VirtualBox

Changeset 85978 in vbox for trunk/src


Ignore:
Timestamp:
Sep 1, 2020 1:52:24 PM (4 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9812: Global preferences: Prepare cascade cleanup for General page.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/settings/global
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsGeneral.cpp

    r85813 r85978  
    6666UIGlobalSettingsGeneral::UIGlobalSettingsGeneral()
    6767    : m_pCache(0)
     68    , m_pLabelMachineFolder(0)
    6869    , m_pSelectorMachineFolder(0)
     70    , m_pLabelVRDPLibName(0)
    6971    , m_pSelectorVRDPLibName(0)
     72    , m_pLabelHostScreenSaver(0)
    7073    , m_pCheckBoxHostScreenSaver(0)
    71     , m_pLabelMachineFolder(0)
    72     , m_pLabelHostScreenSaver(0)
    73     , m_pLabelVRDPLibName(0)
    7474{
    7575    /* Prepare: */
     
    157157void UIGlobalSettingsGeneral::prepare()
    158158{
    159     prepareWidgets();
    160 
    161159    /* Prepare cache: */
    162160    m_pCache = new UISettingsCacheGlobalGeneral;
    163161    AssertPtrReturnVoid(m_pCache);
    164162
    165     /* Layout/widgets created in the .ui file. */
    166     AssertPtrReturnVoid(m_pLabelHostScreenSaver);
    167     AssertPtrReturnVoid(m_pCheckBoxHostScreenSaver);
    168     AssertPtrReturnVoid(m_pSelectorMachineFolder);
    169     AssertPtrReturnVoid(m_pSelectorVRDPLibName);
    170     {
    171         /* Configure host screen-saver check-box: */
    172         // Hide checkbox for now.
    173         m_pLabelHostScreenSaver->hide();
    174         m_pCheckBoxHostScreenSaver->hide();
    175 
    176         /* Configure other widgets: */
    177         m_pSelectorMachineFolder->setHomeDir(uiCommon().homeFolder());
    178         m_pSelectorVRDPLibName->setHomeDir(uiCommon().homeFolder());
    179         m_pSelectorVRDPLibName->setMode(UIFilePathSelector::Mode_File_Open);
    180     }
     163    /* Prepare everything: */
     164    prepareWidgets();
    181165
    182166    /* Apply language settings: */
     
    186170void UIGlobalSettingsGeneral::prepareWidgets()
    187171{
    188     if (objectName().isEmpty())
    189         setObjectName(QStringLiteral("UIGlobalSettingsGeneral"));
    190     QGridLayout *pMainLayout = new QGridLayout(this);
    191     pMainLayout->setContentsMargins(0, 0, 0, 0);
    192     pMainLayout->setObjectName(QStringLiteral("pMainLayout"));
    193     m_pLabelMachineFolder = new QLabel();
    194     m_pLabelMachineFolder->setObjectName(QStringLiteral("m_pLabelMachineFolder"));
    195     m_pLabelMachineFolder->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
    196     pMainLayout->addWidget(m_pLabelMachineFolder, 0, 0, 1, 1);
    197 
    198     m_pSelectorMachineFolder = new UIFilePathSelector();
    199     m_pSelectorMachineFolder->setObjectName(QStringLiteral("m_pSelectorMachineFolder"));
    200     QSizePolicy sizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed);
    201     sizePolicy.setHorizontalStretch(0);
    202     sizePolicy.setVerticalStretch(0);
    203     sizePolicy.setHeightForWidth(m_pSelectorMachineFolder->sizePolicy().hasHeightForWidth());
    204     m_pSelectorMachineFolder->setSizePolicy(sizePolicy);
    205     pMainLayout->addWidget(m_pSelectorMachineFolder, 0, 1, 1, 2);
    206 
    207     m_pLabelVRDPLibName = new QLabel();
    208     m_pLabelVRDPLibName->setObjectName(QStringLiteral("m_pLabelVRDPLibName"));
    209     m_pLabelVRDPLibName->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
    210     pMainLayout->addWidget(m_pLabelVRDPLibName, 1, 0, 1, 1);
    211 
    212     m_pSelectorVRDPLibName = new UIFilePathSelector();
    213     m_pSelectorVRDPLibName->setObjectName(QStringLiteral("m_pSelectorVRDPLibName"));
    214     sizePolicy.setHeightForWidth(m_pSelectorVRDPLibName->sizePolicy().hasHeightForWidth());
    215     m_pSelectorVRDPLibName->setSizePolicy(sizePolicy);
    216     pMainLayout->addWidget(m_pSelectorVRDPLibName, 1, 1, 1, 2);
    217 
    218     m_pLabelHostScreenSaver = new QLabel();
    219     m_pLabelHostScreenSaver->setObjectName(QStringLiteral("m_pLabelHostScreenSaver"));
    220     m_pLabelHostScreenSaver->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
    221     pMainLayout->addWidget(m_pLabelHostScreenSaver, 2, 0, 1, 1);
    222 
    223     m_pCheckBoxHostScreenSaver = new QCheckBox();
    224     m_pCheckBoxHostScreenSaver->setObjectName(QStringLiteral("m_pCheckBoxHostScreenSaver"));
    225     pMainLayout->addWidget(m_pCheckBoxHostScreenSaver, 2, 1, 1, 1);
    226 
    227     QSpacerItem *pSpacerItem = new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding);
    228     pMainLayout->addItem(pSpacerItem, 3, 0, 1, 3);
    229 
    230     m_pLabelMachineFolder->setBuddy(m_pSelectorMachineFolder);
    231     m_pLabelVRDPLibName->setBuddy(m_pSelectorVRDPLibName);
    232     m_pLabelHostScreenSaver->setBuddy(m_pCheckBoxHostScreenSaver);
     172    /* Prepare main layout: */
     173    QGridLayout *pLayoutMain = new QGridLayout(this);
     174    if (pLayoutMain)
     175    {
     176        pLayoutMain->setContentsMargins(0, 0, 0, 0);
     177        pLayoutMain->setColumnStretch(1, 1);
     178        pLayoutMain->setRowStretch(3, 1);
     179
     180        /* Prepare machine folder label: */
     181        m_pLabelMachineFolder = new QLabel(this);
     182        if (m_pLabelMachineFolder)
     183        {
     184            m_pLabelMachineFolder->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
     185            pLayoutMain->addWidget(m_pLabelMachineFolder, 0, 0);
     186        }
     187        /* Prepare machine folder selector: */
     188        m_pSelectorMachineFolder = new UIFilePathSelector(this);
     189        if (m_pSelectorMachineFolder)
     190        {
     191            if (m_pLabelMachineFolder)
     192                m_pLabelMachineFolder->setBuddy(m_pSelectorMachineFolder);
     193            m_pSelectorMachineFolder->setHomeDir(uiCommon().homeFolder());
     194
     195            pLayoutMain->addWidget(m_pSelectorMachineFolder, 0, 1, 1, 2);
     196        }
     197
     198        /* Prepare VRDP library name label: */
     199        m_pLabelVRDPLibName = new QLabel(this);
     200        if (m_pLabelVRDPLibName)
     201        {
     202            m_pLabelVRDPLibName->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
     203            pLayoutMain->addWidget(m_pLabelVRDPLibName, 1, 0);
     204        }
     205        /* Prepare VRDP library name selector: */
     206        m_pSelectorVRDPLibName = new UIFilePathSelector(this);
     207        if (m_pSelectorVRDPLibName)
     208        {
     209            if (m_pLabelVRDPLibName)
     210                m_pLabelVRDPLibName->setBuddy(m_pSelectorVRDPLibName);
     211            m_pSelectorVRDPLibName->setHomeDir(uiCommon().homeFolder());
     212            m_pSelectorVRDPLibName->setMode(UIFilePathSelector::Mode_File_Open);
     213
     214            pLayoutMain->addWidget(m_pSelectorVRDPLibName, 1, 1, 1, 2);
     215        }
     216
     217        /* Prepare screen-saver label: */
     218        m_pLabelHostScreenSaver = new QLabel(this);
     219        if (m_pLabelHostScreenSaver)
     220        {
     221            m_pLabelHostScreenSaver->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
     222            m_pLabelHostScreenSaver->hide();
     223            pLayoutMain->addWidget(m_pLabelHostScreenSaver, 2, 0);
     224        }
     225        /* Prepare screen-saver check-box: */
     226        m_pCheckBoxHostScreenSaver = new QCheckBox(this);
     227        if (m_pCheckBoxHostScreenSaver)
     228        {
     229            if (m_pLabelHostScreenSaver)
     230                m_pLabelHostScreenSaver->setBuddy(m_pCheckBoxHostScreenSaver);
     231            m_pCheckBoxHostScreenSaver->hide();
     232            pLayoutMain->addWidget(m_pCheckBoxHostScreenSaver, 2, 1);
     233        }
     234    }
    233235}
    234236
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsGeneral.h

    r85813 r85978  
    8080    /** @name Widgets
    8181     * @{ */
    82        UIFilePathSelector *m_pSelectorMachineFolder;
    83        UIFilePathSelector *m_pSelectorVRDPLibName;
    84        QCheckBox *m_pCheckBoxHostScreenSaver;
    85        QLabel *m_pLabelMachineFolder;
    86        QLabel *m_pLabelHostScreenSaver;
    87        QLabel *m_pLabelVRDPLibName;
     82        /** Holds machine folder label instance. */
     83        QLabel             *m_pLabelMachineFolder;
     84        /** Holds machine folder selector instance. */
     85        UIFilePathSelector *m_pSelectorMachineFolder;
     86        /** Holds VRDP library name label instance. */
     87        QLabel             *m_pLabelVRDPLibName;
     88        /** Holds VRDP library name selector instance. */
     89        UIFilePathSelector *m_pSelectorVRDPLibName;
     90        /** Holds screen-saver label instance. */
     91        QLabel             *m_pLabelHostScreenSaver;
     92        /** Holds disable screen-saver check-box instance. */
     93        QCheckBox          *m_pCheckBoxHostScreenSaver;
    8894    /** @} */
    8995};
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette