VirtualBox

Changeset 85033 in vbox for trunk/src/VBox/Frontends


Ignore:
Timestamp:
Jul 1, 2020 4:27:40 PM (5 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
138934
Message:

FE/Qt: bugref:9653: Cloud Profile Manager: A bit of connections cleanup.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/cloud/profilemanager
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/cloud/profilemanager/UICloudProfileManager.cpp

    r83950 r85033  
    573573    addAction(m_pActionPool->action(UIActionIndexST_M_Cloud_S_TryPage));
    574574    addAction(m_pActionPool->action(UIActionIndexST_M_Cloud_S_Help));
    575 
    576     /* Connect actions: */
     575}
     576
     577void UICloudProfileManagerWidget::prepareWidgets()
     578{
     579    /* Create main-layout: */
     580    new QVBoxLayout(this);
     581    if (layout())
     582    {
     583        /* Configure layout: */
     584        layout()->setContentsMargins(0, 0, 0, 0);
     585#ifdef VBOX_WS_MAC
     586        layout()->setSpacing(10);
     587#else
     588        layout()->setSpacing(qApp->style()->pixelMetric(QStyle::PM_LayoutVerticalSpacing) / 2);
     589#endif
     590
     591        /* Prepare toolbar, if requested: */
     592        if (m_fShowToolbar)
     593            prepareToolBar();
     594        /* Prepare tree-widget: */
     595        prepareTreeWidget();
     596        /* Prepare details-widget: */
     597        prepareDetailsWidget();
     598        /* Prepare connections: */
     599        prepareConnections();
     600    }
     601}
     602
     603void UICloudProfileManagerWidget::prepareToolBar()
     604{
     605    /* Create toolbar: */
     606    m_pToolBar = new UIToolBar(parentWidget());
     607    if (m_pToolBar)
     608    {
     609        /* Configure toolbar: */
     610        const int iIconMetric = (int)(QApplication::style()->pixelMetric(QStyle::PM_LargeIconSize));
     611        m_pToolBar->setIconSize(QSize(iIconMetric, iIconMetric));
     612        m_pToolBar->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
     613
     614        /* Add toolbar actions: */
     615        m_pToolBar->addAction(m_pActionPool->action(UIActionIndexST_M_Cloud_S_Add));
     616        m_pToolBar->addAction(m_pActionPool->action(UIActionIndexST_M_Cloud_S_Import));
     617        m_pToolBar->addSeparator();
     618        m_pToolBar->addAction(m_pActionPool->action(UIActionIndexST_M_Cloud_S_Remove));
     619        m_pToolBar->addAction(m_pActionPool->action(UIActionIndexST_M_Cloud_T_Details));
     620        m_pToolBar->addSeparator();
     621        m_pToolBar->addAction(m_pActionPool->action(UIActionIndexST_M_Cloud_S_TryPage));
     622        m_pToolBar->addAction(m_pActionPool->action(UIActionIndexST_M_Cloud_S_Help));
     623
     624#ifdef VBOX_WS_MAC
     625        /* Check whether we are embedded into a stack: */
     626        if (m_enmEmbedding == EmbedTo_Stack)
     627        {
     628            /* Add into layout: */
     629            layout()->addWidget(m_pToolBar);
     630        }
     631#else
     632        /* Add into layout: */
     633        layout()->addWidget(m_pToolBar);
     634#endif
     635    }
     636}
     637
     638void UICloudProfileManagerWidget::prepareTreeWidget()
     639{
     640    /* Create tree-widget: */
     641    m_pTreeWidget = new QITreeWidget;
     642    if (m_pTreeWidget)
     643    {
     644        /* Configure tree-widget: */
     645        m_pTreeWidget->header()->hide();
     646        m_pTreeWidget->setRootIsDecorated(false);
     647        m_pTreeWidget->setAlternatingRowColors(true);
     648        m_pTreeWidget->setContextMenuPolicy(Qt::CustomContextMenu);
     649        m_pTreeWidget->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
     650        m_pTreeWidget->setColumnCount(Column_Max);
     651        m_pTreeWidget->setSortingEnabled(true);
     652        m_pTreeWidget->sortByColumn(Column_Name, Qt::AscendingOrder);
     653        m_pTreeWidget->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
     654
     655        /* Add into layout: */
     656        layout()->addWidget(m_pTreeWidget);
     657    }
     658}
     659
     660void UICloudProfileManagerWidget::prepareDetailsWidget()
     661{
     662    /* Create details-widget: */
     663    m_pDetailsWidget = new UICloudProfileDetailsWidget(m_enmEmbedding);
     664    if (m_pDetailsWidget)
     665    {
     666        /* Configure details-widget: */
     667        m_pDetailsWidget->setVisible(false);
     668        m_pDetailsWidget->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
     669
     670        /* Add into layout: */
     671        layout()->addWidget(m_pDetailsWidget);
     672    }
     673}
     674
     675void UICloudProfileManagerWidget::prepareConnections()
     676{
     677    /* Action connections: */
    577678    connect(m_pActionPool->action(UIActionIndexST_M_Cloud_S_Add), &QAction::triggered,
    578679            this, &UICloudProfileManagerWidget::sltAddCloudProfile);
     
    587688    connect(m_pActionPool->action(UIActionIndexST_M_Cloud_S_Help), &QAction::triggered,
    588689            this, &UICloudProfileManagerWidget::sltShowCloudProfileHelp);
    589 }
    590 
    591 void UICloudProfileManagerWidget::prepareWidgets()
    592 {
    593     /* Create main-layout: */
    594     new QVBoxLayout(this);
    595     if (layout())
    596     {
    597         /* Configure layout: */
    598         layout()->setContentsMargins(0, 0, 0, 0);
    599 #ifdef VBOX_WS_MAC
    600         layout()->setSpacing(10);
    601 #else
    602         layout()->setSpacing(qApp->style()->pixelMetric(QStyle::PM_LayoutVerticalSpacing) / 2);
    603 #endif
    604 
    605         /* Prepare toolbar, if requested: */
    606         if (m_fShowToolbar)
    607             prepareToolBar();
    608         /* Prepare tree-widget: */
    609         prepareTreeWidget();
    610         /* Prepare details-widget: */
    611         prepareDetailsWidget();
    612     }
    613 }
    614 
    615 void UICloudProfileManagerWidget::prepareToolBar()
    616 {
    617     /* Create toolbar: */
    618     m_pToolBar = new UIToolBar(parentWidget());
    619     if (m_pToolBar)
    620     {
    621         /* Configure toolbar: */
    622         const int iIconMetric = (int)(QApplication::style()->pixelMetric(QStyle::PM_LargeIconSize));
    623         m_pToolBar->setIconSize(QSize(iIconMetric, iIconMetric));
    624         m_pToolBar->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
    625 
    626         /* Add toolbar actions: */
    627         m_pToolBar->addAction(m_pActionPool->action(UIActionIndexST_M_Cloud_S_Add));
    628         m_pToolBar->addAction(m_pActionPool->action(UIActionIndexST_M_Cloud_S_Import));
    629         m_pToolBar->addSeparator();
    630         m_pToolBar->addAction(m_pActionPool->action(UIActionIndexST_M_Cloud_S_Remove));
    631         m_pToolBar->addAction(m_pActionPool->action(UIActionIndexST_M_Cloud_T_Details));
    632         m_pToolBar->addSeparator();
    633         m_pToolBar->addAction(m_pActionPool->action(UIActionIndexST_M_Cloud_S_TryPage));
    634         m_pToolBar->addAction(m_pActionPool->action(UIActionIndexST_M_Cloud_S_Help));
    635 
    636 #ifdef VBOX_WS_MAC
    637         /* Check whether we are embedded into a stack: */
    638         if (m_enmEmbedding == EmbedTo_Stack)
    639         {
    640             /* Add into layout: */
    641             layout()->addWidget(m_pToolBar);
    642         }
    643 #else
    644         /* Add into layout: */
    645         layout()->addWidget(m_pToolBar);
    646 #endif
    647     }
    648 }
    649 
    650 void UICloudProfileManagerWidget::prepareTreeWidget()
    651 {
    652     /* Create tree-widget: */
    653     m_pTreeWidget = new QITreeWidget;
    654     if (m_pTreeWidget)
    655     {
    656         /* Configure tree-widget: */
    657         m_pTreeWidget->header()->hide();
    658         m_pTreeWidget->setRootIsDecorated(false);
    659         m_pTreeWidget->setAlternatingRowColors(true);
    660         m_pTreeWidget->setContextMenuPolicy(Qt::CustomContextMenu);
    661         m_pTreeWidget->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    662         m_pTreeWidget->setColumnCount(Column_Max);
    663         m_pTreeWidget->setSortingEnabled(true);
    664         m_pTreeWidget->sortByColumn(Column_Name, Qt::AscendingOrder);
    665         m_pTreeWidget->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
    666         connect(m_pTreeWidget, &QITreeWidget::currentItemChanged,
    667                 this, &UICloudProfileManagerWidget::sltHandleCurrentItemChange);
    668         connect(m_pTreeWidget, &QITreeWidget::customContextMenuRequested,
    669                 this, &UICloudProfileManagerWidget::sltHandleContextMenuRequest);
    670         connect(m_pTreeWidget, &QITreeWidget::itemDoubleClicked,
    671                 m_pActionPool->action(UIActionIndexST_M_Cloud_T_Details), &QAction::setChecked);
    672 
    673         /* Add into layout: */
    674         layout()->addWidget(m_pTreeWidget);
    675     }
    676 }
    677 
    678 void UICloudProfileManagerWidget::prepareDetailsWidget()
    679 {
    680     /* Create details-widget: */
    681     m_pDetailsWidget = new UICloudProfileDetailsWidget(m_enmEmbedding);
    682     if (m_pDetailsWidget)
    683     {
    684         /* Configure details-widget: */
    685         m_pDetailsWidget->setVisible(false);
    686         m_pDetailsWidget->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
    687         connect(m_pDetailsWidget, &UICloudProfileDetailsWidget::sigDataChanged,
    688                 this, &UICloudProfileManagerWidget::sigCloudProfileDetailsDataChanged);
    689         connect(m_pDetailsWidget, &UICloudProfileDetailsWidget::sigDataChangeRejected,
    690                 this, &UICloudProfileManagerWidget::sltResetCloudProfileDetailsChanges);
    691         connect(m_pDetailsWidget, &UICloudProfileDetailsWidget::sigDataChangeAccepted,
    692                 this, &UICloudProfileManagerWidget::sltApplyCloudProfileDetailsChanges);
    693 
    694         /* Add into layout: */
    695         layout()->addWidget(m_pDetailsWidget);
    696     }
     690
     691    /* Tree-widget connections: */
     692    connect(m_pTreeWidget, &QITreeWidget::currentItemChanged,
     693            this, &UICloudProfileManagerWidget::sltHandleCurrentItemChange);
     694    connect(m_pTreeWidget, &QITreeWidget::customContextMenuRequested,
     695            this, &UICloudProfileManagerWidget::sltHandleContextMenuRequest);
     696    connect(m_pTreeWidget, &QITreeWidget::itemDoubleClicked,
     697            m_pActionPool->action(UIActionIndexST_M_Cloud_T_Details), &QAction::setChecked);
     698
     699    /* Details-widget connections: */
     700    connect(m_pDetailsWidget, &UICloudProfileDetailsWidget::sigDataChanged,
     701            this, &UICloudProfileManagerWidget::sigCloudProfileDetailsDataChanged);
     702    connect(m_pDetailsWidget, &UICloudProfileDetailsWidget::sigDataChangeRejected,
     703            this, &UICloudProfileManagerWidget::sltResetCloudProfileDetailsChanges);
     704    connect(m_pDetailsWidget, &UICloudProfileDetailsWidget::sigDataChangeAccepted,
     705            this, &UICloudProfileManagerWidget::sltApplyCloudProfileDetailsChanges);
    697706}
    698707
  • trunk/src/VBox/Frontends/VirtualBox/src/cloud/profilemanager/UICloudProfileManager.h

    r83950 r85033  
    133133        /** Prepares details-widget. */
    134134        void prepareDetailsWidget();
     135        /** Prepares connections. */
     136        void prepareConnections();
    135137        /** Load settings: */
    136138        void loadSettings();
Note: See TracChangeset for help on using the changeset viewer.

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