Changeset 38977 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Oct 12, 2011 11:44:56 AM (13 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox
- Files:
-
- 14 edited
- 2 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/Makefile.kmk
r38973 r38977 131 131 endif 132 132 ifdef VBOX_BLEEDING_EDGE 133 VirtualBox_src/selector/ VBoxSelectorWnd.cpp_DEFS += \133 VirtualBox_src/selector/UISelectorWindow.cpp_DEFS += \ 134 134 VBOX_BLEEDING_EDGE=\"$(VBOX_BLEEDING_EDGE)\" 135 135 VirtualBox_src/runtime/UIMachineWindow.cpp_DEFS += \ … … 305 305 src/selector/UIVMPreviewWindow.h \ 306 306 src/selector/UIVirtualBoxEventHandler.h \ 307 src/selector/ VBoxSelectorWnd.h \307 src/selector/UISelectorWindow.h \ 308 308 src/selector/VBoxSnapshotsWgt.h \ 309 309 src/settings/UISettingsDialog.h \ … … 478 478 src/selector/UIVMPreviewWindow.cpp \ 479 479 src/selector/UIVirtualBoxEventHandler.cpp \ 480 src/selector/ VBoxSelectorWnd.cpp \480 src/selector/UISelectorWindow.cpp \ 481 481 src/selector/VBoxSnapshotsWgt.cpp \ 482 482 src/settings/UISettingsDefs.cpp \ -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxMediaManagerDlg.cpp
r38311 r38977 550 550 mModelessDialog->setup (VBoxDefs::MediumType_All, false /* aDoSelect */, aRefresh); 551 551 552 /* Setup 'closing' connection if main window is VBoxSelectorWnd: */553 if (vboxGlobal().mainWindow() && vboxGlobal().mainWindow()->inherits(" VBoxSelectorWnd"))552 /* Setup 'closing' connection if main window is UISelectorWindow: */ 553 if (vboxGlobal().mainWindow() && vboxGlobal().mainWindow()->inherits("UISelectorWindow")) 554 554 connect(vboxGlobal().mainWindow(), SIGNAL(closing()), mModelessDialog, SLOT(close())); 555 555 -
trunk/src/VBox/Frontends/VirtualBox/src/extensions/QIMessageBox.cpp
r38373 r38977 26 26 #include "QIDialogButtonBox.h" 27 27 #include "UIIconPool.h" 28 #ifdef Q_WS_MAC29 # include "VBoxSelectorWnd.h"30 #endif /* Q_WS_MAC */31 28 32 29 /* Qt includes */ -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.cpp
r38582 r38977 35 35 #include "UIMessageCenter.h" 36 36 #include "VBoxGlobal.h" 37 #include " VBoxSelectorWnd.h"37 #include "UISelectorWindow.h" 38 38 #include "UIProgressDialog.h" 39 39 #include "UIDownloaderUserManual.h" … … 2226 2226 } 2227 2227 2228 bool UIMessageCenter::confirmVMACPIShutdown(QWidget *pParent /* = 0 */) 2229 { 2230 return messageOkCancel(pParent ? pParent : mainMachineWindowShown(), Question, 2231 tr("<p>Do you really want to send an ACPI shutdown signal to the virtual machine?</p>"), 2232 "confirmVMACPIShutdown" /* pcszAutoConfirmId */, 2233 tr("ACPI Shutdown", "machine")); 2234 } 2235 2228 2236 bool UIMessageCenter::confirmVMPowerOff(QWidget *pParent /* = 0 */) 2229 2237 { -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.h
r38582 r38977 346 346 347 347 bool confirmVMReset(QWidget *pParent = 0); 348 bool confirmVMACPIShutdown(QWidget *pParent = 0); 348 349 bool confirmVMPowerOff(QWidget *pParent = 0); 349 350 -
trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp
r38774 r38977 24 24 #include "VBoxUtils.h" 25 25 #include "VBoxDefs.h" 26 #include " VBoxSelectorWnd.h"26 #include "UISelectorWindow.h" 27 27 #include "UIMessageCenter.h" 28 28 #include "QIMessageBox.h" … … 417 417 * There is only one such a window per VirtualBox application. 418 418 */ 419 VBoxSelectorWnd&VBoxGlobal::selectorWnd()419 UISelectorWindow &VBoxGlobal::selectorWnd() 420 420 { 421 421 AssertMsg (!vboxGlobal().isVMConsoleProcess(), … … 431 431 * from the below constructor or from constructors/methods it calls. 432 432 */ 433 VBoxSelectorWnd *w = new VBoxSelectorWnd(&mSelectorWnd, 0);433 UISelectorWindow *w = new UISelectorWindow (&mSelectorWnd, 0); 434 434 Assert (w == mSelectorWnd); 435 435 NOREF(w); -
trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.h
r38568 r38977 106 106 //////////////////////////////////////////////////////////////////////////////// 107 107 108 class VBoxSelectorWnd;108 class UISelectorWindow; 109 109 class UIRegistrationWzd; 110 110 class VBoxUpdateDlg; … … 139 139 bool setSettings (VBoxGlobalSettings &gs); 140 140 141 VBoxSelectorWnd&selectorWnd();141 UISelectorWindow &selectorWnd(); 142 142 143 143 QWidget *vmWindow(); … … 800 800 VBoxGlobalSettings gset; 801 801 802 VBoxSelectorWnd*mSelectorWnd;802 UISelectorWindow *mSelectorWnd; 803 803 UIMachine *m_pVirtualMachine; 804 804 QWidget* mMainWindow; -
trunk/src/VBox/Frontends/VirtualBox/src/main.cpp
r38636 r38977 26 26 #include "VBoxGlobal.h" 27 27 #include "UIMessageCenter.h" 28 #include " VBoxSelectorWnd.h"28 #include "UISelectorWindow.h" 29 29 #include "VBoxUtils.h" 30 30 #ifdef Q_WS_MAC -
trunk/src/VBox/Frontends/VirtualBox/src/precomp.h
r38973 r38977 232 232 #include "UIMessageCenter.h" 233 233 #include "VBoxProgressDialog.h" 234 #include " VBoxSelectorWnd.h"234 #include "UISelectorWindow.h" 235 235 #include "UISettingsDialog.h" 236 236 #include "UISettingsDialogSpecific.h" -
trunk/src/VBox/Frontends/VirtualBox/src/selector/UISelectorWindow.cpp
r38973 r38977 2 2 * 3 3 * VBox frontends: Qt GUI ("VirtualBox"): 4 * VBoxSelectorWndclass implementation4 * UISelectorWindow class implementation 5 5 */ 6 6 … … 20 20 # include "precomp.h" 21 21 #else /* !VBOX_WITH_PRECOMPILED_HEADERS */ 22 /* Global includes */ 23 #include <QDesktopWidget> 24 #include <QMenuBar> 25 #include <QResizeEvent> 26 #include <QDesktopServices> 27 28 /* Local includes: */ 22 29 #include "QISplitter.h" 23 30 #include "UIBar.h" … … 36 43 #include "VBoxMediaManagerDlg.h" 37 44 #include "UIMessageCenter.h" 38 #include " VBoxSelectorWnd.h"45 #include "UISelectorWindow.h" 39 46 #include "UISettingsDialogSpecific.h" 40 47 #include "UIToolBar.h" … … 43 50 #include "UISelectorShortcuts.h" 44 51 #include "UIDesktopServices.h" 45 #include "UIGlobalSettingsExtension.h" /* extension pack installation */52 #include "UIGlobalSettingsExtension.h" 46 53 #include "UIActionPoolSelector.h" 47 54 … … 55 62 # include "UIWindowMenuManager.h" 56 63 # include "UIImageTools.h" 57 #endif 58 59 /* Global includes */ 60 #include <QDesktopWidget> 61 #include <QMenuBar> 62 #include <QResizeEvent> 63 #include <QDesktopServices> 64 #endif /* Q_WS_MAC */ 65 66 #ifdef Q_WS_X11 67 # include <iprt/env.h> 68 #endif /* Q_WS_X11 */ 64 69 65 70 #include <iprt/buildconfig.h> 66 71 #include <VBox/version.h> 67 #ifdef Q_WS_X1168 # include <iprt/env.h>69 #endif70 72 #endif /* !VBOX_WITH_PRECOMPILED_HEADERS */ 71 73 72 // VBoxSelectorWnd class 73 //////////////////////////////////////////////////////////////////////////////// 74 75 /** \class VBoxSelectorWnd 76 * 77 * The VBoxSelectorWnd class is a VM selector window, one of two main VBox 78 * GUI windows. 79 * 80 * This window appears when the user starts the VirtualBox executable. 81 * It allows to view the list of configured VMs, their settings 82 * and the current state, create, reconfigure, delete and start VMs. 83 */ 84 85 /** 86 * Constructs the VM selector window. 87 * 88 * @param aSelf pointer to a variable where to store |this| right after 89 * this object's constructor is called (necessary to avoid 90 * recursion in VBoxGlobal::selectorWnd()) 91 */ 92 VBoxSelectorWnd:: 93 VBoxSelectorWnd(VBoxSelectorWnd **aSelf, QWidget* aParent, 94 Qt::WindowFlags aFlags /* = Qt::Window */) 95 : QIWithRetranslateUI2<QMainWindow>(aParent, aFlags) 96 , mDoneInaccessibleWarningOnce(false) 74 UISelectorWindow::UISelectorWindow(UISelectorWindow **ppSelf, QWidget *pParent, 75 Qt::WindowFlags flags /* = Qt::Window */) 76 : QIWithRetranslateUI2<QMainWindow>(pParent, flags) 77 , m_pSplitter(0) 78 #ifndef Q_WS_MAC 79 , m_pBar(0) 80 #endif /* !Q_WS_MAC */ 81 , mVMToolBar(0) 82 , m_pVMListView(0) 83 , m_pVMModel(0) 84 , m_pMachineContextMenu(0) 85 , m_pVMDesktop(0) 86 , m_fDoneInaccessibleWarningOnce(false) 97 87 { 98 88 /* Remember self: */ 99 if (aSelf) 100 *aSelf = this; 101 102 /* The application icon: */ 103 #if !(defined (Q_WS_WIN) || defined (Q_WS_MAC)) 104 /* On Win32, it's built-in to the executable. 105 * On Mac OS X the icon referenced in info.plist is used. */ 106 setWindowIcon(QIcon(":/VirtualBox_48px.png")); 107 #endif 108 109 /* Prepare menu: */ 89 if (ppSelf) 90 *ppSelf = this; 91 92 /* Prepare everything: */ 93 prepareIcon(); 110 94 prepareMenuBar(); 111 95 prepareContextMenu(); 112 113 /* Prepare status bar: */114 96 prepareStatusBar(); 115 116 /* Prepare tool bar: */117 97 prepareWidgets(); 118 119 /* Prepare connections: */120 98 prepareConnections(); 121 99 122 #ifdef VBOX_GUI_WITH_SYSTRAY 123 mTrayIcon = new VBoxTrayIcon(this, mVMModel); 124 Assert(mTrayIcon); 125 #endif 126 100 /* Load all settings: */ 101 loadSettings(); 102 103 /* Translate UI: */ 127 104 retranslateUi(); 128 105 129 CVirtualBox vbox = vboxGlobal().virtualBox(); 130 /* Restore the position of the window */ 131 { 132 QString winPos = vbox.GetExtraData(VBoxDefs::GUI_LastWindowPosition); 133 134 bool ok = false, max = false; 135 int x = 0, y = 0, w = 0, h = 0; 136 x = winPos.section(',', 0, 0).toInt(&ok); 137 if (ok) 138 y = winPos.section(',', 1, 1).toInt(&ok); 139 if (ok) 140 w = winPos.section(',', 2, 2).toInt(&ok); 141 if (ok) 142 h = winPos.section(',', 3, 3).toInt(&ok); 143 if (ok) 144 max = winPos.section(',', 4, 4) == VBoxDefs::GUI_LastWindowState_Max; 145 146 QRect ar = ok ? QApplication::desktop()->availableGeometry(QPoint(x, y)) : 147 QApplication::desktop()->availableGeometry(this); 148 149 if (ok /* previous parameters were read correctly */ 150 && (y > 0) && (y < ar.bottom()) /* check vertical bounds */ 151 && (x + w > ar.left()) && (x < ar.right()) /* & horizontal bounds */) 152 { 153 mNormalGeo.moveTo(x, y); 154 mNormalGeo.setSize(QSize(w, h) 155 .expandedTo(minimumSizeHint()) 156 .boundedTo(ar.size())); 157 #if defined(Q_WS_MAC) && (QT_VERSION >= 0x040700) 158 move(mNormalGeo.topLeft()); 159 resize(mNormalGeo.size()); 160 mNormalGeo = normalGeometry(); 161 #else /* defined(Q_WS_MAC) && (QT_VERSION >= 0x040700) */ 162 setGeometry(mNormalGeo); 163 #endif /* !(defined(Q_WS_MAC) && (QT_VERSION >= 0x040700)) */ 164 if (max) /* maximize if needed */ 165 showMaximized(); 166 } 167 else 168 { 169 mNormalGeo.setSize(QSize(770, 550).expandedTo(minimumSizeHint()) 170 .boundedTo(ar.size())); 171 mNormalGeo.moveCenter(ar.center()); 172 setGeometry(mNormalGeo); 173 } 174 } 175 #if MAC_LEOPARD_STYLE 176 /* Enable unified toolbars on Mac OS X. Available on Qt >= 4.3. We do this 177 * after setting the window pos/size, cause Qt sometime includes the 178 * toolbar height in the content height. */ 106 #ifdef Q_WS_MAC 107 # if MAC_LEOPARD_STYLE 108 /* Enable unified toolbars on Mac OS X. Available on Qt >= 4.3. 109 * We do this after setting the window pos/size, cause Qt sometimes 110 * includes the toolbar height in the content height. */ 179 111 mVMToolBar->setMacToolbar(); 180 #endif /* MAC_LEOPARD_STYLE */ 181 182 /* Update the list */ 183 refreshVMList(); 184 185 /* Reset to the first item */ 186 mVMListView->selectItemByRow(0); 187 188 /* restore the position of vm selector */ 189 { 190 QString prevVMId = vbox.GetExtraData(VBoxDefs::GUI_LastVMSelected); 191 192 mVMListView->selectItemById(prevVMId); 193 } 194 195 /* Read the splitter handle position */ 196 { 197 QList<int> sizes = vbox.GetExtraDataIntList(VBoxDefs::GUI_SplitterSizes); 198 if (sizes.size() == 2) 199 m_pSplitter->setSizes(sizes); 200 } 201 202 /* Restore toolbar and statusbar visibility */ 203 { 204 QString strToolbar = vbox.GetExtraData(VBoxDefs::GUI_Toolbar); 205 QString strStatusbar = vbox.GetExtraData(VBoxDefs::GUI_Statusbar); 206 207 #ifdef Q_WS_MAC 208 mVMToolBar->setVisible(strToolbar.isEmpty() || strToolbar == "true"); 209 #else /* Q_WS_MAC */ 210 m_pBar->setVisible(strToolbar.isEmpty() || strToolbar == "true"); 211 #endif /* !Q_WS_MAC */ 212 statusBar()->setVisible(strStatusbar.isEmpty() || strStatusbar == "true"); 213 } 214 215 /* refresh the details et all (necessary for the case when the stored 216 * selection is still the first list item) */ 217 vmListViewCurrentChanged(); 218 219 /* bring the VM list to the focus */ 220 mVMListView->setFocus(); 221 222 #ifdef Q_WS_MAC 112 # endif /* MAC_LEOPARD_STYLE */ 113 223 114 UIWindowMenuManager::instance()->addWindow(this); 224 115 /* Beta label? */ … … 228 119 ::darwinLabelWindow(this, &betaLabel, false); 229 120 } 230 #endif /* Q_WS_MAC */ 231 232 #ifdef Q_WS_MAC 121 233 122 /* General event filter: */ 234 123 qApp->installEventFilter(this); … … 236 125 } 237 126 238 VBoxSelectorWnd::~VBoxSelectorWnd() 239 { 127 UISelectorWindow::~UISelectorWindow() 128 { 129 /* Destroy our event handlers: */ 130 UIVirtualBoxEventHandler::destroy(); 131 132 /* Save all settings: */ 133 saveSettings(); 134 135 #ifdef VBOX_GUI_WITH_SYSTRAY 136 /* Delete systray menu object: */ 137 delete m_pTrayIcon; 138 m_pTrayIcon = NULL; 139 #endif /* VBOX_GUI_WITH_SYSTRAY */ 140 } 141 142 void UISelectorWindow::sltShowSelectorContextMenu(const QPoint &pos) 143 { 144 /* Load toolbar/statusbar availability settings: */ 240 145 CVirtualBox vbox = vboxGlobal().virtualBox(); 241 242 /* Destroy our event handlers */ 243 UIVirtualBoxEventHandler::destroy(); 244 245 /* Save the position of the window */ 246 { 247 #if defined(Q_WS_MAC) && (QT_VERSION >= 0x040700) 248 QRect frameGeo = frameGeometry(); 249 QRect save(frameGeo.x(), frameGeo.y(), mNormalGeo.width(), mNormalGeo.height()); 250 #else /* defined(Q_WS_MAC) && (QT_VERSION >= 0x040700) */ 251 QRect save(mNormalGeo); 252 #endif /* !(defined(Q_WS_MAC) && (QT_VERSION >= 0x040700)) */ 253 QString winPos = QString("%1,%2,%3,%4") 254 .arg(save.x()).arg(save.y()) 255 .arg(save.width()).arg(save.height()); 146 QString strToolbar = vbox.GetExtraData(VBoxDefs::GUI_Toolbar); 147 QString strStatusbar = vbox.GetExtraData(VBoxDefs::GUI_Statusbar); 148 bool fToolbar = strToolbar.isEmpty() || strToolbar == "true"; 149 bool fStatusbar = strStatusbar.isEmpty() || strStatusbar == "true"; 150 151 /* Populate toolbar/statusbar acctions: */ 152 QList<QAction*> actions; 153 QAction *pShowToolBar = new QAction(tr("Show Toolbar"), 0); 154 pShowToolBar->setCheckable(true); 155 pShowToolBar->setChecked(fToolbar); 156 actions << pShowToolBar; 157 QAction *pShowStatusBar = new QAction(tr("Show Statusbar"), 0); 158 pShowStatusBar->setCheckable(true); 159 pShowStatusBar->setChecked(fStatusbar); 160 actions << pShowStatusBar; 161 162 QPoint gpos = pos; 163 QWidget *pSender = static_cast<QWidget*>(sender()); 164 if (pSender) 165 gpos = pSender->mapToGlobal(pos); 166 QAction *pResult = QMenu::exec(actions, gpos); 167 if (pResult == pShowToolBar) 168 { 169 if (pResult->isChecked()) 170 { 256 171 #ifdef Q_WS_MAC 257 UIWindowMenuManager::destroy(); 258 ::darwinUnregisterForUnifiedToolbarContextMenuEvents(this); 259 if (::darwinIsWindowMaximized(this)) 172 mVMToolBar->show(); 260 173 #else /* Q_WS_MAC */ 261 if (isMaximized())174 m_pBar->show(); 262 175 #endif /* !Q_WS_MAC */ 263 winPos += QString(",%1").arg(VBoxDefs::GUI_LastWindowState_Max); 264 265 vbox.SetExtraData(VBoxDefs::GUI_LastWindowPosition, winPos); 266 } 267 268 /* Save VM selector position */ 269 { 270 UIVMItem *item = mVMListView->selectedItem(); 271 QString curVMId = item ? 272 QString(item->id()) : 273 QString::null; 274 vbox.SetExtraData(VBoxDefs::GUI_LastVMSelected, curVMId); 275 vbox.SetExtraDataStringList(VBoxDefs::GUI_SelectorVMPositions, mVMModel->idList()); 276 } 277 278 /* Save the splitter handle position */ 279 { 280 vbox.SetExtraDataIntList(VBoxDefs::GUI_SplitterSizes, m_pSplitter->sizes()); 281 } 282 283 #ifdef VBOX_GUI_WITH_SYSTRAY 284 /* Delete systray menu object */ 285 delete mTrayIcon; 286 mTrayIcon = NULL; 287 #endif 288 289 /* Delete the items from our model */ 290 mVMModel->clear(); 291 } 292 293 // 294 // Public slots 295 ///////////////////////////////////////////////////////////////////////////// 296 297 void VBoxSelectorWnd::sltShowMediumManager() 298 { 176 vbox.SetExtraData(VBoxDefs::GUI_Toolbar, "true"); 177 } 178 else 179 { 180 #ifdef Q_WS_MAC 181 mVMToolBar->hide(); 182 #else /* Q_WS_MAC */ 183 m_pBar->hide(); 184 #endif /* !Q_WS_MAC */ 185 vbox.SetExtraData(VBoxDefs::GUI_Toolbar, "false"); 186 } 187 } 188 else if (pResult == pShowStatusBar) 189 { 190 if (pResult->isChecked()) 191 { 192 statusBar()->show(); 193 vbox.SetExtraData(VBoxDefs::GUI_Statusbar, "true"); 194 } 195 else 196 { 197 statusBar()->hide(); 198 vbox.SetExtraData(VBoxDefs::GUI_Statusbar, "false"); 199 } 200 } 201 } 202 203 void UISelectorWindow::sltShowMediumManager() 204 { 205 /* Show modeless Virtual Medium Manager: */ 299 206 VBoxMediaManagerDlg::showModeless(this); 300 207 } 301 208 302 void VBoxSelectorWnd::sltShowImportApplianceWizard(const QString &strFile /* = "" */) 303 { 209 void UISelectorWindow::sltShowImportApplianceWizard(const QString &strFileName /* = QString() */) 210 { 211 /* Show Import Appliance wizard: */ 304 212 #ifdef Q_WS_MAC 305 QString strTmpFile = ::darwinResolveAlias(strFile );213 QString strTmpFile = ::darwinResolveAlias(strFileName); 306 214 #else /* Q_WS_MAC */ 307 QString strTmpFile = strFile ;215 QString strTmpFile = strFileName; 308 216 #endif /* !Q_WS_MAC */ 309 UIImportApplianceWzd wzd(strTmpFile, this); 310 311 if ( strFile.isEmpty() 312 || wzd.isValid()) 313 wzd.exec(); 314 } 315 316 void VBoxSelectorWnd::sltShowExportApplianceWizard() 317 { 318 QString name; 319 320 UIVMItem *item = mVMListView->selectedItem(); 321 if (item) 322 name = item->name(); 323 324 UIExportApplianceWzd wzd(this, name); 325 326 wzd.exec(); 327 } 328 329 void VBoxSelectorWnd::sltShowPreferencesDialog() 217 UIImportApplianceWzd wizard(strTmpFile, this); 218 if (strFileName.isEmpty() || wizard.isValid()) 219 wizard.exec(); 220 } 221 222 void UISelectorWindow::sltShowExportApplianceWizard() 223 { 224 /* Show Export Appliance wizard: */ 225 QString strName; 226 if (UIVMItem *pItem = m_pVMListView->selectedItem()) 227 strName = pItem->name(); 228 UIExportApplianceWzd wizard(this, strName); 229 wizard.exec(); 230 } 231 232 void UISelectorWindow::sltShowPreferencesDialog() 330 233 { 331 234 /* Get corresponding action: */ 332 235 QAction *pShowPreferencesDialogAction = gActionPool->action(UIActionIndexSelector_Simple_File_PreferencesDialog); 333 334 236 /* Check that we do NOT handling that already: */ 335 237 if (pShowPreferencesDialogAction->data().toBool()) … … 339 241 340 242 /* Create and execute global settings dialog: */ 341 UISettingsDialogGlobal d lg(this);342 d lg.execute();243 UISettingsDialogGlobal dialog(this); 244 dialog.execute(); 343 245 344 246 /* Remember that we do NOT handling that already: */ … … 346 248 } 347 249 348 void VBoxSelectorWnd::sltPerformExit()250 void UISelectorWindow::sltPerformExit() 349 251 { 350 252 /* We have to check if there are any open windows beside this mainwindow … … 352 254 * different to Qt3 where a *mainWidget* exists & if this going to close 353 255 * all other windows are closed automatically. We do the same below. */ 354 foreach(QWidget *widget, QApplication::topLevelWidgets()) 355 { 356 if (widget->isVisible() && 357 widget != this) 358 widget->close(); 359 } 360 /* We close this widget last. */ 256 QWidgetList widgets = QApplication::topLevelWidgets(); 257 for(int i = 0; i < widgets.size(); ++i) 258 { 259 QWidget *pWidget = widgets[i]; 260 if (pWidget && pWidget->isVisible() && pWidget != this) 261 pWidget->close(); 262 } 263 /* We close this pWidget last: */ 361 264 close(); 362 265 } 363 266 364 void VBoxSelectorWnd::sltShowNewMachineWizard()365 { 366 UINewVMWzd wzd(this);367 if (wzd.exec() == QDialog::Accepted)368 {369 CMachine m = wzd.machine();370 371 /* wait until the list is updated by OnMachineRegistered() */267 void UISelectorWindow::sltShowNewMachineWizard() 268 { 269 /* Show New Machine wizard: */ 270 UINewVMWzd wizard(this); 271 if (wizard.exec() == QDialog::Accepted) 272 { 273 /* Wait until the list is updated by OnMachineRegistered(): */ 274 const CMachine &machine = wizard.machine(); 372 275 QModelIndex index; 373 276 while(!index.isValid()) 374 277 { 375 278 qApp->processEvents(); 376 index = mVMModel->indexById(m.GetId()); 377 } 378 mVMListView->setCurrentIndex(index); 379 } 380 } 381 382 void VBoxSelectorWnd::sltShowAddMachineDialog(const QString &strFile /* = "" */) 383 { 279 index = m_pVMModel->indexById(machine.GetId()); 280 } 281 /* Choose newly created item: */ 282 m_pVMListView->setCurrentIndex(index); 283 } 284 } 285 286 void UISelectorWindow::sltShowAddMachineDialog(const QString &strFileName /* = QString() */) 287 { 288 /* Initialize variables: */ 384 289 #ifdef Q_WS_MAC 385 QString strTmpFile = ::darwinResolveAlias(strFile );290 QString strTmpFile = ::darwinResolveAlias(strFileName); 386 291 #else /* Q_WS_MAC */ 387 QString strTmpFile = strFile ;292 QString strTmpFile = strFileName; 388 293 #endif /* !Q_WS_MAC */ 389 /* Initialize variables: */390 294 CVirtualBox vbox = vboxGlobal().virtualBox(); 391 295 if (strTmpFile.isEmpty()) … … 402 306 strTmpFile = fileNames.at(0); 403 307 } 308 309 /* Open corresponding machine: */ 404 310 if (!strTmpFile.isEmpty()) 405 311 { 406 /* Open corresponding machine: */407 312 CMachine newMachine = vbox.OpenMachine(strTmpFile); 408 313 /* First we should test what machine was opened: */ … … 417 322 /* Register that machine: */ 418 323 vbox.RegisterMachine(newMachine); 419 420 324 /* Wait until the list is updated by OnMachineRegistered(): */ 421 325 QModelIndex index; … … 423 327 { 424 328 qApp->processEvents(); 425 index = m VMModel->indexById(newMachine.GetId());329 index = m_pVMModel->indexById(newMachine.GetId()); 426 330 } 427 /* And choose the new machineitem: */428 m VMListView->setCurrentIndex(index);331 /* And choose added item: */ 332 m_pVMListView->setCurrentIndex(index); 429 333 } 430 334 else … … 436 340 } 437 341 438 /** 439 * Opens the VM settings dialog. 440 */ 441 void VBoxSelectorWnd::sltShowMachineSettingsDialog(const QString &strCategoryRef /* = QString::null */, 442 const QString &strControlRef /* = QString::null */, 443 const QString &strMachineId /* = QString::null */) 342 void UISelectorWindow::sltShowMachineSettingsDialog(const QString &strCategoryRef /* = QString() */, 343 const QString &strControlRef /* = QString() */, 344 const QString &strMachineId /* = QString() */) 444 345 { 445 346 /* Get corresponding action: */ 446 347 QAction *pShowSettingsDialogAction = gActionPool->action(UIActionIndexSelector_Simple_Machine_SettingsDialog); 447 448 348 /* Check that we do NOT handling that already: */ 449 349 if (pShowSettingsDialogAction->data().toBool()) … … 474 374 475 375 /* Don't show the inaccessible warning if the user tries to open VM settings: */ 476 m DoneInaccessibleWarningOnce = true;376 m_fDoneInaccessibleWarningOnce = true; 477 377 478 378 /* Get corresponding VM item: */ 479 UIVMItem *pItem = strMachineId.isNull() ? m VMListView->selectedItem() : mVMModel->itemById(strMachineId);379 UIVMItem *pItem = strMachineId.isNull() ? m_pVMListView->selectedItem() : m_pVMModel->itemById(strMachineId); 480 380 AssertMsgReturnVoid(pItem, ("Item must be always selected here!\n")); 481 381 482 382 /* Create and execute corresponding VM settings dialog: */ 483 UISettingsDialogMachine d lg(this, pItem->id(), strCategory, strControl);484 d lg.execute();383 UISettingsDialogMachine dialog(this, pItem->id(), strCategory, strControl); 384 dialog.execute(); 485 385 486 386 /* Remember that we do NOT handling that already: */ … … 488 388 } 489 389 490 void VBoxSelectorWnd::sltShowCloneMachineDialog(const QString &aUuid /* = QString::null */) 491 { 492 UIVMItem *item = aUuid.isNull() ? mVMListView->selectedItem() : mVMModel->itemById(aUuid); 493 494 AssertMsgReturnVoid(item, ("Item must be always selected here")); 495 496 CMachine machine = item->machine(); 497 498 UICloneVMWizard wzd(this, machine); 499 wzd.exec(); 500 } 501 502 void VBoxSelectorWnd::sltShowRemoveMachineDialog(const QString &aUuid /* = QString::null */) 503 { 504 UIVMItem *item = aUuid.isNull() ? mVMListView->selectedItem() : mVMModel->itemById(aUuid); 505 506 AssertMsgReturnVoid(item, ("Item must be always selected here")); 507 508 CMachine machine = item->machine(); 390 void UISelectorWindow::sltShowCloneMachineWizard(const QString &strMachineId /* = QString() */) 391 { 392 UIVMItem *pItem = strMachineId.isNull() ? m_pVMListView->selectedItem() : m_pVMModel->itemById(strMachineId); 393 AssertMsgReturnVoid(pItem, ("Item must be always selected here")); 394 395 /* Show clone VM wizard: */ 396 CMachine machine = pItem->machine(); 397 UICloneVMWizard wizard(this, machine); 398 wizard.exec(); 399 } 400 401 void UISelectorWindow::sltShowRemoveMachineDialog(const QString &strMachineId /* = QString() */) 402 { 403 UIVMItem *pItem = strMachineId.isNull() ? m_pVMListView->selectedItem() : m_pVMModel->itemById(strMachineId); 404 AssertMsgReturnVoid(pItem, ("Item must be always selected here")); 405 406 /* Show Remove Machine dialog: */ 407 CMachine machine = pItem->machine(); 509 408 int rc = msgCenter().confirmMachineDeletion(machine); 510 409 if (rc != QIMessageBox::Cancel) … … 520 419 if (machine.isOk()) 521 420 { 522 msgCenter().showModalProgressDialog(progress, item->name(), ":/progress_delete_90px.png", 0, true);421 msgCenter().showModalProgressDialog(progress, pItem->name(), ":/progress_delete_90px.png", 0, true); 523 422 if (progress.GetResultCode() != 0) 524 423 msgCenter().cannotDeleteMachine(machine, progress); … … 538 437 } 539 438 540 void VBoxSelectorWnd::sltPerformStartOrShowAction(const QString &aUuid /* = QString::null */) 541 { 542 QUuid uuid(aUuid); 543 UIVMItem *item = uuid.isNull() ? mVMListView->selectedItem() : 544 mVMModel->itemById(aUuid); 545 546 AssertMsgReturnVoid(item, ("Item must be always selected here")); 547 548 /* Are we called from the mVMListView's activated() signal? */ 439 void UISelectorWindow::sltPerformStartOrShowAction(const QString &strMachineId /* = QString() */) 440 { 441 QUuid uuid(strMachineId); 442 UIVMItem *pItem = uuid.isNull() ? m_pVMListView->selectedItem() : m_pVMModel->itemById(strMachineId); 443 AssertMsgReturnVoid(pItem, ("Item must be always selected here")); 444 445 /* Are we called from the m_pVMListView's activated() signal? */ 549 446 if (uuid.isNull()) 550 447 { 551 /* We always get here when m VMListView emits the activated() signal,448 /* We always get here when m_pVMListView emits the activated() signal, 552 449 * so we must explicitly check if the action is enabled or not. */ 553 450 if (!gActionPool->action(UIActionIndexSelector_State_Machine_StartOrShow)->isEnabled()) … … 555 452 } 556 453 557 AssertMsg(!vboxGlobal().isVMConsoleProcess(), 558 ("Must NOT be a VM console process")); 559 560 CMachine machine = item->machine(); 454 /* Start/show machine: */ 455 CMachine machine = pItem->machine(); 561 456 vboxGlobal().launchMachine(machine, qApp->keyboardModifiers() == Qt::ShiftModifier); 562 457 } 563 458 564 void VBoxSelectorWnd::sltPerformDiscardAction(const QString &aUuid /* = QString::null */) 565 { 566 UIVMItem *item = aUuid.isNull() ? mVMListView->selectedItem() : 567 mVMModel->itemById(aUuid); 568 569 AssertMsgReturnVoid(item, ("Item must be always selected here")); 570 571 if (!msgCenter().confirmDiscardSavedState(item->machine())) 572 return; 573 574 /* open a session to modify VM settings */ 575 QString id = item->id(); 459 void UISelectorWindow::sltPerformDiscardAction(const QString &strMachineId /* = QString() */) 460 { 461 UIVMItem *pItem = strMachineId.isNull() ? m_pVMListView->selectedItem() : m_pVMModel->itemById(strMachineId); 462 AssertMsgReturnVoid(pItem, ("Item must be always selected here")); 463 464 /* Confirm discarding current VM saved state: */ 465 if (!msgCenter().confirmDiscardSavedState(pItem->machine())) 466 return; 467 468 /* Open a session to modify VM settings: */ 469 QString strMachinId = pItem->id(); 576 470 CSession session; 577 471 CVirtualBox vbox = vboxGlobal().virtualBox(); … … 583 477 } 584 478 585 CMachine foundMachine = vbox.FindMachine(id); 586 if (!foundMachine.isNull()) 587 foundMachine.LockMachine(session, KLockType_Write); 479 /* Search for the correspoding machine: */ 480 CMachine machine = vbox.FindMachine(strMachinId); 481 if (!machine.isNull()) 482 machine.LockMachine(session, KLockType_Write); 588 483 if (!vbox.isOk()) 589 484 { 590 msgCenter().cannotOpenSession(vbox, item->machine()); 591 return; 592 } 593 485 msgCenter().cannotOpenSession(vbox, pItem->machine()); 486 return; 487 } 488 489 /* Get session console: */ 594 490 CConsole console = session.GetConsole(); 595 491 console.DiscardSavedState(true /* fDeleteFile */); … … 597 493 msgCenter().cannotDiscardSavedState(console); 598 494 495 /* Unlock machine finally: */ 599 496 session.UnlockMachine(); 600 497 } 601 498 602 void VBoxSelectorWnd::sltPerformPauseResumeAction(bool aPause, const QString &aUuid /* = QString::null */) 603 { 604 UIVMItem *item = aUuid.isNull() ? mVMListView->selectedItem() : 605 mVMModel->itemById(aUuid); 606 607 AssertMsgReturnVoid(item, ("Item must be always selected here")); 608 609 CSession session = vboxGlobal().openExistingSession(item->id()); 499 void UISelectorWindow::sltPerformPauseResumeAction(bool fPause, const QString &strMachineId /* = QString() */) 500 { 501 UIVMItem *pItem = strMachineId.isNull() ? m_pVMListView->selectedItem() : m_pVMModel->itemById(strMachineId); 502 AssertMsgReturnVoid(pItem, ("Item must be always selected here")); 503 504 /* Open a session to modify VM state: */ 505 CSession session = vboxGlobal().openExistingSession(pItem->id()); 610 506 if (session.isNull()) 611 507 return; 612 508 509 /* Get session console: */ 613 510 CConsole console = session.GetConsole(); 614 511 if (console.isNull()) 615 512 return; 616 513 617 if (aPause) 514 /* Pause/resume VM: */ 515 if (fPause) 618 516 console.Pause(); 619 517 else … … 623 521 if (!ok) 624 522 { 625 if ( aPause)523 if (fPause) 626 524 msgCenter().cannotPauseMachine(console); 627 525 else … … 629 527 } 630 528 529 /* Unlock machine finally: */ 631 530 session.UnlockMachine(); 632 531 } 633 532 634 void VBoxSelectorWnd::sltPerformResetAction(const QString &aUuid /* = QString::null */) 635 { 636 UIVMItem *item = aUuid.isNull() ? mVMListView->selectedItem() : 637 mVMModel->itemById(aUuid); 638 639 AssertMsgReturnVoid(item, ("Item must be always selected here")); 640 641 /* Confirm/Reset current console: */ 642 if (msgCenter().confirmVMReset(this)) 643 { 644 CSession session = vboxGlobal().openExistingSession(item->id()); 645 if (session.isNull()) 646 return; 647 648 CConsole console = session.GetConsole(); 649 if (console.isNull()) 650 return; 651 652 console.Reset(); 653 } 654 } 655 656 void VBoxSelectorWnd::sltPerformACPIShutdownAction(const QString &aUuid /* = QString::null */) 657 { 658 UIVMItem *item = aUuid.isNull() ? mVMListView->selectedItem() : 659 mVMModel->itemById(aUuid); 660 661 AssertMsgReturnVoid(item, ("Item must be always selected here")); 662 663 /* Confirm/Reset current console: */ 664 if (msgCenter().confirmVMReset(this)) 665 { 666 CSession session = vboxGlobal().openExistingSession(item->id()); 667 if (session.isNull()) 668 return; 669 670 CConsole console = session.GetConsole(); 671 if (console.isNull()) 672 return; 673 674 console.PowerButton(); 675 676 session.UnlockMachine(); 677 } 678 } 679 680 void VBoxSelectorWnd::sltPerformPowerOffAction(const QString &aUuid /* = QString::null */) 681 { 682 UIVMItem *item = aUuid.isNull() ? mVMListView->selectedItem() : 683 mVMModel->itemById(aUuid); 684 685 AssertMsgReturnVoid(item, ("Item must be always selected here")); 686 687 /* Confirm/Reset current console: */ 688 if (msgCenter().confirmVMPowerOff(this)) 689 { 690 CSession session = vboxGlobal().openExistingSession(item->id()); 691 if (session.isNull()) 692 return; 693 694 CConsole console = session.GetConsole(); 695 if (console.isNull()) 696 return; 697 698 console.PowerDown(); 699 700 session.UnlockMachine(); 701 } 702 } 703 704 void VBoxSelectorWnd::sltPerformRefreshAction(const QString &aUuid /* = QString::null */) 705 { 706 UIVMItem *item = aUuid.isNull() ? mVMListView->selectedItem() : 707 mVMModel->itemById(aUuid); 708 709 AssertMsgReturnVoid(item, ("Item must be always selected here")); 710 711 refreshVMItem(item->id(), 712 true /* aDetails */, 713 true /* aSnapshot */, 714 true /* aDescription */); 715 } 716 717 void VBoxSelectorWnd::sltShowLogDialog(const QString &aUuid /* = QString::null */) 718 { 719 UIVMItem *item = aUuid.isNull() ? mVMListView->selectedItem() : 720 mVMModel->itemById(aUuid); 721 722 AssertMsgReturnVoid(item, ("Item must be always selected here")); 723 724 CMachine machine = item->machine(); 533 void UISelectorWindow::sltPerformResetAction(const QString &strMachineId /* = QString() */) 534 { 535 UIVMItem *pItem = strMachineId.isNull() ? m_pVMListView->selectedItem() : m_pVMModel->itemById(strMachineId); 536 AssertMsgReturnVoid(pItem, ("Item must be always selected here")); 537 538 /* Confirm reseting current VM: */ 539 if (!msgCenter().confirmVMReset(this)) 540 return; 541 542 /* Open a session to modify VM state: */ 543 CSession session = vboxGlobal().openExistingSession(pItem->id()); 544 if (session.isNull()) 545 return; 546 547 /* Get session console: */ 548 CConsole console = session.GetConsole(); 549 if (console.isNull()) 550 return; 551 552 /* Reset VM: */ 553 console.Reset(); 554 555 /* Unlock machine finally: */ 556 session.UnlockMachine(); 557 } 558 559 void UISelectorWindow::sltPerformACPIShutdownAction(const QString &strMachineId /* = QString() */) 560 { 561 UIVMItem *pItem = strMachineId.isNull() ? m_pVMListView->selectedItem() : m_pVMModel->itemById(strMachineId); 562 AssertMsgReturnVoid(pItem, ("Item must be always selected here")); 563 564 /* Confirm ACPI shutdown current VM: */ 565 if (!msgCenter().confirmVMACPIShutdown(this)) 566 return; 567 568 /* Open a session to modify VM state: */ 569 CSession session = vboxGlobal().openExistingSession(pItem->id()); 570 if (session.isNull()) 571 return; 572 573 /* Get session console: */ 574 CConsole console = session.GetConsole(); 575 if (console.isNull()) 576 return; 577 578 /* ACPI Shutdown: */ 579 console.PowerButton(); 580 581 /* Unlock machine finally: */ 582 session.UnlockMachine(); 583 } 584 585 void UISelectorWindow::sltPerformPowerOffAction(const QString &strMachineId /* = QString() */) 586 { 587 UIVMItem *pItem = strMachineId.isNull() ? m_pVMListView->selectedItem() : m_pVMModel->itemById(strMachineId); 588 AssertMsgReturnVoid(pItem, ("Item must be always selected here")); 589 590 /* Confirm Power Off current VM: */ 591 if (!msgCenter().confirmVMPowerOff(this)) 592 return; 593 594 /* Open a session to modify VM state: */ 595 CSession session = vboxGlobal().openExistingSession(pItem->id()); 596 if (session.isNull()) 597 return; 598 599 /* Get session console: */ 600 CConsole console = session.GetConsole(); 601 if (console.isNull()) 602 return; 603 604 /* Power Off: */ 605 console.PowerDown(); 606 607 /* Unlock machine finally: */ 608 session.UnlockMachine(); 609 } 610 611 void UISelectorWindow::sltPerformRefreshAction(const QString &strMachineId /* = QString() */) 612 { 613 UIVMItem *pItem = strMachineId.isNull() ? m_pVMListView->selectedItem() : m_pVMModel->itemById(strMachineId); 614 AssertMsgReturnVoid(pItem, ("Item must be always selected here")); 615 616 /* Refresh currently selected VM item: */ 617 sltRefreshVMItem(pItem->id(), true /* details */, true /* snapshot */, true /* description */); 618 } 619 620 void UISelectorWindow::sltShowLogDialog(const QString &strMachineId /* = QString() */) 621 { 622 UIVMItem *pItem = strMachineId.isNull() ? m_pVMListView->selectedItem() : m_pVMModel->itemById(strMachineId); 623 AssertMsgReturnVoid(pItem, ("Item must be always selected here")); 624 625 /* Show VM Log Viewer: */ 626 const CMachine &machine = pItem->machine(); 725 627 UIVMLogViewer::showLogViewerFor(this, machine); 726 628 } 727 629 728 void VBoxSelectorWnd::sltShowMachineInFileManager(const QString &aUuid /* = QString::null */) 729 { 730 UIVMItem *item = aUuid.isNull() ? mVMListView->selectedItem() : 731 mVMModel->itemById(aUuid); 732 733 AssertMsgReturnVoid(item, ("Item must be always selected here")); 734 735 CMachine machine = item->machine(); 630 void UISelectorWindow::sltShowMachineInFileManager(const QString &strMachineId /* = QString() */) 631 { 632 UIVMItem *pItem = strMachineId.isNull() ? m_pVMListView->selectedItem() : m_pVMModel->itemById(strMachineId); 633 AssertMsgReturnVoid(pItem, ("Item must be always selected here")); 634 635 /* Show VM in filebrowser: */ 636 const CMachine &machine = pItem->machine(); 736 637 UIDesktopServices::openInFileManager(machine.GetSettingsFilePath()); 737 638 } 738 639 739 void VBoxSelectorWnd::sltPerformCreateShortcutAction(const QString &aUuid /* = QString::null */) 740 { 741 UIVMItem *item = aUuid.isNull() ? mVMListView->selectedItem() : 742 mVMModel->itemById(aUuid); 743 744 AssertMsgReturnVoid(item, ("Item must be always selected here")); 745 746 CMachine machine = item->machine(); 747 UIDesktopServices::createMachineShortcut(machine.GetSettingsFilePath(), QDesktopServices::storageLocation(QDesktopServices::DesktopLocation), machine.GetName(), machine.GetId()); 748 } 749 750 void VBoxSelectorWnd::sltPerformSortAction(const QString &aUuid /* = QString::null */) 751 { 752 UIVMItem *item = aUuid.isNull() ? mVMListView->selectedItem() : 753 mVMModel->itemById(aUuid); 754 const QString oldId = item->id(); 755 756 AssertMsgReturnVoid(item, ("Item must be always selected here")); 757 758 mVMModel->sortByIdList(QStringList(), 759 qApp->keyboardModifiers() == Qt::ShiftModifier ? Qt::DescendingOrder : Qt::AscendingOrder); 640 void UISelectorWindow::sltPerformCreateShortcutAction(const QString &strMachineId /* = QString() */) 641 { 642 UIVMItem *pItem = strMachineId.isNull() ? m_pVMListView->selectedItem() : m_pVMModel->itemById(strMachineId); 643 AssertMsgReturnVoid(pItem, ("Item must be always selected here")); 644 645 /* Create shortcut for this VM: */ 646 const CMachine &machine = pItem->machine(); 647 UIDesktopServices::createMachineShortcut(machine.GetSettingsFilePath(), 648 QDesktopServices::storageLocation(QDesktopServices::DesktopLocation), 649 machine.GetName(), machine.GetId()); 650 } 651 652 void UISelectorWindow::sltPerformSortAction(const QString &strMachineId /* = QString() */) 653 { 654 UIVMItem *pItem = strMachineId.isNull() ? m_pVMListView->selectedItem() : m_pVMModel->itemById(strMachineId); 655 AssertMsgReturnVoid(pItem, ("Item must be always selected here")); 656 657 /* Sort VM list: */ 658 const QString strOldId = pItem->id(); 659 m_pVMModel->sortByIdList(QStringList(), qApp->keyboardModifiers() == Qt::ShiftModifier ? Qt::DescendingOrder : Qt::AscendingOrder); 760 660 /* Select the VM which was selected before */ 761 m VMListView->selectItemById(oldId);762 } 763 764 void VBoxSelectorWnd::sltMachineMenuAboutToShow()765 { 766 UIVMItem *pItem = m VMListView->selectedItem();661 m_pVMListView->selectItemById(strOldId); 662 } 663 664 void UISelectorWindow::sltMachineMenuAboutToShow() 665 { 666 UIVMItem *pItem = m_pVMListView->selectedItem(); 767 667 AssertMsgReturnVoid(pItem, ("Item must be always selected here")); 768 668 … … 774 674 } 775 675 776 void VBoxSelectorWnd::sltMachineCloseMenuAboutToShow()777 { 778 UIVMItem *pItem = m VMListView->selectedItem();676 void UISelectorWindow::sltMachineCloseMenuAboutToShow() 677 { 678 UIVMItem *pItem = m_pVMListView->selectedItem(); 779 679 AssertMsgReturnVoid(pItem, ("Item must be always selected here")); 780 680 … … 795 695 } 796 696 797 void VBoxSelectorWnd::sltMachineContextMenuHovered(QAction *pAction) 798 { 697 void UISelectorWindow::sltMachineContextMenuHovered(QAction *pAction) 698 { 699 /* Update statusbar with howered action status text: */ 799 700 statusBar()->showMessage(pAction->statusTip()); 800 701 } 801 702 802 void VBoxSelectorWnd::refreshVMList() 803 { 703 void UISelectorWindow::sltRefreshVMList() 704 { 705 /* Refresh VM list: */ 804 706 CVirtualBox vbox = vboxGlobal().virtualBox(); 805 CMachineVector vec = vbox.GetMachines(); 806 for (CMachineVector::ConstIterator m = vec.begin(); 807 m != vec.end(); ++m) 808 mVMModel->addItem(*m); 707 CMachineVector machines = vbox.GetMachines(); 708 for (CMachineVector::ConstIterator m = machines.begin(); m != machines.end(); ++m) 709 m_pVMModel->addItem(*m); 809 710 /* Apply the saved sort order. */ 810 m VMModel->sortByIdList(vbox.GetExtraDataStringList(VBoxDefs::GUI_SelectorVMPositions));711 m_pVMModel->sortByIdList(vbox.GetExtraDataStringList(VBoxDefs::GUI_SelectorVMPositions)); 811 712 /* Update details page. */ 812 vmListViewCurrentChanged(); 813 713 sltCurrentVMItemChanged(); 814 714 #ifdef VBOX_GUI_WITH_SYSTRAY 815 715 if (vboxGlobal().isTrayMenu()) 816 mTrayIcon->refresh(); 817 #endif 818 } 819 820 void VBoxSelectorWnd::refreshVMItem(const QString &aID, 821 bool aDetails, 822 bool aSnapshots, 823 bool aDescription) 824 { 825 UIVMItem *item = mVMModel->itemById(aID); 826 if (item) 827 { 828 mVMModel->refreshItem(item); 829 if (item && item->id() == aID) 830 vmListViewCurrentChanged(aDetails, aSnapshots, aDescription); 831 } 832 } 833 834 void VBoxSelectorWnd::showContextMenu(const QPoint &aPoint) 835 { 836 const QModelIndex &index = mVMListView->indexAt(aPoint); 837 if (index.isValid() && mVMListView->model()->data(index, UIVMItemModel::UIVMItemPtrRole).value<UIVMItem*>()) 838 { 839 /* Show 'Machine' menu as context one: */ 840 m_pMachineContextMenu->exec(mVMListView->mapToGlobal(aPoint)); 716 m_pTrayIcon->refresh(); 717 #endif /* VBOX_GUI_WITH_SYSTRAY */ 718 } 719 720 void UISelectorWindow::sltRefreshVMItem(const QString &strMachineId, bool fDetails, bool fSnapshots, bool fDescription) 721 { 722 /* Refresh VM item: */ 723 UIVMItem *pItem = m_pVMModel->itemById(strMachineId); 724 if (pItem) 725 { 726 m_pVMModel->refreshItem(pItem); 727 if (pItem && pItem->id() == strMachineId) 728 sltCurrentVMItemChanged(fDetails, fSnapshots, fDescription); 729 } 730 } 731 732 void UISelectorWindow::sltShowContextMenu(const QPoint &point) 733 { 734 /* Show VM list context menu: */ 735 const QModelIndex &index = m_pVMListView->indexAt(point); 736 if (index.isValid() && m_pVMListView->model()->data(index, UIVMItemModel::UIVMItemPtrRole).value<UIVMItem*>()) 737 { 738 m_pMachineContextMenu->exec(m_pVMListView->mapToGlobal(point)); 841 739 /* Make sure every status bar hint from the context menu is cleared when the menu is closed: */ 842 740 statusBar()->clearMessage(); … … 844 742 } 845 743 846 void VBoxSelectorWnd::sltOpenUrls(QList<QUrl> list /* = QList<QUrl>() */) 847 { 848 /* Make sure any pending D&D events are consumed. */ 849 qApp->processEvents(); 850 if (list.isEmpty()) 851 { 852 list = vboxGlobal().argUrlList(); 853 vboxGlobal().argUrlList().clear(); 854 } 855 /* Check if we are can handle the dropped urls. */ 856 for (int i = 0; i < list.size(); ++i) 857 { 858 #ifdef Q_WS_MAC 859 QString strFile = ::darwinResolveAlias(list.at(i).toLocalFile()); 860 #else /* Q_WS_MAC */ 861 QString strFile = list.at(i).toLocalFile(); 862 #endif /* !Q_WS_MAC */ 863 if ( !strFile.isEmpty() 864 && QFile::exists(strFile)) 865 { 866 if (VBoxGlobal::hasAllowedExtension(strFile, VBoxDefs::VBoxFileExts)) 867 { 868 /* VBox config files. */ 869 CVirtualBox vbox = vboxGlobal().virtualBox(); 870 CMachine machine = vbox.FindMachine(strFile); 871 if (!machine.isNull()) 872 { 873 CVirtualBox vbox = vboxGlobal().virtualBox(); 874 CMachine machine = vbox.FindMachine(strFile); 875 if (!machine.isNull()) 876 vboxGlobal().launchMachine(machine); 877 }else 878 sltShowAddMachineDialog(strFile); 879 } 880 else if (VBoxGlobal::hasAllowedExtension(strFile, VBoxDefs::OVFFileExts)) 881 { 882 /* OVF/OVA. Only one file at the time. */ 883 sltShowImportApplianceWizard(strFile); 884 break; 885 } 886 else if (VBoxGlobal::hasAllowedExtension(strFile, VBoxDefs::VBoxExtPackFileExts)) 887 { 888 UIGlobalSettingsExtension::doInstallation(strFile, this, NULL); 889 } 890 } 891 } 892 } 893 894 #ifdef VBOX_GUI_WITH_SYSTRAY 895 896 void VBoxSelectorWnd::trayIconActivated(QSystemTrayIcon::ActivationReason aReason) 897 { 898 switch (aReason) 899 { 900 case QSystemTrayIcon::Context: 901 902 mTrayIcon->refresh(); 903 break; 904 905 case QSystemTrayIcon::Trigger: 906 break; 907 908 case QSystemTrayIcon::DoubleClick: 909 910 vboxGlobal().trayIconShowSelector(); 911 break; 912 913 case QSystemTrayIcon::MiddleClick: 914 break; 915 916 default: 917 break; 918 } 919 } 920 921 void VBoxSelectorWnd::showWindow() 922 { 923 showNormal(); 924 raise(); 925 activateWindow(); 926 } 927 928 #endif // VBOX_GUI_WITH_SYSTRAY 929 930 // Protected members 931 ///////////////////////////////////////////////////////////////////////////// 932 933 bool VBoxSelectorWnd::event(QEvent *e) 934 { 935 switch (e->type()) 936 { 937 /* By handling every Resize and Move we keep track of the normal 938 * (non-minimized and non-maximized) window geometry. Shame on Qt 939 * that it doesn't provide this geometry in its public APIs. */ 940 941 case QEvent::Resize: 942 { 943 QResizeEvent *re = (QResizeEvent *) e; 944 if ((windowState() & (Qt::WindowMaximized | Qt::WindowMinimized | 945 Qt::WindowFullScreen)) == 0) 946 mNormalGeo.setSize(re->size()); 947 break; 948 } 949 case QEvent::Move: 950 { 951 if ((windowState() & (Qt::WindowMaximized | Qt::WindowMinimized | 952 Qt::WindowFullScreen)) == 0) 953 mNormalGeo.moveTo(geometry().x(), geometry().y()); 954 break; 955 } 956 case QEvent::WindowDeactivate: 957 { 958 /* Make sure every status bar hint is cleared when the window lost 959 * focus. */ 960 statusBar()->clearMessage(); 961 break; 962 } 963 #ifdef Q_WS_MAC 964 case QEvent::ContextMenu: 965 { 966 /* This is the unified context menu event. Lets show the context 967 * menu. */ 968 QContextMenuEvent *pCE = static_cast<QContextMenuEvent*>(e); 969 showViewContextMenu(pCE->globalPos()); 970 /* Accept it to interrupt the chain. */ 971 pCE->accept(); 972 return false; 973 break; 974 } 975 case QEvent::ToolBarChange: 976 { 977 CVirtualBox vbox = vboxGlobal().virtualBox(); 978 /* We have to invert the isVisible check one time, cause this event 979 * is sent *before* the real toggle is done. Really intuitive 980 * Trolls. */ 981 vbox.SetExtraData(VBoxDefs::GUI_Toolbar, !::darwinIsToolbarVisible(mVMToolBar) ? "true" : "false"); 982 break; 983 } 984 #endif /* Q_WS_MAC */ 985 default: 986 break; 987 } 988 989 return QMainWindow::event(e); 990 } 991 992 void VBoxSelectorWnd::closeEvent(QCloseEvent *aEvent) 993 { 994 #ifdef VBOX_GUI_WITH_SYSTRAY 995 /* Needed for breaking out of the while() loop in main(). */ 996 if (vboxGlobal().isTrayMenu()) 997 vboxGlobal().setTrayMenu(false); 998 #endif 999 1000 emit closing(); 1001 QMainWindow::closeEvent(aEvent); 1002 } 1003 1004 #ifdef Q_WS_MAC 1005 bool VBoxSelectorWnd::eventFilter(QObject *pObject, QEvent *pEvent) 1006 { 1007 if (!isActiveWindow()) 1008 return QIWithRetranslateUI2<QMainWindow>::eventFilter(pObject, pEvent); 1009 1010 if (qobject_cast<QWidget*>(pObject) && 1011 qobject_cast<QWidget*>(pObject)->window() != this) 1012 return QIWithRetranslateUI2<QMainWindow>::eventFilter(pObject, pEvent); 1013 1014 switch (pEvent->type()) 1015 { 1016 case QEvent::FileOpen: 1017 { 1018 sltOpenUrls(QList<QUrl>() << static_cast<QFileOpenEvent*>(pEvent)->file()); 1019 pEvent->accept(); 1020 return true; 1021 break; 1022 } 1023 # if (QT_VERSION < 0x040402) 1024 case QEvent::KeyPress: 1025 { 1026 /* Bug in Qt below 4.4.2. The key events are send to the current 1027 * window even if a menu is shown & has the focus. See 1028 * http://trolltech.com/developer/task-tracker/index_html?method=entry&id=214681. */ 1029 if (::darwinIsMenuOpen()) 1030 return true; 1031 break; 1032 } 1033 # endif 1034 default: 1035 break; 1036 } 1037 return QIWithRetranslateUI2<QMainWindow>::eventFilter(pObject, pEvent); 1038 } 1039 #endif /* Q_WS_MAC */ 1040 1041 /** 1042 * Sets the strings of the subwidgets using the current 1043 * language. 1044 */ 1045 void VBoxSelectorWnd::retranslateUi() 1046 { 1047 QString title(VBOX_PRODUCT); 1048 title += " " + tr("Manager", "Note: main window title which is pretended by the product name."); 1049 1050 #ifdef VBOX_BLEEDING_EDGE 1051 title += QString(" EXPERIMENTAL build ") 1052 + QString(RTBldCfgVersion()) 1053 + QString(" r") 1054 + QString(RTBldCfgRevisionStr()) 1055 + QString(" - "VBOX_BLEEDING_EDGE); 1056 #endif 1057 1058 setWindowTitle(title); 1059 1060 /* ensure the details and screenshot view are updated */ 1061 vmListViewCurrentChanged(); 1062 1063 #ifdef VBOX_GUI_WITH_SYSTRAY 1064 if (vboxGlobal().isTrayMenu()) 1065 { 1066 mTrayIcon->retranslateUi(); 1067 mTrayIcon->refresh(); 1068 } 1069 #endif 1070 1071 #ifdef QT_MAC_USE_COCOA 1072 /* There is a bug in Qt Cocoa which result in showing a "more arrow" when 1073 the necessary size of the toolbar is increased. Also for some languages 1074 the with doesn't match if the text increase. So manually adjust the size 1075 after changing the text. */ 1076 mVMToolBar->updateLayout(); 1077 #endif /* QT_MAC_USE_COCOA */ 1078 } 1079 1080 1081 // Private members 1082 ///////////////////////////////////////////////////////////////////////////// 1083 1084 // 1085 // Private slots 1086 ///////////////////////////////////////////////////////////////////////////// 1087 1088 void VBoxSelectorWnd::vmListViewCurrentChanged(bool aRefreshDetails, 1089 bool aRefreshSnapshots, 1090 bool aRefreshDescription) 1091 { 1092 UIVMItem *item = mVMListView->selectedItem(); 744 void UISelectorWindow::sltCurrentVMItemChanged(bool fRefreshDetails, bool fRefreshSnapshots, bool fRefreshDescription) 745 { 746 UIVMItem *pItem = m_pVMListView->selectedItem(); 1093 747 UIActionInterface *pStartOrShowAction = gActionPool->action(UIActionIndexSelector_State_Machine_StartOrShow); 1094 748 1095 if (item && item->accessible()) 1096 { 1097 CMachine m = item->machine(); 1098 1099 KMachineState state = item->machineState(); 1100 bool fSessionLocked = item->sessionState() != KSessionState_Unlocked; 749 /* If currently selected VM item is accessible: */ 750 if (pItem && pItem->accessible()) 751 { 752 CMachine m = pItem->machine(); 753 754 KMachineState state = pItem->machineState(); 755 bool fSessionLocked = pItem->sessionState() != KSessionState_Unlocked; 1101 756 bool fModifyEnabled = state != KMachineState_Stuck && 1102 757 state != KMachineState_Saved /* for now! */; … … 1105 760 state == KMachineState_LiveSnapshotting; 1106 761 bool fPaused = state == KMachineState_Paused || 1107 state == KMachineState_TeleportingPausedVM; /** @todo Live Migration: does this make sense? */ 1108 1109 if ( aRefreshDetails 1110 || aRefreshDescription) 1111 m_pVMDesktop->updateDetails(item, m); 1112 if (aRefreshSnapshots) 1113 m_pVMDesktop->updateSnapshots(item, m); 1114 // if (aRefreshDescription) 1115 // m_pVMDesktop->updateDescription(item, m); 1116 1117 /* enable/disable modify actions */ 762 state == KMachineState_TeleportingPausedVM; 763 764 if (fRefreshDetails || fRefreshDescription) 765 m_pVMDesktop->updateDetails(pItem, m); 766 if (fRefreshSnapshots) 767 m_pVMDesktop->updateSnapshots(pItem, m); 768 // if (fRefreshDescription) 769 // m_pVMDesktop->updateDescription(pItem, m); 770 771 /* Enable/disable actions: */ 1118 772 gActionPool->action(UIActionIndexSelector_Simple_Machine_SettingsDialog)->setEnabled(fModifyEnabled); 1119 773 gActionPool->action(UIActionIndexSelector_Simple_Machine_CloneWizard)->setEnabled(!fSessionLocked); … … 1125 779 gActionPool->action(UIActionIndexSelector_Simple_Machine_Close_PowerOff)->setEnabled(fRunning || fPaused); 1126 780 1127 /* change the Start button text accordingly */ 1128 if ( state == KMachineState_PoweredOff 1129 || state == KMachineState_Saved 1130 || state == KMachineState_Teleported 1131 || state == KMachineState_Aborted 1132 ) 781 /* Change the Start button text accordingly: */ 782 if (state == KMachineState_PoweredOff || 783 state == KMachineState_Saved || 784 state == KMachineState_Teleported || 785 state == KMachineState_Aborted) 1133 786 { 1134 787 pStartOrShowAction->setState(1); … … 1145 798 { 1146 799 pStartOrShowAction->setState(2); 1147 pStartOrShowAction->setEnabled( item->canSwitchTo());800 pStartOrShowAction->setEnabled(pItem->canSwitchTo()); 1148 801 #ifdef QT_MAC_USE_COCOA 1149 802 /* There is a bug in Qt Cocoa which result in showing a "more arrow" when … … 1170 823 gActionPool->action(UIActionIndexSelector_Toggle_Machine_PauseAndResume)->updateAppearance(); 1171 824 1172 /* disable Refresh for accessible machines*/825 /* Disable Refresh for accessible machines: */ 1173 826 gActionPool->action(UIActionIndexSelector_Simple_Machine_Refresh)->setEnabled(false); 1174 827 1175 /* enable the show log item for the selected vm*/828 /* Enable the show log item for the selected vm: */ 1176 829 gActionPool->action(UIActionIndexSelector_Simple_Machine_LogDialog)->setEnabled(true); 1177 /* Enable the shell interaction features .*/830 /* Enable the shell interaction features: */ 1178 831 gActionPool->action(UIActionIndexSelector_Simple_Machine_ShowInFileManager)->setEnabled(true); 1179 832 #ifdef Q_WS_MAC 1180 833 /* On Mac OS X this are real alias files, which don't work with the old 1181 * legacy xml files. On the other OS's some kind of start up script is 1182 * used. */ 1183 gActionPool->action(UIActionIndexSelector_Simple_Machine_CreateShortcut)->setEnabled(item->settingsFile().endsWith(".vbox", Qt::CaseInsensitive)); 834 * legacy xml files. On the other OS's some kind of start up script is used. */ 835 gActionPool->action(UIActionIndexSelector_Simple_Machine_CreateShortcut)->setEnabled(pItem->settingsFile().endsWith(".vbox", Qt::CaseInsensitive)); 1184 836 #else /* Q_WS_MAC */ 1185 837 gActionPool->action(UIActionIndexSelector_Simple_Machine_CreateShortcut)->setEnabled(true); … … 1187 839 gActionPool->action(UIActionIndexSelector_Simple_Machine_Sort)->setEnabled(true); 1188 840 } 841 /* If currently selected VM item is NOT accessible: */ 1189 842 else 1190 843 { 1191 844 /* Note that the machine becomes inaccessible (or if the last VM gets 1192 * deleted), we have to update all fields, ignoring input 1193 * arguments. */ 1194 1195 if (item) 1196 { 1197 /* the VM is inaccessible */ 1198 m_pVMDesktop->updateDetailsErrorText(UIMessageCenter::formatErrorInfo(item->accessError())); 845 * deleted), we have to update all fields, ignoring input arguments. */ 846 if (pItem) 847 { 848 /* The VM is inaccessible */ 849 m_pVMDesktop->updateDetailsErrorText(UIMessageCenter::formatErrorInfo(pItem->accessError())); 1199 850 gActionPool->action(UIActionIndexSelector_Simple_Machine_Refresh)->setEnabled(true); 1200 851 } 1201 852 else 1202 853 { 1203 /* default HTML support in Qt is terrible so just try to get 1204 * something really simple */ 854 /* default HTML support in Qt is terrible so just try to get something really simple: */ 1205 855 m_pVMDesktop->updateDetailsText( 1206 856 tr("<h3>" … … 1221 871 } 1222 872 1223 /* empty and disable other tabs*/873 /* Empty and disable other tabs: */ 1224 874 m_pVMDesktop->updateSnapshots(0, CMachine()); 1225 875 // m_pVMDesktop->updateDescription(0, CMachine()); … … 1228 878 gActionPool->action(UIActionIndexSelector_Simple_Machine_SettingsDialog)->setEnabled(false); 1229 879 gActionPool->action(UIActionIndexSelector_Simple_Machine_CloneWizard)->setEnabled(false); 1230 gActionPool->action(UIActionIndexSelector_Simple_Machine_RemoveDialog)->setEnabled( item != NULL);880 gActionPool->action(UIActionIndexSelector_Simple_Machine_RemoveDialog)->setEnabled(pItem != NULL); 1231 881 gActionPool->action(UIActionIndexSelector_Simple_Machine_Discard)->setEnabled(false); 1232 882 gActionPool->action(UIActionIndexSelector_Toggle_Machine_PauseAndResume)->setEnabled(false); … … 1249 899 } 1250 900 1251 void VBoxSelectorWnd::mediumEnumStarted() 1252 { 1253 /* refresh the current details to pick up hard disk sizes */ 1254 vmListViewCurrentChanged(true /* aRefreshDetails */); 1255 } 1256 1257 void VBoxSelectorWnd::mediumEnumFinished(const VBoxMediaList &list) 1258 { 1259 /* refresh the current details to pick up hard disk sizes */ 1260 vmListViewCurrentChanged(true /* aRefreshDetails */); 1261 1262 /* we warn about inaccessible media only once (after media emumeration 901 void UISelectorWindow::sltOpenUrls(QList<QUrl> list /* = QList<QUrl>() */) 902 { 903 /* Make sure any pending D&D events are consumed. */ 904 qApp->processEvents(); 905 if (list.isEmpty()) 906 { 907 list = vboxGlobal().argUrlList(); 908 vboxGlobal().argUrlList().clear(); 909 } 910 /* Check if we are can handle the dropped urls. */ 911 for (int i = 0; i < list.size(); ++i) 912 { 913 #ifdef Q_WS_MAC 914 QString strFile = ::darwinResolveAlias(list.at(i).toLocalFile()); 915 #else /* Q_WS_MAC */ 916 QString strFile = list.at(i).toLocalFile(); 917 #endif /* !Q_WS_MAC */ 918 if (!strFile.isEmpty() && QFile::exists(strFile)) 919 { 920 if (VBoxGlobal::hasAllowedExtension(strFile, VBoxDefs::VBoxFileExts)) 921 { 922 /* VBox config files. */ 923 CVirtualBox vbox = vboxGlobal().virtualBox(); 924 CMachine machine = vbox.FindMachine(strFile); 925 if (!machine.isNull()) 926 { 927 CVirtualBox vbox = vboxGlobal().virtualBox(); 928 CMachine machine = vbox.FindMachine(strFile); 929 if (!machine.isNull()) 930 vboxGlobal().launchMachine(machine); 931 } 932 else 933 sltShowAddMachineDialog(strFile); 934 } 935 else if (VBoxGlobal::hasAllowedExtension(strFile, VBoxDefs::OVFFileExts)) 936 { 937 /* OVF/OVA. Only one file at the time. */ 938 sltShowImportApplianceWizard(strFile); 939 break; 940 } 941 else if (VBoxGlobal::hasAllowedExtension(strFile, VBoxDefs::VBoxExtPackFileExts)) 942 { 943 UIGlobalSettingsExtension::doInstallation(strFile, this, NULL); 944 } 945 } 946 } 947 } 948 949 void UISelectorWindow::sltMachineRegistered(QString strMachineId, bool fRegistered) 950 { 951 if (fRegistered) 952 { 953 CVirtualBox vbox = vboxGlobal().virtualBox(); 954 CMachine m = vbox.FindMachine(strMachineId); 955 if (!m.isNull()) 956 { 957 m_pVMModel->addItem(m); 958 /* Make sure the description, ... pages are properly updated. 959 * Actually we haven't call the next method, but unfortunately Qt 960 * seems buggy if the new item is on the same position as the 961 * previous one. So go on the safe side and call this by our self. */ 962 sltCurrentVMItemChanged(); 963 } 964 /* m.isNull() is ok (theoretically, the machine could have been 965 * already deregistered by some other client at this point) */ 966 } 967 else 968 { 969 UIVMItem *pItem = m_pVMModel->itemById(strMachineId); 970 if (pItem) 971 { 972 int iRow = m_pVMModel->rowById(pItem->id()); 973 m_pVMModel->removeItem(pItem); 974 m_pVMListView->ensureSomeRowSelected(iRow); 975 } 976 /* item = 0 is ok (if we originated this event then the item 977 * has been already removed) */ 978 } 979 } 980 981 void UISelectorWindow::sltMachineStateChanged(QString strMachineId, KMachineState /* state */) 982 { 983 #ifdef VBOX_GUI_WITH_SYSTRAY 984 if (vboxGlobal().isTrayMenu()) 985 { 986 /* Check if there are some machines alive - else quit, since 987 * we're not needed as a systray menu anymore. */ 988 if (vboxGlobal().mainWindowCount() == 0) 989 { 990 sltPerformExit(); 991 return; 992 } 993 } 994 #endif /* VBOX_GUI_WITH_SYSTRAY */ 995 996 sltRefreshVMItem(strMachineId, false /* aDetails */, false /* aSnapshots */, false /* aDescription */); 997 998 /* Simulate a state change signal: */ 999 // m_pVMDesktop->updateDescriptionState(); 1000 } 1001 1002 void UISelectorWindow::sltMachineDataChanged(QString strMachineId) 1003 { 1004 sltRefreshVMItem(strMachineId, true /* details */, false /* snapshots */, true /* description */); 1005 } 1006 1007 void UISelectorWindow::sltSessionStateChanged(QString strMachineId, KSessionState /* state */) 1008 { 1009 sltRefreshVMItem(strMachineId, true /* details */, false /* snapshots */, false /* description */); 1010 1011 // /* Simulate a state change signal: */ 1012 // m_pVMDesktop->updateDescriptionState(); 1013 } 1014 1015 void UISelectorWindow::sltSnapshotChanged(QString strMachineId, QString /* strSnapshotId */) 1016 { 1017 sltRefreshVMItem(strMachineId, false /* details */, true /* snapshot */, false /* description */); 1018 } 1019 1020 #ifdef VBOX_GUI_WITH_SYSTRAY 1021 void UISelectorWindow::sltMainWindowCountChanged(int iCount) 1022 { 1023 if (vboxGlobal().isTrayMenu() && count <= 1) 1024 sltPerformExit(); 1025 } 1026 1027 void UISelectorWindow::sltTrayIconCanShow(bool fEnabled) 1028 { 1029 emit sltTrayIconChanged(VBoxChangeTrayIconEvent(vboxGlobal().settings().trayIconEnabled())); 1030 } 1031 1032 void UISelectorWindow::sltTrayIconShow(bool fEnabled) 1033 { 1034 if (vboxGlobal().isTrayMenu() && m_pTrayIcon) 1035 m_pTrayIcon->sltTrayIconShow(fEnabled); 1036 } 1037 1038 void UISelectorWindow::sltTrayIconChanged(bool fEnabled) 1039 { 1040 /* Not used yet. */ 1041 } 1042 1043 void UISelectorWindow::sltTrayIconActivated(QSystemTrayIcon::ActivationReason reason) 1044 { 1045 switch (reason) 1046 { 1047 case QSystemTrayIcon::Context: 1048 m_pTrayIcon->refresh(); 1049 break; 1050 1051 case QSystemTrayIcon::Trigger: 1052 break; 1053 1054 case QSystemTrayIcon::DoubleClick: 1055 vboxGlobal().trayIconShowSelector(); 1056 break; 1057 1058 case QSystemTrayIcon::MiddleClick: 1059 break; 1060 1061 default: 1062 break; 1063 } 1064 } 1065 1066 void UISelectorWindow::sltShowWindow() 1067 { 1068 showNormal(); 1069 raise(); 1070 activateWindow(); 1071 } 1072 #endif // VBOX_GUI_WITH_SYSTRAY 1073 1074 void UISelectorWindow::sltMediumEnumerationStarted() 1075 { 1076 /* Refresh the current details to pick up hard disk sizes: */ 1077 sltCurrentVMItemChanged(true /* fRefreshDetails */); 1078 } 1079 1080 void UISelectorWindow::sltMediumEnumFinished(const VBoxMediaList &list) 1081 { 1082 /* Refresh the current details to pick up hard disk sizes */ 1083 sltCurrentVMItemChanged(true /* fRefreshDetails */); 1084 1085 /* We warn about inaccessible media only once (after media emumeration 1263 1086 * started from main() at startup), to avoid annoying the user */ 1264 if ( mDoneInaccessibleWarningOnce1087 if (m_fDoneInaccessibleWarningOnce 1265 1088 #ifdef VBOX_GUI_WITH_SYSTRAY 1266 1089 || vboxGlobal().isTrayMenu() 1267 #endif 1090 #endif /* VBOX_GUI_WITH_SYSTRAY */ 1268 1091 ) 1269 1092 return; 1270 1093 1271 m DoneInaccessibleWarningOnce = true;1094 m_fDoneInaccessibleWarningOnce = true; 1272 1095 1273 1096 do 1274 1097 { 1275 /* ignore the signal if a modal widget is currently active (we won't be1276 * able to properly show the modeless VDI manager window in this case) */1098 /* Ignore the signal if a modal widget is currently active (we won't be 1099 * able to properly show the modeless VDI manager window in this case): */ 1277 1100 if (QApplication::activeModalWidget()) 1278 1101 break; 1279 1102 1280 /* ignore the signal if a VBoxMediaManagerDlg window is active*/1103 /* Ignore the signal if a VBoxMediaManagerDlg window is active: */ 1281 1104 if (qApp->activeWindow() && 1282 1105 !strcmp(qApp->activeWindow()->metaObject()->className(), "VBoxMediaManagerDlg")) 1283 1106 break; 1284 1107 1285 /* look for at least one inaccessible media*/1108 /* Look for at least one inaccessible media: */ 1286 1109 VBoxMediaList::const_iterator it; 1287 1110 for (it = list.begin(); it != list.end(); ++ it) … … 1291 1114 if (it != list.end() && msgCenter().remindAboutInaccessibleMedia()) 1292 1115 { 1293 /* Show the VDM dialog but don't refresh once more after a 1294 * just-finished refresh */ 1116 /* Show the VDM dialog but don't refresh once more after a just-finished refresh: */ 1295 1117 VBoxMediaManagerDlg::showModeless(this, false /* aRefresh */); 1296 1118 } … … 1299 1121 } 1300 1122 1301 void VBoxSelectorWnd::machineStateChanged(QString strId, KMachineState /* state */) 1302 { 1303 #ifdef VBOX_GUI_WITH_SYSTRAY 1304 if (vboxGlobal().isTrayMenu()) 1305 { 1306 /* Check if there are some machines alive - else quit, since 1307 * we're not needed as a systray menu anymore. */ 1308 if (vboxGlobal().mainWindowCount() == 0) 1309 { 1310 sltPerformExit(); 1311 return; 1312 } 1313 } 1314 #endif 1315 1316 refreshVMItem(strId, 1317 false /* aDetails */, 1318 false /* aSnapshots */, 1319 false /* aDescription */); 1320 1321 /* simulate a state change signal */ 1322 // m_pVMDesktop->updateDescriptionState(); 1323 } 1324 1325 void VBoxSelectorWnd::machineDataChanged(QString strId) 1326 { 1327 refreshVMItem(strId, 1328 true /* aDetails */, 1329 false /* aSnapshots */, 1330 true /* aDescription */); 1331 } 1332 1333 void VBoxSelectorWnd::machineRegistered(QString strId, bool fRegistered) 1334 { 1335 if (fRegistered) 1336 { 1337 CVirtualBox vbox = vboxGlobal().virtualBox(); 1338 CMachine m = vbox.FindMachine(strId); 1339 if (!m.isNull()) 1340 { 1341 mVMModel->addItem(m); 1342 /* Make sure the description, ... pages are properly updated. 1343 * Actually we haven't call the next method, but unfortunately Qt 1344 * seems buggy if the new item is on the same position as the 1345 * previous one. So go on the safe side and call this by our self. */ 1346 vmListViewCurrentChanged(); 1347 } 1348 /* m.isNull() is ok (theoretically, the machine could have been 1349 * already deregistered by some other client at this point) */ 1350 } 1351 else 1352 { 1353 UIVMItem *item = mVMModel->itemById(strId); 1354 if (item) 1355 { 1356 int row = mVMModel->rowById(item->id()); 1357 mVMModel->removeItem(item); 1358 mVMListView->ensureSomeRowSelected(row); 1359 } 1360 1361 /* item = 0 is ok (if we originated this event then the item 1362 * has been already removed) */ 1363 } 1364 } 1365 1366 void VBoxSelectorWnd::sessionStateChanged(QString strId, KSessionState /* state */) 1367 { 1368 refreshVMItem(strId, 1369 true /* aDetails */, 1370 false /* aSnapshots */, 1371 false /* aDescription */); 1372 1373 /* simulate a state change signal */ 1374 // m_pVMDesktop->updateDescriptionState(); 1375 } 1376 1377 void VBoxSelectorWnd::snapshotChanged(QString strId, QString /* strSnapshotId */) 1378 { 1379 refreshVMItem(strId, 1380 false /* aDetails */, 1381 true /* aSnapshot */, 1382 false /* aDescription */); 1383 } 1384 1385 #ifdef VBOX_GUI_WITH_SYSTRAY 1386 1387 void VBoxSelectorWnd::mainWindowCountChanged(int count) 1388 { 1389 if (vboxGlobal().isTrayMenu() && count <= 1) 1390 sltPerformExit(); 1391 } 1392 1393 void VBoxSelectorWnd::trayIconCanShow(bool fEnabled) 1394 { 1395 emit trayIconChanged(VBoxChangeTrayIconEvent(vboxGlobal().settings().trayIconEnabled())); 1396 } 1397 1398 void VBoxSelectorWnd::trayIconShow(bool fEnabled) 1399 { 1400 if (vboxGlobal().isTrayMenu() && mTrayIcon) 1401 mTrayIcon->trayIconShow(fEnabled); 1402 } 1403 1404 void VBoxSelectorWnd::trayIconChanged(bool fEnabled) 1405 { 1406 /* Not used yet. */ 1407 } 1408 1409 #endif /* VBOX_GUI_WITH_SYSTRAY */ 1410 1411 void VBoxSelectorWnd::sltEmbedDownloaderForUserManual() 1123 void UISelectorWindow::sltEmbedDownloaderForUserManual() 1412 1124 { 1413 1125 /* If there is User Manual downloader created => show the process bar: */ … … 1416 1128 } 1417 1129 1418 void VBoxSelectorWnd::sltEmbedDownloaderForExtensionPack()1130 void UISelectorWindow::sltEmbedDownloaderForExtensionPack() 1419 1131 { 1420 1132 /* If there is Extension Pack downloader created => show the process bar: */ … … 1423 1135 } 1424 1136 1425 void VBoxSelectorWnd::showViewContextMenu(const QPoint &pos) 1426 { 1427 CVirtualBox vbox = vboxGlobal().virtualBox(); 1428 QString strToolbar = vbox.GetExtraData(VBoxDefs::GUI_Toolbar); 1429 QString strStatusbar = vbox.GetExtraData(VBoxDefs::GUI_Statusbar); 1430 bool fToolbar = strToolbar.isEmpty() || strToolbar == "true"; 1431 bool fStatusbar = strStatusbar.isEmpty() || strStatusbar == "true"; 1432 1433 QList<QAction*> actions; 1434 QAction *pShowToolBar = new QAction(tr("Show Toolbar"), 0); 1435 pShowToolBar->setCheckable(true); 1436 pShowToolBar->setChecked(fToolbar); 1437 actions << pShowToolBar; 1438 QAction *pShowStatusBar = new QAction(tr("Show Statusbar"), 0); 1439 pShowStatusBar->setCheckable(true); 1440 pShowStatusBar->setChecked(fStatusbar); 1441 actions << pShowStatusBar; 1442 1443 QPoint gpos = pos; 1444 QWidget *pSender = static_cast<QWidget*>(sender()); 1445 if (pSender) 1446 gpos = pSender->mapToGlobal(pos); 1447 QAction *pResult = QMenu::exec(actions, gpos); 1448 if (pResult == pShowToolBar) 1449 { 1450 if (pResult->isChecked()) 1451 { 1137 void UISelectorWindow::retranslateUi() 1138 { 1139 /* Set window title: */ 1140 QString strTitle(VBOX_PRODUCT); 1141 strTitle += " " + tr("Manager", "Note: main window title which is pretended by the product name."); 1142 #ifdef VBOX_BLEEDING_EDGE 1143 strTitle += QString(" EXPERIMENTAL build ") 1144 + QString(RTBldCfgVersion()) 1145 + QString(" r") 1146 + QString(RTBldCfgRevisionStr()) 1147 + QString(" - "VBOX_BLEEDING_EDGE); 1148 #endif /* VBOX_BLEEDING_EDGE */ 1149 setWindowTitle(strTitle); 1150 1151 /* Ensure the details and screenshot view are updated: */ 1152 sltCurrentVMItemChanged(); 1153 1154 #ifdef VBOX_GUI_WITH_SYSTRAY 1155 if (vboxGlobal().isTrayMenu()) 1156 { 1157 m_pTrayIcon->retranslateUi(); 1158 m_pTrayIcon->refresh(); 1159 } 1160 #endif /* VBOX_GUI_WITH_SYSTRAY */ 1161 1162 #ifdef QT_MAC_USE_COCOA 1163 /* There is a bug in Qt Cocoa which result in showing a "more arrow" when 1164 the necessary size of the toolbar is increased. Also for some languages 1165 the with doesn't match if the text increase. So manually adjust the size 1166 after changing the text. */ 1167 mVMToolBar->updateLayout(); 1168 #endif /* QT_MAC_USE_COCOA */ 1169 } 1170 1171 bool UISelectorWindow::event(QEvent *pEvent) 1172 { 1173 switch (pEvent->type()) 1174 { 1175 /* By handling every Resize and Move we keep track of the normal 1176 * (non-minimized and non-maximized) window geometry. Shame on Qt 1177 * that it doesn't provide this geometry in its public APIs. */ 1178 case QEvent::Resize: 1179 { 1180 QResizeEvent *pResizeEvent = (QResizeEvent*) pEvent; 1181 if ((windowState() & (Qt::WindowMaximized | Qt::WindowMinimized | Qt::WindowFullScreen)) == 0) 1182 m_normalGeo.setSize(pResizeEvent->size()); 1183 break; 1184 } 1185 case QEvent::Move: 1186 { 1187 if ((windowState() & (Qt::WindowMaximized | Qt::WindowMinimized | Qt::WindowFullScreen)) == 0) 1188 m_normalGeo.moveTo(geometry().x(), geometry().y()); 1189 break; 1190 } 1191 case QEvent::WindowDeactivate: 1192 { 1193 /* Make sure every status bar hint is cleared when the window lost focus. */ 1194 statusBar()->clearMessage(); 1195 break; 1196 } 1452 1197 #ifdef Q_WS_MAC 1453 mVMToolBar->show(); 1454 #else /* Q_WS_MAC */ 1455 m_pBar->show(); 1456 #endif /* !Q_WS_MAC */ 1457 vbox.SetExtraData(VBoxDefs::GUI_Toolbar, "true"); 1458 } 1459 else 1460 { 1198 case QEvent::ContextMenu: 1199 { 1200 /* This is the unified context menu event. Lets show the context menu. */ 1201 QContextMenuEvent *pContextMenuEvent = static_cast<QContextMenuEvent*>(pEvent); 1202 sltShowSelectorContextMenu(pContextMenuEvent->globalPos()); 1203 /* Accept it to interrupt the chain. */ 1204 pContextMenuEvent->accept(); 1205 return false; 1206 break; 1207 } 1208 case QEvent::ToolBarChange: 1209 { 1210 CVirtualBox vbox = vboxGlobal().virtualBox(); 1211 /* We have to invert the isVisible check one time, cause this event 1212 * is sent *before* the real toggle is done. Really intuitive Trolls. */ 1213 vbox.SetExtraData(VBoxDefs::GUI_Toolbar, !::darwinIsToolbarVisible(mVMToolBar) ? "true" : "false"); 1214 break; 1215 } 1216 #endif /* Q_WS_MAC */ 1217 default: 1218 break; 1219 } 1220 1221 return QMainWindow::event(pEvent); 1222 } 1223 1224 void UISelectorWindow::closeEvent(QCloseEvent *pEvent) 1225 { 1226 #ifdef VBOX_GUI_WITH_SYSTRAY 1227 /* Needed for breaking out of the while() loop in main(). */ 1228 if (vboxGlobal().isTrayMenu()) 1229 vboxGlobal().setTrayMenu(false); 1230 #endif /* VBOX_GUI_WITH_SYSTRAY */ 1231 1232 emit closing(); 1233 QMainWindow::closeEvent(pEvent); 1234 } 1235 1461 1236 #ifdef Q_WS_MAC 1462 mVMToolBar->hide(); 1463 #else /* Q_WS_MAC */ 1464 m_pBar->hide(); 1465 #endif /* !Q_WS_MAC */ 1466 vbox.SetExtraData(VBoxDefs::GUI_Toolbar, "false"); 1467 } 1468 }else if (pResult == pShowStatusBar) 1469 { 1470 if (pResult->isChecked()) 1471 { 1472 statusBar()->show(); 1473 vbox.SetExtraData(VBoxDefs::GUI_Statusbar, "true"); 1474 } 1475 else 1476 { 1477 statusBar()->hide(); 1478 vbox.SetExtraData(VBoxDefs::GUI_Statusbar, "false"); 1479 } 1480 } 1481 } 1482 1483 void VBoxSelectorWnd::prepareMenuBar() 1484 { 1485 /* Prepare 'file' menu: */ 1237 bool UISelectorWindow::eventFilter(QObject *pObject, QEvent *pEvent) 1238 { 1239 if (!isActiveWindow()) 1240 return QIWithRetranslateUI2<QMainWindow>::eventFilter(pObject, pEvent); 1241 1242 if (qobject_cast<QWidget*>(pObject) && 1243 qobject_cast<QWidget*>(pObject)->window() != this) 1244 return QIWithRetranslateUI2<QMainWindow>::eventFilter(pObject, pEvent); 1245 1246 switch (pEvent->type()) 1247 { 1248 case QEvent::FileOpen: 1249 { 1250 sltOpenUrls(QList<QUrl>() << static_cast<QFileOpenEvent*>(pEvent)->file()); 1251 pEvent->accept(); 1252 return true; 1253 break; 1254 } 1255 # if (QT_VERSION < 0x040402) 1256 case QEvent::KeyPress: 1257 { 1258 /* Bug in Qt below 4.4.2. The key events are send to the current 1259 * window even if a menu is shown & has the focus. See 1260 * http://trolltech.com/developer/task-tracker/index_html?method=entry&id=214681. */ 1261 if (::darwinIsMenuOpen()) 1262 return true; 1263 break; 1264 } 1265 # endif 1266 default: 1267 break; 1268 } 1269 return QIWithRetranslateUI2<QMainWindow>::eventFilter(pObject, pEvent); 1270 } 1271 #endif /* Q_WS_MAC */ 1272 1273 void UISelectorWindow::prepareIcon() 1274 { 1275 /* Prepare application icon: */ 1276 #if !(defined (Q_WS_WIN) || defined (Q_WS_MAC)) 1277 /* On Win32, it's built-in to the executable. 1278 * On Mac OS X the icon referenced in info.plist is used. */ 1279 setWindowIcon(QIcon(":/VirtualBox_48px.png")); 1280 #endif 1281 } 1282 1283 void UISelectorWindow::prepareMenuBar() 1284 { 1285 /* Prepare 'File' menu: */ 1486 1286 QMenu *pFileMenu = gActionPool->action(UIActionIndexSelector_Menu_File)->menu(); 1487 1287 prepareMenuFile(pFileMenu); 1488 1288 menuBar()->addMenu(pFileMenu); 1489 1289 1490 /* Prepare ' machine' menu: */1290 /* Prepare 'Machine' menu: */ 1491 1291 QMenu *pMachineMenu = gActionPool->action(UIActionIndexSelector_Menu_Machine)->menu(); 1492 1292 prepareMenuMachine(pMachineMenu); … … 1497 1297 #endif /* Q_WS_MAC */ 1498 1298 1499 /* Prepare helpmenu: */1299 /* Prepare 'Help' menu: */ 1500 1300 QMenu *pHelpMenu = gActionPool->action(UIActionIndex_Menu_Help)->menu(); 1501 1301 prepareMenuHelp(pHelpMenu); 1502 1302 menuBar()->addMenu(pHelpMenu); 1503 1303 1304 /* Setup menubar policy: */ 1504 1305 menuBar()->setContextMenuPolicy(Qt::CustomContextMenu); 1505 1306 } 1506 1307 1507 void VBoxSelectorWnd::prepareMenuFile(QMenu *pMenu)1308 void UISelectorWindow::prepareMenuFile(QMenu *pMenu) 1508 1309 { 1509 1310 /* Do not touch if filled already: */ … … 1511 1312 return; 1512 1313 1513 /* Populate ' file' menu: */1314 /* Populate 'File' menu: */ 1514 1315 pMenu->addAction(gActionPool->action(UIActionIndexSelector_Simple_File_MediumManagerDialog)); 1515 1316 pMenu->addAction(gActionPool->action(UIActionIndexSelector_Simple_File_ImportApplianceWizard)); … … 1525 1326 } 1526 1327 1527 void VBoxSelectorWnd::prepareMenuMachine(QMenu *pMenu)1328 void UISelectorWindow::prepareMenuMachine(QMenu *pMenu) 1528 1329 { 1529 1330 /* Do not touch if filled already: */ … … 1531 1332 return; 1532 1333 1533 /* Populate ' machine' menu: */1334 /* Populate 'Machine' menu: */ 1534 1335 pMenu->addAction(gActionPool->action(UIActionIndexSelector_Simple_Machine_NewWizard)); 1535 1336 pMenu->addAction(gActionPool->action(UIActionIndexSelector_Simple_Machine_AddDialog)); … … 1556 1357 } 1557 1358 1558 void VBoxSelectorWnd::prepareMenuMachineClose(QMenu *pMenu)1359 void UISelectorWindow::prepareMenuMachineClose(QMenu *pMenu) 1559 1360 { 1560 1361 /* Do not touch if filled already: */ … … 1562 1363 return; 1563 1364 1564 /* Populate ' machine/close' menu: */1365 /* Populate 'Machine/Close' menu: */ 1565 1366 pMenu->addAction(gActionPool->action(UIActionIndexSelector_Simple_Machine_Close_ACPIShutdown)); 1566 1367 pMenu->addAction(gActionPool->action(UIActionIndexSelector_Simple_Machine_Close_PowerOff)); 1567 1368 } 1568 1369 1569 void VBoxSelectorWnd::prepareMenuHelp(QMenu *pMenu)1370 void UISelectorWindow::prepareMenuHelp(QMenu *pMenu) 1570 1371 { 1571 1372 /* Do not touch if filled already: */ … … 1573 1374 return; 1574 1375 1575 /* Help submenu: */1376 /* Populate 'Help' menu: */ 1576 1377 pMenu->addAction(gActionPool->action(UIActionIndex_Simple_Help)); 1577 1378 pMenu->addAction(gActionPool->action(UIActionIndex_Simple_Web)); … … 1596 1397 } 1597 1398 1598 void VBoxSelectorWnd::prepareContextMenu()1399 void UISelectorWindow::prepareContextMenu() 1599 1400 { 1600 1401 m_pMachineContextMenu = new QMenu(this); … … 1618 1419 } 1619 1420 1620 void VBoxSelectorWnd::prepareStatusBar() 1621 { 1421 void UISelectorWindow::prepareStatusBar() 1422 { 1423 /* Setup statusbar policy: */ 1622 1424 statusBar()->setContextMenuPolicy(Qt::CustomContextMenu); 1623 1425 } 1624 1426 1625 void VBoxSelectorWnd::prepareWidgets()1427 void UISelectorWindow::prepareWidgets() 1626 1428 { 1627 1429 /* Prepare splitter: */ … … 1640 1442 1641 1443 /* Prepare VM list: */ 1642 m VMModel = new UIVMItemModel(this);1643 m VMListView = new UIVMListView(mVMModel);1644 m VMListView->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);1444 m_pVMModel = new UIVMItemModel(this); 1445 m_pVMListView = new UIVMListView(m_pVMModel); 1446 m_pVMListView->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); 1645 1447 /* Make non-possible to activate list elements by single click, 1646 1448 * this hack should disable the current possibility to do it if present: */ 1647 if (m VMListView->style()->styleHint(QStyle::SH_ItemView_ActivateItemOnSingleClick, 0, mVMListView))1648 m VMListView->setStyleSheet("activate-on-singleclick : 0");1449 if (m_pVMListView->style()->styleHint(QStyle::SH_ItemView_ActivateItemOnSingleClick, 0, m_pVMListView)) 1450 m_pVMListView->setStyleSheet("activate-on-singleclick : 0"); 1649 1451 1650 1452 /* Prepare details and snapshots tabs: */ … … 1657 1459 /* Central widget @ horizontal layout: */ 1658 1460 setCentralWidget(m_pSplitter); 1659 m_pSplitter->addWidget(m VMListView);1461 m_pSplitter->addWidget(m_pVMListView); 1660 1462 #else /* MAC_LEOPARD_STYLE */ 1661 1463 QWidget *pLeftWidget = new QWidget(this); … … 1669 1471 pLeftVLayout->addWidget(m_pSplitter); 1670 1472 setCentralWidget(pLeftWidget); 1671 m_pSplitter->addWidget(m VMListView);1473 m_pSplitter->addWidget(m_pVMListView); 1672 1474 # else /* BIG_TOOLBAR */ 1673 1475 pLeftVLayout->addWidget(mVMToolBar); 1674 pLeftVLayout->addWidget(m VMListView);1476 pLeftVLayout->addWidget(m_pVMListView); 1675 1477 setCentralWidget(m_pSplitter); 1676 1478 m_pSplitter->addWidget(pLeftWidget); … … 1682 1484 m_pSplitter->setStretchFactor(0, 2); 1683 1485 m_pSplitter->setStretchFactor(1, 3); 1684 } 1685 1686 void VBoxSelectorWnd::prepareConnections() 1486 1487 /* Refresh VM list: */ 1488 sltRefreshVMList(); 1489 /* Reset to the first item: */ 1490 m_pVMListView->selectItemByRow(0); 1491 /* Bring the VM list to the focus: */ 1492 m_pVMListView->setFocus(); 1493 1494 #ifdef VBOX_GUI_WITH_SYSTRAY 1495 m_pTrayIcon = new VBoxTrayIcon(this, m_pVMModel); 1496 Assert(m_pTrayIcon); 1497 #endif /* VBOX_GUI_WITH_SYSTRAY */ 1498 } 1499 1500 void UISelectorWindow::prepareConnections() 1687 1501 { 1688 1502 /* VirtualBox event connections: */ 1689 connect(gVBoxEvents, SIGNAL(sigMachineStateChange(QString, KMachineState)), this, SLOT( machineStateChanged(QString, KMachineState)));1690 connect(gVBoxEvents, SIGNAL(sigMachineDataChange(QString)), this, SLOT( machineDataChanged(QString)));1691 connect(gVBoxEvents, SIGNAL(sigMachineRegistered(QString, bool)), this, SLOT( machineRegistered(QString, bool)));1692 connect(gVBoxEvents, SIGNAL(sigSessionStateChange(QString, KSessionState)), this, SLOT(s essionStateChanged(QString, KSessionState)));1693 connect(gVBoxEvents, SIGNAL(sigSnapshotChange(QString, QString)), this, SLOT(s napshotChanged(QString, QString)));1503 connect(gVBoxEvents, SIGNAL(sigMachineStateChange(QString, KMachineState)), this, SLOT(sltMachineStateChanged(QString, KMachineState))); 1504 connect(gVBoxEvents, SIGNAL(sigMachineDataChange(QString)), this, SLOT(sltMachineDataChanged(QString))); 1505 connect(gVBoxEvents, SIGNAL(sigMachineRegistered(QString, bool)), this, SLOT(sltMachineRegistered(QString, bool))); 1506 connect(gVBoxEvents, SIGNAL(sigSessionStateChange(QString, KSessionState)), this, SLOT(sltSessionStateChanged(QString, KSessionState))); 1507 connect(gVBoxEvents, SIGNAL(sigSnapshotChange(QString, QString)), this, SLOT(sltSnapshotChanged(QString, QString))); 1694 1508 1695 1509 /* Medium enumeration connections: */ 1696 connect(&vboxGlobal(), SIGNAL(mediumEnumStarted()), this, SLOT( mediumEnumStarted()));1697 connect(&vboxGlobal(), SIGNAL(mediumEnumFinished(const VBoxMediaList &)), this, SLOT( mediumEnumFinished(const VBoxMediaList &)));1510 connect(&vboxGlobal(), SIGNAL(mediumEnumStarted()), this, SLOT(sltMediumEnumerationStarted())); 1511 connect(&vboxGlobal(), SIGNAL(mediumEnumFinished(const VBoxMediaList &)), this, SLOT(sltMediumEnumFinished(const VBoxMediaList &))); 1698 1512 1699 1513 /* Downloader connections: */ … … 1702 1516 1703 1517 /* Menu-bar connections: */ 1704 connect(menuBar(), SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(s howViewContextMenu(const QPoint&)));1518 connect(menuBar(), SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(sltShowSelectorContextMenu(const QPoint&))); 1705 1519 1706 1520 /* 'File' menu connections: */ … … 1726 1540 SIGNAL(triggered()), this, SLOT(sltShowMachineSettingsDialog())); 1727 1541 connect(gActionPool->action(UIActionIndexSelector_Simple_Machine_CloneWizard), 1728 SIGNAL(triggered()), this, SLOT(sltShowCloneMachine Dialog()));1542 SIGNAL(triggered()), this, SLOT(sltShowCloneMachineWizard())); 1729 1543 connect(gActionPool->action(UIActionIndexSelector_Simple_Machine_RemoveDialog), 1730 1544 SIGNAL(triggered()), this, SLOT(sltShowRemoveMachineDialog())); … … 1780 1594 /* Status-bar connections: */ 1781 1595 connect(statusBar(), SIGNAL(customContextMenuRequested(const QPoint&)), 1782 this, SLOT(s howViewContextMenu(const QPoint&)));1596 this, SLOT(sltShowSelectorContextMenu(const QPoint&))); 1783 1597 1784 1598 /* VM list-view connections: */ 1785 connect(m VMListView, SIGNAL(sigUrlsDropped(QList<QUrl>)), this, SLOT(sltOpenUrls(QList<QUrl>)), Qt::QueuedConnection);1786 connect(m VMListView, SIGNAL(currentChanged()), this, SLOT(vmListViewCurrentChanged()));1787 connect(m VMListView, SIGNAL(activated()), this, SLOT(sltPerformStartOrShowAction()));1788 connect(m VMListView, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(showContextMenu(const QPoint &)));1599 connect(m_pVMListView, SIGNAL(sigUrlsDropped(QList<QUrl>)), this, SLOT(sltOpenUrls(QList<QUrl>)), Qt::QueuedConnection); 1600 connect(m_pVMListView, SIGNAL(currentChanged()), this, SLOT(sltCurrentVMItemChanged())); 1601 connect(m_pVMListView, SIGNAL(activated()), this, SLOT(sltPerformStartOrShowAction())); 1602 connect(m_pVMListView, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(sltShowContextMenu(const QPoint &))); 1789 1603 1790 1604 /* Tool-bar connections: */ 1791 1605 #ifndef Q_WS_MAC 1792 connect(mVMToolBar, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(s howViewContextMenu(const QPoint&)));1606 connect(mVMToolBar, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(sltShowSelectorContextMenu(const QPoint&))); 1793 1607 #else /* !Q_WS_MAC */ 1794 1608 /* A simple connect doesn't work on the Mac, also we want receive right … … 1802 1616 #ifdef VBOX_GUI_WITH_SYSTRAY 1803 1617 /* Tray icon connections: */ 1804 connect(m TrayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)),1805 this, SLOT( trayIconActivated(QSystemTrayIcon::ActivationReason)));1806 connect(gEDataEvents, SIGNAL(sigMainWindowCountChange(int)), this, SLOT( mainWindowCountChanged(int)));1807 connect(gEDataEvents, SIGNAL(sigCanShowTrayIcon(bool)), this, SLOT( trayIconCanShow(bool)));1808 connect(gEDataEvents, SIGNAL(sigTrayIconChange(bool)), this, SLOT( trayIconChanged(bool)));1809 connect(&vboxGlobal(), SIGNAL(sigTrayIconShow(bool)), this, SLOT( trayIconShow(bool)));1618 connect(m_pTrayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), 1619 this, SLOT(sltTrayIconActivated(QSystemTrayIcon::ActivationReason))); 1620 connect(gEDataEvents, SIGNAL(sigMainWindowCountChange(int)), this, SLOT(sltMainWindowCountChanged(int))); 1621 connect(gEDataEvents, SIGNAL(sigCanShowTrayIcon(bool)), this, SLOT(sltTrayIconCanShow(bool))); 1622 connect(gEDataEvents, SIGNAL(sigTrayIconChange(bool)), this, SLOT(sltTrayIconChanged(bool))); 1623 connect(&vboxGlobal(), SIGNAL(sigTrayIconShow(bool)), this, SLOT(sltTrayIconShow(bool))); 1810 1624 #endif /* VBOX_GUI_WITH_SYSTRAY */ 1811 1625 } 1812 1626 1627 void UISelectorWindow::loadSettings() 1628 { 1629 /* Get VBox object: */ 1630 CVirtualBox vbox = vboxGlobal().virtualBox(); 1631 1632 /* Restore window position: */ 1633 { 1634 QString strWinPos = vbox.GetExtraData(VBoxDefs::GUI_LastWindowPosition); 1635 1636 bool ok = false, max = false; 1637 int x = 0, y = 0, w = 0, h = 0; 1638 x = strWinPos.section(',', 0, 0).toInt(&ok); 1639 if (ok) 1640 y = strWinPos.section(',', 1, 1).toInt(&ok); 1641 if (ok) 1642 w = strWinPos.section(',', 2, 2).toInt(&ok); 1643 if (ok) 1644 h = strWinPos.section(',', 3, 3).toInt(&ok); 1645 if (ok) 1646 max = strWinPos.section(',', 4, 4) == VBoxDefs::GUI_LastWindowState_Max; 1647 1648 QRect ar = ok ? QApplication::desktop()->availableGeometry(QPoint(x, y)) : 1649 QApplication::desktop()->availableGeometry(this); 1650 1651 if (ok /* previous parameters were read correctly */ 1652 && (y > 0) && (y < ar.bottom()) /* check vertical bounds */ 1653 && (x + w > ar.left()) && (x < ar.right()) /* & horizontal bounds */) 1654 { 1655 m_normalGeo.moveTo(x, y); 1656 m_normalGeo.setSize(QSize(w, h).expandedTo(minimumSizeHint()).boundedTo(ar.size())); 1657 #if defined(Q_WS_MAC) && (QT_VERSION >= 0x040700) 1658 move(m_normalGeo.topLeft()); 1659 resize(m_normalGeo.size()); 1660 m_normalGeo = normalGeometry(); 1661 #else /* defined(Q_WS_MAC) && (QT_VERSION >= 0x040700) */ 1662 setGeometry(m_normalGeo); 1663 #endif /* !(defined(Q_WS_MAC) && (QT_VERSION >= 0x040700)) */ 1664 if (max) /* maximize if needed */ 1665 showMaximized(); 1666 } 1667 else 1668 { 1669 m_normalGeo.setSize(QSize(770, 550).expandedTo(minimumSizeHint()).boundedTo(ar.size())); 1670 m_normalGeo.moveCenter(ar.center()); 1671 setGeometry(m_normalGeo); 1672 } 1673 } 1674 1675 /* Restore selected VM(s): */ 1676 { 1677 QString strPrevVMId = vbox.GetExtraData(VBoxDefs::GUI_LastVMSelected); 1678 1679 m_pVMListView->selectItemById(strPrevVMId); 1680 } 1681 1682 /* Restore splitter handle position: */ 1683 { 1684 QList<int> sizes = vbox.GetExtraDataIntList(VBoxDefs::GUI_SplitterSizes); 1685 1686 if (sizes.size() == 2) 1687 m_pSplitter->setSizes(sizes); 1688 } 1689 1690 /* Restore toolbar and statusbar visibility: */ 1691 { 1692 QString strToolbar = vbox.GetExtraData(VBoxDefs::GUI_Toolbar); 1693 QString strStatusbar = vbox.GetExtraData(VBoxDefs::GUI_Statusbar); 1694 1695 #ifdef Q_WS_MAC 1696 mVMToolBar->setVisible(strToolbar.isEmpty() || strToolbar == "true"); 1697 #else /* Q_WS_MAC */ 1698 m_pBar->setVisible(strToolbar.isEmpty() || strToolbar == "true"); 1699 #endif /* !Q_WS_MAC */ 1700 statusBar()->setVisible(strStatusbar.isEmpty() || strStatusbar == "true"); 1701 } 1702 } 1703 1704 void UISelectorWindow::saveSettings() 1705 { 1706 /* Get VBox object: */ 1707 CVirtualBox vbox = vboxGlobal().virtualBox(); 1708 1709 /* Save window position: */ 1710 { 1711 #if defined(Q_WS_MAC) && (QT_VERSION >= 0x040700) 1712 QRect frameGeo = frameGeometry(); 1713 QRect save(frameGeo.x(), frameGeo.y(), m_normalGeo.width(), m_normalGeo.height()); 1714 #else /* defined(Q_WS_MAC) && (QT_VERSION >= 0x040700) */ 1715 QRect save(m_normalGeo); 1716 #endif /* !(defined(Q_WS_MAC) && (QT_VERSION >= 0x040700)) */ 1717 QString strWinPos = QString("%1,%2,%3,%4").arg(save.x()).arg(save.y()).arg(save.width()).arg(save.height()); 1718 #ifdef Q_WS_MAC 1719 UIWindowMenuManager::destroy(); 1720 ::darwinUnregisterForUnifiedToolbarContextMenuEvents(this); 1721 if (::darwinIsWindowMaximized(this)) 1722 #else /* Q_WS_MAC */ 1723 if (isMaximized()) 1724 #endif /* !Q_WS_MAC */ 1725 strWinPos += QString(",%1").arg(VBoxDefs::GUI_LastWindowState_Max); 1726 1727 vbox.SetExtraData(VBoxDefs::GUI_LastWindowPosition, strWinPos); 1728 } 1729 1730 /* Save selected VM(s): */ 1731 { 1732 UIVMItem *pItem = m_pVMListView->selectedItem(); 1733 QString strCurrentVMId = pItem ? QString(pItem->id()) : QString(); 1734 vbox.SetExtraData(VBoxDefs::GUI_LastVMSelected, strCurrentVMId); 1735 vbox.SetExtraDataStringList(VBoxDefs::GUI_SelectorVMPositions, m_pVMModel->idList()); 1736 } 1737 1738 /* Save splitter handle position: */ 1739 { 1740 vbox.SetExtraDataIntList(VBoxDefs::GUI_SplitterSizes, m_pSplitter->sizes()); 1741 } 1742 } -
trunk/src/VBox/Frontends/VirtualBox/src/selector/UISelectorWindow.h
r38973 r38977 2 2 * 3 3 * VBox frontends: Qt GUI ("VirtualBox"): 4 * VBoxSelectorWndclass declaration4 * UISelectorWindow class declaration 5 5 */ 6 6 7 7 /* 8 * Copyright (C) 2006-201 0Oracle Corporation8 * Copyright (C) 2006-2011 Oracle Corporation 9 9 * 10 10 * This file is part of VirtualBox Open Source Edition (OSE), as … … 17 17 */ 18 18 19 #ifndef __ VBoxSelectorWnd_h__20 #define __ VBoxSelectorWnd_h__19 #ifndef __UISelectorWindow_h__ 20 #define __UISelectorWindow_h__ 21 21 22 /* Local includes */ 23 #include "COMDefs.h" 24 #include "QIWithRetranslateUI.h" 25 #include "VBoxGlobal.h" 26 #include "UIMessageCenter.h" 27 28 /* Global includes */ 22 /* Global includes: */ 29 23 #include <QMainWindow> 30 24 #include <QUrl> … … 33 27 #endif /* VBOX_GUI_WITH_SYSTRAY */ 34 28 35 /* Local forward declarations */ 29 /* Local includes: */ 30 #include "QIWithRetranslateUI.h" 31 #include "VBoxMedium.h" 32 #include "COMDefs.h" 33 34 /* Forward declarations: */ 36 35 class QISplitter; 37 36 class UIMainBar; 37 class UIToolBar; 38 38 class UIVMDesktop; 39 class UIVMItem;40 39 class UIVMItemModel; 41 40 class UIVMListView; 42 class UIToolBar; 41 #ifdef VBOX_GUI_WITH_SYSTRAY 43 42 class VBoxTrayIcon; 43 #endif /* VBOX_GUI_WITH_SYSTRAY */ 44 44 45 class VBoxSelectorWnd : public QIWithRetranslateUI2<QMainWindow> 45 /* VM selector window class: */ 46 class UISelectorWindow : public QIWithRetranslateUI2<QMainWindow> 46 47 { 47 48 Q_OBJECT; … … 49 50 public: 50 51 51 VBoxSelectorWnd(VBoxSelectorWnd **aSelf, 52 QWidget* aParent = 0, 53 Qt::WindowFlags aFlags = Qt::Window); 54 virtual ~VBoxSelectorWnd(); 52 /* Constructor/destructor: */ 53 UISelectorWindow(UISelectorWindow **ppSelf, 54 QWidget* pParent = 0, 55 Qt::WindowFlags flags = Qt::Window); 56 virtual ~UISelectorWindow(); 55 57 56 58 signals: 57 59 60 /* Signal to notify listeners about this dialog closed: */ 58 61 void closing(); 59 62 60 p ublicslots:63 private slots: 61 64 65 /* Menubar/status bar slots: */ 66 void sltShowSelectorContextMenu(const QPoint &pos); 67 68 /* 'File' menu slots: */ 62 69 void sltShowMediumManager(); 63 void sltShowImportApplianceWizard(const QString &strFile = "");70 void sltShowImportApplianceWizard(const QString &strFileName = QString()); 64 71 void sltShowExportApplianceWizard(); 65 72 void sltShowPreferencesDialog(); 66 73 void sltPerformExit(); 67 74 75 /* 'Machine' menu slots: */ 68 76 void sltShowNewMachineWizard(); 69 void sltShowAddMachineDialog(const QString &strFile = ""); 70 void sltShowMachineSettingsDialog(const QString &aCategory = QString::null, const QString &aControl = QString::null, const QString & = QString::null); 71 void sltShowCloneMachineDialog(const QString & = QString::null); 72 void sltShowRemoveMachineDialog(const QString & = QString::null); 73 void sltPerformStartOrShowAction(const QString & = QString::null); 74 void sltPerformDiscardAction(const QString & = QString::null); 75 void sltPerformPauseResumeAction(bool, const QString & = QString::null); 76 void sltPerformResetAction(const QString & = QString::null); 77 void sltPerformACPIShutdownAction(const QString &aUuid = QString::null); 78 void sltPerformPowerOffAction(const QString &aUuid = QString::null); 79 void sltPerformRefreshAction(const QString & = QString::null); 80 void sltShowLogDialog(const QString & = QString::null); 81 void sltShowMachineInFileManager(const QString &aUuid = QString::null); 82 void sltPerformCreateShortcutAction(const QString &aUuid = QString::null); 83 void sltPerformSortAction(const QString &aUuid = QString::null); 77 void sltShowAddMachineDialog(const QString &strFileName = QString()); 78 void sltShowMachineSettingsDialog(const QString &strCategory = QString(), 79 const QString &strControl = QString(), 80 const QString &strMachineId = QString()); 81 void sltShowCloneMachineWizard(const QString &strMachineId = QString()); 82 void sltShowRemoveMachineDialog(const QString &strMachineId = QString()); 83 void sltPerformStartOrShowAction(const QString &strMachineId = QString()); 84 void sltPerformDiscardAction(const QString &strMachineId = QString()); 85 void sltPerformPauseResumeAction(bool fPause, const QString &strMachineId = QString()); 86 void sltPerformResetAction(const QString &strMachineId = QString()); 87 void sltPerformACPIShutdownAction(const QString &strMachineId = QString()); 88 void sltPerformPowerOffAction(const QString &strMachineId = QString()); 89 void sltPerformRefreshAction(const QString &strMachineId = QString()); 90 void sltShowLogDialog(const QString &strMachineId = QString()); 91 void sltShowMachineInFileManager(const QString &strMachineId = QString()); 92 void sltPerformCreateShortcutAction(const QString &strMachineId = QString()); 93 void sltPerformSortAction(const QString &strMachineId = QString()); 84 94 void sltMachineMenuAboutToShow(); 85 95 void sltMachineCloseMenuAboutToShow(); 86 96 void sltMachineContextMenuHovered(QAction *pAction); 87 97 88 void refreshVMList();89 void refreshVMItem(const QString &aID, bool aDetails, bool aSnapshots, bool aDescription);90 91 void s howContextMenu(const QPoint &aPoint);92 98 /* VM list slots: */ 99 void sltRefreshVMList(); 100 void sltRefreshVMItem(const QString &strMachineId, bool fDetails, bool fSnapshots, bool fDescription); 101 void sltShowContextMenu(const QPoint &point); 102 void sltCurrentVMItemChanged(bool fRefreshDetails = true, bool fRefreshSnapshots = true, bool fRefreshDescription = true); 93 103 void sltOpenUrls(QList<QUrl> list = QList<QUrl>()); 94 104 105 /* VirtualBox callback events we're interested in: */ 106 void sltMachineRegistered(QString strID, bool fRegistered); 107 void sltMachineStateChanged(QString strId, KMachineState state); 108 void sltMachineDataChanged(QString strId); 109 void sltSessionStateChanged(QString strId, KSessionState state); 110 void sltSnapshotChanged(QString strId, QString strSnapshotId); 95 111 #ifdef VBOX_GUI_WITH_SYSTRAY 96 void trayIconActivated(QSystemTrayIcon::ActivationReason aReason); 97 void showWindow(); 98 #endif 112 /* Sys tray related event handlers: */ 113 void sltMainWindowCountChanged(int count); 114 void sltTrayIconCanShow(bool fEnabled); 115 void sltTrayIconShow(bool fEnabled); 116 void sltTrayIconChanged(bool fEnabled); 117 /* Sys tray related slots: */ 118 void sltTrayIconActivated(QSystemTrayIcon::ActivationReason aReason); 119 void sltShowWindow(); 120 #endif /* VBOX_GUI_WITH_SYSTRAY */ 99 121 100 protected: 122 /* Medium enumeration related slots: */ 123 void sltMediumEnumerationStarted(); 124 void sltMediumEnumFinished(const VBoxMediaList &mediumList); 101 125 102 /* Events */ 103 bool event(QEvent *aEvent); 104 void closeEvent(QCloseEvent *aEvent); 126 /* Downloader related slots: */ 127 void sltEmbedDownloaderForUserManual(); 128 void sltEmbedDownloaderForExtensionPack(); 129 130 private: 131 132 /* Translation stuff: */ 133 void retranslateUi(); 134 135 /* Event handlers: */ 136 bool event(QEvent *pEvent); 137 void closeEvent(QCloseEvent *pEvent); 105 138 #ifdef Q_WS_MAC 106 139 bool eventFilter(QObject *pObject, QEvent *pEvent); 107 140 #endif /* Q_WS_MAC */ 108 141 109 void retranslateUi();110 111 private slots:112 113 void vmListViewCurrentChanged(bool aRefreshDetails = true, bool aRefreshSnapshots = true, bool aRefreshDescription = true);114 void mediumEnumStarted();115 void mediumEnumFinished(const VBoxMediaList &);116 117 /* VirtualBox callback events we're interested in */118 119 void machineStateChanged(QString strId, KMachineState state);120 void machineDataChanged(QString strId);121 void machineRegistered(QString strID, bool fRegistered);122 void sessionStateChanged(QString strId, KSessionState state);123 void snapshotChanged(QString strId, QString strSnapshotId);124 #ifdef VBOX_GUI_WITH_SYSTRAY125 void mainWindowCountChanged(int count);126 void trayIconCanShow(bool fEnabled);127 void trayIconShow(bool fEnabled);128 void trayIconChanged(bool fEnabled);129 #endif130 131 void sltEmbedDownloaderForUserManual();132 void sltEmbedDownloaderForExtensionPack();133 134 void showViewContextMenu(const QPoint &pos);135 136 private:137 138 142 /* Helping stuff: */ 143 void prepareIcon(); 139 144 void prepareMenuBar(); 140 145 void prepareMenuFile(QMenu *pMenu); … … 146 151 void prepareWidgets(); 147 152 void prepareConnections(); 153 void loadSettings(); 154 void saveSettings(); 148 155 149 /* Central splitter window */156 /* Central splitter window: */ 150 157 QISplitter *m_pSplitter; 151 158 152 /* Main toolbar */159 /* Main toolbar: */ 153 160 #ifndef Q_WS_MAC 154 161 UIMainBar *m_pBar; … … 156 163 UIToolBar *mVMToolBar; 157 164 158 /* VM list context menu */ 165 /* VM list view: */ 166 UIVMListView *m_pVMListView; 167 /* VM list model: */ 168 UIVMItemModel *m_pVMModel; 169 /* VM list context menu: */ 159 170 QMenu *m_pMachineContextMenu; 160 171 161 #ifdef VBOX_GUI_WITH_SYSTRAY 162 /* The systray icon */ 163 VBoxTrayIcon *mTrayIcon; 164 #endif 165 166 /* The vm list view/model */ 167 UIVMListView *mVMListView; 168 UIVMItemModel *mVMModel; 169 170 /* The right information widgets */ 172 /* VM details widget: */ 171 173 UIVMDesktop *m_pVMDesktop; 172 174 173 QRect mNormalGeo; 174 175 bool mDoneInaccessibleWarningOnce : 1; 175 /* Other variables: */ 176 QRect m_normalGeo; 177 bool m_fDoneInaccessibleWarningOnce : 1; 178 #ifdef VBOX_GUI_WITH_SYSTRAY 179 /* The systray icon: */ 180 VBoxTrayIcon *m_pTrayIcon; 181 #endif /* VBOX_GUI_WITH_SYSTRAY */ 176 182 }; 177 183 178 #endif // __ VBoxSelectorWnd_h__184 #endif // __UISelectorWindow_h__ 179 185 -
trunk/src/VBox/Frontends/VirtualBox/src/selector/UIVMListView.cpp
r38800 r38977 25 25 #include "UIVMListView.h" 26 26 #include "UIMessageCenter.h" 27 #include "VBoxSelectorWnd.h"28 27 29 28 /* Global includes */ -
trunk/src/VBox/Frontends/VirtualBox/src/selector/UIVMListView.h
r38800 r38977 45 45 UIVMItemModel(QObject *aParent = 0) 46 46 :QAbstractListModel(aParent) {} 47 ~UIVMItemModel() { clear(); } 47 48 48 49 void addItem(const CMachine &machine); -
trunk/src/VBox/Frontends/VirtualBox/src/selector/VBoxTrayIcon.cpp
r32758 r38977 19 19 /* Local includes */ 20 20 #include "VBoxTrayIcon.h" 21 #include " VBoxSelectorWnd.h"21 #include "UISelectorWindow.h" 22 22 #include "UIIconPool.h" 23 23 #include "UIVMItem.h" … … 28 28 #include <QAction> 29 29 30 VBoxTrayIcon::VBoxTrayIcon ( VBoxSelectorWnd* aParent, UIVMItemModel* aVMModel)30 VBoxTrayIcon::VBoxTrayIcon (UISelectorWindow* aParent, UIVMItemModel* aVMModel) 31 31 { 32 32 mParent = aParent; -
trunk/src/VBox/Frontends/VirtualBox/src/selector/VBoxTrayIcon.h
r32758 r38977 26 26 27 27 /* Local forward declarations */ 28 class VBoxSelectorWnd;28 class UISelectorWindow; 29 29 class UIVMItem; 30 30 class UIVMItemModel; … … 40 40 public: 41 41 42 VBoxTrayIcon ( VBoxSelectorWnd* aParent, UIVMItemModel* aVMModel);42 VBoxTrayIcon (UISelectorWindow* aParent, UIVMItemModel* aVMModel); 43 43 virtual ~VBoxTrayIcon (); 44 44 … … 74 74 UIVMItemModel *mVMModel; 75 75 76 VBoxSelectorWnd* mParent;76 UISelectorWindow* mParent; 77 77 QMenu *mTrayIconMenu; 78 78 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsExtension.cpp
r38311 r38977 108 108 * Attempt the actual installation. 109 109 * 110 * This code is shared by UIGlobalSettingsExtension::sltInstallPackage and 111 * VBoxSelectorWnd::sltOpenUrls. 110 * This code is shared by UIGlobalSettingsExtension::sltInstallPackage and UISelectorWindow::sltOpenUrls. 112 111 * 113 112 * @param strFilePath The path to the tarball.
Note:
See TracChangeset
for help on using the changeset viewer.