Changeset 5148 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Oct 3, 2007 12:05:25 PM (17 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/include/VBoxConsoleWnd.h
r5140 r5148 186 186 void onExitFullscreen(); 187 187 188 void onToggleRegMenuItem (bool aEnable); 189 188 190 private: 189 191 -
trunk/src/VBox/Frontends/VirtualBox/include/VBoxDefs.h
r5128 r5148 133 133 MachineRegisteredEventType, 134 134 ShowRegDlgEventType, 135 ToggleRegMenuItemEvent, 135 136 SessionStateChangeEventType, 136 137 SnapshotEventType, -
trunk/src/VBox/Frontends/VirtualBox/include/VBoxGlobal.h
r5139 r5148 108 108 }; 109 109 110 class VBoxToggleRegMenuItem : public QEvent 111 { 112 public: 113 VBoxToggleRegMenuItem (bool aEnable) 114 : QEvent ((QEvent::Type) VBoxDefs::ToggleRegMenuItemEvent) 115 , mEnable (aEnable) 116 {} 117 118 bool mEnable; 119 }; 120 110 121 class VBoxSessionStateChangeEvent : public QEvent 111 122 { … … 376 387 bool showVirtualBoxLicense(); 377 388 #endif 378 379 void checkRegistration();380 389 381 390 CSession openSession (const QUuid &id); … … 507 516 void sessionStateChanged (const VBoxSessionStateChangeEvent &e); 508 517 void snapshotChanged (const VBoxSnapshotEvent &e); 518 void toggleRegMenuItem (bool aEnable); 509 519 510 520 public slots: … … 512 522 bool openURL (const QString &aURL); 513 523 514 void showRegistrationDialog();524 void checkRegistration (bool aForced = true); 515 525 516 526 protected: … … 518 528 bool event (QEvent *e); 519 529 bool eventFilter (QObject *, QEvent *); 530 531 void showRegistrationDialog(); 520 532 521 533 private: -
trunk/src/VBox/Frontends/VirtualBox/include/VBoxSelectorWnd.h
r5140 r5148 103 103 void snapshotChanged (const VBoxSnapshotEvent &e); 104 104 105 void onToggleRegMenuItem (bool aEnable); 106 105 107 private: 106 108 -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxConsoleWnd.cpp
r5140 r5148 378 378 #ifdef VBOX_WITH_REGISTRATION 379 379 helpRegisterAction->addTo (helpMenu); 380 helpRegisterAction->setEnabled (vboxGlobal().virtualBox(). 381 GetExtraData (VBoxDefs::GUI_RegistrationDlgWinID).isEmpty()); 380 382 #endif 381 383 helpAboutAction->addTo( helpMenu ); … … 530 532 &vboxProblem(), SLOT (showHelpWebDialog())); 531 533 connect (helpRegisterAction, SIGNAL (activated()), 532 &vboxGlobal(), SLOT (showRegistrationDialog())); 534 &vboxGlobal(), SLOT (checkRegistration())); 535 connect (&vboxGlobal(), SIGNAL (toggleRegMenuItem (bool)), 536 this, SLOT (onToggleRegMenuItem (bool))); 533 537 connect (helpAboutAction, SIGNAL (activated()), 534 538 &vboxProblem(), SLOT (showHelpAboutDialog())); … … 1018 1022 console->setIgnoreMainwndResize (false); 1019 1023 console->normalizeGeometry (true /* adjustPosition */); 1024 } 1025 1026 void VBoxConsoleWnd::onToggleRegMenuItem (bool aEnable) 1027 { 1028 helpRegisterAction->setEnabled (aEnable); 1020 1029 } 1021 1030 -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxGlobal.cpp
r5139 r5148 131 131 public: 132 132 133 VBoxCallback (VBoxGlobal &aGlobal) : global (aGlobal) 133 VBoxCallback (VBoxGlobal &aGlobal) : global (aGlobal), mShowRegDlg (false) 134 134 { 135 135 #if defined (Q_OS_WIN32) … … 209 209 if (sKey.startsWith ("GUI/")) 210 210 { 211 if (!sVal.isEmpty() && 212 sKey == VBoxDefs::GUI_RegistrationDlgWinID) 211 if (sKey == VBoxDefs::GUI_RegistrationDlgWinID) 213 212 { 214 if (sVal == QString ("%1") 215 .arg ((long)qApp->mainWidget()->winId())) 213 if (mShowRegDlg) 216 214 { 217 *allowChange = TRUE; 218 QApplication::postEvent (&global, new VBoxShowRegDlgEvent()); 215 if (sVal.isEmpty() || 216 sVal == QString ("%1").arg ((long)qApp->mainWidget()->winId())) 217 *allowChange = TRUE; 218 else 219 *allowChange = FALSE; 219 220 } 220 221 else 221 *allowChange = FALSE;222 *allowChange = TRUE; 222 223 return S_OK; 223 224 } … … 256 257 if (sKey.startsWith ("GUI/")) 257 258 { 259 if (sKey == VBoxDefs::GUI_RegistrationDlgWinID) 260 { 261 if (sVal.isEmpty()) 262 { 263 mShowRegDlg = false; 264 QApplication::postEvent (&global, new VBoxToggleRegMenuItem (true)); 265 } 266 else if (sVal == QString ("%1").arg ((long)qApp->mainWidget()->winId())) 267 { 268 mShowRegDlg = true; 269 QApplication::postEvent (&global, new VBoxToggleRegMenuItem (true)); 270 QApplication::postEvent (&global, new VBoxShowRegDlgEvent()); 271 } 272 else 273 QApplication::postEvent (&global, new VBoxToggleRegMenuItem (false)); 274 } 275 258 276 mutex.lock(); 259 277 global.gset.setPublicProperty (sKey, sVal); … … 329 347 /** protects #OnExtraDataChange() */ 330 348 QMutex mutex; 349 350 bool mShowRegDlg; 331 351 332 352 #if defined (Q_OS_WIN32) … … 1650 1670 #endif 1651 1671 1652 void VBoxGlobal::checkRegistration ()1672 void VBoxGlobal::checkRegistration (bool aForced) 1653 1673 { 1654 1674 #ifdef VBOX_WITH_REGISTRATION 1655 if (! VBoxRegistrationDlg::hasToBeShown())1675 if (!aForced && !VBoxRegistrationDlg::hasToBeShown()) 1656 1676 return; 1657 1677 1658 /* Store the ID of the main window to ensure that only one registration1659 * dialog is shown at a time. This operation will implicitly cause the1660 * dialog to show if it's not already shown. */1661 virtualBox().SetExtraData (VBoxDefs::GUI_RegistrationDlgWinID,1662 QString ("%1").arg ((long) qApp->mainWidget()->winId()));1663 #endif1664 }1665 1666 void VBoxGlobal::showRegistrationDialog()1667 {1668 #ifdef VBOX_WITH_REGISTRATION1669 1678 if (mRegDlg) 1670 1679 { … … 1674 1683 mRegDlg->setActiveWindow(); 1675 1684 } 1685 /* Store the ID of the main window to ensure that only one registration 1686 * dialog is shown at a time. This operation will implicitly cause the 1687 * dialog to show if it's not already shown. */ 1676 1688 else 1689 virtualBox().SetExtraData (VBoxDefs::GUI_RegistrationDlgWinID, 1690 QString ("%1").arg ((long) qApp->mainWidget()->winId())); 1691 #endif 1692 } 1693 1694 void VBoxGlobal::showRegistrationDialog() 1695 { 1696 #ifdef VBOX_WITH_REGISTRATION 1697 if (!mRegDlg) 1677 1698 { 1678 1699 /* Create new registration dialog */ … … 3496 3517 return true; 3497 3518 } 3519 case VBoxDefs::ToggleRegMenuItemEvent: 3520 { 3521 emit toggleRegMenuItem (((VBoxToggleRegMenuItem *)e)->mEnable); 3522 return true; 3523 } 3498 3524 case VBoxDefs::SessionStateChangeEventType: 3499 3525 { -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxSelectorWnd.cpp
r5140 r5148 530 530 #ifdef VBOX_WITH_REGISTRATION 531 531 helpRegisterAction->addTo (helpMenu); 532 helpRegisterAction->setEnabled (vboxGlobal().virtualBox(). 533 GetExtraData (VBoxDefs::GUI_RegistrationDlgWinID).isEmpty()); 532 534 #endif 533 535 helpAboutAction->addTo (helpMenu); … … 591 593 &vboxProblem(), SLOT (showHelpWebDialog())); 592 594 connect (helpRegisterAction, SIGNAL (activated()), 593 &vboxGlobal(), SLOT (showRegistrationDialog())); 595 &vboxGlobal(), SLOT (checkRegistration())); 596 connect (&vboxGlobal(), SIGNAL (toggleRegMenuItem (bool)), 597 this, SLOT (onToggleRegMenuItem (bool))); 594 598 connect (helpAboutAction, SIGNAL (activated()), 595 599 &vboxProblem(), SLOT (showHelpAboutDialog())); … … 1386 1390 } 1387 1391 1392 void VBoxSelectorWnd::onToggleRegMenuItem (bool aEnable) 1393 { 1394 helpRegisterAction->setEnabled (aEnable); 1395 } 1396 1388 1397 #include "VBoxSelectorWnd.moc" -
trunk/src/VBox/Frontends/VirtualBox/src/main.cpp
r5139 r5148 234 234 if (vboxGlobal().startMachine (vboxGlobal().managedVMUuid())) 235 235 { 236 vboxGlobal().checkRegistration ();236 vboxGlobal().checkRegistration (false); 237 237 rc = a.exec(); 238 238 } … … 245 245 { 246 246 a.setMainWidget (&vboxGlobal().selectorWnd()); 247 vboxGlobal().checkRegistration ();247 vboxGlobal().checkRegistration (false); 248 248 vboxGlobal().selectorWnd().show(); 249 249 vboxGlobal().startEnumeratingMedia();
Note:
See TracChangeset
for help on using the changeset viewer.