VirtualBox

Changeset 79959 in vbox


Ignore:
Timestamp:
Jul 24, 2019 1:57:03 PM (6 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
132390
Message:

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

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/Makefile.kmk

    r79948 r79959  
    888888        src/settings/machine/UIMachineSettingsUSBFilterDetails.h \
    889889        src/widgets/UIAddDiskEncryptionPasswordDialog.h \
     890        src/widgets/UIBaseMemoryEditor.h \
    890891        src/widgets/UIBaseMemorySlider.h \
    891892        src/widgets/UIBootTable.h \
     
    13781379        src/settings/machine/UIMachineSettingsUSBFilterDetails.cpp \
    13791380        src/widgets/UIAddDiskEncryptionPasswordDialog.cpp \
     1381        src/widgets/UIBaseMemoryEditor.cpp \
    13801382        src/widgets/UIBaseMemorySlider.cpp \
    13811383        src/widgets/UIBootTable.cpp \
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIDetailsGenerator.cpp

    r79940 r79959  
    132132    /* Base memory: */
    133133    if (fOptions & UIExtraDataMetaDefs::DetailsElementOptionTypeSystem_RAM)
     134    {
     135        /* Configure hovering anchor: */
     136        const QString strAnchorType = QString("base_memory");
     137        const int iBaseMemory = comMachine.GetMemorySize();
    134138        table << UITextTableLine(QApplication::translate("UIDetails", "Base Memory", "details (system)"),
    135                                  QApplication::translate("UIDetails", "%1 MB", "details").arg(comMachine.GetMemorySize()));
     139                                 QApplication::translate("UIDetails", "<a href=#%1,%2>%2 MB</a>", "details")
     140                                    .arg(strAnchorType).arg(iBaseMemory));
     141    }
    136142
    137143    /* Processors: */
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMachineAttributeSetter.cpp

    r79940 r79959  
    8888                break;
    8989            }
     90            case MachineAttribute_BaseMemory:
     91            {
     92                /* Change machine base memory (RAM): */
     93                comMachine.SetMemorySize(guiAttribute.toInt());
     94                if (!comMachine.isOk())
     95                {
     96                    msgCenter().cannotChangeMachineAttribute(comMachine);
     97                    fErrorHappened = true;
     98                }
     99                break;
     100            }
    90101            default:
    91102                break;
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMachineAttributeSetter.h

    r79940 r79959  
    3333    MachineAttribute_OSType,
    3434    MachineAttribute_Location,
     35    MachineAttribute_BaseMemory,
    3536};
    3637
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/details/UIDetailsElement.cpp

    r79940 r79959  
    2727#include "QIDialogContainer.h"
    2828#include "UIActionPool.h"
     29#include "UIBaseMemoryEditor.h"
    2930#include "UICommon.h"
    3031#include "UIConverter.h"
     
    4849    AnchorRole_MachineLocation,
    4950    AnchorRole_OSType,
     51    AnchorRole_BaseMemory,
    5052    AnchorRole_Storage,
    5153};
     
    150152    m_pTextPane->setAnchorRoleRestricted("#machine_location", cal != ConfigurationAccessLevel_Full);
    151153    m_pTextPane->setAnchorRoleRestricted("#os_type", cal != ConfigurationAccessLevel_Full);
     154    m_pTextPane->setAnchorRoleRestricted("#base_memory", cal != ConfigurationAccessLevel_Full);
    152155    m_pTextPane->setAnchorRoleRestricted("#mount", cal == ConfigurationAccessLevel_Null);
    153156    m_pTextPane->setAnchorRoleRestricted("#attach", cal != ConfigurationAccessLevel_Full);
     
    432435    roles["#machine_location"] = AnchorRole_MachineLocation;
    433436    roles["#os_type"] = AnchorRole_OSType;
     437    roles["#base_memory"] = AnchorRole_BaseMemory;
    434438    roles["#mount"] = AnchorRole_Storage;
    435439    roles["#attach"] = AnchorRole_Storage;
     
    497501            break;
    498502        }
     503        case AnchorRole_BaseMemory:
     504        {
     505            /* Prepare popup: */
     506            QPointer<QIDialogContainer> pPopup = new QIDialogContainer(0, Qt::Tool);
     507            if (pPopup)
     508            {
     509                /* Prepare editor: */
     510                UIBaseMemoryEditor *pEditor = new UIBaseMemoryEditor(pPopup);
     511                if (pEditor)
     512                {
     513                    pEditor->setValue(strData.section(',', 0, 0).toInt());
     514                    connect(pEditor, &UIBaseMemoryEditor::sigValidChanged,
     515                            pPopup, &QIDialogContainer::setOkButtonEnabled);
     516                    pPopup->setWidget(pEditor);
     517                }
     518
     519                /* Adjust popup geometry: */
     520                pPopup->move(QCursor::pos());
     521                pPopup->adjustSize();
     522
     523                // WORKAROUND:
     524                // On Windows, Tool dialogs aren't activated by default by some reason.
     525                // So we have created sltActivateWindow wrapping actual activateWindow
     526                // to fix that annoying issue.
     527                QMetaObject::invokeMethod(pPopup, "sltActivateWindow", Qt::QueuedConnection);
     528                /* Execute popup, change machine name if confirmed: */
     529                if (pPopup->exec() == QDialog::Accepted)
     530                    setMachineAttribute(machine(), MachineAttribute_BaseMemory, QVariant::fromValue(pEditor->value()));
     531
     532                /* Delete popup: */
     533                delete pPopup;
     534            }
     535            break;
     536        }
    499537        case AnchorRole_Storage:
    500538        {
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette