VirtualBox

Changeset 80046 in vbox


Ignore:
Timestamp:
Jul 29, 2019 4:06:19 PM (6 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:7720: VirtualBox Manager: Details pane: Possibility to edit VM video memory size on-the-fly.

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

Legend:

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

    r79982 r80046  
    256256    /* Video memory: */
    257257    if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeDisplay_VRAM)
     258    {
     259        /* Configure hovering anchor: */
     260        const QString strAnchorType = QString("video_memory");
     261        const int iVideoMemory = comMachine.GetVRAMSize();
    258262        table << UITextTableLine(QApplication::translate("UIDetails", "Video Memory", "details (display)"),
    259                                  QApplication::translate("UIDetails", "%1 MB", "details").arg(comMachine.GetVRAMSize()));
     263                                 QApplication::translate("UIDetails", "<a href=#%1,%2>%2 MB</a>", "details")
     264                                    .arg(strAnchorType).arg(iVideoMemory));
     265    }
    260266
    261267    /* Screens: */
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMachineAttributeSetter.cpp

    r79982 r80046  
    111111                break;
    112112            }
     113            case MachineAttribute_VideoMemory:
     114            {
     115                /* Change machine video memory (VRAM): */
     116                comMachine.SetVRAMSize(guiAttribute.toInt());
     117                if (!comMachine.isOk())
     118                {
     119                    msgCenter().cannotChangeMachineAttribute(comMachine);
     120                    fErrorHappened = true;
     121                }
     122                break;
     123            }
    113124            default:
    114125                break;
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMachineAttributeSetter.h

    r79982 r80046  
    3535    MachineAttribute_BaseMemory,
    3636    MachineAttribute_BootOrder,
     37    MachineAttribute_VideoMemory,
    3738};
    3839
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/details/UIDetailsElement.cpp

    r79997 r80046  
    4040#include "UIMachineAttributeSetter.h"
    4141#include "UINameAndSystemEditor.h"
     42#include "UIVideoMemoryEditor.h"
    4243#include "UIVirtualBoxManager.h"
    4344
     
    5253    AnchorRole_BaseMemory,
    5354    AnchorRole_BootOrder,
     55    AnchorRole_VideoMemory,
    5456    AnchorRole_Storage,
    5557};
     
    156158    m_pTextPane->setAnchorRoleRestricted("#base_memory", cal != ConfigurationAccessLevel_Full);
    157159    m_pTextPane->setAnchorRoleRestricted("#boot_order", cal != ConfigurationAccessLevel_Full);
     160    m_pTextPane->setAnchorRoleRestricted("#video_memory", cal != ConfigurationAccessLevel_Full);
    158161    m_pTextPane->setAnchorRoleRestricted("#mount", cal == ConfigurationAccessLevel_Null);
    159162    m_pTextPane->setAnchorRoleRestricted("#attach", cal != ConfigurationAccessLevel_Full);
     
    440443    roles["#base_memory"] = AnchorRole_BaseMemory;
    441444    roles["#boot_order"] = AnchorRole_BootOrder;
     445    roles["#video_memory"] = AnchorRole_VideoMemory;
    442446    roles["#mount"] = AnchorRole_Storage;
    443447    roles["#attach"] = AnchorRole_Storage;
     
    571575            break;
    572576        }
     577        case AnchorRole_VideoMemory:
     578        {
     579            /* Prepare popup: */
     580            QPointer<QIDialogContainer> pPopup = new QIDialogContainer(0, Qt::Tool);
     581            if (pPopup)
     582            {
     583                /* Prepare editor: */
     584                UIVideoMemoryEditor *pEditor = new UIVideoMemoryEditor(pPopup, true /* with label */);
     585                if (pEditor)
     586                {
     587                    pEditor->setValue(strData.section(',', 0, 0).toInt());
     588                    connect(pEditor, &UIVideoMemoryEditor::sigValidChanged,
     589                            pPopup.data(), &QIDialogContainer::setOkButtonEnabled);
     590                    pPopup->setWidget(pEditor);
     591                }
     592
     593                /* Adjust popup geometry: */
     594                pPopup->move(QCursor::pos());
     595                pPopup->adjustSize();
     596
     597                // WORKAROUND:
     598                // On Windows, Tool dialogs aren't activated by default by some reason.
     599                // So we have created sltActivateWindow wrapping actual activateWindow
     600                // to fix that annoying issue.
     601                QMetaObject::invokeMethod(pPopup, "sltActivateWindow", Qt::QueuedConnection);
     602                /* Execute popup, change machine name if confirmed: */
     603                if (pPopup->exec() == QDialog::Accepted)
     604                    setMachineAttribute(machine(), MachineAttribute_VideoMemory, QVariant::fromValue(pEditor->value()));
     605
     606                /* Delete popup: */
     607                delete pPopup;
     608            }
     609            break;
     610        }
    573611        case AnchorRole_Storage:
    574612        {
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