Changeset 27087 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Mar 5, 2010 1:28:41 PM (15 years ago)
- svn:sync-xref-src-repo-rev:
- 58412
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/VBoxVMInformationDlg.cpp
r27044 r27087 45 45 #ifdef VBOX_WITH_NEW_RUNTIME_CORE 46 46 void VBoxVMInformationDlg::createInformationDlg(UIMachineWindow *pMachineWindow) 47 #else /* VBOX_WITH_NEW_RUNTIME_CORE */ 48 void VBoxVMInformationDlg::createInformationDlg (const CSession &aSession, VBoxConsoleView *aConsole) 49 #endif /* VBOX_WITH_NEW_RUNTIME_CORE */ 50 { 51 #ifdef VBOX_WITH_NEW_RUNTIME_CORE 47 { 52 48 CMachine machine = pMachineWindow->machineLogic()->uisession()->session().GetMachine(); 53 #else /* VBOX_WITH_NEW_RUNTIME_CORE */54 CMachine machine = aSession.GetMachine();55 #endif /* VBOX_WITH_NEW_RUNTIME_CORE */56 49 if (mSelfArray.find (machine.GetName()) == mSelfArray.end()) 57 50 { 58 51 /* Creating new information dialog if there is no one existing */ 59 #ifdef VBOX_WITH_NEW_RUNTIME_CORE60 52 VBoxVMInformationDlg *id = new VBoxVMInformationDlg(pMachineWindow, Qt::Window); 61 53 id->centerAccording (pMachineWindow->machineWindow()); 62 #else /* VBOX_WITH_NEW_RUNTIME_CORE */63 VBoxVMInformationDlg *id = new VBoxVMInformationDlg (aConsole, aSession, Qt::Window);64 id->centerAccording (aConsole);65 #endif /* VBOX_WITH_NEW_RUNTIME_CORE */66 54 connect (vboxGlobal().mainWindow(), SIGNAL (closing()), id, SLOT (close())); 67 55 id->setAttribute (Qt::WA_DeleteOnClose); … … 76 64 } 77 65 78 #ifdef VBOX_WITH_NEW_RUNTIME_CORE79 66 VBoxVMInformationDlg::VBoxVMInformationDlg (UIMachineWindow *pMachineWindow, Qt::WindowFlags aFlags) 80 67 # ifdef Q_WS_MAC … … 84 71 # endif /* Q_WS_MAC */ 85 72 , mSession (pMachineWindow->session()) 86 #else /* VBOX_WITH_NEW_RUNTIME_CORE */87 VBoxVMInformationDlg::VBoxVMInformationDlg (VBoxConsoleView *aConsole, const CSession &aSession, Qt::WindowFlags aFlags)88 # ifdef Q_WS_MAC89 : QIWithRetranslateUI2 <QIMainDialog> (aConsole, aFlags)90 # else /* Q_WS_MAC */91 : QIWithRetranslateUI2 <QIMainDialog> (0, aFlags)92 # endif /* Q_WS_MAC */93 #endif /* VBOX_WITH_NEW_RUNTIME_CORE */94 #ifndef VBOX_WITH_NEW_RUNTIME_CORE95 , mConsole (aConsole)96 , mSession (aSession)97 #endif /* !VBOX_WITH_NEW_RUNTIME_CORE */98 73 , mIsPolished (false) 99 74 , mStatTimer (new QTimer (this)) … … 127 102 128 103 /* Setup handlers */ 129 #ifdef VBOX_WITH_NEW_RUNTIME_CORE130 104 connect (pMachineWindow->uisession(), SIGNAL (sigMediumChange(const CMediumAttachment&)), this, SLOT (updateDetails())); 131 105 connect (pMachineWindow->uisession(), SIGNAL (sigSharedFolderChange()), this, SLOT (updateDetails())); … … 133 107 * more than one screens. */ 134 108 connect (pMachineWindow->machineView(), SIGNAL (resizeHintDone()), this, SLOT (processStatistics())); 135 #else /* VBOX_WITH_NEW_RUNTIME_CORE */ 109 connect (mInfoStack, SIGNAL (currentChanged (int)), this, SLOT (onPageChanged (int))); 110 connect (&vboxGlobal(), SIGNAL (mediumEnumFinished (const VBoxMediaList &)), this, SLOT (updateDetails())); 111 connect (mStatTimer, SIGNAL (timeout()), this, SLOT (processStatistics())); 112 113 /* Loading language constants */ 114 retranslateUi(); 115 116 /* Details page update */ 117 updateDetails(); 118 119 /* Statistics page update */ 120 processStatistics(); 121 mStatTimer->start (5000); 122 123 /* Preload dialog attributes for this vm */ 124 QString dlgsize = mSession.GetMachine().GetExtraData (VBoxDefs::GUI_InfoDlgState); 125 if (dlgsize.isEmpty()) 126 { 127 mWidth = 400; 128 mHeight = 450; 129 mMax = false; 130 } 131 else 132 { 133 QStringList list = dlgsize.split (','); 134 mWidth = list [0].toInt(), mHeight = list [1].toInt(); 135 mMax = list [2] == "max"; 136 } 137 138 /* Make statistics page the default one */ 139 mInfoStack->setCurrentIndex (1); 140 } 141 #endif /* VBOX_WITH_NEW_RUNTIME_CORE */ 142 143 void VBoxVMInformationDlg::createInformationDlg (const CSession &aSession, VBoxConsoleView *aConsole) 144 { 145 CMachine machine = aSession.GetMachine(); 146 if (mSelfArray.find (machine.GetName()) == mSelfArray.end()) 147 { 148 /* Creating new information dialog if there is no one existing */ 149 VBoxVMInformationDlg *id = new VBoxVMInformationDlg (aConsole, aSession, Qt::Window); 150 id->centerAccording (aConsole); 151 connect (vboxGlobal().mainWindow(), SIGNAL (closing()), id, SLOT (close())); 152 id->setAttribute (Qt::WA_DeleteOnClose); 153 mSelfArray [machine.GetName()] = id; 154 } 155 156 VBoxVMInformationDlg *info = mSelfArray [machine.GetName()]; 157 info->show(); 158 info->raise(); 159 info->setWindowState (info->windowState() & ~Qt::WindowMinimized); 160 info->activateWindow(); 161 } 162 163 VBoxVMInformationDlg::VBoxVMInformationDlg (VBoxConsoleView *aConsole, const CSession &aSession, Qt::WindowFlags aFlags) 164 # ifdef Q_WS_MAC 165 : QIWithRetranslateUI2 <QIMainDialog> (aConsole, aFlags) 166 # else /* Q_WS_MAC */ 167 : QIWithRetranslateUI2 <QIMainDialog> (0, aFlags) 168 # endif /* Q_WS_MAC */ 169 , mConsole (aConsole) 170 , mSession (aSession) 171 , mIsPolished (false) 172 , mStatTimer (new QTimer (this)) 173 { 174 /* Apply UI decorations */ 175 Ui::VBoxVMInformationDlg::setupUi (this); 176 177 #ifdef Q_WS_MAC 178 /* No icon for this window on the mac, cause this would act as proxy icon which isn't necessary here. */ 179 setWindowIcon (QIcon()); 180 #else 181 /* Apply window icons */ 182 setWindowIcon (vboxGlobal().iconSetFull (QSize (32, 32), QSize (16, 16), 183 ":/session_info_32px.png", ":/session_info_16px.png")); 184 #endif 185 186 /* Enable size grip without using a status bar. */ 187 setSizeGripEnabled (true); 188 189 /* Setup focus-proxy for pages */ 190 mPage1->setFocusProxy (mDetailsText); 191 mPage2->setFocusProxy (mStatisticText); 192 193 /* Setup browsers */ 194 mDetailsText->viewport()->setAutoFillBackground (false); 195 mStatisticText->viewport()->setAutoFillBackground (false); 196 197 /* Setup margins */ 198 mDetailsText->setViewportMargins (5, 5, 5, 5); 199 mStatisticText->setViewportMargins (5, 5, 5, 5); 200 201 /* Setup handlers */ 136 202 /* Setup handlers */ 137 203 connect (mConsole, SIGNAL (mediaDriveChanged (VBoxDefs::MediumType)), this, SLOT (updateDetails())); 138 204 connect (mConsole, SIGNAL (sharedFoldersChanged()), this, SLOT (updateDetails())); 139 205 connect (mConsole, SIGNAL (resizeHintDone()), this, SLOT (processStatistics())); 140 #endif /* VBOX_WITH_NEW_RUNTIME_CORE */141 206 connect (mInfoStack, SIGNAL (currentChanged (int)), this, SLOT (onPageChanged (int))); 142 207 connect (&vboxGlobal(), SIGNAL (mediumEnumFinished (const VBoxMediaList &)), this, SLOT (updateDetails())); -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxVMInformationDlg.h
r27044 r27087 46 46 #ifdef VBOX_WITH_NEW_RUNTIME_CORE 47 47 static void createInformationDlg(UIMachineWindow *pMachineWindow); 48 #e lse/* VBOX_WITH_NEW_RUNTIME_CORE */48 #endif /* VBOX_WITH_NEW_RUNTIME_CORE */ 49 49 static void createInformationDlg (const CSession &aSession, VBoxConsoleView *aConsole); 50 #endif /* VBOX_WITH_NEW_RUNTIME_CORE */51 50 52 51 protected: … … 54 53 #ifdef VBOX_WITH_NEW_RUNTIME_CORE 55 54 VBoxVMInformationDlg (UIMachineWindow *pMachineWindow, Qt::WindowFlags aFlags); 56 #e lse/* VBOX_WITH_NEW_RUNTIME_CORE */55 #endif /* VBOX_WITH_NEW_RUNTIME_CORE */ 57 56 VBoxVMInformationDlg (VBoxConsoleView *aConsole, const CSession &aSession, Qt::WindowFlags aFlags); 58 #endif /* VBOX_WITH_NEW_RUNTIME_CORE */59 57 ~VBoxVMInformationDlg(); 60 58 … … 84 82 static InfoDlgMap mSelfArray; 85 83 86 #ifndef VBOX_WITH_NEW_RUNTIME_CORE87 84 VBoxConsoleView *mConsole; 88 #endif /* !VBOX_WITH_NEW_RUNTIME_CORE */89 85 CSession mSession; 90 86 bool mIsPolished;
Note:
See TracChangeset
for help on using the changeset viewer.