Changeset 51654 in vbox
- Timestamp:
- Jun 18, 2014 6:14:46 PM (10 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/converter/UIConverterBackend.h
r51579 r51654 91 91 template<> bool canConvert<GuruMeditationHandlerType>(); 92 92 template<> bool canConvert<HiDPIOptimizationType>(); 93 template<> bool canConvert<MiniToolbarAlignment>(); 93 94 94 95 /* Declare COM canConvert specializations: */ … … 164 165 template<> QString toInternalString(const HiDPIOptimizationType &optimizationType); 165 166 template<> HiDPIOptimizationType fromInternalString<HiDPIOptimizationType>(const QString &strOptimizationType); 167 template<> QString toInternalString(const MiniToolbarAlignment &miniToolbarAlignment); 168 template<> MiniToolbarAlignment fromInternalString<MiniToolbarAlignment>(const QString &strMiniToolbarAlignment); 166 169 167 170 /* Declare COM conversion specializations: */ -
trunk/src/VBox/Frontends/VirtualBox/src/converter/UIConverterBackendGlobal.cpp
r51532 r51654 55 55 template<> bool canConvert<GuruMeditationHandlerType>() { return true; } 56 56 template<> bool canConvert<HiDPIOptimizationType>() { return true; } 57 template<> bool canConvert<MiniToolbarAlignment>() { return true; } 57 58 58 59 /* QString <= SizeSuffix: */ … … 932 933 /* Here we have some fancy stuff allowing us 933 934 * to search through the keys using 'case-insensitive' rule: */ 934 QStringList keys; QList<GlobalSettingsPageType> values;935 QStringList keys; QList<GlobalSettingsPageType> values; 935 936 keys << "General"; values << GlobalSettingsPageType_General; 936 937 keys << "Input"; values << GlobalSettingsPageType_Input; … … 1237 1238 } 1238 1239 1240 /* QString <= MiniToolbarAlignment: */ 1241 template<> QString toInternalString(const MiniToolbarAlignment &miniToolbarAlignment) 1242 { 1243 /* Return corresponding QString representation for passed enum value: */ 1244 switch (miniToolbarAlignment) 1245 { 1246 case MiniToolbarAlignment_Bottom: return "Bottom"; 1247 case MiniToolbarAlignment_Top: return "Top"; 1248 default: AssertMsgFailed(("No text for '%d'", miniToolbarAlignment)); break; 1249 } 1250 /* Return QString() by default: */ 1251 return QString(); 1252 } 1253 1254 /* MiniToolbarAlignment <= QString: */ 1255 template<> MiniToolbarAlignment fromInternalString<MiniToolbarAlignment>(const QString &strMiniToolbarAlignment) 1256 { 1257 /* Here we have some fancy stuff allowing us 1258 * to search through the keys using 'case-insensitive' rule: */ 1259 QStringList keys; QList<MiniToolbarAlignment> values; 1260 keys << "Bottom"; values << MiniToolbarAlignment_Bottom; 1261 keys << "Top"; values << MiniToolbarAlignment_Top; 1262 /* Bottom type for unknown words: */ 1263 if (!keys.contains(strMiniToolbarAlignment, Qt::CaseInsensitive)) 1264 return MiniToolbarAlignment_Bottom; 1265 /* Corresponding type for known words: */ 1266 return values.at(keys.indexOf(QRegExp(strMiniToolbarAlignment, Qt::CaseInsensitive))); 1267 } 1268 -
trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataDefs.h
r51593 r51654 406 406 }; 407 407 408 /** Runtime UI: Mini-toolbar alignment. */ 409 enum MiniToolbarAlignment 410 { 411 MiniToolbarAlignment_Bottom, 412 MiniToolbarAlignment_Top 413 }; 408 414 409 415 #endif /* !___UIExtraDataDefs_h___ */ -
trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.cpp
r51596 r51654 955 955 } 956 956 957 bool UIExtraDataManager::showMiniToolbar(const QString &strID) const 958 { 959 /* 'True' unless feature restricted: */ 960 return !isFeatureRestricted(GUI_ShowMiniToolBar, strID); 961 } 962 963 void UIExtraDataManager::setShowMiniToolbar(bool fShown, const QString &strID) 964 { 965 /* 'False' if feature restricted, null-string otherwise: */ 966 setExtraDataString(GUI_ShowMiniToolBar, toFeatureRestricted(!fShown), strID); 967 } 968 969 bool UIExtraDataManager::autoHideMiniToolbar(const QString &strID) const 970 { 971 /* 'True' unless feature restricted: */ 972 return !isFeatureRestricted(GUI_MiniToolBarAutoHide, strID); 973 } 974 975 void UIExtraDataManager::setAutoHideMiniToolbar(bool fAutoHide, const QString &strID) 976 { 977 /* 'False' if feature restricted, null-string otherwise: */ 978 setExtraDataString(GUI_MiniToolBarAutoHide, toFeatureRestricted(!fAutoHide), strID); 979 } 980 981 Qt::AlignmentFlag UIExtraDataManager::miniToolbarAlignment(const QString &strID) const 982 { 983 /* Return Qt::AlignBottom unless MiniToolbarAlignment_Top specified separately: */ 984 switch (gpConverter->fromInternalString<MiniToolbarAlignment>(extraDataString(GUI_MiniToolBarAlignment, strID))) 985 { 986 case MiniToolbarAlignment_Top: return Qt::AlignTop; 987 default: break; 988 } 989 return Qt::AlignBottom; 990 } 991 992 void UIExtraDataManager::setMiniToolbarAlignment(Qt::AlignmentFlag alignment, const QString &strID) 993 { 994 /* Remove record unless Qt::AlignTop specified separately: */ 995 switch (alignment) 996 { 997 case Qt::AlignTop: setExtraDataString(GUI_MiniToolBarAlignment, gpConverter->toInternalString(MiniToolbarAlignment_Top), strID); return; 998 default: break; 999 } 1000 setExtraDataString(GUI_MiniToolBarAlignment, QString(), strID); 1001 } 1002 957 1003 void UIExtraDataManager::sltExtraDataChange(QString strMachineID, QString strKey, QString strValue) 958 1004 { -
trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.h
r51596 r51654 277 277 bool hidLedsSyncState(const QString &strID) const; 278 278 279 /** Returns whether mini-toolbar should be shown for full and seamless screens. */ 280 bool showMiniToolbar(const QString &strID) const; 281 /** Defines whether mini-toolbar should be @a fShown for full and seamless screens. */ 282 void setShowMiniToolbar(bool fShown, const QString &strID); 283 284 /** Returns whether mini-toolbar should auto-hide itself. */ 285 bool autoHideMiniToolbar(const QString &strID) const; 286 /** Defines whether mini-toolbar should @a fAutoHide itself. */ 287 void setAutoHideMiniToolbar(bool fAutoHide, const QString &strID); 288 289 /** Returns mini-toolbar alignment. */ 290 Qt::AlignmentFlag miniToolbarAlignment(const QString &strID) const; 291 /** Returns mini-toolbar @a alignment. */ 292 void setMiniToolbarAlignment(Qt::AlignmentFlag alignment, const QString &strID); 293 279 294 private slots: 280 295 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineWindowFullscreen.cpp
r51248 r51654 234 234 void UIMachineWindowFullscreen::prepareMiniToolbar() 235 235 { 236 /* Get machine: */ 237 CMachine m = machine(); 238 239 /* Make sure mini-toolbar is necessary: */ 240 bool fIsActive = m.GetExtraData(GUI_ShowMiniToolBar) != "no"; 241 if (!fIsActive) 242 return; 243 244 /* Get the mini-toolbar alignment: */ 245 bool fIsAtTop = m.GetExtraData(GUI_MiniToolBarAlignment) == "top"; 246 /* Get the mini-toolbar auto-hide feature availability: */ 247 bool fIsAutoHide = m.GetExtraData(GUI_MiniToolBarAutoHide) != "off"; 236 /* Make sure mini-toolbar is not restricted: */ 237 if (!gEDataManager->showMiniToolbar(vboxGlobal().managedVMUuid())) 238 return; 239 248 240 /* Create mini-toolbar: */ 249 241 m_pMiniToolBar = new UIRuntimeMiniToolBar(this, 250 fIsAtTop ? Qt::AlignTop : Qt::AlignBottom,251 242 IntegrationMode_Embedded, 252 fIsAutoHide); 243 gEDataManager->miniToolbarAlignment(vboxGlobal().managedVMUuid()), 244 gEDataManager->autoHideMiniToolbar(vboxGlobal().managedVMUuid())); 253 245 QList<QMenu*> menus; 254 246 RuntimeMenuType restrictedMenus = gEDataManager->restrictedRuntimeMenuTypes(vboxGlobal().managedVMUuid()); … … 275 267 276 268 /* Save mini-toolbar settings: */ 277 machine().SetExtraData(GUI_MiniToolBarAutoHide, m_pMiniToolBar->autoHide() ? QString() : "off");269 gEDataManager->setAutoHideMiniToolbar(m_pMiniToolBar->autoHide(), vboxGlobal().managedVMUuid()); 278 270 /* Delete mini-toolbar: */ 279 271 delete m_pMiniToolBar; -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineWindowSeamless.cpp
r51054 r51654 128 128 void UIMachineWindowSeamless::prepareMiniToolbar() 129 129 { 130 /* Get machine: */ 131 CMachine m = machine(); 132 133 /* Make sure mini-toolbar is necessary: */ 134 bool fIsActive = m.GetExtraData(GUI_ShowMiniToolBar) != "no"; 135 if (!fIsActive) 130 /* Make sure mini-toolbar is not restricted: */ 131 if (!gEDataManager->showMiniToolbar(vboxGlobal().managedVMUuid())) 136 132 return; 137 133 138 /* Get the mini-toolbar alignment: */139 bool fIsAtTop = m.GetExtraData(GUI_MiniToolBarAlignment) == "top";140 /* Get the mini-toolbar auto-hide feature availability: */141 bool fIsAutoHide = m.GetExtraData(GUI_MiniToolBarAutoHide) != "off";142 134 /* Create mini-toolbar: */ 143 135 m_pMiniToolBar = new UIRuntimeMiniToolBar(this, 144 fIsAtTop ? Qt::AlignTop : Qt::AlignBottom,145 136 IntegrationMode_External, 146 fIsAutoHide); 137 gEDataManager->miniToolbarAlignment(vboxGlobal().managedVMUuid()), 138 gEDataManager->autoHideMiniToolbar(vboxGlobal().managedVMUuid())); 147 139 m_pMiniToolBar->show(); 148 140 QList<QMenu*> menus; … … 170 162 171 163 /* Save mini-toolbar settings: */ 172 machine().SetExtraData(GUI_MiniToolBarAutoHide, m_pMiniToolBar->autoHide() ? QString() : "off");164 gEDataManager->setAutoHideMiniToolbar(m_pMiniToolBar->autoHide(), vboxGlobal().managedVMUuid()); 173 165 /* Delete mini-toolbar: */ 174 166 delete m_pMiniToolBar; -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsGeneral.cpp
r51593 r51654 23 23 24 24 /* GUI includes: */ 25 #include "QIWidgetValidator.h" 25 26 #include "UIMachineSettingsGeneral.h" 27 #include "UIExtraDataManager.h" 26 28 #include "UIMessageCenter.h" 27 #include "QIWidgetValidator.h"28 29 #include "UIConverter.h" 29 30 … … 106 107 generalData.m_strName = m_machine.GetName(); 107 108 generalData.m_strGuestOsTypeId = m_machine.GetOSTypeId(); 108 QString strShowMiniToolBar = m_machine.GetExtraData(GUI_ShowMiniToolBar); 109 generalData.m_fShowMiniToolBar = strShowMiniToolBar != "no"; 110 QString strMiniToolBarAlignment = m_machine.GetExtraData(GUI_MiniToolBarAlignment); 111 generalData.m_fMiniToolBarAtTop = strMiniToolBarAlignment == "top"; 109 generalData.m_fShowMiniToolBar = gEDataManager->showMiniToolbar(m_machine.GetId()); 110 generalData.m_fMiniToolBarAtTop = gEDataManager->miniToolbarAlignment(m_machine.GetId()) == Qt::AlignTop; 112 111 generalData.m_strSnapshotsFolder = m_machine.GetSnapshotFolder(); 113 112 generalData.m_strSnapshotsHomeDir = QFileInfo(m_machine.GetSettingsFilePath()).absolutePath(); … … 189 188 m_machine.SetClipboardMode(generalData.m_clipboardMode); 190 189 m_machine.SetDnDMode(generalData.m_dndMode); 191 m_machine.SetExtraData(GUI_ShowMiniToolBar, generalData.m_fShowMiniToolBar ? "yes" : "no");192 m_machine.SetExtraData(GUI_MiniToolBarAlignment, generalData.m_fMiniToolBarAtTop ? "top" : "bottom");190 gEDataManager->setShowMiniToolbar(generalData.m_fShowMiniToolBar, m_machine.GetId()); 191 gEDataManager->setMiniToolbarAlignment(generalData.m_fMiniToolBarAtTop ? Qt::AlignTop : Qt::AlignBottom, m_machine.GetId()); 193 192 /* Description tab: */ 194 193 m_machine.SetDescription(generalData.m_strDescription); -
trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIMiniToolBar.cpp
r51079 r51654 42 42 43 43 UIRuntimeMiniToolBar::UIRuntimeMiniToolBar(QWidget *pParent, 44 IntegrationMode integrationMode, 44 45 Qt::Alignment alignment, 45 IntegrationMode integrationMode, 46 bool fAutoHide /* = true*/) 46 bool fAutoHide /* = true */) 47 47 : QWidget(pParent) 48 48 /* Variables: General stuff: */ 49 , m_integrationMode(integrationMode) 49 50 , m_alignment(alignment) 50 , m_integrationMode(integrationMode)51 51 , m_fAutoHide(fAutoHide) 52 52 /* Variables: Contents stuff: */ -
trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIMiniToolBar.h
r50816 r51654 71 71 /* Constructor/destructor: */ 72 72 UIRuntimeMiniToolBar(QWidget *pParent, 73 IntegrationMode integrationMode, 73 74 Qt::Alignment alignment, 74 IntegrationMode integrationMode,75 75 bool fAutoHide = true); 76 76 ~UIRuntimeMiniToolBar(); … … 131 131 132 132 /* Variables: General stuff: */ 133 IntegrationMode m_integrationMode; 133 134 Qt::Alignment m_alignment; 134 IntegrationMode m_integrationMode;135 135 bool m_fAutoHide; 136 136
Note:
See TracChangeset
for help on using the changeset viewer.