VirtualBox

Changeset 84910 in vbox


Ignore:
Timestamp:
Jun 22, 2020 4:10:09 PM (5 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9774: VirtualBox Manager: Add Visual State option to Details pane, allow to edit it via embedded popup editor.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/converter/UIConverterBackendGlobal.cpp

    r84904 r84910  
    14151415    switch (enmDetailsElementOptionTypeUserInterface)
    14161416    {
     1417        case UIExtraDataMetaDefs::DetailsElementOptionTypeUserInterface_VisualState: strResult = QApplication::translate("UICommon", "Visual State"); break;
    14171418        case UIExtraDataMetaDefs::DetailsElementOptionTypeUserInterface_MenuBar:     strResult = QApplication::translate("UICommon", "Menu Bar"); break;
    14181419        case UIExtraDataMetaDefs::DetailsElementOptionTypeUserInterface_StatusBar:   strResult = QApplication::translate("UICommon", "Status Bar"); break;
     
    14331434    switch (enmDetailsElementOptionTypeUserInterface)
    14341435    {
     1436        case UIExtraDataMetaDefs::DetailsElementOptionTypeUserInterface_VisualState: strResult = "VisualState"; break;
    14351437        case UIExtraDataMetaDefs::DetailsElementOptionTypeUserInterface_MenuBar:     strResult = "MenuBar"; break;
    14361438        case UIExtraDataMetaDefs::DetailsElementOptionTypeUserInterface_StatusBar:   strResult = "StatusBar"; break;
     
    14511453     * to search through the keys using 'case-insensitive' rule: */
    14521454    QStringList keys;      QList<UIExtraDataMetaDefs::DetailsElementOptionTypeUserInterface> values;
     1455    keys << "VisualState"; values << UIExtraDataMetaDefs::DetailsElementOptionTypeUserInterface_VisualState;
    14531456    keys << "MenuBar";     values << UIExtraDataMetaDefs::DetailsElementOptionTypeUserInterface_MenuBar;
    14541457    keys << "StatusBar";   values << UIExtraDataMetaDefs::DetailsElementOptionTypeUserInterface_StatusBar;
  • trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataDefs.h

    r84790 r84910  
    764764    {
    765765        DetailsElementOptionTypeUserInterface_Invalid     = 0,
    766         DetailsElementOptionTypeUserInterface_MenuBar     = RT_BIT(0),
    767         DetailsElementOptionTypeUserInterface_StatusBar   = RT_BIT(1),
    768         DetailsElementOptionTypeUserInterface_MiniToolbar = RT_BIT(2),
     766        DetailsElementOptionTypeUserInterface_VisualState = RT_BIT(0),
     767        DetailsElementOptionTypeUserInterface_MenuBar     = RT_BIT(1),
     768        DetailsElementOptionTypeUserInterface_StatusBar   = RT_BIT(2),
     769        DetailsElementOptionTypeUserInterface_MiniToolbar = RT_BIT(3),
    769770        DetailsElementOptionTypeUserInterface_Default     = 0xFFFF
    770771    };
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIDetailsGenerator.cpp

    r84790 r84910  
    959959    }
    960960
     961    /* Visual state: */
     962    if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeUserInterface_VisualState)
     963    {
     964        const QString strAnchorType = QString("visual_state");
     965        const QString strEnabledFullscreen = comMachine.GetExtraData(UIExtraDataDefs::GUI_Fullscreen);
     966        const QString strEnabledSeamless = comMachine.GetExtraData(UIExtraDataDefs::GUI_Seamless);
     967        const QString strEnabledScale = comMachine.GetExtraData(UIExtraDataDefs::GUI_Scale);
     968        UIVisualStateType enmType = UIVisualStateType_Normal;
     969        if (   strEnabledFullscreen.compare("true", Qt::CaseInsensitive) == 0
     970            || strEnabledFullscreen.compare("yes", Qt::CaseInsensitive) == 0
     971            || strEnabledFullscreen.compare("on", Qt::CaseInsensitive) == 0
     972            || strEnabledFullscreen == "1")
     973            enmType = UIVisualStateType_Fullscreen;
     974        else
     975        if (   strEnabledSeamless.compare("true", Qt::CaseInsensitive) == 0
     976            || strEnabledSeamless.compare("yes", Qt::CaseInsensitive) == 0
     977            || strEnabledSeamless.compare("on", Qt::CaseInsensitive) == 0
     978            || strEnabledSeamless == "1")
     979            enmType = UIVisualStateType_Seamless;
     980        else
     981        if (   strEnabledScale.compare("true", Qt::CaseInsensitive) == 0
     982            || strEnabledScale.compare("yes", Qt::CaseInsensitive) == 0
     983            || strEnabledScale.compare("on", Qt::CaseInsensitive) == 0
     984            || strEnabledScale == "1")
     985            enmType = UIVisualStateType_Scale;
     986        const QString strVisualState = gpConverter->toString(enmType);
     987        table << UITextTableLine(QApplication::translate("UIDetails", "Visual State", "details (user interface)"),
     988                                 QString("<a href=#%1,%2>%3</a>")
     989                                     .arg(strAnchorType)
     990                                     .arg(enmType)
     991                                     .arg(strVisualState));
     992    }
     993
    961994#ifndef VBOX_WS_MAC
    962995    /* Menu-bar: */
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/details/UIDetailsElement.cpp

    r84098 r84910  
    5151#include "UIVideoMemoryEditor.h"
    5252#include "UIVirtualBoxManager.h"
     53#include "UIVisualStateEditor.h"
    5354
    5455
     
    6970    AnchorRole_NetworkAttachmentType,
    7071    AnchorRole_USBControllerType,
     72    AnchorRole_VisualStateType,
    7173#ifndef VBOX_WS_MAC
    7274    AnchorRole_MenuBar,
     
    190192    m_pTextPane->setAnchorRoleRestricted("#network_attachment_type", enmCal == ConfigurationAccessLevel_Null);
    191193    m_pTextPane->setAnchorRoleRestricted("#usb_controller_type", enmCal != ConfigurationAccessLevel_Full);
     194    m_pTextPane->setAnchorRoleRestricted("#visual_state", enmCal == ConfigurationAccessLevel_Null);
    192195#ifndef VBOX_WS_MAC
    193196    m_pTextPane->setAnchorRoleRestricted("#menu_bar", enmCal == ConfigurationAccessLevel_Null);
     
    497500    roles["#network_attachment_type"] = AnchorRole_NetworkAttachmentType;
    498501    roles["#usb_controller_type"] = AnchorRole_USBControllerType;
     502    roles["#visual_state"] = AnchorRole_VisualStateType;
    499503#ifndef VBOX_WS_MAC
    500504    roles["#menu_bar"] = AnchorRole_MenuBar;
     
    877881                if (controllerSets.key(controllerSet) != iTriggeredIndex)
    878882                    setMachineAttribute(machine(), MachineAttribute_USBControllerType, QVariant::fromValue(controllerSets.value(iTriggeredIndex)));
     883            }
     884            break;
     885        }
     886        case AnchorRole_VisualStateType:
     887        {
     888            /* Prepare popup: */
     889            QPointer<QIDialogContainer> pPopup = new QIDialogContainer(0, Qt::Tool);
     890            if (pPopup)
     891            {
     892                /* Prepare editor: */
     893                UIVisualStateEditor *pEditor = new UIVisualStateEditor(pPopup, true /* with label */);
     894                if (pEditor)
     895                {
     896                    pEditor->setMachineId(machine().GetId());
     897                    pEditor->setValue(static_cast<UIVisualStateType>(strData.section(',', 0, 0).toInt()));
     898                    pPopup->setWidget(pEditor);
     899                }
     900
     901                /* Adjust popup geometry: */
     902                pPopup->move(QCursor::pos());
     903                pPopup->adjustSize();
     904
     905                // WORKAROUND:
     906                // On Windows, Tool dialogs aren't activated by default by some reason.
     907                // So we have created sltActivateWindow wrapping actual activateWindow
     908                // to fix that annoying issue.
     909                QMetaObject::invokeMethod(pPopup, "sltActivateWindow", Qt::QueuedConnection);
     910                /* Execute popup, change machine name if confirmed: */
     911                if (pPopup->exec() == QDialog::Accepted)
     912                    gEDataManager->setRequestedVisualState(pEditor->value(), machine().GetId());
     913
     914                /* Delete popup: */
     915                delete pPopup;
    879916            }
    880917            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