VirtualBox

Changeset 92423 in vbox


Ignore:
Timestamp:
Nov 15, 2021 12:37:17 PM (3 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:10141 Adding actions of medium selector dialog to the action pool.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/globals
Files:
2 edited

Legend:

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

    r92415 r92423  
    24842484        setStatusTip(QApplication::translate("UIActionPool", "Reset the VISO content."));
    24852485        setToolTip(QApplication::translate("UIActionPool", "Reset the VISO content.")
     2486                   + (shortcut().isEmpty() ? QString() : QString(" (%1)").arg(shortcut().toString())));
     2487    }
     2488};
     2489
     2490/** Menu action extension, used as 'Menu Selector' menu class. */
     2491class UIActionMenuMediumSelector : public UIActionMenu
     2492{
     2493    Q_OBJECT;
     2494
     2495public:
     2496
     2497    /** Constructs action passing @a pParent to the base-class. */
     2498    UIActionMenuMediumSelector(UIActionPool *pParent)
     2499        : UIActionMenu(pParent)
     2500    {}
     2501
     2502protected:
     2503
     2504    /** Returns shortcut extra-data ID. */
     2505    virtual QString shortcutExtraDataID() const /* override */
     2506    {
     2507        return QString("MediumSelector");
     2508    }
     2509
     2510    /** Handles translation event. */
     2511    virtual void retranslateUi() /* override */
     2512    {
     2513        setName(QApplication::translate("UIActionPool", "&Medium Selector"));
     2514    }
     2515};
     2516
     2517/** Simple action extension, used as 'Add' action class. */
     2518class UIActionMenuMediumSelectorAddHD  : public UIActionSimple
     2519{
     2520    Q_OBJECT;
     2521
     2522public:
     2523
     2524    /** Constructs action passing @a pParent to the base-class. */
     2525    UIActionMenuMediumSelectorAddHD(UIActionPool *pParent)
     2526        : UIActionSimple(pParent, ":/hd_add_32px.png",  ":/hd_add_16px.png",
     2527                         ":/hd_add_disabled_32px.png", ":/hd_add_disabled_16px.png")
     2528    {
     2529        setShortcutContext(Qt::WidgetWithChildrenShortcut);
     2530    }
     2531
     2532protected:
     2533
     2534    /** Returns shortcut extra-data ID. */
     2535    virtual QString shortcutExtraDataID() const /* override */
     2536    {
     2537        return QString("Add");
     2538    }
     2539
     2540    /** Handles translation event. */
     2541    virtual void retranslateUi() /* override */
     2542    {
     2543        setName(QApplication::translate("UIActionPool", "&Add..."));
     2544        setShortcutScope(QApplication::translate("UIActionPool", "Medium Selector"));
     2545        setStatusTip(QApplication::translate("UIActionPool", "Add existing disk image file"));
     2546        setToolTip(  QApplication::translate("UIActionPool", "Add Existing Disk Image File")
     2547                   + (shortcut().isEmpty() ? QString() : QString(" (%1)").arg(shortcut().toString())));
     2548    }
     2549};
     2550
     2551/** Simple action extension, used as 'Add' action class. */
     2552class UIActionMenuMediumSelectorAddCD  : public UIActionSimple
     2553{
     2554    Q_OBJECT;
     2555
     2556public:
     2557
     2558    /** Constructs action passing @a pParent to the base-class. */
     2559    UIActionMenuMediumSelectorAddCD(UIActionPool *pParent)
     2560        : UIActionSimple(pParent, ":/cd_add_32px.png",  ":/cd_add_16px.png",
     2561                         ":/cd_add_disabled_32px.png", ":/cd_add_disabled_16px.png")
     2562    {
     2563        setShortcutContext(Qt::WidgetWithChildrenShortcut);
     2564    }
     2565
     2566protected:
     2567
     2568    /** Returns shortcut extra-data ID. */
     2569    virtual QString shortcutExtraDataID() const /* override */
     2570    {
     2571        return QString("Add");
     2572    }
     2573
     2574    /** Handles translation event. */
     2575    virtual void retranslateUi() /* override */
     2576    {
     2577        setName(QApplication::translate("UIActionPool", "&Add..."));
     2578        setShortcutScope(QApplication::translate("UIActionPool", "Medium Selector"));
     2579        setStatusTip(QApplication::translate("UIActionPool", "Add existing disk image file"));
     2580        setToolTip(  QApplication::translate("UIActionPool", "Add Existing Disk Image File")
     2581                   + (shortcut().isEmpty() ? QString() : QString(" (%1)").arg(shortcut().toString())));
     2582    }
     2583};
     2584
     2585/** Simple action extension, used as 'Add' action class. */
     2586class UIActionMenuMediumSelectorAddFD  : public UIActionSimple
     2587{
     2588    Q_OBJECT;
     2589
     2590public:
     2591
     2592    /** Constructs action passing @a pParent to the base-class. */
     2593    UIActionMenuMediumSelectorAddFD(UIActionPool *pParent)
     2594        : UIActionSimple(pParent, ":/fd_add_32px.png",  ":/fd_add_16px.png",
     2595                         ":/fd_add_disabled_32px.png", ":/fd_add_disabled_16px.png")
     2596    {
     2597        setShortcutContext(Qt::WidgetWithChildrenShortcut);
     2598    }
     2599
     2600protected:
     2601
     2602    /** Returns shortcut extra-data ID. */
     2603    virtual QString shortcutExtraDataID() const /* override */
     2604    {
     2605        return QString("Add");
     2606    }
     2607
     2608    /** Handles translation event. */
     2609    virtual void retranslateUi() /* override */
     2610    {
     2611        setName(QApplication::translate("UIActionPool", "&Add..."));
     2612        setShortcutScope(QApplication::translate("UIActionPool", "Medium Selector"));
     2613        setStatusTip(QApplication::translate("UIActionPool", "Add existing disk image file"));
     2614        setToolTip(  QApplication::translate("UIActionPool", "Add Existing Disk Image File")
     2615                   + (shortcut().isEmpty() ? QString() : QString(" (%1)").arg(shortcut().toString())));
     2616    }
     2617};
     2618
     2619/** Simple action extension, used as 'Create' action class. */
     2620class UIActionMenuMediumSelectorCreateHD  : public UIActionSimple
     2621{
     2622    Q_OBJECT;
     2623
     2624public:
     2625
     2626    /** Constructs action passing @a pParent to the base-class. */
     2627    UIActionMenuMediumSelectorCreateHD(UIActionPool *pParent)
     2628        : UIActionSimple(pParent, ":/hd_create_32px.png",  ":/hd_create_16px.png",
     2629                         ":/hd_create_disabled_32px.png", ":/hd_create_disabled_16px.png")
     2630    {
     2631        setShortcutContext(Qt::WidgetWithChildrenShortcut);
     2632    }
     2633
     2634protected:
     2635
     2636    /** Returns shortcut extra-data ID. */
     2637    virtual QString shortcutExtraDataID() const /* override */
     2638    {
     2639        return QString("Create");
     2640    }
     2641
     2642    /** Handles translation event. */
     2643    virtual void retranslateUi() /* override */
     2644    {
     2645        setName(QApplication::translate("UIActionPool", "&Create..."));
     2646        setShortcutScope(QApplication::translate("UIActionPool", "Medium Selector"));
     2647        setStatusTip(QApplication::translate("UIActionPool", "Create a new disk image file"));
     2648        setToolTip(  QApplication::translate("UIActionPool", "Create a New Disk Image File")
     2649                   + (shortcut().isEmpty() ? QString() : QString(" (%1)").arg(shortcut().toString())));
     2650    }
     2651};
     2652
     2653/** Simple action extension, used as 'Create' action class. */
     2654class UIActionMenuMediumSelectorCreateCD  : public UIActionSimple
     2655{
     2656    Q_OBJECT;
     2657
     2658public:
     2659
     2660    /** Constructs action passing @a pParent to the base-class. */
     2661    UIActionMenuMediumSelectorCreateCD(UIActionPool *pParent)
     2662        : UIActionSimple(pParent, ":/cd_create_32px.png",  ":/cd_create_16px.png",
     2663                         ":/cd_create_disabled_32px.png", ":/cd_create_disabled_16px.png")
     2664    {
     2665        setShortcutContext(Qt::WidgetWithChildrenShortcut);
     2666    }
     2667
     2668protected:
     2669
     2670    /** Returns shortcut extra-data ID. */
     2671    virtual QString shortcutExtraDataID() const /* override */
     2672    {
     2673        return QString("Create");
     2674    }
     2675
     2676    /** Handles translation event. */
     2677    virtual void retranslateUi() /* override */
     2678    {
     2679        setName(QApplication::translate("UIActionPool", "&Create..."));
     2680        setShortcutScope(QApplication::translate("UIActionPool", "Medium Selector"));
     2681        setStatusTip(QApplication::translate("UIActionPool", "Create a new disk image file"));
     2682        setToolTip(  QApplication::translate("UIActionPool", "Create a New Disk Image File")
     2683                   + (shortcut().isEmpty() ? QString() : QString(" (%1)").arg(shortcut().toString())));
     2684    }
     2685};
     2686
     2687/** Simple action extension, used as 'Create' action class. */
     2688class UIActionMenuMediumSelectorCreateFD  : public UIActionSimple
     2689{
     2690    Q_OBJECT;
     2691
     2692public:
     2693
     2694    /** Constructs action passing @a pParent to the base-class. */
     2695    UIActionMenuMediumSelectorCreateFD(UIActionPool *pParent)
     2696        : UIActionSimple(pParent, ":/fd_create_32px.png",  ":/fd_create_16px.png",
     2697                         ":/fd_create_disabled_32px.png", ":/fd_create_disabled_16px.png")
     2698    {
     2699        setShortcutContext(Qt::WidgetWithChildrenShortcut);
     2700    }
     2701
     2702protected:
     2703
     2704    /** Returns shortcut extra-data ID. */
     2705    virtual QString shortcutExtraDataID() const /* override */
     2706    {
     2707        return QString("Create");
     2708    }
     2709
     2710    /** Handles translation event. */
     2711    virtual void retranslateUi() /* override */
     2712    {
     2713        setName(QApplication::translate("UIActionPool", "&Create..."));
     2714        setShortcutScope(QApplication::translate("UIActionPool", "Medium Selector"));
     2715        setStatusTip(QApplication::translate("UIActionPool", "Create a new disk image file"));
     2716        setToolTip(  QApplication::translate("UIActionPool", "Create a New Disk Image File")
     2717                   + (shortcut().isEmpty() ? QString() : QString(" (%1)").arg(shortcut().toString())));
     2718    }
     2719};
     2720
     2721/** Simple action extension, used as 'Create' action class. */
     2722class UIActionMenuMediumSelectorRefresh  : public UIActionSimple
     2723{
     2724    Q_OBJECT;
     2725
     2726public:
     2727
     2728    /** Constructs action passing @a pParent to the base-class. */
     2729    UIActionMenuMediumSelectorRefresh(UIActionPool *pParent)
     2730        : UIActionSimple(pParent, ":/refresh_32px.png",  ":/refresh_16px.png",
     2731                         ":/refresh_disabled_32px.png", ":/refresh_disabled_16px.png")
     2732    {
     2733        setShortcutContext(Qt::WidgetWithChildrenShortcut);
     2734    }
     2735
     2736protected:
     2737
     2738    /** Returns shortcut extra-data ID. */
     2739    virtual QString shortcutExtraDataID() const /* override */
     2740    {
     2741        return QString("Create");
     2742    }
     2743
     2744    /** Handles translation event. */
     2745    virtual void retranslateUi() /* override */
     2746    {
     2747        setName(QApplication::translate("UIActionPool", "&Create..."));
     2748        setShortcutScope(QApplication::translate("UIActionPool", "Medium Selector"));
     2749        setStatusTip(QApplication::translate("UIActionPool", "Create a new disk image file"));
     2750        setToolTip(  QApplication::translate("UIActionPool", "Create a New Disk Image File")
    24862751                   + (shortcut().isEmpty() ? QString() : QString(" (%1)").arg(shortcut().toString())));
    24872752    }
     
    28773142    m_pool[UIActionIndex_M_VISOCreator_Reset] = new UIActionMenuVISOCreatorReset(this);
    28783143
     3144    /* Medium Selector actions: */
     3145    m_pool[UIActionIndex_M_MediumSelector] = new UIActionMenuMediumSelector(this);
     3146    m_pool[UIActionIndex_M_MediumSelector_AddHD] = new UIActionMenuMediumSelectorAddHD(this);
     3147    m_pool[UIActionIndex_M_MediumSelector_AddCD] = new UIActionMenuMediumSelectorAddCD(this);
     3148    m_pool[UIActionIndex_M_MediumSelector_AddFD] = new UIActionMenuMediumSelectorAddFD(this);
     3149    m_pool[UIActionIndex_M_MediumSelector_CreateHD] = new UIActionMenuMediumSelectorCreateHD(this);
     3150    m_pool[UIActionIndex_M_MediumSelector_CreateCD] = new UIActionMenuMediumSelectorCreateCD(this);
     3151    m_pool[UIActionIndex_M_MediumSelector_CreateFD] = new UIActionMenuMediumSelectorCreateFD(this);
     3152    m_pool[UIActionIndex_M_MediumSelector_Refresh] = new UIActionMenuMediumSelectorRefresh(this);
     3153
    28793154    /* Prepare update-handlers for known menus: */
    28803155#ifdef VBOX_WS_MAC
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIActionPool.h

    r92415 r92423  
    148148    UIActionIndex_M_VISOCreator_Reset,
    149149
     150    /* Medium selector actions : */
     151    UIActionIndex_M_MediumSelector,
     152    UIActionIndex_M_MediumSelector_AddHD,
     153    UIActionIndex_M_MediumSelector_AddFD,
     154    UIActionIndex_M_MediumSelector_AddCD,
     155    UIActionIndex_M_MediumSelector_CreateHD,
     156    UIActionIndex_M_MediumSelector_CreateCD,
     157    UIActionIndex_M_MediumSelector_CreateFD,
     158    UIActionIndex_M_MediumSelector_Refresh,
     159
    150160    /* Maximum index: */
    151161    UIActionIndex_Max
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