VirtualBox

Changeset 73694 in vbox for trunk/src/VBox/Frontends


Ignore:
Timestamp:
Aug 15, 2018 3:07:32 PM (6 years ago)
Author:
vboxsync
Message:

FE/Qt: UIActionPool* UIVMLogViewer* classes: Move Log Viewer to action-pool rails which means it is configurable via shortcut-pool now.

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  
    11771177
    11781178
     1179/** Menu action extension, used as 'Log' menu class. */
     1180class UIActionMenuSelectorLog : public UIActionMenu
     1181{
     1182    Q_OBJECT;
     1183
     1184public:
     1185
     1186    /** Constructs action passing @a pParent to the base-class. */
     1187    UIActionMenuSelectorLog(UIActionPool *pParent)
     1188        : UIActionMenu(pParent)
     1189    {}
     1190
     1191protected:
     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. */
     1208class UIActionMenuSelectorLogTogglePaneFind : public UIActionToggle
     1209{
     1210    Q_OBJECT;
     1211
     1212public:
     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
     1220protected:
     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. */
     1244class UIActionMenuSelectorLogTogglePaneFilter : public UIActionToggle
     1245{
     1246    Q_OBJECT;
     1247
     1248public:
     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
     1256protected:
     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. */
     1280class UIActionMenuSelectorLogTogglePaneBookmark : public UIActionToggle
     1281{
     1282    Q_OBJECT;
     1283
     1284public:
     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
     1292protected:
     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. */
     1316class UIActionMenuSelectorLogTogglePaneSettings : public UIActionToggle
     1317{
     1318    Q_OBJECT;
     1319
     1320public:
     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
     1328protected:
     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. */
     1352class UIActionMenuSelectorLogPerformRefresh : public UIActionSimple
     1353{
     1354    Q_OBJECT;
     1355
     1356public:
     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
     1364protected:
     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. */
     1388class UIActionMenuSelectorLogPerformSave : public UIActionSimple
     1389{
     1390    Q_OBJECT;
     1391
     1392public:
     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
     1400protected:
     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
    11791424/*********************************************************************************************************************************
    11801425*   Class UIActionPool implementation.                                                                                           *
     
    13721617#endif
    13731618
     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
    13741628    /* Prepare update-handlers for known menus: */
    13751629#ifdef VBOX_WS_MAC
     
    13781632#endif
    13791633    m_menuUpdateHandlers[UIActionIndex_Menu_Help].ptf = &UIActionPool::updateMenuHelp;
     1634    m_menuUpdateHandlers[UIActionIndex_M_LogViewer].ptf = &UIActionPool::updateMenuLogViewer;
    13801635
    13811636    /* Invalidate all known menus: */
     
    16141869}
    16151870
     1871void 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
    16161915void UIActionPool::retranslateUi()
    16171916{
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIActionPool.h

    r71630 r73694  
    8787    UIActionIndex_Simple_About,
    8888#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,
    8998
    9099    /* Maximum index: */
     
    545554    /** Updates 'Help' menu. */
    546555    virtual void updateMenuHelp();
     556    /** Updates 'Log Viewer' menu. */
     557    virtual void updateMenuLogViewer();
    547558
    548559    /** Updates shortcuts. */
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIActionPoolRuntime.cpp

    r73578 r73694  
    34253425    addMenu(m_mainMenus, action(UIActionIndex_Menu_Help));
    34263426    updateMenuHelp();
     3427
     3428    /* 'Log Viewer' menu: */
     3429    updateMenuLogViewer();
    34273430}
    34283431
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIActionPoolSelector.cpp

    r73671 r73694  
    18811881    /* 'Help' menu: */
    18821882    updateMenuHelp();
     1883
     1884    /* 'Log Viewer' menu: */
     1885    updateMenuLogViewer();
    18831886}
    18841887
  • trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerDialog.cpp

    r73693 r73694  
    5050*********************************************************************************************************************************/
    5151
    52 UIVMLogViewerDialogFactory::UIVMLogViewerDialogFactory(const CMachine &comMachine /* = CMachine() */)
    53     : m_comMachine(comMachine)
     52UIVMLogViewerDialogFactory::UIVMLogViewerDialogFactory(UIActionPool *pActionPool /* = 0 */,
     53                                                       const CMachine &comMachine /* = CMachine() */)
     54    : m_pActionPool(pActionPool)
     55    , m_comMachine(comMachine)
    5456{
    5557}
     
    5759void UIVMLogViewerDialogFactory::create(QIManagerDialog *&pDialog, QWidget *pCenterWidget)
    5860{
    59     pDialog = new UIVMLogViewerDialog(pCenterWidget, m_comMachine);
     61    pDialog = new UIVMLogViewerDialog(pCenterWidget, m_pActionPool, m_comMachine);
    6062}
    6163
     
    6567*********************************************************************************************************************************/
    6668
    67 UIVMLogViewerDialog::UIVMLogViewerDialog(QWidget *pCenterWidget, const CMachine &comMachine)
     69UIVMLogViewerDialog::UIVMLogViewerDialog(QWidget *pCenterWidget, UIActionPool *pActionPool, const CMachine &comMachine)
    6870    : QIWithRetranslateUI<QIManagerDialog>(pCenterWidget)
     71    , m_pActionPool(pActionPool)
    6972    , m_comMachine(comMachine)
    7073{
     
    9295{
    9396    /* Create widget: */
    94     UIVMLogViewerWidget *pWidget = new UIVMLogViewerWidget(EmbedTo_Dialog, m_comMachine, this);
     97    UIVMLogViewerWidget *pWidget = new UIVMLogViewerWidget(EmbedTo_Dialog, m_pActionPool, m_comMachine, this);
    9598    if (pWidget)
    9699    {
  • trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerDialog.h

    r73693 r73694  
    3535class QDialogButtonBox;
    3636class QVBoxLayout;
     37class UIActionPool;
    3738class UIVMLogViewerDialog;
    3839class CMachine;
     
    4546
    4647    /** 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());
    4951
    5052protected:
     
    5456    virtual void create(QIManagerDialog *&pDialog, QWidget *pCenterWidget) /* override */;
    5557
     58    /** Holds the action-pool reference. */
     59    UIActionPool *m_pActionPool;
    5660    /** Holds the machine reference. */
    5761    CMachine      m_comMachine;
     
    6872    /** Constructs Log Viewer dialog.
    6973      * @param  pCenterWidget  Brings the widget reference to center according to.
     74      * @param  pActionPool    Brings the action-pool reference.
    7075      * @param  comMachine     Brings the machine reference. */
    71     UIVMLogViewerDialog(QWidget *pCenterWidget, const CMachine &comMachine);
     76    UIVMLogViewerDialog(QWidget *pCenterWidget, UIActionPool *pActionPool, const CMachine &comMachine);
    7277
    7378protected:
     
    107112private:
    108113
     114    /** Holds the action-pool reference. */
     115    UIActionPool *m_pActionPool;
    109116    /** Holds the machine reference. */
    110     CMachine  m_comMachine;
     117    CMachine      m_comMachine;
    111118};
    112119
  • trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerWidget.cpp

    r73693 r73694  
    3838# include "QIFileDialog.h"
    3939# include "QITabWidget.h"
     40# include "UIActionPool.h"
    4041# include "UIExtraDataManager.h"
    4142# include "UIIconPool.h"
     
    5859
    5960UIVMLogViewerWidget::UIVMLogViewerWidget(EmbedTo enmEmbedding,
     61                                         UIActionPool *pActionPool,
    6062                                         const CMachine &comMachine /* = CMachine() */,
    6163                                         QWidget *pParent /* = 0 */)
    6264    : QIWithRetranslateUI<QWidget>(pParent)
    6365    , m_enmEmbedding(enmEmbedding)
     66    , m_pActionPool(pActionPool)
    6467    , m_comMachine(comMachine)
    6568    , m_fIsPolished(false)
     
    7174    , m_pMainLayout(0)
    7275    , 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)
    8076    , m_bShowLineNumbers(true)
    8177    , m_bWrapLines(false)
     
    110106
    111107    return iDefaultWidth;
     108}
     109
     110QMenu *UIVMLogViewerWidget::menu() const
     111{
     112    return m_pActionPool->action(UIActionIndex_M_LogViewer)->menu();
    112113}
    113114
     
    187188
    188189    /* 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);
    199195
    200196    m_pTabWidget->show();
     
    426422    prepareActions();
    427423    prepareToolBar();
    428     prepareMenu();
    429424    prepareWidgets();
    430425    /* Load settings: */
     
    442437void UIVMLogViewerWidget::prepareActions()
    443438{
    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);
    525462}
    526463
     
    537474
    538475        /* 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));
    557484
    558485#ifdef VBOX_WS_MAC
     
    570497}
    571498
    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 
    599499void UIVMLogViewerWidget::prepareWidgets()
    600500{
     
    624524        connect(m_pSearchPanel, &UIVMLogViewerSearchPanel::sigHighlightingUpdated,
    625525                this, &UIVMLogViewerWidget::sltSearchResultHighLigting);
    626         m_panelActionMap.insert(m_pSearchPanel, m_pActionFind);
     526        m_panelActionMap.insert(m_pSearchPanel, m_pActionPool->action(UIActionIndex_M_LogViewer_T_Find));
    627527
    628528        /* Add into layout: */
     
    639539        connect(m_pFilterPanel, &UIVMLogViewerFilterPanel::sigFilterApplied,
    640540                this, &UIVMLogViewerWidget::sltFilterApplied);
    641         m_panelActionMap.insert(m_pFilterPanel, m_pActionFilter);
     541        m_panelActionMap.insert(m_pFilterPanel, m_pActionPool->action(UIActionIndex_M_LogViewer_T_Filter));
    642542
    643543        /* Add into layout: */
     
    656556        connect(m_pBookmarksPanel, &UIVMLogViewerBookmarksPanel::sigBookmarkSelected,
    657557                this, &UIVMLogViewerWidget::gotoBookmark);
    658         m_panelActionMap.insert(m_pBookmarksPanel, m_pActionBookmarks);
     558        m_panelActionMap.insert(m_pBookmarksPanel, m_pActionPool->action(UIActionIndex_M_LogViewer_T_Bookmark));
    659559
    660560        /* Add into layout: */
     
    675575        connect(m_pSettingsPanel, &UIVMLogViewerSettingsPanel::sigChangeFont, this, &UIVMLogViewerWidget::sltChangeFont);
    676576        connect(m_pSettingsPanel, &UIVMLogViewerSettingsPanel::sigResetToDefaults, this, &UIVMLogViewerWidget::sltResetSettingsToDefault);
    677         m_panelActionMap.insert(m_pSettingsPanel, m_pActionSettings);
     577        m_panelActionMap.insert(m_pSettingsPanel, m_pActionPool->action(UIActionIndex_M_LogViewer_T_Settings));
    678578
    679579        /* Add into layout: */
     
    704604void UIVMLogViewerWidget::retranslateUi()
    705605{
    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         else
    741         {
    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         else
    756         {
    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 
    769606    /* Translate toolbar: */
    770607#ifdef VBOX_WS_MAC
  • trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerWidget.h

    r73693 r73694  
    3737class QPlainTextEdit;
    3838class QVBoxLayout;
     39class UIActionPool;
    3940class UIToolBar;
    4041class UIVMLogPage;
     
    6061    /** Constructs the VM Log-Viewer by passing @a pParent to QWidget base-class constructor.
    6162      * @param  enmEmbedding  Brings the type of widget embedding.
     63      * @param  pActionPool   Brings the action-pool reference.
    6264      * @param  comMachine    Brings the machine for which VM Log-Viewer is requested. */
    63     UIVMLogViewerWidget(EmbedTo enmEmbedding,
     65    UIVMLogViewerWidget(EmbedTo enmEmbedding, UIActionPool *pActionPool,
    6466                        const CMachine &comMachine = CMachine(), QWidget *pParent = 0);
    6567    /** Destructs the VM Log-Viewer. */
     
    6971
    7072    /** Returns the menu. */
    71     QMenu *menu() const { return m_pMenu; }
     73    QMenu *menu() const;
    7274
    7375#ifdef VBOX_WS_MAC
     
    133135        /** Prepares actions. */
    134136        void prepareActions();
    135         /** Prepares action icons. */
    136         void prepareActionIcons();
    137137        /** Prepares toolbar. */
    138138        void prepareToolBar();
    139         /** Prepares menu. */
    140         void prepareMenu();
    141139        /** Prepares widgets. */
    142140        void prepareWidgets();
     
    188186    /** Holds the widget's embedding type. */
    189187    const EmbedTo m_enmEmbedding;
     188    /** Hold sthe action-pool reference. */
     189    UIActionPool *m_pActionPool;
    190190    /** Holds the machine instance. */
    191191    CMachine      m_comMachine;
     
    214214      * @{ */
    215215        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;
    223216    /** @} */
    224217
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/UIToolPaneMachine.cpp

    r73676 r73694  
    154154            {
    155155                /* Create the Logviewer pane: */
    156                 m_pPaneLogViewer = new UIVMLogViewerWidget(EmbedTo_Stack);
     156                m_pPaneLogViewer = new UIVMLogViewerWidget(EmbedTo_Stack, m_pActionPool);
    157157                AssertPtrReturnVoid(m_pPaneLogViewer);
    158158                {
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManager.cpp

    r73693 r73694  
    10351035        if (!m_logViewers[pItem->machine().GetHardwareUUID()])
    10361036        {
    1037             UIVMLogViewerDialogFactory dialogFactory(pItem->machine());
     1037            UIVMLogViewerDialogFactory dialogFactory(actionPool(), pItem->machine());
    10381038            dialogFactory.prepare(pLogViewerDialog, this);
    10391039            if (pLogViewerDialog)
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp

    r73693 r73694  
    23892389
    23902390    QIManagerDialog *pLogViewerDialog;
    2391     UIVMLogViewerDialogFactory dialogFactory(machine());
     2391    UIVMLogViewerDialogFactory dialogFactory(actionPool(), machine());
    23922392    dialogFactory.prepare(pLogViewerDialog, activeMachineWindow());
    23932393    if (pLogViewerDialog)
  • trunk/src/VBox/Frontends/VirtualBox/src/selector/UISelectorWindow.cpp

    r73693 r73694  
    10891089        if (!m_logViewers[pItem->machine().GetHardwareUUID()])
    10901090        {
    1091             UIVMLogViewerDialogFactory dialogFactory(pItem->machine());
     1091            UIVMLogViewerDialogFactory dialogFactory(actionPool(), pItem->machine());
    10921092            dialogFactory.prepare(pLogViewerDialog, this);
    10931093            if (pLogViewerDialog)
  • trunk/src/VBox/Frontends/VirtualBox/src/selector/UIToolsPaneMachine.cpp

    r73671 r73694  
    146146            {
    147147                /* Create the Logviewer pane: */
    148                 m_pPaneLogViewer = new UIVMLogViewerWidget(EmbedTo_Stack);
     148                m_pPaneLogViewer = new UIVMLogViewerWidget(EmbedTo_Stack, m_pActionPool);
    149149                AssertPtrReturnVoid(m_pPaneLogViewer);
    150150                {
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette