Changeset 88834 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- May 3, 2021 1:09:49 PM (4 years ago)
- svn:sync-xref-src-repo-rev:
- 144168
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIActionPool.cpp
r88242 r88834 1376 1376 setName(QApplication::translate("UIActionPool", "&Refresh")); 1377 1377 setShortcutScope(QApplication::translate("UIActionPool", "Log Viewer")); 1378 setStatusTip(QApplication::translate("UIActionPool", "Refresh selected virtual machine log")); 1379 setToolTip( QApplication::translate("UIActionPool", "Refresh Virtual Machine Log") 1378 setStatusTip(QApplication::translate("UIActionPool", "Refresh the currently viewed log")); 1379 setToolTip( QApplication::translate("UIActionPool", "Refresh the Currently Viewed Log") 1380 + (shortcut().isEmpty() ? QString() : QString(" (%1)").arg(shortcut().toString()))); 1381 } 1382 }; 1383 1384 /** Simple action extension, used as 'Perform Reload' action class. */ 1385 class UIActionMenuSelectorLogPerformReload : public UIActionSimple 1386 { 1387 Q_OBJECT; 1388 1389 public: 1390 1391 /** Constructs action passing @a pParent to the base-class. */ 1392 UIActionMenuSelectorLogPerformReload(UIActionPool *pParent) 1393 : UIActionSimple(pParent, 1394 ":/log_viewer_refresh_32px.png", ":/log_viewer_refresh_16px.png", 1395 ":/log_viewer_refresh_disabled_32px.png", ":/log_viewer_refresh_disabled_16px.png") 1396 { 1397 setShortcutContext(Qt::WidgetWithChildrenShortcut); 1398 } 1399 1400 protected: 1401 1402 /** Returns shortcut extra-data ID. */ 1403 virtual QString shortcutExtraDataID() const /* override */ 1404 { 1405 return QString("ReloadAllLogs"); 1406 } 1407 1408 /** Returns default shortcut. */ 1409 virtual QKeySequence defaultShortcut(UIActionPoolType) const /* override */ 1410 { 1411 return QKeySequence(); 1412 } 1413 1414 /** Returns standard shortcut. */ 1415 virtual QKeySequence standardShortcut(UIActionPoolType) const /* override */ 1416 { 1417 return QKeySequence(); 1418 } 1419 1420 /** Handles translation event. */ 1421 virtual void retranslateUi() /* override */ 1422 { 1423 setName(QApplication::translate("UIActionPool", "&Reload")); 1424 setShortcutScope(QApplication::translate("UIActionPool", "Log Viewer")); 1425 setStatusTip(QApplication::translate("UIActionPool", "Reread all the log files and refresh pages")); 1426 setToolTip( QApplication::translate("UIActionPool", "Reread All the Log Files and Refresh Pages") 1380 1427 + (shortcut().isEmpty() ? QString() : QString(" (%1)").arg(shortcut().toString()))); 1381 1428 } … … 2539 2586 m_pool[UIActionIndex_M_Log_T_Options] = new UIActionMenuSelectorLogTogglePaneOptions(this); 2540 2587 m_pool[UIActionIndex_M_Log_S_Refresh] = new UIActionMenuSelectorLogPerformRefresh(this); 2588 m_pool[UIActionIndex_M_Log_S_Reload] = new UIActionMenuSelectorLogPerformReload(this); 2541 2589 m_pool[UIActionIndex_M_Log_S_Save] = new UIActionMenuSelectorLogPerformSave(this); 2542 2590 … … 2963 3011 /* 'Refresh' action: */ 2964 3012 fSeparator = addAction(pMenu, action(UIActionIndex_M_Log_S_Refresh)) || fSeparator; 3013 fSeparator = addAction(pMenu, action(UIActionIndex_M_Log_S_Reload)) || fSeparator; 3014 2965 3015 } 2966 3016 -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIActionPool.h
r88242 r88834 96 96 UIActionIndex_M_Log_T_Options, 97 97 UIActionIndex_M_Log_S_Refresh, 98 UIActionIndex_M_Log_S_Reload, 98 99 UIActionIndex_M_Log_S_Save, 99 100 -
trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerWidget.cpp
r88817 r88834 332 332 } 333 333 334 void UIVMLogViewerWidget::sltReload() 335 { 336 if (!m_pTabWidget) 337 return; 338 339 m_pTabWidget->blockSignals(true); 340 m_pTabWidget->hide(); 341 342 removeAllLogPages(); 343 createLogViewerPages(m_machines); 344 345 /* re-Apply the filter settings: */ 346 if (m_pFilterPanel) 347 m_pFilterPanel->applyFilter(); 348 349 m_pTabWidget->blockSignals(false); 350 setTabColorPerMachine(); 351 m_pTabWidget->show(); 352 } 353 334 354 void UIVMLogViewerWidget::sltSave() 335 355 { … … 588 608 connect(m_pActionPool->action(UIActionIndex_M_Log_S_Refresh), &QAction::triggered, 589 609 this, &UIVMLogViewerWidget::sltRefresh); 610 connect(m_pActionPool->action(UIActionIndex_M_Log_S_Reload), &QAction::triggered, 611 this, &UIVMLogViewerWidget::sltReload); 590 612 connect(m_pActionPool->action(UIActionIndex_M_Log_S_Save), &QAction::triggered, 591 613 this, &UIVMLogViewerWidget::sltSave); … … 725 747 m_pToolBar->addSeparator(); 726 748 m_pToolBar->addAction(m_pActionPool->action(UIActionIndex_M_Log_S_Refresh)); 749 m_pToolBar->addAction(m_pActionPool->action(UIActionIndex_M_Log_S_Reload)); 727 750 728 751 #ifdef VBOX_WS_MAC … … 843 866 QPlainTextEdit* UIVMLogViewerWidget::logPage(int pIndex) const 844 867 { 845 if ( !m_pTabWidget->isEnabled())868 if (m_pTabWidget) 846 869 return 0; 847 870 QWidget* pContainer = m_pTabWidget->widget(pIndex); … … 850 873 QPlainTextEdit *pBrowser = pContainer->findChild<QPlainTextEdit*>(); 851 874 return pBrowser; 875 } 876 877 QVector<UIVMLogPage*> UIVMLogViewerWidget::logPages() 878 { 879 QVector<UIVMLogPage*> pages; 880 if (m_pTabWidget) 881 return pages; 882 for (int i = 0; i < m_pTabWidget->count(); ++i) 883 { 884 UIVMLogPage *pPage = logPage(i); 885 if (pPage) 886 pages << pPage; 887 } 888 return pages; 852 889 } 853 890 … … 963 1000 /* Remove all the tabs from tab widget, note that this does not delete tab widgets: */ 964 1001 m_pTabWidget->clear(); 1002 QVector<UIVMLogPage*> pagesToRemove; 965 1003 /* Add tab widgets (log pages) back as long as machine id is not in machineList: */ 966 1004 for (int i = 0; i < logPages.size(); ++i) … … 971 1009 972 1010 if (machineList.contains(id)) 973 continue; 974 m_pTabWidget->addTab(logPages[i].first, logPages[i].second); 975 } 1011 pagesToRemove << logPages[i].first; 1012 else 1013 m_pTabWidget->addTab(logPages[i].first, logPages[i].second); 1014 } 1015 /* Delete all the other pages: */ 1016 qDeleteAll(pagesToRemove.begin(), pagesToRemove.end()); 976 1017 m_pTabWidget->blockSignals(false); 977 1018 } 978 1019 1020 void UIVMLogViewerWidget::removeAllLogPages() 1021 { 1022 if (!m_pTabWidget) 1023 return; 1024 1025 QVector<UIVMLogPage*> pagesToRemove = logPages(); 1026 m_pTabWidget->clear(); 1027 qDeleteAll(pagesToRemove.begin(), pagesToRemove.end()); 1028 } 979 1029 980 1030 void UIVMLogViewerWidget::resetHighlighthing() -
trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerWidget.h
r88817 r88834 101 101 /** Rereads the log file shown in the current tab. */ 102 102 void sltRefresh(); 103 /** Rereads all the log files . */ 104 void sltReload(); 103 105 /** Handles save action triggering. */ 104 106 void sltSave(); … … 179 181 /** Returns the log page at tab with iIndex if it contains a log page. Return 0 otherwise. */ 180 182 UIVMLogPage *logPage(int iIndex); 183 /** Returns a vector of all the log pages of the tab widget. */ 184 QVector<UIVMLogPage*> logPages(); 181 185 182 186 void createLogViewerPages(const QVector<QUuid> &machineList); 183 187 /** Removes the log pages/tabs that shows logs of the machines from @p machineList. */ 184 188 void removeLogViewerPages(const QVector<QUuid> &machineList); 189 void removeAllLogPages(); 185 190 /** We alternate tab colors between two `darker and lighter` one per machine. This function goes over tabs and 186 191 * sets tab data so tab our QTabBar extension can color tabs correctly. */ -
trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManagerWidget.cpp
r88520 r88834 943 943 m_pToolBar->addAction(actionPool()->action(UIActionIndex_M_Log_T_Options)); 944 944 m_pToolBar->addAction(actionPool()->action(UIActionIndex_M_Log_S_Refresh)); 945 m_pToolBar->addAction(actionPool()->action(UIActionIndex_M_Log_S_Reload)); 945 946 m_pToolBar->addSeparator(); 946 947 m_pToolBar->addAction(actionPool()->action(UIActionIndexMN_M_Machine_S_Settings));
Note:
See TracChangeset
for help on using the changeset viewer.