int UIWizardNewVDPageExpert::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = UIWizardPage::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        if (_id < 4)
            qt_static_metacall(this, _c, _id, _a);
        _id -= 4;
    }
#ifndef QT_NO_PROPERTIES
      else if (_c == QMetaObject::ReadProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: *reinterpret_cast< CMediumFormat*>(_v) = mediumFormat(); break;
        case 1: *reinterpret_cast< qulonglong*>(_v) = mediumVariant(); break;
        case 2: *reinterpret_cast< QString*>(_v) = mediumPath(); break;
        case 3: *reinterpret_cast< qulonglong*>(_v) = mediumSize(); break;
        }
        _id -= 4;
    } else if (_c == QMetaObject::WriteProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: setMediumFormat(*reinterpret_cast< CMediumFormat*>(_v)); break;
        case 1: setMediumVariant(*reinterpret_cast< qulonglong*>(_v)); break;
        case 3: setMediumSize(*reinterpret_cast< qulonglong*>(_v)); break;
        }
        _id -= 4;
    } else if (_c == QMetaObject::ResetProperty) {
        _id -= 4;
    } else if (_c == QMetaObject::QueryPropertyDesignable) {
        _id -= 4;
    } else if (_c == QMetaObject::QueryPropertyScriptable) {
        _id -= 4;
    } else if (_c == QMetaObject::QueryPropertyStored) {
        _id -= 4;
    } else if (_c == QMetaObject::QueryPropertyEditable) {
        _id -= 4;
    } else if (_c == QMetaObject::QueryPropertyUser) {
        _id -= 4;
    }
#endif // QT_NO_PROPERTIES
    return _id;
}
Example #2
0
UIWizardNewVDPageBasic3::UIWizardNewVDPageBasic3(const QString &strDefaultName, const QString &strDefaultPath, qulonglong uDefaultSize)
    : UIWizardNewVDPage3(strDefaultName, strDefaultPath)
{
    /* Create widgets: */
    QVBoxLayout *pMainLayout = new QVBoxLayout(this);
    {
        m_pLocationLabel = new QIRichTextLabel(this);
        QHBoxLayout *pLocationLayout = new QHBoxLayout;
        {
            m_pLocationEditor = new QLineEdit(this);
            m_pLocationOpenButton = new QIToolButton(this);
            {
                m_pLocationOpenButton->setAutoRaise(true);
                m_pLocationOpenButton->setIcon(UIIconPool::iconSet(":/select_file_16px.png", "select_file_dis_16px.png"));
            }
            pLocationLayout->addWidget(m_pLocationEditor);
            pLocationLayout->addWidget(m_pLocationOpenButton);
        }
        m_pSizeLabel = new QIRichTextLabel(this);
        QGridLayout *m_pSizeLayout = new QGridLayout;
        {
            m_pSizeSlider = new QSlider(this);
            {
                m_pSizeSlider->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
                m_pSizeSlider->setOrientation(Qt::Horizontal);
                m_pSizeSlider->setTickPosition(QSlider::TicksBelow);
                m_pSizeSlider->setFocusPolicy(Qt::StrongFocus);
                m_pSizeSlider->setPageStep(m_iSliderScale);
                m_pSizeSlider->setSingleStep(m_iSliderScale / 8);
                m_pSizeSlider->setTickInterval(0);
                m_pSizeSlider->setMinimum(sizeMBToSlider(m_uMediumSizeMin, m_iSliderScale));
                m_pSizeSlider->setMaximum(sizeMBToSlider(m_uMediumSizeMax, m_iSliderScale));
            }
            m_pSizeEditor = new QILineEdit(this);
            {
                m_pSizeEditor->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
                m_pSizeEditor->setFixedWidthByText("88888.88 MB");
                m_pSizeEditor->setAlignment(Qt::AlignRight);
                m_pSizeEditor->setValidator(new QRegExpValidator(QRegExp(vboxGlobal().sizeRegexp()), this));
            }
            QLabel *m_pSizeMin = new QLabel(this);
            {
                m_pSizeMin->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Fixed);
                m_pSizeMin->setText(vboxGlobal().formatSize(m_uMediumSizeMin));
            }
            QLabel *m_pSizeMax = new QLabel(this);
            {
                m_pSizeMax->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Fixed);
                m_pSizeMax->setText(vboxGlobal().formatSize(m_uMediumSizeMax));
            }
            m_pSizeLayout->addWidget(m_pSizeSlider, 0, 0, 1, 3);
            m_pSizeLayout->addWidget(m_pSizeEditor, 0, 3);
            m_pSizeLayout->addWidget(m_pSizeMin, 1, 0);
            m_pSizeLayout->setColumnStretch(1, 1);
            m_pSizeLayout->addWidget(m_pSizeMax, 1, 2);
        }
        setMediumSize(uDefaultSize);
        pMainLayout->addWidget(m_pLocationLabel);
        pMainLayout->addLayout(pLocationLayout);
        pMainLayout->addWidget(m_pSizeLabel);
        pMainLayout->addLayout(m_pSizeLayout);
        pMainLayout->addStretch();
    }

    /* Setup connections: */
    connect(m_pLocationEditor, SIGNAL(textChanged(const QString &)), this, SIGNAL(completeChanged()));
    connect(m_pLocationOpenButton, SIGNAL(clicked()), this, SLOT(sltSelectLocationButtonClicked()));
    connect(m_pSizeSlider, SIGNAL(valueChanged(int)), this, SLOT(sltSizeSliderValueChanged(int)));
    connect(m_pSizeEditor, SIGNAL(textChanged(const QString &)), this, SLOT(sltSizeEditorTextChanged(const QString &)));

    /* Register fields: */
    registerField("mediumPath", this, "mediumPath");
    registerField("mediumSize", this, "mediumSize");
}
UIWizardNewVDPageExpert::UIWizardNewVDPageExpert(const QString &strDefaultName, const QString &strDefaultPath, qulonglong uDefaultSize)
    : UIWizardNewVDPage3(strDefaultName, strDefaultPath)
{
    /* Create widgets: */
    QGridLayout *pMainLayout = new QGridLayout(this);
    {
        pMainLayout->setContentsMargins(8, 6, 8, 6);
        pMainLayout->setSpacing(10);
        m_pLocationCnt = new QGroupBox(this);
        {
            m_pLocationCnt->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed);
            QHBoxLayout *pLocationCntLayout = new QHBoxLayout(m_pLocationCnt);
            {
                m_pLocationEditor = new QLineEdit(m_pLocationCnt);
                {
                    m_pLocationEditor->setText(m_strDefaultName);
                }
                m_pLocationOpenButton = new QIToolButton(m_pLocationCnt);
                {
                    m_pLocationOpenButton->setAutoRaise(true);
                    m_pLocationOpenButton->setIcon(UIIconPool::iconSet(":/select_file_16px.png", "select_file_disabled_16px.png"));
                }
                pLocationCntLayout->addWidget(m_pLocationEditor);
                pLocationCntLayout->addWidget(m_pLocationOpenButton);
            }
        }
        m_pSizeCnt = new QGroupBox(this);
        {
            m_pSizeCnt->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed);
            QGridLayout *pSizeCntLayout = new QGridLayout(m_pSizeCnt);
            {
                m_pSizeSlider = new QSlider(m_pSizeCnt);
                {
                    m_pSizeSlider->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
                    m_pSizeSlider->setOrientation(Qt::Horizontal);
                    m_pSizeSlider->setTickPosition(QSlider::TicksBelow);
                    m_pSizeSlider->setFocusPolicy(Qt::StrongFocus);
                    m_pSizeSlider->setPageStep(m_iSliderScale);
                    m_pSizeSlider->setSingleStep(m_iSliderScale / 8);
                    m_pSizeSlider->setTickInterval(0);
                    m_pSizeSlider->setMinimum(sizeMBToSlider(m_uMediumSizeMin, m_iSliderScale));
                    m_pSizeSlider->setMaximum(sizeMBToSlider(m_uMediumSizeMax, m_iSliderScale));
                }
                m_pSizeEditor = new QILineEdit(m_pSizeCnt);
                {
                    m_pSizeEditor->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
                    m_pSizeEditor->setFixedWidthByText("88888.88 MB");
                    m_pSizeEditor->setAlignment(Qt::AlignRight);
                    m_pSizeEditor->setValidator(new QRegExpValidator(QRegExp(vboxGlobal().sizeRegexp()), this));
                }
                QLabel *m_pSizeMin = new QLabel(m_pSizeCnt);
                {
                    m_pSizeMin->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Fixed);
                    m_pSizeMin->setText(vboxGlobal().formatSize(m_uMediumSizeMin));
                }
                QLabel *m_pSizeMax = new QLabel(m_pSizeCnt);
                {
                    m_pSizeMax->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Fixed);
                    m_pSizeMax->setText(vboxGlobal().formatSize(m_uMediumSizeMax));
                }
                pSizeCntLayout->addWidget(m_pSizeSlider, 0, 0, 1, 3);
                pSizeCntLayout->addWidget(m_pSizeEditor, 0, 3);
                pSizeCntLayout->addWidget(m_pSizeMin, 1, 0);
                pSizeCntLayout->setColumnStretch(1, 1);
                pSizeCntLayout->addWidget(m_pSizeMax, 1, 2);
            }
        }
        m_pFormatCnt = new QGroupBox(this);
        {
            m_pFormatCnt->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed);
            QVBoxLayout *pFormatCntLayout = new QVBoxLayout(m_pFormatCnt);
            {
                m_pFormatButtonGroup = new QButtonGroup(m_pFormatCnt);
                {
                    CSystemProperties systemProperties = vboxGlobal().virtualBox().GetSystemProperties();
                    const QVector<CMediumFormat> &medFormats = systemProperties.GetMediumFormats();
                    for (int i = 0; i < medFormats.size(); ++i)
                    {
                        const CMediumFormat &medFormat = medFormats[i];
                        if (medFormat.GetName() == "VDI")
                            addFormatButton(m_pFormatCnt, pFormatCntLayout, medFormat);
                    }
                    for (int i = 0; i < medFormats.size(); ++i)
                    {
                        const CMediumFormat &medFormat = medFormats[i];
                        if (medFormat.GetName() != "VDI")
                            addFormatButton(m_pFormatCnt, pFormatCntLayout, medFormat);
                    }
                    if (!m_pFormatButtonGroup->buttons().isEmpty())
                    {
                        m_pFormatButtonGroup->button(0)->click();
                        m_pFormatButtonGroup->button(0)->setFocus();
                    }
                }
            }
        }
        m_pVariantCnt = new QGroupBox(this);
        {
            m_pVariantCnt->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed);
            QVBoxLayout *pVariantCntLayout = new QVBoxLayout(m_pVariantCnt);
            {
                m_pVariantButtonGroup = new QButtonGroup(m_pVariantCnt);
                {
                    m_pDynamicalButton = new QRadioButton(m_pVariantCnt);
                    {
                        m_pDynamicalButton->click();
                        m_pDynamicalButton->setFocus();
                    }
                    m_pFixedButton = new QRadioButton(m_pVariantCnt);
                    m_pVariantButtonGroup->addButton(m_pDynamicalButton, 0);
                    m_pVariantButtonGroup->addButton(m_pFixedButton, 1);
                }
                m_pSplitBox = new QCheckBox(m_pVariantCnt);
                pVariantCntLayout->addWidget(m_pDynamicalButton);
                pVariantCntLayout->addWidget(m_pFixedButton);
                pVariantCntLayout->addWidget(m_pSplitBox);
            }
        }
        pMainLayout->addWidget(m_pLocationCnt, 0, 0, 1, 2);
        pMainLayout->addWidget(m_pSizeCnt, 1, 0, 1, 2);
        pMainLayout->addWidget(m_pFormatCnt, 2, 0, Qt::AlignTop);
        pMainLayout->addWidget(m_pVariantCnt, 2, 1, Qt::AlignTop);
        setMediumSize(uDefaultSize);
        sltMediumFormatChanged();
    }

    /* Setup connections: */
    connect(m_pFormatButtonGroup, SIGNAL(buttonClicked(QAbstractButton*)), this, SLOT(sltMediumFormatChanged()));
    connect(m_pVariantButtonGroup, SIGNAL(buttonClicked(QAbstractButton *)), this, SIGNAL(completeChanged()));
    connect(m_pSplitBox, SIGNAL(stateChanged(int)), this, SIGNAL(completeChanged()));
    connect(m_pLocationEditor, SIGNAL(textChanged(const QString &)), this, SIGNAL(completeChanged()));
    connect(m_pLocationOpenButton, SIGNAL(clicked()), this, SLOT(sltSelectLocationButtonClicked()));
    connect(m_pSizeSlider, SIGNAL(valueChanged(int)), this, SLOT(sltSizeSliderValueChanged(int)));
    connect(m_pSizeEditor, SIGNAL(textChanged(const QString &)), this, SLOT(sltSizeEditorTextChanged(const QString &)));

    /* Register classes: */
    qRegisterMetaType<CMediumFormat>();
    /* Register fields: */
    registerField("mediumFormat", this, "mediumFormat");
    registerField("mediumVariant", this, "mediumVariant");
    registerField("mediumPath", this, "mediumPath");
    registerField("mediumSize", this, "mediumSize");
}