Changeset 44453 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Jan 30, 2013 10:21:33 AM (12 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIExtraDataEventHandler.cpp
r44448 r44453 37 37 38 38 public: 39 39 40 UIExtraDataEventHandlerPrivate(QObject *pParent = 0) 40 : QObject(pParent) 41 , m_fIsRegDlgOwner(false) 42 , m_fIsUpdDlgOwner(false) 43 #ifdef VBOX_GUI_WITH_SYSTRAY 44 , m_fIsTrayIconOwner(false) 41 : QObject(pParent) 42 #ifdef VBOX_GUI_WITH_SYSTRAY 43 , m_fIsTrayIconOwner(false) 45 44 #endif /* VBOX_GUI_WITH_SYSTRAY */ 46 45 {} … … 55 54 if (strKey.startsWith("GUI/")) 56 55 { 57 if (strKey == GUI_RegistrationDlgWinID) 58 { 59 if (m_fIsRegDlgOwner) 56 #ifdef VBOX_GUI_WITH_SYSTRAY 57 if (strKey == GUI_TrayIconWinID) 58 { 59 if (m_fIsTrayIconOwner) 60 60 { 61 61 if (!(strValue.isEmpty() || … … 66 66 return; 67 67 } 68 69 #ifdef VBOX_GUI_WITH_SYSTRAY 70 if (strKey == GUI_TrayIconWinID) 71 { 72 if (m_fIsTrayIconOwner) 73 { 74 if (!(strValue.isEmpty() || 75 strValue == QString("%1") 76 .arg((qulonglong)vboxGlobal().mainWindow()->winId()))) 77 fVeto = true; 78 } 79 return; 80 } 81 #endif 68 #endif /* VBOX_GUI_WITH_SYSTRAY */ 82 69 /* Try to set the global setting to check its syntax */ 83 70 VBoxGlobalSettings gs(false /* non-null */); … … 97 84 } 98 85 99 void sltExtraDataChange(QString strId, QString strKey, QString strValue) 100 { 101 if (QUuid(strId).isNull()) 102 { 103 if (strKey.startsWith ("GUI/")) 104 { 105 if (strKey == GUI_RegistrationDlgWinID) 106 { 107 if (strValue.isEmpty()) 108 { 109 m_fIsRegDlgOwner = false; 110 emit sigCanShowRegistrationDlg(true); 111 } 112 else if (strValue == QString("%1") 113 .arg((qulonglong)vboxGlobal().mainWindow()->winId())) 114 { 115 m_fIsRegDlgOwner = true; 116 emit sigCanShowRegistrationDlg(true); 117 } 118 else 119 emit sigCanShowRegistrationDlg(false); 120 } 121 if (strKey == GUI_LanguageId) 122 emit sigGUILanguageChange(strValue); 123 if (strKey == GUI_Input_SelectorShortcuts && gActionPool->type() == UIActionPoolType_Selector) 124 emit sigSelectorShortcutsChanged(); 125 if (strKey == GUI_Input_MachineShortcuts && gActionPool->type() == UIActionPoolType_Runtime) 126 emit sigMachineShortcutsChanged(); 127 #ifdef VBOX_GUI_WITH_SYSTRAY 128 if (strKey == GUI_MainWindowCount) 129 emit sigMainWindowCountChange(strValue.toInt()); 130 if (strKey == GUI_TrayIconWinID) 131 { 132 if (strValue.isEmpty()) 133 { 134 m_fIsTrayIconOwner = false; 135 emit sigCanShowTrayIcon(true); 136 } 137 else if (strValue == QString("%1") 138 .arg((qulonglong)vboxGlobal().mainWindow()->winId())) 139 { 140 m_fIsTrayIconOwner = true; 141 emit sigCanShowTrayIcon(true); 142 } 143 else 144 emit sigCanShowTrayIcon(false); 145 } 146 if (strKey == GUI_TrayIconEnabled) 147 emit sigTrayIconChange((strValue.toLower() == "true") ? true : false); 86 void sltExtraDataChange(QString strId, QString strKey, QString strValue) 87 { 88 if (QUuid(strId).isNull()) 89 { 90 if (strKey.startsWith ("GUI/")) 91 { 92 if (strKey == GUI_LanguageId) 93 emit sigGUILanguageChange(strValue); 94 if (strKey == GUI_Input_SelectorShortcuts && gActionPool->type() == UIActionPoolType_Selector) 95 emit sigSelectorShortcutsChanged(); 96 if (strKey == GUI_Input_MachineShortcuts && gActionPool->type() == UIActionPoolType_Runtime) 97 emit sigMachineShortcutsChanged(); 98 #ifdef VBOX_GUI_WITH_SYSTRAY 99 if (strKey == GUI_MainWindowCount) 100 emit sigMainWindowCountChange(strValue.toInt()); 101 if (strKey == GUI_TrayIconWinID) 102 { 103 if (strValue.isEmpty()) 104 { 105 m_fIsTrayIconOwner = false; 106 emit sigCanShowTrayIcon(true); 107 } 108 else if (strValue == QString("%1") 109 .arg((qulonglong)vboxGlobal().mainWindow()->winId())) 110 { 111 m_fIsTrayIconOwner = true; 112 emit sigCanShowTrayIcon(true); 113 } 114 else 115 emit sigCanShowTrayIcon(false); 116 } 117 if (strKey == GUI_TrayIconEnabled) 118 emit sigTrayIconChange((strValue.toLower() == "true") ? true : false); 148 119 #endif /* VBOX_GUI_WITH_SYSTRAY */ 149 120 #ifdef Q_WS_MAC 150 if (strKey == GUI_PresentationModeEnabled)151 {152 /* Default to true if it is an empty value */153 QString testStr = strValue.toLower();154 bool f = (testStr.isEmpty() || testStr == "false");155 emit sigPresentationModeChange(f);156 }121 if (strKey == GUI_PresentationModeEnabled) 122 { 123 /* Default to true if it is an empty value */ 124 QString testStr = strValue.toLower(); 125 bool f = (testStr.isEmpty() || testStr == "false"); 126 emit sigPresentationModeChange(f); 127 } 157 128 #endif /* Q_WS_MAC */ 158 129 159 m_mutex.lock();160 vboxGlobal().settings().setPublicProperty(strKey, strValue);161 m_mutex.unlock();162 Assert(!!vboxGlobal().settings());163 }164 }130 m_mutex.lock(); 131 vboxGlobal().settings().setPublicProperty(strKey, strValue); 132 m_mutex.unlock(); 133 Assert(!!vboxGlobal().settings()); 134 } 135 } 165 136 #ifdef Q_WS_MAC 166 else if (vboxGlobal().isVMConsoleProcess())167 {168 /* Check for the currently running machine */169 if (strId == vboxGlobal().managedVMUuid())170 {171 if ( strKey == GUI_RealtimeDockIconUpdateEnabled172 || strKey == GUI_RealtimeDockIconUpdateMonitor)173 {174 bool f = strValue.toLower() == "false" ? false : true;175 emit sigDockIconAppearanceChange(f);176 }177 }178 }137 else if (vboxGlobal().isVMConsoleProcess()) 138 { 139 /* Check for the currently running machine */ 140 if (strId == vboxGlobal().managedVMUuid()) 141 { 142 if ( strKey == GUI_RealtimeDockIconUpdateEnabled 143 || strKey == GUI_RealtimeDockIconUpdateMonitor) 144 { 145 bool f = strValue.toLower() == "false" ? false : true; 146 emit sigDockIconAppearanceChange(f); 147 } 148 } 149 } 179 150 #endif /* Q_WS_MAC */ 180 }151 } 181 152 182 153 signals: 183 void sigCanShowRegistrationDlg(bool fEnabled); 154 184 155 void sigGUILanguageChange(QString strLang); 185 156 void sigSelectorShortcutsChanged(); … … 196 167 197 168 private: 169 198 170 /** protects #OnExtraDataChange() */ 199 171 QMutex m_mutex; 200 172 201 173 /* Private member vars */ 202 bool m_fIsRegDlgOwner;203 bool m_fIsUpdDlgOwner;204 174 #ifdef VBOX_GUI_WITH_SYSTRAY 205 175 bool m_fIsTrayIconOwner; … … 257 227 258 228 /* UI signals */ 259 connect(m_pHandler, SIGNAL(sigCanShowRegistrationDlg(bool)),260 this, SIGNAL(sigCanShowRegistrationDlg(bool)),261 Qt::QueuedConnection);262 263 229 connect(m_pHandler, SIGNAL(sigGUILanguageChange(QString)), 264 230 this, SIGNAL(sigGUILanguageChange(QString)), -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIExtraDataEventHandler.h
r44448 r44453 36 36 signals: 37 37 /* Specialized extra data signals */ 38 void sigCanShowRegistrationDlg(bool fEnabled);39 38 void sigGUILanguageChange(QString strLang); 40 39 void sigSelectorShortcutsChanged(); -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.cpp
r43138 r44453 1990 1990 } 1991 1991 1992 void UIMessageCenter::cannotConnectRegister(QWidget *pParent,1993 const QString &strUrl,1994 const QString &strReason)1995 {1996 /* we don't want to expose the registration script URL to the user1997 * if he simply doesn't have an internet connection */1998 Q_UNUSED(strUrl);1999 2000 message(pParent, Error,2001 tr("<p>Failed to connect to the VirtualBox online "2002 "registration service due to the following error:</p><p><b>%1</b></p>")2003 .arg(strReason));2004 }2005 2006 void UIMessageCenter::showRegisterResult(QWidget *pParent,2007 const QString &strResult)2008 {2009 if (strResult == "OK")2010 {2011 /* On successful registration attempt */2012 message(pParent, Info,2013 tr("<p>Congratulations! You have been successfully registered "2014 "as a user of VirtualBox.</p>"2015 "<p>Thank you for finding time to fill out the "2016 "registration form!</p>"));2017 }2018 else2019 {2020 QString parsed;2021 2022 /* Else parse and translate special key-words */2023 if (strResult == "AUTHFAILED")2024 parsed = tr("<p>Invalid e-mail address or password specified.</p>");2025 2026 message(pParent, Error,2027 tr("<p>Failed to register the VirtualBox product.</p><p>%1</p>")2028 .arg(parsed.isNull() ? strResult : parsed));2029 }2030 }2031 2032 1992 void UIMessageCenter::showUpdateSuccess(const QString &strVersion, const QString &strLink) 2033 1993 { -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.h
r43138 r44453 330 330 bool proposeInstallExtentionPack(const QString &strExtPackName, const QString &strFrom, const QString &strTo); 331 331 void warnAboutExtentionPackCantBeSaved(const QString &strExtPackName, const QString &strFrom, const QString &strTo); 332 333 void cannotConnectRegister(QWidget *pParent,334 const QString &strUrl,335 const QString &strReason);336 void showRegisterResult(QWidget *pParent,337 const QString &strResult);338 332 339 333 void showUpdateSuccess(const QString &strVersion, const QString &strLink); -
trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp
r44436 r44453 85 85 # include "VBoxFBOverlay.h" 86 86 #endif /* VBOX_WITH_VIDEOHWACCEL */ 87 88 #ifdef VBOX_WITH_REGISTRATION89 # include "UIRegistrationWzd.h"90 #endif /* VBOX_WITH_REGISTRATION */91 87 92 88 #ifdef VBOX_GUI_WITH_SYSTRAY … … 291 287 , m_pVirtualMachine(0) 292 288 , mMainWindow (NULL) 293 #ifdef VBOX_WITH_REGISTRATION294 , mRegDlg (NULL)295 #endif296 289 #ifdef VBOX_GUI_WITH_SYSTRAY 297 290 , mIsTrayMenu (false) … … 4010 4003 4011 4004 return result; 4012 }4013 4014 /**4015 * Shows the VirtualBox registration dialog.4016 *4017 * @note that this method is not part of UIMessageCenter (like e.g.4018 * UIMessageCenter::sltShowHelpAboutDialog()) because it is tied to4019 * VBoxCallback::OnExtraDataChange() handling performed by VBoxGlobal.4020 *4021 * @param aForce4022 */4023 void VBoxGlobal::showRegistrationDialog (bool aForce)4024 {4025 NOREF(aForce);4026 #ifdef VBOX_WITH_REGISTRATION4027 if (!aForce && !UIRegistrationWzd::hasToBeShown())4028 return;4029 4030 if (mRegDlg)4031 {4032 /* Show the already opened registration dialog */4033 mRegDlg->setWindowState (mRegDlg->windowState() & ~Qt::WindowMinimized);4034 mRegDlg->raise();4035 mRegDlg->activateWindow();4036 }4037 else4038 {4039 /* Store the ID of the main window to ensure that only one4040 * registration dialog is shown at a time. Due to manipulations with4041 * OnExtraDataCanChange() and OnExtraDataChange() signals, this extra4042 * data item acts like an inter-process mutex, so the first process4043 * that attempts to set it will win, the rest will get a failure from4044 * the SetExtraData() call. */4045 mVBox.SetExtraData (GUI_RegistrationDlgWinID,4046 QString ("%1").arg ((qulonglong) mMainWindow->winId()));4047 4048 if (mVBox.isOk())4049 {4050 /* We've got the "mutex", create a new registration dialog */4051 UIRegistrationWzd *dlg = new UIRegistrationWzd (&mRegDlg);4052 dlg->setAttribute (Qt::WA_DeleteOnClose);4053 Assert (dlg == mRegDlg);4054 mRegDlg->show();4055 }4056 }4057 #endif4058 4005 } 4059 4006 … … 4716 4663 } 4717 4664 4718 #ifdef VBOX_WITH_REGISTRATION4719 if (mRegDlg)4720 mRegDlg->close();4721 #endif4722 4723 4665 if (mSelectorWnd) 4724 4666 delete mSelectorWnd; -
trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.h
r43104 r44453 56 56 57 57 class UISelectorWindow; 58 class UIRegistrationWzd;59 58 class VBoxUpdateDlg; 60 59 … … 433 432 bool openURL (const QString &aURL); 434 433 435 void showRegistrationDialog (bool aForce = true);436 434 void sltGUILanguageChange(QString strLang); 437 435 void sltProcessGlobalSettingChange(); … … 464 462 UIMachine *m_pVirtualMachine; 465 463 QWidget* mMainWindow; 466 467 #ifdef VBOX_WITH_REGISTRATION468 UIRegistrationWzd *mRegDlg;469 #endif470 464 471 465 QString vmUuid; -
trunk/src/VBox/Frontends/VirtualBox/src/main.cpp
r42665 r44453 523 523 #endif 524 524 vboxGlobal().selectorWnd().show(); 525 #ifdef VBOX_WITH_REGISTRATION_REQUEST526 vboxGlobal().showRegistrationDialog (false /* aForce */);527 #endif528 525 #ifdef VBOX_GUI_WITH_SYSTRAY 529 526 } -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineMenuBar.cpp
r43622 r44453 278 278 279 279 pMenu->addAction(gActionPool->action(UIActionIndex_Simple_NetworkAccessManager)); 280 #ifdef VBOX_WITH_REGISTRATION281 pMenu->addAction(gActionPool->action(UIActionIndex_Simple_Register));282 #endif283 280 284 281 #ifndef Q_WS_MAC … … 310 307 VBoxGlobal::connect(gActionPool->action(UIActionIndex_Simple_NetworkAccessManager), SIGNAL(triggered()), 311 308 gNetworkManager, SLOT(show())); 312 #ifdef VBOX_WITH_REGISTRATION313 VBoxGlobal::connect(gActionPool->action(UIActionIndex_Simple_Register), SIGNAL(triggered()),314 &vboxGlobal(), SLOT(showRegistrationDialog()));315 VBoxGlobal::connect(gEDataEvents, SIGNAL(sigCanShowRegistrationDlg(bool)),316 gActionPool->action(UIActionIndex_Simple_Register), SLOT(setEnabled(bool)));317 #endif /* VBOX_WITH_REGISTRATION */318 309 319 310 m_fIsFirstTime = false; -
trunk/src/VBox/Frontends/VirtualBox/src/selector/UISelectorWindow.cpp
r44434 r44453 1296 1296 m_pNetworkAccessManager = gActionPool->action(UIActionIndex_Simple_NetworkAccessManager); 1297 1297 pMenu->addAction(m_pNetworkAccessManager); 1298 #ifdef VBOX_WITH_REGISTRATION1299 m_pRegisterAction = gActionPool->action(UIActionIndex_Simple_Register);1300 pMenu->addAction(m_pRegisterAction);1301 #endif /* VBOX_WITH_REGISTRATION */1302 1298 m_pUpdateAction = gActionPool->action(UIActionIndex_Simple_CheckForUpdates); 1303 1299 pMenu->addAction(m_pUpdateAction); … … 1434 1430 connect(m_pResetWarningsAction, SIGNAL(triggered()), &msgCenter(), SLOT(sltResetSuppressedMessages())); 1435 1431 connect(m_pNetworkAccessManager, SIGNAL(triggered()), gNetworkManager, SLOT(show())); 1436 #ifdef VBOX_WITH_REGISTRATION1437 connect(m_pRegisterAction, SIGNAL(triggered()), &vboxGlobal(), SLOT(showRegistrationDialog()));1438 connect(gEDataEvents, SIGNAL(sigCanShowRegistrationDlg(bool)), m_pRegisterAction, SLOT(setEnabled(bool)));1439 #endif /* VBOX_WITH_REGISTRATION */1440 1432 connect(m_pUpdateAction, SIGNAL(triggered()), gUpdateManager, SLOT(sltForceCheck())); 1441 1433 connect(m_pAboutAction, SIGNAL(triggered()), &msgCenter(), SLOT(sltShowHelpAboutDialog()));
Note:
See TracChangeset
for help on using the changeset viewer.