Changeset 32759 in vbox
- Timestamp:
- Sep 24, 2010 1:20:18 PM (14 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/selector
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/selector/VBoxSelectorWnd.cpp
r32758 r32759 76 76 */ 77 77 VBoxSelectorWnd:: 78 VBoxSelectorWnd 79 80 : QIWithRetranslateUI2<QMainWindow> 81 , mDoneInaccessibleWarningOnce 78 VBoxSelectorWnd(VBoxSelectorWnd **aSelf, QWidget* aParent, 79 Qt::WindowFlags aFlags /* = Qt::Window */) 80 : QIWithRetranslateUI2<QMainWindow>(aParent, aFlags) 81 , mDoneInaccessibleWarningOnce(false) 82 82 { 83 83 VBoxGlobalSettings settings = vboxGlobal().settings(); … … 91 91 92 92 #if defined (Q_WS_MAC) && (QT_VERSION < 0x040402) 93 qApp->installEventFilter 93 qApp->installEventFilter(this); 94 94 #endif /* defined (Q_WS_MAC) && (QT_VERSION < 0x040402) */ 95 95 … … 97 97 /* The application icon. On Win32, it's built-in to the executable. On Mac 98 98 * OS X the icon referenced in info.plist is used. */ 99 setWindowIcon (QIcon(":/VirtualBox_48px.png"));99 setWindowIcon(QIcon(":/VirtualBox_48px.png")); 100 100 #endif 101 101 102 102 /* actions */ 103 103 104 mFileMediaMgrAction = new QAction 104 mFileMediaMgrAction = new QAction(this); 105 105 mFileMediaMgrAction->setIcon(UIIconPool::iconSet(":/diskimage_16px.png")); 106 106 107 mFileApplianceImportAction = new QAction 107 mFileApplianceImportAction = new QAction(this); 108 108 mFileApplianceImportAction->setIcon(UIIconPool::iconSet(":/import_16px.png")); 109 109 110 mFileApplianceExportAction = new QAction 110 mFileApplianceExportAction = new QAction(this); 111 111 mFileApplianceExportAction->setIcon(UIIconPool::iconSet(":/export_16px.png")); 112 112 113 113 mFileSettingsAction = new QAction(this); 114 mFileSettingsAction->setMenuRole 114 mFileSettingsAction->setMenuRole(QAction::PreferencesRole); 115 115 mFileSettingsAction->setIcon(UIIconPool::iconSet(":/global_settings_16px.png")); 116 mFileExitAction = new QAction 117 mFileExitAction->setMenuRole 116 mFileExitAction = new QAction(this); 117 mFileExitAction->setMenuRole(QAction::QuitRole); 118 118 mFileExitAction->setIcon(UIIconPool::iconSet(":/exit_16px.png")); 119 119 120 mVmNewAction = new QAction 120 mVmNewAction = new QAction(this); 121 121 mVmNewAction->setIcon(UIIconPool::iconSetFull( 122 QSize (32, 32), QSize(16, 16),122 QSize(32, 32), QSize(16, 16), 123 123 ":/vm_new_32px.png", ":/new_16px.png")); 124 mVmConfigAction = new QAction 124 mVmConfigAction = new QAction(this); 125 125 mVmConfigAction->setIcon(UIIconPool::iconSetFull( 126 QSize (32, 32), QSize(16, 16),126 QSize(32, 32), QSize(16, 16), 127 127 ":/vm_settings_32px.png", ":/settings_16px.png", 128 128 ":/vm_settings_disabled_32px.png", ":/settings_dis_16px.png")); 129 mVmDeleteAction = new QAction 129 mVmDeleteAction = new QAction(this); 130 130 mVmDeleteAction->setIcon(UIIconPool::iconSetFull( 131 QSize (32, 32), QSize(16, 16),131 QSize(32, 32), QSize(16, 16), 132 132 ":/vm_delete_32px.png", ":/delete_16px.png", 133 133 ":/vm_delete_disabled_32px.png", ":/delete_dis_16px.png")); 134 mVmStartAction = new QAction 134 mVmStartAction = new QAction(this); 135 135 mVmStartAction->setIcon(UIIconPool::iconSetFull( 136 QSize (32, 32), QSize(16, 16),136 QSize(32, 32), QSize(16, 16), 137 137 ":/vm_start_32px.png", ":/start_16px.png", 138 138 ":/vm_start_disabled_32px.png", ":/start_dis_16px.png")); 139 mVmDiscardAction = new QAction 139 mVmDiscardAction = new QAction(this); 140 140 mVmDiscardAction->setIcon(UIIconPool::iconSetFull( 141 QSize (32, 32), QSize(16, 16),141 QSize(32, 32), QSize(16, 16), 142 142 ":/vm_discard_32px.png", ":/discard_16px.png", 143 143 ":/vm_discard_disabled_32px.png", ":/discard_dis_16px.png")); 144 mVmPauseAction = new QAction 145 mVmPauseAction->setCheckable 144 mVmPauseAction = new QAction(this); 145 mVmPauseAction->setCheckable(true); 146 146 mVmPauseAction->setIcon(UIIconPool::iconSetFull( 147 QSize (32, 32), QSize(16, 16),147 QSize(32, 32), QSize(16, 16), 148 148 ":/vm_pause_32px.png", ":/pause_16px.png", 149 149 ":/vm_pause_disabled_32px.png", ":/pause_disabled_16px.png")); 150 mVmRefreshAction = new QAction 150 mVmRefreshAction = new QAction(this); 151 151 mVmRefreshAction->setIcon(UIIconPool::iconSetFull( 152 QSize (32, 32), QSize(16, 16),152 QSize(32, 32), QSize(16, 16), 153 153 ":/refresh_32px.png", ":/refresh_16px.png", 154 154 ":/refresh_disabled_32px.png", ":/refresh_disabled_16px.png")); 155 mVmShowLogsAction = new QAction 155 mVmShowLogsAction = new QAction(this); 156 156 mVmShowLogsAction->setIcon(UIIconPool::iconSetFull( 157 QSize (32, 32), QSize(16, 16),157 QSize(32, 32), QSize(16, 16), 158 158 ":/vm_show_logs_32px.png", ":/show_logs_16px.png", 159 159 ":/vm_show_logs_disabled_32px.png", ":/show_logs_disabled_16px.png")); 160 160 161 mHelpActions.setup 161 mHelpActions.setup(this); 162 162 163 163 /* VM list toolbar */ … … 181 181 /* Make non-possible to activate list elements by single click, 182 182 * this hack should disable the current possibility to do it if present */ 183 if (mVMListView->style()->styleHint 184 mVMListView->setStyleSheet 183 if (mVMListView->style()->styleHint(QStyle::SH_ItemView_ActivateItemOnSingleClick, 0, mVMListView)) 184 mVMListView->setStyleSheet("activate-on-singleclick : 0"); 185 185 186 186 m_pSplitter = new QISplitter(this); … … 190 190 #if MAC_LEOPARD_STYLE 191 191 /* Enable unified toolbars on Mac OS X. Available on Qt >= 4.3 */ 192 addToolBar 192 addToolBar(mVMToolBar); 193 193 mVMToolBar->setMacToolbar(); 194 194 /* Central widget @ horizontal layout */ 195 195 setCentralWidget(m_pSplitter); 196 m_pSplitter->addWidget 196 m_pSplitter->addWidget(mVMListView); 197 197 #else /* MAC_LEOPARD_STYLE */ 198 198 // mVMToolBar->setContentsMargins(5, 5, 0, 0); 199 // addToolBar 200 // m_pSplitter->addWidget 199 // addToolBar(mVMToolBar); 200 // m_pSplitter->addWidget(mVMListView); 201 201 QWidget *pLeftWidget = new QWidget(this); 202 202 QVBoxLayout *pLeftVLayout = new QVBoxLayout(pLeftWidget); … … 220 220 /* add actions to the toolbar */ 221 221 222 mVMToolBar->setIconSize (QSize(32, 32));223 mVMToolBar->setToolButtonStyle 224 // mVMToolBar->setSizePolicy 225 226 mVMToolBar->addAction 227 mVMToolBar->addAction 222 mVMToolBar->setIconSize(QSize(32, 32)); 223 mVMToolBar->setToolButtonStyle(Qt::ToolButtonTextUnderIcon); 224 // mVMToolBar->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Preferred); 225 226 mVMToolBar->addAction(mVmNewAction); 227 mVMToolBar->addAction(mVmConfigAction); 228 228 #if 0 /* delete action is really rare */ 229 mVMToolBar->addAction 229 mVMToolBar->addAction(mVmDeleteAction); 230 230 #endif 231 mVMToolBar->addAction 232 mVMToolBar->addAction 231 mVMToolBar->addAction(mVmStartAction); 232 mVMToolBar->addAction(mVmDiscardAction); 233 233 234 234 /* VM tab widget containing details and snapshots tabs */ … … 240 240 pVBox->addWidget(m_pVMDesktop); 241 241 242 m_pSplitter->addWidget 242 m_pSplitter->addWidget(w); 243 243 244 244 /* Set the initial distribution. The right site is bigger. */ … … 252 252 253 253 /* add actions to menubar */ 254 mFileMenu = menuBar()->addMenu 255 mFileMenu->addAction 256 mFileMenu->addAction 257 mFileMenu->addAction 254 mFileMenu = menuBar()->addMenu(QString::null); 255 mFileMenu->addAction(mFileMediaMgrAction); 256 mFileMenu->addAction(mFileApplianceImportAction); 257 mFileMenu->addAction(mFileApplianceExportAction); 258 258 #ifndef Q_WS_MAC 259 259 mFileMenu->addSeparator(); 260 260 #endif /* Q_WS_MAC */ 261 mFileMenu->addAction 261 mFileMenu->addAction(mFileSettingsAction); 262 262 #ifndef Q_WS_MAC 263 263 mFileMenu->addSeparator(); 264 264 #endif /* Q_WS_MAC */ 265 mFileMenu->addAction 266 267 mVMMenu = menuBar()->addMenu 268 mVMMenu->addAction 269 mVMMenu->addAction 270 mVMMenu->addAction 265 mFileMenu->addAction(mFileExitAction); 266 267 mVMMenu = menuBar()->addMenu(QString::null); 268 mVMMenu->addAction(mVmNewAction); 269 mVMMenu->addAction(mVmConfigAction); 270 mVMMenu->addAction(mVmDeleteAction); 271 271 mVMMenu->addSeparator(); 272 mVMMenu->addAction 273 mVMMenu->addAction 274 mVMMenu->addAction 272 mVMMenu->addAction(mVmStartAction); 273 mVMMenu->addAction(mVmDiscardAction); 274 mVMMenu->addAction(mVmPauseAction); 275 275 mVMMenu->addSeparator(); 276 mVMMenu->addAction 277 mVMMenu->addAction 278 279 mVMCtxtMenu = new QMenu 280 mVMCtxtMenu->addAction 281 mVMCtxtMenu->addAction 276 mVMMenu->addAction(mVmRefreshAction); 277 mVMMenu->addAction(mVmShowLogsAction); 278 279 mVMCtxtMenu = new QMenu(this); 280 mVMCtxtMenu->addAction(mVmConfigAction); 281 mVMCtxtMenu->addAction(mVmDeleteAction); 282 282 mVMCtxtMenu->addSeparator(); 283 mVMCtxtMenu->addAction 284 mVMCtxtMenu->addAction 285 mVMCtxtMenu->addAction 283 mVMCtxtMenu->addAction(mVmStartAction); 284 mVMCtxtMenu->addAction(mVmDiscardAction); 285 mVMCtxtMenu->addAction(mVmPauseAction); 286 286 mVMCtxtMenu->addSeparator(); 287 mVMCtxtMenu->addAction 288 mVMCtxtMenu->addAction 287 mVMCtxtMenu->addAction(mVmRefreshAction); 288 mVMCtxtMenu->addAction(mVmShowLogsAction); 289 289 290 290 /* Make sure every status bar hint from the context menu is cleared when 291 291 * the menu is closed. */ 292 connect 293 294 295 mHelpMenu = menuBar()->addMenu 296 mHelpActions.addTo 292 connect(mVMCtxtMenu, SIGNAL(aboutToHide()), 293 statusBar(), SLOT(clearMessage())); 294 295 mHelpMenu = menuBar()->addMenu(QString::null); 296 mHelpActions.addTo(mHelpMenu); 297 297 298 298 #ifdef VBOX_GUI_WITH_SYSTRAY 299 mTrayIcon = new VBoxTrayIcon 300 Assert 301 connect (mTrayIcon, SIGNAL (activated(QSystemTrayIcon::ActivationReason)),302 this, SLOT (trayIconActivated(QSystemTrayIcon::ActivationReason)));299 mTrayIcon = new VBoxTrayIcon(this, mVMModel); 300 Assert(mTrayIcon); 301 connect(mTrayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), 302 this, SLOT(trayIconActivated(QSystemTrayIcon::ActivationReason))); 303 303 #endif 304 304 … … 308 308 /* Restore the position of the window */ 309 309 { 310 QString winPos = vbox.GetExtraData 310 QString winPos = vbox.GetExtraData(VBoxDefs::GUI_LastWindowPosition); 311 311 312 312 bool ok = false, max = false; 313 313 int x = 0, y = 0, w = 0, h = 0; 314 x = winPos.section (',', 0, 0).toInt(&ok);314 x = winPos.section(',', 0, 0).toInt(&ok); 315 315 if (ok) 316 y = winPos.section (',', 1, 1).toInt(&ok);316 y = winPos.section(',', 1, 1).toInt(&ok); 317 317 if (ok) 318 w = winPos.section (',', 2, 2).toInt(&ok);318 w = winPos.section(',', 2, 2).toInt(&ok); 319 319 if (ok) 320 h = winPos.section (',', 3, 3).toInt(&ok);320 h = winPos.section(',', 3, 3).toInt(&ok); 321 321 if (ok) 322 max = winPos.section 323 324 QRect ar = ok ? QApplication::desktop()->availableGeometry (QPoint(x, y)) :325 QApplication::desktop()->availableGeometry 322 max = winPos.section(',', 4, 4) == VBoxDefs::GUI_LastWindowState_Max; 323 324 QRect ar = ok ? QApplication::desktop()->availableGeometry(QPoint(x, y)) : 325 QApplication::desktop()->availableGeometry(this); 326 326 327 327 if (ok /* previous parameters were read correctly */ … … 329 329 && (x + w > ar.left()) && (x < ar.right()) /* & horizontal bounds */) 330 330 { 331 mNormalGeo.moveTo 332 mNormalGeo.setSize (QSize (w, h).expandedTo(minimumSizeHint())333 .boundedTo(ar.size()));334 setGeometry 331 mNormalGeo.moveTo(x, y); 332 mNormalGeo.setSize(QSize(w, h).expandedTo(minimumSizeHint()) 333 .boundedTo(ar.size())); 334 setGeometry(mNormalGeo); 335 335 if (max) /* maximize if needed */ 336 336 showMaximized(); … … 338 338 else 339 339 { 340 mNormalGeo.setSize (QSize (770, 550).expandedTo(minimumSizeHint())341 .boundedTo(ar.size()));342 mNormalGeo.moveCenter 343 setGeometry 340 mNormalGeo.setSize(QSize(770, 550).expandedTo(minimumSizeHint()) 341 .boundedTo(ar.size())); 342 mNormalGeo.moveCenter(ar.center()); 343 setGeometry(mNormalGeo); 344 344 } 345 345 } … … 349 349 350 350 /* Reset to the first item */ 351 mVMListView->selectItemByRow 351 mVMListView->selectItemByRow(0); 352 352 353 353 /* restore the position of vm selector */ 354 354 { 355 QString prevVMId = vbox.GetExtraData 356 357 mVMListView->selectItemById 355 QString prevVMId = vbox.GetExtraData(VBoxDefs::GUI_LastVMSelected); 356 357 mVMListView->selectItemById(prevVMId); 358 358 } 359 359 … … 383 383 384 384 /* signals and slots connections */ 385 connect (mFileMediaMgrAction, SIGNAL (triggered()), this, SLOT(fileMediaMgr()));386 connect (mFileApplianceImportAction, SIGNAL (triggered()), this, SLOT(fileImportAppliance()));387 connect (mFileApplianceExportAction, SIGNAL (triggered()), this, SLOT(fileExportAppliance()));388 connect (mFileSettingsAction, SIGNAL (triggered()), this, SLOT(fileSettings()));389 connect (mFileExitAction, SIGNAL (triggered()), this, SLOT(fileExit()));390 connect (mVmNewAction, SIGNAL (triggered()), this, SLOT(vmNew()));391 392 connect (mVmConfigAction, SIGNAL (triggered()), this, SLOT(vmSettings()));393 connect (mVmDeleteAction, SIGNAL (triggered()), this, SLOT(vmDelete()));394 connect (mVmStartAction, SIGNAL (triggered()), this, SLOT(vmStart()));395 connect (mVmDiscardAction, SIGNAL (triggered()), this, SLOT(vmDiscard()));396 connect (mVmPauseAction, SIGNAL (toggled (bool)), this, SLOT (vmPause(bool)));397 connect (mVmRefreshAction, SIGNAL (triggered()), this, SLOT(vmRefresh()));398 connect (mVmShowLogsAction, SIGNAL (triggered()), this, SLOT(vmShowLogs()));399 400 connect (mVMListView, SIGNAL(currentChanged()),401 this, SLOT(vmListViewCurrentChanged()));402 connect (mVMListView, SIGNAL(activated()),403 this, SLOT(vmStart()));404 connect (mVMListView, SIGNAL (customContextMenuRequested(const QPoint &)),405 this, SLOT (showContextMenu(const QPoint &)));406 407 connect 408 385 connect(mFileMediaMgrAction, SIGNAL(triggered()), this, SLOT(fileMediaMgr())); 386 connect(mFileApplianceImportAction, SIGNAL(triggered()), this, SLOT(fileImportAppliance())); 387 connect(mFileApplianceExportAction, SIGNAL(triggered()), this, SLOT(fileExportAppliance())); 388 connect(mFileSettingsAction, SIGNAL(triggered()), this, SLOT(fileSettings())); 389 connect(mFileExitAction, SIGNAL(triggered()), this, SLOT(fileExit())); 390 connect(mVmNewAction, SIGNAL(triggered()), this, SLOT(vmNew())); 391 392 connect(mVmConfigAction, SIGNAL(triggered()), this, SLOT(vmSettings())); 393 connect(mVmDeleteAction, SIGNAL(triggered()), this, SLOT(vmDelete())); 394 connect(mVmStartAction, SIGNAL(triggered()), this, SLOT(vmStart())); 395 connect(mVmDiscardAction, SIGNAL(triggered()), this, SLOT(vmDiscard())); 396 connect(mVmPauseAction, SIGNAL(toggled(bool)), this, SLOT(vmPause(bool))); 397 connect(mVmRefreshAction, SIGNAL(triggered()), this, SLOT(vmRefresh())); 398 connect(mVmShowLogsAction, SIGNAL(triggered()), this, SLOT(vmShowLogs())); 399 400 connect(mVMListView, SIGNAL(currentChanged()), 401 this, SLOT(vmListViewCurrentChanged())); 402 connect(mVMListView, SIGNAL(activated()), 403 this, SLOT(vmStart())); 404 connect(mVMListView, SIGNAL(customContextMenuRequested(const QPoint &)), 405 this, SLOT(showContextMenu(const QPoint &))); 406 407 connect(m_pVMDesktop, SIGNAL(linkClicked(const QString &)), 408 this, SLOT(vmSettings(const QString &))); 409 409 410 410 /* listen to media enumeration signals */ 411 connect (&vboxGlobal(), SIGNAL(mediumEnumStarted()),412 this, SLOT(mediumEnumStarted()));413 connect (&vboxGlobal(), SIGNAL (mediumEnumFinished(const VBoxMediaList &)),414 this, SLOT (mediumEnumFinished(const VBoxMediaList &)));411 connect(&vboxGlobal(), SIGNAL(mediumEnumStarted()), 412 this, SLOT(mediumEnumStarted())); 413 connect(&vboxGlobal(), SIGNAL(mediumEnumFinished(const VBoxMediaList &)), 414 this, SLOT(mediumEnumFinished(const VBoxMediaList &))); 415 415 416 416 /* connect VirtualBox events */ 417 connect 418 419 connect 420 421 connect 422 423 connect 424 425 connect 426 417 connect(gVBoxEvents, SIGNAL(sigMachineStateChange(QString, KMachineState)), 418 this, SLOT(machineStateChanged(QString, KMachineState))); 419 connect(gVBoxEvents, SIGNAL(sigMachineDataChange(QString)), 420 this, SLOT(machineDataChanged(QString))); 421 connect(gVBoxEvents, SIGNAL(sigMachineRegistered(QString, bool)), 422 this, SLOT(machineRegistered(QString, bool))); 423 connect(gVBoxEvents, SIGNAL(sigSessionStateChange(QString, KSessionState)), 424 this, SLOT(sessionStateChanged(QString, KSessionState))); 425 connect(gVBoxEvents, SIGNAL(sigSnapshotChange(QString, QString)), 426 this, SLOT(snapshotChanged(QString, QString))); 427 427 #ifdef VBOX_GUI_WITH_SYSTRAY 428 connect 429 430 connect 431 432 connect 433 434 connect 435 428 connect(gEDataEvents, SIGNAL(sigMainWindowCountChange(int)), 429 this, SLOT(mainWindowCountChanged(int))); 430 connect(gEDataEvents, SIGNAL(sigCanShowTrayIcon(bool)), 431 this, SLOT(trayIconCanShow(bool))); 432 connect(gEDataEvents, SIGNAL(sigTrayIconChange(bool)), 433 this, SLOT(trayIconChanged(bool))); 434 connect(&vboxGlobal(), SIGNAL(sigTrayIconShow(bool)), 435 this, SLOT(trayIconShow(bool))); 436 436 #endif 437 437 … … 453 453 { 454 454 int y = mNormalGeo.y(); 455 QString winPos = QString 456 .arg (mNormalGeo.x()).arg(y)457 .arg (mNormalGeo.width()).arg(mNormalGeo.height());455 QString winPos = QString("%1,%2,%3,%4") 456 .arg(mNormalGeo.x()).arg(y) 457 .arg(mNormalGeo.width()).arg(mNormalGeo.height()); 458 458 #ifdef Q_WS_MAC 459 459 ::darwinUnregisterForUnifiedToolbarContextMenuEvents(this); … … 462 462 if (isMaximized()) 463 463 #endif /* !Q_WS_MAC */ 464 winPos += QString (",%1").arg(VBoxDefs::GUI_LastWindowState_Max);465 466 vbox.SetExtraData 464 winPos += QString(",%1").arg(VBoxDefs::GUI_LastWindowState_Max); 465 466 vbox.SetExtraData(VBoxDefs::GUI_LastWindowPosition, winPos); 467 467 } 468 468 … … 471 471 UIVMItem *item = mVMListView->selectedItem(); 472 472 QString curVMId = item ? 473 QString 473 QString(item->id()) : 474 474 QString::null; 475 vbox.SetExtraData 475 vbox.SetExtraData(VBoxDefs::GUI_LastVMSelected, curVMId); 476 476 } 477 477 … … 497 497 void VBoxSelectorWnd::fileMediaMgr() 498 498 { 499 VBoxMediaManagerDlg::showModeless 499 VBoxMediaManagerDlg::showModeless(this); 500 500 } 501 501 502 502 void VBoxSelectorWnd::fileImportAppliance() 503 503 { 504 UIImportApplianceWzd wzd 504 UIImportApplianceWzd wzd(this); 505 505 506 506 wzd.exec(); … … 515 515 name = item->name(); 516 516 517 UIExportApplianceWzd wzd 517 UIExportApplianceWzd wzd(this, name); 518 518 519 519 wzd.exec(); … … 525 525 CSystemProperties props = vboxGlobal().virtualBox().GetSystemProperties(); 526 526 527 UISettingsDialog *dlg = new UIGLSettingsDlg 527 UISettingsDialog *dlg = new UIGLSettingsDlg(this); 528 528 dlg->getFrom(); 529 529 … … 540 540 * different to Qt3 where a *mainWidget* exists & if this going to close 541 541 * all other windows are closed automatically. We do the same below. */ 542 foreach 542 foreach(QWidget *widget, QApplication::topLevelWidgets()) 543 543 { 544 544 if (widget->isVisible() && … … 552 552 void VBoxSelectorWnd::vmNew() 553 553 { 554 UINewVMWzd wzd 554 UINewVMWzd wzd(this); 555 555 if (wzd.exec() == QDialog::Accepted) 556 556 { … … 559 559 /* wait until the list is updated by OnMachineRegistered() */ 560 560 QModelIndex index; 561 while 561 while(!index.isValid()) 562 562 { 563 563 qApp->processEvents(); 564 index = mVMModel->indexById 565 } 566 mVMListView->setCurrentIndex 564 index = mVMModel->indexById(m.GetId()); 565 } 566 mVMListView->setCurrentIndex(index); 567 567 } 568 568 } … … 571 571 * Opens the VM settings dialog. 572 572 */ 573 void VBoxSelectorWnd::vmSettings 574 575 573 void VBoxSelectorWnd::vmSettings(const QString &aCategory /* = QString::null */, 574 const QString &aControl /* = QString::null */, 575 const QString &aUuid /* = QString::null */) 576 576 { 577 577 if (!aCategory.isEmpty() && aCategory [0] != '#') 578 578 { 579 579 /* Assume it's a href from the Details HTML */ 580 vboxGlobal().openURL 580 vboxGlobal().openURL(aCategory); 581 581 return; 582 582 } … … 595 595 596 596 UIVMItem *item = aUuid.isNull() ? mVMListView->selectedItem() : 597 mVMModel->itemById 598 599 AssertMsgReturnVoid 597 mVMModel->itemById(aUuid); 598 599 AssertMsgReturnVoid(item, ("Item must be always selected here")); 600 600 601 601 // open a direct session to modify VM settings 602 602 QString id = item->id(); 603 CSession session = vboxGlobal().openSession 603 CSession session = vboxGlobal().openSession(id); 604 604 if (session.isNull()) 605 605 return; 606 606 607 607 CMachine m = session.GetMachine(); 608 AssertMsgReturn 609 610 UISettingsDialog *dlg = new UIVMSettingsDlg 608 AssertMsgReturn(!m.isNull(), ("Machine must not be null"), (void) 0); 609 610 UISettingsDialog *dlg = new UIVMSettingsDlg(this, m, strCategory, strControl); 611 611 dlg->getFrom(); 612 612 … … 619 619 if (m.isOk()) 620 620 { 621 if (oldName.compare 621 if (oldName.compare(m.GetName())) 622 622 mVMModel->sort(); 623 623 } 624 624 else 625 vboxProblem().cannotSaveMachineSettings 625 vboxProblem().cannotSaveMachineSettings(m); 626 626 627 627 /* To check use the result in future 628 * vboxProblem().cannotApplyMachineSettings 628 * vboxProblem().cannotApplyMachineSettings(m, res); */ 629 629 } 630 630 … … 636 636 } 637 637 638 void VBoxSelectorWnd::vmDelete 638 void VBoxSelectorWnd::vmDelete(const QString &aUuid /* = QString::null */) 639 639 { 640 640 UIVMItem *item = aUuid.isNull() ? mVMListView->selectedItem() : 641 mVMModel->itemById 642 643 AssertMsgReturnVoid 641 mVMModel->itemById(aUuid); 642 643 AssertMsgReturnVoid(item, ("Item must be always selected here")); 644 644 645 645 CMachine machine = item->machine(); … … 667 667 } 668 668 669 void VBoxSelectorWnd::vmStart 670 { 671 QUuid uuid 669 void VBoxSelectorWnd::vmStart(const QString &aUuid /* = QString::null */) 670 { 671 QUuid uuid(aUuid); 672 672 UIVMItem *item = uuid.isNull() ? mVMListView->selectedItem() : 673 mVMModel->itemById 674 675 AssertMsgReturnVoid 673 mVMModel->itemById(aUuid); 674 675 AssertMsgReturnVoid(item, ("Item must be always selected here")); 676 676 677 677 /* Are we called from the mVMListView's activated() signal? */ … … 684 684 } 685 685 686 AssertMsg 687 686 AssertMsg(!vboxGlobal().isVMConsoleProcess(), 687 ("Must NOT be a VM console process")); 688 688 689 689 /* just switch to the VM window if it already exists */ … … 694 694 } 695 695 696 AssertMsg 697 698 699 700 696 AssertMsg( item->machineState() == KMachineState_PoweredOff 697 || item->machineState() == KMachineState_Saved 698 || item->machineState() == KMachineState_Teleported 699 || item->machineState() == KMachineState_Aborted 700 , ("Machine must be PoweredOff/Saved/Aborted (%d)", item->machineState())); 701 701 702 702 QString id = item->id(); … … 704 704 CSession session; 705 705 706 session.createInstance 706 session.createInstance(CLSID_Session); 707 707 if (session.isNull()) 708 708 { 709 vboxProblem().cannotOpenSession 709 vboxProblem().cannotOpenSession(session); 710 710 return; 711 711 } 712 712 713 #if defined 713 #if defined(Q_OS_WIN32) 714 714 /* allow the started VM process to make itself the foreground window */ 715 AllowSetForegroundWindow 715 AllowSetForegroundWindow(ASFW_ANY); 716 716 #endif 717 717 718 718 QString env; 719 #if defined 719 #if defined(Q_WS_X11) 720 720 /* make sure the VM process will start on the same display as the Selector */ 721 const char *display = RTEnvGet 721 const char *display = RTEnvGet("DISPLAY"); 722 722 if (display) 723 723 env.append(QString("DISPLAY=%1\n").arg(display)); 724 const char *xauth = RTEnvGet 724 const char *xauth = RTEnvGet("XAUTHORITY"); 725 725 if (xauth) 726 726 env.append(QString("XAUTHORITY=%1\n").arg(xauth)); … … 744 744 } 745 745 746 void VBoxSelectorWnd::vmDiscard 746 void VBoxSelectorWnd::vmDiscard(const QString &aUuid /* = QString::null */) 747 747 { 748 748 UIVMItem *item = aUuid.isNull() ? mVMListView->selectedItem() : 749 mVMModel->itemById 750 751 AssertMsgReturnVoid 752 753 if (!vboxProblem().confirmDiscardSavedState 749 mVMModel->itemById(aUuid); 750 751 AssertMsgReturnVoid(item, ("Item must be always selected here")); 752 753 if (!vboxProblem().confirmDiscardSavedState(item->machine())) 754 754 return; 755 755 … … 758 758 CSession session; 759 759 CVirtualBox vbox = vboxGlobal().virtualBox(); 760 session.createInstance 760 session.createInstance(CLSID_Session); 761 761 if (session.isNull()) 762 762 { … … 770 770 if (!vbox.isOk()) 771 771 { 772 vboxProblem().cannotOpenSession 772 vboxProblem().cannotOpenSession(vbox, item->machine()); 773 773 return; 774 774 } … … 777 777 console.DiscardSavedState(true /* fDeleteFile */); 778 778 if (!console.isOk()) 779 vboxProblem().cannotDiscardSavedState 779 vboxProblem().cannotDiscardSavedState(console); 780 780 781 781 session.UnlockMachine(); 782 782 } 783 783 784 void VBoxSelectorWnd::vmPause 784 void VBoxSelectorWnd::vmPause(bool aPause, const QString &aUuid /* = QString::null */) 785 785 { 786 786 UIVMItem *item = aUuid.isNull() ? mVMListView->selectedItem() : 787 mVMModel->itemById 788 789 AssertMsgReturnVoid 790 791 CSession session = vboxGlobal().openExistingSession 787 mVMModel->itemById(aUuid); 788 789 AssertMsgReturnVoid(item, ("Item must be always selected here")); 790 791 CSession session = vboxGlobal().openExistingSession(item->id()); 792 792 if (session.isNull()) 793 793 return; … … 806 806 { 807 807 if (aPause) 808 vboxProblem().cannotPauseMachine 808 vboxProblem().cannotPauseMachine(console); 809 809 else 810 vboxProblem().cannotResumeMachine 810 vboxProblem().cannotResumeMachine(console); 811 811 } 812 812 … … 814 814 } 815 815 816 void VBoxSelectorWnd::vmRefresh 816 void VBoxSelectorWnd::vmRefresh(const QString &aUuid /* = QString::null */) 817 817 { 818 818 UIVMItem *item = aUuid.isNull() ? mVMListView->selectedItem() : 819 mVMModel->itemById 820 821 AssertMsgReturnVoid 822 823 refreshVMItem 819 mVMModel->itemById(aUuid); 820 821 AssertMsgReturnVoid(item, ("Item must be always selected here")); 822 823 refreshVMItem(item->id(), 824 824 true /* aDetails */, 825 825 true /* aSnapshot */, … … 827 827 } 828 828 829 void VBoxSelectorWnd::vmShowLogs 829 void VBoxSelectorWnd::vmShowLogs(const QString &aUuid /* = QString::null */) 830 830 { 831 831 UIVMItem *item = aUuid.isNull() ? mVMListView->selectedItem() : 832 mVMModel->itemById 833 834 AssertMsgReturnVoid 832 mVMModel->itemById(aUuid); 833 834 AssertMsgReturnVoid(item, ("Item must be always selected here")); 835 835 836 836 CMachine machine = item->machine(); 837 VBoxVMLogViewer::createLogViewer 837 VBoxVMLogViewer::createLogViewer(this, machine); 838 838 } 839 839 … … 844 844 for (CMachineVector::ConstIterator m = vec.begin(); 845 845 m != vec.end(); ++ m) 846 mVMModel->addItem (new UIVMItem(*m));846 mVMModel->addItem(new UIVMItem(*m)); 847 847 mVMModel->sort(); 848 848 … … 860 860 bool aDescription) 861 861 { 862 UIVMItem *item = mVMModel->itemById 862 UIVMItem *item = mVMModel->itemById(aID); 863 863 if (item) 864 864 { 865 mVMModel->refreshItem 865 mVMModel->refreshItem(item); 866 866 if (item && item->id() == aID) 867 vmListViewCurrentChanged 868 } 869 } 870 871 void VBoxSelectorWnd::showContextMenu 867 vmListViewCurrentChanged(aDetails, aSnapshots, aDescription); 868 } 869 } 870 871 void VBoxSelectorWnd::showContextMenu(const QPoint &aPoint) 872 872 { 873 873 /* Send a context menu request */ 874 const QModelIndex &index = mVMListView->indexAt 874 const QModelIndex &index = mVMListView->indexAt(aPoint); 875 875 if (index.isValid()) 876 if (mVMListView->model()->data 876 if (mVMListView->model()->data(index, 877 877 UIVMItemModel::UIVMItemPtrRole).value <UIVMItem*>()) 878 mVMCtxtMenu->exec (mVMListView->mapToGlobal(aPoint));878 mVMCtxtMenu->exec(mVMListView->mapToGlobal(aPoint)); 879 879 } 880 880 881 881 #ifdef VBOX_GUI_WITH_SYSTRAY 882 882 883 void VBoxSelectorWnd::trayIconActivated 883 void VBoxSelectorWnd::trayIconActivated(QSystemTrayIcon::ActivationReason aReason) 884 884 { 885 885 switch (aReason) … … 918 918 ///////////////////////////////////////////////////////////////////////////// 919 919 920 bool VBoxSelectorWnd::event 920 bool VBoxSelectorWnd::event(QEvent *e) 921 921 { 922 922 switch (e->type()) … … 931 931 if ((windowState() & (Qt::WindowMaximized | Qt::WindowMinimized | 932 932 Qt::WindowFullScreen)) == 0) 933 mNormalGeo.setSize 933 mNormalGeo.setSize(re->size()); 934 934 break; 935 935 } … … 938 938 if ((windowState() & (Qt::WindowMaximized | Qt::WindowMinimized | 939 939 Qt::WindowFullScreen)) == 0) 940 mNormalGeo.moveTo 940 mNormalGeo.moveTo(geometry().x(), geometry().y()); 941 941 break; 942 942 } … … 974 974 } 975 975 976 return QMainWindow::event 977 } 978 979 void VBoxSelectorWnd::closeEvent 976 return QMainWindow::event(e); 977 } 978 979 void VBoxSelectorWnd::closeEvent(QCloseEvent *aEvent) 980 980 { 981 981 #ifdef VBOX_GUI_WITH_SYSTRAY 982 982 /* Needed for breaking out of the while() loop in main(). */ 983 983 if (vboxGlobal().isTrayMenu()) 984 vboxGlobal().setTrayMenu 984 vboxGlobal().setTrayMenu(false); 985 985 #endif 986 986 987 987 emit closing(); 988 QMainWindow::closeEvent 988 QMainWindow::closeEvent(aEvent); 989 989 } 990 990 991 991 #if defined (Q_WS_MAC) && (QT_VERSION < 0x040402) 992 bool VBoxSelectorWnd::eventFilter 992 bool VBoxSelectorWnd::eventFilter(QObject *aObject, QEvent *aEvent) 993 993 { 994 994 if (!isActiveWindow()) 995 return QIWithRetranslateUI2<QMainWindow>::eventFilter 996 997 if (qobject_cast<QWidget*> 998 qobject_cast<QWidget*> 999 return QIWithRetranslateUI2<QMainWindow>::eventFilter 995 return QIWithRetranslateUI2<QMainWindow>::eventFilter(aObject, aEvent); 996 997 if (qobject_cast<QWidget*>(aObject) && 998 qobject_cast<QWidget*>(aObject)->window() != this) 999 return QIWithRetranslateUI2<QMainWindow>::eventFilter(aObject, aEvent); 1000 1000 1001 1001 switch (aEvent->type()) … … 1012 1012 break; 1013 1013 } 1014 return QIWithRetranslateUI2<QMainWindow>::eventFilter 1014 return QIWithRetranslateUI2<QMainWindow>::eventFilter(aObject, aEvent); 1015 1015 } 1016 1016 #endif /* defined (Q_WS_MAC) && (QT_VERSION < 0x040402) */ … … 1023 1023 { 1024 1024 #ifdef VBOX_OSE 1025 QString title (tr("VirtualBox OSE"));1025 QString title(tr("VirtualBox OSE")); 1026 1026 #else 1027 QString title 1027 QString title(VBOX_PRODUCT); 1028 1028 #endif 1029 1029 … … 1036 1036 #endif 1037 1037 1038 setWindowTitle 1038 setWindowTitle(title); 1039 1039 1040 1040 /* ensure the details and screenshot view are updated */ 1041 1041 vmListViewCurrentChanged(); 1042 1042 1043 mFileMediaMgrAction->setText (tr("&Virtual Media Manager..."));1044 mFileMediaMgrAction->setShortcut (QKeySequence("Ctrl+D"));1045 mFileMediaMgrAction->setStatusTip (tr("Display the Virtual Media Manager dialog"));1046 1047 mFileApplianceImportAction->setText (tr("&Import Appliance..."));1048 mFileApplianceImportAction->setShortcut (QKeySequence("Ctrl+I"));1049 mFileApplianceImportAction->setStatusTip (tr("Import an appliance into VirtualBox"));1050 1051 mFileApplianceExportAction->setText (tr("&Export Appliance..."));1052 mFileApplianceExportAction->setShortcut (QKeySequence("Ctrl+E"));1053 mFileApplianceExportAction->setStatusTip (tr("Export one or more VirtualBox virtual machines as an appliance"));1043 mFileMediaMgrAction->setText(tr("&Virtual Media Manager...")); 1044 mFileMediaMgrAction->setShortcut(QKeySequence("Ctrl+D")); 1045 mFileMediaMgrAction->setStatusTip(tr("Display the Virtual Media Manager dialog")); 1046 1047 mFileApplianceImportAction->setText(tr("&Import Appliance...")); 1048 mFileApplianceImportAction->setShortcut(QKeySequence("Ctrl+I")); 1049 mFileApplianceImportAction->setStatusTip(tr("Import an appliance into VirtualBox")); 1050 1051 mFileApplianceExportAction->setText(tr("&Export Appliance...")); 1052 mFileApplianceExportAction->setShortcut(QKeySequence("Ctrl+E")); 1053 mFileApplianceExportAction->setStatusTip(tr("Export one or more VirtualBox virtual machines as an appliance")); 1054 1054 1055 1055 #ifdef Q_WS_MAC … … 1064 1064 * be really interesting to see how this plays on non-english systems... 1065 1065 */ 1066 mFileSettingsAction->setText (tr("&Preferences...", "global settings"));1066 mFileSettingsAction->setText(tr("&Preferences...", "global settings")); 1067 1067 #else 1068 1068 /* … … 1071 1071 * to figure out. 1072 1072 */ 1073 mFileSettingsAction->setText (tr("&Preferences...", "global settings"));1073 mFileSettingsAction->setText(tr("&Preferences...", "global settings")); 1074 1074 #endif 1075 mFileSettingsAction->setShortcut (QKeySequence("Ctrl+G"));1076 mFileSettingsAction->setStatusTip (tr("Display the global settings dialog"));1077 1078 mFileExitAction->setText (tr("E&xit"));1079 mFileExitAction->setShortcut (QKeySequence("Ctrl+Q"));1080 mFileExitAction->setStatusTip (tr("Close application"));1081 1082 mVmNewAction->setText (tr("&New..."));1083 mVmNewAction->setShortcut (QKeySequence("Ctrl+N"));1084 mVmNewAction->setStatusTip (tr("Create a new virtual machine"));1085 mVmNewAction->setToolTip (mVmNewAction->text().remove ('&').remove('.') +1086 QString (" (%1)").arg(mVmNewAction->shortcut().toString()));1087 1088 mVmConfigAction->setText (tr("&Settings..."));1089 mVmConfigAction->setShortcut (QKeySequence("Ctrl+S"));1090 mVmConfigAction->setStatusTip (tr("Configure the selected virtual machine"));1091 mVmConfigAction->setToolTip (mVmConfigAction->text().remove ('&').remove('.') +1092 QString (" (%1)").arg(mVmConfigAction->shortcut().toString()));1093 1094 mVmDeleteAction->setText (tr("&Delete"));1095 mVmDeleteAction->setShortcut (QKeySequence("Ctrl+R"));1096 mVmDeleteAction->setStatusTip (tr("Delete the selected virtual machine"));1075 mFileSettingsAction->setShortcut(QKeySequence("Ctrl+G")); 1076 mFileSettingsAction->setStatusTip(tr("Display the global settings dialog")); 1077 1078 mFileExitAction->setText(tr("E&xit")); 1079 mFileExitAction->setShortcut(QKeySequence("Ctrl+Q")); 1080 mFileExitAction->setStatusTip(tr("Close application")); 1081 1082 mVmNewAction->setText(tr("&New...")); 1083 mVmNewAction->setShortcut(QKeySequence("Ctrl+N")); 1084 mVmNewAction->setStatusTip(tr("Create a new virtual machine")); 1085 mVmNewAction->setToolTip(mVmNewAction->text().remove('&').remove('.') + 1086 QString("(%1)").arg(mVmNewAction->shortcut().toString())); 1087 1088 mVmConfigAction->setText(tr("&Settings...")); 1089 mVmConfigAction->setShortcut(QKeySequence("Ctrl+S")); 1090 mVmConfigAction->setStatusTip(tr("Configure the selected virtual machine")); 1091 mVmConfigAction->setToolTip(mVmConfigAction->text().remove('&').remove('.') + 1092 QString("(%1)").arg(mVmConfigAction->shortcut().toString())); 1093 1094 mVmDeleteAction->setText(tr("&Delete")); 1095 mVmDeleteAction->setShortcut(QKeySequence("Ctrl+R")); 1096 mVmDeleteAction->setStatusTip(tr("Delete the selected virtual machine")); 1097 1097 1098 1098 /* Note: mVmStartAction text is set up in vmListViewCurrentChanged() */ 1099 1099 1100 mVmDiscardAction->setText (tr("D&iscard"));1101 mVmDiscardAction->setStatusTip 1102 tr 1103 1104 mVmPauseAction->setText (tr("&Pause"));1105 mVmPauseAction->setStatusTip 1106 tr 1107 1108 mVmRefreshAction->setText (tr("Re&fresh"));1109 mVmRefreshAction->setStatusTip 1110 tr 1111 1112 mVmShowLogsAction->setText (tr("Show &Log..."));1113 mVmShowLogsAction->setIconText (tr("Log", "icon text"));1114 mVmShowLogsAction->setShortcut (QKeySequence("Ctrl+L"));1115 mVmShowLogsAction->setStatusTip 1116 tr 1100 mVmDiscardAction->setText(tr("D&iscard")); 1101 mVmDiscardAction->setStatusTip( 1102 tr("Discard the saved state of the selected virtual machine")); 1103 1104 mVmPauseAction->setText(tr("&Pause")); 1105 mVmPauseAction->setStatusTip( 1106 tr("Suspend the execution of the virtual machine")); 1107 1108 mVmRefreshAction->setText(tr("Re&fresh")); 1109 mVmRefreshAction->setStatusTip( 1110 tr("Refresh the accessibility state of the selected virtual machine")); 1111 1112 mVmShowLogsAction->setText(tr("Show &Log...")); 1113 mVmShowLogsAction->setIconText(tr("Log", "icon text")); 1114 mVmShowLogsAction->setShortcut(QKeySequence("Ctrl+L")); 1115 mVmShowLogsAction->setStatusTip( 1116 tr("Show the log files of the selected virtual machine")); 1117 1117 1118 1118 mHelpActions.retranslateUi(); 1119 1119 1120 1120 #ifdef Q_WS_MAC 1121 mFileMenu->setTitle 1121 mFileMenu->setTitle(tr("&File", "Mac OS X version")); 1122 1122 #else /* Q_WS_MAC */ 1123 mFileMenu->setTitle 1123 mFileMenu->setTitle(tr("&File", "Non Mac OS X version")); 1124 1124 #endif /* !Q_WS_MAC */ 1125 mVMMenu->setTitle (tr("&Machine"));1126 mHelpMenu->setTitle (tr("&Help"));1125 mVMMenu->setTitle(tr("&Machine")); 1126 mHelpMenu->setTitle(tr("&Help")); 1127 1127 1128 1128 #ifdef VBOX_GUI_WITH_SYSTRAY … … 1151 1151 ///////////////////////////////////////////////////////////////////////////// 1152 1152 1153 void VBoxSelectorWnd::vmListViewCurrentChanged 1154 1155 1153 void VBoxSelectorWnd::vmListViewCurrentChanged(bool aRefreshDetails, 1154 bool aRefreshSnapshots, 1155 bool aRefreshDescription) 1156 1156 { 1157 1157 UIVMItem *item = mVMListView->selectedItem(); … … 1191 1191 ) 1192 1192 { 1193 mVmStartAction->setText (tr("S&tart"));1193 mVmStartAction->setText(tr("S&tart")); 1194 1194 #ifdef QT_MAC_USE_COCOA 1195 1195 /* There is a bug in Qt Cocoa which result in showing a "more arrow" when … … 1199 1199 mVMToolBar->updateLayout(); 1200 1200 #endif /* QT_MAC_USE_COCOA */ 1201 mVmStartAction->setStatusTip 1202 tr 1203 1204 mVmStartAction->setEnabled 1201 mVmStartAction->setStatusTip( 1202 tr("Start the selected virtual machine")); 1203 1204 mVmStartAction->setEnabled(!running); 1205 1205 } 1206 1206 else 1207 1207 { 1208 mVmStartAction->setText (tr("S&how"));1208 mVmStartAction->setText(tr("S&how")); 1209 1209 #ifdef QT_MAC_USE_COCOA 1210 1210 /* There is a bug in Qt Cocoa which result in showing a "more arrow" when … … 1214 1214 mVMToolBar->updateLayout(); 1215 1215 #endif /* QT_MAC_USE_COCOA */ 1216 mVmStartAction->setStatusTip 1217 tr 1218 1219 mVmStartAction->setEnabled 1216 mVmStartAction->setStatusTip( 1217 tr("Switch to the window of the selected virtual machine")); 1218 1219 mVmStartAction->setEnabled(item->canSwitchTo()); 1220 1220 } 1221 1221 … … 1225 1225 ) 1226 1226 { 1227 mVmPauseAction->setText (tr("R&esume"));1228 mVmPauseAction->setShortcut (QKeySequence("Ctrl+P"));1229 mVmPauseAction->setStatusTip 1230 tr 1231 mVmPauseAction->blockSignals 1232 mVmPauseAction->setChecked 1233 mVmPauseAction->blockSignals 1227 mVmPauseAction->setText(tr("R&esume")); 1228 mVmPauseAction->setShortcut(QKeySequence("Ctrl+P")); 1229 mVmPauseAction->setStatusTip( 1230 tr("Resume the execution of the virtual machine")); 1231 mVmPauseAction->blockSignals(true); 1232 mVmPauseAction->setChecked(true); 1233 mVmPauseAction->blockSignals(false); 1234 1234 } 1235 1235 else 1236 1236 { 1237 mVmPauseAction->setText (tr("&Pause"));1238 mVmPauseAction->setShortcut (QKeySequence("Ctrl+P"));1239 mVmPauseAction->setStatusTip 1240 tr 1241 mVmPauseAction->blockSignals 1242 mVmPauseAction->setChecked 1243 mVmPauseAction->blockSignals 1237 mVmPauseAction->setText(tr("&Pause")); 1238 mVmPauseAction->setShortcut(QKeySequence("Ctrl+P")); 1239 mVmPauseAction->setStatusTip( 1240 tr("Suspend the execution of the virtual machine")); 1241 mVmPauseAction->blockSignals(true); 1242 mVmPauseAction->setChecked(false); 1243 mVmPauseAction->blockSignals(false); 1244 1244 } 1245 1245 1246 1246 /* disable Refresh for accessible machines */ 1247 mVmRefreshAction->setEnabled 1247 mVmRefreshAction->setEnabled(false); 1248 1248 1249 1249 /* enable the show log item for the selected vm */ 1250 mVmShowLogsAction->setEnabled 1250 mVmShowLogsAction->setEnabled(true); 1251 1251 } 1252 1252 else … … 1281 1281 "or visit " 1282 1282 "<a href=http://www.virtualbox.org>www.virtualbox.org</a> " 1283 "for the latest information and news.</p>").arg (QKeySequence (QKeySequence::HelpContents).toString(QKeySequence::NativeText)));1283 "for the latest information and news.</p>").arg(QKeySequence(QKeySequence::HelpContents).toString(QKeySequence::NativeText))); 1284 1284 mVmRefreshAction->setEnabled(false); 1285 1285 } … … 1290 1290 1291 1291 /* disable modify actions */ 1292 mVmConfigAction->setEnabled 1293 mVmDeleteAction->setEnabled 1294 mVmDiscardAction->setEnabled 1295 mVmPauseAction->setEnabled 1292 mVmConfigAction->setEnabled(false); 1293 mVmDeleteAction->setEnabled(item != NULL); 1294 mVmDiscardAction->setEnabled(false); 1295 mVmPauseAction->setEnabled(false); 1296 1296 1297 1297 /* change the Start button text accordingly */ 1298 mVmStartAction->setText (tr("S&tart"));1299 mVmStartAction->setStatusTip 1300 tr 1301 mVmStartAction->setEnabled 1298 mVmStartAction->setText(tr("S&tart")); 1299 mVmStartAction->setStatusTip( 1300 tr("Start the selected virtual machine")); 1301 mVmStartAction->setEnabled(false); 1302 1302 1303 1303 /* disable the show log item for the selected vm */ 1304 mVmShowLogsAction->setEnabled 1304 mVmShowLogsAction->setEnabled(false); 1305 1305 } 1306 1306 } … … 1309 1309 { 1310 1310 /* refresh the current details to pick up hard disk sizes */ 1311 vmListViewCurrentChanged 1312 } 1313 1314 void VBoxSelectorWnd::mediumEnumFinished 1311 vmListViewCurrentChanged(true /* aRefreshDetails */); 1312 } 1313 1314 void VBoxSelectorWnd::mediumEnumFinished(const VBoxMediaList &list) 1315 1315 { 1316 1316 /* refresh the current details to pick up hard disk sizes */ 1317 vmListViewCurrentChanged 1317 vmListViewCurrentChanged(true /* aRefreshDetails */); 1318 1318 1319 1319 /* we warn about inaccessible media only once (after media emumeration … … 1337 1337 /* ignore the signal if a VBoxMediaManagerDlg window is active */ 1338 1338 if (qApp->activeWindow() && 1339 !strcmp 1339 !strcmp(qApp->activeWindow()->metaObject()->className(), "VBoxMediaManagerDlg")) 1340 1340 break; 1341 1341 … … 1350 1350 /* Show the VDM dialog but don't refresh once more after a 1351 1351 * just-finished refresh */ 1352 VBoxMediaManagerDlg::showModeless 1352 VBoxMediaManagerDlg::showModeless(this, false /* aRefresh */); 1353 1353 } 1354 1354 } … … 1371 1371 #endif 1372 1372 1373 refreshVMItem 1374 1375 1376 1373 refreshVMItem(strId, 1374 false /* aDetails */, 1375 false /* aSnapshots */, 1376 false /* aDescription */); 1377 1377 1378 1378 /* simulate a state change signal */ … … 1382 1382 void VBoxSelectorWnd::machineDataChanged(QString strId) 1383 1383 { 1384 refreshVMItem 1385 1386 1387 1384 refreshVMItem(strId, 1385 true /* aDetails */, 1386 false /* aSnapshots */, 1387 true /* aDescription */); 1388 1388 } 1389 1389 … … 1393 1393 { 1394 1394 CVirtualBox vbox = vboxGlobal().virtualBox(); 1395 CMachine m = vbox.GetMachine 1395 CMachine m = vbox.GetMachine(strId); 1396 1396 if (!m.isNull()) 1397 1397 { 1398 mVMModel->addItem (new UIVMItem(m));1398 mVMModel->addItem(new UIVMItem(m)); 1399 1399 mVMModel->sort(); 1400 1400 /* Make sure the description, ... pages are properly updated. … … 1409 1409 else 1410 1410 { 1411 UIVMItem *item = mVMModel->itemById 1411 UIVMItem *item = mVMModel->itemById(strId); 1412 1412 if (item) 1413 1413 { 1414 int row = mVMModel->rowById 1415 mVMModel->removeItem 1414 int row = mVMModel->rowById(item->id()); 1415 mVMModel->removeItem(item); 1416 1416 delete item; 1417 mVMListView->ensureSomeRowSelected 1417 mVMListView->ensureSomeRowSelected(row); 1418 1418 } 1419 1419 … … 1425 1425 void VBoxSelectorWnd::sessionStateChanged(QString strId, KSessionState /* state */) 1426 1426 { 1427 refreshVMItem 1428 1429 1430 1427 refreshVMItem(strId, 1428 true /* aDetails */, 1429 false /* aSnapshots */, 1430 false /* aDescription */); 1431 1431 1432 1432 /* simulate a state change signal */ … … 1436 1436 void VBoxSelectorWnd::snapshotChanged(QString strId, QString /* strSnapshotId */) 1437 1437 { 1438 refreshVMItem 1439 1440 1441 1438 refreshVMItem(strId, 1439 false /* aDetails */, 1440 true /* aSnapshot */, 1441 false /* aDescription */); 1442 1442 } 1443 1443 … … 1452 1452 void VBoxSelectorWnd::trayIconCanShow(bool fEnabled) 1453 1453 { 1454 emit trayIconChanged(VBoxChangeTrayIconEvent 1454 emit trayIconChanged(VBoxChangeTrayIconEvent(vboxGlobal().settings().trayIconEnabled())); 1455 1455 } 1456 1456 -
trunk/src/VBox/Frontends/VirtualBox/src/selector/VBoxSelectorWnd.h
r32758 r32759 50 50 public: 51 51 52 VBoxSelectorWnd 53 54 52 VBoxSelectorWnd(VBoxSelectorWnd **aSelf, 53 QWidget* aParent = 0, 54 Qt::WindowFlags aFlags = Qt::Window); 55 55 virtual ~VBoxSelectorWnd(); 56 56 … … 68 68 69 69 void vmNew(); 70 void vmSettings (const QString &aCategory = QString::null, 71 const QString &aControl = QString::null, 72 const QString & = QString::null); 73 void vmDelete (const QString & = QString::null); 74 void vmStart (const QString & = QString::null); 75 void vmDiscard (const QString & = QString::null); 76 void vmPause (bool, const QString & = QString::null); 77 void vmRefresh (const QString & = QString::null); 78 void vmShowLogs (const QString & = QString::null); 70 void vmSettings(const QString &aCategory = QString::null, const QString &aControl = QString::null, const QString & = QString::null); 71 void vmDelete(const QString & = QString::null); 72 void vmStart(const QString & = QString::null); 73 void vmDiscard(const QString & = QString::null); 74 void vmPause(bool, const QString & = QString::null); 75 void vmRefresh(const QString & = QString::null); 76 void vmShowLogs(const QString & = QString::null); 79 77 80 78 void refreshVMList(); 81 void refreshVMItem (const QString &aID, bool aDetails, 82 bool aSnapshots, 83 bool aDescription); 79 void refreshVMItem(const QString &aID, bool aDetails, bool aSnapshots, bool aDescription); 84 80 85 void showContextMenu 81 void showContextMenu(const QPoint &aPoint); 86 82 87 83 #ifdef VBOX_GUI_WITH_SYSTRAY 88 void trayIconActivated 84 void trayIconActivated(QSystemTrayIcon::ActivationReason aReason); 89 85 void showWindow(); 90 86 #endif … … 102 98 103 99 /* Events */ 104 bool event 105 void closeEvent 100 bool event(QEvent *aEvent); 101 void closeEvent(QCloseEvent *aEvent); 106 102 //#if defined (Q_WS_MAC) && (QT_VERSION < 0x040402) 107 // bool eventFilter 103 // bool eventFilter(QObject *aObject, QEvent *aEvent); 108 104 //#endif /* defined (Q_WS_MAC) && (QT_VERSION < 0x040402) */ 109 105 … … 112 108 private slots: 113 109 114 void vmListViewCurrentChanged (bool aRefreshDetails = true, 115 bool aRefreshSnapshots = true, 116 bool aRefreshDescription = true); 117 110 void vmListViewCurrentChanged(bool aRefreshDetails = true, bool aRefreshSnapshots = true, bool aRefreshDescription = true); 118 111 void mediumEnumStarted(); 119 void mediumEnumFinished 112 void mediumEnumFinished(const VBoxMediaList &); 120 113 121 114 /* VirtualBox callback events we're interested in */
Note:
See TracChangeset
for help on using the changeset viewer.