Changeset 86096 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- Sep 11, 2020 2:31:56 PM (4 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/settings/global
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsGeneral.cpp
r86094 r86096 24 24 #include "UICommon.h" 25 25 #include "UIErrorString.h" 26 #include "UIExtraDataManager.h"27 26 #include "UIFilePathSelector.h" 28 27 #include "UIGlobalSettingsGeneral.h" … … 52 51 bool operator!=(const UIDataSettingsGlobalGeneral &other) const { return !equal(other); } 53 52 54 /** Holds the default machine folderpath. */53 /** Holds the 'default machine folder' path. */ 55 54 QString m_strDefaultMachineFolder; 56 /** Holds the VRDE authentication libraryname. */55 /** Holds the 'VRDE auth library' name. */ 57 56 QString m_strVRDEAuthLibrary; 58 57 }; … … 61 60 UIGlobalSettingsGeneral::UIGlobalSettingsGeneral() 62 61 : m_pCache(0) 63 , m_pLabelMachineFolder(0) 64 , m_pSelectorMachineFolder(0) 65 , m_pLabelVRDPLibraryName(0) 66 , m_pSelectorVRDPLibraryName(0) 67 { 68 /* Prepare: */ 62 , m_pLabelDefaultMachineFolder(0) 63 , m_pSelectorDefaultMachineFolder(0) 64 , m_pLabelVRDEAuthLibrary(0) 65 , m_pSelectorVRDEAuthLibrary(0) 66 { 69 67 prepare(); 70 68 } … … 72 70 UIGlobalSettingsGeneral::~UIGlobalSettingsGeneral() 73 71 { 74 /* Cleanup: */75 72 cleanup(); 76 73 } … … 84 81 m_pCache->clear(); 85 82 86 /* Prepare old general data: */ 87 UIDataSettingsGlobalGeneral oldGeneralData; 88 89 /* Gather old general data: */ 90 oldGeneralData.m_strDefaultMachineFolder = m_properties.GetDefaultMachineFolder(); 91 oldGeneralData.m_strVRDEAuthLibrary = m_properties.GetVRDEAuthLibrary(); 92 93 /* Cache old general data: */ 94 m_pCache->cacheInitialData(oldGeneralData); 83 /* Cache old data: */ 84 UIDataSettingsGlobalGeneral oldData; 85 oldData.m_strDefaultMachineFolder = m_properties.GetDefaultMachineFolder(); 86 oldData.m_strVRDEAuthLibrary = m_properties.GetVRDEAuthLibrary(); 87 m_pCache->cacheInitialData(oldData); 95 88 96 89 /* Upload properties to data: */ … … 100 93 void UIGlobalSettingsGeneral::getFromCache() 101 94 { 102 /* Get old general data from the cache: */ 103 const UIDataSettingsGlobalGeneral &oldGeneralData = m_pCache->base(); 104 105 /* Load old general data from the cache: */ 106 m_pSelectorMachineFolder->setPath(oldGeneralData.m_strDefaultMachineFolder); 107 m_pSelectorVRDPLibraryName->setPath(oldGeneralData.m_strVRDEAuthLibrary); 95 /* Load old data from cache: */ 96 const UIDataSettingsGlobalGeneral &oldData = m_pCache->base(); 97 m_pSelectorDefaultMachineFolder->setPath(oldData.m_strDefaultMachineFolder); 98 m_pSelectorVRDEAuthLibrary->setPath(oldData.m_strVRDEAuthLibrary); 108 99 } 109 100 110 101 void UIGlobalSettingsGeneral::putToCache() 111 102 { 112 /* Prepare new general data: */ 113 UIDataSettingsGlobalGeneral newGeneralData = m_pCache->base(); 114 115 /* Gather new general data: */ 116 newGeneralData.m_strDefaultMachineFolder = m_pSelectorMachineFolder->path(); 117 newGeneralData.m_strVRDEAuthLibrary = m_pSelectorVRDPLibraryName->path(); 118 119 /* Cache new general data: */ 120 m_pCache->cacheCurrentData(newGeneralData); 103 /* Prepare new data: */ 104 UIDataSettingsGlobalGeneral newData = m_pCache->base(); 105 106 /* Cache new data: */ 107 newData.m_strDefaultMachineFolder = m_pSelectorDefaultMachineFolder->path(); 108 newData.m_strVRDEAuthLibrary = m_pSelectorVRDEAuthLibrary->path(); 109 m_pCache->cacheCurrentData(newData); 121 110 } 122 111 … … 126 115 UISettingsPageGlobal::fetchData(data); 127 116 128 /* Update generaldata and failing state: */117 /* Update data and failing state: */ 129 118 setFailed(!saveGeneralData()); 130 119 … … 135 124 void UIGlobalSettingsGeneral::retranslateUi() 136 125 { 137 m_pLabelMachineFolder->setText(tr("Default &Machine Folder:")); 138 m_pSelectorMachineFolder->setWhatsThis(tr("Holds the path to the default virtual machine folder. This folder is used, " 139 "if not explicitly specified otherwise, when creating new virtual machines.")); 140 m_pLabelVRDPLibraryName->setText(tr("V&RDP Authentication Library:")); 141 m_pSelectorVRDPLibraryName->setWhatsThis(tr("Holds the path to the library that provides authentication for Remote Display (VRDP) clients.")); 126 m_pLabelDefaultMachineFolder->setText(tr("Default &Machine Folder:")); 127 m_pSelectorDefaultMachineFolder->setWhatsThis(tr("Holds the path to the default virtual machine folder. This folder is used, " 128 "if not explicitly specified otherwise, when creating new virtual machines.")); 129 m_pLabelVRDEAuthLibrary->setText(tr("V&RDP Authentication Library:")); 130 m_pSelectorVRDEAuthLibrary->setWhatsThis(tr("Holds the path to the library that provides " 131 "authentication for Remote Display (VRDP) clients.")); 142 132 } 143 133 … … 164 154 pLayoutMain->setRowStretch(3, 1); 165 155 166 /* Prepare machine folderlabel: */167 m_pLabel MachineFolder = new QLabel(this);168 if (m_pLabel MachineFolder)169 { 170 m_pLabel MachineFolder->setAlignment(Qt::AlignRight | Qt::AlignVCenter);171 pLayoutMain->addWidget(m_pLabel MachineFolder, 0, 0);172 } 173 /* Prepare machine folder selector: */174 m_pSelector MachineFolder = new UIFilePathSelector(this);175 if (m_pSelector MachineFolder)176 { 177 if (m_pLabel MachineFolder)178 m_pLabel MachineFolder->setBuddy(m_pSelectorMachineFolder);179 m_pSelector MachineFolder->setHomeDir(uiCommon().homeFolder());180 181 pLayoutMain->addWidget(m_pSelector MachineFolder, 0, 1, 1, 2);182 } 183 184 /* Prepare VRDP library namelabel: */185 m_pLabelVRD PLibraryName= new QLabel(this);186 if (m_pLabelVRD PLibraryName)187 { 188 m_pLabelVRD PLibraryName->setAlignment(Qt::AlignRight | Qt::AlignVCenter);189 pLayoutMain->addWidget(m_pLabelVRD PLibraryName, 1, 0);190 } 191 /* Prepare VRDP library name selector: */192 m_pSelectorVRD PLibraryName= new UIFilePathSelector(this);193 if (m_pSelectorVRD PLibraryName)194 { 195 if (m_pLabelVRD PLibraryName)196 m_pLabelVRD PLibraryName->setBuddy(m_pSelectorVRDPLibraryName);197 m_pSelectorVRD PLibraryName->setHomeDir(uiCommon().homeFolder());198 m_pSelectorVRD PLibraryName->setMode(UIFilePathSelector::Mode_File_Open);199 200 pLayoutMain->addWidget(m_pSelectorVRD PLibraryName, 1, 1, 1, 2);156 /* Prepare 'default machine folder' label: */ 157 m_pLabelDefaultMachineFolder = new QLabel(this); 158 if (m_pLabelDefaultMachineFolder) 159 { 160 m_pLabelDefaultMachineFolder->setAlignment(Qt::AlignRight | Qt::AlignVCenter); 161 pLayoutMain->addWidget(m_pLabelDefaultMachineFolder, 0, 0); 162 } 163 /* Prepare 'default machine folder' editor: */ 164 m_pSelectorDefaultMachineFolder = new UIFilePathSelector(this); 165 if (m_pSelectorDefaultMachineFolder) 166 { 167 if (m_pLabelDefaultMachineFolder) 168 m_pLabelDefaultMachineFolder->setBuddy(m_pSelectorDefaultMachineFolder); 169 m_pSelectorDefaultMachineFolder->setHomeDir(uiCommon().homeFolder()); 170 171 pLayoutMain->addWidget(m_pSelectorDefaultMachineFolder, 0, 1, 1, 2); 172 } 173 174 /* Prepare 'VRDE auth library' label: */ 175 m_pLabelVRDEAuthLibrary = new QLabel(this); 176 if (m_pLabelVRDEAuthLibrary) 177 { 178 m_pLabelVRDEAuthLibrary->setAlignment(Qt::AlignRight | Qt::AlignVCenter); 179 pLayoutMain->addWidget(m_pLabelVRDEAuthLibrary, 1, 0); 180 } 181 /* Prepare 'VRDE auth library' editor: */ 182 m_pSelectorVRDEAuthLibrary = new UIFilePathSelector(this); 183 if (m_pSelectorVRDEAuthLibrary) 184 { 185 if (m_pLabelVRDEAuthLibrary) 186 m_pLabelVRDEAuthLibrary->setBuddy(m_pSelectorVRDEAuthLibrary); 187 m_pSelectorVRDEAuthLibrary->setHomeDir(uiCommon().homeFolder()); 188 m_pSelectorVRDEAuthLibrary->setMode(UIFilePathSelector::Mode_File_Open); 189 190 pLayoutMain->addWidget(m_pSelectorVRDEAuthLibrary, 1, 1, 1, 2); 201 191 } 202 192 } … … 214 204 /* Prepare result: */ 215 205 bool fSuccess = true; 216 /* Save general settings from thecache: */206 /* Save settings from cache: */ 217 207 if (fSuccess && m_pCache->wasChanged()) 218 208 { 219 /* Get old general data from thecache: */220 const UIDataSettingsGlobalGeneral &old GeneralData = m_pCache->base();221 /* Get new general data from thecache: */222 const UIDataSettingsGlobalGeneral &new GeneralData = m_pCache->data();223 224 /* Save default machine folder: */209 /* Get old data from cache: */ 210 const UIDataSettingsGlobalGeneral &oldData = m_pCache->base(); 211 /* Get new data from cache: */ 212 const UIDataSettingsGlobalGeneral &newData = m_pCache->data(); 213 214 /* Save 'default machine folder': */ 225 215 if ( fSuccess 226 && new GeneralData.m_strDefaultMachineFolder != oldGeneralData.m_strDefaultMachineFolder)227 { 228 m_properties.SetDefaultMachineFolder(new GeneralData.m_strDefaultMachineFolder);216 && newData.m_strDefaultMachineFolder != oldData.m_strDefaultMachineFolder) 217 { 218 m_properties.SetDefaultMachineFolder(newData.m_strDefaultMachineFolder); 229 219 fSuccess = m_properties.isOk(); 230 220 } 231 /* Save VRDE auth library: */221 /* Save 'VRDE auth library': */ 232 222 if ( fSuccess 233 && new GeneralData.m_strVRDEAuthLibrary != oldGeneralData.m_strVRDEAuthLibrary)234 { 235 m_properties.SetVRDEAuthLibrary(new GeneralData.m_strVRDEAuthLibrary);223 && newData.m_strVRDEAuthLibrary != oldData.m_strVRDEAuthLibrary) 224 { 225 m_properties.SetVRDEAuthLibrary(newData.m_strVRDEAuthLibrary); 236 226 fSuccess = m_properties.isOk(); 237 227 } -
trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsGeneral.h
r86095 r86096 38 38 public: 39 39 40 /** Constructs Generalsettings page. */40 /** Constructs settings page. */ 41 41 UIGlobalSettingsGeneral(); 42 /** Destructs Generalsettings page. */43 ~UIGlobalSettingsGeneral();42 /** Destructs settings page. */ 43 virtual ~UIGlobalSettingsGeneral() /* override */; 44 44 45 45 protected: … … 71 71 void cleanup(); 72 72 73 /** Saves existing general data from thecache. */73 /** Saves existing data from cache. */ 74 74 bool saveGeneralData(); 75 75 … … 79 79 /** @name Widgets 80 80 * @{ */ 81 /** Holds machine folderlabel instance. */82 QLabel *m_pLabel MachineFolder;83 /** Holds machine folderselector instance. */84 UIFilePathSelector *m_pSelector MachineFolder;85 /** Holds VRDP library namelabel instance. */86 QLabel *m_pLabelVRD PLibraryName;87 /** Holds VRDP library nameselector instance. */88 UIFilePathSelector *m_pSelectorVRD PLibraryName;81 /** Holds 'default machine folder' label instance. */ 82 QLabel *m_pLabelDefaultMachineFolder; 83 /** Holds 'default machine folder' selector instance. */ 84 UIFilePathSelector *m_pSelectorDefaultMachineFolder; 85 /** Holds 'VRDE auth library' label instance. */ 86 QLabel *m_pLabelVRDEAuthLibrary; 87 /** Holds 'VRDE auth library' selector instance. */ 88 UIFilePathSelector *m_pSelectorVRDEAuthLibrary; 89 89 /** @} */ 90 90 };
Note:
See TracChangeset
for help on using the changeset viewer.