Changeset 100890 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Aug 17, 2023 6:35:45 AM (16 months ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox
- Files:
-
- 2 deleted
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/Makefile.kmk
r100880 r100890 845 845 src/guestctrl/UIFileManagerGuestTable.h \ 846 846 src/guestctrl/UIFileManagerHostTable.h \ 847 src/guestctrl/UIFileManagerLogPanel.h \848 847 src/guestctrl/UIFileManagerOperationsPanel.h \ 849 848 src/guestctrl/UIFileManagerPanel.h \ … … 1061 1060 src/globals/UIVirtualBoxClientEventHandler.cpp \ 1062 1061 src/guestctrl/UIFileManager.cpp \ 1063 src/guestctrl/UIFileManagerLogPanel.cpp \1064 1062 src/guestctrl/UIFileManagerOperationsPanel.cpp \ 1065 1063 src/guestctrl/UIFileManagerPanel.cpp \ … … 1426 1424 src/guestctrl/UIFileManagerGuestTable.cpp \ 1427 1425 src/guestctrl/UIFileManagerHostTable.cpp \ 1428 src/guestctrl/UIFileManagerLogPanel.cpp \1429 1426 src/guestctrl/UIFileManagerPanel.cpp \ 1430 1427 src/guestctrl/UIFileManagerOperationsPanel.cpp \ -
trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIFileManager.cpp
r100888 r100890 43 43 #include "UIFileManager.h" 44 44 #include "UIFileManagerPanel.h" 45 #include "UIFileManagerLogPanel.h"46 45 #include "UIFileManagerOperationsPanel.h" 47 46 #include "UIFileManagerGuestTable.h" … … 314 313 this, &UIFileManager::sltCopyHostToGuest); 315 314 } 316 if (m_pLogPanel) 317 { 318 connect(m_pLogPanel, &UIFileManagerLogPanel::sigHidePanel, 319 this, &UIFileManager::sltHandleHidePanel); 320 connect(m_pLogPanel, &UIFileManagerLogPanel::sigShowPanel, 321 this, &UIFileManager::sltHandleShowPanel); 322 } 315 323 316 if (m_pPanel) 324 317 { … … 515 508 { 516 509 if (m_pPanel) 517 m_pPanel->update ();510 m_pPanel->updatePreferences(); 518 511 519 512 for (int i = 0; i < m_pGuestTablesContainer->count(); ++i) … … 582 575 } 583 576 pSplitter->addWidget(m_pOperationsPanel); 584 m_pLogPanel = new UIFileManagerLogPanel;585 if (m_pLogPanel)586 {587 m_pLogPanel->hide();588 m_panelActionMap.insert(m_pLogPanel, m_pActionPool->action(UIActionIndex_M_FileManager_T_Log));589 }590 pSplitter->addWidget(m_pLogPanel);591 577 } 592 578 … … 709 695 void UIFileManager::appendLog(const QString &strLog, const QString &strMachineName, FileManagerLogType eLogType) 710 696 { 711 if (!m_pLogPanel) 712 return; 713 m_pLogPanel->appendLog(strLog, strMachineName, eLogType); 697 if (m_pPanel) 698 m_pPanel->appendLog(strLog, strMachineName, eLogType); 714 699 } 715 700 -
trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIFileManagerPanel.cpp
r100887 r100890 32 32 #include <QSpinBox> 33 33 #include <QTabWidget> 34 #include <QTextEdit> 35 #include <QTime> 34 36 35 37 /* GUI includes: */ … … 39 41 /* Other VBox includes: */ 40 42 #include <iprt/assert.h> 43 44 45 /********************************************************************************************************************************* 46 * UIFileManagerLogViewer definition. * 47 *********************************************************************************************************************************/ 48 49 class UIFileManagerLogViewer : public QTextEdit 50 { 51 52 Q_OBJECT; 53 54 public: 55 56 UIFileManagerLogViewer(QWidget *pParent = 0); 57 58 protected: 59 60 virtual void contextMenuEvent(QContextMenuEvent * event) RT_OVERRIDE; 61 62 private slots: 63 64 void sltClear(); 65 }; 66 67 /********************************************************************************************************************************* 68 * UIFileManagerLogViewer implementation. * 69 *********************************************************************************************************************************/ 70 71 UIFileManagerLogViewer::UIFileManagerLogViewer(QWidget *pParent /* = 0 */) 72 :QTextEdit(pParent) 73 { 74 setUndoRedoEnabled(false); 75 setReadOnly(true); 76 } 77 78 void UIFileManagerLogViewer::contextMenuEvent(QContextMenuEvent *event) 79 { 80 QMenu *menu = createStandardContextMenu(); 81 82 QAction *pClearAction = menu->addAction(UIFileManager::tr("Clear")); 83 connect(pClearAction, &QAction::triggered, this, &UIFileManagerLogViewer::sltClear); 84 menu->exec(event->globalPos()); 85 delete menu; 86 } 87 88 void UIFileManagerLogViewer::sltClear() 89 { 90 clear(); 91 } 92 93 /********************************************************************************************************************************* 94 * UIFileManagerPanel implementation. * 95 *********************************************************************************************************************************/ 41 96 42 97 UIFileManagerPanel::UIFileManagerPanel(QWidget *pParent, UIFileManagerOptions *pFileManagerOptions) … … 63 118 pMainLayout->addWidget(m_pTabWidget); 64 119 preparePreferencesTab(); 120 prepareLogTab(); 65 121 } 66 122 67 123 void UIFileManagerPanel::preparePreferencesTab() 68 124 { 69 m_pPreferencesTab = new QWidget;125 QWidget *pPreferencesTab = new QWidget; 70 126 m_pListDirectoriesOnTopCheckBox = new QCheckBox; 71 127 m_pDeleteConfirmationCheckBox = new QCheckBox; … … 73 129 m_pShowHiddenObjectsCheckBox = new QCheckBox; 74 130 75 AssertReturnVoid( m_pPreferencesTab);131 AssertReturnVoid(pPreferencesTab); 76 132 AssertReturnVoid(m_pListDirectoriesOnTopCheckBox); 77 133 AssertReturnVoid(m_pDeleteConfirmationCheckBox); … … 104 160 this, &UIFileManagerPanel::sltShowHiddenObjectsCheckBoxToggled); 105 161 106 QGridLayout *pPreferencesLayout = new QGridLayout( m_pPreferencesTab);162 QGridLayout *pPreferencesLayout = new QGridLayout(pPreferencesTab); 107 163 AssertReturnVoid(pPreferencesLayout); 164 pPreferencesLayout->setContentsMargins(0, 0, 0, 0); 165 108 166 pPreferencesLayout->addWidget(m_pListDirectoriesOnTopCheckBox, 0, 0, 1, 1); 109 167 pPreferencesLayout->addWidget(m_pDeleteConfirmationCheckBox, 1, 0, 1, 1); 110 168 pPreferencesLayout->addWidget(m_pHumanReabableSizesCheckBox, 0, 1, 1, 1); 111 169 pPreferencesLayout->addWidget(m_pShowHiddenObjectsCheckBox, 1, 1, 1, 1); 112 113 m_pTabWidget->addTab(m_pPreferencesTab, QApplication::translate("UIFileManager", "Preferences")); 170 pPreferencesLayout->addItem(new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding), 2, 0, 1, 2); 171 172 m_pTabWidget->addTab(pPreferencesTab, QApplication::translate("UIFileManager", "Preferences")); 173 } 174 175 void UIFileManagerPanel::prepareLogTab() 176 { 177 QWidget *pLogTab = new QWidget; 178 AssertReturnVoid(pLogTab); 179 QHBoxLayout *pLogLayout = new QHBoxLayout(pLogTab); 180 AssertReturnVoid(pLogLayout); 181 pLogLayout->setContentsMargins(0, 0, 0, 0); 182 m_pLogTextEdit = new UIFileManagerLogViewer; 183 if (m_pLogTextEdit) 184 pLogLayout->addWidget(m_pLogTextEdit); 185 m_pTabWidget->addTab(pLogTab, QApplication::translate("UIFileManager", "Log")); 114 186 } 115 187 … … 175 247 } 176 248 177 void UIFileManagerPanel::update ()249 void UIFileManagerPanel::updatePreferences() 178 250 { 179 251 if (!m_pFileManagerOptions) … … 209 281 } 210 282 283 void UIFileManagerPanel::appendLog(const QString &strLog, const QString &strMachineName, FileManagerLogType eLogType) 284 { 285 if (!m_pLogTextEdit) 286 return; 287 QString strStartTag("<font color=\"Black\">"); 288 QString strEndTag("</font>"); 289 if (eLogType == FileManagerLogType_Error) 290 { 291 strStartTag = "<b><font color=\"Red\">"; 292 strEndTag = "</font></b>"; 293 } 294 QString strColoredLog = QString("%1 %2: %3 %4 %5").arg(strStartTag).arg(QTime::currentTime().toString("hh:mm:ss:z")).arg(strMachineName).arg(strLog).arg(strEndTag); 295 m_pLogTextEdit->append(strColoredLog); 296 m_pLogTextEdit->moveCursor(QTextCursor::End); 297 m_pLogTextEdit->ensureCursorVisible(); 298 } 211 299 212 300 #include "UIFileManagerPanel.moc" -
trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIFileManagerPanel.h
r100887 r100890 39 39 class QTabWidget; 40 40 class QCheckBox; 41 class UIFileManagerLogViewer; 41 42 class UIFileManagerOptions; 42 43 … … 52 53 53 54 UIFileManagerPanel(QWidget *pParent, UIFileManagerOptions *pFileManagerOptions); 54 void update(); 55 void updatePreferences(); 56 void appendLog(const QString &strLog, const QString &strMachineName, FileManagerLogType eLogType); 55 57 56 58 protected: … … 69 71 void prepare(); 70 72 void preparePreferencesTab(); 73 void prepareLogTab(); 74 71 75 QTabWidget *m_pTabWidget; 72 76 73 77 /** @name Preferences tab 74 78 * @{ */ 75 QWidget *m_pPreferencesTab;76 79 QCheckBox *m_pListDirectoriesOnTopCheckBox; 77 80 QCheckBox *m_pDeleteConfirmationCheckBox; … … 81 84 /** @} */ 82 85 86 /** @name Log tab 87 * @{ */ 88 UIFileManagerLogViewer *m_pLogTextEdit; 89 /** @} */ 83 90 84 91 };
Note:
See TracChangeset
for help on using the changeset viewer.