Changeset 73694 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Aug 15, 2018 3:07:32 PM (6 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIActionPool.cpp
r71617 r73694 1177 1177 1178 1178 1179 /** Menu action extension, used as 'Log' menu class. */ 1180 class UIActionMenuSelectorLog : public UIActionMenu 1181 { 1182 Q_OBJECT; 1183 1184 public: 1185 1186 /** Constructs action passing @a pParent to the base-class. */ 1187 UIActionMenuSelectorLog(UIActionPool *pParent) 1188 : UIActionMenu(pParent) 1189 {} 1190 1191 protected: 1192 1193 /** Returns shortcut extra-data ID. */ 1194 virtual QString shortcutExtraDataID() const /* override */ 1195 { 1196 return QString("LogViewerMenu"); 1197 } 1198 1199 /** Handles translation event. */ 1200 virtual void retranslateUi() /* override */ 1201 { 1202 setName(QApplication::translate("UIActionPool", "&Log Viewer")); 1203 setStatusTip(QApplication::translate("UIActionPool", "Open the log menu")); 1204 } 1205 }; 1206 1207 /** Simple action extension, used as 'Toggle Pane Find' action class. */ 1208 class UIActionMenuSelectorLogTogglePaneFind : public UIActionToggle 1209 { 1210 Q_OBJECT; 1211 1212 public: 1213 1214 /** Constructs action passing @a pParent to the base-class. */ 1215 UIActionMenuSelectorLogTogglePaneFind(UIActionPool *pParent) 1216 : UIActionToggle(pParent, 1217 ":/log_viewer_find_22px.png", ":/log_viewer_find_disabled_22px.png") 1218 {} 1219 1220 protected: 1221 1222 /** Returns shortcut extra-data ID. */ 1223 virtual QString shortcutExtraDataID() const /* override */ 1224 { 1225 return QString("ToggleLogFind"); 1226 } 1227 1228 /** Returns default shortcut. */ 1229 virtual QKeySequence defaultShortcut(UIActionPoolType) const /* override */ 1230 { 1231 return QKeySequence("Ctrl+Shift+F"); 1232 } 1233 1234 /** Handles translation event. */ 1235 virtual void retranslateUi() /* override */ 1236 { 1237 setName(QApplication::translate("UIActionPool", "&Find")); 1238 setStatusTip(QApplication::translate("UIActionPool", "Open pane with searching options")); 1239 setToolTip(tr("Open Find Pane (%1)").arg(shortcut().toString())); 1240 } 1241 }; 1242 1243 /** Simple action extension, used as 'Toggle Pane Filter' action class. */ 1244 class UIActionMenuSelectorLogTogglePaneFilter : public UIActionToggle 1245 { 1246 Q_OBJECT; 1247 1248 public: 1249 1250 /** Constructs action passing @a pParent to the base-class. */ 1251 UIActionMenuSelectorLogTogglePaneFilter(UIActionPool *pParent) 1252 : UIActionToggle(pParent, 1253 ":/log_viewer_filter_22px.png", ":/log_viewer_filter_disabled_22px.png") 1254 {} 1255 1256 protected: 1257 1258 /** Returns shortcut extra-data ID. */ 1259 virtual QString shortcutExtraDataID() const /* override */ 1260 { 1261 return QString("ToggleLogFilter"); 1262 } 1263 1264 /** Returns default shortcut. */ 1265 virtual QKeySequence defaultShortcut(UIActionPoolType) const /* override */ 1266 { 1267 return QKeySequence("Ctrl+Shift+T"); 1268 } 1269 1270 /** Handles translation event. */ 1271 virtual void retranslateUi() /* override */ 1272 { 1273 setName(QApplication::translate("UIActionPool", "&Filter")); 1274 setStatusTip(QApplication::translate("UIActionPool", "Open pane with filtering options")); 1275 setToolTip(tr("Open Filter Pane (%1)").arg(shortcut().toString())); 1276 } 1277 }; 1278 1279 /** Simple action extension, used as 'Toggle Pane Bookmark' action class. */ 1280 class UIActionMenuSelectorLogTogglePaneBookmark : public UIActionToggle 1281 { 1282 Q_OBJECT; 1283 1284 public: 1285 1286 /** Constructs action passing @a pParent to the base-class. */ 1287 UIActionMenuSelectorLogTogglePaneBookmark(UIActionPool *pParent) 1288 : UIActionToggle(pParent, 1289 ":/log_viewer_bookmark_22px.png", ":/log_viewer_bookmark_disabled_22px.png") 1290 {} 1291 1292 protected: 1293 1294 /** Returns shortcut extra-data ID. */ 1295 virtual QString shortcutExtraDataID() const /* override */ 1296 { 1297 return QString("ToggleLogBookmark"); 1298 } 1299 1300 /** Returns default shortcut. */ 1301 virtual QKeySequence defaultShortcut(UIActionPoolType) const /* override */ 1302 { 1303 return QKeySequence("Ctrl+Shift+D"); 1304 } 1305 1306 /** Handles translation event. */ 1307 virtual void retranslateUi() /* override */ 1308 { 1309 setName(QApplication::translate("UIActionPool", "&Bookmark")); 1310 setStatusTip(QApplication::translate("UIActionPool", "Open pane with bookmarking options")); 1311 setToolTip(tr("Open Bookmark Pane (%1)").arg(shortcut().toString())); 1312 } 1313 }; 1314 1315 /** Simple action extension, used as 'Toggle Pane Settings' action class. */ 1316 class UIActionMenuSelectorLogTogglePaneSettings : public UIActionToggle 1317 { 1318 Q_OBJECT; 1319 1320 public: 1321 1322 /** Constructs action passing @a pParent to the base-class. */ 1323 UIActionMenuSelectorLogTogglePaneSettings(UIActionPool *pParent) 1324 : UIActionToggle(pParent, 1325 ":/log_viewer_settings_22px.png", ":/log_viewer_settings_disabled_22px.png") 1326 {} 1327 1328 protected: 1329 1330 /** Returns shortcut extra-data ID. */ 1331 virtual QString shortcutExtraDataID() const /* override */ 1332 { 1333 return QString("ToggleLogSettings"); 1334 } 1335 1336 /** Returns default shortcut. */ 1337 virtual QKeySequence defaultShortcut(UIActionPoolType) const /* override */ 1338 { 1339 return QKeySequence("Ctrl+Shift+P"); 1340 } 1341 1342 /** Handles translation event. */ 1343 virtual void retranslateUi() /* override */ 1344 { 1345 setName(QApplication::translate("UIActionPool", "&Settings")); 1346 setStatusTip(QApplication::translate("UIActionPool", "Open pane with log viewer settings")); 1347 setToolTip(tr("Open Settings Pane (%1)").arg(shortcut().toString())); 1348 } 1349 }; 1350 1351 /** Simple action extension, used as 'Perform Refresh' action class. */ 1352 class UIActionMenuSelectorLogPerformRefresh : public UIActionSimple 1353 { 1354 Q_OBJECT; 1355 1356 public: 1357 1358 /** Constructs action passing @a pParent to the base-class. */ 1359 UIActionMenuSelectorLogPerformRefresh(UIActionPool *pParent) 1360 : UIActionSimple(pParent, 1361 ":/log_viewer_refresh_22px.png", ":/log_viewer_refresh_disabled_22px.png") 1362 {} 1363 1364 protected: 1365 1366 /** Returns shortcut extra-data ID. */ 1367 virtual QString shortcutExtraDataID() const /* override */ 1368 { 1369 return QString("RefreshLog"); 1370 } 1371 1372 /** Returns default shortcut. */ 1373 virtual QKeySequence defaultShortcut(UIActionPoolType) const /* override */ 1374 { 1375 return QKeySequence("Ctrl+Shift+R"); 1376 } 1377 1378 /** Handles translation event. */ 1379 virtual void retranslateUi() /* override */ 1380 { 1381 setName(QApplication::translate("UIActionPool", "&Refresh")); 1382 setStatusTip(QApplication::translate("UIActionPool", "Refresh selected virtual machine log")); 1383 setToolTip(tr("Refresh Virtual Machine Log (%1)").arg(shortcut().toString())); 1384 } 1385 }; 1386 1387 /** Simple action extension, used as 'Perform Save' action class. */ 1388 class UIActionMenuSelectorLogPerformSave : public UIActionSimple 1389 { 1390 Q_OBJECT; 1391 1392 public: 1393 1394 /** Constructs action passing @a pParent to the base-class. */ 1395 UIActionMenuSelectorLogPerformSave(UIActionPool *pParent) 1396 : UIActionSimple(pParent, 1397 ":/log_viewer_save_22px.png", ":/log_viewer_save_disabled_22px.png") 1398 {} 1399 1400 protected: 1401 1402 /** Returns shortcut extra-data ID. */ 1403 virtual QString shortcutExtraDataID() const /* override */ 1404 { 1405 return QString("SaveLog"); 1406 } 1407 1408 /** Returns default shortcut. */ 1409 virtual QKeySequence defaultShortcut(UIActionPoolType) const /* override */ 1410 { 1411 return QKeySequence("Ctrl+Shift+S"); 1412 } 1413 1414 /** Handles translation event. */ 1415 virtual void retranslateUi() /* override */ 1416 { 1417 setName(QApplication::translate("UIActionPool", "&Save...")); 1418 setStatusTip(QApplication::translate("UIActionPool", "Save selected virtual machine log")); 1419 setToolTip(tr("Save Virtual Machine Log (%1)").arg(shortcut().toString())); 1420 } 1421 }; 1422 1423 1179 1424 /********************************************************************************************************************************* 1180 1425 * Class UIActionPool implementation. * … … 1372 1617 #endif 1373 1618 1619 /* Create 'Log Viewer' actions: */ 1620 m_pool[UIActionIndex_M_LogViewer] = new UIActionMenuSelectorLog(this); 1621 m_pool[UIActionIndex_M_LogViewer_T_Find] = new UIActionMenuSelectorLogTogglePaneFind(this); 1622 m_pool[UIActionIndex_M_LogViewer_T_Filter] = new UIActionMenuSelectorLogTogglePaneFilter(this); 1623 m_pool[UIActionIndex_M_LogViewer_T_Bookmark] = new UIActionMenuSelectorLogTogglePaneBookmark(this); 1624 m_pool[UIActionIndex_M_LogViewer_T_Settings] = new UIActionMenuSelectorLogTogglePaneSettings(this); 1625 m_pool[UIActionIndex_M_LogViewer_S_Refresh] = new UIActionMenuSelectorLogPerformRefresh(this); 1626 m_pool[UIActionIndex_M_LogViewer_S_Save] = new UIActionMenuSelectorLogPerformSave(this); 1627 1374 1628 /* Prepare update-handlers for known menus: */ 1375 1629 #ifdef VBOX_WS_MAC … … 1378 1632 #endif 1379 1633 m_menuUpdateHandlers[UIActionIndex_Menu_Help].ptf = &UIActionPool::updateMenuHelp; 1634 m_menuUpdateHandlers[UIActionIndex_M_LogViewer].ptf = &UIActionPool::updateMenuLogViewer; 1380 1635 1381 1636 /* Invalidate all known menus: */ … … 1614 1869 } 1615 1870 1871 void UIActionPool::updateMenuLogViewer() 1872 { 1873 /* Get corresponding menu: */ 1874 UIMenu *pMenu = action(UIActionIndex_M_LogViewer)->menu(); 1875 AssertPtrReturnVoid(pMenu); 1876 /* Clear contents: */ 1877 pMenu->clear(); 1878 1879 /* Separator? */ 1880 bool fSeparator = false; 1881 1882 /* 'Save' action: */ 1883 fSeparator = addAction(pMenu, action(UIActionIndex_M_LogViewer_S_Save)) || fSeparator; 1884 1885 /* Separator? */ 1886 if (fSeparator) 1887 { 1888 pMenu->addSeparator(); 1889 fSeparator = false; 1890 } 1891 1892 /* 'Find' action: */ 1893 fSeparator = addAction(pMenu, action(UIActionIndex_M_LogViewer_T_Find)) || fSeparator; 1894 /* 'Filter' action: */ 1895 fSeparator = addAction(pMenu, action(UIActionIndex_M_LogViewer_T_Filter)) || fSeparator; 1896 /* 'Bookmarks' action: */ 1897 fSeparator = addAction(pMenu, action(UIActionIndex_M_LogViewer_T_Bookmark)) || fSeparator; 1898 /* 'Settings' action: */ 1899 fSeparator = addAction(pMenu, action(UIActionIndex_M_LogViewer_T_Settings)) || fSeparator; 1900 1901 /* Separator? */ 1902 if (fSeparator) 1903 { 1904 pMenu->addSeparator(); 1905 fSeparator = false; 1906 } 1907 1908 /* 'Refresh' action: */ 1909 fSeparator = addAction(pMenu, action(UIActionIndex_M_LogViewer_S_Refresh)) || fSeparator;; 1910 1911 /* Mark menu as valid: */ 1912 m_invalidations.remove(UIActionIndex_M_LogViewer); 1913 } 1914 1616 1915 void UIActionPool::retranslateUi() 1617 1916 { -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIActionPool.h
r71630 r73694 87 87 UIActionIndex_Simple_About, 88 88 #endif 89 90 /* 'Log Viewer' menu actions: */ 91 UIActionIndex_M_LogViewer, 92 UIActionIndex_M_LogViewer_T_Find, 93 UIActionIndex_M_LogViewer_T_Filter, 94 UIActionIndex_M_LogViewer_T_Bookmark, 95 UIActionIndex_M_LogViewer_T_Settings, 96 UIActionIndex_M_LogViewer_S_Refresh, 97 UIActionIndex_M_LogViewer_S_Save, 89 98 90 99 /* Maximum index: */ … … 545 554 /** Updates 'Help' menu. */ 546 555 virtual void updateMenuHelp(); 556 /** Updates 'Log Viewer' menu. */ 557 virtual void updateMenuLogViewer(); 547 558 548 559 /** Updates shortcuts. */ -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIActionPoolRuntime.cpp
r73578 r73694 3425 3425 addMenu(m_mainMenus, action(UIActionIndex_Menu_Help)); 3426 3426 updateMenuHelp(); 3427 3428 /* 'Log Viewer' menu: */ 3429 updateMenuLogViewer(); 3427 3430 } 3428 3431 -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIActionPoolSelector.cpp
r73671 r73694 1881 1881 /* 'Help' menu: */ 1882 1882 updateMenuHelp(); 1883 1884 /* 'Log Viewer' menu: */ 1885 updateMenuLogViewer(); 1883 1886 } 1884 1887 -
trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerDialog.cpp
r73693 r73694 50 50 *********************************************************************************************************************************/ 51 51 52 UIVMLogViewerDialogFactory::UIVMLogViewerDialogFactory(const CMachine &comMachine /* = CMachine() */) 53 : m_comMachine(comMachine) 52 UIVMLogViewerDialogFactory::UIVMLogViewerDialogFactory(UIActionPool *pActionPool /* = 0 */, 53 const CMachine &comMachine /* = CMachine() */) 54 : m_pActionPool(pActionPool) 55 , m_comMachine(comMachine) 54 56 { 55 57 } … … 57 59 void UIVMLogViewerDialogFactory::create(QIManagerDialog *&pDialog, QWidget *pCenterWidget) 58 60 { 59 pDialog = new UIVMLogViewerDialog(pCenterWidget, m_ comMachine);61 pDialog = new UIVMLogViewerDialog(pCenterWidget, m_pActionPool, m_comMachine); 60 62 } 61 63 … … 65 67 *********************************************************************************************************************************/ 66 68 67 UIVMLogViewerDialog::UIVMLogViewerDialog(QWidget *pCenterWidget, const CMachine &comMachine)69 UIVMLogViewerDialog::UIVMLogViewerDialog(QWidget *pCenterWidget, UIActionPool *pActionPool, const CMachine &comMachine) 68 70 : QIWithRetranslateUI<QIManagerDialog>(pCenterWidget) 71 , m_pActionPool(pActionPool) 69 72 , m_comMachine(comMachine) 70 73 { … … 92 95 { 93 96 /* Create widget: */ 94 UIVMLogViewerWidget *pWidget = new UIVMLogViewerWidget(EmbedTo_Dialog, m_ comMachine, this);97 UIVMLogViewerWidget *pWidget = new UIVMLogViewerWidget(EmbedTo_Dialog, m_pActionPool, m_comMachine, this); 95 98 if (pWidget) 96 99 { -
trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerDialog.h
r73693 r73694 35 35 class QDialogButtonBox; 36 36 class QVBoxLayout; 37 class UIActionPool; 37 38 class UIVMLogViewerDialog; 38 39 class CMachine; … … 45 46 46 47 /** Constructs Log Viewer factory acquiring additional arguments. 47 * @param comMachine Brings the machine for which VM Log-Viewer is requested. */ 48 UIVMLogViewerDialogFactory(const CMachine &comMachine = CMachine()); 48 * @param pActionPool Brings the action-pool reference. 49 * @param comMachine Brings the machine for which VM Log-Viewer is requested. */ 50 UIVMLogViewerDialogFactory(UIActionPool *pActionPool = 0, const CMachine &comMachine = CMachine()); 49 51 50 52 protected: … … 54 56 virtual void create(QIManagerDialog *&pDialog, QWidget *pCenterWidget) /* override */; 55 57 58 /** Holds the action-pool reference. */ 59 UIActionPool *m_pActionPool; 56 60 /** Holds the machine reference. */ 57 61 CMachine m_comMachine; … … 68 72 /** Constructs Log Viewer dialog. 69 73 * @param pCenterWidget Brings the widget reference to center according to. 74 * @param pActionPool Brings the action-pool reference. 70 75 * @param comMachine Brings the machine reference. */ 71 UIVMLogViewerDialog(QWidget *pCenterWidget, const CMachine &comMachine);76 UIVMLogViewerDialog(QWidget *pCenterWidget, UIActionPool *pActionPool, const CMachine &comMachine); 72 77 73 78 protected: … … 107 112 private: 108 113 114 /** Holds the action-pool reference. */ 115 UIActionPool *m_pActionPool; 109 116 /** Holds the machine reference. */ 110 CMachine m_comMachine;117 CMachine m_comMachine; 111 118 }; 112 119 -
trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerWidget.cpp
r73693 r73694 38 38 # include "QIFileDialog.h" 39 39 # include "QITabWidget.h" 40 # include "UIActionPool.h" 40 41 # include "UIExtraDataManager.h" 41 42 # include "UIIconPool.h" … … 58 59 59 60 UIVMLogViewerWidget::UIVMLogViewerWidget(EmbedTo enmEmbedding, 61 UIActionPool *pActionPool, 60 62 const CMachine &comMachine /* = CMachine() */, 61 63 QWidget *pParent /* = 0 */) 62 64 : QIWithRetranslateUI<QWidget>(pParent) 63 65 , m_enmEmbedding(enmEmbedding) 66 , m_pActionPool(pActionPool) 64 67 , m_comMachine(comMachine) 65 68 , m_fIsPolished(false) … … 71 74 , m_pMainLayout(0) 72 75 , m_pToolBar(0) 73 , m_pActionFind(0)74 , m_pActionFilter(0)75 , m_pActionRefresh(0)76 , m_pActionSave(0)77 , m_pActionBookmarks(0)78 , m_pActionSettings(0)79 , m_pMenu(0)80 76 , m_bShowLineNumbers(true) 81 77 , m_bWrapLines(false) … … 110 106 111 107 return iDefaultWidth; 108 } 109 110 QMenu *UIVMLogViewerWidget::menu() const 111 { 112 return m_pActionPool->action(UIActionIndex_M_LogViewer)->menu(); 112 113 } 113 114 … … 187 188 188 189 /* Enable/Disable toolbar actions (except Refresh) & tab widget according log presence: */ 189 if (m_pActionFind) 190 m_pActionFind->setEnabled(!noLogsToShow); 191 if (m_pActionFilter) 192 m_pActionFilter->setEnabled(!noLogsToShow); 193 if (m_pActionSave) 194 m_pActionSave->setEnabled(!noLogsToShow); 195 if (m_pActionBookmarks) 196 m_pActionBookmarks->setEnabled(!noLogsToShow); 197 if (m_pActionSettings) 198 m_pActionSettings->setEnabled(!noLogsToShow); 190 m_pActionPool->action(UIActionIndex_M_LogViewer_T_Find)->setEnabled(!noLogsToShow); 191 m_pActionPool->action(UIActionIndex_M_LogViewer_T_Filter)->setEnabled(!noLogsToShow); 192 m_pActionPool->action(UIActionIndex_M_LogViewer_S_Save)->setEnabled(!noLogsToShow); 193 m_pActionPool->action(UIActionIndex_M_LogViewer_T_Bookmark)->setEnabled(!noLogsToShow); 194 m_pActionPool->action(UIActionIndex_M_LogViewer_T_Settings)->setEnabled(!noLogsToShow); 199 195 200 196 m_pTabWidget->show(); … … 426 422 prepareActions(); 427 423 prepareToolBar(); 428 prepareMenu();429 424 prepareWidgets(); 430 425 /* Load settings: */ … … 442 437 void UIVMLogViewerWidget::prepareActions() 443 438 { 444 /* Create and configure 'Find' action: */ 445 m_pActionFind = new QAction(this); 446 if (m_pActionFind) 447 { 448 m_pActionFind->setShortcut(QKeySequence("Ctrl+F")); 449 m_pActionFind->setCheckable(true); 450 connect(m_pActionFind, &QAction::triggered, this, &UIVMLogViewerWidget::sltPanelActionToggled); 451 } 452 453 /* Create and configure 'Filter' action: */ 454 m_pActionFilter = new QAction(this); 455 if (m_pActionFilter) 456 { 457 m_pActionFilter->setShortcut(QKeySequence("Ctrl+T")); 458 m_pActionFilter->setCheckable(true); 459 connect(m_pActionFilter, &QAction::triggered, this, &UIVMLogViewerWidget::sltPanelActionToggled); 460 } 461 /* Create and configure 'Bookmark' action: */ 462 m_pActionBookmarks = new QAction(this); 463 if (m_pActionBookmarks) 464 { 465 /* tie Ctrl+D to save only if we show this in a dialog since Ctrl+D is 466 already assigned to another action in the selector UI: */ 467 if (m_enmEmbedding == EmbedTo_Dialog) 468 m_pActionBookmarks->setShortcut(QKeySequence("Ctrl+D")); 469 m_pActionBookmarks->setCheckable(true); 470 connect(m_pActionBookmarks, &QAction::triggered, this, &UIVMLogViewerWidget::sltPanelActionToggled); 471 } 472 473 /* Create and configure 'Settings' action: */ 474 m_pActionSettings = new QAction(this); 475 if (m_pActionSettings) 476 { 477 m_pActionSettings->setShortcut(QKeySequence("Ctrl+P")); 478 m_pActionSettings->setCheckable(true); 479 connect(m_pActionSettings, &QAction::triggered, this, &UIVMLogViewerWidget::sltPanelActionToggled); 480 } 481 482 /* Create and configure 'Refresh' action: */ 483 m_pActionRefresh = new QAction(this); 484 if (m_pActionRefresh) 485 { 486 m_pActionRefresh->setShortcut(QKeySequence("F5")); 487 connect(m_pActionRefresh, &QAction::triggered, this, &UIVMLogViewerWidget::sltRefresh); 488 } 489 490 /* Create and configure 'Save' action: */ 491 m_pActionSave = new QAction(this); 492 if (m_pActionSave) 493 { 494 /* tie Ctrl+S to save only if we show this in a dialog since Ctrl+S is 495 already assigned to another action in the selector UI: */ 496 if (m_enmEmbedding == EmbedTo_Dialog) 497 m_pActionSave->setShortcut(QKeySequence("Ctrl+S")); 498 connect(m_pActionSave, &QAction::triggered, this, &UIVMLogViewerWidget::sltSave); 499 } 500 501 /* Update action icons: */ 502 prepareActionIcons(); 503 } 504 505 void UIVMLogViewerWidget::prepareActionIcons() 506 { 507 if (m_pActionFind) 508 m_pActionFind->setIcon(UIIconPool::iconSet(QString(":/log_viewer_find_22px.png"), 509 QString(":/log_viewer_find_disabled_22px.png"))); 510 if (m_pActionFilter) 511 m_pActionFilter->setIcon(UIIconPool::iconSet(QString(":/log_viewer_filter_22px.png"), 512 QString(":/log_viewer_filter_disabled_22px.png"))); 513 if (m_pActionRefresh) 514 m_pActionRefresh->setIcon(UIIconPool::iconSet(QString(":/log_viewer_refresh_22px.png"), 515 QString(":/log_viewer_refresh_disabled_22px.png"))); 516 if (m_pActionSave) 517 m_pActionSave->setIcon(UIIconPool::iconSet(QString(":/log_viewer_save_22px.png"), 518 QString(":/log_viewer_save_disabled_22px.png"))); 519 if (m_pActionBookmarks) 520 m_pActionBookmarks->setIcon(UIIconPool::iconSet(QString(":/log_viewer_bookmark_22px.png"), 521 QString(":/log_viewer_bookmark_disabled_22px.png"))); 522 if (m_pActionSettings) 523 m_pActionSettings->setIcon(UIIconPool::iconSet(QString(":/log_viewer_settings_22px.png"), 524 QString(":/log_viewer_settings_disabled_22px.png"))); 439 /* Configure 'Find' action: */ 440 connect(m_pActionPool->action(UIActionIndex_M_LogViewer_T_Find), &QAction::toggled, 441 this, &UIVMLogViewerWidget::sltPanelActionToggled); 442 443 /* Configure 'Filter' action: */ 444 connect(m_pActionPool->action(UIActionIndex_M_LogViewer_T_Filter), &QAction::toggled, 445 this, &UIVMLogViewerWidget::sltPanelActionToggled); 446 447 /* Configure 'Bookmark' action: */ 448 connect(m_pActionPool->action(UIActionIndex_M_LogViewer_T_Bookmark), &QAction::toggled, 449 this, &UIVMLogViewerWidget::sltPanelActionToggled); 450 451 /* Configure 'Settings' action: */ 452 connect(m_pActionPool->action(UIActionIndex_M_LogViewer_T_Settings), &QAction::toggled, 453 this, &UIVMLogViewerWidget::sltPanelActionToggled); 454 455 /* Configure 'Refresh' action: */ 456 connect(m_pActionPool->action(UIActionIndex_M_LogViewer_S_Refresh), &QAction::triggered, 457 this, &UIVMLogViewerWidget::sltRefresh); 458 459 /* Configure 'Save' action: */ 460 connect(m_pActionPool->action(UIActionIndex_M_LogViewer_S_Save), &QAction::triggered, 461 this, &UIVMLogViewerWidget::sltSave); 525 462 } 526 463 … … 537 474 538 475 /* Add toolbar actions: */ 539 if (m_pActionSave) 540 { 541 m_pToolBar->addAction(m_pActionSave); 542 m_pToolBar->addSeparator(); 543 } 544 if (m_pActionFind) 545 m_pToolBar->addAction(m_pActionFind); 546 if (m_pActionFilter) 547 m_pToolBar->addAction(m_pActionFilter); 548 if (m_pActionBookmarks) 549 m_pToolBar->addAction(m_pActionBookmarks); 550 if (m_pActionSettings) 551 m_pToolBar->addAction(m_pActionSettings); 552 if (m_pActionRefresh) 553 { 554 m_pToolBar->addSeparator(); 555 m_pToolBar->addAction(m_pActionRefresh); 556 } 476 m_pToolBar->addAction(m_pActionPool->action(UIActionIndex_M_LogViewer_S_Save)); 477 m_pToolBar->addSeparator(); 478 m_pToolBar->addAction(m_pActionPool->action(UIActionIndex_M_LogViewer_T_Find)); 479 m_pToolBar->addAction(m_pActionPool->action(UIActionIndex_M_LogViewer_T_Filter)); 480 m_pToolBar->addAction(m_pActionPool->action(UIActionIndex_M_LogViewer_T_Bookmark)); 481 m_pToolBar->addAction(m_pActionPool->action(UIActionIndex_M_LogViewer_T_Settings)); 482 m_pToolBar->addSeparator(); 483 m_pToolBar->addAction(m_pActionPool->action(UIActionIndex_M_LogViewer_S_Refresh)); 557 484 558 485 #ifdef VBOX_WS_MAC … … 570 497 } 571 498 572 void UIVMLogViewerWidget::prepareMenu()573 {574 /* Create 'LogViewer' menu: */575 m_pMenu = new QMenu(this);576 if (m_pMenu)577 {578 if (m_pActionSave)579 {580 m_pMenu->addAction(m_pActionSave);581 m_pMenu->addSeparator();582 }583 if (m_pActionFind)584 m_pMenu->addAction(m_pActionFind);585 if (m_pActionFilter)586 m_pMenu->addAction(m_pActionFilter);587 if (m_pActionBookmarks)588 m_pMenu->addAction(m_pActionBookmarks);589 if (m_pActionSettings)590 m_pMenu->addAction(m_pActionSettings);591 if (m_pActionRefresh)592 {593 m_pMenu->addSeparator();594 m_pMenu->addAction(m_pActionRefresh);595 }596 }597 }598 599 499 void UIVMLogViewerWidget::prepareWidgets() 600 500 { … … 624 524 connect(m_pSearchPanel, &UIVMLogViewerSearchPanel::sigHighlightingUpdated, 625 525 this, &UIVMLogViewerWidget::sltSearchResultHighLigting); 626 m_panelActionMap.insert(m_pSearchPanel, m_pAction Find);526 m_panelActionMap.insert(m_pSearchPanel, m_pActionPool->action(UIActionIndex_M_LogViewer_T_Find)); 627 527 628 528 /* Add into layout: */ … … 639 539 connect(m_pFilterPanel, &UIVMLogViewerFilterPanel::sigFilterApplied, 640 540 this, &UIVMLogViewerWidget::sltFilterApplied); 641 m_panelActionMap.insert(m_pFilterPanel, m_pAction Filter);541 m_panelActionMap.insert(m_pFilterPanel, m_pActionPool->action(UIActionIndex_M_LogViewer_T_Filter)); 642 542 643 543 /* Add into layout: */ … … 656 556 connect(m_pBookmarksPanel, &UIVMLogViewerBookmarksPanel::sigBookmarkSelected, 657 557 this, &UIVMLogViewerWidget::gotoBookmark); 658 m_panelActionMap.insert(m_pBookmarksPanel, m_pAction Bookmarks);558 m_panelActionMap.insert(m_pBookmarksPanel, m_pActionPool->action(UIActionIndex_M_LogViewer_T_Bookmark)); 659 559 660 560 /* Add into layout: */ … … 675 575 connect(m_pSettingsPanel, &UIVMLogViewerSettingsPanel::sigChangeFont, this, &UIVMLogViewerWidget::sltChangeFont); 676 576 connect(m_pSettingsPanel, &UIVMLogViewerSettingsPanel::sigResetToDefaults, this, &UIVMLogViewerWidget::sltResetSettingsToDefault); 677 m_panelActionMap.insert(m_pSettingsPanel, m_pAction Settings);577 m_panelActionMap.insert(m_pSettingsPanel, m_pActionPool->action(UIActionIndex_M_LogViewer_T_Settings)); 678 578 679 579 /* Add into layout: */ … … 704 604 void UIVMLogViewerWidget::retranslateUi() 705 605 { 706 if (m_pMenu)707 {708 m_pMenu->setTitle(tr("&Log Viewer"));709 }710 711 if (m_pActionFind)712 {713 m_pActionFind->setText(tr("&Find"));714 m_pActionFind->setToolTip(tr("Show/Hide 'Find' Panel (Ctrl+F)"));715 m_pActionFind->setStatusTip(tr("Show/Hide 'Find' Panel (Ctrl+F)"));716 }717 718 if (m_pActionFilter)719 {720 m_pActionFilter->setText(tr("&Filter"));721 m_pActionFilter->setToolTip(tr("Show/Hide 'Filter' Panel (Ctrl+T)"));722 m_pActionFilter->setStatusTip(tr("Show/Hide 'Filter' Panel (Ctrl+T)"));723 }724 725 if (m_pActionRefresh)726 {727 m_pActionRefresh->setText(tr("&Refresh"));728 m_pActionRefresh->setToolTip(tr("Reload the log (F5)"));729 m_pActionRefresh->setStatusTip(tr("Reload the log (F5)"));730 }731 732 if (m_pActionSave)733 {734 m_pActionSave->setText(tr("&Save..."));735 if (m_enmEmbedding == EmbedTo_Dialog)736 {737 m_pActionSave->setToolTip(tr("Save the log (Ctrl+S)"));738 m_pActionSave->setStatusTip(tr("Save the log (Ctrl+S)"));739 }740 else741 {742 m_pActionSave->setToolTip(tr("Save the log"));743 m_pActionSave->setStatusTip(tr("Save the log"));744 }745 }746 747 if (m_pActionBookmarks)748 {749 m_pActionBookmarks->setText(tr("&Bookmarks"));750 if (m_enmEmbedding == EmbedTo_Dialog)751 {752 m_pActionBookmarks->setToolTip(tr("Show/Hide 'Bookmarks' Panel (Ctrl+D)"));753 m_pActionBookmarks->setStatusTip(tr("Show/Hide 'Bookmarks' Panel (Ctrl+D)"));754 }755 else756 {757 m_pActionBookmarks->setToolTip(tr("Show/Hide 'Bookmarks' Panel"));758 m_pActionBookmarks->setStatusTip(tr("Show/Hide 'Bookmarks' Panel"));759 }760 }761 762 if (m_pActionSettings)763 {764 m_pActionSettings->setText(tr("&Settings"));765 m_pActionSettings->setToolTip(tr("Show/Hide 'Settings' Panel (Ctrl+P)"));766 m_pActionSettings->setStatusTip(tr("Show/Hide 'Settings' Panel (Ctrl+P)"));767 }768 769 606 /* Translate toolbar: */ 770 607 #ifdef VBOX_WS_MAC -
trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerWidget.h
r73693 r73694 37 37 class QPlainTextEdit; 38 38 class QVBoxLayout; 39 class UIActionPool; 39 40 class UIToolBar; 40 41 class UIVMLogPage; … … 60 61 /** Constructs the VM Log-Viewer by passing @a pParent to QWidget base-class constructor. 61 62 * @param enmEmbedding Brings the type of widget embedding. 63 * @param pActionPool Brings the action-pool reference. 62 64 * @param comMachine Brings the machine for which VM Log-Viewer is requested. */ 63 UIVMLogViewerWidget(EmbedTo enmEmbedding, 65 UIVMLogViewerWidget(EmbedTo enmEmbedding, UIActionPool *pActionPool, 64 66 const CMachine &comMachine = CMachine(), QWidget *pParent = 0); 65 67 /** Destructs the VM Log-Viewer. */ … … 69 71 70 72 /** Returns the menu. */ 71 QMenu *menu() const { return m_pMenu; }73 QMenu *menu() const; 72 74 73 75 #ifdef VBOX_WS_MAC … … 133 135 /** Prepares actions. */ 134 136 void prepareActions(); 135 /** Prepares action icons. */136 void prepareActionIcons();137 137 /** Prepares toolbar. */ 138 138 void prepareToolBar(); 139 /** Prepares menu. */140 void prepareMenu();141 139 /** Prepares widgets. */ 142 140 void prepareWidgets(); … … 188 186 /** Holds the widget's embedding type. */ 189 187 const EmbedTo m_enmEmbedding; 188 /** Hold sthe action-pool reference. */ 189 UIActionPool *m_pActionPool; 190 190 /** Holds the machine instance. */ 191 191 CMachine m_comMachine; … … 214 214 * @{ */ 215 215 UIToolBar *m_pToolBar; 216 QAction *m_pActionFind;217 QAction *m_pActionFilter;218 QAction *m_pActionRefresh;219 QAction *m_pActionSave;220 QAction *m_pActionBookmarks;221 QAction *m_pActionSettings;222 QMenu *m_pMenu;223 216 /** @} */ 224 217 -
trunk/src/VBox/Frontends/VirtualBox/src/manager/UIToolPaneMachine.cpp
r73676 r73694 154 154 { 155 155 /* Create the Logviewer pane: */ 156 m_pPaneLogViewer = new UIVMLogViewerWidget(EmbedTo_Stack );156 m_pPaneLogViewer = new UIVMLogViewerWidget(EmbedTo_Stack, m_pActionPool); 157 157 AssertPtrReturnVoid(m_pPaneLogViewer); 158 158 { -
trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManager.cpp
r73693 r73694 1035 1035 if (!m_logViewers[pItem->machine().GetHardwareUUID()]) 1036 1036 { 1037 UIVMLogViewerDialogFactory dialogFactory( pItem->machine());1037 UIVMLogViewerDialogFactory dialogFactory(actionPool(), pItem->machine()); 1038 1038 dialogFactory.prepare(pLogViewerDialog, this); 1039 1039 if (pLogViewerDialog) -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp
r73693 r73694 2389 2389 2390 2390 QIManagerDialog *pLogViewerDialog; 2391 UIVMLogViewerDialogFactory dialogFactory( machine());2391 UIVMLogViewerDialogFactory dialogFactory(actionPool(), machine()); 2392 2392 dialogFactory.prepare(pLogViewerDialog, activeMachineWindow()); 2393 2393 if (pLogViewerDialog) -
trunk/src/VBox/Frontends/VirtualBox/src/selector/UISelectorWindow.cpp
r73693 r73694 1089 1089 if (!m_logViewers[pItem->machine().GetHardwareUUID()]) 1090 1090 { 1091 UIVMLogViewerDialogFactory dialogFactory( pItem->machine());1091 UIVMLogViewerDialogFactory dialogFactory(actionPool(), pItem->machine()); 1092 1092 dialogFactory.prepare(pLogViewerDialog, this); 1093 1093 if (pLogViewerDialog) -
trunk/src/VBox/Frontends/VirtualBox/src/selector/UIToolsPaneMachine.cpp
r73671 r73694 146 146 { 147 147 /* Create the Logviewer pane: */ 148 m_pPaneLogViewer = new UIVMLogViewerWidget(EmbedTo_Stack );148 m_pPaneLogViewer = new UIVMLogViewerWidget(EmbedTo_Stack, m_pActionPool); 149 149 AssertPtrReturnVoid(m_pPaneLogViewer); 150 150 {
Note:
See TracChangeset
for help on using the changeset viewer.