VirtualBox

Changeset 37143 in vbox


Ignore:
Timestamp:
May 18, 2011 3:25:29 PM (14 years ago)
Author:
vboxsync
Message:

FE/Qt: 3887: Make certain settings editable during runtime: Notify the user about machine data was altered from the outside and provide him with choice to reload data or keep his changes.

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

Legend:

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

    r37027 r37143  
    720720}
    721721
     722bool VBoxProblemReporter::confirmedSettingsReloading(QWidget *pParent)
     723{
     724    int rc = message(pParent, Question,
     725                     tr("<p>The machine settings were changed while you were editing them. "
     726                        "You currently have unsaved setting changes.</p>"
     727                        "<p>Would you like to reload the changed settings or to keep your own changes?</p>"), 0,
     728                     QIMessageBox::Yes, QIMessageBox::No | QIMessageBox::Default | QIMessageBox::Escape, 0,
     729                     tr("Reload settings"), tr("Keep changes"), 0);
     730    return rc == QIMessageBox::Yes;
     731}
     732
    722733void VBoxProblemReporter::cannotStartMachine (const CConsole &console)
    723734{
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxProblemReporter.h

    r36393 r37143  
    202202                                    QWidget *parent = 0);
    203203
     204    bool confirmedSettingsReloading(QWidget *pParent);
     205
    204206    void cannotStartMachine (const CConsole &console);
    205207    void cannotStartMachine (const CProgress &progress);
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialogSpecific.cpp

    r37138 r37143  
    10921092        return;
    10931093
     1094    /* Check if user had changed something and warn him about he will loose settings on reloading: */
     1095    if (isSettingsChanged() && !vboxProblem().confirmedSettingsReloading(this))
     1096        return;
     1097
    10941098    /* Reload data: */
    10951099    loadData();
     
    11661170}
    11671171
     1172bool UISettingsDialogMachine::isSettingsChanged()
     1173{
     1174    bool fIsSettingsChanged = false;
     1175    for (int iWidgetNumber = 0; iWidgetNumber < m_pStack->count() && !fIsSettingsChanged; ++iWidgetNumber)
     1176    {
     1177        UISettingsPage *pPage = static_cast<UISettingsPage*>(m_pStack->widget(iWidgetNumber));
     1178        pPage->putToCache();
     1179        if (pPage->changed())
     1180            fIsSettingsChanged = true;
     1181    }
     1182    return fIsSettingsChanged;
     1183}
     1184
    11681185# include "UISettingsDialogSpecific.moc"
    11691186
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialogSpecific.h

    r37138 r37143  
    110110
    111111    bool isPageAvailable(int iPageId);
     112    bool isSettingsChanged();
    112113
    113114    QString m_strMachineId;
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsPage.h

    r37051 r37143  
    106106    bool isMachineInValidMode() const { return isMachineOffline() || isMachineSaved() || isMachineOnline(); }
    107107
     108    /* Page changed: */
     109    virtual bool changed() const = 0;
     110
    108111    /* Page 'ID' stuff: */
    109112    int id() const { return m_cId; }
     
    153156    void uploadData(QVariant &data) const;
    154157
     158    /* Page changed: */
     159    bool changed() const { return false; }
     160
    155161    /* Global data source: */
    156162    CSystemProperties m_properties;
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsAudio.h

    r36924 r37143  
    7575    void saveFromCacheTo(QVariant &data);
    7676
     77    /* Page changed: */
     78    bool changed() const { return m_cache.wasChanged(); }
     79
    7780    void setOrderAfter (QWidget *aWidget);
    7881
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsDisplay.h

    r36920 r37143  
    110110    void saveFromCacheTo(QVariant &data);
    111111
     112    /* Page changed: */
     113    bool changed() const { return m_cache.wasChanged(); }
     114
    112115    void setValidator (QIWidgetValidator *aVal);
    113116    bool revalidate (QString &aWarning, QString &aTitle);
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsGeneral.h

    r36917 r37143  
    9696    void getFromCache();
    9797
     98    /* Page changed: */
     99    bool changed() const { return m_cache.wasChanged(); }
     100
    98101    /* Save data from corresponding widgets to cache,
    99102     * this task SHOULD be performed in GUI thread only: */
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsNetwork.h

    r36928 r37143  
    187187    void saveFromCacheTo(QVariant &data);
    188188
     189    /* Page changed: */
     190    bool changed() const { return m_cache.wasChanged(); }
     191
    189192    void setValidator(QIWidgetValidator *pValidator);
    190193    bool revalidate(QString &strWarning, QString &strTitle);
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsParallel.h

    r36930 r37143  
    132132    void saveFromCacheTo(QVariant &data);
    133133
     134    /* Page changed: */
     135    bool changed() const { return m_cache.wasChanged(); }
     136
    134137    void setValidator (QIWidgetValidator *aVal);
    135138    bool revalidate (QString &aWarning, QString &aTitle);
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSF.h

    r37051 r37143  
    100100    void saveFromCacheTo(UISharedFolderType sharedFoldersType);
    101101
     102    /* Page changed: */
     103    bool changed() const { return m_cache.wasChanged(); }
     104
    102105    void setOrderAfter (QWidget *aWidget);
    103106
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSerial.h

    r36929 r37143  
    139139    void saveFromCacheTo(QVariant &data);
    140140
     141    /* Page changed: */
     142    bool changed() const { return m_cache.wasChanged(); }
     143
    141144    void setValidator (QIWidgetValidator *aVal);
    142145    bool revalidate (QString &aWarning, QString &aTitle);
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsStorage.h

    r37051 r37143  
    654654    void saveFromCacheTo(QVariant &data);
    655655
     656    /* Page changed: */
     657    bool changed() const { return m_cache.wasChanged(); }
     658
    656659    void setValidator (QIWidgetValidator *aVal);
    657660    bool revalidate (QString &aWarning, QString &aTitle);
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSystem.h

    r36919 r37143  
    130130    void saveFromCacheTo(QVariant &data);
    131131
     132    /* Page changed: */
     133    bool changed() const { return m_cache.wasChanged(); }
     134
    132135    void setValidator (QIWidgetValidator *aVal);
    133136    bool revalidate (QString &aWarning, QString &aTitle);
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsUSB.h

    r37126 r37143  
    138138    void saveFromCacheTo(QVariant &data);
    139139
     140    /* Page changed: */
     141    bool changed() const { return m_cache.wasChanged(); }
     142
    140143    void setValidator (QIWidgetValidator *aVal);
    141144    bool revalidate(QString &strWarningText, QString &strTitle);
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