VirtualBox

Changeset 66490 in vbox


Ignore:
Timestamp:
Apr 10, 2017 8:45:36 AM (8 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
114485
Message:

FE/Qt: Machine settings: Interface page: Error handling (settings save).

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

Legend:

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

    r66482 r66490  
    12001200          tr("Cannot save storage medium settings."),
    12011201          formatErrorInfo(comMedium));
     1202}
     1203
     1204void UIMessageCenter::cannotSaveInterfaceSettings(const CMachine &comMachine, QWidget *pParent /* = 0 */)
     1205{
     1206    error(pParent, MessageType_Error,
     1207          tr("Cannot save user interface settings."),
     1208          formatErrorInfo(comMachine));
    12021209}
    12031210
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.h

    r66482 r66490  
    246246    void cannotSaveStorageAttachmentSettings(const CMediumAttachment &comAttachment, QWidget *pParent = 0);
    247247    void cannotSaveStorageMediumSettings(const CMedium &comMedium, QWidget *pParent = 0);
     248    void cannotSaveInterfaceSettings(const CMachine &comMachine, QWidget *pParent = 0);
    248249    void cannotAttachDevice(const CMachine &machine, UIMediumType type, const QString &strLocation, const StorageSlot &storageSlot, QWidget *pParent = 0);
    249250    bool warnAboutIncorrectPort(QWidget *pParent = 0) const;
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsInterface.cpp

    r66460 r66490  
    273273    UISettingsPageMachine::fetchData(data);
    274274
    275     /* Make sure machine is in valid mode & interface data was changed: */
    276     if (isMachineInValidMode() && m_pCache->wasChanged())
    277     {
    278         /* Get old interface data from the cache: */
    279         const UIDataSettingsMachineInterface &oldInterfaceData = m_pCache->base();
    280         /* Get new interface data from the cache: */
    281         const UIDataSettingsMachineInterface &newInterfaceData = m_pCache->data();
    282 
    283         /* Store whether status-bar is enabled: */
    284         if (newInterfaceData.m_fStatusBarEnabled != oldInterfaceData.m_fStatusBarEnabled)
    285             gEDataManager->setStatusBarEnabled(newInterfaceData.m_fStatusBarEnabled, m_machine.GetId());
    286         /* Store status-bar restrictions: */
    287         if (newInterfaceData.m_statusBarRestrictions != oldInterfaceData.m_statusBarRestrictions)
    288             gEDataManager->setRestrictedStatusBarIndicators(newInterfaceData.m_statusBarRestrictions, m_machine.GetId());
    289         /* Store status-bar order: */
    290         if (newInterfaceData.m_statusBarOrder != oldInterfaceData.m_statusBarOrder)
    291             gEDataManager->setStatusBarIndicatorOrder(newInterfaceData.m_statusBarOrder, m_machine.GetId());
    292 #ifndef VBOX_WS_MAC
    293         /* Store whether menu-bar is enabled: */
    294         if (newInterfaceData.m_fMenuBarEnabled != oldInterfaceData.m_fMenuBarEnabled)
    295             gEDataManager->setMenuBarEnabled(newInterfaceData.m_fMenuBarEnabled, m_machine.GetId());
    296 #endif
    297         /* Store menu-bar restrictions: */
    298         if (newInterfaceData.m_restrictionsOfMenuBar != oldInterfaceData.m_restrictionsOfMenuBar)
    299             gEDataManager->setRestrictedRuntimeMenuTypes(newInterfaceData.m_restrictionsOfMenuBar, m_machine.GetId());
    300         /* Store menu-bar Application menu restrictions: */
    301         if (newInterfaceData.m_restrictionsOfMenuApplication != oldInterfaceData.m_restrictionsOfMenuApplication)
    302             gEDataManager->setRestrictedRuntimeMenuApplicationActionTypes(newInterfaceData.m_restrictionsOfMenuApplication, m_machine.GetId());
    303         /* Store menu-bar Machine menu restrictions: */
    304         if (newInterfaceData.m_restrictionsOfMenuMachine != oldInterfaceData.m_restrictionsOfMenuMachine)
    305             gEDataManager->setRestrictedRuntimeMenuMachineActionTypes(newInterfaceData.m_restrictionsOfMenuMachine, m_machine.GetId());
    306         /* Store menu-bar View menu restrictions: */
    307         if (newInterfaceData.m_restrictionsOfMenuView != oldInterfaceData.m_restrictionsOfMenuView)
    308             gEDataManager->setRestrictedRuntimeMenuViewActionTypes(newInterfaceData.m_restrictionsOfMenuView, m_machine.GetId());
    309         /* Store menu-bar Input menu restrictions: */
    310         if (newInterfaceData.m_restrictionsOfMenuInput != oldInterfaceData.m_restrictionsOfMenuInput)
    311             gEDataManager->setRestrictedRuntimeMenuInputActionTypes(newInterfaceData.m_restrictionsOfMenuInput, m_machine.GetId());
    312         /* Store menu-bar Devices menu restrictions: */
    313         if (newInterfaceData.m_restrictionsOfMenuDevices != oldInterfaceData.m_restrictionsOfMenuDevices)
    314             gEDataManager->setRestrictedRuntimeMenuDevicesActionTypes(newInterfaceData.m_restrictionsOfMenuDevices, m_machine.GetId());
    315 #ifdef VBOX_WITH_DEBUGGER_GUI
    316         /* Store menu-bar Debug menu restrictions: */
    317         if (newInterfaceData.m_restrictionsOfMenuDebug != oldInterfaceData.m_restrictionsOfMenuDebug)
    318             gEDataManager->setRestrictedRuntimeMenuDebuggerActionTypes(newInterfaceData.m_restrictionsOfMenuDebug, m_machine.GetId());
    319 #endif
    320 #ifdef VBOX_WS_MAC
    321         /* Store menu-bar Window menu restrictions: */
    322         if (newInterfaceData.m_restrictionsOfMenuWindow != oldInterfaceData.m_restrictionsOfMenuWindow)
    323             gEDataManager->setRestrictedRuntimeMenuWindowActionTypes(newInterfaceData.m_restrictionsOfMenuWindow, m_machine.GetId());
    324 #endif
    325         /* Store menu-bar Help menu restrictions: */
    326         if (newInterfaceData.m_restrictionsOfMenuHelp != oldInterfaceData.m_restrictionsOfMenuHelp)
    327             gEDataManager->setRestrictedRuntimeMenuHelpActionTypes(newInterfaceData.m_restrictionsOfMenuHelp, m_machine.GetId());
    328 #ifndef VBOX_WS_MAC
    329         /* Store whether mini-toolbar is enabled: */
    330         if (newInterfaceData.m_fShowMiniToolBar != oldInterfaceData.m_fShowMiniToolBar)
    331             gEDataManager->setMiniToolbarEnabled(newInterfaceData.m_fShowMiniToolBar, m_machine.GetId());
    332         /* Store whether mini-toolbar should be location at top of screen: */
    333         if (newInterfaceData.m_fMiniToolBarAtTop != oldInterfaceData.m_fMiniToolBarAtTop)
    334             gEDataManager->setMiniToolbarAlignment(newInterfaceData.m_fMiniToolBarAtTop ? Qt::AlignTop : Qt::AlignBottom, m_machine.GetId());
    335 #endif
    336     }
     275    /* Update interface data and failing state: */
     276    setFailed(!saveInterfaceData());
    337277
    338278    /* Upload machine to data: */
     
    404344}
    405345
     346bool UIMachineSettingsInterface::saveInterfaceData()
     347{
     348    /* Prepare result: */
     349    bool fSuccess = true;
     350    /* Save display settings from the cache: */
     351    if (fSuccess && isMachineInValidMode() && m_pCache->wasChanged())
     352    {
     353        /* Save 'Menu-bar' data from the cache: */
     354        if (fSuccess)
     355            fSuccess = saveMenuBarData();
     356        /* Save 'Status-bar' data from the cache: */
     357        if (fSuccess)
     358            fSuccess = saveStatusBarData();
     359        /* Save 'Status-bar' data from the cache: */
     360        if (fSuccess)
     361            fSuccess = saveMiniToolbarData();
     362    }
     363    /* Return result: */
     364    return fSuccess;
     365}
     366
     367bool UIMachineSettingsInterface::saveMenuBarData()
     368{
     369    /* Prepare result: */
     370    bool fSuccess = true;
     371    /* Save 'Menu-bar' data from the cache: */
     372    if (fSuccess)
     373    {
     374        /* Get old interface data from the cache: */
     375        const UIDataSettingsMachineInterface &oldInterfaceData = m_pCache->base();
     376        /* Get new interface data from the cache: */
     377        const UIDataSettingsMachineInterface &newInterfaceData = m_pCache->data();
     378
     379#ifndef VBOX_WS_MAC
     380        /* Save whether menu-bar is enabled: */
     381        if (fSuccess && newInterfaceData.m_fMenuBarEnabled != oldInterfaceData.m_fMenuBarEnabled)
     382            /* fSuccess = */ gEDataManager->setMenuBarEnabled(newInterfaceData.m_fMenuBarEnabled, m_machine.GetId());
     383#endif
     384        /* Save menu-bar restrictions: */
     385        if (fSuccess && newInterfaceData.m_restrictionsOfMenuBar != oldInterfaceData.m_restrictionsOfMenuBar)
     386            /* fSuccess = */ gEDataManager->setRestrictedRuntimeMenuTypes(newInterfaceData.m_restrictionsOfMenuBar, m_machine.GetId());
     387        /* Save menu-bar Application menu restrictions: */
     388        if (fSuccess && newInterfaceData.m_restrictionsOfMenuApplication != oldInterfaceData.m_restrictionsOfMenuApplication)
     389            /* fSuccess = */ gEDataManager->setRestrictedRuntimeMenuApplicationActionTypes(newInterfaceData.m_restrictionsOfMenuApplication, m_machine.GetId());
     390        /* Save menu-bar Machine menu restrictions: */
     391        if (fSuccess && newInterfaceData.m_restrictionsOfMenuMachine != oldInterfaceData.m_restrictionsOfMenuMachine)
     392           /* fSuccess = */  gEDataManager->setRestrictedRuntimeMenuMachineActionTypes(newInterfaceData.m_restrictionsOfMenuMachine, m_machine.GetId());
     393        /* Save menu-bar View menu restrictions: */
     394        if (fSuccess && newInterfaceData.m_restrictionsOfMenuView != oldInterfaceData.m_restrictionsOfMenuView)
     395           /* fSuccess = */  gEDataManager->setRestrictedRuntimeMenuViewActionTypes(newInterfaceData.m_restrictionsOfMenuView, m_machine.GetId());
     396        /* Save menu-bar Input menu restrictions: */
     397        if (fSuccess && newInterfaceData.m_restrictionsOfMenuInput != oldInterfaceData.m_restrictionsOfMenuInput)
     398            /* fSuccess = */ gEDataManager->setRestrictedRuntimeMenuInputActionTypes(newInterfaceData.m_restrictionsOfMenuInput, m_machine.GetId());
     399        /* Save menu-bar Devices menu restrictions: */
     400        if (fSuccess && newInterfaceData.m_restrictionsOfMenuDevices != oldInterfaceData.m_restrictionsOfMenuDevices)
     401            /* fSuccess = */ gEDataManager->setRestrictedRuntimeMenuDevicesActionTypes(newInterfaceData.m_restrictionsOfMenuDevices, m_machine.GetId());
     402#ifdef VBOX_WITH_DEBUGGER_GUI
     403        /* Save menu-bar Debug menu restrictions: */
     404        if (fSuccess && newInterfaceData.m_restrictionsOfMenuDebug != oldInterfaceData.m_restrictionsOfMenuDebug)
     405            /* fSuccess = */ gEDataManager->setRestrictedRuntimeMenuDebuggerActionTypes(newInterfaceData.m_restrictionsOfMenuDebug, m_machine.GetId());
     406#endif
     407#ifdef VBOX_WS_MAC
     408        /* Save menu-bar Window menu restrictions: */
     409        if (fSuccess && newInterfaceData.m_restrictionsOfMenuWindow != oldInterfaceData.m_restrictionsOfMenuWindow)
     410            /* fSuccess = */ gEDataManager->setRestrictedRuntimeMenuWindowActionTypes(newInterfaceData.m_restrictionsOfMenuWindow, m_machine.GetId());
     411#endif
     412        /* Save menu-bar Help menu restrictions: */
     413        if (fSuccess && newInterfaceData.m_restrictionsOfMenuHelp != oldInterfaceData.m_restrictionsOfMenuHelp)
     414            /* fSuccess = */ gEDataManager->setRestrictedRuntimeMenuHelpActionTypes(newInterfaceData.m_restrictionsOfMenuHelp, m_machine.GetId());
     415    }
     416    /* Return result: */
     417    return fSuccess;
     418}
     419
     420bool UIMachineSettingsInterface::saveStatusBarData()
     421{
     422    /* Prepare result: */
     423    bool fSuccess = true;
     424    /* Save 'Status-bar' data from the cache: */
     425    if (fSuccess)
     426    {
     427        /* Get old interface data from the cache: */
     428        const UIDataSettingsMachineInterface &oldInterfaceData = m_pCache->base();
     429        /* Get new interface data from the cache: */
     430        const UIDataSettingsMachineInterface &newInterfaceData = m_pCache->data();
     431
     432        /* Save whether status-bar is enabled: */
     433        if (fSuccess && newInterfaceData.m_fStatusBarEnabled != oldInterfaceData.m_fStatusBarEnabled)
     434            /* fSuccess = */ gEDataManager->setStatusBarEnabled(newInterfaceData.m_fStatusBarEnabled, m_machine.GetId());
     435        /* Save status-bar restrictions: */
     436        if (fSuccess && newInterfaceData.m_statusBarRestrictions != oldInterfaceData.m_statusBarRestrictions)
     437            /* fSuccess = */ gEDataManager->setRestrictedStatusBarIndicators(newInterfaceData.m_statusBarRestrictions, m_machine.GetId());
     438        /* Save status-bar order: */
     439        if (fSuccess && newInterfaceData.m_statusBarOrder != oldInterfaceData.m_statusBarOrder)
     440            /* fSuccess = */ gEDataManager->setStatusBarIndicatorOrder(newInterfaceData.m_statusBarOrder, m_machine.GetId());
     441    }
     442    /* Return result: */
     443    return fSuccess;
     444}
     445
     446bool UIMachineSettingsInterface::saveMiniToolbarData()
     447{
     448    /* Prepare result: */
     449    bool fSuccess = true;
     450    /* Save 'Mini-toolbar' data from the cache: */
     451    if (fSuccess)
     452    {
     453        /* Get old interface data from the cache: */
     454        const UIDataSettingsMachineInterface &oldInterfaceData = m_pCache->base();
     455        /* Get new interface data from the cache: */
     456        const UIDataSettingsMachineInterface &newInterfaceData = m_pCache->data();
     457
     458#ifndef VBOX_WS_MAC
     459        /* Save whether mini-toolbar is enabled: */
     460        if (fSuccess && newInterfaceData.m_fShowMiniToolBar != oldInterfaceData.m_fShowMiniToolBar)
     461            /* fSuccess = */ gEDataManager->setMiniToolbarEnabled(newInterfaceData.m_fShowMiniToolBar, m_machine.GetId());
     462        /* Save whether mini-toolbar should be location at top of screen: */
     463        if (fSuccess && newInterfaceData.m_fMiniToolBarAtTop != oldInterfaceData.m_fMiniToolBarAtTop)
     464            /* fSuccess = */ gEDataManager->setMiniToolbarAlignment(newInterfaceData.m_fMiniToolBarAtTop ? Qt::AlignTop : Qt::AlignBottom, m_machine.GetId());
     465#endif
     466    }
     467    /* Return result: */
     468    return fSuccess;
     469}
     470
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsInterface.h

    r66345 r66490  
    7474    void cleanup();
    7575
     76    /** Saves existing interface data from the cache. */
     77    bool saveInterfaceData();
     78    /** Saves existing 'Menu-bar' data from the cache. */
     79    bool saveMenuBarData();
     80    /** Saves existing 'Status-bar' data from the cache. */
     81    bool saveStatusBarData();
     82    /** Saves existing 'Mini-toolbar' data from the cache. */
     83    bool saveMiniToolbarData();
     84
    7685    /** Holds the machine ID copy. */
    7786    const QString  m_strMachineId;
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