VirtualBox

Changeset 7369 in vbox


Ignore:
Timestamp:
Mar 7, 2008 2:35:57 PM (17 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
28793
Message:

FE/Qt4: Removed several Qt3 support warnings. Replaced Q3* classes with the corresponding Qt4 classes.

Location:
trunk/src/VBox/Frontends/VirtualBox4
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox4/include/QIMessageBox.h

    r7220 r7369  
    2020#define __QIMessageBox_h__
    2121
    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>
    2927
    3028class QIRichLabel;
     
    6866    void setButtonText (int aButton, const QString &aText);
    6967
    70     QString flagText() const { return mFlagCB->isShown() ? mFlagCB->text() : QString::null; }
     68    QString flagText() const { return mFlagCB->isVisible() ? mFlagCB->text() : QString::null; }
    7169    void setFlagText (const QString &aText);
    7270
     
    7472    void setFlagChecked (bool aChecked) { mFlagCB->setChecked (aChecked); }
    7573
    76     QString detailsText () const { return mDetailsText->text(); }
     74    QString detailsText () const { return mDetailsText->toHtml(); }
    7775    void setDetailsText (const QString &aText);
    7876
    79     bool isDetailsShown() const { return mDetailsVBox->isShown(); }
     77    bool isDetailsShown() const { return mDetailsVBox->isVisible(); }
    8078    void setDetailsShown (bool aShown);
    8179
    8280private:
    8381
    84     QPushButton *createButton (QWidget *aParent, int aButton);
     82    QPushButton *createButton (int aButton);
    8583
    8684private slots:
     
    102100    QIRichLabel *mTextLabel;
    103101    QPushButton *mButton0PB, *mButton1PB, *mButton2PB;
    104     Q3VBox *mMessageVBox;
    105102    QCheckBox *mFlagCB, *mFlagCB_Main, *mFlagCB_Details;
    106     Q3VBox *mDetailsVBox;
    107     Q3TextEdit *mDetailsText;
     103    QWidget *mDetailsVBox;
     104    QTextEdit *mDetailsText;
    108105    QSpacerItem *mSpacer;
    109106};
  • trunk/src/VBox/Frontends/VirtualBox4/include/QIStateIndicator.h

    r7220 r7369  
    2020#define __QIStateIndicator_h__
    2121
    22 #include <q3frame.h>
    23 #include <qpixmap.h>
     22/* Qt includes */
     23#include <QFrame>
     24#include <QHash>
    2425
    25 #include <q3intdict.h>
    26 //Added by qt3to4:
    27 #include <QMouseEvent>
    28 #include <QContextMenuEvent>
    29 
    30 class QIStateIndicator : public Q3Frame
     26class QIStateIndicator : public QFrame
    3127{
    3228    Q_OBJECT
     
    3430public:
    3531
    36     QIStateIndicator (int aState,
    37                       QWidget *aParent, const char *aName = 0,
    38                       Qt::WFlags aFlags = 0);
     32    QIStateIndicator (int aState, QWidget *aParent);
     33    ~QIStateIndicator();
    3934
    4035    virtual QSize sizeHint() const;
     
    5954protected:
    6055
     56    virtual void paintEvent (QPaintEvent *event);
    6157    virtual void drawContents (QPainter *aPainter);
    6258
     
    8581    };
    8682
    87     Q3IntDict <Icon> mStateIcons;
     83    QHash <int, Icon *> mStateIcons;
    8884};
    8985
  • trunk/src/VBox/Frontends/VirtualBox4/include/QIStatusBar.h

    r7220 r7369  
    2020#define __QIStatusBar_h__
    2121
    22 #include <qstatusbar.h>
    23 //Added by qt3to4:
    24 #include <QPaintEvent>
     22/* Qt includes */
     23#include <QStatusBar>
    2524
    2625class QPaintEvent;
     
    3231public:
    3332
    34     QIStatusBar (QWidget *parent = 0, const char *name = 0);
     33    QIStatusBar (QWidget *parent = 0);
    3534
    3635protected:
  • trunk/src/VBox/Frontends/VirtualBox4/include/VBoxConsoleWnd.h

    r7220 r7369  
    3030//Added by qt3to4:
    3131#include <QContextMenuEvent>
     32#include <q3hbox.h>
    3233#include <QLabel>
    3334#include <Q3PopupMenu>
  • trunk/src/VBox/Frontends/VirtualBox4/include/VBoxGlobal.h

    r7342 r7369  
    733733 *  This class provides enable/disable menu items.
    734734 */
    735 class VBoxSwitchMenu : public Q3PopupMenu
     735class VBoxSwitchMenu : public QMenu
    736736{
    737737    Q_OBJECT
     
    747747    void processAboutToShow();
    748748
    749     void processActivated (int);
     749//    void processActivated (int);
    750750
    751751private:
    752752
    753753    QAction *mAction;
    754     QString  mTip;
    755754    bool     mInverted;
    756755};
  • trunk/src/VBox/Frontends/VirtualBox4/include/VBoxProblemReporter.h

    r7342 r7369  
    2323#include "QIMessageBox.h"
    2424
    25 #include <qobject.h>
    26 
    27 class Q3Process;
     25/* Qt icludes */
     26#include <QObject>
    2827
    2928class VBoxProblemReporter : public QObject
  • trunk/src/VBox/Frontends/VirtualBox4/src/QIMessageBox.cpp

    r7235 r7369  
    1818
    1919#include "QIMessageBox.h"
    20 //Added by qt3to4:
    21 #include <Q3HBoxLayout>
    22 #include <q3mimefactory.h>
    23 #include <Q3VBoxLayout>
    2420#include "VBoxDefs.h"
    2521#include "QIRichLabel.h"
    2622
    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>
    3427
    3528/** @class QIMessageBox
     
    5447                        Qt::WStyle_Title | Qt::WStyle_SysMenu)
    5548{
    56     setCaption (aCaption);
     49    setWindowTitle (aCaption);
    5750
    5851    mButton0 = aButton0;
     
    6053    mButton2 = aButton2;
    6154
    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);
    6556    layout->setMargin (11);
    6657    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);
    7265    layout->addWidget (main);
    7366
    74     mIconLabel = new QLabel (main);
     67    mIconLabel = new QLabel();
    7568        if (aIcon < GuruMeditation)
    7669        mIconLabel->setPixmap (QMessageBox::standardIcon ((QMessageBox::Icon) aIcon));
     
    7972    mIconLabel->setSizePolicy (QSizePolicy::Fixed, QSizePolicy::Minimum);
    8073    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);
    8782    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);
    8986    mTextLabel->setMinimumWidth (mTextLabel->sizeHint().width());
    90 
    91     mFlagCB_Main = new QCheckBox (mMessageVBox);
     87    messageVBoxLayout->addWidget (mTextLabel);
     88
     89    mFlagCB_Main = new QCheckBox();
    9290    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();
    9794    layout->addWidget (mDetailsVBox);
    9895
    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();
    100101    {
    101102        /* calculate the minimum size dynamically, approx. for 40 chars and
     
    105106    }
    106107    mDetailsText->setReadOnly (true);
    107     mDetailsText->setWrapPolicy (Q3TextEdit::AtWordOrDocumentBoundary);
    108108    mDetailsText->setSizePolicy (QSizePolicy::Expanding,
    109109                                 QSizePolicy::MinimumExpanding);
    110 
    111     mFlagCB_Details = new QCheckBox (mDetailsVBox);
     110    detailsVBoxLayout->addWidget (mDetailsText);
     111
     112    mFlagCB_Details = new QCheckBox();
    112113    mFlagCB_Details->hide();
     114    detailsVBoxLayout->addWidget (mFlagCB_Details);
    113115
    114116    mSpacer = new QSpacerItem (0, 0);
    115117    layout->addItem (mSpacer);
    116118
    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);
    121122
    122123    mButtonEsc = 0;
    123124
    124     mButton0PB = createButton (buttons->mainWidget(), aButton0);
     125    mButton0PB = createButton (aButton0);
    125126    if (mButton0PB)
     127    {
     128        buttonsHLayout->addWidget (mButton0PB);
    126129        connect (mButton0PB, SIGNAL (clicked()), SLOT (done0()));
    127     mButton1PB = createButton (buttons->mainWidget(), aButton1);
     130    }
     131    mButton1PB = createButton (aButton1);
    128132    if (mButton1PB)
     133    {
     134        buttonsHLayout->addWidget (mButton1PB);
    129135        connect (mButton1PB, SIGNAL (clicked()), SLOT (done1()));
    130     mButton2PB = createButton (buttons->mainWidget(), aButton2);
     136    }
     137    mButton2PB = createButton (aButton2);
    131138    if (mButton2PB)
     139    {
     140        buttonsHLayout->addWidget (mButton2PB);
    132141        connect (mButton2PB, SIGNAL (clicked()), SLOT (done2()));
    133 
    134     buttons->setAlignment (Qt::AlignHCenter);
     142    }
     143
     144    buttonsHLayout->setAlignment (Qt::AlignHCenter);
    135145
    136146    /* this call is a must -- it initializes mFlagCB and mSpacer */
     
    219229 */
    220230
    221 QPushButton *QIMessageBox::createButton (QWidget *aParent, int aButton)
     231QPushButton *QIMessageBox::createButton (int aButton)
    222232{
    223233    if (aButton == 0)
     
    237247    }
    238248
    239     QPushButton *b = new QPushButton (text, aParent);
     249    QPushButton *b = new QPushButton (text);
    240250
    241251    if (aButton & Default)
     
    291301    if (aShown)
    292302    {
    293         mFlagCB_Details->setShown (mFlagCB_Main->isShown());
     303        mFlagCB_Details->setVisible (mFlagCB_Main->isVisible());
    294304        mFlagCB_Details->setChecked (mFlagCB_Main->isChecked());
    295305        mFlagCB_Details->setText (mFlagCB_Main->text());
    296306        if (mFlagCB_Main->hasFocus())
    297307            mFlagCB_Details->setFocus();
    298         mFlagCB_Main->setShown (false);
     308        mFlagCB_Main->setVisible (false);
    299309        mFlagCB = mFlagCB_Details;
    300310        mSpacer->changeSize (0, 0, QSizePolicy::Minimum, QSizePolicy::Minimum);
    301311    }
    302312
    303     mDetailsVBox->setShown (aShown);
     313    mDetailsVBox->setVisible (aShown);
    304314
    305315    if (!aShown)
    306316    {
    307         mFlagCB_Main->setShown (mFlagCB_Details->isShown());
     317        mFlagCB_Main->setVisible (mFlagCB_Details->isVisible());
    308318        mFlagCB_Main->setChecked (mFlagCB_Details->isChecked());
    309319        mFlagCB_Main->setText (mFlagCB_Details->text());
  • trunk/src/VBox/Frontends/VirtualBox4/src/QIStateIndicator.cpp

    r7220 r7369  
    1919#include "QIStateIndicator.h"
    2020
    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>
    2723
    2824/** @clas QIStateIndicator
     
    4036 */
    4137QIStateIndicator::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)
    4541{
    4642    mState = aState;
    4743    mSize = QSize (0, 0);
    48     mStateIcons.setAutoDelete (true);
    4944
    5045    setSizePolicy (QSizePolicy (QSizePolicy::Fixed, QSizePolicy::Fixed));
     
    5348     * drawContents(), so try to set the correct bacground origin for the
    5449     * 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
     54QIStateIndicator::~QIStateIndicator()
     55{
     56    qDeleteAll (mStateIcons);
    5757}
    5858
     
    9292{
    9393    mState = aState;
    94     repaint (false);
     94    repaint();
     95}
     96
     97void QIStateIndicator::paintEvent (QPaintEvent * /*event*/)
     98{
     99    QPainter painter(this);
     100    drawContents(&painter);
    95101}
    96102
     
    98104{
    99105    Icon *icon = mStateIcons [mState];
    100     if (!icon)
     106    if (icon)
    101107    {
    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. */
    106113//        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 */
    140144//                bitBlt (&icon->cached, 0, 0, &icon->pixmap,
    141145//                        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         else
    151         {
     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//        {
    152156            aPainter->drawPixmap (contentsRect(), icon->pixmap);
    153         }
     157//        }
    154158    }
    155159}
     
    167171        aEv->accept();
    168172    else
    169         Q3Frame::mousePressEvent (aEv);
     173        QFrame::mousePressEvent (aEv);
    170174}
    171175#endif /* Q_WS_MAC */
  • trunk/src/VBox/Frontends/VirtualBox4/src/QIStatusBar.cpp

    r7220 r7369  
    1919#include "QIStatusBar.h"
    2020
    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>
    2524
    2625/** @clas QIStatusLine
     
    3130 */
    3231
    33 QIStatusBar::QIStatusBar (QWidget *parent, const char *name) :
    34     QStatusBar (parent, name)
     32QIStatusBar::QIStatusBar (QWidget *parent) :
     33    QStatusBar (parent)
    3534{
    3635    connect (
     
    4443 *  widgets.
    4544 */
    46 void QIStatusBar::paintEvent (QPaintEvent *)
     45void QIStatusBar::paintEvent (QPaintEvent *e)
    4746{
    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
    5153    // this will work provided that QStatusBar::setSizeGripEnabled() names
    5254    // 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//    }
    6367}
  • trunk/src/VBox/Frontends/VirtualBox4/src/VBoxConsoleWnd.cpp

    r7282 r7369  
    159159
    160160    /* ensure status bar is created */
    161     new QIStatusBar (this, "statusBar");
     161    new QIStatusBar (this);
    162162
    163163    ///// Actions ///////////////////////////////////////////////////////////
     
    418418    indicatorBox->setSpacing (5);
    419419    /* i/o devices */
    420     hd_light = new QIStateIndicator (KDeviceActivity_Idle, indicatorBox, "hd_light", Qt::WNoAutoErase);
     420    hd_light = new QIStateIndicator (KDeviceActivity_Idle, indicatorBox);
    421421    hd_light->setStateIcon (KDeviceActivity_Idle, QPixmap (":/hd_16px.png"));
    422422    hd_light->setStateIcon (KDeviceActivity_Reading, QPixmap (":/hd_read_16px.png"));
    423423    hd_light->setStateIcon (KDeviceActivity_Writing, QPixmap (":/hd_write_16px.png"));
    424424    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);
    426426    cd_light->setStateIcon (KDeviceActivity_Idle, QPixmap (":/cd_16px.png"));
    427427    cd_light->setStateIcon (KDeviceActivity_Reading, QPixmap (":/cd_read_16px.png"));
    428428    cd_light->setStateIcon (KDeviceActivity_Writing, QPixmap (":/cd_write_16px.png"));
    429429    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);
    431431    fd_light->setStateIcon (KDeviceActivity_Idle, QPixmap (":/fd_16px.png"));
    432432    fd_light->setStateIcon (KDeviceActivity_Reading, QPixmap (":/fd_read_16px.png"));
    433433    fd_light->setStateIcon (KDeviceActivity_Writing, QPixmap (":/fd_write_16px.png"));
    434434    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);
    436436    net_light->setStateIcon (KDeviceActivity_Idle, QPixmap (":/nw_16px.png"));
    437437    net_light->setStateIcon (KDeviceActivity_Reading, QPixmap (":/nw_read_16px.png"));
    438438    net_light->setStateIcon (KDeviceActivity_Writing, QPixmap (":/nw_write_16px.png"));
    439439    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);
    441441    usb_light->setStateIcon (KDeviceActivity_Idle, QPixmap (":/usb_16px.png"));
    442442    usb_light->setStateIcon (KDeviceActivity_Reading, QPixmap (":/usb_read_16px.png"));
    443443    usb_light->setStateIcon (KDeviceActivity_Writing, QPixmap (":/usb_write_16px.png"));
    444444    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);
    446446    sf_light->setStateIcon (KDeviceActivity_Idle, QPixmap (":/shared_folder_16px.png"));
    447447    sf_light->setStateIcon (KDeviceActivity_Reading, QPixmap (":/shared_folder_read_16px.png"));
     
    465465
    466466    /* mouse */
    467     mouse_state = new QIStateIndicator (0, indicatorBox, "mouse_state", Qt::WNoAutoErase);
     467    mouse_state = new QIStateIndicator (0, indicatorBox);
    468468    mouse_state->setStateIcon (0, QPixmap (":/mouse_disabled_16px.png"));
    469469    mouse_state->setStateIcon (1, QPixmap (":/mouse_16px.png"));
     
    474474    hostkey_hbox = new Q3HBox (indicatorBox, "hostkey_hbox");
    475475    hostkey_hbox->setSpacing (3);
    476     hostkey_state = new QIStateIndicator (0, hostkey_hbox, "hostkey_state");
     476    hostkey_state = new QIStateIndicator (0, hostkey_hbox);
    477477    hostkey_state->setStateIcon (0, QPixmap (":/hostkey_16px.png"));
    478478    hostkey_state->setStateIcon (1, QPixmap (":/hostkey_captured_16px.png"));
     
    32493249    /* If seamless mode should be enabled then check if it is enabled
    32503250     * currently and re-enable it if open-view procedure is finished */
    3251     if (vmSeamlessAction->isOn() && mIsOpenViewFinished && aSeamlessSupported)
     3251    if (vmSeamlessAction->isChecked() && mIsOpenViewFinished && aSeamlessSupported)
    32523252        toggleFullscreenMode (true, true);
    32533253
     
    34223422#endif
    34233423
    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 {
     3424VBoxSFDialog::VBoxSFDialog (QWidget *aParent, CSession &aSession)
     3425    : QDialog (aParent)
     3426    , mSettings (0)
     3427    , mSession (aSession)
     3428{
     3429    setModal (true);
    34293430    /* Setup Dialog's options */
    3430     setCaption (tr ("Shared Folders"));
    3431     setIcon (QPixmap (":/select_file_16px.png"));
     3431    setWindowTitle (tr ("Shared Folders"));
     3432    setWindowIcon (QIcon (":/select_file_16px.png"));
    34323433    setSizeGripEnabled (true);
    34333434
    34343435    /* 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);
    34363439
    34373440    /* Setup settings layout */
     
    34443447
    34453448    /* 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"));
    34483453    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"));
    34513456    connect (pbHelp, SIGNAL (clicked()), &vboxProblem(), SLOT (showHelpHelpDialog()));
    34523457    connect (pbOk, SIGNAL (clicked()), this, SLOT (accept()));
    34533458    connect (pbCancel, SIGNAL (clicked()), this, SLOT (reject()));
    3454     pbHelp->setAccel (Qt::Key_F1);
     3459    pbHelp->setShortcut (Qt::Key_F1);
    34553460    buttonLayout->addWidget (pbHelp);
    34563461    buttonLayout->addItem (spacer);
  • trunk/src/VBox/Frontends/VirtualBox4/src/VBoxGlobal.cpp

    r7351 r7369  
    2828//Added by qt3to4:
    2929#include <QDesktopWidget>
    30 #include <Q3CString>
    31 #include <q3mimefactory.h>
    3230#include <QTranslator>
    3331#include <Q3VBoxLayout>
     
    5149#include <qlabel.h>
    5250#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>
    5358
    5459#ifdef Q_WS_X11
     
    5863#endif
    5964
    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>
    6865
    6966#if defined (Q_WS_MAC)
     
    36773674    for (size_t i = 0; i < ELEMENTS (commands); ++ i)
    36783675    {
    3679         QStringList args = QStringList::split (':', commands [i]);
     3676        QStringList args = QString(commands [i]).split (':');
    36803677        args += aURL;
    3681         Q3Process cmd (args);
    3682         if (cmd.start())
     3678        QString command = args.takeFirst();
     3679        if (QProcess::startDetached (command, args))
    36833680            return true;
    36843681    }
     
    37013698    {
    37023699        ConstStr255Param hint (0x0);
    3703         Q3CString cs = aURL.local8Bit();
     3700        QByteArray cs = aURL.toLocal8Bit();
    37043701        const char* data = cs.data();
    37053702        long length = cs.length();
     
    42624259VBoxSwitchMenu::VBoxSwitchMenu (QWidget *aParent, QAction *aAction,
    42634260                                bool aInverted)
    4264     : Q3PopupMenu (aParent), mAction (aAction), mInverted (aInverted)
     4261    : QMenu (aParent), mAction (aAction), mInverted (aInverted)
    42654262{
    42664263    /* this menu works only with toggle action */
    4267     Assert (aAction->isToggleAction());
     4264    Assert (aAction->isCheckable());
    42684265    connect (this, SIGNAL (aboutToShow()),
    42694266             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)));
    42724269}
    42734270
    42744271void VBoxSwitchMenu::setToolTip (const QString &aTip)
    42754272{
    4276     mTip = aTip;
     4273    mAction->setToolTip (aTip);
    42774274}
    42784275
    42794276void VBoxSwitchMenu::processAboutToShow()
    42804277{
    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//}
    42924287
    42934288#ifdef Q_WS_X11
  • trunk/src/VBox/Frontends/VirtualBox4/src/VBoxProblemReporter.cpp

    r7351 r7369  
    2727#include "QIHotKeyEdit.h"
    2828
    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>
    3533#ifdef Q_WS_MAC
    36 # include <qpushbutton.h>
     34# include <QPushButton>
    3735#endif
    38 //Added by qt3to4:
    39 #include <QTimerEvent>
    40 #include <Q3CString>
    41 #include <QCloseEvent>
    4236
    4337#include <iprt/err.h>
     
    6357 *        is destroyed.
    6458 */
    65 class VBoxProgressDialog : public Q3ProgressDialog
     59class VBoxProgressDialog : public QProgressDialog
    6660{
    6761public:
    6862
    6963    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,
    7366                           Qt::WStyle_Customize | Qt::WStyle_DialogBorder | Qt::WStyle_Title)
    7467        , mProgress (aProgress)
     
    7972        , mEnded (false)
    8073    {
     74        setModal (true);
    8175        if (mOpCount > 1)
    8276            setLabelText (QString (sOpDescTpl)
     
    8781                          .arg (mProgress.GetOperationDescription()));
    8882        setCancelButtonText (QString::null);
    89         setTotalSteps (100);
    90         setCaption (QString ("%1: %2")
     83        setMaximum (100);
     84        setWindowTitle (QString ("%1: %2")
    9185                    .arg (aTitle, mProgress.GetDescription()));
    9286        setMinimumDuration (aMinDuration);
    9387        setCancelEnabled (false);
    94         setProgress (0);
     88        setValue (0);
    9589    }
    9690
     
    10498    virtual void timerEvent (QTimerEvent *e);
    10599
    106     virtual void reject() { if (mCalcelEnabled) Q3ProgressDialog::reject(); };
     100    virtual void reject() { if (mCalcelEnabled) QProgressDialog::reject(); };
    107101
    108102    virtual void closeEvent (QCloseEvent *e)
    109103    {
    110104        if (mCalcelEnabled)
    111             Q3ProgressDialog::closeEvent (e);
     105            QProgressDialog::closeEvent (e);
    112106        else
    113107            e->ignore();
     
    135129#warning port me
    136130        /* 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.
    138136//        mLoopLevel = qApp->eventLoop()->loopLevel();
    139137//        /* enter the modal loop */
     
    142140//        mLoopLevel = -1;
    143141//        mEnded = false;
    144         return result();
     142        return exec();
    145143    }
    146144    return Rejected;
     
    158156        if (mProgress.isOk())
    159157        {
    160             setProgress (100);
    161             setResult (Accepted);
     158            setValue (100);
     159            accepted();
     160//            setResult (Accepted);
    162161        }
    163162        else
    164             setResult (Rejected);
    165         mEnded = justEnded = true;
     163            rejected();
     164//            setResult (Rejected);
     165        //
     166//        mEnded = justEnded = true;
     167        return;
    166168    }
    167169
     
    199201            .arg (mCurOp).arg (mOpCount));
    200202    }
    201     setProgress (mProgress.GetPercent());
     203    setValue (mProgress.GetPercent());
    202204}
    203205
     
    300302    {
    301303        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)) {
    304306            int rc = AutoConfirmed;
    305307            if (aButton1 & QIMessageBox::Default)
     
    418420
    419421    VBoxProgressDialog progressDlg (aProgress, aTitle, aMinDuration,
    420                                     aParent, "progressDlg");
     422                                    aParent);
    421423
    422424    /* run the dialog with the 100 ms refresh interval */
     
    443445    if (vboxGlobal().isVMConsoleProcess())
    444446    {
    445         if (vboxGlobal().consoleWnd().isShown())
     447        if (vboxGlobal().consoleWnd().isVisible())
    446448            return &vboxGlobal().consoleWnd();
    447449    }
    448450    else
    449451    {
    450         if (vboxGlobal().selectorWnd().isShown())
     452        if (vboxGlobal().selectorWnd().isVisible())
    451453            return &vboxGlobal().selectorWnd();
    452454    }
    453455#else
    454     if (vboxGlobal().consoleWnd().isShown())
     456    if (vboxGlobal().consoleWnd().isVisible())
    455457        return &vboxGlobal().consoleWnd();
    456     if (vboxGlobal().selectorWnd().isShown())
     458    if (vboxGlobal().selectorWnd().isVisible())
    457459        return &vboxGlobal().selectorWnd();
    458460#endif
     
    964966        /* this should be in sync with VBoxVMListBoxItem::recache() */
    965967        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();
    968970        msg = tr ("<p>Are you sure you want to unregister the inaccessible "
    969971                  "virtual machine <b>%1</b>?</p>"
     
    18441846    //  - add common buttons like Retry/Save/PowerOff/whatever
    18451847
    1846     Q3CString autoConfimId = "showRuntimeError.";
     1848    QByteArray autoConfimId = "showRuntimeError.";
    18471849
    18481850    CConsole console = aConsole;
     
    18741876    }
    18751877
    1876     autoConfimId += errorID.utf8();
     1878    autoConfimId += errorID.toUtf8();
    18771879
    18781880    QString formatted;
     
    20912093    Assert(RT_SUCCESS(rc));
    20922094    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"));
    20982099#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"));
    21022102#endif
    21032103#endif /* VBOX_OSE */
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette