VirtualBox

Changeset 80103 in vbox for trunk/src


Ignore:
Timestamp:
Aug 1, 2019 2:59:49 PM (5 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:7720: VirtualBox Manager: Details pane: Possibility to edit VM menu-bar and status-bar presence on-the-fly.

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

Legend:

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

    r80101 r80103  
    804804    if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeUserInterface_MenuBar)
    805805    {
     806        const QString strAnchorType = QString("menu_bar");
    806807        const QString strMenubarEnabled = comMachine.GetExtraData(UIExtraDataDefs::GUI_MenuBar_Enabled);
    807         /* Try to convert loaded data to bool: */
    808808        const bool fEnabled = !(   strMenubarEnabled.compare("false", Qt::CaseInsensitive) == 0
    809809                                || strMenubarEnabled.compare("no", Qt::CaseInsensitive) == 0
    810810                                || strMenubarEnabled.compare("off", Qt::CaseInsensitive) == 0
    811811                                || strMenubarEnabled == "0");
    812         /* Append information: */
    813812        table << UITextTableLine(QApplication::translate("UIDetails", "Menu-bar", "details (user interface)"),
    814                                  fEnabled ? QApplication::translate("UIDetails", "Enabled", "details (user interface/menu-bar)")
    815                                           : QApplication::translate("UIDetails", "Disabled", "details (user interface/menu-bar)"));
     813                                 QString("<a href=#%1,%2>%3</a>")
     814                                     .arg(strAnchorType)
     815                                     .arg((int)fEnabled)
     816                                     .arg(fEnabled ? QApplication::translate("UIDetails", "Enabled", "details (user interface/menu-bar)")
     817                                                   : QApplication::translate("UIDetails", "Disabled", "details (user interface/menu-bar)")));
    816818    }
    817819#endif /* !VBOX_WS_MAC */
     
    820822    if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeUserInterface_StatusBar)
    821823    {
     824        const QString strAnchorType = QString("status_bar");
    822825        const QString strStatusbarEnabled = comMachine.GetExtraData(UIExtraDataDefs::GUI_StatusBar_Enabled);
    823         /* Try to convert loaded data to bool: */
    824826        const bool fEnabled = !(   strStatusbarEnabled.compare("false", Qt::CaseInsensitive) == 0
    825827                                || strStatusbarEnabled.compare("no", Qt::CaseInsensitive) == 0
    826828                                || strStatusbarEnabled.compare("off", Qt::CaseInsensitive) == 0
    827829                                || strStatusbarEnabled == "0");
    828         /* Append information: */
    829830        table << UITextTableLine(QApplication::translate("UIDetails", "Status-bar", "details (user interface)"),
    830                                  fEnabled ? QApplication::translate("UIDetails", "Enabled", "details (user interface/status-bar)")
    831                                           : QApplication::translate("UIDetails", "Disabled", "details (user interface/status-bar)"));
     831                                 QString("<a href=#%1,%2>%3</a>")
     832                                     .arg(strAnchorType)
     833                                     .arg((int)fEnabled)
     834                                     .arg(fEnabled ? QApplication::translate("UIDetails", "Enabled", "details (user interface/status-bar)")
     835                                                   : QApplication::translate("UIDetails", "Disabled", "details (user interface/status-bar)")));
    832836    }
    833837
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/details/UIDetailsElement.cpp

    r80083 r80103  
    6161    AnchorRole_AudioHostDriverType,
    6262    AnchorRole_AudioControllerType,
     63    AnchorRole_MenuBar,
     64    AnchorRole_StatusBar,
    6365};
    6466
     
    166168    m_pTextPane->setAnchorRoleRestricted("#video_memory", cal != ConfigurationAccessLevel_Full);
    167169    m_pTextPane->setAnchorRoleRestricted("#graphics_controller_type", cal != ConfigurationAccessLevel_Full);
     170    m_pTextPane->setAnchorRoleRestricted("#mount", cal == ConfigurationAccessLevel_Null);
     171    m_pTextPane->setAnchorRoleRestricted("#attach", cal != ConfigurationAccessLevel_Full);
    168172    m_pTextPane->setAnchorRoleRestricted("#audio_host_driver_type", cal != ConfigurationAccessLevel_Full);
    169173    m_pTextPane->setAnchorRoleRestricted("#audio_controller_type", cal != ConfigurationAccessLevel_Full);
    170     m_pTextPane->setAnchorRoleRestricted("#mount", cal == ConfigurationAccessLevel_Null);
    171     m_pTextPane->setAnchorRoleRestricted("#attach", cal != ConfigurationAccessLevel_Full);
     174    m_pTextPane->setAnchorRoleRestricted("#menu_bar", cal == ConfigurationAccessLevel_Null);
     175    m_pTextPane->setAnchorRoleRestricted("#status_bar", cal == ConfigurationAccessLevel_Null);
    172176}
    173177
     
    454458    roles["#video_memory"] = AnchorRole_VideoMemory;
    455459    roles["#graphics_controller_type"] = AnchorRole_GraphicsControllerType;
     460    roles["#mount"] = AnchorRole_Storage;
     461    roles["#attach"] = AnchorRole_Storage;
    456462    roles["#audio_host_driver_type"] = AnchorRole_AudioHostDriverType;
    457463    roles["#audio_controller_type"] = AnchorRole_AudioControllerType;
    458     roles["#mount"] = AnchorRole_Storage;
    459     roles["#attach"] = AnchorRole_Storage;
     464    roles["#menu_bar"] = AnchorRole_MenuBar;
     465    roles["#status_bar"] = AnchorRole_StatusBar;
    460466
    461467    /* Current anchor role: */
     
    736742            break;
    737743        }
     744        case AnchorRole_MenuBar:
     745        case AnchorRole_StatusBar:
     746        {
     747            /* Parse whether we have it enabled, true if unable to parse: */
     748            bool fParsed = false;
     749            bool fEnabled = strData.section(',', 0, 0).toInt(&fParsed);
     750            if (!fParsed)
     751                fEnabled = true;
     752
     753            /* Fill menu with actions, use menu-bar NLS for both cases for simplicity: */
     754            UIMenu menu;
     755            QAction *pActionEnable = menu.addAction(QApplication::translate("UIDetails", "Enabled", "details (user interface/menu-bar)"));
     756            pActionEnable->setCheckable(true);
     757            pActionEnable->setChecked(fEnabled);
     758            QAction *pActionDisable = menu.addAction(QApplication::translate("UIDetails", "Disabled", "details (user interface/menu-bar)"));
     759            pActionDisable->setCheckable(true);
     760            pActionDisable->setChecked(!fEnabled);
     761
     762            /* Execute menu, look for result: */
     763            QAction *pTriggeredAction = menu.exec(QCursor::pos());
     764            if (   pTriggeredAction
     765                && (   fEnabled && pTriggeredAction == pActionDisable
     766                    || !fEnabled && pTriggeredAction == pActionEnable))
     767            {
     768                switch (enmRole)
     769                {
     770                    case AnchorRole_MenuBar: gEDataManager->setMenuBarEnabled(!fEnabled, machine().GetId()); break;
     771                    case AnchorRole_StatusBar: gEDataManager->setStatusBarEnabled(!fEnabled, machine().GetId()); break;
     772                    default: break;
     773                }
     774            }
     775            break;
     776        }
    738777        default:
    739778            break;
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