Changeset 12695 in vbox
- Timestamp:
- Sep 24, 2008 3:25:31 PM (16 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox4
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox4/include/QIMainDialog.h
r11343 r12695 65 65 QPushButton* searchDefaultButton() const; 66 66 67 void centerAccording (QWidget *aWidget) { mCenterWidget = aWidget; } 68 67 69 protected slots: 68 70 … … 87 89 88 90 bool mPolished; 91 QWidget *mCenterWidget; 89 92 }; 90 93 -
trunk/src/VBox/Frontends/VirtualBox4/include/VBoxSelectorWnd.h
r12010 r12695 59 59 bool startMachine (const QUuid &aId); 60 60 61 signals: 62 63 void closing(); 64 61 65 public slots: 62 66 … … 86 90 /* Events */ 87 91 bool event (QEvent *aEvent); 92 void closeEvent (QCloseEvent *aEvent); 88 93 89 94 void retranslateUi(); -
trunk/src/VBox/Frontends/VirtualBox4/include/VBoxVMInformationDlg.h
r11532 r12695 64 64 void processStatistics(); 65 65 void onPageChanged (int aIndex); 66 void suicide(); 66 67 67 68 private: -
trunk/src/VBox/Frontends/VirtualBox4/src/QIMainDialog.cpp
r11343 r12695 44 44 , mRescode (QDialog::Rejected) 45 45 , mPolished (false) 46 , mCenterWidget (aParent) 46 47 { 47 48 qApp->installEventFilter (this); … … 216 217 void QIMainDialog::showEvent (QShowEvent *aEvent) 217 218 { 218 219 QMainWindow::showEvent (aEvent); 219 220 220 221 /* Polishing border */ … … 223 224 mPolished = true; 224 225 225 /* Explicit widget centering relatively to it's parent226 * if any or desktop if parent is missed. */227 vboxGlobal().centerWidget (this, parentWidget(), false);226 /* Explicit widget centering relatively to it's centering 227 * widget if any or desktop if centering widget is missed. */ 228 vboxGlobal().centerWidget (this, mCenterWidget, false); 228 229 } 229 230 -
trunk/src/VBox/Frontends/VirtualBox4/src/VBoxDiskImageManagerDlg.cpp
r12402 r12695 490 490 491 491 /* static */ 492 void VBoxDiskImageManagerDlg::showModeless (QWidget *aParent /* = NULL */, bool aRefresh /* = true */) 492 void VBoxDiskImageManagerDlg::showModeless (QWidget *aCenterWidget /* = NULL */, 493 bool aRefresh /* = true */) 493 494 { 494 495 if (!mModelessDialog) 495 496 { 496 mModelessDialog = 497 new VBoxDiskImageManagerDlg (aParent, Qt::Window); 497 mModelessDialog = new VBoxDiskImageManagerDlg (0, Qt::Window); 498 mModelessDialog->centerAccording (aCenterWidget); 499 connect (aCenterWidget, SIGNAL (closing()), mModelessDialog, SLOT (close())); 498 500 mModelessDialog->setAttribute (Qt::WA_DeleteOnClose); 499 501 mModelessDialog->setup (VBoxDefs::HD | VBoxDefs::CD | VBoxDefs::FD, -
trunk/src/VBox/Frontends/VirtualBox4/src/VBoxSelectorWnd.cpp
r12098 r12695 1104 1104 } 1105 1105 1106 void VBoxSelectorWnd::closeEvent (QCloseEvent *aEvent) 1107 { 1108 emit closing(); 1109 return QMainWindow::closeEvent (aEvent); 1110 } 1111 1106 1112 /** 1107 1113 * Sets the strings of the subwidgets using the current -
trunk/src/VBox/Frontends/VirtualBox4/src/VBoxVMInformationDlg.cpp
r11950 r12695 37 37 { 38 38 /* Creating new information dialog if there is no one existing */ 39 mSelfArray [machine.GetName()] = new VBoxVMInformationDlg ( 40 aConsole, aSession, Qt::Window); 41 mSelfArray [machine.GetName()]->setAttribute (Qt::WA_DeleteOnClose); 39 VBoxVMInformationDlg *id = new VBoxVMInformationDlg (aConsole, 40 aSession, Qt::Window); 41 id->centerAccording (aConsole); 42 connect (aConsole, SIGNAL (destroyed (QObject*)), id, SLOT (suicide())); 43 id->setAttribute (Qt::WA_DeleteOnClose); 44 mSelfArray [machine.GetName()] = id; 42 45 } 43 46 … … 53 56 const CSession &aSession, 54 57 Qt::WindowFlags aFlags) 55 : QIWithRetranslateUI2<QIMainDialog> ( aConsole, aFlags)58 : QIWithRetranslateUI2<QIMainDialog> (0, aFlags) 56 59 , mIsPolished (false) 57 60 , mConsole (aConsole) … … 294 297 void VBoxVMInformationDlg::showEvent (QShowEvent *aEvent) 295 298 { 296 QIMainDialog::showEvent (aEvent);297 298 299 /* One may think that QWidget::polish() is the right place to do things 299 300 * below, but apparently, by the time when QWidget::polish() is called, … … 301 302 * size hint is not properly calculated. Since this is sometimes necessary, 302 303 * we provide our own "polish" implementation */ 303 304 if (mIsPolished) 305 return; 306 307 /* Load window size and state */ 308 resize (mWidth, mHeight); 309 if (mMax) 310 QTimer::singleShot (0, this, SLOT (showMaximized())); 311 else 312 mIsPolished = true; 313 314 VBoxGlobal::centerWidget (this, parentWidget()); 304 if (!mIsPolished) 305 { 306 /* Load window size and state */ 307 resize (mWidth, mHeight); 308 if (mMax) 309 QTimer::singleShot (0, this, SLOT (showMaximized())); 310 else 311 mIsPolished = true; 312 } 313 314 QIMainDialog::showEvent (aEvent); 315 315 } 316 316 … … 345 345 /* Focusing the browser on shown page */ 346 346 mInfoStack->widget (aIndex)->setFocus(); 347 } 348 349 /** 350 * Opposing to deleteLater() slot this one makes it immediately. 351 */ 352 void VBoxVMInformationDlg::suicide() 353 { 354 delete this; 347 355 } 348 356 -
trunk/src/VBox/Frontends/VirtualBox4/src/VBoxVMLogViewer.cpp
r10337 r12695 41 41 VBoxVMLogViewer::LogViewersMap VBoxVMLogViewer::mSelfArray = LogViewersMap(); 42 42 43 void VBoxVMLogViewer::createLogViewer (QWidget *a Parent, CMachine &aMachine)44 { 45 if (!mSelfArray.contains (aMachine.GetName())) 46 { 47 /* creating new log viewer if there is no one existing */48 VBoxVMLogViewer *lv = new VBoxVMLogViewer ( aParent,49 Qt::Window, aMachine);50 /* Self destroy on close event */43 void VBoxVMLogViewer::createLogViewer (QWidget *aCenterWidget, CMachine &aMachine) 44 { 45 if (!mSelfArray.contains (aMachine.GetName())) 46 { 47 /* Creating new log viewer if there is no one existing */ 48 VBoxVMLogViewer *lv = new VBoxVMLogViewer (0, Qt::Window, aMachine); 49 lv->centerAccording (aCenterWidget); 50 connect (aCenterWidget, SIGNAL (closing()), lv, SLOT (close())); 51 51 lv->setAttribute (Qt::WA_DeleteOnClose); 52 52 mSelfArray [aMachine.GetName()] = lv; … … 91 91 /* Add missing buttons & retrieve standard buttons */ 92 92 mBtnHelp = mButtonBox->button (QDialogButtonBox::Help); 93 mBtnFind = mButtonBox->addButton (QString::null, QDialogButtonBox::ActionRole); 93 mBtnFind = mButtonBox->addButton (QString::null, QDialogButtonBox::ActionRole); 94 94 mBtnSave = mButtonBox->button (QDialogButtonBox::Save); 95 mBtnRefresh = mButtonBox->addButton (QString::null, QDialogButtonBox::ActionRole); 95 mBtnRefresh = mButtonBox->addButton (QString::null, QDialogButtonBox::ActionRole); 96 96 mBtnClose = mButtonBox->button (QDialogButtonBox::Close); 97 98 /* Fix the tab order to ensure the dialog keys are always the last */99 /* @todo: Not sure if this is necessary any longer. On Linux this looks100 * good in the default order. Keep in mind that with the QDialogButtonBox101 * the order isn't fixed any more. */102 // setTabOrder (mSearchPanel->focusProxy(), mBtnHelp);103 // setTabOrder (mBtnHelp, mBtnFind);104 // setTabOrder (mBtnFind, mBtnSave);105 // setTabOrder (mBtnSave, mBtnRefresh);106 // setTabOrder (mBtnRefresh, mBtnClose);107 // setTabOrder (mBtnClose, mLogList);108 97 109 98 /* Setup connections */ … … 125 114 /* Loading language constants */ 126 115 retranslateUi(); 127 128 116 } 129 117 … … 247 235 void VBoxVMLogViewer::currentLogPageChanged (int aIndex) 248 236 { 249 if (aIndex >= 0 && 237 if (aIndex >= 0 && 250 238 aIndex < mLogFilesList.count()) 251 239 setFileForProxyIcon (mLogFilesList.at (aIndex)); … … 263 251 mBtnFind->setText (tr ("&Find")); 264 252 mBtnRefresh->setText (tr ("&Refresh")); 265 mBtnSave->setText (tr ("&Save")); 266 mBtnClose->setText (tr ("Close")); 253 mBtnSave->setText (tr ("&Save")); 254 mBtnClose->setText (tr ("Close")); 267 255 } 268 256 … … 299 287 } 300 288 } 301 302 VBoxGlobal::centerWidget (this, parentWidget());303 289 } 304 290
Note:
See TracChangeset
for help on using the changeset viewer.