VirtualBox

Ignore:
Timestamp:
Aug 14, 2018 1:46:50 PM (6 years ago)
Author:
vboxsync
Message:

FE/Qt: UIActionPoolSelector: A bit of cleanup/rework: Moving some code to appropriate place.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIActionPoolSelector.cpp

    r73384 r73659  
    11391139
    11401140
     1141/** Menu action extension, used as 'Close' menu class. */
     1142class UIActionMenuSelectorClose : public UIActionMenu
     1143{
     1144    Q_OBJECT;
     1145
     1146public:
     1147
     1148    /** Constructs action passing @a pParent to the base-class. */
     1149    UIActionMenuSelectorClose(UIActionPool *pParent)
     1150        : UIActionMenu(pParent, ":/exit_16px.png")
     1151    {}
     1152
     1153protected:
     1154
     1155    /** Handles translation event. */
     1156    virtual void retranslateUi() /* override */
     1157    {
     1158        setName(QApplication::translate("UIActionPool", "&Close"));
     1159    }
     1160};
     1161
     1162/** Simple action extension, used as 'Perform Detach' action class. */
     1163class UIActionSimpleSelectorPerformDetach : public UIActionSimple
     1164{
     1165    Q_OBJECT;
     1166
     1167public:
     1168
     1169    /** Constructs action passing @a pParent to the base-class. */
     1170    UIActionSimpleSelectorPerformDetach(UIActionPool *pParent)
     1171        : UIActionSimple(pParent, ":/vm_create_shortcut_16px.png", ":/vm_create_shortcut_disabled_16px.png")
     1172    {}
     1173
     1174protected:
     1175
     1176    /** Returns shortcut extra-data ID. */
     1177    virtual QString shortcutExtraDataID() const /* override */
     1178    {
     1179        return QString("DetachUIVM");
     1180    }
     1181
     1182    /** Handles translation event. */
     1183    virtual void retranslateUi() /* override */
     1184    {
     1185        setName(QApplication::translate("UIActionPool", "&Detach GUI"));
     1186        setStatusTip(QApplication::translate("UIActionPool", "Detach the GUI from headless VM"));
     1187    }
     1188};
     1189
     1190/** Simple action extension, used as 'Perform Save' action class. */
     1191class UIActionSimpleSelectorPerformSave : public UIActionSimple
     1192{
     1193    Q_OBJECT;
     1194
     1195public:
     1196
     1197    /** Constructs action passing @a pParent to the base-class. */
     1198    UIActionSimpleSelectorPerformSave(UIActionPool *pParent)
     1199        : UIActionSimple(pParent, ":/vm_save_state_16px.png", ":/vm_save_state_disabled_16px.png")
     1200    {}
     1201
     1202protected:
     1203
     1204    /** Returns shortcut extra-data ID. */
     1205    virtual QString shortcutExtraDataID() const /* override */
     1206    {
     1207        return QString("SaveVM");
     1208    }
     1209
     1210    /** Returns default shortcut. */
     1211    virtual QKeySequence defaultShortcut(UIActionPoolType) const /* override */
     1212    {
     1213        return QKeySequence("Ctrl+V");
     1214    }
     1215
     1216    /** Handles translation event. */
     1217    virtual void retranslateUi() /* override */
     1218    {
     1219        setName(QApplication::translate("UIActionPool", "&Save State"));
     1220        setStatusTip(QApplication::translate("UIActionPool", "Save state of selected virtual machines"));
     1221    }
     1222};
     1223
     1224/** Simple action extension, used as 'Perform Shutdown' action class. */
     1225class UIActionSimpleSelectorPerformShutdown : public UIActionSimple
     1226{
     1227    Q_OBJECT;
     1228
     1229public:
     1230
     1231    /** Constructs action passing @a pParent to the base-class. */
     1232    UIActionSimpleSelectorPerformShutdown(UIActionPool *pParent)
     1233        : UIActionSimple(pParent, ":/vm_shutdown_16px.png", ":/vm_shutdown_disabled_16px.png")
     1234    {}
     1235
     1236protected:
     1237
     1238    /** Returns shortcut extra-data ID. */
     1239    virtual QString shortcutExtraDataID() const /* override */
     1240    {
     1241        return QString("ACPIShutdownVM");
     1242    }
     1243
     1244    /** Returns default shortcut. */
     1245    virtual QKeySequence defaultShortcut(UIActionPoolType) const /* override */
     1246    {
     1247        return QKeySequence("Ctrl+H");
     1248    }
     1249
     1250    /** Handles translation event. */
     1251    virtual void retranslateUi() /* override */
     1252    {
     1253        setName(QApplication::translate("UIActionPool", "ACPI Sh&utdown"));
     1254        setStatusTip(QApplication::translate("UIActionPool", "Send ACPI Shutdown signal to selected virtual machines"));
     1255    }
     1256};
     1257
     1258/** Simple action extension, used as 'Perform PowerOff' action class. */
     1259class UIActionSimpleSelectorPerformPowerOff : public UIActionSimple
     1260{
     1261    Q_OBJECT;
     1262
     1263public:
     1264
     1265    /** Constructs action passing @a pParent to the base-class. */
     1266    UIActionSimpleSelectorPerformPowerOff(UIActionPool *pParent)
     1267        : UIActionSimple(pParent, ":/vm_poweroff_16px.png", ":/vm_poweroff_disabled_16px.png")
     1268    {}
     1269
     1270protected:
     1271
     1272    /** Returns shortcut extra-data ID. */
     1273    virtual QString shortcutExtraDataID() const /* override */
     1274    {
     1275        return QString("PowerOffVM");
     1276    }
     1277
     1278    /** Returns default shortcut. */
     1279    virtual QKeySequence defaultShortcut(UIActionPoolType) const /* override */
     1280    {
     1281        return QKeySequence("Ctrl+F");
     1282    }
     1283
     1284    /** Handles translation event. */
     1285    virtual void retranslateUi() /* override */
     1286    {
     1287        setName(QApplication::translate("UIActionPool", "Po&wer Off"));
     1288        setStatusTip(QApplication::translate("UIActionPool", "Power off selected virtual machines"));
     1289    }
     1290};
     1291
     1292
    11411293/** Toggle action extension, used as 'Machine Tools' action class. */
    11421294class UIActionToggleSelectorToolsMachine : public UIActionToggle
     
    13991551        setName(QApplication::translate("UIActionPool", "&Host Network Manager"));
    14001552        setStatusTip(QApplication::translate("UIActionPool", "Open the Host Network Manager"));
    1401     }
    1402 };
    1403 
    1404 
    1405 /** Menu action extension, used as 'Close' menu class. */
    1406 class UIActionMenuSelectorClose : public UIActionMenu
    1407 {
    1408     Q_OBJECT;
    1409 
    1410 public:
    1411 
    1412     /** Constructs action passing @a pParent to the base-class. */
    1413     UIActionMenuSelectorClose(UIActionPool *pParent)
    1414         : UIActionMenu(pParent, ":/exit_16px.png")
    1415     {}
    1416 
    1417 protected:
    1418 
    1419     /** Handles translation event. */
    1420     virtual void retranslateUi() /* override */
    1421     {
    1422         setName(QApplication::translate("UIActionPool", "&Close"));
    1423     }
    1424 };
    1425 
    1426 /** Simple action extension, used as 'Perform Detach' action class. */
    1427 class UIActionSimpleSelectorPerformDetach : public UIActionSimple
    1428 {
    1429     Q_OBJECT;
    1430 
    1431 public:
    1432 
    1433     /** Constructs action passing @a pParent to the base-class. */
    1434     UIActionSimpleSelectorPerformDetach(UIActionPool *pParent)
    1435         : UIActionSimple(pParent, ":/vm_create_shortcut_16px.png", ":/vm_create_shortcut_disabled_16px.png")
    1436     {}
    1437 
    1438 protected:
    1439 
    1440     /** Returns shortcut extra-data ID. */
    1441     virtual QString shortcutExtraDataID() const /* override */
    1442     {
    1443         return QString("DetachUIVM");
    1444     }
    1445 
    1446     /** Handles translation event. */
    1447     virtual void retranslateUi() /* override */
    1448     {
    1449         setName(QApplication::translate("UIActionPool", "&Detach GUI"));
    1450         setStatusTip(QApplication::translate("UIActionPool", "Detach the GUI from headless VM"));
    1451     }
    1452 };
    1453 
    1454 /** Simple action extension, used as 'Perform Save' action class. */
    1455 class UIActionSimpleSelectorPerformSave : public UIActionSimple
    1456 {
    1457     Q_OBJECT;
    1458 
    1459 public:
    1460 
    1461     /** Constructs action passing @a pParent to the base-class. */
    1462     UIActionSimpleSelectorPerformSave(UIActionPool *pParent)
    1463         : UIActionSimple(pParent, ":/vm_save_state_16px.png", ":/vm_save_state_disabled_16px.png")
    1464     {}
    1465 
    1466 protected:
    1467 
    1468     /** Returns shortcut extra-data ID. */
    1469     virtual QString shortcutExtraDataID() const /* override */
    1470     {
    1471         return QString("SaveVM");
    1472     }
    1473 
    1474     /** Returns default shortcut. */
    1475     virtual QKeySequence defaultShortcut(UIActionPoolType) const /* override */
    1476     {
    1477         return QKeySequence("Ctrl+V");
    1478     }
    1479 
    1480     /** Handles translation event. */
    1481     virtual void retranslateUi() /* override */
    1482     {
    1483         setName(QApplication::translate("UIActionPool", "&Save State"));
    1484         setStatusTip(QApplication::translate("UIActionPool", "Save state of selected virtual machines"));
    1485     }
    1486 };
    1487 
    1488 /** Simple action extension, used as 'Perform Shutdown' action class. */
    1489 class UIActionSimpleSelectorPerformShutdown : public UIActionSimple
    1490 {
    1491     Q_OBJECT;
    1492 
    1493 public:
    1494 
    1495     /** Constructs action passing @a pParent to the base-class. */
    1496     UIActionSimpleSelectorPerformShutdown(UIActionPool *pParent)
    1497         : UIActionSimple(pParent, ":/vm_shutdown_16px.png", ":/vm_shutdown_disabled_16px.png")
    1498     {}
    1499 
    1500 protected:
    1501 
    1502     /** Returns shortcut extra-data ID. */
    1503     virtual QString shortcutExtraDataID() const /* override */
    1504     {
    1505         return QString("ACPIShutdownVM");
    1506     }
    1507 
    1508     /** Returns default shortcut. */
    1509     virtual QKeySequence defaultShortcut(UIActionPoolType) const /* override */
    1510     {
    1511         return QKeySequence("Ctrl+H");
    1512     }
    1513 
    1514     /** Handles translation event. */
    1515     virtual void retranslateUi() /* override */
    1516     {
    1517         setName(QApplication::translate("UIActionPool", "ACPI Sh&utdown"));
    1518         setStatusTip(QApplication::translate("UIActionPool", "Send ACPI Shutdown signal to selected virtual machines"));
    1519     }
    1520 };
    1521 
    1522 /** Simple action extension, used as 'Perform PowerOff' action class. */
    1523 class UIActionSimpleSelectorPerformPowerOff : public UIActionSimple
    1524 {
    1525     Q_OBJECT;
    1526 
    1527 public:
    1528 
    1529     /** Constructs action passing @a pParent to the base-class. */
    1530     UIActionSimpleSelectorPerformPowerOff(UIActionPool *pParent)
    1531         : UIActionSimple(pParent, ":/vm_poweroff_16px.png", ":/vm_poweroff_disabled_16px.png")
    1532     {}
    1533 
    1534 protected:
    1535 
    1536     /** Returns shortcut extra-data ID. */
    1537     virtual QString shortcutExtraDataID() const /* override */
    1538     {
    1539         return QString("PowerOffVM");
    1540     }
    1541 
    1542     /** Returns default shortcut. */
    1543     virtual QKeySequence defaultShortcut(UIActionPoolType) const /* override */
    1544     {
    1545         return QKeySequence("Ctrl+F");
    1546     }
    1547 
    1548     /** Handles translation event. */
    1549     virtual void retranslateUi() /* override */
    1550     {
    1551         setName(QApplication::translate("UIActionPool", "Po&wer Off"));
    1552         setStatusTip(QApplication::translate("UIActionPool", "Power off selected virtual machines"));
    15531553    }
    15541554};
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