VirtualBox

Changeset 7721 in vbox for trunk/src


Ignore:
Timestamp:
Apr 3, 2008 12:49:30 PM (17 years ago)
Author:
vboxsync
Message:

FE/Qt4: Ported several classes from qt3 to qt4 and some minor changes.

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

Legend:

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

    r7220 r7721  
    2222#include <limits.h>
    2323
    24 #include <qobject.h>
    25 #include <qvalidator.h>
    26 #include <q3valuelist.h>
     24/* Qt includes */
     25#include <QObject>
     26#include <QValidator>
     27#include <QList>
    2728
    2829class QIWidgetValidator : public QObject
     
    3233public:
    3334
    34     QIWidgetValidator (QWidget *aWidget, QObject *aParent = 0,
    35                        const char *aName = 0);
     35    QIWidgetValidator (QWidget *aWidget, QObject *aParent = 0);
    3636    QIWidgetValidator (const QString &aCaption,
    37                        QWidget *aWidget, QObject *aParent = 0,
    38                        const char *aName = 0);
     37                       QWidget *aWidget, QObject *aParent = 0);
    3938    ~QIWidgetValidator();
    4039
     
    7473    };
    7574
    76     Q3ValueList <Watched> mWatched;
     75    QList <Watched> mWatched;
    7776    Watched mLastInvalid;
    7877
     
    8685public:
    8786
    88     QIULongValidator (QObject *aParent, const char *aName = 0)
     87    QIULongValidator (QObject *aParent)
    8988        : QValidator (aParent)
    9089        , mBottom (0), mTop (ULONG_MAX) {}
    9190
    9291    QIULongValidator (ulong aMinimum, ulong aMaximum,
    93                       QObject *aParent, const char *aName = 0)
     92                      QObject *aParent)
    9493        : QValidator (aParent)
    9594        , mBottom (aMinimum), mTop (aMaximum) {}
  • trunk/src/VBox/Frontends/VirtualBox4/include/VBoxGlobalSettings.h

    r5999 r7721  
    2222#include "CIShared.h"
    2323
    24 #include <qobject.h>
     24/* Qt includes */
     25#include <QObject>
    2526
    2627class CVirtualBox;
  • trunk/src/VBox/Frontends/VirtualBox4/src/QIWidgetValidator.cpp

    r7220 r7721  
    1919#include "QIWidgetValidator.h"
    2020
    21 #include <qobject.h>
    22 #include <qlineedit.h>
    23 #include <qcombobox.h>
    24 #include <qlabel.h>
    25 //Added by qt3to4:
    26 #include <Q3ValueList>
     21/* Qt includes */
     22#include <QLineEdit>
     23#include <QComboBox>
     24#include <QLabel>
    2725
    2826#include <iprt/assert.h>
     
    7977 *  @param aWidget  Widget whose children should be checked.
    8078 */
    81 QIWidgetValidator::QIWidgetValidator (QWidget *aWidget, QObject *aParent,
    82                                       const char *aName)
    83     : QObject (aParent, aName)
     79QIWidgetValidator::QIWidgetValidator (QWidget *aWidget, QObject *aParent)
     80    : QObject (aParent)
    8481    , mWidget (aWidget)
    8582    , mOtherValid (true)
     
    9693 */
    9794QIWidgetValidator::QIWidgetValidator (const QString &aCaption,
    98                                       QWidget *aWidget, QObject *aParent,
    99                                       const char *aName)
    100     : QObject (aParent, aName)
     95                                      QWidget *aWidget, QObject *aParent)
     96    : QObject (aParent)
    10197    , mCaption (aCaption)
    10298    , mWidget (aWidget)
     
    154150    QValidator::State state = QValidator::Acceptable;
    155151
    156     for (Q3ValueList <Watched>::ConstIterator it = mWatched.begin();
    157          it != mWatched.end(); ++ it)
     152    foreach (Watched watched, mWatched)
    158153    {
    159         Watched watched = *it;
    160 
    161154        if (watched.widget->inherits ("QLineEdit"))
    162155        {
     
    214207    Watched watched;
    215208
    216     QObjectList list = mWidget->queryList();
    217     QObject *obj;
     209    QList<QWidget *> list = mWidget->findChildren<QWidget *>();
     210    QWidget *wgt;
    218211
    219212    /* detect all widgets that support validation */
    220     QListIterator<QObject*> it (list);
     213    QListIterator<QWidget *> it (list);
    221214    while (it.hasNext())
    222215    {
    223         obj = it.next();
    224         if (obj->inherits ("QLineEdit"))
    225         {
    226             QLineEdit *le = ((QLineEdit *) obj);
     216        wgt = it.next();
     217
     218        if (QLineEdit *le = qobject_cast<QLineEdit *> (wgt))
     219        {
    227220            if (!le->validator())
    228221                continue;
     
    233226                     this, SLOT (doRevalidate()));
    234227        }
    235         else if (obj->inherits ("QComboBox"))
    236         {
    237             QComboBox *cb = ((QComboBox *) obj);
     228        else if (QComboBox *cb = qobject_cast<QComboBox *> (wgt))
     229        {
     230           
    238231            if (!cb->validator() || !cb->lineEdit())
    239232                continue;
     
    245238        }
    246239
    247         watched.widget = (QWidget *) obj;
     240        watched.widget = wgt;
    248241
    249242        /* try to find a buddy widget in order to determine the title for
    250243         * the watched widget which is used in the warning text */
    251         QListIterator<QObject*> it2 (list);
     244        QListIterator<QWidget *> it2 (list);
    252245        while (it2.hasNext())
    253246        {
    254             obj = it2.next();
    255             if (obj->inherits ("QLabel"))
    256             {
    257                 QLabel *label = (QLabel *) obj;
     247            wgt = it2.next();
     248            if (QLabel *label = qobject_cast<QLabel *> (wgt))
    258249                if (label->buddy() == watched.widget)
    259250                {
     
    261252                    break;
    262253                }
    263             }
    264254        }
    265255
     
    363353    Q_UNUSED (aPos);
    364354
    365     QString stripped = aInput.stripWhiteSpace();
     355    QString stripped = aInput.trimmed();
    366356
    367357    if (stripped.isEmpty() ||
    368         stripped.upper() == QString ("0x").upper())
     358        stripped.toUpper() == QString ("0x").toUpper())
    369359        return Intermediate;
    370360
  • trunk/src/VBox/Frontends/VirtualBox4/src/VBoxConsoleWnd.cpp

    r7678 r7721  
    144144
    145145    /* ensure status bar is created */
    146     new QIStatusBar (this);
     146    setStatusBar (new QIStatusBar (this));
    147147
    148148    ///// Actions ///////////////////////////////////////////////////////////
     
    32953295{
    32963296#warning "port me"
    3297     /* @todo: I'm not sure if it is the right way to force an shutdown if modal
    3298      * child widgets are open. Anyway, currently I didn't know how to achieve
    3299      * this. So for now we simply call close. */
     3297    /* It seems that Qt4 closes all child widgets if the parent widget get
     3298     * closed. So nothing to do here than to call close. */
    33003299     
    33013300     close();
    33023301
     3302    /* We have this to test on Windows and Mac or maybe I forgot something, so
     3303     * we keep this as a reference: */
    33033304//    LogFlowFunc (("eventLoopLevel=%d\n", qApp->eventLoop()->loopLevel()));
    33043305//
  • trunk/src/VBox/Frontends/VirtualBox4/src/VBoxGlobalSettings.cpp

    r5999 r7721  
    1717 */
    1818
    19 #include <qglobal.h>
    20 #include <qstring.h>
    21 #include <qregexp.h>
     19/* Qt includes */
     20#include <QString>
     21#include <QRegExp>
     22#include <QVariant>
    2223
    2324#include "VBoxGlobalSettings.h"
    2425#include "QIHotKeyEdit.h"
    2526#include "COMDefs.h"
    26 
    27 #include <qvariant.h>
    2827
    2928/** @class VBoxGlobalSettingsData
     
    118117bool VBoxGlobalSettings::isFeatureActive (const char *aFeature) const
    119118{
    120     QStringList featureList = QStringList::split (',', data()->guiFeatures);
     119    QStringList featureList = data()->guiFeatures.split (',');
    121120    return featureList.contains (aFeature);
    122121}
     
    164163    {
    165164        QVariant value = property (gPropertyMap [i].name);
    166         Assert (value.isValid() && value.canCast (QVariant::String));
     165        Assert (value.isValid() && value.canConvert (QVariant::String));
    167166
    168167        vbox.SetExtraData (gPropertyMap [i].publicName, value.toString());
     
    183182        {
    184183            QVariant value = property (gPropertyMap [i].name);
    185             Assert (value.isValid() && value.canCast (QVariant::String));
    186 
    187             if (value.isValid() && value.canCast (QVariant::String))
     184            Assert (value.isValid() && value.canConvert (QVariant::String));
     185
     186            if (value.isValid() && value.canConvert (QVariant::String))
    188187                return value.toString();
    189188            else
     
    246245
    247246    QVariant oldVal = property (gPropertyMap [index].name);
    248     Assert (oldVal.isValid() && oldVal.canCast (QVariant::String));
    249 
    250     if (oldVal.isValid() && oldVal.canCast (QVariant::String) &&
     247    Assert (oldVal.isValid() && oldVal.canConvert (QVariant::String));
     248
     249    if (oldVal.isValid() && oldVal.canConvert (QVariant::String) &&
    251250        oldVal.toString() != value)
    252251    {
  • trunk/src/VBox/Frontends/VirtualBox4/ui/VBoxSnapshotsWgt.ui.h

    r7669 r7721  
    303303    toolBar->setSizePolicy (QSizePolicy::Fixed, QSizePolicy::Fixed);
    304304#warning port me
     305    vboxLayout->insertWidget (0, toolBar);
    305306//    VBoxSnapshotsWgtLayout->insertWidget (0, toolBar);
    306307#ifdef Q_WS_MAC
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