Changeset 7369 in vbox
- Timestamp:
- Mar 7, 2008 2:35:57 PM (17 years ago)
- svn:sync-xref-src-repo-rev:
- 28793
- Location:
- trunk/src/VBox/Frontends/VirtualBox4
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox4/include/QIMessageBox.h
r7220 r7369 20 20 #define __QIMessageBox_h__ 21 21 22 #include <qdialog.h> 23 #include <q3vbox.h> 24 #include <qmessagebox.h> 25 #include <qcheckbox.h> 26 #include <q3textedit.h> 27 //Added by qt3to4: 28 #include <QLabel> 22 /* Qt includes */ 23 #include <QDialog> 24 #include <QMessageBox> 25 #include <QCheckBox> 26 #include <QTextEdit> 29 27 30 28 class QIRichLabel; … … 68 66 void setButtonText (int aButton, const QString &aText); 69 67 70 QString flagText() const { return mFlagCB->is Shown() ? mFlagCB->text() : QString::null; }68 QString flagText() const { return mFlagCB->isVisible() ? mFlagCB->text() : QString::null; } 71 69 void setFlagText (const QString &aText); 72 70 … … 74 72 void setFlagChecked (bool aChecked) { mFlagCB->setChecked (aChecked); } 75 73 76 QString detailsText () const { return mDetailsText->t ext(); }74 QString detailsText () const { return mDetailsText->toHtml(); } 77 75 void setDetailsText (const QString &aText); 78 76 79 bool isDetailsShown() const { return mDetailsVBox->is Shown(); }77 bool isDetailsShown() const { return mDetailsVBox->isVisible(); } 80 78 void setDetailsShown (bool aShown); 81 79 82 80 private: 83 81 84 QPushButton *createButton ( QWidget *aParent,int aButton);82 QPushButton *createButton (int aButton); 85 83 86 84 private slots: … … 102 100 QIRichLabel *mTextLabel; 103 101 QPushButton *mButton0PB, *mButton1PB, *mButton2PB; 104 Q3VBox *mMessageVBox;105 102 QCheckBox *mFlagCB, *mFlagCB_Main, *mFlagCB_Details; 106 Q 3VBox*mDetailsVBox;107 Q 3TextEdit *mDetailsText;103 QWidget *mDetailsVBox; 104 QTextEdit *mDetailsText; 108 105 QSpacerItem *mSpacer; 109 106 }; -
trunk/src/VBox/Frontends/VirtualBox4/include/QIStateIndicator.h
r7220 r7369 20 20 #define __QIStateIndicator_h__ 21 21 22 #include <q3frame.h> 23 #include <qpixmap.h> 22 /* Qt includes */ 23 #include <QFrame> 24 #include <QHash> 24 25 25 #include <q3intdict.h> 26 //Added by qt3to4: 27 #include <QMouseEvent> 28 #include <QContextMenuEvent> 29 30 class QIStateIndicator : public Q3Frame 26 class QIStateIndicator : public QFrame 31 27 { 32 28 Q_OBJECT … … 34 30 public: 35 31 36 QIStateIndicator (int aState, 37 QWidget *aParent, const char *aName = 0, 38 Qt::WFlags aFlags = 0); 32 QIStateIndicator (int aState, QWidget *aParent); 33 ~QIStateIndicator(); 39 34 40 35 virtual QSize sizeHint() const; … … 59 54 protected: 60 55 56 virtual void paintEvent (QPaintEvent *event); 61 57 virtual void drawContents (QPainter *aPainter); 62 58 … … 85 81 }; 86 82 87 Q 3IntDict <Icon> mStateIcons;83 QHash <int, Icon *> mStateIcons; 88 84 }; 89 85 -
trunk/src/VBox/Frontends/VirtualBox4/include/QIStatusBar.h
r7220 r7369 20 20 #define __QIStatusBar_h__ 21 21 22 #include <qstatusbar.h> 23 //Added by qt3to4: 24 #include <QPaintEvent> 22 /* Qt includes */ 23 #include <QStatusBar> 25 24 26 25 class QPaintEvent; … … 32 31 public: 33 32 34 QIStatusBar (QWidget *parent = 0 , const char *name = 0);33 QIStatusBar (QWidget *parent = 0); 35 34 36 35 protected: -
trunk/src/VBox/Frontends/VirtualBox4/include/VBoxConsoleWnd.h
r7220 r7369 30 30 //Added by qt3to4: 31 31 #include <QContextMenuEvent> 32 #include <q3hbox.h> 32 33 #include <QLabel> 33 34 #include <Q3PopupMenu> -
trunk/src/VBox/Frontends/VirtualBox4/include/VBoxGlobal.h
r7342 r7369 733 733 * This class provides enable/disable menu items. 734 734 */ 735 class VBoxSwitchMenu : public Q 3PopupMenu735 class VBoxSwitchMenu : public QMenu 736 736 { 737 737 Q_OBJECT … … 747 747 void processAboutToShow(); 748 748 749 void processActivated (int);749 // void processActivated (int); 750 750 751 751 private: 752 752 753 753 QAction *mAction; 754 QString mTip;755 754 bool mInverted; 756 755 }; -
trunk/src/VBox/Frontends/VirtualBox4/include/VBoxProblemReporter.h
r7342 r7369 23 23 #include "QIMessageBox.h" 24 24 25 #include <qobject.h> 26 27 class Q3Process; 25 /* Qt icludes */ 26 #include <QObject> 28 27 29 28 class VBoxProblemReporter : public QObject -
trunk/src/VBox/Frontends/VirtualBox4/src/QIMessageBox.cpp
r7235 r7369 18 18 19 19 #include "QIMessageBox.h" 20 //Added by qt3to4:21 #include <Q3HBoxLayout>22 #include <q3mimefactory.h>23 #include <Q3VBoxLayout>24 20 #include "VBoxDefs.h" 25 21 #include "QIRichLabel.h" 26 22 27 #include <qpixmap.h> 28 #include <qlabel.h> 29 #include <qpushbutton.h> 30 #include <q3hbox.h> 31 #include <qlayout.h> 32 33 #include <qfontmetrics.h> 23 /* Qt includes */ 24 #include <QHBoxLayout> 25 #include <QPushButton> 26 #include <QLabel> 34 27 35 28 /** @class QIMessageBox … … 54 47 Qt::WStyle_Title | Qt::WStyle_SysMenu) 55 48 { 56 set Caption(aCaption);49 setWindowTitle (aCaption); 57 50 58 51 mButton0 = aButton0; … … 60 53 mButton2 = aButton2; 61 54 62 Q3VBoxLayout *layout = new Q3VBoxLayout (this); 63 /* setAutoAdd() behavior is really poor (it messes up with the order 64 * of widgets), never use it: layout->setAutoAdd (true); */ 55 QVBoxLayout *layout = new QVBoxLayout (this); 65 56 layout->setMargin (11); 66 57 layout->setSpacing (10); 67 layout->setResizeMode (QLayout::SetMinimumSize); 68 69 Q3HBox *main = new Q3HBox (this); 70 main->setMargin (0); 71 main->setSpacing (10); 58 layout->setSizeConstraint (QLayout::SetMinimumSize); 59 60 QWidget *main = new QWidget(); 61 62 QHBoxLayout *hLayout = new QHBoxLayout (main); 63 hLayout->setContentsMargins (0, 0, 0, 0); 64 hLayout->setSpacing (10); 72 65 layout->addWidget (main); 73 66 74 mIconLabel = new QLabel (main);67 mIconLabel = new QLabel(); 75 68 if (aIcon < GuruMeditation) 76 69 mIconLabel->setPixmap (QMessageBox::standardIcon ((QMessageBox::Icon) aIcon)); … … 79 72 mIconLabel->setSizePolicy (QSizePolicy::Fixed, QSizePolicy::Minimum); 80 73 mIconLabel->setAlignment (Qt::AlignHCenter | Qt::AlignTop); 81 82 mMessageVBox = new Q3VBox (main); 83 mMessageVBox->setMargin (0); 84 mMessageVBox->setSpacing (10); 85 86 mTextLabel = new QIRichLabel (aText, mMessageVBox); 74 hLayout->addWidget (mIconLabel); 75 76 QVBoxLayout* messageVBoxLayout = new QVBoxLayout(); 77 messageVBoxLayout->setContentsMargins (0, 0, 0, 0); 78 messageVBoxLayout->setSpacing (10); 79 hLayout->addLayout (messageVBoxLayout); 80 81 mTextLabel = new QIRichLabel (aText, NULL); 87 82 mTextLabel->setAlignment (Qt::AlignLeft | Qt::AlignTop | Qt::TextExpandTabs | Qt::TextWordWrap); 88 mTextLabel->setSizePolicy (QSizePolicy::Preferred, QSizePolicy::Preferred, true); 83 QSizePolicy sp (QSizePolicy::Preferred, QSizePolicy::Preferred); 84 sp.setHeightForWidth (true); 85 mTextLabel->setSizePolicy (sp); 89 86 mTextLabel->setMinimumWidth (mTextLabel->sizeHint().width()); 90 91 mFlagCB_Main = new QCheckBox (mMessageVBox); 87 messageVBoxLayout->addWidget (mTextLabel); 88 89 mFlagCB_Main = new QCheckBox(); 92 90 mFlagCB_Main->hide(); 93 94 mDetailsVBox = new Q3VBox (this); 95 mDetailsVBox->setMargin (0); 96 mDetailsVBox->setSpacing (10); 91 messageVBoxLayout->addWidget (mFlagCB_Main); 92 93 mDetailsVBox = new QWidget(); 97 94 layout->addWidget (mDetailsVBox); 98 95 99 mDetailsText = new Q3TextEdit (mDetailsVBox); 96 QVBoxLayout* detailsVBoxLayout = new QVBoxLayout(mDetailsVBox); 97 detailsVBoxLayout->setContentsMargins (0, 0, 0, 0); 98 detailsVBoxLayout->setSpacing (10); 99 100 mDetailsText = new QTextEdit(); 100 101 { 101 102 /* calculate the minimum size dynamically, approx. for 40 chars and … … 105 106 } 106 107 mDetailsText->setReadOnly (true); 107 mDetailsText->setWrapPolicy (Q3TextEdit::AtWordOrDocumentBoundary);108 108 mDetailsText->setSizePolicy (QSizePolicy::Expanding, 109 109 QSizePolicy::MinimumExpanding); 110 111 mFlagCB_Details = new QCheckBox (mDetailsVBox); 110 detailsVBoxLayout->addWidget (mDetailsText); 111 112 mFlagCB_Details = new QCheckBox(); 112 113 mFlagCB_Details->hide(); 114 detailsVBoxLayout->addWidget (mFlagCB_Details); 113 115 114 116 mSpacer = new QSpacerItem (0, 0); 115 117 layout->addItem (mSpacer); 116 118 117 Q3HBoxLayout *buttons = new Q3HBoxLayout (new QWidget (this)); 118 layout->addWidget (buttons->mainWidget()); 119 buttons->setAutoAdd (true); 120 buttons->setSpacing (5); 119 QHBoxLayout *buttonsHLayout = new QHBoxLayout(); 120 buttonsHLayout->setSpacing (5); 121 layout->addLayout (buttonsHLayout); 121 122 122 123 mButtonEsc = 0; 123 124 124 mButton0PB = createButton ( buttons->mainWidget(),aButton0);125 mButton0PB = createButton (aButton0); 125 126 if (mButton0PB) 127 { 128 buttonsHLayout->addWidget (mButton0PB); 126 129 connect (mButton0PB, SIGNAL (clicked()), SLOT (done0())); 127 mButton1PB = createButton (buttons->mainWidget(), aButton1); 130 } 131 mButton1PB = createButton (aButton1); 128 132 if (mButton1PB) 133 { 134 buttonsHLayout->addWidget (mButton1PB); 129 135 connect (mButton1PB, SIGNAL (clicked()), SLOT (done1())); 130 mButton2PB = createButton (buttons->mainWidget(), aButton2); 136 } 137 mButton2PB = createButton (aButton2); 131 138 if (mButton2PB) 139 { 140 buttonsHLayout->addWidget (mButton2PB); 132 141 connect (mButton2PB, SIGNAL (clicked()), SLOT (done2())); 133 134 buttons->setAlignment (Qt::AlignHCenter); 142 } 143 144 buttonsHLayout->setAlignment (Qt::AlignHCenter); 135 145 136 146 /* this call is a must -- it initializes mFlagCB and mSpacer */ … … 219 229 */ 220 230 221 QPushButton *QIMessageBox::createButton ( QWidget *aParent,int aButton)231 QPushButton *QIMessageBox::createButton (int aButton) 222 232 { 223 233 if (aButton == 0) … … 237 247 } 238 248 239 QPushButton *b = new QPushButton (text , aParent);249 QPushButton *b = new QPushButton (text); 240 250 241 251 if (aButton & Default) … … 291 301 if (aShown) 292 302 { 293 mFlagCB_Details->set Shown (mFlagCB_Main->isShown());303 mFlagCB_Details->setVisible (mFlagCB_Main->isVisible()); 294 304 mFlagCB_Details->setChecked (mFlagCB_Main->isChecked()); 295 305 mFlagCB_Details->setText (mFlagCB_Main->text()); 296 306 if (mFlagCB_Main->hasFocus()) 297 307 mFlagCB_Details->setFocus(); 298 mFlagCB_Main->set Shown(false);308 mFlagCB_Main->setVisible (false); 299 309 mFlagCB = mFlagCB_Details; 300 310 mSpacer->changeSize (0, 0, QSizePolicy::Minimum, QSizePolicy::Minimum); 301 311 } 302 312 303 mDetailsVBox->set Shown(aShown);313 mDetailsVBox->setVisible (aShown); 304 314 305 315 if (!aShown) 306 316 { 307 mFlagCB_Main->set Shown (mFlagCB_Details->isShown());317 mFlagCB_Main->setVisible (mFlagCB_Details->isVisible()); 308 318 mFlagCB_Main->setChecked (mFlagCB_Details->isChecked()); 309 319 mFlagCB_Main->setText (mFlagCB_Details->text()); -
trunk/src/VBox/Frontends/VirtualBox4/src/QIStateIndicator.cpp
r7220 r7369 19 19 #include "QIStateIndicator.h" 20 20 21 #include <qpainter.h> 22 //Added by qt3to4: 23 #include <QPixmap> 24 #include <QMouseEvent> 25 #include <Q3Frame> 26 #include <QContextMenuEvent> 21 /* Qt includes */ 22 #include <QPainter> 27 23 28 24 /** @clas QIStateIndicator … … 40 36 */ 41 37 QIStateIndicator::QIStateIndicator (int aState, 42 QWidget *aParent , const char *aName,43 Qt::WFlags aFlags)44 : Q3Frame (aParent, aName, aFlags | Qt::WStaticContents | Qt::WMouseNoMask)38 QWidget *aParent) 39 : QFrame (aParent) 40 // : QFrame (aParent, aName, aFlags | Qt::WStaticContents | Qt::WMouseNoMask) 45 41 { 46 42 mState = aState; 47 43 mSize = QSize (0, 0); 48 mStateIcons.setAutoDelete (true);49 44 50 45 setSizePolicy (QSizePolicy (QSizePolicy::Fixed, QSizePolicy::Fixed)); … … 53 48 * drawContents(), so try to set the correct bacground origin for the 54 49 * case when a pixmap is used as a widget background. */ 55 if (aParent) 56 setBackgroundOrigin (aParent->backgroundOrigin()); 50 // if (aParent) 51 // setBackgroundOrigin (aParent->backgroundOrigin()); 52 } 53 54 QIStateIndicator::~QIStateIndicator() 55 { 56 qDeleteAll (mStateIcons); 57 57 } 58 58 … … 92 92 { 93 93 mState = aState; 94 repaint (false); 94 repaint(); 95 } 96 97 void QIStateIndicator::paintEvent (QPaintEvent * /*event*/) 98 { 99 QPainter painter(this); 100 drawContents(&painter); 95 101 } 96 102 … … 98 104 { 99 105 Icon *icon = mStateIcons [mState]; 100 if ( !icon)106 if (icon) 101 107 { 102 erase(); 103 } 104 else 105 { 108 #warning port me 109 /* I didn't see any benefits of caching the icon 110 * background drawing in Qt4. This is already done 111 * by Qt itself. Also there is no "NoAutoErase" 112 * anymore. Disable this for now. */ 106 113 // if (testAttribute (Qt::WNoAutoErase)) 107 #warning port me 108 if(0) 109 { 110 QColor bgColor = paletteBackgroundColor(); 111 const QPixmap *bgPixmap = paletteBackgroundPixmap(); 112 QPoint bgOff = backgroundOffset(); 113 114 bool bgOffChanged = icon->bgOff != bgOff; 115 bool bgPixmapChanged = icon->bgPixmap != bgPixmap || 116 (icon->bgPixmap != NULL && 117 icon->bgPixmap->serialNumber() != bgPixmap->serialNumber()); 118 bool bgColorChanged = icon->bgColor != bgColor; 119 120 /* re-precompose the pixmap if any of these have changed */ 121 if (icon->cached.isNull() || 122 bgOffChanged || bgPixmapChanged || bgColorChanged) 123 { 124 int w = icon->pixmap.width(); 125 int h = icon->pixmap.height(); 126 if (icon->cached.isNull()) 127 icon->cached = QPixmap (w, h); 128 129 if (bgPixmap || bgOffChanged || bgPixmapChanged) 130 { 131 QPainter p (&icon->cached); 132 p.drawTiledPixmap (QRect (0, 0, w, h), *bgPixmap, bgOff); 133 } 134 else 135 { 136 icon->cached.fill (bgColor); 137 } 138 /* paint the icon on top of the widget background sample */ 139 #warning port me 114 // { 115 // QColor bgColor = paletteBackgroundColor(); 116 // const QPixmap *bgPixmap = paletteBackgroundPixmap(); 117 // QPoint bgOff = backgroundOffset(); 118 // 119 // bool bgOffChanged = icon->bgOff != bgOff; 120 // bool bgPixmapChanged = icon->bgPixmap != bgPixmap || 121 // (icon->bgPixmap != NULL && 122 // icon->bgPixmap->serialNumber() != bgPixmap->serialNumber()); 123 // bool bgColorChanged = icon->bgColor != bgColor; 124 // 125 // /* re-precompose the pixmap if any of these have changed */ 126 // if (icon->cached.isNull() || 127 // bgOffChanged || bgPixmapChanged || bgColorChanged) 128 // { 129 // int w = icon->pixmap.width(); 130 // int h = icon->pixmap.height(); 131 // if (icon->cached.isNull()) 132 // icon->cached = QPixmap (w, h); 133 // 134 // if (bgPixmap || bgOffChanged || bgPixmapChanged) 135 // { 136 // QPainter p (&icon->cached); 137 // p.drawTiledPixmap (QRect (0, 0, w, h), *bgPixmap, bgOff); 138 // } 139 // else 140 // { 141 // icon->cached.fill (bgColor); 142 // } 143 // /* paint the icon on top of the widget background sample */ 140 144 // bitBlt (&icon->cached, 0, 0, &icon->pixmap, 141 145 // 0, 0, w, h, CopyROP, false); 142 /* store the new values */143 icon->bgColor = bgColor;144 icon->bgPixmap = bgPixmap;145 icon->bgOff = bgOff;146 }147 /* draw the precomposed pixmap */148 aPainter->drawPixmap (contentsRect(), icon->cached);149 }150 else151 {146 // /* store the new values */ 147 // icon->bgColor = bgColor; 148 // icon->bgPixmap = bgPixmap; 149 // icon->bgOff = bgOff; 150 // } 151 // /* draw the precomposed pixmap */ 152 // aPainter->drawPixmap (contentsRect(), icon->cached); 153 // } 154 // else 155 // { 152 156 aPainter->drawPixmap (contentsRect(), icon->pixmap); 153 }157 // } 154 158 } 155 159 } … … 167 171 aEv->accept(); 168 172 else 169 Q 3Frame::mousePressEvent (aEv);173 QFrame::mousePressEvent (aEv); 170 174 } 171 175 #endif /* Q_WS_MAC */ -
trunk/src/VBox/Frontends/VirtualBox4/src/QIStatusBar.cpp
r7220 r7369 19 19 #include "QIStatusBar.h" 20 20 21 #include <qpainter.h> 22 #include <qsizegrip.h> 23 //Added by qt3to4: 24 #include <QPaintEvent> 21 /* Qt includes */ 22 #include <QPainter> 23 //#include <qsizegrip.h> 25 24 26 25 /** @clas QIStatusLine … … 31 30 */ 32 31 33 QIStatusBar::QIStatusBar (QWidget *parent , const char *name) :34 QStatusBar (parent , name)32 QIStatusBar::QIStatusBar (QWidget *parent) : 33 QStatusBar (parent) 35 34 { 36 35 connect ( … … 44 43 * widgets. 45 44 */ 46 void QIStatusBar::paintEvent (QPaintEvent * )45 void QIStatusBar::paintEvent (QPaintEvent *e) 47 46 { 48 QPainter p (this); 49 50 #ifndef QT_NO_SIZEGRIP 47 QStatusBar::paintEvent (e); 48 return; 49 #warning port me: is this needed anymore? 50 // QPainter p (this); 51 // 52 //#ifndef QT_NO_SIZEGRIP 51 53 // this will work provided that QStatusBar::setSizeGripEnabled() names 52 54 // its resizer child as specified (at least Qt 3.3.x does this). 53 QSizeGrip *resizer = (QSizeGrip *) child ("QStatusBar::resizer", "QSizeGrip"); 54 int psx = (resizer && resizer->isVisible()) ? resizer->x() : width() - 12; 55 #else 56 int psx = width() - 12; 57 #endif 58 59 if (!message.isEmpty()) { 60 p.setPen (colorGroup().foreground()); 61 p.drawText (6, 0, psx, height(), Qt::AlignVCenter | Qt::TextSingleLine, message); 62 } 55 //#warning port me: check this 56 // QSizeGrip *resizer = (QSizeGrip *) child ("QStatusBar::resizer", "QSizeGrip"); 57 // int psx = (resizer && resizer->isVisible()) ? resizer->x() : width() - 12; 58 //#else 59 // int psx = width() - 12; 60 //#endif 61 // 62 // if (!message.isEmpty()) 63 // { 64 // p.setPen (colorGroup().foreground()); 65 // p.drawText (6, 0, psx, height(), Qt::AlignVCenter | Qt::TextSingleLine, message); 66 // } 63 67 } -
trunk/src/VBox/Frontends/VirtualBox4/src/VBoxConsoleWnd.cpp
r7282 r7369 159 159 160 160 /* ensure status bar is created */ 161 new QIStatusBar (this , "statusBar");161 new QIStatusBar (this); 162 162 163 163 ///// Actions /////////////////////////////////////////////////////////// … … 418 418 indicatorBox->setSpacing (5); 419 419 /* i/o devices */ 420 hd_light = new QIStateIndicator (KDeviceActivity_Idle, indicatorBox , "hd_light", Qt::WNoAutoErase);420 hd_light = new QIStateIndicator (KDeviceActivity_Idle, indicatorBox); 421 421 hd_light->setStateIcon (KDeviceActivity_Idle, QPixmap (":/hd_16px.png")); 422 422 hd_light->setStateIcon (KDeviceActivity_Reading, QPixmap (":/hd_read_16px.png")); 423 423 hd_light->setStateIcon (KDeviceActivity_Writing, QPixmap (":/hd_write_16px.png")); 424 424 hd_light->setStateIcon (KDeviceActivity_Null, QPixmap (":/hd_disabled_16px.png")); 425 cd_light = new QIStateIndicator (KDeviceActivity_Idle, indicatorBox , "cd_light", Qt::WNoAutoErase);425 cd_light = new QIStateIndicator (KDeviceActivity_Idle, indicatorBox); 426 426 cd_light->setStateIcon (KDeviceActivity_Idle, QPixmap (":/cd_16px.png")); 427 427 cd_light->setStateIcon (KDeviceActivity_Reading, QPixmap (":/cd_read_16px.png")); 428 428 cd_light->setStateIcon (KDeviceActivity_Writing, QPixmap (":/cd_write_16px.png")); 429 429 cd_light->setStateIcon (KDeviceActivity_Null, QPixmap (":/cd_disabled_16px.png")); 430 fd_light = new QIStateIndicator (KDeviceActivity_Idle, indicatorBox , "fd_light", Qt::WNoAutoErase);430 fd_light = new QIStateIndicator (KDeviceActivity_Idle, indicatorBox); 431 431 fd_light->setStateIcon (KDeviceActivity_Idle, QPixmap (":/fd_16px.png")); 432 432 fd_light->setStateIcon (KDeviceActivity_Reading, QPixmap (":/fd_read_16px.png")); 433 433 fd_light->setStateIcon (KDeviceActivity_Writing, QPixmap (":/fd_write_16px.png")); 434 434 fd_light->setStateIcon (KDeviceActivity_Null, QPixmap (":/fd_disabled_16px.png")); 435 net_light = new QIStateIndicator (KDeviceActivity_Idle, indicatorBox , "net_light", Qt::WNoAutoErase);435 net_light = new QIStateIndicator (KDeviceActivity_Idle, indicatorBox); 436 436 net_light->setStateIcon (KDeviceActivity_Idle, QPixmap (":/nw_16px.png")); 437 437 net_light->setStateIcon (KDeviceActivity_Reading, QPixmap (":/nw_read_16px.png")); 438 438 net_light->setStateIcon (KDeviceActivity_Writing, QPixmap (":/nw_write_16px.png")); 439 439 net_light->setStateIcon (KDeviceActivity_Null, QPixmap (":/nw_disabled_16px.png")); 440 usb_light = new QIStateIndicator (KDeviceActivity_Idle, indicatorBox , "usb_light", Qt::WNoAutoErase);440 usb_light = new QIStateIndicator (KDeviceActivity_Idle, indicatorBox); 441 441 usb_light->setStateIcon (KDeviceActivity_Idle, QPixmap (":/usb_16px.png")); 442 442 usb_light->setStateIcon (KDeviceActivity_Reading, QPixmap (":/usb_read_16px.png")); 443 443 usb_light->setStateIcon (KDeviceActivity_Writing, QPixmap (":/usb_write_16px.png")); 444 444 usb_light->setStateIcon (KDeviceActivity_Null, QPixmap (":/usb_disabled_16px.png")); 445 sf_light = new QIStateIndicator (KDeviceActivity_Idle, indicatorBox , "sf_light", Qt::WNoAutoErase);445 sf_light = new QIStateIndicator (KDeviceActivity_Idle, indicatorBox); 446 446 sf_light->setStateIcon (KDeviceActivity_Idle, QPixmap (":/shared_folder_16px.png")); 447 447 sf_light->setStateIcon (KDeviceActivity_Reading, QPixmap (":/shared_folder_read_16px.png")); … … 465 465 466 466 /* mouse */ 467 mouse_state = new QIStateIndicator (0, indicatorBox , "mouse_state", Qt::WNoAutoErase);467 mouse_state = new QIStateIndicator (0, indicatorBox); 468 468 mouse_state->setStateIcon (0, QPixmap (":/mouse_disabled_16px.png")); 469 469 mouse_state->setStateIcon (1, QPixmap (":/mouse_16px.png")); … … 474 474 hostkey_hbox = new Q3HBox (indicatorBox, "hostkey_hbox"); 475 475 hostkey_hbox->setSpacing (3); 476 hostkey_state = new QIStateIndicator (0, hostkey_hbox , "hostkey_state");476 hostkey_state = new QIStateIndicator (0, hostkey_hbox); 477 477 hostkey_state->setStateIcon (0, QPixmap (":/hostkey_16px.png")); 478 478 hostkey_state->setStateIcon (1, QPixmap (":/hostkey_captured_16px.png")); … … 3249 3249 /* If seamless mode should be enabled then check if it is enabled 3250 3250 * currently and re-enable it if open-view procedure is finished */ 3251 if (vmSeamlessAction->is On() && mIsOpenViewFinished && aSeamlessSupported)3251 if (vmSeamlessAction->isChecked() && mIsOpenViewFinished && aSeamlessSupported) 3252 3252 toggleFullscreenMode (true, true); 3253 3253 … … 3422 3422 #endif 3423 3423 3424 VBoxSFDialog::VBoxSFDialog (QWidget *aParent, CSession &aSession) 3425 : QDialog (aParent, "VBoxSFDialog", true /* modal */, 3426 Qt::WType_Dialog | Qt::WShowModal) 3427 , mSettings (0), mSession (aSession) 3428 { 3424 VBoxSFDialog::VBoxSFDialog (QWidget *aParent, CSession &aSession) 3425 : QDialog (aParent) 3426 , mSettings (0) 3427 , mSession (aSession) 3428 { 3429 setModal (true); 3429 3430 /* Setup Dialog's options */ 3430 set Caption(tr ("Shared Folders"));3431 set Icon (QPixmap(":/select_file_16px.png"));3431 setWindowTitle (tr ("Shared Folders")); 3432 setWindowIcon (QIcon (":/select_file_16px.png")); 3432 3433 setSizeGripEnabled (true); 3433 3434 3434 3435 /* Setup main dialog's layout */ 3435 Q3VBoxLayout *mainLayout = new Q3VBoxLayout (this, 10, 10, "mainLayout"); 3436 QVBoxLayout *mainLayout = new QVBoxLayout (this); 3437 mainLayout->setContentsMargins (10, 10, 10, 10); 3438 mainLayout->setSpacing (10); 3436 3439 3437 3440 /* Setup settings layout */ … … 3444 3447 3445 3448 /* Setup button's layout */ 3446 Q3HBoxLayout *buttonLayout = new Q3HBoxLayout (mainLayout, 10, "buttonLayout"); 3447 QPushButton *pbHelp = new QPushButton (tr ("Help"), this, "pbHelp"); 3449 QHBoxLayout *buttonLayout = new QHBoxLayout(); 3450 buttonLayout->setSpacing (10); 3451 mainLayout->addLayout (buttonLayout); 3452 QPushButton *pbHelp = new QPushButton (tr ("Help")); 3448 3453 QSpacerItem *spacer = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum); 3449 QPushButton *pbOk = new QPushButton (tr ("&OK") , this, "pbOk");3450 QPushButton *pbCancel = new QPushButton (tr ("Cancel") , this, "pbCancel");3454 QPushButton *pbOk = new QPushButton (tr ("&OK")); 3455 QPushButton *pbCancel = new QPushButton (tr ("Cancel")); 3451 3456 connect (pbHelp, SIGNAL (clicked()), &vboxProblem(), SLOT (showHelpHelpDialog())); 3452 3457 connect (pbOk, SIGNAL (clicked()), this, SLOT (accept())); 3453 3458 connect (pbCancel, SIGNAL (clicked()), this, SLOT (reject())); 3454 pbHelp->set Accel(Qt::Key_F1);3459 pbHelp->setShortcut (Qt::Key_F1); 3455 3460 buttonLayout->addWidget (pbHelp); 3456 3461 buttonLayout->addItem (spacer); -
trunk/src/VBox/Frontends/VirtualBox4/src/VBoxGlobal.cpp
r7351 r7369 28 28 //Added by qt3to4: 29 29 #include <QDesktopWidget> 30 #include <Q3CString>31 #include <q3mimefactory.h>32 30 #include <QTranslator> 33 31 #include <Q3VBoxLayout> … … 51 49 #include <qlabel.h> 52 50 #include <qtoolbutton.h> 51 #include <qfileinfo.h> 52 #include <qdir.h> 53 #include <qmutex.h> 54 #include <qregexp.h> 55 #include <qlocale.h> 56 #include <QProcess> 57 #include <QList> 53 58 54 59 #ifdef Q_WS_X11 … … 58 63 #endif 59 64 60 #include <qfileinfo.h>61 #include <qdir.h>62 #include <qmutex.h>63 #include <qregexp.h>64 #include <qlocale.h>65 #include <q3process.h>66 67 #include <QList>68 65 69 66 #if defined (Q_WS_MAC) … … 3677 3674 for (size_t i = 0; i < ELEMENTS (commands); ++ i) 3678 3675 { 3679 QStringList args = QString List::split (':', commands [i]);3676 QStringList args = QString(commands [i]).split (':'); 3680 3677 args += aURL; 3681 Q 3Process cmd (args);3682 if ( cmd.start())3678 QString command = args.takeFirst(); 3679 if (QProcess::startDetached (command, args)) 3683 3680 return true; 3684 3681 } … … 3701 3698 { 3702 3699 ConstStr255Param hint (0x0); 3703 Q 3CString cs = aURL.local8Bit();3700 QByteArray cs = aURL.toLocal8Bit(); 3704 3701 const char* data = cs.data(); 3705 3702 long length = cs.length(); … … 4262 4259 VBoxSwitchMenu::VBoxSwitchMenu (QWidget *aParent, QAction *aAction, 4263 4260 bool aInverted) 4264 : Q 3PopupMenu (aParent), mAction (aAction), mInverted (aInverted)4261 : QMenu (aParent), mAction (aAction), mInverted (aInverted) 4265 4262 { 4266 4263 /* this menu works only with toggle action */ 4267 Assert (aAction->is ToggleAction());4264 Assert (aAction->isCheckable()); 4268 4265 connect (this, SIGNAL (aboutToShow()), 4269 4266 this, SLOT (processAboutToShow())); 4270 connect (this, SIGNAL (activated (int)),4271 this, SLOT (processActivated (int)));4267 // connect (this, SIGNAL (activated (int)), 4268 // this, SLOT (processActivated (int))); 4272 4269 } 4273 4270 4274 4271 void VBoxSwitchMenu::setToolTip (const QString &aTip) 4275 4272 { 4276 m Tip = aTip;4273 mAction->setToolTip (aTip); 4277 4274 } 4278 4275 4279 4276 void VBoxSwitchMenu::processAboutToShow() 4280 4277 { 4281 clear(); 4282 QString text = mAction->isOn() ^ mInverted ? tr ("Disable") : tr ("Enable"); 4283 int id = insertItem (text); 4284 setItemEnabled (id, mAction->isEnabled()); 4285 QToolTip::add (this, tr ("%1 %2").arg (text).arg (mTip)); 4286 } 4287 4288 void VBoxSwitchMenu::processActivated (int /*aIndex*/) 4289 { 4290 mAction->setOn (!mAction->isOn()); 4291 } 4278 QString text = mAction->isChecked() ^ mInverted ? tr ("Disable") : tr ("Enable"); 4279 mAction->setText (text); 4280 } 4281 4282 #warning port me: no longer needed? 4283 //void VBoxSwitchMenu::processActivated (int /*aIndex*/) 4284 //{ 4285 // mAction->toggle(); 4286 //} 4292 4287 4293 4288 #ifdef Q_WS_X11 -
trunk/src/VBox/Frontends/VirtualBox4/src/VBoxProblemReporter.cpp
r7351 r7369 27 27 #include "QIHotKeyEdit.h" 28 28 29 #include <qmessagebox.h> 30 #include <q3progressdialog.h> 31 #include <qcursor.h> 32 #include <q3process.h> 33 #include <qeventloop.h> 34 #include <qregexp.h> 29 /* Qt includes */ 30 #include <QProgressDialog> 31 #include <QProcess> 32 #include <QFileInfo> 35 33 #ifdef Q_WS_MAC 36 # include < qpushbutton.h>34 # include <QPushButton> 37 35 #endif 38 //Added by qt3to4:39 #include <QTimerEvent>40 #include <Q3CString>41 #include <QCloseEvent>42 36 43 37 #include <iprt/err.h> … … 63 57 * is destroyed. 64 58 */ 65 class VBoxProgressDialog : public Q 3ProgressDialog59 class VBoxProgressDialog : public QProgressDialog 66 60 { 67 61 public: 68 62 69 63 VBoxProgressDialog (CProgress &aProgress, const QString &aTitle, 70 int aMinDuration = 2000, QWidget *aCreator = 0, 71 const char *aName = 0) 72 : Q3ProgressDialog (aCreator, aName, true, 64 int aMinDuration = 2000, QWidget *aCreator = 0) 65 : QProgressDialog (aCreator, 73 66 Qt::WStyle_Customize | Qt::WStyle_DialogBorder | Qt::WStyle_Title) 74 67 , mProgress (aProgress) … … 79 72 , mEnded (false) 80 73 { 74 setModal (true); 81 75 if (mOpCount > 1) 82 76 setLabelText (QString (sOpDescTpl) … … 87 81 .arg (mProgress.GetOperationDescription())); 88 82 setCancelButtonText (QString::null); 89 set TotalSteps(100);90 set Caption(QString ("%1: %2")83 setMaximum (100); 84 setWindowTitle (QString ("%1: %2") 91 85 .arg (aTitle, mProgress.GetDescription())); 92 86 setMinimumDuration (aMinDuration); 93 87 setCancelEnabled (false); 94 set Progress(0);88 setValue (0); 95 89 } 96 90 … … 104 98 virtual void timerEvent (QTimerEvent *e); 105 99 106 virtual void reject() { if (mCalcelEnabled) Q 3ProgressDialog::reject(); };100 virtual void reject() { if (mCalcelEnabled) QProgressDialog::reject(); }; 107 101 108 102 virtual void closeEvent (QCloseEvent *e) 109 103 { 110 104 if (mCalcelEnabled) 111 Q 3ProgressDialog::closeEvent (e);105 QProgressDialog::closeEvent (e); 112 106 else 113 107 e->ignore(); … … 135 129 #warning port me 136 130 /* start a refresh timer */ 137 // startTimer (aRefreshInterval); 131 startTimer (aRefreshInterval); 132 // todo: Ok here I have no clue what this mean. 133 // I never saw someone calling the eventloop directly. 134 // Very inconventient. I will investigate this later. 135 // For now it seems to working correctly. 138 136 // mLoopLevel = qApp->eventLoop()->loopLevel(); 139 137 // /* enter the modal loop */ … … 142 140 // mLoopLevel = -1; 143 141 // mEnded = false; 144 return result();142 return exec(); 145 143 } 146 144 return Rejected; … … 158 156 if (mProgress.isOk()) 159 157 { 160 setProgress (100); 161 setResult (Accepted); 158 setValue (100); 159 accepted(); 160 // setResult (Accepted); 162 161 } 163 162 else 164 setResult (Rejected); 165 mEnded = justEnded = true; 163 rejected(); 164 // setResult (Rejected); 165 // 166 // mEnded = justEnded = true; 167 return; 166 168 } 167 169 … … 199 201 .arg (mCurOp).arg (mOpCount)); 200 202 } 201 set Progress(mProgress.GetPercent());203 setValue (mProgress.GetPercent()); 202 204 } 203 205 … … 300 302 { 301 303 vbox = vboxGlobal().virtualBox(); 302 msgs = QStringList::split (',', vbox.GetExtraData (VBoxDefs::GUI_SuppressMessages));303 if (msgs. findIndex (aAutoConfirmId) >= 0) {304 msgs = vbox.GetExtraData (VBoxDefs::GUI_SuppressMessages).split (','); 305 if (msgs.contains (aAutoConfirmId)) { 304 306 int rc = AutoConfirmed; 305 307 if (aButton1 & QIMessageBox::Default) … … 418 420 419 421 VBoxProgressDialog progressDlg (aProgress, aTitle, aMinDuration, 420 aParent , "progressDlg");422 aParent); 421 423 422 424 /* run the dialog with the 100 ms refresh interval */ … … 443 445 if (vboxGlobal().isVMConsoleProcess()) 444 446 { 445 if (vboxGlobal().consoleWnd().is Shown())447 if (vboxGlobal().consoleWnd().isVisible()) 446 448 return &vboxGlobal().consoleWnd(); 447 449 } 448 450 else 449 451 { 450 if (vboxGlobal().selectorWnd().is Shown())452 if (vboxGlobal().selectorWnd().isVisible()) 451 453 return &vboxGlobal().selectorWnd(); 452 454 } 453 455 #else 454 if (vboxGlobal().consoleWnd().is Shown())456 if (vboxGlobal().consoleWnd().isVisible()) 455 457 return &vboxGlobal().consoleWnd(); 456 if (vboxGlobal().selectorWnd().is Shown())458 if (vboxGlobal().selectorWnd().isVisible()) 457 459 return &vboxGlobal().selectorWnd(); 458 460 #endif … … 964 966 /* this should be in sync with VBoxVMListBoxItem::recache() */ 965 967 QFileInfo fi (machine.GetSettingsFilePath()); 966 name = fi. extension().lower() == "xml" ?967 fi. baseName (true) : fi.fileName();968 name = fi.suffix().toLower() == "xml" ? 969 fi.completeBaseName() : fi.fileName(); 968 970 msg = tr ("<p>Are you sure you want to unregister the inaccessible " 969 971 "virtual machine <b>%1</b>?</p>" … … 1844 1846 // - add common buttons like Retry/Save/PowerOff/whatever 1845 1847 1846 Q 3CStringautoConfimId = "showRuntimeError.";1848 QByteArray autoConfimId = "showRuntimeError."; 1847 1849 1848 1850 CConsole console = aConsole; … … 1874 1876 } 1875 1877 1876 autoConfimId += errorID. utf8();1878 autoConfimId += errorID.toUtf8(); 1877 1879 1878 1880 QString formatted; … … 2091 2093 Assert(RT_SUCCESS(rc)); 2092 2094 rc = RTPathAppPrivateArch (szViewerPath, sizeof (szViewerPath)); 2093 2094 QString fullProgPath = QString(szDocsPath); 2095 Q3Process kchmViewer (QString(szViewerPath) + "/kchmviewer"); 2096 kchmViewer.addArgument (fullProgPath + "/VirtualBox.chm"); 2097 kchmViewer.launch (QString("")); 2095 Assert(RT_SUCCESS(rc)); 2096 2097 QProcess::startDetached (QString(szViewerPath) + "/kchmviewer", 2098 QStringList (QString(szDocsPath) + "/VirtualBox.chm")); 2098 2099 #elif defined (Q_WS_MAC) 2099 Q3Process openApp (QString("/usr/bin/open")); 2100 openApp.addArgument (qApp->applicationDirPath() + "/UserManual.pdf"); 2101 openApp.launch (QString("")); 2100 QProcess::startDetached ("/usr/bin/open", 2101 QStringList (qApp->applicationDirPath() + "/UserManual.pdf")); 2102 2102 #endif 2103 2103 #endif /* VBOX_OSE */
Note:
See TracChangeset
for help on using the changeset viewer.