Changeset 75220 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Nov 2, 2018 8:07:11 AM (6 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox
- Files:
-
- 9 edited
- 8 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/Makefile.kmk
r75209 r75220 841 841 src/guestctrl/UIGuestControlFileManager.h \ 842 842 src/guestctrl/UIGuestControlFileManagerDialog.h \ 843 src/guestctrl/UIGuestControlFileManagerPanel.h \ 844 src/guestctrl/UIGuestControlFileManagerSessionPanel.h \ 845 src/guestctrl/UIGuestControlFileManagerLogPanel.h \ 846 src/guestctrl/UIGuestControlFileManagerSettingsPanel.h \ 843 847 src/guestctrl/UIGuestControlFileModel.h \ 844 848 src/guestctrl/UIGuestControlFileTable.h \ … … 992 996 src/guestctrl/UIGuestControlFileManager.h \ 993 997 src/guestctrl/UIGuestControlFileManagerDialog.h \ 998 src/guestctrl/UIGuestControlFileManagerPanel.h \ 999 src/guestctrl/UIGuestControlFileManagerSessionPanel.h \ 1000 src/guestctrl/UIGuestControlFileManagerLogPanel.h \ 1001 src/guestctrl/UIGuestControlFileManagerSettingsPanel.h \ 994 1002 src/guestctrl/UIGuestControlFileModel.h \ 995 1003 src/guestctrl/UIGuestControlFileTable.h \ … … 1215 1223 src/runtime/UIIndicatorsPool.cpp \ 1216 1224 src/guestctrl/UIGuestControlFileManager.cpp \ 1225 src/guestctrl/UIGuestControlFileManagerAccounPanel.cpp \ 1226 src/guestctrl/UIGuestControlFileManagerLogPanel.cpp \ 1217 1227 src/guestctrl/UIGuestControlFileTable.cpp \ 1218 1228 src/guestctrl/UIGuestFileTable.cpp \ … … 1265 1275 src/runtime/UIIndicatorsPool.cpp \ 1266 1276 src/guestctrl/UIGuestControlFileManager.cpp \ 1277 src/guestctrl/UIGuestControlFileManagerSessionPanel.cpp \ 1278 src/guestctrl/UIGuestControlFileManagerLogPanel.cpp \ 1267 1279 src/guestctrl/UIGuestControlFileTable.cpp \ 1268 1280 src/guestctrl/UIGuestFileTable.cpp \ … … 1540 1552 src/guestctrl/UIGuestControlFileManager.cpp \ 1541 1553 src/guestctrl/UIGuestControlFileManagerDialog.cpp \ 1554 src/guestctrl/UIGuestControlFileManagerPanel.cpp \ 1555 src/guestctrl/UIGuestControlFileManagerSessionPanel.cpp \ 1556 src/guestctrl/UIGuestControlFileManagerLogPanel.cpp \ 1557 src/guestctrl/UIGuestControlFileManagerSettingsPanel.cpp \ 1542 1558 src/guestctrl/UIGuestControlFileModel.cpp \ 1543 1559 src/guestctrl/UIGuestControlFileTable.cpp \ … … 1714 1730 src/guestctrl/UIGuestControlFileManager.cpp \ 1715 1731 src/guestctrl/UIGuestControlFileManagerDialog.cpp \ 1732 src/guestctrl/UIGuestControlFileManagerPanel.cpp \ 1733 src/guestctrl/UIGuestControlFileManagerSessionPanel.cpp \ 1734 src/guestctrl/UIGuestControlFileManagerLogPanel.cpp \ 1735 src/guestctrl/UIGuestControlFileManagerSettingsPanel.cpp \ 1716 1736 src/guestctrl/UIGuestControlFileModel.cpp \ 1717 1737 src/guestctrl/UIGuestControlFileTable.cpp \ -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIActionPool.cpp
r75209 r75220 1558 1558 virtual void retranslateUi() /* override */ 1559 1559 { 1560 setName(QApplication::translate("UIActionPool", "Copy t he selected object(s) from host to guest"));1560 setName(QApplication::translate("UIActionPool", "Copy to guest")); 1561 1561 setShortcutScope(QApplication::translate("UIActionPool", "Guest Control File Manager")); 1562 1562 setToolTip(QApplication::translate("UIActionPool", "Copy the Selected Object(s) from Host to Guest")); … … 1594 1594 virtual void retranslateUi() /* override */ 1595 1595 { 1596 setName(QApplication::translate("UIActionPool", "Copy t he selected object(s) from guest to host"));1596 setName(QApplication::translate("UIActionPool", "Copy to host")); 1597 1597 setShortcutScope(QApplication::translate("UIActionPool", "Guest Control File Manager")); 1598 1598 setToolTip(QApplication::translate("UIActionPool", "Copy the Selected Object(s) from Guest to Host")); … … 1601 1601 }; 1602 1602 1603 1604 /** Simple action extension, used as 'File Manager Settings' in guest control file manager action class. */ 1605 class UIActionMenuGuestControlFileManagerSettings : public UIActionSimple 1603 /** Toggle action extension, used to toggle 'File Manager Settings' panel in guest control file manager. */ 1604 class UIActionMenuGuestControlFileManagerSettings : public UIActionToggle 1606 1605 { 1607 1606 Q_OBJECT; … … 1611 1610 /** Constructs action passing @a pParent to the base-class. */ 1612 1611 UIActionMenuGuestControlFileManagerSettings(UIActionPool *pParent) 1613 : UIActionSimple(pParent, ":/vm_delete_32px.png", ":/vm_delete_disabled_32px.png") 1614 {} 1615 1616 protected: 1617 1618 /** Returns shortcut extra-data ID. */ 1619 virtual QString shortcutExtraDataID() const /* override */ 1620 { 1621 return QString("FileManagerSettings"); 1612 : UIActionToggle(pParent, 1613 ":/log_viewer_bookmark_32px.png", ":/log_viewer_bookmark_disabled_32px.png") 1614 { 1615 setShortcutContext(Qt::WidgetWithChildrenShortcut); 1616 } 1617 1618 protected: 1619 1620 /** Returns shortcut extra-data ID. */ 1621 virtual QString shortcutExtraDataID() const /* override */ 1622 { 1623 return QString("ToggleFileManagerSettingsPanel"); 1622 1624 } 1623 1625 … … 1632 1634 { 1633 1635 setName(QApplication::translate("UIActionPool", "Settings")); 1634 setShortcutScope(QApplication::translate("UIActionPool", "Guest Control File Manager")); 1635 setStatusTip(QApplication::translate("UIActionPool", "Modify file manager settings")); 1636 setToolTip(QApplication::translate("UIActionPool", "Modify File Manager Settings")); 1637 } 1638 }; 1636 setShortcutScope(QApplication::translate("UIActionPool", "File Manager")); 1637 setStatusTip(QApplication::translate("UIActionPool", "Open panel with file manager settings")); 1638 setToolTip(QApplication::translate("UIActionPool", "Open Panel With File Manager Settings")); 1639 } 1640 }; 1641 1642 /** Toggle action extension, used to toggle 'File Manager Log' panel in guest control file manager. */ 1643 class UIActionMenuGuestControlFileManagerLog : public UIActionToggle 1644 { 1645 Q_OBJECT; 1646 1647 public: 1648 1649 /** Constructs action passing @a pParent to the base-class. */ 1650 UIActionMenuGuestControlFileManagerLog(UIActionPool *pParent) 1651 : UIActionToggle(pParent, 1652 ":/log_viewer_bookmark_32px.png", ":/log_viewer_bookmark_disabled_32px.png") 1653 { 1654 setShortcutContext(Qt::WidgetWithChildrenShortcut); 1655 } 1656 1657 protected: 1658 1659 /** Returns shortcut extra-data ID. */ 1660 virtual QString shortcutExtraDataID() const /* override */ 1661 { 1662 return QString("ToggleFileManagerLogPanel"); 1663 } 1664 1665 /** Returns default shortcut. */ 1666 virtual QKeySequence defaultShortcut(UIActionPoolType) const /* override */ 1667 { 1668 return QKeySequence(); 1669 } 1670 1671 /** Handles translation event. */ 1672 virtual void retranslateUi() /* override */ 1673 { 1674 setName(QApplication::translate("UIActionPool", "Log")); 1675 setShortcutScope(QApplication::translate("UIActionPool", "File Manager")); 1676 setStatusTip(QApplication::translate("UIActionPool", "Open panel with to view file manager log")); 1677 setToolTip(QApplication::translate("UIActionPool", "Open Panel With to View File Manager Log")); 1678 } 1679 }; 1680 1681 /** Toggle action extension, used to toggle 'File Manager File Operations' panel in guest control file manager. */ 1682 class UIActionMenuGuestControlFileManagerFileOperations : public UIActionToggle 1683 { 1684 Q_OBJECT; 1685 1686 public: 1687 1688 /** Constructs action passing @a pParent to the base-class. */ 1689 UIActionMenuGuestControlFileManagerFileOperations(UIActionPool *pParent) 1690 : UIActionToggle(pParent, 1691 ":/log_viewer_bookmark_32px.png", ":/log_viewer_bookmark_disabled_32px.png") 1692 { 1693 setShortcutContext(Qt::WidgetWithChildrenShortcut); 1694 } 1695 1696 protected: 1697 1698 /** Returns shortcut extra-data ID. */ 1699 virtual QString shortcutExtraDataID() const /* override */ 1700 { 1701 return QString("ToggleFileManagerFileOperationsPanel"); 1702 } 1703 1704 /** Returns default shortcut. */ 1705 virtual QKeySequence defaultShortcut(UIActionPoolType) const /* override */ 1706 { 1707 return QKeySequence(); 1708 } 1709 1710 /** Handles translation event. */ 1711 virtual void retranslateUi() /* override */ 1712 { 1713 setName(QApplication::translate("UIActionPool", "File Operations")); 1714 setShortcutScope(QApplication::translate("UIActionPool", "File Manager")); 1715 setStatusTip(QApplication::translate("UIActionPool", "Open panel with to view file manager file operations")); 1716 setToolTip(QApplication::translate("UIActionPool", "Open Panel With to View File Manager File Operations")); 1717 } 1718 }; 1719 1720 /** Toggle action extension, used to toggle 'File Manager Session' panel in guest control file manager. */ 1721 class UIActionMenuGuestControlFileManagerSession : public UIActionToggle 1722 { 1723 Q_OBJECT; 1724 1725 public: 1726 1727 /** Constructs action passing @a pParent to the base-class. */ 1728 UIActionMenuGuestControlFileManagerSession(UIActionPool *pParent) 1729 : UIActionToggle(pParent, 1730 ":/log_viewer_bookmark_32px.png", ":/log_viewer_bookmark_disabled_32px.png") 1731 { 1732 setShortcutContext(Qt::WidgetWithChildrenShortcut); 1733 } 1734 1735 protected: 1736 1737 /** Returns shortcut extra-data ID. */ 1738 virtual QString shortcutExtraDataID() const /* override */ 1739 { 1740 return QString("ToggleFileManagerSessionPanel"); 1741 } 1742 1743 /** Returns default shortcut. */ 1744 virtual QKeySequence defaultShortcut(UIActionPoolType) const /* override */ 1745 { 1746 return QKeySequence(); 1747 } 1748 1749 /** Handles translation event. */ 1750 virtual void retranslateUi() /* override */ 1751 { 1752 setName(QApplication::translate("UIActionPool", "Session")); 1753 setShortcutScope(QApplication::translate("UIActionPool", "File Manager")); 1754 setStatusTip(QApplication::translate("UIActionPool", "Open file manager account")); 1755 setToolTip(QApplication::translate("UIActionPool", "Open File Manager Session")); 1756 } 1757 }; 1758 1639 1759 /** Simple action extension, used as 'Perform GoUp' in guest control file manager action class. */ 1640 1760 class UIActionMenuGuestControlFileManagerGoUp : public UIActionSimple … … 2283 2403 m_pool[UIActionIndex_M_GuestControlFileManager_S_CopyToHost] = new UIActionMenuGuestControlFileManagerCopyToHost(this); 2284 2404 2285 m_pool[UIActionIndex_M_GuestControlFileManager_S_Settings] = new UIActionMenuGuestControlFileManagerSettings(this); 2405 m_pool[UIActionIndex_M_GuestControlFileManager_T_Settings] = new UIActionMenuGuestControlFileManagerSettings(this); 2406 m_pool[UIActionIndex_M_GuestControlFileManager_T_Log] = new UIActionMenuGuestControlFileManagerLog(this); 2407 m_pool[UIActionIndex_M_GuestControlFileManager_T_FileOperations] = new UIActionMenuGuestControlFileManagerFileOperations(this); 2408 m_pool[UIActionIndex_M_GuestControlFileManager_T_Session] = new UIActionMenuGuestControlFileManagerSession(this); 2409 2286 2410 m_pool[UIActionIndex_M_GuestControlFileManager_S_Host_GoUp] = new UIActionMenuGuestControlFileManagerGoUp(this); 2287 2411 m_pool[UIActionIndex_M_GuestControlFileManager_S_Guest_GoUp] = new UIActionMenuGuestControlFileManagerGoUp(this); … … 2627 2751 void UIActionPool::updateMenuGuestControlFileManagerWrapper(UIMenu *pMenu) 2628 2752 { 2629 addAction(pMenu, action(UIActionIndex_M_GuestControlFileManager_ S_Settings));2753 addAction(pMenu, action(UIActionIndex_M_GuestControlFileManager_T_Settings)); 2630 2754 addAction(pMenu, action(UIActionIndex_M_GuestControlFileManager_M_HostSubmenu)); 2631 2755 addAction(pMenu, action(UIActionIndex_M_GuestControlFileManager_M_GuestSubmenu)); -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIActionPool.h
r75209 r75220 104 104 UIActionIndex_M_GuestControlFileManager_S_CopyToGuest, 105 105 UIActionIndex_M_GuestControlFileManager_S_CopyToHost, 106 UIActionIndex_M_GuestControlFileManager_S_Settings, 106 UIActionIndex_M_GuestControlFileManager_T_Settings, 107 UIActionIndex_M_GuestControlFileManager_T_Log, 108 UIActionIndex_M_GuestControlFileManager_T_FileOperations, 109 UIActionIndex_M_GuestControlFileManager_T_Session, 107 110 UIActionIndex_M_GuestControlFileManager_S_Host_GoUp, 108 111 UIActionIndex_M_GuestControlFileManager_S_Guest_GoUp, -
trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIGuestControlFileManager.cpp
r75196 r75220 27 27 # include <QTextEdit> 28 28 # include <QPushButton> 29 # include <QSplitter>30 29 # include <QGridLayout> 31 30 … … 42 41 # include "UIGuestControlConsole.h" 43 42 # include "UIGuestControlFileManager.h" 43 # include "UIGuestControlFileManagerSessionPanel.h" 44 # include "UIGuestControlFileManagerSettingsPanel.h" 45 # include "UIGuestControlFileManagerLogPanel.h" 44 46 # include "UIGuestFileTable.h" 45 47 # include "UIGuestControlInterface.h" … … 58 60 #endif /* !VBOX_WITH_PRECOMPILED_HEADERS */ 59 61 60 /********************************************************************************************************************************* 61 * UIFileManagerLogViewer definition. * 62 *********************************************************************************************************************************/ 63 64 class UIFileManagerLogViewer : public QTextEdit 65 { 66 67 Q_OBJECT; 68 69 public: 70 71 UIFileManagerLogViewer(QWidget *pParent = 0); 72 73 protected: 74 75 virtual void contextMenuEvent(QContextMenuEvent * event) /* override */; 76 77 private slots: 78 79 void sltClear(); 80 }; 62 81 63 82 64 /********************************************************************************************************************************* … … 94 76 }; 95 77 96 /*********************************************************************************************************************************97 * UIGuestSessionCreateWidget definition. *98 *********************************************************************************************************************************/99 100 class UIGuestSessionCreateWidget : public QIWithRetranslateUI<QWidget>101 {102 Q_OBJECT;103 104 signals:105 106 void sigCreateSession(QString strUserName, QString strPassword);107 void sigCloseButtonClick();108 109 public:110 111 UIGuestSessionCreateWidget(QWidget *pParent = 0);112 void switchSessionCreateMode();113 void switchSessionCloseMode();114 115 protected:116 117 void retranslateUi();118 void keyPressEvent(QKeyEvent * pEvent);119 120 private slots:121 122 void sltCreateButtonClick();123 void sltShowHidePassword(bool flag);124 125 private:126 void prepareWidgets();127 QILineEdit *m_pUserNameEdit;128 QILineEdit *m_pPasswordEdit;129 QPushButton *m_pCreateButton;130 QPushButton *m_pCloseButton;131 QHBoxLayout *m_pMainLayout;132 QCheckBox *m_pShowPasswordCheckBox;133 134 };135 136 /*********************************************************************************************************************************137 * UIFileManagerLogViewer implementation. *138 *********************************************************************************************************************************/139 140 UIFileManagerLogViewer::UIFileManagerLogViewer(QWidget *pParent /* = 0 */)141 :QTextEdit(pParent)142 {143 }144 145 void UIFileManagerLogViewer::contextMenuEvent(QContextMenuEvent *event)146 {147 QMenu *menu = createStandardContextMenu();148 void sltClear();149 150 QAction *pClearAction = menu->addAction(tr("Clear"));151 connect(pClearAction, &QAction::triggered, this, &UIFileManagerLogViewer::sltClear);152 menu->exec(event->globalPos());153 delete menu;154 }155 156 void UIFileManagerLogViewer::sltClear()157 {158 clear();159 }160 161 78 162 79 /********************************************************************************************************************************* … … 168 85 UIGuestControlFileManagerSettings* UIGuestControlFileManagerSettings::instance() 169 86 { 87 if (!m_pInstance) 88 m_pInstance = new UIGuestControlFileManagerSettings; 170 89 return m_pInstance; 171 90 } … … 205 124 206 125 /********************************************************************************************************************************* 207 * UIGuestSessionCreateWidget implementation. *208 *********************************************************************************************************************************/209 210 UIGuestSessionCreateWidget::UIGuestSessionCreateWidget(QWidget *pParent /* = 0 */)211 : QIWithRetranslateUI<QWidget>(pParent)212 , m_pUserNameEdit(0)213 , m_pPasswordEdit(0)214 , m_pCreateButton(0)215 , m_pCloseButton(0)216 , m_pMainLayout(0)217 , m_pShowPasswordCheckBox(0)218 {219 prepareWidgets();220 }221 222 void UIGuestSessionCreateWidget::prepareWidgets()223 {224 m_pMainLayout = new QHBoxLayout(this);225 if (!m_pMainLayout)226 return;227 228 m_pUserNameEdit = new QILineEdit;229 if (m_pUserNameEdit)230 {231 m_pMainLayout->addWidget(m_pUserNameEdit, 2);232 m_pUserNameEdit->setPlaceholderText("User Name");233 }234 235 m_pPasswordEdit = new QILineEdit;236 if (m_pPasswordEdit)237 {238 m_pMainLayout->addWidget(m_pPasswordEdit, 2);239 m_pPasswordEdit->setPlaceholderText("Password");240 m_pPasswordEdit->setEchoMode(QLineEdit::Password);241 }242 243 m_pShowPasswordCheckBox = new QCheckBox;244 if (m_pShowPasswordCheckBox)245 {246 m_pShowPasswordCheckBox->setText("Show Password");247 m_pMainLayout->addWidget(m_pShowPasswordCheckBox);248 connect(m_pShowPasswordCheckBox, &QCheckBox::toggled,249 this, &UIGuestSessionCreateWidget::sltShowHidePassword);250 }251 252 m_pCreateButton = new QPushButton;253 if (m_pCreateButton)254 {255 m_pMainLayout->addWidget(m_pCreateButton);256 connect(m_pCreateButton, &QPushButton::clicked, this, &UIGuestSessionCreateWidget::sltCreateButtonClick);257 }258 259 m_pCloseButton = new QPushButton;260 if (m_pCloseButton)261 {262 m_pMainLayout->addWidget(m_pCloseButton);263 connect(m_pCloseButton, &QPushButton::clicked, this, &UIGuestSessionCreateWidget::sigCloseButtonClick);264 }265 m_pMainLayout->insertStretch(-1, 1);266 retranslateUi();267 }268 269 void UIGuestSessionCreateWidget::sltCreateButtonClick()270 {271 if (m_pUserNameEdit && m_pPasswordEdit)272 emit sigCreateSession(m_pUserNameEdit->text(), m_pPasswordEdit->text());273 }274 275 void UIGuestSessionCreateWidget::sltShowHidePassword(bool flag)276 {277 if (!m_pPasswordEdit)278 return;279 if (flag)280 m_pPasswordEdit->setEchoMode(QLineEdit::Normal);281 else282 m_pPasswordEdit->setEchoMode(QLineEdit::Password);283 }284 285 void UIGuestSessionCreateWidget::retranslateUi()286 {287 if (m_pUserNameEdit)288 {289 m_pUserNameEdit->setToolTip(QApplication::translate("UIGuestProcessControlWidget", "User name to authenticate session creation"));290 m_pUserNameEdit->setPlaceholderText(QApplication::translate("UIGuestProcessControlWidget", "User Name"));291 292 }293 if (m_pPasswordEdit)294 {295 m_pPasswordEdit->setToolTip(QApplication::translate("UIGuestProcessControlWidget", "Password to authenticate session creation"));296 m_pPasswordEdit->setPlaceholderText(QApplication::translate("UIGuestProcessControlWidget", "Password"));297 }298 299 if (m_pCreateButton)300 m_pCreateButton->setText(QApplication::translate("UIGuestProcessControlWidget", "Create Session"));301 if (m_pCloseButton)302 m_pCloseButton->setText(QApplication::translate("UIGuestProcessControlWidget", "Close Session"));303 }304 305 void UIGuestSessionCreateWidget::keyPressEvent(QKeyEvent * pEvent)306 {307 /* Emit sigCreateSession upon enter press: */308 if (pEvent->key() == Qt::Key_Enter || pEvent->key() == Qt::Key_Return)309 {310 if ((m_pUserNameEdit && m_pUserNameEdit->hasFocus()) ||311 (m_pPasswordEdit && m_pPasswordEdit->hasFocus()))312 sigCreateSession(m_pUserNameEdit->text(), m_pPasswordEdit->text());313 }314 QWidget::keyPressEvent(pEvent);315 }316 317 void UIGuestSessionCreateWidget::switchSessionCreateMode()318 {319 if (m_pUserNameEdit)320 m_pUserNameEdit->setEnabled(true);321 if (m_pPasswordEdit)322 m_pPasswordEdit->setEnabled(true);323 if (m_pCreateButton)324 m_pCreateButton->setEnabled(true);325 if (m_pCloseButton)326 m_pCloseButton->setEnabled(false);327 }328 329 void UIGuestSessionCreateWidget::switchSessionCloseMode()330 {331 if (m_pUserNameEdit)332 m_pUserNameEdit->setEnabled(false);333 if (m_pPasswordEdit)334 m_pPasswordEdit->setEnabled(false);335 if (m_pCreateButton)336 m_pCreateButton->setEnabled(false);337 if (m_pCloseButton)338 m_pCloseButton->setEnabled(true);339 }340 341 342 /*********************************************************************************************************************************343 126 * UIGuestControlFileManager implementation. * 344 127 *********************************************************************************************************************************/ 345 128 346 129 UIGuestControlFileManager::UIGuestControlFileManager(EmbedTo enmEmbedding, UIActionPool *pActionPool, 347 const CGuest &comGuest, QWidget *pParent )130 const CGuest &comGuest, QWidget *pParent, bool fShowToolbar /* = true */) 348 131 : QIWithRetranslateUI<QWidget>(pParent) 349 132 , m_iMaxRecursionDepth(1) 350 133 , m_comGuest(comGuest) 351 134 , m_pMainLayout(0) 352 , m_pVerticalSplitter(0)353 , m_pLogOutput(0)354 135 , m_pToolBar(0) 355 136 , m_pFileTableContainerWidget(0) 356 137 , m_pFileTableContainerLayout(0) 357 , m_pTabWidget(0)358 , m_pFileOperationsList(0)359 , m_pSessionCreateWidget(0)360 138 , m_pGuestFileTable(0) 361 139 , m_pHostFileTable(0) 362 140 , m_enmEmbedding(enmEmbedding) 363 141 , m_pActionPool(pActionPool) 142 , m_fShowToolbar(fShowToolbar) 143 , m_pSettingsPanel(0) 144 , m_pLogPanel(0) 145 , m_pSessionPanel(0) 364 146 { 365 147 prepareGuestListener(); … … 390 172 void UIGuestControlFileManager::retranslateUi() 391 173 { 392 m_pTabWidget->setTabText(0, QApplication::translate("UIGuestProcessControlWidget", "Log"));393 m_pTabWidget->setTabText(1, QApplication::translate("UIGuestProcessControlWidget", "File Operations"));394 m_pTabWidget->setTabText(2, QApplication::translate("UIGuestProcessControlWidget", "Terminal"));395 174 } 396 175 … … 417 196 m_pMainLayout->setSpacing(0); 418 197 419 m_pSessionCreateWidget = new UIGuestSessionCreateWidget(); 420 if (m_pSessionCreateWidget) 421 { 422 m_pMainLayout->addWidget(m_pSessionCreateWidget); 423 } 424 425 m_pVerticalSplitter = new QSplitter; 426 if (m_pVerticalSplitter) 427 { 428 m_pMainLayout->addWidget(m_pVerticalSplitter); 429 m_pVerticalSplitter->setOrientation(Qt::Vertical); 430 m_pVerticalSplitter->setHandleWidth(4); 431 } 198 if (m_fShowToolbar) 199 prepareToolBar(); 200 201 // m_pSessionCreateWidget = new UIGuestSessionCreateWidget(); 202 // if (m_pSessionCreateWidget) 203 // { 204 // m_pMainLayout->addWidget(m_pSessionCreateWidget); 205 // } 432 206 433 207 m_pFileTableContainerWidget = new QWidget; … … 451 225 m_pFileTableContainerLayout->addWidget(m_pHostFileTable); 452 226 } 453 prepare ToolBar();227 prepareVerticalToolBar(); 454 228 if (m_pGuestFileTable) 455 229 { … … 460 234 461 235 } 462 m_pVerticalSplitter->addWidget(m_pFileTableContainerWidget); 463 } 464 465 m_pTabWidget = new QITabWidget; 466 if (m_pTabWidget) 467 { 468 m_pVerticalSplitter->addWidget(m_pTabWidget); 469 m_pTabWidget->setTabPosition(QTabWidget::South); 470 } 471 472 m_pLogOutput = new UIFileManagerLogViewer; 473 if (m_pLogOutput) 474 { 475 m_pTabWidget->addTab(m_pLogOutput, "Log"); 476 m_pLogOutput->setReadOnly(true); 477 } 478 479 m_pFileOperationsList = new UIFileOperationsList; 480 if (m_pFileOperationsList) 481 { 482 m_pTabWidget->addTab(m_pFileOperationsList, "File Operatiions"); 483 m_pFileOperationsList->header()->hide(); 484 } 485 486 m_pVerticalSplitter->setStretchFactor(0, 3); 487 m_pVerticalSplitter->setStretchFactor(1, 1); 488 } 489 490 void UIGuestControlFileManager::prepareToolBar() 236 m_pMainLayout->addWidget(m_pFileTableContainerWidget); 237 } 238 239 // m_pFileOperationsList = new UIFileOperationsList; 240 // if (m_pFileOperationsList) 241 // { 242 // m_pTabWidget->addTab(m_pFileOperationsList, "File Operatiions"); 243 // m_pFileOperationsList->header()->hide(); 244 // } 245 246 /* Create the settings-panel: */ 247 m_pLogPanel = new UIGuestControlFileManagerLogPanel(this /* manager dialog */, 0 /*parent */); 248 if (m_pLogPanel) 249 { 250 /* Configure panel: */ 251 m_pLogPanel->hide(); 252 m_panelActionMap.insert(m_pLogPanel, m_pActionPool->action(UIActionIndex_M_GuestControlFileManager_T_Log)); 253 /* Add into layout: */ 254 m_pMainLayout->addWidget(m_pLogPanel); 255 } 256 m_pSessionPanel = new UIGuestControlFileManagerSessionPanel(this /* manager dialog */, 0 /*parent */); 257 if (m_pSessionPanel) 258 { 259 /* Configure panel: */ 260 m_pSessionPanel->hide(); 261 m_panelActionMap.insert(m_pSessionPanel, m_pActionPool->action(UIActionIndex_M_GuestControlFileManager_T_Session)); 262 /* Add into layout: */ 263 m_pMainLayout->addWidget(m_pSessionPanel); 264 } 265 266 /* Create the settings-panel: */ 267 m_pSettingsPanel = 268 new UIGuestControlFileManagerSettingsPanel(this /* manager dialog */, 269 0 /*parent */, UIGuestControlFileManagerSettings::instance()); 270 if (m_pSettingsPanel) 271 { 272 /* Configure panel: */ 273 m_pSettingsPanel->hide(); 274 m_panelActionMap.insert(m_pSettingsPanel, m_pActionPool->action(UIActionIndex_M_GuestControlFileManager_T_Settings)); 275 connect(m_pSettingsPanel, &UIGuestControlFileManagerSettingsPanel::sigListDirectoriesFirstChanged, 276 this, &UIGuestControlFileManager::sltListDirectoriesBeforeChanged); 277 /* Add into layout: */ 278 m_pMainLayout->addWidget(m_pSettingsPanel); 279 } 280 281 } 282 283 void UIGuestControlFileManager::prepareVerticalToolBar() 491 284 { 492 285 m_pToolBar = new UIToolBar; … … 525 318 this, &UIGuestControlFileManager::sltGuestSessionUnregistered); 526 319 } 527 if (m_pSession CreateWidget)528 { 529 connect(m_pSession CreateWidget, &UIGuestSessionCreateWidget::sigCreateSession,320 if (m_pSessionPanel) 321 { 322 connect(m_pSessionPanel, &UIGuestControlFileManagerSessionPanel::sigCreateSession, 530 323 this, &UIGuestControlFileManager::sltCreateSession); 531 connect(m_pSession CreateWidget, &UIGuestSessionCreateWidget::sigCloseButtonClick,324 connect(m_pSessionPanel, &UIGuestControlFileManagerSessionPanel::sigCloseSession, 532 325 this, &UIGuestControlFileManager::sltCloseSession); 533 326 } 534 327 } 328 329 void UIGuestControlFileManager::prepareToolBar() 330 { 331 /* Create toolbar: */ 332 m_pToolBar = new UIToolBar(parentWidget()); 333 if (m_pToolBar) 334 { 335 /* Configure toolbar: */ 336 const int iIconMetric = (int)(QApplication::style()->pixelMetric(QStyle::PM_LargeIconSize)); 337 m_pToolBar->setIconSize(QSize(iIconMetric, iIconMetric)); 338 m_pToolBar->setToolButtonStyle(Qt::ToolButtonTextUnderIcon); 339 340 m_pToolBar->addAction(m_pActionPool->action(UIActionIndex_M_GuestControlFileManager_T_Session)); 341 m_pToolBar->addAction(m_pActionPool->action(UIActionIndex_M_GuestControlFileManager_T_Settings)); 342 m_pToolBar->addAction(m_pActionPool->action(UIActionIndex_M_GuestControlFileManager_T_Log)); 343 m_pToolBar->addAction(m_pActionPool->action(UIActionIndex_M_GuestControlFileManager_T_FileOperations)); 344 345 connect(m_pActionPool->action(UIActionIndex_M_GuestControlFileManager_T_Settings), &QAction::toggled, 346 this, &UIGuestControlFileManager::sltPanelActionToggled); 347 connect(m_pActionPool->action(UIActionIndex_M_GuestControlFileManager_T_Log), &QAction::toggled, 348 this, &UIGuestControlFileManager::sltPanelActionToggled); 349 connect(m_pActionPool->action(UIActionIndex_M_GuestControlFileManager_T_Session), &QAction::toggled, 350 this, &UIGuestControlFileManager::sltPanelActionToggled); 351 352 #ifdef VBOX_WS_MAC 353 /* Check whether we are embedded into a stack: */ 354 if (m_enmEmbedding == EmbedTo_Stack) 355 { 356 /* Add into layout: */ 357 m_pMainLayout->addWidget(m_pToolBar); 358 } 359 #else 360 /* Add into layout: */ 361 m_pMainLayout->addWidget(m_pToolBar); 362 #endif 363 } 364 } 365 535 366 536 367 void UIGuestControlFileManager::sltGuestSessionUnregistered(CGuestSession guestSession) … … 549 380 if (!UIGuestControlInterface::isGuestAdditionsAvailable(m_comGuest)) 550 381 { 551 if (m_pLogOutput) 552 { 553 m_pLogOutput->append("Could not find Guest Additions"); 554 postSessionClosed(); 555 return; 556 } 382 appendLog("Could not find Guest Additions"); 383 postSessionClosed(); 384 return; 557 385 } 558 386 if (strUserName.isEmpty()) 559 387 { 560 if (m_pLogOutput) 561 m_pLogOutput->append("No user name is given"); 388 appendLog("No user name is given"); 562 389 return; 563 390 } … … 569 396 if (!m_comGuestSession.isOk()) 570 397 { 571 m_pLogOutput->append("Guest session is not valid");398 appendLog("Guest session is not valid"); 572 399 postSessionClosed(); 573 400 return; … … 580 407 581 408 m_comGuestSession.Close(); 582 m_pLogOutput->append("Guest session is closed");409 appendLog("Guest session is closed"); 583 410 postSessionClosed(); 584 411 } … … 590 417 CVirtualBoxErrorInfo cErrorInfo = cEvent.GetError(); 591 418 if (cErrorInfo.isOk()) 592 { 593 m_pLogOutput->append(cErrorInfo.GetText()); 594 } 419 appendLog(cErrorInfo.GetText()); 595 420 } 596 421 if (m_comGuestSession.GetStatus() == KGuestSessionStatus_Started) … … 601 426 else 602 427 { 603 m_pLogOutput->append("Session status has changed");428 appendLog("Session status has changed"); 604 429 } 605 430 } … … 607 432 void UIGuestControlFileManager::sltReceieveLogOutput(QString strOutput) 608 433 { 609 if (m_pLogOutput) 610 m_pLogOutput->append(strOutput); 434 appendLog(strOutput); 611 435 } 612 436 … … 629 453 } 630 454 455 void UIGuestControlFileManager::sltPanelActionToggled(bool fChecked) 456 { 457 QAction *pSenderAction = qobject_cast<QAction*>(sender()); 458 if (!pSenderAction) 459 return; 460 UIGuestControlFileManagerPanel* pPanel = 0; 461 /* Look for the sender() within the m_panelActionMap's values: */ 462 for (QMap<UIGuestControlFileManagerPanel*, QAction*>::const_iterator iterator = m_panelActionMap.begin(); 463 iterator != m_panelActionMap.end(); ++iterator) 464 { 465 if (iterator.value() == pSenderAction) 466 pPanel = iterator.key(); 467 } 468 if (!pPanel) 469 return; 470 if (fChecked) 471 showPanel(pPanel); 472 else 473 hidePanel(pPanel); 474 } 475 476 void UIGuestControlFileManager::sltListDirectoriesBeforeChanged() 477 { 478 if (m_pGuestFileTable) 479 m_pGuestFileTable->relist(); 480 if (m_pHostFileTable) 481 m_pHostFileTable->relist(); 482 } 483 631 484 void UIGuestControlFileManager::initFileTable() 632 485 { … … 640 493 void UIGuestControlFileManager::postSessionCreated() 641 494 { 642 if (m_pSession CreateWidget)643 m_pSession CreateWidget->switchSessionCloseMode();495 if (m_pSessionPanel) 496 m_pSessionPanel->switchSessionCloseMode(); 644 497 if (m_pGuestFileTable) 645 498 m_pGuestFileTable->setEnabled(true); … … 650 503 void UIGuestControlFileManager::postSessionClosed() 651 504 { 652 if (m_pSession CreateWidget)653 m_pSession CreateWidget->switchSessionCreateMode();505 if (m_pSessionPanel) 506 m_pSessionPanel->switchSessionCreateMode(); 654 507 if (m_pGuestFileTable) 655 508 m_pGuestFileTable->setEnabled(false); … … 670 523 if (!m_comGuestSession.isOk()) 671 524 { 672 m_pLogOutput->append(UIErrorString::formatErrorInfo(m_comGuestSession));525 appendLog(UIErrorString::formatErrorInfo(m_comGuestSession)); 673 526 return false; 674 527 } 675 676 m_pLogOutput->append("Guest session has been created"); 677 if (m_pSessionCreateWidget) 678 m_pSessionCreateWidget->switchSessionCloseMode(); 528 appendLog("Guest session has been created"); 529 if (m_pSessionPanel) 530 m_pSessionPanel->switchSessionCloseMode(); 679 531 680 532 /* Prepare session listener */ … … 693 545 /* Wait session to start. For some reason we cannot get GuestSessionStatusChanged event 694 546 consistently. So we wait: */ 695 m_pLogOutput->append("Waiting the session to start");547 appendLog("Waiting the session to start"); 696 548 const ULONG waitTimeout = 2000; 697 549 KGuestSessionWaitResult waitResult = m_comGuestSession.WaitFor(KGuestSessionWaitForFlag_Start, waitTimeout); 698 550 if (waitResult != KGuestSessionWaitResult_Start) 699 551 { 700 m_pLogOutput->append("The session did not start");552 appendLog("The session did not start"); 701 553 sltCloseSession(); 702 554 return false; … … 763 615 void UIGuestControlFileManager::saveSettings() 764 616 { 765 if (!m_pVerticalSplitter)766 return;767 gEDataManager->setGuestControlFileManagerSplitterHints(m_pVerticalSplitter->sizes());768 617 } 769 618 770 619 void UIGuestControlFileManager::loadSettings() 771 620 { 772 if (!m_pVerticalSplitter) 773 return; 774 QList<int> splitterHints = gEDataManager->guestControlFileManagerSplitterHints(); 775 if (splitterHints.size() != 2) 776 return; 777 if (splitterHints[0] != 0 && splitterHints[1] != 0) 778 m_pVerticalSplitter->setSizes(splitterHints); 621 } 622 623 void UIGuestControlFileManager::hidePanel(UIGuestControlFileManagerPanel* panel) 624 { 625 if (panel && panel->isVisible()) 626 panel->setVisible(false); 627 QMap<UIGuestControlFileManagerPanel*, QAction*>::iterator iterator = m_panelActionMap.find(panel); 628 if (iterator != m_panelActionMap.end()) 629 { 630 if (iterator.value() && iterator.value()->isChecked()) 631 iterator.value()->setChecked(false); 632 } 633 m_visiblePanelsList.removeOne(panel); 634 manageEscapeShortCut(); 635 } 636 637 void UIGuestControlFileManager::showPanel(UIGuestControlFileManagerPanel* panel) 638 { 639 if (panel && panel->isHidden()) 640 panel->setVisible(true); 641 QMap<UIGuestControlFileManagerPanel*, QAction*>::iterator iterator = m_panelActionMap.find(panel); 642 if (iterator != m_panelActionMap.end()) 643 { 644 if (!iterator.value()->isChecked()) 645 iterator.value()->setChecked(true); 646 } 647 m_visiblePanelsList.push_back(panel); 648 manageEscapeShortCut(); 649 } 650 651 void UIGuestControlFileManager::manageEscapeShortCut() 652 { 653 /* if there is no visible panels give the escape shortcut to parent dialog: */ 654 if (m_visiblePanelsList.isEmpty()) 655 { 656 emit sigSetCloseButtonShortCut(QKeySequence(Qt::Key_Escape)); 657 return; 658 } 659 /* Take the escape shortcut from the dialog: */ 660 emit sigSetCloseButtonShortCut(QKeySequence()); 661 /* Just loop thru the visible panel list and set the esc key to the 662 panel which made visible latest */ 663 for (int i = 0; i < m_visiblePanelsList.size() - 1; ++i) 664 { 665 m_visiblePanelsList[i]->setCloseButtonShortCut(QKeySequence()); 666 } 667 m_visiblePanelsList.back()->setCloseButtonShortCut(QKeySequence(Qt::Key_Escape)); 668 } 669 670 void UIGuestControlFileManager::appendLog(const QString &strLog) 671 { 672 if (!m_pLogPanel) 673 return; 674 m_pLogPanel->appendLog(strLog); 779 675 } 780 676 -
trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIGuestControlFileManager.h
r75202 r75220 38 38 class QTextEdit; 39 39 class QVBoxLayout; 40 class QSplitter;41 40 class QITabWidget; 42 41 class CGuestSessionStateChangedEvent; … … 45 44 class UIGuestControlConsole; 46 45 class UIGuestControlInterface; 46 class UIGuestControlFileManagerPanel; 47 class UIGuestControlFileManagerSessionPanel; 48 class UIGuestControlFileManagerLogPanel; 49 class UIGuestControlFileManagerSettingsPanel; 47 50 class UIGuestFileTable; 48 51 class UIHostFileTable; … … 50 53 class UIToolBar; 51 54 55 /** A Utility class to manage file manager settings. */ 52 56 class UIGuestControlFileManagerSettings 53 57 { 58 54 59 public: 60 55 61 static UIGuestControlFileManagerSettings* instance(); 56 62 static void create(); … … 59 65 bool bListDirectoriesOnTop; 60 66 bool bAskDeleteConfirmation; 67 61 68 private: 62 69 UIGuestControlFileManagerSettings(); … … 76 83 77 84 UIGuestControlFileManager(EmbedTo enmEmbedding, UIActionPool *pActionPool, 78 const CGuest &comGuest, QWidget *pParent );85 const CGuest &comGuest, QWidget *pParent, bool fShowToolbar = true); 79 86 ~UIGuestControlFileManager(); 80 87 QMenu *menu() const; 81 //const UIGuestControlFileManagerSettings& settings() const; 88 89 signals: 90 91 void sigSetCloseButtonShortCut(QKeySequence); 82 92 83 93 protected: … … 94 104 void sltCopyGuestToHost(); 95 105 void sltCopyHostToGuest(); 106 void sltPanelActionToggled(bool fChecked); 107 void sltListDirectoriesBeforeChanged(); 96 108 97 109 private: … … 100 112 void prepareGuestListener(); 101 113 void prepareConnections(); 114 void prepareVerticalToolBar(); 102 115 void prepareToolBar(); 103 116 bool createSession(const QString& strUserName, const QString& strPassword, … … 117 130 void saveSettings(); 118 131 void loadSettings(); 132 void hidePanel(UIGuestControlFileManagerPanel *panel); 133 void showPanel(UIGuestControlFileManagerPanel *panel); 134 /** Make sure escape key is assigned to only a single widget. This is done by checking 135 several things in the following order: 136 - when there are no more panels visible assign it to the parent dialog 137 - grab it from the dialog as soon as a panel becomes visible again 138 - assigned it to the most recently "unhidden" panel */ 139 void manageEscapeShortCut(); 140 119 141 120 142 template<typename T> 121 143 QStringList getFsObjInfoStringList(const T &fsObjectInfo) const; 122 144 void appendLog(const QString &strLog); 123 145 const int m_iMaxRecursionDepth; 124 146 CGuest m_comGuest; 125 147 CGuestSession m_comGuestSession; 126 148 QVBoxLayout *m_pMainLayout; 127 QSplitter *m_pVerticalSplitter; 128 QTextEdit *m_pLogOutput; 149 129 150 UIToolBar *m_pToolBar; 130 151 QWidget *m_pFileTableContainerWidget; 131 152 QHBoxLayout *m_pFileTableContainerLayout; 132 QITabWidget *m_pTabWidget;133 153 134 UIFileOperationsList *m_pFileOperationsList;154 //UIFileOperationsList *m_pFileOperationsList; 135 155 UIGuestControlConsole *m_pConsole; 136 156 UIGuestControlInterface *m_pControlInterface; 137 / * m_pSessionCreateWidget is a QWidget extension enabling user to start/stop138 * a Guest Control session with password/username fields etc.. */139 UIGuestSessionCreateWidget *m_pSessionCreateWidget;157 // /* m_pSessionCreateWidget is a QWidget extension enabling user to start/stop 158 // * a Guest Control session with password/username fields etc.. */ 159 // UIGuestSessionCreateWidget *m_pSessionCreateWidget; 140 160 UIGuestFileTable *m_pGuestFileTable; 141 161 UIHostFileTable *m_pHostFileTable; … … 147 167 const EmbedTo m_enmEmbedding; 148 168 UIActionPool *m_pActionPool; 149 150 //UIGuestControlFileManagerSettings m_settings; 169 const bool m_fShowToolbar; 170 QMap<UIGuestControlFileManagerPanel*, QAction*> m_panelActionMap; 171 QList<UIGuestControlFileManagerPanel*> m_visiblePanelsList; 172 UIGuestControlFileManagerSettingsPanel *m_pSettingsPanel; 173 UIGuestControlFileManagerLogPanel *m_pLogPanel; 174 UIGuestControlFileManagerSessionPanel *m_pSessionPanel; 175 friend class UIGuestControlFileManagerSettingsPanel; 176 friend class UIGuestControlFileManagerPanel; 151 177 }; 152 178 -
trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIGuestControlFileManagerLogPanel.cpp
r75195 r75220 21 21 22 22 /* Qt includes: */ 23 # include <QComboBox>24 23 # include <QHBoxLayout> 25 # include <QFontDatabase> 26 # include <QFontDialog> 27 # include <QCheckBox> 28 # include <QLabel> 24 # include <QMenu> 29 25 # include <QSpinBox> 26 # include <QTextEdit> 30 27 31 28 /* GUI includes: */ 32 29 # include "QIToolButton.h" 33 30 # include "UIIconPool.h" 34 # include "UI VMLogViewerSettingsPanel.h"35 # include "UI VMLogViewerWidget.h"31 # include "UIGuestControlFileManager.h" 32 # include "UIGuestControlFileManagerLogPanel.h" 36 33 37 34 #endif /* !VBOX_WITH_PRECOMPILED_HEADERS */ 38 35 39 36 40 UIVMLogViewerSettingsPanel::UIVMLogViewerSettingsPanel(QWidget *pParent, UIVMLogViewerWidget *pViewer) 41 : UIVMLogViewerPanel(pParent, pViewer) 42 , m_pLineNumberCheckBox(0) 43 , m_pWrapLinesCheckBox(0) 44 , m_pFontSizeSpinBox(0) 45 , m_pFontSizeLabel(0) 46 , m_pOpenFontDialogButton(0) 47 , m_pResetToDefaultsButton(0) 48 , m_iDefaultFontSize(9) 37 /********************************************************************************************************************************* 38 * UIFileManagerLogViewer definition. * 39 *********************************************************************************************************************************/ 40 41 class UIFileManagerLogViewer : public QTextEdit 42 { 43 44 Q_OBJECT; 45 46 public: 47 48 UIFileManagerLogViewer(QWidget *pParent = 0); 49 50 protected: 51 52 virtual void contextMenuEvent(QContextMenuEvent * event) /* override */; 53 54 private slots: 55 56 void sltClear(); 57 }; 58 59 /********************************************************************************************************************************* 60 * UIFileManagerLogViewer implementation. * 61 *********************************************************************************************************************************/ 62 63 UIFileManagerLogViewer::UIFileManagerLogViewer(QWidget *pParent /* = 0 */) 64 :QTextEdit(pParent) 65 { 66 } 67 68 void UIFileManagerLogViewer::contextMenuEvent(QContextMenuEvent *event) 69 { 70 QMenu *menu = createStandardContextMenu(); 71 void sltClear(); 72 73 QAction *pClearAction = menu->addAction(tr("Clear")); 74 connect(pClearAction, &QAction::triggered, this, &UIFileManagerLogViewer::sltClear); 75 menu->exec(event->globalPos()); 76 delete menu; 77 } 78 79 void UIFileManagerLogViewer::sltClear() 80 { 81 clear(); 82 } 83 84 85 /********************************************************************************************************************************* 86 * UIGuestControlFileManagerLogPanel implementation. * 87 *********************************************************************************************************************************/ 88 89 UIGuestControlFileManagerLogPanel::UIGuestControlFileManagerLogPanel(UIGuestControlFileManager *pManagerWidget, QWidget *pParent) 90 : UIGuestControlFileManagerPanel(pManagerWidget, pParent) 91 , m_pLogTextEdit(0) 49 92 { 50 93 prepare(); 51 94 } 52 95 53 void UIVMLogViewerSettingsPanel::setShowLineNumbers(bool bShowLineNumbers) 54 { 55 if (!m_pLineNumberCheckBox) 56 return; 57 if (m_pLineNumberCheckBox->isChecked() == bShowLineNumbers) 58 return; 59 m_pLineNumberCheckBox->setChecked(bShowLineNumbers); 60 } 61 62 void UIVMLogViewerSettingsPanel::setWrapLines(bool bWrapLines) 63 { 64 if (!m_pWrapLinesCheckBox) 65 return; 66 if (m_pWrapLinesCheckBox->isChecked() == bWrapLines) 67 return; 68 m_pWrapLinesCheckBox->setChecked(bWrapLines); 69 } 70 71 void UIVMLogViewerSettingsPanel::setFontSizeInPoints(int fontSizeInPoints) 72 { 73 if (!m_pFontSizeSpinBox) 74 return; 75 if (m_pFontSizeSpinBox->value() == fontSizeInPoints) 76 return; 77 m_pFontSizeSpinBox->setValue(fontSizeInPoints); 78 } 79 80 void UIVMLogViewerSettingsPanel::prepareWidgets() 96 void UIGuestControlFileManagerLogPanel::prepareWidgets() 81 97 { 82 98 if (!mainLayout()) 83 99 return; 84 85 /* Create line-number check-box: */ 86 m_pLineNumberCheckBox = new QCheckBox; 87 if (m_pLineNumberCheckBox) 100 m_pLogTextEdit = new UIFileManagerLogViewer; 101 if (m_pLogTextEdit) 88 102 { 89 m_pLineNumberCheckBox->setChecked(true); 90 mainLayout()->addWidget(m_pLineNumberCheckBox, 0, Qt::AlignLeft); 103 mainLayout()->addWidget(m_pLogTextEdit); 91 104 } 92 105 93 /* Create wrap-lines check-box: */94 m_pWrapLinesCheckBox = new QCheckBox;95 if (m_pWrapLinesCheckBox)96 {97 m_pWrapLinesCheckBox->setChecked(false);98 mainLayout()->addWidget(m_pWrapLinesCheckBox, 0, Qt::AlignLeft);99 }100 101 /* Create font-size spin-box: */102 m_pFontSizeSpinBox = new QSpinBox;103 if (m_pFontSizeSpinBox)104 {105 mainLayout()->addWidget(m_pFontSizeSpinBox, 0, Qt::AlignLeft);106 m_pFontSizeSpinBox->setValue(m_iDefaultFontSize);107 m_pFontSizeSpinBox->setMaximum(44);108 m_pFontSizeSpinBox->setMinimum(6);109 }110 111 /* Create font-size label: */112 m_pFontSizeLabel = new QLabel;113 if (m_pFontSizeLabel)114 {115 mainLayout()->addWidget(m_pFontSizeLabel, 0, Qt::AlignLeft);116 }117 118 /* Create combo/button layout: */119 QHBoxLayout *pButtonLayout = new QHBoxLayout;120 if (pButtonLayout)121 {122 pButtonLayout->setContentsMargins(0, 0, 0, 0);123 pButtonLayout->setSpacing(0);124 125 /* Create open font dialog button: */126 m_pOpenFontDialogButton = new QIToolButton;127 if (m_pOpenFontDialogButton)128 {129 pButtonLayout->addWidget(m_pOpenFontDialogButton, 0);130 m_pOpenFontDialogButton->setIcon(UIIconPool::iconSet(":/log_viewer_choose_font_16px.png"));131 }132 133 /* Create reset font to default button: */134 m_pResetToDefaultsButton = new QIToolButton;135 if (m_pResetToDefaultsButton)136 {137 pButtonLayout->addWidget(m_pResetToDefaultsButton, 0);138 m_pResetToDefaultsButton->setIcon(UIIconPool::iconSet(":/log_viewer_reset_font_16px.png"));139 }140 141 mainLayout()->addLayout(pButtonLayout);142 }143 144 mainLayout()->addStretch(2);145 106 } 146 107 147 void UI VMLogViewerSettingsPanel::prepareConnections()108 void UIGuestControlFileManagerLogPanel::prepareConnections() 148 109 { 149 if (m_pLineNumberCheckBox)150 connect(m_pLineNumberCheckBox, &QCheckBox::toggled, this, &UIVMLogViewerSettingsPanel::sigShowLineNumbers);151 if (m_pWrapLinesCheckBox)152 connect(m_pWrapLinesCheckBox, &QCheckBox::toggled, this, &UIVMLogViewerSettingsPanel::sigWrapLines);153 if (m_pFontSizeSpinBox)154 connect(m_pFontSizeSpinBox, static_cast<void(QSpinBox::*)(int)>(&QSpinBox::valueChanged),155 this, &UIVMLogViewerSettingsPanel::sigChangeFontSizeInPoints);156 if (m_pOpenFontDialogButton)157 connect(m_pOpenFontDialogButton, &QIToolButton::clicked, this, &UIVMLogViewerSettingsPanel::sltOpenFontDialog);158 if (m_pResetToDefaultsButton)159 connect(m_pResetToDefaultsButton, &QIToolButton::clicked, this, &UIVMLogViewerSettingsPanel::sigResetToDefaults);160 110 } 161 111 162 void UI VMLogViewerSettingsPanel::retranslateUi()112 void UIGuestControlFileManagerLogPanel::retranslateUi() 163 113 { 164 UI VMLogViewerPanel::retranslateUi();114 UIGuestControlFileManagerPanel::retranslateUi(); 165 115 166 m_pLineNumberCheckBox->setText(UIVMLogViewerWidget::tr("Show Line Numbers"));167 m_pLineNumberCheckBox->setToolTip(UIVMLogViewerWidget::tr("When checked, show line numbers"));168 169 m_pWrapLinesCheckBox->setText(UIVMLogViewerWidget::tr("Wrap Lines"));170 m_pWrapLinesCheckBox->setToolTip(UIVMLogViewerWidget::tr("When checked, wrap lines"));171 172 m_pFontSizeLabel->setText(UIVMLogViewerWidget::tr("Font Size"));173 m_pFontSizeSpinBox->setToolTip(UIVMLogViewerWidget::tr("Log viewer font size"));174 175 m_pOpenFontDialogButton->setToolTip(UIVMLogViewerWidget::tr("Open a font dialog to select font face for the logviewer"));176 m_pResetToDefaultsButton->setToolTip(UIVMLogViewerWidget::tr("Reset settings to application defaults"));177 116 } 178 117 179 void UI VMLogViewerSettingsPanel::sltOpenFontDialog()118 void UIGuestControlFileManagerLogPanel::appendLog(const QString &strLog) 180 119 { 181 QFont currentFont; 182 UIVMLogViewerWidget* parentWidget = qobject_cast<UIVMLogViewerWidget*>(parent()); 183 if (!parentWidget) 120 if (!m_pLogTextEdit) 184 121 return; 122 m_pLogTextEdit->append(strLog); 123 } 185 124 186 currentFont = parentWidget->currentFont(); 187 bool ok; 188 QFont font = 189 QFontDialog::getFont(&ok, currentFont, this, "Logviewer font"); 190 191 if (ok) 192 emit sigChangeFont(font); 193 } 125 #include "UIGuestControlFileManagerLogPanel.moc" -
trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIGuestControlFileManagerLogPanel.h
r75195 r75220 16 16 */ 17 17 18 #ifndef ___UI VMLogViewerSettingssPanel_h___19 #define ___UI VMLogViewerSettingssPanel_h___18 #ifndef ___UIGuestControlFileManagerLogPanel_h___ 19 #define ___UIGuestControlFileManagerLogPanel_h___ 20 20 21 21 /* GUI includes: */ 22 #include "UI VMLogViewerPanel.h"22 #include "UIGuestControlFileManagerPanel.h" 23 23 24 24 /* Forward declarations: */ 25 class QCheckBox; 26 class QSpinBox; 27 class QLabel; 28 class QIToolButton; 29 class UIVMLogViewerWidget; 25 class QTextEdit; 26 class UIGuestControlFileManager; 30 27 31 28 /** UIVMLogViewerPanel extension providing GUI to manage logviewer settings. */ 32 class UI VMLogViewerSettingsPanel : public UIVMLogViewerPanel29 class UIGuestControlFileManagerLogPanel : public UIGuestControlFileManagerPanel 33 30 { 34 31 Q_OBJECT; 32 33 public: 34 35 UIGuestControlFileManagerLogPanel(UIGuestControlFileManager *pManagerWidget, QWidget *pParent); 36 37 void appendLog(const QString &str); 35 38 36 39 signals: … … 41 44 void sigChangeFont(QFont font); 42 45 void sigResetToDefaults(); 43 44 public:45 46 UIVMLogViewerSettingsPanel(QWidget *pParent, UIVMLogViewerWidget *pViewer);47 48 void setShowLineNumbers(bool bShowLineNumbers);49 void setWrapLines(bool bWrapLines);50 void setFontSizeInPoints(int fontSizeInPoints);51 52 public slots:53 54 46 55 47 protected: … … 63 55 private slots: 64 56 65 void sltOpenFontDialog();66 57 67 58 private: 68 59 69 QCheckBox *m_pLineNumberCheckBox; 70 QCheckBox *m_pWrapLinesCheckBox; 71 QSpinBox *m_pFontSizeSpinBox; 72 QLabel *m_pFontSizeLabel; 73 QIToolButton *m_pOpenFontDialogButton; 74 QIToolButton *m_pResetToDefaultsButton; 75 76 /** Default font size in points. */ 77 const int m_iDefaultFontSize; 78 60 QTextEdit *m_pLogTextEdit; 79 61 }; 80 62 81 #endif /* !___UI VMLogViewerSettingsPanel_h___ */63 #endif /* !___UIGuestControlFileManagerLogPanel_h___ */ -
trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIGuestControlFileManagerPanel.cpp
r75195 r75220 31 31 # include "QIToolButton.h" 32 32 # include "UIIconPool.h" 33 # include "UIVMLogPage.h" 34 # include "UIVMLogViewerPanel.h" 35 # include "UIVMLogViewerWidget.h" 33 # include "UIGuestControlFileManager.h" 34 # include "UIGuestControlFileManagerPanel.h" 36 35 # ifdef VBOX_WS_MAC 37 36 # include "VBoxUtils-darwin.h" … … 40 39 41 40 42 UI VMLogViewerPanel::UIVMLogViewerPanel(QWidget *pParent, UIVMLogViewerWidget *pViewer)41 UIGuestControlFileManagerPanel::UIGuestControlFileManagerPanel(UIGuestControlFileManager *pManagerWidget, QWidget *pParent) 43 42 : QIWithRetranslateUI<QWidget>(pParent) 44 , m_pViewer(pViewer)45 43 , m_pMainLayout(0) 46 44 , m_pCloseButton(0) 45 , m_pFileManager(pManagerWidget) 47 46 { 48 47 prepare(); 49 48 } 50 49 51 void UI VMLogViewerPanel::setCloseButtonShortCut(QKeySequence shortCut)50 void UIGuestControlFileManagerPanel::setCloseButtonShortCut(QKeySequence shortCut) 52 51 { 53 52 if (!m_pCloseButton) … … 56 55 } 57 56 58 UIVMLogViewerWidget* UIVMLogViewerPanel::viewer() 59 { 60 return m_pViewer; 61 } 62 63 const UIVMLogViewerWidget* UIVMLogViewerPanel::viewer() const 64 { 65 return m_pViewer; 66 } 67 68 QHBoxLayout* UIVMLogViewerPanel::mainLayout() 57 QHBoxLayout* UIGuestControlFileManagerPanel::mainLayout() 69 58 { 70 59 return m_pMainLayout; 71 60 } 72 61 73 void UI VMLogViewerPanel::prepare()62 void UIGuestControlFileManagerPanel::prepare() 74 63 { 75 64 prepareWidgets(); … … 78 67 } 79 68 80 void UI VMLogViewerPanel::prepareWidgets()69 void UIGuestControlFileManagerPanel::prepareWidgets() 81 70 { 82 71 m_pMainLayout = new QHBoxLayout(this); … … 101 90 } 102 91 103 void UI VMLogViewerPanel::prepareConnections()92 void UIGuestControlFileManagerPanel::prepareConnections() 104 93 { 105 94 if (m_pCloseButton) 106 connect(m_pCloseButton, &QIToolButton::clicked, this, &UI VMLogViewerPanel::hide);95 connect(m_pCloseButton, &QIToolButton::clicked, this, &UIGuestControlFileManagerPanel::hide); 107 96 } 108 97 109 void UI VMLogViewerPanel::retranslateUi()98 void UIGuestControlFileManagerPanel::retranslateUi() 110 99 { 111 100 if (m_pCloseButton) 112 m_pCloseButton->setToolTip(UI VMLogViewerWidget::tr("Close the pane"));101 m_pCloseButton->setToolTip(UIGuestControlFileManager::tr("Close the pane")); 113 102 } 114 103 115 bool UI VMLogViewerPanel::eventFilter(QObject *pObject, QEvent *pEvent)104 bool UIGuestControlFileManagerPanel::eventFilter(QObject *pObject, QEvent *pEvent) 116 105 { 117 106 Q_UNUSED(pObject); … … 121 110 } 122 111 123 void UI VMLogViewerPanel::showEvent(QShowEvent *pEvent)112 void UIGuestControlFileManagerPanel::showEvent(QShowEvent *pEvent) 124 113 { 125 114 QWidget::showEvent(pEvent); 126 115 } 127 116 128 void UI VMLogViewerPanel::hideEvent(QHideEvent *pEvent)117 void UIGuestControlFileManagerPanel::hideEvent(QHideEvent *pEvent) 129 118 { 130 119 /* Get focused widget: */ … … 134 123 if (pFocus && pFocus->parent() == this) 135 124 focusNextPrevChild(true); 136 if (m_p Viewer)137 m_p Viewer->hidePanel(this);125 if (m_pFileManager) 126 m_pFileManager->hidePanel(this); 138 127 139 128 QWidget::hideEvent(pEvent); 140 129 } 141 142 QTextDocument *UIVMLogViewerPanel::textDocument()143 {144 QPlainTextEdit *pEdit = textEdit();145 if (!pEdit)146 return 0;147 return textEdit()->document();148 }149 150 QPlainTextEdit *UIVMLogViewerPanel::textEdit()151 {152 if (!viewer())153 return 0;154 UIVMLogPage *logPage = viewer()->currentLogPage();155 if (!logPage)156 return 0;157 return logPage->textEdit();158 }159 160 const QString* UIVMLogViewerPanel::logString() const161 {162 if (!viewer())163 return 0;164 const UIVMLogPage* const page = qobject_cast<const UIVMLogPage* const>(viewer()->currentLogPage());165 if (!page)166 return 0;167 return &(page->logString());168 }169 -
trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIGuestControlFileManagerPanel.h
r75195 r75220 16 16 */ 17 17 18 #ifndef ___UI VMLogViewerPanel_h___19 #define ___UI VMLogViewerPanel_h___18 #ifndef ___UIGuestControlFileManagerPanel_h___ 19 #define ___UIGuestControlFileManagerPanel_h___ 20 20 21 21 /* Qt includes: */ … … 30 30 class QTextDocument; 31 31 class QIToolButton; 32 class UIVMLogViewerWidget; 33 32 class UIGuestControlFileManager; 34 33 35 34 /** QWidget extension acting as the base class for UIVMLogViewerXXXPanel widgets. */ 36 class UI VMLogViewerPanel : public QIWithRetranslateUI<QWidget>35 class UIGuestControlFileManagerPanel : public QIWithRetranslateUI<QWidget> 37 36 { 38 37 Q_OBJECT; … … 40 39 public: 41 40 42 UI VMLogViewerPanel(QWidget *pParent, UIVMLogViewerWidget *pViewer);41 UIGuestControlFileManagerPanel(UIGuestControlFileManager *pManagerWidget, QWidget *pParent); 43 42 void setCloseButtonShortCut(QKeySequence shortCut); 44 43 … … 50 49 51 50 /* Access functions for children classes. */ 52 UIVMLogViewerWidget* viewer();53 const UIVMLogViewerWidget* viewer() const;54 51 QHBoxLayout* mainLayout(); 55 52 … … 64 61 void hideEvent(QHideEvent *pEvent); 65 62 66 QTextDocument *textDocument();67 QPlainTextEdit *textEdit();68 63 /* Return the unmodified log. */ 69 64 const QString* logString() const; … … 72 67 73 68 /** Holds the reference to VM Log-Viewer this panel belongs to. */ 74 UIVMLogViewerWidget *m_pViewer;75 69 QHBoxLayout *m_pMainLayout; 76 70 QIToolButton *m_pCloseButton; 71 UIGuestControlFileManager *m_pFileManager; 77 72 }; 78 73 79 #endif /* !___UIVMLogViewerPanel!_h___ */ 80 74 #endif /* !___UIGuestControlFileManagerPanel!_h___ */ -
trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIGuestControlFileManagerSessionPanel.cpp
r75195 r75220 21 21 22 22 /* Qt includes: */ 23 # include <QC omboBox>23 # include <QCheckBox> 24 24 # include <QHBoxLayout> 25 # include <QFontDatabase> 26 # include <QFontDialog> 27 # include <QCheckBox> 28 # include <QLabel> 25 # include <QMenu> 26 # include <QPushButton> 29 27 # include <QSpinBox> 28 # include <QTextEdit> 30 29 31 30 /* GUI includes: */ 31 # include "QILineEdit.h" 32 32 # include "QIToolButton.h" 33 33 # include "UIIconPool.h" 34 # include "UI VMLogViewerSettingsPanel.h"35 # include "UI VMLogViewerWidget.h"34 # include "UIGuestControlFileManager.h" 35 # include "UIGuestControlFileManagerSessionPanel.h" 36 36 37 37 #endif /* !VBOX_WITH_PRECOMPILED_HEADERS */ 38 38 39 39 40 UIVMLogViewerSettingsPanel::UIVMLogViewerSettingsPanel(QWidget *pParent, UIVMLogViewerWidget *pViewer) 41 : UIVMLogViewerPanel(pParent, pViewer) 42 , m_pLineNumberCheckBox(0) 43 , m_pWrapLinesCheckBox(0) 44 , m_pFontSizeSpinBox(0) 45 , m_pFontSizeLabel(0) 46 , m_pOpenFontDialogButton(0) 47 , m_pResetToDefaultsButton(0) 48 , m_iDefaultFontSize(9) 40 /********************************************************************************************************************************* 41 * UIGuestSessionCreateWidget definition. * 42 *********************************************************************************************************************************/ 43 44 class UIGuestSessionCreateWidget : public QIWithRetranslateUI<QWidget> 45 { 46 Q_OBJECT; 47 48 signals: 49 50 void sigCreateSession(QString strUserName, QString strPassword); 51 void sigCloseSession(); 52 53 public: 54 55 UIGuestSessionCreateWidget(QWidget *pParent = 0); 56 void switchSessionCreateMode(); 57 void switchSessionCloseMode(); 58 59 protected: 60 61 void retranslateUi(); 62 void keyPressEvent(QKeyEvent * pEvent); 63 64 private slots: 65 66 void sltCreateButtonClick(); 67 void sltShowHidePassword(bool flag); 68 69 private: 70 void prepareWidgets(); 71 QILineEdit *m_pUserNameEdit; 72 QILineEdit *m_pPasswordEdit; 73 QPushButton *m_pCreateButton; 74 QPushButton *m_pCloseButton; 75 QHBoxLayout *m_pMainLayout; 76 QCheckBox *m_pShowPasswordCheckBox; 77 78 }; 79 80 81 /********************************************************************************************************************************* 82 * UIGuestSessionCreateWidget implementation. * 83 *********************************************************************************************************************************/ 84 85 UIGuestSessionCreateWidget::UIGuestSessionCreateWidget(QWidget *pParent /* = 0 */) 86 : QIWithRetranslateUI<QWidget>(pParent) 87 , m_pUserNameEdit(0) 88 , m_pPasswordEdit(0) 89 , m_pCreateButton(0) 90 , m_pCloseButton(0) 91 , m_pMainLayout(0) 92 , m_pShowPasswordCheckBox(0) 93 { 94 prepareWidgets(); 95 } 96 97 void UIGuestSessionCreateWidget::prepareWidgets() 98 { 99 m_pMainLayout = new QHBoxLayout(this); 100 if (!m_pMainLayout) 101 return; 102 103 m_pUserNameEdit = new QILineEdit; 104 if (m_pUserNameEdit) 105 { 106 m_pMainLayout->addWidget(m_pUserNameEdit, 2); 107 m_pUserNameEdit->setPlaceholderText("User Name"); 108 } 109 110 m_pPasswordEdit = new QILineEdit; 111 if (m_pPasswordEdit) 112 { 113 m_pMainLayout->addWidget(m_pPasswordEdit, 2); 114 m_pPasswordEdit->setPlaceholderText("Password"); 115 m_pPasswordEdit->setEchoMode(QLineEdit::Password); 116 } 117 118 m_pShowPasswordCheckBox = new QCheckBox; 119 if (m_pShowPasswordCheckBox) 120 { 121 m_pShowPasswordCheckBox->setText("Show Password"); 122 m_pMainLayout->addWidget(m_pShowPasswordCheckBox); 123 connect(m_pShowPasswordCheckBox, &QCheckBox::toggled, 124 this, &UIGuestSessionCreateWidget::sltShowHidePassword); 125 } 126 127 m_pCreateButton = new QPushButton; 128 if (m_pCreateButton) 129 { 130 m_pMainLayout->addWidget(m_pCreateButton); 131 connect(m_pCreateButton, &QPushButton::clicked, this, &UIGuestSessionCreateWidget::sltCreateButtonClick); 132 } 133 134 m_pCloseButton = new QPushButton; 135 if (m_pCloseButton) 136 { 137 m_pMainLayout->addWidget(m_pCloseButton); 138 connect(m_pCloseButton, &QPushButton::clicked, this, &UIGuestSessionCreateWidget::sigCloseSession); 139 } 140 m_pMainLayout->insertStretch(-1, 1); 141 retranslateUi(); 142 } 143 144 void UIGuestSessionCreateWidget::sltCreateButtonClick() 145 { 146 if (m_pUserNameEdit && m_pPasswordEdit) 147 emit sigCreateSession(m_pUserNameEdit->text(), m_pPasswordEdit->text()); 148 } 149 150 void UIGuestSessionCreateWidget::sltShowHidePassword(bool flag) 151 { 152 if (!m_pPasswordEdit) 153 return; 154 if (flag) 155 m_pPasswordEdit->setEchoMode(QLineEdit::Normal); 156 else 157 m_pPasswordEdit->setEchoMode(QLineEdit::Password); 158 } 159 160 void UIGuestSessionCreateWidget::retranslateUi() 161 { 162 if (m_pUserNameEdit) 163 { 164 m_pUserNameEdit->setToolTip(QApplication::translate("UIGuestProcessControlWidget", "User name to authenticate session creation")); 165 m_pUserNameEdit->setPlaceholderText(QApplication::translate("UIGuestProcessControlWidget", "User Name")); 166 167 } 168 if (m_pPasswordEdit) 169 { 170 m_pPasswordEdit->setToolTip(QApplication::translate("UIGuestProcessControlWidget", "Password to authenticate session creation")); 171 m_pPasswordEdit->setPlaceholderText(QApplication::translate("UIGuestProcessControlWidget", "Password")); 172 } 173 174 if (m_pCreateButton) 175 m_pCreateButton->setText(QApplication::translate("UIGuestProcessControlWidget", "Create Session")); 176 if (m_pCloseButton) 177 m_pCloseButton->setText(QApplication::translate("UIGuestProcessControlWidget", "Close Session")); 178 } 179 180 void UIGuestSessionCreateWidget::keyPressEvent(QKeyEvent * pEvent) 181 { 182 /* Emit sigCreateSession upon enter press: */ 183 if (pEvent->key() == Qt::Key_Enter || pEvent->key() == Qt::Key_Return) 184 { 185 if ((m_pUserNameEdit && m_pUserNameEdit->hasFocus()) || 186 (m_pPasswordEdit && m_pPasswordEdit->hasFocus())) 187 sigCreateSession(m_pUserNameEdit->text(), m_pPasswordEdit->text()); 188 } 189 QWidget::keyPressEvent(pEvent); 190 } 191 192 void UIGuestSessionCreateWidget::switchSessionCreateMode() 193 { 194 if (m_pUserNameEdit) 195 m_pUserNameEdit->setEnabled(true); 196 if (m_pPasswordEdit) 197 m_pPasswordEdit->setEnabled(true); 198 if (m_pCreateButton) 199 m_pCreateButton->setEnabled(true); 200 if (m_pCloseButton) 201 m_pCloseButton->setEnabled(false); 202 } 203 204 void UIGuestSessionCreateWidget::switchSessionCloseMode() 205 { 206 if (m_pUserNameEdit) 207 m_pUserNameEdit->setEnabled(false); 208 if (m_pPasswordEdit) 209 m_pPasswordEdit->setEnabled(false); 210 if (m_pCreateButton) 211 m_pCreateButton->setEnabled(false); 212 if (m_pCloseButton) 213 m_pCloseButton->setEnabled(true); 214 } 215 216 217 /********************************************************************************************************************************* 218 * UIGuestControlFileManagerSessionPanel implementation. * 219 *********************************************************************************************************************************/ 220 221 UIGuestControlFileManagerSessionPanel::UIGuestControlFileManagerSessionPanel(UIGuestControlFileManager *pManagerWidget, QWidget *pParent) 222 : UIGuestControlFileManagerPanel(pManagerWidget, pParent) 223 , m_pSessionCreateWidget(0) 49 224 { 50 225 prepare(); 51 226 } 52 227 53 void UIVMLogViewerSettingsPanel::setShowLineNumbers(bool bShowLineNumbers) 54 { 55 if (!m_pLineNumberCheckBox) 56 return; 57 if (m_pLineNumberCheckBox->isChecked() == bShowLineNumbers) 58 return; 59 m_pLineNumberCheckBox->setChecked(bShowLineNumbers); 60 } 61 62 void UIVMLogViewerSettingsPanel::setWrapLines(bool bWrapLines) 63 { 64 if (!m_pWrapLinesCheckBox) 65 return; 66 if (m_pWrapLinesCheckBox->isChecked() == bWrapLines) 67 return; 68 m_pWrapLinesCheckBox->setChecked(bWrapLines); 69 } 70 71 void UIVMLogViewerSettingsPanel::setFontSizeInPoints(int fontSizeInPoints) 72 { 73 if (!m_pFontSizeSpinBox) 74 return; 75 if (m_pFontSizeSpinBox->value() == fontSizeInPoints) 76 return; 77 m_pFontSizeSpinBox->setValue(fontSizeInPoints); 78 } 79 80 void UIVMLogViewerSettingsPanel::prepareWidgets() 228 void UIGuestControlFileManagerSessionPanel::switchSessionCloseMode() 229 { 230 if (m_pSessionCreateWidget) 231 m_pSessionCreateWidget->switchSessionCloseMode(); 232 } 233 234 void UIGuestControlFileManagerSessionPanel::switchSessionCreateMode() 235 { 236 if (m_pSessionCreateWidget) 237 m_pSessionCreateWidget->switchSessionCreateMode(); 238 } 239 240 void UIGuestControlFileManagerSessionPanel::prepareWidgets() 81 241 { 82 242 if (!mainLayout()) 83 243 return; 84 85 /* Create line-number check-box: */ 86 m_pLineNumberCheckBox = new QCheckBox; 87 if (m_pLineNumberCheckBox) 88 { 89 m_pLineNumberCheckBox->setChecked(true); 90 mainLayout()->addWidget(m_pLineNumberCheckBox, 0, Qt::AlignLeft); 91 } 92 93 /* Create wrap-lines check-box: */ 94 m_pWrapLinesCheckBox = new QCheckBox; 95 if (m_pWrapLinesCheckBox) 96 { 97 m_pWrapLinesCheckBox->setChecked(false); 98 mainLayout()->addWidget(m_pWrapLinesCheckBox, 0, Qt::AlignLeft); 99 } 100 101 /* Create font-size spin-box: */ 102 m_pFontSizeSpinBox = new QSpinBox; 103 if (m_pFontSizeSpinBox) 104 { 105 mainLayout()->addWidget(m_pFontSizeSpinBox, 0, Qt::AlignLeft); 106 m_pFontSizeSpinBox->setValue(m_iDefaultFontSize); 107 m_pFontSizeSpinBox->setMaximum(44); 108 m_pFontSizeSpinBox->setMinimum(6); 109 } 110 111 /* Create font-size label: */ 112 m_pFontSizeLabel = new QLabel; 113 if (m_pFontSizeLabel) 114 { 115 mainLayout()->addWidget(m_pFontSizeLabel, 0, Qt::AlignLeft); 116 } 117 118 /* Create combo/button layout: */ 119 QHBoxLayout *pButtonLayout = new QHBoxLayout; 120 if (pButtonLayout) 121 { 122 pButtonLayout->setContentsMargins(0, 0, 0, 0); 123 pButtonLayout->setSpacing(0); 124 125 /* Create open font dialog button: */ 126 m_pOpenFontDialogButton = new QIToolButton; 127 if (m_pOpenFontDialogButton) 128 { 129 pButtonLayout->addWidget(m_pOpenFontDialogButton, 0); 130 m_pOpenFontDialogButton->setIcon(UIIconPool::iconSet(":/log_viewer_choose_font_16px.png")); 131 } 132 133 /* Create reset font to default button: */ 134 m_pResetToDefaultsButton = new QIToolButton; 135 if (m_pResetToDefaultsButton) 136 { 137 pButtonLayout->addWidget(m_pResetToDefaultsButton, 0); 138 m_pResetToDefaultsButton->setIcon(UIIconPool::iconSet(":/log_viewer_reset_font_16px.png")); 139 } 140 141 mainLayout()->addLayout(pButtonLayout); 142 } 143 144 mainLayout()->addStretch(2); 145 } 146 147 void UIVMLogViewerSettingsPanel::prepareConnections() 148 { 149 if (m_pLineNumberCheckBox) 150 connect(m_pLineNumberCheckBox, &QCheckBox::toggled, this, &UIVMLogViewerSettingsPanel::sigShowLineNumbers); 151 if (m_pWrapLinesCheckBox) 152 connect(m_pWrapLinesCheckBox, &QCheckBox::toggled, this, &UIVMLogViewerSettingsPanel::sigWrapLines); 153 if (m_pFontSizeSpinBox) 154 connect(m_pFontSizeSpinBox, static_cast<void(QSpinBox::*)(int)>(&QSpinBox::valueChanged), 155 this, &UIVMLogViewerSettingsPanel::sigChangeFontSizeInPoints); 156 if (m_pOpenFontDialogButton) 157 connect(m_pOpenFontDialogButton, &QIToolButton::clicked, this, &UIVMLogViewerSettingsPanel::sltOpenFontDialog); 158 if (m_pResetToDefaultsButton) 159 connect(m_pResetToDefaultsButton, &QIToolButton::clicked, this, &UIVMLogViewerSettingsPanel::sigResetToDefaults); 160 } 161 162 void UIVMLogViewerSettingsPanel::retranslateUi() 163 { 164 UIVMLogViewerPanel::retranslateUi(); 165 166 m_pLineNumberCheckBox->setText(UIVMLogViewerWidget::tr("Show Line Numbers")); 167 m_pLineNumberCheckBox->setToolTip(UIVMLogViewerWidget::tr("When checked, show line numbers")); 168 169 m_pWrapLinesCheckBox->setText(UIVMLogViewerWidget::tr("Wrap Lines")); 170 m_pWrapLinesCheckBox->setToolTip(UIVMLogViewerWidget::tr("When checked, wrap lines")); 171 172 m_pFontSizeLabel->setText(UIVMLogViewerWidget::tr("Font Size")); 173 m_pFontSizeSpinBox->setToolTip(UIVMLogViewerWidget::tr("Log viewer font size")); 174 175 m_pOpenFontDialogButton->setToolTip(UIVMLogViewerWidget::tr("Open a font dialog to select font face for the logviewer")); 176 m_pResetToDefaultsButton->setToolTip(UIVMLogViewerWidget::tr("Reset settings to application defaults")); 177 } 178 179 void UIVMLogViewerSettingsPanel::sltOpenFontDialog() 180 { 181 QFont currentFont; 182 UIVMLogViewerWidget* parentWidget = qobject_cast<UIVMLogViewerWidget*>(parent()); 183 if (!parentWidget) 184 return; 185 186 currentFont = parentWidget->currentFont(); 187 bool ok; 188 QFont font = 189 QFontDialog::getFont(&ok, currentFont, this, "Logviewer font"); 190 191 if (ok) 192 emit sigChangeFont(font); 193 } 244 m_pSessionCreateWidget = new UIGuestSessionCreateWidget; 245 if (m_pSessionCreateWidget) 246 mainLayout()->addWidget(m_pSessionCreateWidget); 247 } 248 249 void UIGuestControlFileManagerSessionPanel::prepareConnections() 250 { 251 if (m_pSessionCreateWidget) 252 { 253 connect(m_pSessionCreateWidget, &UIGuestSessionCreateWidget::sigCreateSession, 254 this, &UIGuestControlFileManagerSessionPanel::sigCreateSession); 255 connect(m_pSessionCreateWidget, &UIGuestSessionCreateWidget::sigCloseSession, 256 this, &UIGuestControlFileManagerSessionPanel::sigCloseSession); 257 } 258 } 259 260 void UIGuestControlFileManagerSessionPanel::retranslateUi() 261 { 262 UIGuestControlFileManagerPanel::retranslateUi(); 263 264 } 265 266 #include "UIGuestControlFileManagerSessionPanel.moc" -
trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIGuestControlFileManagerSessionPanel.h
r75195 r75220 16 16 */ 17 17 18 #ifndef ___UI VMLogViewerSettingssPanel_h___19 #define ___UI VMLogViewerSettingssPanel_h___18 #ifndef ___UIGuestControlFileManagerSessionPanel_h___ 19 #define ___UIGuestControlFileManagerSessionPanel_h___ 20 20 21 21 /* GUI includes: */ 22 #include "UI VMLogViewerPanel.h"22 #include "UIGuestControlFileManagerPanel.h" 23 23 24 24 /* Forward declarations: */ 25 class QCheckBox; 26 class QSpinBox; 27 class QLabel; 28 class QIToolButton; 29 class UIVMLogViewerWidget; 25 class QTextEdit; 26 class UIGuestControlFileManager; 27 class UIGuestSessionCreateWidget; 30 28 31 29 /** UIVMLogViewerPanel extension providing GUI to manage logviewer settings. */ 32 class UI VMLogViewerSettingsPanel : public UIVMLogViewerPanel30 class UIGuestControlFileManagerSessionPanel : public UIGuestControlFileManagerPanel 33 31 { 34 32 Q_OBJECT; 35 33 34 public: 35 36 UIGuestControlFileManagerSessionPanel(UIGuestControlFileManager *pManagerWidget, QWidget *pParent); 37 void switchSessionCloseMode(); 38 void switchSessionCreateMode(); 39 36 40 signals: 37 41 38 void sigShowLineNumbers(bool show); 39 void sigWrapLines(bool show); 40 void sigChangeFontSizeInPoints(int size); 41 void sigChangeFont(QFont font); 42 void sigResetToDefaults(); 43 44 public: 45 46 UIVMLogViewerSettingsPanel(QWidget *pParent, UIVMLogViewerWidget *pViewer); 47 48 void setShowLineNumbers(bool bShowLineNumbers); 49 void setWrapLines(bool bWrapLines); 50 void setFontSizeInPoints(int fontSizeInPoints); 51 52 public slots: 53 42 void sigCreateSession(QString strUserName, QString strPassword); 43 void sigCloseSession(); 54 44 55 45 protected: … … 63 53 private slots: 64 54 65 void sltOpenFontDialog();66 55 67 56 private: 68 57 69 QCheckBox *m_pLineNumberCheckBox; 70 QCheckBox *m_pWrapLinesCheckBox; 71 QSpinBox *m_pFontSizeSpinBox; 72 QLabel *m_pFontSizeLabel; 73 QIToolButton *m_pOpenFontDialogButton; 74 QIToolButton *m_pResetToDefaultsButton; 75 76 /** Default font size in points. */ 77 const int m_iDefaultFontSize; 78 58 UIGuestSessionCreateWidget *m_pSessionCreateWidget; 79 59 }; 80 60 81 #endif /* !___UI VMLogViewerSettingsPanel_h___ */61 #endif /* !___UIGuestControlFileManagerSessionPanel_h___ */ -
trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIGuestControlFileManagerSettingsPanel.cpp
r75195 r75220 32 32 # include "QIToolButton.h" 33 33 # include "UIIconPool.h" 34 # include "UI VMLogViewerSettingsPanel.h"35 # include "UI VMLogViewerWidget.h"34 # include "UIGuestControlFileManager.h" 35 # include "UIGuestControlFileManagerSettingsPanel.h" 36 36 37 37 #endif /* !VBOX_WITH_PRECOMPILED_HEADERS */ 38 38 39 39 40 UIVMLogViewerSettingsPanel::UIVMLogViewerSettingsPanel(QWidget *pParent, UIVMLogViewerWidget *pViewer) 41 : UIVMLogViewerPanel(pParent, pViewer) 42 , m_pLineNumberCheckBox(0) 43 , m_pWrapLinesCheckBox(0) 44 , m_pFontSizeSpinBox(0) 45 , m_pFontSizeLabel(0) 46 , m_pOpenFontDialogButton(0) 47 , m_pResetToDefaultsButton(0) 48 , m_iDefaultFontSize(9) 40 UIGuestControlFileManagerSettingsPanel::UIGuestControlFileManagerSettingsPanel(UIGuestControlFileManager *pManagerWidget, 41 QWidget *pParent, UIGuestControlFileManagerSettings *pFileManagerSettings) 42 : UIGuestControlFileManagerPanel(pManagerWidget, pParent) 43 , m_pListDirectoriesOnTopCheckBox(0) 44 , m_pDeleteConfirmationCheckBox(0) 45 , m_pFileManagerSettings(pFileManagerSettings) 49 46 { 50 47 prepare(); 51 48 } 52 49 53 void UIVMLogViewerSettingsPanel::setShowLineNumbers(bool bShowLineNumbers) 54 { 55 if (!m_pLineNumberCheckBox) 56 return; 57 if (m_pLineNumberCheckBox->isChecked() == bShowLineNumbers) 58 return; 59 m_pLineNumberCheckBox->setChecked(bShowLineNumbers); 60 } 61 62 void UIVMLogViewerSettingsPanel::setWrapLines(bool bWrapLines) 63 { 64 if (!m_pWrapLinesCheckBox) 65 return; 66 if (m_pWrapLinesCheckBox->isChecked() == bWrapLines) 67 return; 68 m_pWrapLinesCheckBox->setChecked(bWrapLines); 69 } 70 71 void UIVMLogViewerSettingsPanel::setFontSizeInPoints(int fontSizeInPoints) 72 { 73 if (!m_pFontSizeSpinBox) 74 return; 75 if (m_pFontSizeSpinBox->value() == fontSizeInPoints) 76 return; 77 m_pFontSizeSpinBox->setValue(fontSizeInPoints); 78 } 79 80 void UIVMLogViewerSettingsPanel::prepareWidgets() 50 void UIGuestControlFileManagerSettingsPanel::prepareWidgets() 81 51 { 82 52 if (!mainLayout()) 83 53 return; 84 54 85 /* Create line-number check-box: */ 86 m_pLineNumberCheckBox = new QCheckBox; 87 if (m_pLineNumberCheckBox) 55 m_pListDirectoriesOnTopCheckBox = new QCheckBox; 56 if (m_pListDirectoriesOnTopCheckBox) 88 57 { 89 m_pLi neNumberCheckBox->setChecked(true);90 mainLayout()->addWidget(m_pLi neNumberCheckBox, 0, Qt::AlignLeft);58 m_pListDirectoriesOnTopCheckBox->setChecked(true); 59 mainLayout()->addWidget(m_pListDirectoriesOnTopCheckBox, 0, Qt::AlignLeft); 91 60 } 92 61 93 /* Create wrap-lines check-box: */ 94 m_pWrapLinesCheckBox = new QCheckBox; 95 if (m_pWrapLinesCheckBox) 62 m_pDeleteConfirmationCheckBox = new QCheckBox; 63 if (m_pDeleteConfirmationCheckBox) 96 64 { 97 m_p WrapLinesCheckBox->setChecked(false);98 mainLayout()->addWidget(m_p WrapLinesCheckBox, 0, Qt::AlignLeft);65 m_pDeleteConfirmationCheckBox->setChecked(false); 66 mainLayout()->addWidget(m_pDeleteConfirmationCheckBox, 0, Qt::AlignLeft); 99 67 } 100 68 101 /* Create font-size spin-box: */102 m_pFontSizeSpinBox = new QSpinBox;103 if (m_pFontSizeSpinBox)104 {105 mainLayout()->addWidget(m_pFontSizeSpinBox, 0, Qt::AlignLeft);106 m_pFontSizeSpinBox->setValue(m_iDefaultFontSize);107 m_pFontSizeSpinBox->setMaximum(44);108 m_pFontSizeSpinBox->setMinimum(6);109 }110 69 111 /* Create font-size label: */ 112 m_pFontSizeLabel = new QLabel; 113 if (m_pFontSizeLabel) 114 { 115 mainLayout()->addWidget(m_pFontSizeLabel, 0, Qt::AlignLeft); 116 } 117 118 /* Create combo/button layout: */ 119 QHBoxLayout *pButtonLayout = new QHBoxLayout; 120 if (pButtonLayout) 121 { 122 pButtonLayout->setContentsMargins(0, 0, 0, 0); 123 pButtonLayout->setSpacing(0); 124 125 /* Create open font dialog button: */ 126 m_pOpenFontDialogButton = new QIToolButton; 127 if (m_pOpenFontDialogButton) 128 { 129 pButtonLayout->addWidget(m_pOpenFontDialogButton, 0); 130 m_pOpenFontDialogButton->setIcon(UIIconPool::iconSet(":/log_viewer_choose_font_16px.png")); 131 } 132 133 /* Create reset font to default button: */ 134 m_pResetToDefaultsButton = new QIToolButton; 135 if (m_pResetToDefaultsButton) 136 { 137 pButtonLayout->addWidget(m_pResetToDefaultsButton, 0); 138 m_pResetToDefaultsButton->setIcon(UIIconPool::iconSet(":/log_viewer_reset_font_16px.png")); 139 } 140 141 mainLayout()->addLayout(pButtonLayout); 142 } 143 70 retranslateUi(); 144 71 mainLayout()->addStretch(2); 145 72 } 146 73 147 void UI VMLogViewerSettingsPanel::prepareConnections()74 void UIGuestControlFileManagerSettingsPanel::sltListDirectoryCheckBoxToogled(bool fChecked) 148 75 { 149 if (m_pLineNumberCheckBox) 150 connect(m_pLineNumberCheckBox, &QCheckBox::toggled, this, &UIVMLogViewerSettingsPanel::sigShowLineNumbers); 151 if (m_pWrapLinesCheckBox) 152 connect(m_pWrapLinesCheckBox, &QCheckBox::toggled, this, &UIVMLogViewerSettingsPanel::sigWrapLines); 153 if (m_pFontSizeSpinBox) 154 connect(m_pFontSizeSpinBox, static_cast<void(QSpinBox::*)(int)>(&QSpinBox::valueChanged), 155 this, &UIVMLogViewerSettingsPanel::sigChangeFontSizeInPoints); 156 if (m_pOpenFontDialogButton) 157 connect(m_pOpenFontDialogButton, &QIToolButton::clicked, this, &UIVMLogViewerSettingsPanel::sltOpenFontDialog); 158 if (m_pResetToDefaultsButton) 159 connect(m_pResetToDefaultsButton, &QIToolButton::clicked, this, &UIVMLogViewerSettingsPanel::sigResetToDefaults); 76 if (!m_pFileManagerSettings) 77 return; 78 m_pFileManagerSettings->bListDirectoriesOnTop = fChecked; 79 emit sigListDirectoriesFirstChanged(); 160 80 } 161 81 162 void UI VMLogViewerSettingsPanel::retranslateUi()82 void UIGuestControlFileManagerSettingsPanel::prepareConnections() 163 83 { 164 UIVMLogViewerPanel::retranslateUi(); 165 166 m_pLineNumberCheckBox->setText(UIVMLogViewerWidget::tr("Show Line Numbers")); 167 m_pLineNumberCheckBox->setToolTip(UIVMLogViewerWidget::tr("When checked, show line numbers")); 168 169 m_pWrapLinesCheckBox->setText(UIVMLogViewerWidget::tr("Wrap Lines")); 170 m_pWrapLinesCheckBox->setToolTip(UIVMLogViewerWidget::tr("When checked, wrap lines")); 171 172 m_pFontSizeLabel->setText(UIVMLogViewerWidget::tr("Font Size")); 173 m_pFontSizeSpinBox->setToolTip(UIVMLogViewerWidget::tr("Log viewer font size")); 174 175 m_pOpenFontDialogButton->setToolTip(UIVMLogViewerWidget::tr("Open a font dialog to select font face for the logviewer")); 176 m_pResetToDefaultsButton->setToolTip(UIVMLogViewerWidget::tr("Reset settings to application defaults")); 84 if (m_pListDirectoriesOnTopCheckBox) 85 connect(m_pListDirectoriesOnTopCheckBox, &QCheckBox::toggled, 86 this, &UIGuestControlFileManagerSettingsPanel::sltListDirectoryCheckBoxToogled); 87 // if (m_pWrapLinesCheckBox) 88 // connect(m_pWrapLinesCheckBox, &QCheckBox::toggled, this, &UIGuestControlFileManagerSettingsPanel::sigWrapLines); 89 // if (m_pFontSizeSpinBox) 90 // connect(m_pFontSizeSpinBox, static_cast<void(QSpinBox::*)(int)>(&QSpinBox::valueChanged), 91 // this, &UIGuestControlFileManagerSettingsPanel::sigChangeFontSizeInPoints); 92 // if (m_pResetToDefaultsButton) 93 // connect(m_pResetToDefaultsButton, &QIToolButton::clicked, this, &UIGuestControlFileManagerSettingsPanel::sigResetToDefaults); 177 94 } 178 95 179 void UI VMLogViewerSettingsPanel::sltOpenFontDialog()96 void UIGuestControlFileManagerSettingsPanel::retranslateUi() 180 97 { 181 QFont currentFont; 182 UIVMLogViewerWidget* parentWidget = qobject_cast<UIVMLogViewerWidget*>(parent()); 183 if (!parentWidget) 184 return; 98 UIGuestControlFileManagerPanel::retranslateUi(); 185 99 186 currentFont = parentWidget->currentFont(); 187 bool ok; 188 QFont font = 189 QFontDialog::getFont(&ok, currentFont, this, "Logviewer font"); 100 m_pListDirectoriesOnTopCheckBox->setText(UIGuestControlFileManager::tr("List directories on top")); 101 m_pListDirectoriesOnTopCheckBox->setToolTip(UIGuestControlFileManager::tr("List directories before files")); 190 102 191 if (ok)192 emit sigChangeFont(font);103 m_pDeleteConfirmationCheckBox->setText(UIGuestControlFileManager::tr("Ask before delete")); 104 m_pDeleteConfirmationCheckBox->setToolTip(UIGuestControlFileManager::tr("List directories before files")); 193 105 } -
trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIGuestControlFileManagerSettingsPanel.h
r75195 r75220 16 16 */ 17 17 18 #ifndef ___UI VMLogViewerSettingssPanel_h___19 #define ___UI VMLogViewerSettingssPanel_h___18 #ifndef ___UIGuestControlFileManagerSettingsPanel_h___ 19 #define ___UIGuestControlFileManagerSettingsPanel_h___ 20 20 21 21 /* GUI includes: */ 22 #include "UI VMLogViewerPanel.h"22 #include "UIGuestControlFileManagerPanel.h" 23 23 24 24 /* Forward declarations: */ … … 27 27 class QLabel; 28 28 class QIToolButton; 29 class UI VMLogViewerWidget;29 class UIGuestControlFileManagerSettings; 30 30 31 31 /** UIVMLogViewerPanel extension providing GUI to manage logviewer settings. */ 32 class UI VMLogViewerSettingsPanel : public UIVMLogViewerPanel32 class UIGuestControlFileManagerSettingsPanel : public UIGuestControlFileManagerPanel 33 33 { 34 34 Q_OBJECT; 35 35 36 public: 37 38 UIGuestControlFileManagerSettingsPanel(UIGuestControlFileManager *pManagerWidget, 39 QWidget *pParent, UIGuestControlFileManagerSettings *pFileManagerSettings); 40 36 41 signals: 37 42 38 void sigShowLineNumbers(bool show); 39 void sigWrapLines(bool show); 40 void sigChangeFontSizeInPoints(int size); 41 void sigChangeFont(QFont font); 42 void sigResetToDefaults(); 43 44 public: 45 46 UIVMLogViewerSettingsPanel(QWidget *pParent, UIVMLogViewerWidget *pViewer); 47 48 void setShowLineNumbers(bool bShowLineNumbers); 49 void setWrapLines(bool bWrapLines); 50 void setFontSizeInPoints(int fontSizeInPoints); 51 52 public slots: 53 43 void sigListDirectoriesFirstChanged(); 54 44 55 45 protected: … … 63 53 private slots: 64 54 65 void slt OpenFontDialog();55 void sltListDirectoryCheckBoxToogled(bool fChecked); 66 56 67 57 private: 68 58 69 QCheckBox *m_pLineNumberCheckBox; 70 QCheckBox *m_pWrapLinesCheckBox; 71 QSpinBox *m_pFontSizeSpinBox; 72 QLabel *m_pFontSizeLabel; 73 QIToolButton *m_pOpenFontDialogButton; 74 QIToolButton *m_pResetToDefaultsButton; 75 76 /** Default font size in points. */ 77 const int m_iDefaultFontSize; 78 59 QCheckBox *m_pListDirectoriesOnTopCheckBox; 60 QCheckBox *m_pDeleteConfirmationCheckBox; 61 UIGuestControlFileManagerSettings *m_pFileManagerSettings; 79 62 }; 80 63 81 #endif /* !___UI VMLogViewerSettingsPanel_h___ */64 #endif /* !___UIGuestControlFileManagerSettingsPanel_h___ */ -
trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIGuestControlFileTable.cpp
r75203 r75220 959 959 m_pView->setRootIndex(m_pProxyModel->mapFromSource(currentIndex)); 960 960 setSelectionDependentActionsEnabled(m_pView->hasSelection()); 961 } 962 963 void UIGuestControlFileTable::relist() 964 { 965 if (!m_pProxyModel) 966 return; 967 m_pProxyModel->invalidate(); 961 968 } 962 969 -
trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIGuestControlFileTable.h
r75202 r75220 251 251 virtual ~UIGuestControlFileTable(); 252 252 /** Deletes all the tree nodes */ 253 void reset();254 void emitLogOutput(const QString& strOutput);253 void reset(); 254 void emitLogOutput(const QString& strOutput); 255 255 /** Returns the path of the rootIndex */ 256 256 QString currentDirectoryPath() const; … … 258 258 QStringList selectedItemPathList(); 259 259 virtual void refresh(); 260 260 void relist(); 261 261 static const unsigned m_iKiloByte; 262 262 static QString humanReadableSize(ULONG64 size); -
trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIGuestProcessControlWidget.cpp
r75087 r75220 29 29 /* GUI includes: */ 30 30 # include "QITreeWidget.h" 31 # include "UIActionPool.h" 31 32 # include "UIExtraDataManager.h" 32 33 # include "UIGuestControlConsole.h" … … 34 35 # include "UIGuestControlTreeItem.h" 35 36 # include "UIGuestProcessControlWidget.h" 37 # include "UIToolBar.h" 36 38 # include "UIVMInformationDialog.h" 37 39 # include "VBoxGlobal.h" … … 166 168 167 169 UIGuestProcessControlWidget::UIGuestProcessControlWidget(EmbedTo enmEmbedding, UIActionPool *pActionPool, 168 const CGuest &comGuest, QWidget *pParent )170 const CGuest &comGuest, QWidget *pParent, bool fShowToolbar /* = false */) 169 171 :QIWithRetranslateUI<QWidget>(pParent) 170 172 , m_comGuest(comGuest) … … 176 178 , m_enmEmbedding(enmEmbedding) 177 179 , m_pActionPool(pActionPool) 180 , m_pToolBar(0) 178 181 , m_pQtListener(0) 182 , m_fShowToolbar(fShowToolbar) 179 183 { 180 184 prepareListener(); 181 185 prepareObjects(); 182 186 prepareConnections(); 187 prepareToolBar(); 183 188 initGuestSessionTree(); 184 189 loadSettings(); … … 351 356 } 352 357 358 void UIGuestProcessControlWidget::prepareToolBar() 359 { 360 /* Create toolbar: */ 361 m_pToolBar = new UIToolBar(parentWidget()); 362 if (m_pToolBar) 363 { 364 /* Configure toolbar: */ 365 const int iIconMetric = (int)(QApplication::style()->pixelMetric(QStyle::PM_LargeIconSize)); 366 m_pToolBar->setIconSize(QSize(iIconMetric, iIconMetric)); 367 m_pToolBar->setToolButtonStyle(Qt::ToolButtonTextUnderIcon); 368 369 /* Add toolbar actions: */ 370 m_pToolBar->addSeparator(); 371 m_pToolBar->addSeparator(); 372 373 #ifdef VBOX_WS_MAC 374 /* Check whether we are embedded into a stack: */ 375 if (m_enmEmbedding == EmbedTo_Stack) 376 { 377 /* Add into layout: */ 378 m_pMainLayout->addWidget(m_pToolBar); 379 } 380 #else 381 /* Add into layout: */ 382 m_pMainLayout->addWidget(m_pToolBar); 383 #endif 384 } 385 } 386 353 387 void UIGuestProcessControlWidget::initGuestSessionTree() 354 388 { -
trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIGuestProcessControlWidget.h
r75087 r75220 41 41 class UIGuestSessionsEventHandler; 42 42 class UIGuestControlTreeWidget; 43 43 class UIToolBar; 44 44 45 45 /** QWidget extension … … 52 52 53 53 UIGuestProcessControlWidget(EmbedTo enmEmbedding, UIActionPool *pActionPool, 54 const CGuest &comGuest, QWidget *pParent );54 const CGuest &comGuest, QWidget *pParent, bool fShowToolbar = false); 55 55 ~UIGuestProcessControlWidget(); 56 56 … … 76 76 void prepareObjects(); 77 77 void prepareConnections(); 78 void prepareToolBar(); 78 79 void prepareListener(); 79 80 void initGuestSessionTree(); … … 92 93 const EmbedTo m_enmEmbedding; 93 94 UIActionPool *m_pActionPool; 95 UIToolBar *m_pToolBar; 94 96 95 97 /** Holds the Qt event listener instance. */ … … 97 99 /** Holds the COM event listener instance. */ 98 100 CEventListener m_comEventListener; 101 const bool m_fShowToolbar; 99 102 }; 100 103
Note:
See TracChangeset
for help on using the changeset viewer.