Changeset 7308 in vbox
- Timestamp:
- Mar 5, 2008 2:50:08 PM (17 years ago)
- svn:sync-xref-src-repo-rev:
- 28706
- Location:
- trunk/src/VBox/Frontends/VirtualBox4
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox4/include/VBoxSelectorWnd.h
r7246 r7308 24 24 #include "VBoxGlobal.h" 25 25 26 #include <qapplication.h> 26 /* Qt includes */ 27 27 #include <QMainWindow> 28 #include <q3listbox.h>29 #include <q3groupbox.h>30 #include <qaction.h>31 32 #include <q3valuelist.h>33 //Added by qt3to4:34 #include <QEvent>35 #include <QLabel>36 #include <Q3PopupMenu>37 28 38 29 class VBoxVMListBox; … … 42 33 class VBoxVMLogViewer; 43 34 44 class QLabel;45 class Q3TextBrowser;46 35 class QTabWidget; 47 struct QUuid; 36 class Q3ListBoxItem; 37 class QEvent; 38 class QUuid; 48 39 49 40 class VBoxSelectorWnd : public QMainWindow … … 54 45 55 46 VBoxSelectorWnd (VBoxSelectorWnd **aSelf, 56 QWidget* aParent = 0, const char* aName = 0,47 QWidget* aParent = 0, 57 48 Qt::WFlags aFlags = Qt::WType_TopLevel); 58 49 virtual ~VBoxSelectorWnd(); … … 114 105 115 106 /** VM list context menu */ 116 Q 3PopupMenu *mVMCtxtMenu;107 QMenu *mVMCtxtMenu; 117 108 118 109 /* actions */ … … 141 132 VBoxVMDescriptionPage *vmDescriptionPage; 142 133 143 Q3ValueList <CSession> sessions;144 145 134 QPoint normal_pos; 146 135 QSize normal_size; -
trunk/src/VBox/Frontends/VirtualBox4/include/VBoxToolBar.h
r7282 r7308 37 37 public: 38 38 39 VBoxToolBar (QMainWindow *aMainWindow, QWidget *aParent )40 : QToolBar (aParent), 39 VBoxToolBar (QMainWindow *aMainWindow, QWidget *aParent = NULL) 40 : QToolBar (aParent), 41 41 mMainWindow (aMainWindow) 42 42 { … … 54 54 void setUsesBigPixmaps (bool enable) 55 55 { 56 QSize bigSize(32, 32); 57 56 QSize size (32, 32); 57 if (!enable) 58 size = QSize (16, 16); 59 58 60 if (mMainWindow) 59 mMainWindow->setIconSize ( bigSize);61 mMainWindow->setIconSize (size); 60 62 else 61 setIconSize ( bigSize);63 setIconSize (size); 62 64 } 63 65 64 66 void setUsesTextLabel (bool enable) 65 67 { 68 Qt::ToolButtonStyle tbs = Qt::ToolButtonTextUnderIcon; 69 if (!enable) 70 tbs = Qt::ToolButtonIconOnly; 71 66 72 if (mMainWindow) 67 mMainWindow->setToolButtonStyle ( Qt::ToolButtonTextUnderIcon);73 mMainWindow->setToolButtonStyle (tbs); 68 74 else 69 setToolButtonStyle ( Qt::ToolButtonTextUnderIcon);75 setToolButtonStyle (tbs); 70 76 } 71 77 -
trunk/src/VBox/Frontends/VirtualBox4/src/VBoxGlobal.cpp
r7250 r7308 863 863 * from the below constructor or from constructors/methods it calls. 864 864 */ 865 VBoxSelectorWnd *w = new VBoxSelectorWnd (&mSelectorWnd, 0 , "selectorWnd");865 VBoxSelectorWnd *w = new VBoxSelectorWnd (&mSelectorWnd, 0); 866 866 Assert (w == mSelectorWnd); 867 867 NOREF(w); -
trunk/src/VBox/Frontends/VirtualBox4/src/VBoxSelectorWnd.cpp
r7250 r7308 30 30 #include "VBoxVMLogViewer.h" 31 31 32 #include <qlabel.h>33 #include <QTextBrowser>34 #include <q3textbrowser.h>35 #include <qmenubar.h>36 #include <q3popupmenu.h>37 #include <qmessagebox.h>38 #include <qwidget.h>39 #include <qtabwidget.h>40 #include <q3widgetstack.h>41 #include <qpushbutton.h>42 #include <q3process.h>43 44 #include <qlayout.h>45 #include <q3vbox.h>46 //Added by qt3to4:47 #include <QDesktopWidget>48 #include <Q3HBoxLayout>49 #include <Q3Frame>50 #include <q3mimefactory.h>51 #include <QResizeEvent>52 #include <QEvent>53 #include <Q3VBoxLayout>54 #include <QMenuItem>55 56 32 #ifdef Q_WS_X11 57 33 #include <iprt/env.h> 58 34 #endif 59 35 36 /* Qt includes */ 37 #include <QTextBrowser> 38 #include <QMenuBar> 39 #include <QMenu> 40 #include <QMenuItem> 41 #include <QStackedWidget> 42 #include <QDesktopWidget> 60 43 61 44 // VBoxVMDetailsView class … … 66 49 * and another one for inaccessibility errors. 67 50 */ 68 class VBoxVMDetailsView : public Q 3WidgetStack51 class VBoxVMDetailsView : public QStackedWidget 69 52 { 70 53 Q_OBJECT … … 72 55 public: 73 56 74 VBoxVMDetailsView (QWidget *aParent, const char *aName,57 VBoxVMDetailsView (QWidget *aParent, 75 58 QAction *aRefreshAction = NULL); 76 59 … … 80 63 { 81 64 mDetailsText->setText (aText); 82 raiseWidget(0);65 setCurrentIndex (0); 83 66 } 84 67 … … 87 70 createErrPage(); 88 71 mErrText->setText (aText); 89 raiseWidget(1);72 setCurrentIndex (1); 90 73 } 91 74 … … 93 76 { 94 77 mDetailsText->setText (QString::null); 95 raiseWidget(0);78 setCurrentIndex (0); 96 79 } 97 80 … … 120 103 QWidget *mErrBox; 121 104 QLabel *mErrLabel; 122 Q 3TextBrowser *mErrText;105 QTextBrowser *mErrText; 123 106 QToolButton *mRefreshButton; 124 107 QAction *mRefreshAction; 125 108 }; 126 109 127 VBoxVMDetailsView::VBoxVMDetailsView (QWidget *aParent, const char *aName,110 VBoxVMDetailsView::VBoxVMDetailsView (QWidget *aParent, 128 111 QAction *aRefreshAction /* = NULL */) 129 : Q 3WidgetStack (aParent, aName)112 : QStackedWidget (aParent) 130 113 , mErrBox (NULL), mErrLabel (NULL), mErrText (NULL) 131 114 , mRefreshButton (NULL) … … 150 133 this, SLOT (gotLinkClicked (const QUrl &))); 151 134 152 addWidget (mDetailsText , 0);135 addWidget (mDetailsText); 153 136 } 154 137 … … 162 145 mErrBox = new QWidget(); 163 146 164 Q 3VBoxLayout *layout = new Q3VBoxLayout (mErrBox);165 layout->setSpacing (10);147 QVBoxLayout *pVLayout = new QVBoxLayout (mErrBox); 148 pVLayout->setSpacing (10); 166 149 167 150 mErrLabel = new QLabel (mErrBox); 168 151 mErrLabel->setAlignment (Qt::WordBreak); 169 152 mErrLabel->setSizePolicy (QSizePolicy::Expanding, QSizePolicy::Fixed); 170 layout->add (mErrLabel);171 172 mErrText = new Q 3TextBrowser (mErrBox);153 pVLayout->add (mErrLabel); 154 155 mErrText = new QTextBrowser (mErrBox); 173 156 mErrText->setFocusPolicy (Qt::StrongFocus); 174 mErrText-> setLinkUnderline (false);175 layout->add (mErrText);157 mErrText->document()->setDefaultStyleSheet ("a { text-decoration: none; }"); 158 pVLayout->add (mErrText); 176 159 177 160 if (mRefreshAction) … … 180 163 mRefreshButton->setFocusPolicy (Qt::StrongFocus); 181 164 182 Q 3HBoxLayout *hLayout = new Q3HBoxLayout (layout);183 hLayout->addItem (new QSpacerItem (0, 0, QSizePolicy::Expanding,184 QSizePolicy::Minimum));185 hLayout->add (mRefreshButton);165 QHBoxLayout *pHLayout = new QHBoxLayout (pVLayout); 166 pHLayout->addItem (new QSpacerItem (0, 0, QSizePolicy::Expanding, 167 QSizePolicy::Minimum)); 168 pHLayout->add (mRefreshButton); 186 169 187 170 connect (mRefreshButton, SIGNAL (clicked()), … … 189 172 } 190 173 191 layout->addItem (new QSpacerItem (0, 0, QSizePolicy::Minimum,174 pVLayout->addItem (new QSpacerItem (0, 0, QSizePolicy::Minimum, 192 175 QSizePolicy::Expanding)); 193 176 194 addWidget (mErrBox , 1);177 addWidget (mErrBox); 195 178 196 179 languageChange(); … … 249 232 VBoxSelectorWnd *mParent; 250 233 QToolButton *mBtnEdit; 251 Q 3TextBrowser *mBrowser;234 QTextBrowser *mBrowser; 252 235 QLabel *mLabel; 253 236 }; … … 260 243 { 261 244 /* main layout */ 262 Q3VBoxLayout *mainLayout = new Q3VBoxLayout (this, 0, 10, "mainLayout"); 245 QVBoxLayout *pVMainLayout = new QVBoxLayout (this); 246 pVMainLayout->setSpacing (10); 247 pVMainLayout->setContentsMargins (0, 0, 0, 0); 263 248 264 249 /* mBrowser */ 265 mBrowser = new Q 3TextBrowser (this, "mBrowser");250 mBrowser = new QTextBrowser (this, "mBrowser"); 266 251 mBrowser->setSizePolicy (QSizePolicy::Expanding, QSizePolicy::Expanding); 267 252 mBrowser->setFocusPolicy (Qt::StrongFocus); 268 mBrowser-> setLinkUnderline (false);269 mainLayout->addWidget (mBrowser);253 mBrowser->document()->setDefaultStyleSheet ("a { text-decoration: none; }"); 254 pVMainLayout->addWidget (mBrowser); 270 255 /* hidden by default */ 271 256 mBrowser->setHidden (true); … … 275 260 mLabel->setSizePolicy (QSizePolicy::Expanding, QSizePolicy::Expanding); 276 261 mLabel->setAlignment (Qt::AlignCenter | Qt::WordBreak); 277 mainLayout->addWidget (mLabel);262 pVMainLayout->addWidget (mLabel); 278 263 /* always disabled */ 279 264 mLabel->setEnabled (false); 280 265 281 266 /* button layout */ 282 Q3HBoxLayout *btnLayout = new Q3HBoxLayout (mainLayout, 10, "btnLayout"); 283 btnLayout->addItem (new QSpacerItem (0, 0, 284 QSizePolicy::Expanding, 285 QSizePolicy::Minimum)); 267 QHBoxLayout *pHBtnLayout = new QHBoxLayout (pVMainLayout); 268 pHBtnLayout->setSpacing (10); 269 pHBtnLayout->addItem (new QSpacerItem (0, 0, 270 QSizePolicy::Expanding, 271 QSizePolicy::Minimum)); 286 272 287 273 /* button */ … … 294 280 mBtnEdit->setUsesTextLabel (true); 295 281 connect (mBtnEdit, SIGNAL (clicked()), this, SLOT (goToSettings())); 296 btnLayout->addWidget (mBtnEdit);297 298 mainLayout->addItem (new QSpacerItem (0, 0,282 pHBtnLayout->addWidget (mBtnEdit); 283 284 pVMainLayout->addItem (new QSpacerItem (0, 0, 299 285 QSizePolicy::Expanding, 300 286 QSizePolicy::Minimum)); … … 392 378 */ 393 379 VBoxSelectorWnd:: 394 VBoxSelectorWnd (VBoxSelectorWnd **aSelf, QWidget* aParent, const char* aName,380 VBoxSelectorWnd (VBoxSelectorWnd **aSelf, QWidget* aParent, 395 381 Qt::WFlags aFlags) 396 382 : QMainWindow (aParent, aFlags) … … 462 448 463 449 /* central widget & horizontal layout */ 464 setCentralWidget (new QWidget (this, "centralWidget")); 465 Q3HBoxLayout *centralLayout = 466 new Q3HBoxLayout (centralWidget(), 5, 9, "centralLayout"); 450 setCentralWidget (new QWidget (this)); 451 QHBoxLayout *pCentralLayout = 452 new QHBoxLayout (centralWidget()); 453 pCentralLayout->setSpacing (9); 454 pCentralLayout->setContentsMargins (5, 5, 5, 5); 467 455 468 456 /* left vertical box */ 469 Q 3VBox *leftVBox = new Q3VBox (centralWidget(), "leftWidget");470 leftVBox->setSpacing (5);457 QVBoxLayout *pLeftVLayout = new QVBoxLayout (); 458 pLeftVLayout->setSpacing (5); 471 459 /* right vertical box */ 472 Q 3VBox *rightVBox = new Q3VBox (centralWidget(), "rightWidget");473 rightVBox->setSpacing (5);474 centralLayout->addWidget (leftVBox, 3);475 centralLayout->addWidget (rightVBox, 5);460 QVBoxLayout *pRightVLayout = new QVBoxLayout (); 461 pRightVLayout->setSpacing (5); 462 pCentralLayout->addLayout (pLeftVLayout, 3); 463 pCentralLayout->addLayout (pRightVLayout, 3); 476 464 477 465 /* VM list toolbar */ 478 VBoxToolBar *vmTools = new VBoxToolBar (this, leftVBox); 466 VBoxToolBar *vmTools = new VBoxToolBar (this); 467 pLeftVLayout->addWidget(vmTools); 479 468 480 469 /* VM list box */ 481 vmListBox = new VBoxVMListBox (leftVBox, "vmListBox"); 470 vmListBox = new VBoxVMListBox (); 471 pLeftVLayout->addWidget (vmListBox); 482 472 483 473 /* VM tab widget containing details and snapshots tabs */ 484 vmTabWidget = new QTabWidget (rightVBox, "vmTabWidget"); 474 vmTabWidget = new QTabWidget (); 475 pRightVLayout->addWidget (vmTabWidget); 485 476 vmTabWidget->setMargin (10); 486 477 487 478 /* VM details view */ 488 vmDetailsView = new VBoxVMDetailsView (NULL, "vmDetailsView",479 vmDetailsView = new VBoxVMDetailsView (NULL, 489 480 vmRefreshAction); 490 481 vmTabWidget->addTab (vmDetailsView, … … 511 502 // setUsesTextLabel (true); 512 503 // setUsesBigPixmaps (true); 504 vmTools->setIconSize (QSize (32, 32)); 505 vmTools->setToolButtonStyle (Qt::ToolButtonTextUnderIcon); 513 506 vmTools->setSizePolicy (QSizePolicy::Fixed, QSizePolicy::Preferred); 514 507 … … 526 519 /* add actions to menubar */ 527 520 528 Q 3PopupMenu *fileMenu = new Q3PopupMenu(this, "fileMenu");521 QMenu *fileMenu = menuBar()->addMenu(tr("&File")); 529 522 fileDiskMgrAction->addTo( fileMenu ); 530 523 fileMenu->insertSeparator(); … … 535 528 menuBar()->insertItem( QString::null, fileMenu, 1); 536 529 537 Q 3PopupMenu *vmMenu = new Q3PopupMenu (this, "vmMenu");530 QMenu *vmMenu = menuBar()->addMenu(tr("&Machine")); 538 531 vmNewAction->addTo (vmMenu); 539 532 vmMenu->insertSeparator(); … … 552 545 menuBar()->insertItem (QString::null, vmMenu, 2); 553 546 554 mVMCtxtMenu = new Q 3PopupMenu (this, "mVMCtxtMenu");547 mVMCtxtMenu = new QMenu (this); 555 548 vmConfigAction->addTo (mVMCtxtMenu); 556 549 vmDeleteAction->addTo (mVMCtxtMenu); … … 565 558 vmShowLogsAction->addTo (mVMCtxtMenu); 566 559 567 Q 3PopupMenu *helpMenu = new Q3PopupMenu( this, "helpMenu");560 QMenu *helpMenu = menuBar()->addMenu(tr("&Help")); 568 561 helpContentsAction->addTo (helpMenu); 569 562 helpWebAction->addTo (helpMenu);
Note:
See TracChangeset
for help on using the changeset viewer.