VirtualBox

Changeset 75642 in vbox for trunk/src/VBox/Frontends


Ignore:
Timestamp:
Nov 21, 2018 1:55:19 PM (6 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:6699. Save file manager options to extra data

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataDefs.cpp

    r75424 r75642  
    204204const char *UIExtraDataDefs::GUI_GuestControl_ProcessControlDialogGeometry = "GUI/GuestControl/ProcessControlDialogGeometry";
    205205
     206/* Guest Control file manager options: */
     207const char *UIExtraDataDefs::GUI_GuestControl_FileManagerOptions = "GUI/GuestControl/FileManagerOptions";
     208const char *UIExtraDataDefs::GUI_GuestControl_FileManagerListDirectoriesFirst = "ListDirectoriesFirst";
     209const char *UIExtraDataDefs::GUI_GuestControl_FileManagerShowDeleteConfirmation = "ShowDeleteConfimation";
     210const char *UIExtraDataDefs::GUI_GuestControl_FileManagerShowHumanReadableSizes = "ShowHumanReadableSizes";
     211
    206212/* Virtual Machine: Close dialog: */
    207213const char *UIExtraDataDefs::GUI_DefaultCloseAction = "GUI/DefaultCloseAction";
  • trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataDefs.h

    r75616 r75642  
    365365    /** @} */
    366366
     367    /** @name Guest Control file manager options
     368      * @{ */
     369        extern const char *GUI_GuestControl_FileManagerOptions;
     370        extern const char *GUI_GuestControl_FileManagerListDirectoriesFirst;
     371        extern const char *GUI_GuestControl_FileManagerShowDeleteConfirmation;
     372        extern const char *GUI_GuestControl_FileManagerShowHumanReadableSizes;
     373    /** @} */
     374
    367375    /** @name Virtual Machine: Close dialog
    368376      * @{ */
  • trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.cpp

    r75607 r75642  
    20342034           << GUI_GuestControl_ProcessControlSplitterHints
    20352035           << GUI_GuestControl_FileManagerDialogGeometry
     2036           << GUI_GuestControl_FileManagerOptions
    20362037           << GUI_GuestControl_ProcessControlDialogGeometry
    20372038           << GUI_DefaultCloseAction << GUI_RestrictedCloseActions
     
    42454246}
    42464247
     4248void UIExtraDataManager::setGuestControlFileManagerOptions(bool fListDirectoriesFirst,
     4249                                       bool fShowDeleteConfirmation, bool fShowHumanReadableSizes)
     4250{
     4251    /* Serialize passed values: */
     4252    QStringList data;
     4253
     4254    if (fListDirectoriesFirst)
     4255        data << GUI_GuestControl_FileManagerListDirectoriesFirst;
     4256    if (fShowDeleteConfirmation)
     4257        data << GUI_GuestControl_FileManagerShowDeleteConfirmation;
     4258    if (fShowHumanReadableSizes)
     4259        data << GUI_GuestControl_FileManagerShowHumanReadableSizes;
     4260
     4261    /* Re-cache corresponding extra-data: */
     4262    setExtraDataStringList(GUI_GuestControl_FileManagerOptions, data);
     4263}
     4264
     4265bool UIExtraDataManager::guestControlFileManagerListDirectoriesFirst()
     4266{
     4267    const QStringList data = extraDataStringList(GUI_GuestControl_FileManagerOptions);
     4268    for (int i = 0; i < data.size(); ++i)
     4269    {
     4270        if (data[i] == GUI_GuestControl_FileManagerListDirectoriesFirst)
     4271            return true;
     4272    }
     4273    return false;
     4274}
     4275
     4276bool UIExtraDataManager::guestControlFileManagerShowDeleteConfirmation()
     4277{
     4278    const QStringList data = extraDataStringList(GUI_GuestControl_FileManagerOptions);
     4279    for (int i = 0; i < data.size(); ++i)
     4280    {
     4281        if (data[i] == GUI_GuestControl_FileManagerShowDeleteConfirmation)
     4282            return true;
     4283    }
     4284    return false;
     4285}
     4286
     4287bool UIExtraDataManager::guestControlFileManagerShowHumanReadableSizes()
     4288{
     4289    const QStringList data = extraDataStringList(GUI_GuestControl_FileManagerOptions);
     4290    for (int i = 0; i < data.size(); ++i)
     4291    {
     4292        if (data[i] == GUI_GuestControl_FileManagerShowHumanReadableSizes)
     4293            return true;
     4294    }
     4295    return false;
     4296}
     4297
    42474298QRect UIExtraDataManager::guestProcessControlDialogGeometry(QWidget *pWidget, const QRect &defaultGeometry)
    42484299{
  • trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.h

    r75607 r75642  
    634634    /** @} */
    635635
    636     /** @name Virtual Machine: Guest Control related dialogs
     636    /** @name Guest Control related dialogs
    637637      * @{ */
    638638        void setGuestControlProcessControlSplitterHints(const QList<int> &hints);
     
    646646        void setGuestControlFileManagerVisiblePanels(const QStringList &panelNameList);
    647647        QStringList guestControlFileManagerVisiblePanels();
     648    /** @} */
     649
     650    /** @name Guest Control file manager options
     651      * @{ */
     652        void setGuestControlFileManagerOptions(bool fListDirectoriesFirst,
     653                                               bool fShowDeleteConfirmation, bool fshowHumanReadableSizes);
     654        bool guestControlFileManagerListDirectoriesFirst();
     655        bool guestControlFileManagerShowDeleteConfirmation();
     656        bool guestControlFileManagerShowHumanReadableSizes();
    648657    /** @} */
    649658
  • trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIGuestControlFileManager.cpp

    r75619 r75642  
    147147    , m_pOperationsPanel(0)
    148148{
     149    loadOptions();
    149150    prepareGuestListener();
    150151    prepareObjects();
     
    703704        strNameList.append(pPanel->panelName());
    704705    gEDataManager->setGuestControlFileManagerVisiblePanels(strNameList);
     706
     707    /* Save the options: */
     708    UIGuestControlFileManagerSettings *pSettings = UIGuestControlFileManagerSettings::instance();
     709    if (pSettings)
     710    {
     711        gEDataManager->setGuestControlFileManagerOptions(pSettings->bListDirectoriesOnTop,
     712                                                         pSettings->bAskDeleteConfirmation,
     713                                                         pSettings->bShowHumanReadableSizes);
     714    }
    705715}
    706716
     
    722732}
    723733
     734void UIGuestControlFileManager::loadOptions()
     735{
     736    /* Load options: */
     737    UIGuestControlFileManagerSettings *pSettings = UIGuestControlFileManagerSettings::instance();
     738    if (pSettings)
     739    {
     740        pSettings->bListDirectoriesOnTop = gEDataManager->guestControlFileManagerListDirectoriesFirst();
     741        pSettings->bAskDeleteConfirmation = gEDataManager->guestControlFileManagerShowDeleteConfirmation();
     742        pSettings->bShowHumanReadableSizes = gEDataManager->guestControlFileManagerShowHumanReadableSizes();
     743    }
     744}
     745
    724746void UIGuestControlFileManager::hidePanel(UIGuestControlFileManagerPanel* panel)
    725747{
  • trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIGuestControlFileManager.h

    r75619 r75642  
    143143    /** @} */
    144144
     145    /** Saves list of panels and file manager options to the extra data. */
    145146    void saveSettings();
     147    /** Loads settings from exra data except the file manager options. */
    146148    void loadSettings();
     149    /** Loads file manager options. This should be done before widget creation
     150     *  since some widgets are initilized with these options */
     151    void loadOptions();
    147152    void hidePanel(UIGuestControlFileManagerPanel *panel);
    148153    void showPanel(UIGuestControlFileManagerPanel *panel);
    149     /** Make sure escape key is assigned to only a single widget. This is done by checking
     154    /** Makes sure escape key is assigned to only a single widget. This is done by checking
    150155        several things in the following order:
    151156        - when there are no more panels visible assign it to the parent dialog
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