Exemplo n.º 1
0
StoreStreamDlg::StoreStreamDlg(QWidget *parent, QSettings *settings, int index)
	: QDialog(parent, Qt::WindowSystemMenuHint | Qt::WindowTitleHint)
{
	m_index = index;
	m_settings = settings;
	layoutWidgets();
	connect(m_cancelButton, SIGNAL(clicked()), this, SLOT(cancelButtonClick()));
	connect(m_okButton, SIGNAL(clicked()), this, SLOT(okButtonClick()));
	loadCurrentValues();
}
Exemplo n.º 2
0
BoggleWindow::BoggleWindow(QWidget * parent)
 : QWidget(parent)
{
    this->setWindowTitle("Boggle");
    setUpBoggleBoard();
    setUpOptionsContainer();
    setUpFoundWordLists();
    QLayout *layout3 = setUpNotificationArea();
    QLayout *layout4 = setUpTextEntry();
    layoutWidgets(layout3, layout4);
}
bool UIGraphicsScrollArea::eventFilter(QObject *pObject, QEvent *pEvent)
{
    /* Handle layout requests for m_pViewport if set: */
    if (   m_pViewport
        && pObject == m_pViewport
        && pEvent->type() == QEvent::LayoutRequest)
        layoutWidgets();

    /* Handle wheel events for first scene view if set: */
    if (   scene()
        && !scene()->views().isEmpty()
        && pObject == scene()->views().first()
        && pEvent->type() == QEvent::Wheel)
    {
        QWheelEvent *pWheelEvent = static_cast<QWheelEvent*>(pEvent);
        const QPoint angleDelta = pWheelEvent->angleDelta();
#ifdef VBOX_WS_MAC
        const QPoint pixelDelta = pWheelEvent->pixelDelta();
#endif
        switch (m_enmOrientation)
        {
            /* Scroll viewport horizontally: */
            case Qt::Horizontal:
            {
                if (angleDelta.x() > 0)
                    m_pScrollBar->setValue(m_pScrollBar->value() - m_pScrollBar->step());
                else if (angleDelta.x() < 0)
                    m_pScrollBar->setValue(m_pScrollBar->value() + m_pScrollBar->step());
                break;
            }
            /* Scroll viewport vertically: */
            case Qt::Vertical:
            {
                if (angleDelta.y() > 0)
#ifdef VBOX_WS_MAC
                    m_pScrollBar->setValue(m_pScrollBar->value() - pixelDelta.y());
#else
                    m_pScrollBar->setValue(m_pScrollBar->value() - m_pScrollBar->step());
#endif
                else if (angleDelta.y() < 0)
#ifdef VBOX_WS_MAC
                    m_pScrollBar->setValue(m_pScrollBar->value() - pixelDelta.y());
#else
                    m_pScrollBar->setValue(m_pScrollBar->value() + m_pScrollBar->step());
#endif
                break;
            }
        }
Exemplo n.º 4
0
void EmulatedCardWindow::setMaximized(bool enable) {

	refreshAdjustmentAngle();

	if (enable) {
		layoutWidgets();
		if (!m_fullScreenMode) { m_statusBar->show(); }
		m_gestureStrip->show();
		m_keyboardButton->show();
	} else {
		m_statusBar->hide();
		m_gestureStrip->hide();
		m_keyboardButton->hide();
	}
	CardWindow::setMaximized(enable);
}
Exemplo n.º 5
0
void ItemView::update()
{
    while (mScrollView->getChildCount())
        MyGUI::Gui::getInstance().destroyWidget(mScrollView->getChildAt(0));

    if (!mModel)
        return;

    mModel->update();

    MyGUI::Widget* dragArea = mScrollView->createWidget<MyGUI::Widget>("",0,0,mScrollView->getWidth(),mScrollView->getHeight(),
                                                                       MyGUI::Align::Stretch);
    dragArea->setNeedMouseFocus(true);
    dragArea->eventMouseButtonClick += MyGUI::newDelegate(this, &ItemView::onSelectedBackground);
    dragArea->eventMouseWheel += MyGUI::newDelegate(this, &ItemView::onMouseWheel);

    for (ItemModel::ModelIndex i=0; i<static_cast<int>(mModel->getItemCount()); ++i)
    {
        const ItemStack& item = mModel->getItem(i);

        ItemWidget* itemWidget = dragArea->createWidget<ItemWidget>("MW_ItemIcon",
            MyGUI::IntCoord(0, 0, 42, 42), MyGUI::Align::Default);
        itemWidget->setUserString("ToolTipType", "ItemModelIndex");
        itemWidget->setUserData(std::make_pair(i, mModel));
        ItemWidget::ItemState state = ItemWidget::None;
        if (item.mType == ItemStack::Type_Barter)
            state = ItemWidget::Barter;
        if (item.mType == ItemStack::Type_Equipped)
            state = ItemWidget::Equip;
        itemWidget->setItem(item.mBase, state);

        itemWidget->eventMouseButtonClick += MyGUI::newDelegate(this, &ItemView::onSelectedItem);
        itemWidget->eventMouseWheel += MyGUI::newDelegate(this, &ItemView::onMouseWheel);

        // text widget that shows item count
        // TODO: move to ItemWidget
        MyGUI::TextBox* text = itemWidget->createWidget<MyGUI::TextBox>("SandBrightText",
            MyGUI::IntCoord(5, 19, 32, 18), MyGUI::Align::Default, std::string("Label"));
        text->setTextAlign(MyGUI::Align::Right);
        text->setNeedMouseFocus(false);
        text->setTextShadow(true);
        text->setTextShadowColour(MyGUI::Colour(0,0,0));
        text->setCaption(getCountString(item.mCount));
    }

    layoutWidgets();
}
void UIGraphicsScrollArea::setViewport(QIGraphicsWidget *pViewport)
{
    /* Forget previous widget: */
    if (m_pViewport)
    {
        m_pViewport->removeEventFilter(this);
        m_pViewport->setParentItem(0);
        m_pViewport = 0;
    }

    /* Remember passed widget: */
    if (pViewport)
    {
        m_pViewport = pViewport;
        m_pViewport->setParentItem(this);
        m_pViewport->installEventFilter(this);
    }

    /* Layout widgets: */
    layoutWidgets();
}
Exemplo n.º 7
0
void ItemView::update()
{
    while (mScrollView->getChildCount())
        MyGUI::Gui::getInstance().destroyWidget(mScrollView->getChildAt(0));

    if (!mModel)
        return;

    mModel->update();

    MyGUI::Widget* dragArea = mScrollView->createWidget<MyGUI::Widget>("",0,0,mScrollView->getWidth(),mScrollView->getHeight(),
                                                                       MyGUI::Align::Stretch);
    dragArea->setNeedMouseFocus(true);
    dragArea->eventMouseButtonClick += MyGUI::newDelegate(this, &ItemView::onSelectedBackground);
    dragArea->eventMouseWheel += MyGUI::newDelegate(this, &ItemView::onMouseWheelMoved);

    for (ItemModel::ModelIndex i=0; i<static_cast<int>(mModel->getItemCount()); ++i)
    {
        const ItemStack& item = mModel->getItem(i);

        ItemWidget* itemWidget = dragArea->createWidget<ItemWidget>("MW_ItemIcon",
            MyGUI::IntCoord(0, 0, 42, 42), MyGUI::Align::Default);
        itemWidget->setUserString("ToolTipType", "ItemModelIndex");
        itemWidget->setUserData(std::make_pair(i, mModel));
        ItemWidget::ItemState state = ItemWidget::None;
        if (item.mType == ItemStack::Type_Barter)
            state = ItemWidget::Barter;
        if (item.mType == ItemStack::Type_Equipped)
            state = ItemWidget::Equip;
        itemWidget->setItem(item.mBase, state);
        itemWidget->setCount(item.mCount);

        itemWidget->eventMouseButtonClick += MyGUI::newDelegate(this, &ItemView::onSelectedItem);
        itemWidget->eventMouseWheel += MyGUI::newDelegate(this, &ItemView::onMouseWheelMoved);
    }

    layoutWidgets();
}
Exemplo n.º 8
0
DescrGeneratorInterface::DescrGeneratorInterface (QWidget* parent, MainWindow* window) :
    QWidget(parent),
    parentWindow(window),
    labelMainTemplate(new QLabel("Main Template", this)),
    editMainTemplate(new QLineEdit(this)),
    buttonMainTemplate(new QPushButton("Apri", this)),
    labelResourcesTemplate(new QLabel("Res. Template", this)),
    editResourcesTemplate(new QLineEdit(this)),
    buttonResourcesTemplate(new QPushButton("Apri", this)),
    labelVideoResourcesTemplate(new QLabel("Video Res. Template", this)),
    editVideoResourcesTemplate(new QLineEdit(this)),
    buttonVideoResourcesTemplate(new QPushButton("Apri", this)),
    labelVideoTemplate(new QLabel("Video Template", this)),
    editVideoTemplate(new QLineEdit(this)),
    buttonVideoTemplate(new QPushButton("Apri", this)),
    labelCatMerc(new QLabel("Cat. Merc.", this)),
    editCatMerc(new QLineEdit(this)),
    labelNatura(new QLabel("Natura", this)),
    editNatura(new QLineEdit(this)),
    labelFile(new QLabel("File destinazione", this)),
    editFile(new QLineEdit(this)),
    buttonFile(new QPushButton("Scegli", this)),
    buttonCrea(new QPushButton("Crea", this)),
    layoutButton(new QHBoxLayout),
    gridLayout(new QGridLayout(this)),
    progress(new QProgressBar(this)),
    worker_thread(0),
    generator(0)
{
    setLayout(gridLayout);

    resizeWidgets();
    layoutWidgets();
    connectWidgets();
    loadConfig();
}
Exemplo n.º 9
0
    void SpellView::update()
    {
        if (!mModel.get())
            return;

        mModel->update();

        int curType = -1;

        const int spellHeight = 18;

        mLines.clear();

        while (mScrollView->getChildCount())
            MyGUI::Gui::getInstance().destroyWidget(mScrollView->getChildAt(0));

        for (SpellModel::ModelIndex i = 0; i<int(mModel->getItemCount()); ++i)
        {
            const Spell& spell = mModel->getItem(i);
            if (curType != spell.mType)
            {
                if (spell.mType == Spell::Type_Power)
                    addGroup("#{sPowers}", "");
                else if (spell.mType == Spell::Type_Spell)
                    addGroup("#{sSpells}", "#{sCostChance}");
                else
                    addGroup("#{sMagicItem}", "#{sCostCharge}");
                curType = spell.mType;
            }

            const std::string skin = spell.mActive ? "SandTextButton" : "SpellTextUnequipped";

            Gui::SharedStateButton* t = mScrollView->createWidget<Gui::SharedStateButton>(skin,
                MyGUI::IntCoord(0, 0, 0, spellHeight), MyGUI::Align::Left | MyGUI::Align::Top);
            t->setCaption(spell.mName);
            t->setTextAlign(MyGUI::Align::Left);
            adjustSpellWidget(spell, i, t);

            if (!spell.mCostColumn.empty() && mShowCostColumn)
            {
                Gui::SharedStateButton* costChance = mScrollView->createWidget<Gui::SharedStateButton>(skin,
                    MyGUI::IntCoord(0, 0, 0, spellHeight), MyGUI::Align::Left | MyGUI::Align::Top);
                costChance->setCaption(spell.mCostColumn);
                costChance->setTextAlign(MyGUI::Align::Right);
                adjustSpellWidget(spell, i, costChance);

                Gui::ButtonGroup group;
                group.push_back(t);
                group.push_back(costChance);
                Gui::SharedStateButton::createButtonGroup(group);

                mLines.push_back(LineInfo(t, costChance, i));
            }
            else
                mLines.push_back(LineInfo(t, (MyGUI::Widget*)NULL, i));

            t->setStateSelected(spell.mSelected);
        }

        layoutWidgets();
    }
Exemplo n.º 10
0
void EmulatedCardWindow::onSetAppOrientation(int orientation) {
	refreshAdjustmentAngle();
	layoutWidgets();
}
Exemplo n.º 11
0
void XProcessTablePrivate::relayout()
{
    qreal initY = 0;
    layoutWidgets(_items,initY);
}
Exemplo n.º 12
0
void EmulatedCardWindow::slotUiRotated() {
	refreshAdjustmentAngle();
	layoutWidgets();

}
Exemplo n.º 13
0
EmulatedCardWindow::EmulatedCardWindow(Window::Type type, HostWindowData* data, IpcClientHost* clientHost)
	: CardWindow(type, data, clientHost)
	, m_fullScreenMode(false)
	, m_appFreeOrientation(false)
	, m_positiveSpaceChanging(false)
        , m_smoothEdgeShaderStage(0)
	, m_keyboardUpManually(false)
{

	m_positiveSpaceAdjustment = 0;
	m_screenMidLine = 0;
	//NOTE: it seems the bounding rect may have a width and height of 0 at this time
	//making brect's use in the calculation below pointless

	QRectF brect = boundingRect();
	int emuWidth = Settings::LunaSettings()->emulatedCardWidth;
	int emuHeight = Settings::LunaSettings()->emulatedCardHeight - Settings::LunaSettings()->positiveSpaceTopPadding;

	//Center emu card in its bounding card
	int x = (brect.x() + (brect.width()/2)) - (emuWidth/2);
	int y = (brect.y() + (brect.height()/2)) - (emuHeight/2);

	QRectF emuRect(x,y,emuWidth,emuHeight);
	m_emulationBoundingRect = emuRect;

	//Start out with a screen mid-line that is half the buffer height.
	m_screenMidLine = (SystemUiController::instance()->currentUiHeight() - Settings::LunaSettings()->positiveSpaceTopPadding)/2;

	//Find the right angle to start bringing in this card at.
	//This will control the rotation angle for rendering the
	//card, how the widgets are laid out, etc.

	refreshAdjustmentAngle();

	//Note that these assets are hidden at initialization.  They will be shown the
	//first time the card is maximized.

	m_gestureStrip = new VirtualCoreNavi(emuWidth, 66);
	m_gestureStrip->setParentItem(this);
	m_gestureStrip->hide();

	//Set the accepted corenavi gestures.  We're currently supporting...only back.
	QList<Qt::Key> acceptedKeys;
	acceptedKeys.append(Qt::Key_CoreNavi_Back);
	m_gestureStrip->setAcceptedKeys(acceptedKeys);
	m_gestureStrip->setTapGesture(Qt::Key_CoreNavi_Back);

	m_statusBar = new StatusBar(StatusBar::TypeEmulatedCard, emuWidth, Settings::LunaSettings()->positiveSpaceTopPadding);
	m_statusBar->setParentItem(this);
	m_statusBar->init();
	m_statusBar->hide();

	m_keyboardButton = new PixmapButton(QPixmap (qFromUtf8Stl(KEYBOARD_UP_BUTTON)),
										QRect(0,0,52,44), QRect(0,44,52,44));
	m_keyboardButton->setParentItem(this);
	m_keyboardButton->setManualMode(true);
	m_keyboardButton->hide();
	m_keyboardButton->createLargerHitTargetRect(10,10);
		connect(m_keyboardButton,SIGNAL(clickComplete()),SLOT(slotKeyboardUpClicked()));
	layoutWidgets();

	//And now to load the rounded corners.  These are drawn in by paintBase()

	m_upperLeftCorner = s_upperLeftCorner.toStrongRef();
	if (m_upperLeftCorner.isNull()) {
		QPixmap corner = QPixmap::fromImage(QImage(qFromUtf8Stl(UPPER_LEFT_CORNER)));
		if (corner.isNull()) {
			corner = QPixmap(10, 10);
			corner.fill(Qt::transparent);
		}
		m_upperLeftCorner = QSharedPointer<QPixmap>(new QPixmap(corner));
		s_upperLeftCorner = m_upperLeftCorner.toWeakRef();
	}

	m_upperRightCorner = s_upperRightCorner.toStrongRef();
	if (m_upperRightCorner.isNull()) {
		QPixmap corner = QPixmap::fromImage(QImage(qFromUtf8Stl(UPPER_RIGHT_CORNER)));
		if (corner.isNull()) {
			corner = QPixmap(10, 10);
			corner.fill(Qt::transparent);
		}
		m_upperRightCorner = QSharedPointer<QPixmap>(new QPixmap(corner));
		s_upperRightCorner = m_upperRightCorner.toWeakRef();
	}

	m_lowerLeftCorner = s_lowerLeftCorner.toStrongRef();
	if (m_lowerLeftCorner.isNull()) {
		QPixmap corner = QPixmap::fromImage(QImage(qFromUtf8Stl(LOWER_LEFT_CORNER)));
		if (corner.isNull()) {
			corner = QPixmap(10, 10);
			corner.fill(Qt::transparent);
		}
		m_lowerLeftCorner = QSharedPointer<QPixmap>(new QPixmap(corner));
		s_lowerLeftCorner = m_lowerLeftCorner.toWeakRef();
	}

	m_lowerRightCorner = s_lowerRightCorner.toStrongRef();
	if (m_lowerRightCorner.isNull()) {
		QPixmap corner = QPixmap::fromImage(QImage(qFromUtf8Stl(LOWER_RIGHT_CORNER)));
		if (corner.isNull()) {
			corner = QPixmap(10, 10);
			corner.fill(Qt::transparent);
		}
		m_lowerRightCorner = QSharedPointer<QPixmap>(new QPixmap(corner));
		s_lowerRightCorner = m_lowerRightCorner.toWeakRef();
	}

	m_deviceFrame = s_deviceFrame.toStrongRef();
	if (m_deviceFrame.isNull()) {
		QPixmap corner = QPixmap::fromImage(QImage(qFromUtf8Stl(DEVICE_FRAME)));
		if (corner.isNull()) {
			corner = QPixmap(10, 10);
			corner.fill(Qt::transparent);
		}
		m_deviceFrame = QSharedPointer<QPixmap>(new QPixmap(corner));
		s_deviceFrame = m_deviceFrame.toWeakRef();
        }

        m_background = s_background.toStrongRef();
        if (m_background.isNull()) {
                QPixmap corner = QPixmap::fromImage(QImage(qFromUtf8Stl(BACKGROUND)));
                if (corner.isNull()) {
                        corner = QPixmap(10, 10);
                        corner.fill(Qt::transparent);
                }
                m_background = QSharedPointer<QPixmap>(new QPixmap(corner));
                s_background = m_background.toWeakRef();
        }

	grabGesture(Qt::TapGesture);
}
Exemplo n.º 14
0
void EmulatedCardWindow::onSetAppFreeOrientation(bool freeOrientation) {
	m_appFreeOrientation = freeOrientation;
	refreshAdjustmentAngle();
	layoutWidgets();
}
Exemplo n.º 15
0
void EmulatedCardWindow::calculatePositiveSpaceAdjustment() {
	m_positiveSpaceAdjustment = m_screenMidLine - (m_positiveSpace/2);
	layoutWidgets();
}
Exemplo n.º 16
0
void XProcessTablePrivate::layoutWidget(XProcessItem *item,qreal& initY)
{
    // guard clause
    // for safe releasing memory use
    if(!item)
    {
        return ;
    }

    if(_allColumnWidth.size() > 0)
    {
        qreal initX = 0;
        qreal endX = 0;

        Container<BaseDisplayWidget*> widgets = item->getColumnWidgets();
        for(int i = 0;i < widgets.size();i++)
        {
            QPointF topLeft(initX,initY);
            QPointF bottomRight(initX + _allColumnWidth.at(i),initY + XPT::Constant::RowHeight);

            BaseDisplayWidget* widget = widgets[i];

            if(!widget)
            {
                continue;
            }

            if(widget->widgetType() != Progress)
            {
                topLeft.setX(topLeft.x() + XPT::Constant::ExtraSpace);
                bottomRight.setX(bottomRight.x() - XPT::Constant::ExtraSpace);
            }
            else
            {
                topLeft.setY(topLeft.y() + XPT::Constant::TinySpace);
                bottomRight.setY(bottomRight.y() - XPT::Constant::TinySpace);
            }

            QRectF itemRect(topLeft,bottomRight);

            widget->resize(itemRect.size().toSize());
            widget->move(topLeft.toPoint());

            // hide name since we will draw it
            widget->show();

            // increment initX
            initX += _allColumnWidth.at(i);

            if(item->hasChild() && item->expanded())
            {
                layoutWidgets(item->children(),initY);
            }
        }

        // increment initY
        initY += XPT::Constant::RowHeight;

        setMinimumHeight(initY);

    }
}
Exemplo n.º 17
0
void GamesViewItem::setModelIndex( const QModelIndex& index )
{
    m_index = index;
    layoutWidgets();
    setToolTips();
}