Changeset 100906 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Aug 18, 2023 4:49:42 PM (16 months ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIDialogPanel.cpp
r98103 r100906 42 42 #endif 43 43 44 /* Other VBox includes: */ 45 #include <iprt/assert.h> 46 47 48 49 UIDialogPanelBase::UIDialogPanelBase(QWidget *pParent /* = 0 */) 50 : QWidget(pParent) 51 , m_pTabWidget(0) 52 { 53 prepare(); 54 } 55 56 void UIDialogPanelBase::prepare() 57 { 58 QHBoxLayout *pLayout = new QHBoxLayout(this); 59 AssertReturnVoid(pLayout); 60 pLayout->setContentsMargins(0, 0, 0, 0); 61 m_pTabWidget = new QTabWidget(); 62 connect(m_pTabWidget, &QTabWidget::currentChanged, this, &UIDialogPanelBase::sigCurrentTabChanged); 63 AssertReturnVoid(m_pTabWidget); 64 pLayout->addWidget(m_pTabWidget); 65 } 66 67 void UIDialogPanelBase::insertTab(int iIndex, QWidget *pPage, const QString &strLabel) 68 { 69 if (m_pTabWidget) 70 m_pTabWidget->insertTab(iIndex, pPage, strLabel); 71 } 72 73 void UIDialogPanelBase::setTabText(int iIndex, const QString &strText) 74 { 75 if (!m_pTabWidget || iIndex < 0 || iIndex >= m_pTabWidget->count()) 76 return; 77 m_pTabWidget->setTabText(iIndex, strText); 78 } 79 80 void UIDialogPanelBase::setCurrentIndex(int iIndex) 81 { 82 if (!m_pTabWidget || iIndex >= m_pTabWidget->count() || iIndex < 0) 83 return; 84 m_pTabWidget->setCurrentIndex(iIndex); 85 } 44 86 45 87 UIDialogPanel::UIDialogPanel(QWidget *pParent /* = 0 */) -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIDialogPanel.h
r98103 r100906 44 44 45 45 /** QWidget extension acting as the base class for all the dialog panels like file manager, logviewer etc. */ 46 class SHARED_LIBRARY_STUFF UIDialogPanelBase : public QWidget 47 { 48 Q_OBJECT; 49 50 signals: 51 52 void sigCurrentTabChanged(int iIndex); 53 54 public: 55 56 UIDialogPanelBase(QWidget *pParent = 0); 57 void setCurrentIndex(int iIndex); 58 59 protected: 60 61 virtual void prepare(); 62 void insertTab(int iIndex, QWidget *pPage, const QString &strLabel); 63 void setTabText(int iIndex, const QString &strText); 64 65 private: 66 67 QTabWidget *m_pTabWidget; 68 }; 69 70 /** QWidget extension acting as the base class for all the dialog panels like file manager, logviewer etc. */ 46 71 class SHARED_LIBRARY_STUFF UIDialogPanel : public QIWithRetranslateUI<QWidget> 47 72 { -
trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIFileManager.cpp
r100905 r100906 328 328 connect(m_pPanel, &UIFileManagerPanel::sigFileOperationFail, 329 329 this, &UIFileManager::sltReceieveLogOutput); 330 connect(m_pPanel, &UIFileManagerPanel::sigCurrentTabChanged, 331 this, &UIFileManager::sltPanelCurrentTabChanged); 330 332 } 331 333 … … 411 413 pAction->blockSignals(false); 412 414 } 415 m_pPanel->blockSignals(true); 413 416 m_pPanel->setCurrentIndex(pSenderAction->data().toInt()); 417 m_pPanel->blockSignals(false); 414 418 } 415 419 … … 541 545 m_pHostFileTable->optionsUpdated(); 542 546 saveOptions(); 547 } 548 549 void UIFileManager::sltPanelCurrentTabChanged(int iIndex) 550 { 551 if (!m_pPanel || !m_pPanel->isVisible()) 552 return; 553 554 for(QSet<QAction*>::iterator iter = m_panelActions.begin(); iter != m_panelActions.end(); ++iter) 555 { 556 QAction *pAction = *iter; 557 558 pAction->blockSignals(true); 559 pAction->setChecked(false); 560 pAction->blockSignals(false); 561 } 562 563 switch (static_cast<UIFileManagerPanel::Page>(iIndex)) 564 { 565 case UIFileManagerPanel::Page_Preferences: 566 m_pActionPool->action(UIActionIndex_M_FileManager_T_Preferences)->setChecked(true); 567 break; 568 case UIFileManagerPanel::Page_Operations: 569 m_pActionPool->action(UIActionIndex_M_FileManager_T_Operations)->setChecked(true); 570 break; 571 case UIFileManagerPanel::Page_Log: 572 m_pActionPool->action(UIActionIndex_M_FileManager_T_Log)->setChecked(true); 573 break; 574 case UIFileManagerPanel::Page_Max: 575 default: 576 break; 577 } 543 578 } 544 579 -
trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIFileManager.h
r100905 r100906 129 129 void sltGuestFileTableStateChanged(bool fIsRunning); 130 130 void sltHandleOptionsUpdated(); 131 void sltPanelCurrentTabChanged(int iIndex); 131 132 132 133 private: -
trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIFileManagerPanel.cpp
r100905 r100906 369 369 370 370 UIFileManagerPanel::UIFileManagerPanel(QWidget *pParent, UIFileManagerOptions *pFileManagerOptions) 371 : QIWithRetranslateUI<QWidget>(pParent) 372 , m_pTabWidget(0) 371 : QIWithRetranslateUI<UIDialogPanelBase>(pParent) 373 372 , m_pListDirectoriesOnTopCheckBox(0) 374 373 , m_pDeleteConfirmationCheckBox(0) … … 389 388 void UIFileManagerPanel::prepare() 390 389 { 391 QHBoxLayout *pMainLayout = new QHBoxLayout(this);392 AssertReturnVoid(pMainLayout);393 394 m_pTabWidget = new QTabWidget;395 AssertReturnVoid(m_pTabWidget);396 pMainLayout->addWidget(m_pTabWidget);397 390 preparePreferencesTab(); 398 391 prepareLogTab(); … … 445 438 pPreferencesLayout->addItem(new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding), 2, 0, 1, 2); 446 439 447 m_pTabWidget->insertTab(Page_Preferences, pPreferencesTab, QString());440 insertTab(Page_Preferences, pPreferencesTab, QString()); 448 441 } 449 442 … … 458 451 if (m_pLogTextEdit) 459 452 pLogLayout->addWidget(m_pLogTextEdit); 460 m_pTabWidget->insertTab(Page_Log, pLogTab, QString());453 insertTab(Page_Log, pLogTab, QString()); 461 454 } 462 455 … … 486 479 pOperationsTab->setLayout(m_pOperationsTabLayout); 487 480 m_pOperationsTabLayout->addStretch(4); 488 m_pTabWidget->insertTab(Page_Operations, m_pScrollArea, QString());481 insertTab(Page_Operations, m_pScrollArea, QString()); 489 482 } 490 483 … … 548 541 m_pShowHiddenObjectsCheckBox->setToolTip(QApplication::translate("UIFileManager", "Show hidden files/directories")); 549 542 } 550 if (m_pTabWidget) 551 { 552 m_pTabWidget->setTabText(Page_Preferences, QApplication::translate("UIFileManager", "Preferences")); 553 m_pTabWidget->setTabText(Page_Log, QApplication::translate("UIFileManager", "Log")); 554 m_pTabWidget->setTabText(Page_Operations, QApplication::translate("UIFileManager", "Operations")); 555 } 543 544 setTabText(Page_Preferences, QApplication::translate("UIFileManager", "Preferences")); 545 setTabText(Page_Log, QApplication::translate("UIFileManager", "Log")); 546 setTabText(Page_Operations, QApplication::translate("UIFileManager", "Operations")); 556 547 } 557 548 … … 627 618 connect(pOperationsWidget, &UIFileOperationProgressWidget::sigFocusOut, 628 619 this, &UIFileManagerPanel::sltHandleWidgetFocusOut); 629 }630 631 void UIFileManagerPanel::setCurrentIndex(int iIndex)632 {633 if (!m_pTabWidget || iIndex >= m_pTabWidget->count() || iIndex < 0)634 return;635 m_pTabWidget->setCurrentIndex(iIndex);636 620 } 637 621 -
trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIFileManagerPanel.h
r100905 r100906 37 37 38 38 /* GUI includes: */ 39 #include "UIDialogPanel.h" 39 40 #include "UIGuestControlDefs.h" 40 41 #include "QIWithRetranslateUI.h" … … 52 53 class QVBoxLayout; 53 54 54 class UIFileManagerPanel : public QIWithRetranslateUI< QWidget>55 class UIFileManagerPanel : public QIWithRetranslateUI<UIDialogPanelBase> 55 56 { 56 57 Q_OBJECT; … … 70 71 void appendLog(const QString &strLog, const QString &strMachineName, FileManagerLogType eLogType); 71 72 void addNewProgress(const CProgress &comProgress, const QString &strSourceTableName); 72 void setCurrentIndex(int iIndex); 73 73 74 enum Page 74 75 { 75 76 Page_Preferences = 0, 77 Page_Operations, 76 78 Page_Log, 77 Page_Operations,78 79 Page_Max 79 80 }; … … 107 108 private: 108 109 109 void prepare() ;110 void prepare() override; 110 111 void preparePreferencesTab(); 111 112 void prepareLogTab(); 112 113 void prepareOperationsTab(); 113 114 QTabWidget *m_pTabWidget;115 114 116 115 /** @name Preferences tab
Note:
See TracChangeset
for help on using the changeset viewer.