VirtualBox

Changeset 7397 in vbox


Ignore:
Timestamp:
Mar 10, 2008 12:53:51 PM (17 years ago)
Author:
vboxsync
Message:

FE/Qt4: Ported the console window to qt4. Some parts of the qmenu stuff still have do be done.

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

Legend:

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

    r7381 r7397  
    3030public:
    3131
    32     QIStateIndicator (int aState, QWidget *aParent);
     32    QIStateIndicator (int aState);
    3333    ~QIStateIndicator();
    3434
  • trunk/src/VBox/Frontends/VirtualBox4/include/VBoxConsoleWnd.h

    r7378 r7397  
    2424/* Qt includes */
    2525#include <QMainWindow>
    26 
    27 #include <qmap.h>
    28 #include <qobject.h>
    29 #include <qcolor.h>
    30 #include <qdialog.h>
    31 //Added by qt3to4:
    32 #include <QContextMenuEvent>
    33 #include <q3hbox.h>
    34 #include <QLabel>
    35 #include <QEvent>
    36 #include <Q3ActionGroup>
    37 #include <QShowEvent>
    38 #include <QCloseEvent>
     26#include <QMap>
     27#include <QColor>
     28#include <QDialog>
     29
    3930
    4031#ifdef VBOX_WITH_DEBUGGER_GUI
     
    4839
    4940class QAction;
    50 class Q3ActionGroup;
    51 class Q3HBox;
     41class QActionGroup;
    5242class QLabel;
    5343class QSpacerItem;
     
    6757
    6858    VBoxConsoleWnd (VBoxConsoleWnd **aSelf,
    69                      QWidget* aParent = 0, const char* aName = 0,
     59                     QWidget* aParent = 0,
    7060                     Qt::WFlags aFlags = Qt::WType_TopLevel);
    7161    virtual ~VBoxConsoleWnd();
     
    206196    QMenu *mMainMenu;
    207197
    208     Q3ActionGroup *mRunningActions;
    209     Q3ActionGroup *mRunningOrPausedActions;
     198    QActionGroup *mRunningActions;
     199    QActionGroup *mRunningOrPausedActions;
    210200
    211201    // Machine actions
     
    301291    QIStateIndicator *autoresize_state;
    302292    QIStateIndicator *vrdp_state;
    303     Q3HBox *hostkey_hbox;
     293    QWidget *hostkey_hbox;
    304294    QLabel *hostkey_name;
    305295
  • trunk/src/VBox/Frontends/VirtualBox4/src/QIStateIndicator.cpp

    r7390 r7397  
    3838 *      the initial indicator state
    3939 */
    40 QIStateIndicator::QIStateIndicator (int aState,
    41                                     QWidget *aParent)
    42     : QFrame (aParent)
     40QIStateIndicator::QIStateIndicator (int aState)
    4341//    : QFrame (aParent, aName, aFlags | Qt::WStaticContents | Qt::WMouseNoMask)
    4442{
  • trunk/src/VBox/Frontends/VirtualBox4/src/VBoxConsoleWnd.cpp

    r7390 r7397  
    3131
    3232/* Qt includes */
    33 #include <qaction.h>
    34 #include <qmenubar.h>
    35 #include <q3buttongroup.h>
    36 #include <qradiobutton.h>
    37 #include <qfile.h>
    38 #include <qdir.h>
    39 #include <qpushbutton.h>
    40 #include <qcursor.h>
    41 #include <qtimer.h>
    42 #include <qeventloop.h>
    43 #include <qregexp.h>
    44 //Added by qt3to4:
     33#include <QActionGroup>
    4534#include <QDesktopWidget>
    46 #include <QResizeEvent>
    47 #include <QContextMenuEvent>
    48 #include <QLabel>
    49 #include <QCloseEvent>
    50 #include <Q3GridLayout>
    51 #include <QShowEvent>
    52 #include <q3mimefactory.h>
    53 #include <Q3HBoxLayout>
    54 #include <QEvent>
    55 #include <Q3VBoxLayout>
    56 #include <Q3Frame>
    57 #include <Q3ActionGroup>
     35#include <QMenuBar>
     36#include <QFileInfo>
     37#include <QDir>
    5838#ifdef Q_WS_X11
    5939# include <QX11Info>
     
    11999 */
    120100VBoxConsoleWnd::
    121 VBoxConsoleWnd (VBoxConsoleWnd **aSelf, QWidget* aParent, const char* aName,
     101VBoxConsoleWnd (VBoxConsoleWnd **aSelf, QWidget* aParent,
    122102                Qt::WFlags aFlags)
    123     : QMainWindow (aParent, aName, aFlags)
     103    : QMainWindow (aParent, aFlags)
    124104    , mMainMenu (0)
    125105#ifdef VBOX_WITH_DEBUGGER_GUI
     
    159139    /* default application icon (will change to the VM-specific icon in
    160140     * openView()) */
    161     setIcon (QPixmap (":/ico40x01.png"));
     141    setWindowIcon (QIcon (":/ico40x01.png"));
    162142
    163143    /* ensure status bar is created */
     
    169149     * Note that only actions whose enabled state depends exclusively on the
    170150     * execution state of the VM are added to this group. */
    171     mRunningActions = new Q3ActionGroup (this);
     151    mRunningActions = new QActionGroup (this);
    172152    mRunningActions->setExclusive (false);
    173153
     
    175155     * paused. Note that only actions whose enabled state depends exclusively
    176156     * on the execution state of the VM are added to this group. */
    177     mRunningOrPausedActions = new Q3ActionGroup (this);
     157    mRunningOrPausedActions = new QActionGroup (this);
    178158    mRunningOrPausedActions->setExclusive (false);
    179159
    180160    /* VM menu actions */
    181161
    182     vmFullscreenAction = new QAction (this, "vmFullscreenAction");
    183     vmFullscreenAction->setIconSet (
     162    vmFullscreenAction = new QAction (this);
     163    vmFullscreenAction->setIcon (
    184164        VBoxGlobal::iconSet (":/fullscreen_16px.png", ":/fullscreen_disabled_16px.png"));
    185     vmFullscreenAction->setToggleAction (true);
    186 
    187     vmSeamlessAction = new QAction (this, "vmSeamlessAction");
    188     vmSeamlessAction->setIconSet (
     165    vmFullscreenAction->setCheckable (true);
     166
     167    vmSeamlessAction = new QAction (this);
     168    vmSeamlessAction->setIcon (
    189169        VBoxGlobal::iconSet (":/nw_16px.png", ":/nw_disabled_16px.png"));
    190     vmSeamlessAction->setToggleAction (true);
    191 
    192     vmAutoresizeGuestAction = new QAction (mRunningActions, "vmAutoresizeGuestAction");
    193     vmAutoresizeGuestAction->setIconSet (
     170    vmSeamlessAction->setCheckable (true);
     171
     172    vmAutoresizeGuestAction = new QAction (mRunningActions);
     173    vmAutoresizeGuestAction->setIcon (
    194174        VBoxGlobal::iconSet (":/auto_resize_on_16px.png", ":/auto_resize_on_disabled_16px.png"));
    195     vmAutoresizeGuestAction->setToggleAction (true);
     175    vmAutoresizeGuestAction->setCheckable (true);
    196176    vmAutoresizeGuestAction->setEnabled (false);
    197177
    198     vmAdjustWindowAction = new QAction (this, "vmAdjustWindowAction");
    199     vmAdjustWindowAction->setIconSet (
     178    vmAdjustWindowAction = new QAction (this);
     179    vmAdjustWindowAction->setIcon (
    200180        VBoxGlobal::iconSet (":/adjust_win_size_16px.png",
    201181                             ":/adjust_win_size_disabled_16px.png"));
    202182
    203     vmTypeCADAction = new QAction (mRunningActions, "vmTypeCADAction");
    204     vmTypeCADAction->setIconSet (VBoxGlobal::iconSet (":/hostkey_16px.png",
     183    vmTypeCADAction = new QAction (mRunningActions);
     184    vmTypeCADAction->setIcon (VBoxGlobal::iconSet (":/hostkey_16px.png",
    205185                                                      ":/hostkey_disabled_16px.png"));
    206186
    207187#if defined(Q_WS_X11)
    208     vmTypeCABSAction = new QAction (mRunningActions, "vmTypeCABSAction");
    209     vmTypeCABSAction->setIconSet (VBoxGlobal::iconSet (":/hostkey_16px.png",
     188    vmTypeCABSAction = new QAction (mRunningActions);
     189    vmTypeCABSAction->setIcon (VBoxGlobal::iconSet (":/hostkey_16px.png",
    210190                                                       ":/hostkey_disabled_16px.png"));
    211191#endif
    212192
    213     vmResetAction = new QAction (mRunningActions, "vmResetAction");
    214     vmResetAction->setIconSet (VBoxGlobal::iconSet (":/reset_16px.png",
     193    vmResetAction = new QAction (mRunningActions);
     194    vmResetAction->setIcon (VBoxGlobal::iconSet (":/reset_16px.png",
    215195                                                    ":/reset_disabled_16px.png"));
    216196
    217     vmPauseAction = new QAction (this, "vmPauseAction");
    218     vmPauseAction->setIconSet (VBoxGlobal::iconSet (":/pause_16px.png"));
    219     vmPauseAction->setToggleAction (true);
    220 
    221     vmACPIShutdownAction = new QAction (mRunningActions, "vmACPIShutdownAction");
    222     vmACPIShutdownAction->setIconSet (
     197    vmPauseAction = new QAction (this);
     198    vmPauseAction->setIcon (VBoxGlobal::iconSet (":/pause_16px.png"));
     199    vmPauseAction->setCheckable (true);
     200
     201    vmACPIShutdownAction = new QAction (mRunningActions);
     202    vmACPIShutdownAction->setIcon (
    223203        VBoxGlobal::iconSet (":/acpi_16px.png", ":/acpi_disabled_16px.png"));
    224204
    225     vmCloseAction = new QAction (this, "vmCloseAction");
    226     vmCloseAction->setIconSet (VBoxGlobal::iconSet (":/exit_16px.png"));
    227 
    228     vmTakeSnapshotAction = new QAction (mRunningOrPausedActions, "vmTakeSnapshotAction");
    229     vmTakeSnapshotAction->setIconSet (VBoxGlobal::iconSet (
     205    vmCloseAction = new QAction (this);
     206    vmCloseAction->setIcon (VBoxGlobal::iconSet (":/exit_16px.png"));
     207
     208    vmTakeSnapshotAction = new QAction (mRunningOrPausedActions);
     209    vmTakeSnapshotAction->setIcon (VBoxGlobal::iconSet (
    230210        ":/take_snapshot_16px.png", ":/take_snapshot_dis_16px.png"));
    231211
    232     vmShowInformationDlgAction = new QAction (this, "vmShowInformationDlgAction");
    233     vmShowInformationDlgAction->setIconSet (VBoxGlobal::iconSet (
     212    vmShowInformationDlgAction = new QAction (this);
     213    vmShowInformationDlgAction->setIcon (VBoxGlobal::iconSet (
    234214        ":/description_16px.png", ":/description_disabled_16px.png"));
    235215
    236     vmDisableMouseIntegrAction = new QAction (this, "vmDisableMouseIntegrAction");
    237     vmDisableMouseIntegrAction->setIconSet (VBoxGlobal::iconSet (
     216    vmDisableMouseIntegrAction = new QAction (this);
     217    vmDisableMouseIntegrAction->setIcon (VBoxGlobal::iconSet (
    238218        ":/mouse_can_seamless_16px.png", ":/mouse_can_seamless_disabled_16px.png"));
    239     vmDisableMouseIntegrAction->setToggleAction (true);
     219    vmDisableMouseIntegrAction->setCheckable (true);
    240220
    241221    /* Devices menu actions */
    242222
    243     devicesMountFloppyImageAction = new QAction (mRunningOrPausedActions,
    244                                                  "devicesMountFloppyImageAction");
    245 
    246     devicesUnmountFloppyAction = new QAction (this, "devicesUnmountFloppyAction");
    247     devicesUnmountFloppyAction->setIconSet (VBoxGlobal::iconSet (":/fd_unmount_16px.png",
     223    devicesMountFloppyImageAction = new QAction (mRunningOrPausedActions);
     224
     225    devicesUnmountFloppyAction = new QAction (this);
     226    devicesUnmountFloppyAction->setIcon (VBoxGlobal::iconSet (":/fd_unmount_16px.png",
    248227                                                                 ":/fd_unmount_dis_16px.png"));
    249228
    250     devicesMountDVDImageAction = new QAction (mRunningOrPausedActions,
    251                                               "devicesMountISOImageAction");
    252 
    253     devicesUnmountDVDAction = new QAction (this, "devicesUnmountDVDAction");
    254     devicesUnmountDVDAction->setIconSet (VBoxGlobal::iconSet (":/cd_unmount_16px.png",
     229    devicesMountDVDImageAction = new QAction (mRunningOrPausedActions);
     230
     231    devicesUnmountDVDAction = new QAction (this);
     232    devicesUnmountDVDAction->setIcon (VBoxGlobal::iconSet (":/cd_unmount_16px.png",
    255233                                                              ":/cd_unmount_dis_16px.png"));
    256234
    257     devicesSFDialogAction = new QAction (mRunningOrPausedActions,
    258                                          "devicesSFDialogAction");
    259     devicesSFDialogAction->setIconSet (VBoxGlobal::iconSet (":/shared_folder_16px.png",
     235    devicesSFDialogAction = new QAction (mRunningOrPausedActions);
     236    devicesSFDialogAction->setIcon (VBoxGlobal::iconSet (":/shared_folder_16px.png",
    260237                                                            ":/shared_folder_disabled_16px.png"));
    261238
    262     devicesSwitchVrdpAction = new QAction (mRunningOrPausedActions,
    263                                            "devicesSwitchVrdpAction");
    264     devicesSwitchVrdpAction->setIconSet (VBoxGlobal::iconSet (":/vrdp_16px.png",
     239    devicesSwitchVrdpAction = new QAction (mRunningOrPausedActions);
     240    devicesSwitchVrdpAction->setIcon (VBoxGlobal::iconSet (":/vrdp_16px.png",
    265241                                                              ":/vrdp_disabled_16px.png"));
    266     devicesSwitchVrdpAction->setToggleAction (true);
    267 
    268     devicesInstallGuestToolsAction = new QAction (mRunningActions,
    269                                                   "devicesInstallGuestToolsAction");
    270     devicesInstallGuestToolsAction->setIconSet (VBoxGlobal::iconSet (":/guesttools_16px.png",
     242    devicesSwitchVrdpAction->setCheckable (true);
     243
     244    devicesInstallGuestToolsAction = new QAction (mRunningActions);
     245    devicesInstallGuestToolsAction->setIcon (VBoxGlobal::iconSet (":/guesttools_16px.png",
    271246                                                                     ":/guesttools_disabled_16px.png"));
    272247
     
    274249    if (vboxGlobal().isDebuggerEnabled())
    275250    {
    276         dbgStatisticsAction = new QAction (this, "dbgStatisticsAction");
    277         dbgCommandLineAction = new QAction (this, "dbgCommandLineAction");
     251        dbgStatisticsAction = new QAction (this);
     252        dbgCommandLineAction = new QAction (this);
    278253    }
    279254    else
     
    286261    /* Help menu actions */
    287262
    288     helpContentsAction = new QAction (this, "helpContentsAction");
    289     helpContentsAction->setIconSet (VBoxGlobal::iconSet (":/help_16px.png"));
    290     helpWebAction = new QAction (this, "helpWebAction");
    291     helpWebAction->setIconSet (VBoxGlobal::iconSet (":/site_16px.png"));
    292     helpRegisterAction = new QAction (this, "helpRegisterAction");
    293     helpRegisterAction->setIconSet (VBoxGlobal::iconSet (":/register_16px.png",
     263    helpContentsAction = new QAction (this);
     264    helpContentsAction->setIcon (VBoxGlobal::iconSet (":/help_16px.png"));
     265    helpWebAction = new QAction (this);
     266    helpWebAction->setIcon (VBoxGlobal::iconSet (":/site_16px.png"));
     267    helpRegisterAction = new QAction (this);
     268    helpRegisterAction->setIcon (VBoxGlobal::iconSet (":/register_16px.png",
    294269                                                         ":/register_disabled_16px.png"));
    295     helpAboutAction = new QAction (this, "helpAboutAction");
    296     helpAboutAction->setIconSet (VBoxGlobal::iconSet (":/about_16px.png"));
    297     helpResetMessagesAction = new QAction (this, "helpResetMessagesAction");
    298     helpResetMessagesAction->setIconSet (VBoxGlobal::iconSet (":/reset_16px.png"));
     270    helpAboutAction = new QAction (this);
     271    helpAboutAction->setIcon (VBoxGlobal::iconSet (":/about_16px.png"));
     272    helpResetMessagesAction = new QAction (this);
     273    helpResetMessagesAction->setIcon (VBoxGlobal::iconSet (":/reset_16px.png"));
    299274
    300275    ///// Menubar ///////////////////////////////////////////////////////////
     
    311286                                               true /* inverted toggle state */);
    312287
    313     vmFullscreenAction->addTo (vmMenu);
    314     vmSeamlessAction->addTo (vmMenu);
    315     vmAdjustWindowAction->addTo (vmMenu);
    316     vmAutoresizeGuestAction->addTo (vmMenu);
    317     vmMenu->insertSeparator();
    318     vmDisableMouseIntegrAction->addTo (vmMenu);
    319     vmMenu->insertSeparator();
    320     vmTypeCADAction->addTo (vmMenu);
     288    vmMenu->addAction (vmFullscreenAction);
     289    vmMenu->addAction (vmSeamlessAction);
     290    vmMenu->addAction (vmAdjustWindowAction);
     291    vmMenu->addAction (vmAutoresizeGuestAction);
     292    vmMenu->addSeparator();
     293    vmMenu->addAction (vmDisableMouseIntegrAction);
     294    vmMenu->addSeparator();
     295    vmMenu->addAction (vmTypeCADAction);
    321296#if defined(Q_WS_X11)
    322     vmTypeCABSAction->addTo (vmMenu);
    323 #endif
    324     vmMenu->insertSeparator();
    325     vmTakeSnapshotAction->addTo (vmMenu);
    326     vmMenu->insertSeparator();
    327     vmShowInformationDlgAction->addTo (vmMenu);
    328     vmMenu->insertSeparator();
    329     vmResetAction->addTo (vmMenu);
    330     vmPauseAction->addTo (vmMenu);
    331     vmACPIShutdownAction->addTo (vmMenu);
    332     vmMenu->insertSeparator();
    333     vmCloseAction->addTo (vmMenu);
     297    vmMenu->addAction (vmTypeCABSAction);
     298#endif
     299    vmMenu->addSeparator();
     300    vmMenu->addAction (vmTakeSnapshotAction);
     301    vmMenu->addSeparator();
     302    vmMenu->addAction (vmShowInformationDlgAction);
     303    vmMenu->addSeparator();
     304    vmMenu->addAction (vmResetAction);
     305    vmMenu->addAction (vmPauseAction);
     306    vmMenu->addAction (vmACPIShutdownAction);
     307    vmMenu->addSeparator();
     308    vmMenu->addAction (vmCloseAction);
    334309
    335310    menuBar()->insertItem (QString::null, vmMenu, vmMenuId);
     
    350325    devicesMenu->insertItem (VBoxGlobal::iconSet (":/cd_16px.png", ":/cd_disabled_16px.png"),
    351326        QString::null, devicesMountDVDMenu, devicesMountDVDMenuId);
    352     devicesUnmountDVDAction->addTo (devicesMenu);
    353     devicesMenu->insertSeparator();
     327    devicesMenu->addAction (devicesUnmountDVDAction);
     328    devicesMenu->addSeparator();
    354329
    355330    devicesMenu->insertItem (VBoxGlobal::iconSet (":/fd_16px.png", ":/fd_disabled_16px.png"),
    356331        QString::null, devicesMountFloppyMenu, devicesMountFloppyMenuId);
    357     devicesUnmountFloppyAction->addTo (devicesMenu);
    358     devicesMenu->insertSeparator();
     332    devicesMenu->addAction (devicesUnmountFloppyAction);
     333    devicesMenu->addSeparator();
    359334
    360335    devicesMenu->insertItem (VBoxGlobal::iconSet (":/nw_16px.png", ":/nw_disabled_16px.png"),
    361336        QString::null, devicesNetworkMenu, devicesNetworkMenuId);
    362     devicesMenu->insertSeparator();
     337    devicesMenu->addSeparator();
    363338
    364339    devicesMenu->insertItem (VBoxGlobal::iconSet (":/usb_16px.png", ":/usb_disabled_16px.png"),
     
    366341    devicesUSBMenuSeparatorId = devicesMenu->insertSeparator();
    367342
    368     devicesSFDialogAction->addTo (devicesMenu);
     343    devicesMenu->addAction (devicesSFDialogAction);
    369344    devicesSFMenuSeparatorId = devicesMenu->insertSeparator();
    370     devicesSFDialogAction->addTo (devicesSFMenu);
    371 
    372     devicesSwitchVrdpAction->addTo (devicesMenu);
     345    devicesMenu->addAction (devicesSFDialogAction);
     346
     347    devicesMenu->addAction (devicesSwitchVrdpAction);
    373348    devicesVRDPMenuSeparatorId = devicesMenu->insertSeparator();
    374349
    375     devicesInstallGuestToolsAction->addTo (devicesMenu);
     350    devicesMenu->addAction (devicesInstallGuestToolsAction);
    376351
    377352    menuBar()->insertItem (QString::null, devicesMenu, devicesMenuId);
     
    388363    {
    389364        dbgMenu = new QMenu (this);
    390         dbgStatisticsAction->addTo (dbgMenu);
    391         dbgCommandLineAction->addTo (dbgMenu);
     365        dbgMenu->addAction (dbgStatisticsAction);
     366        dbgMenu->addAction (dbgCommandLineAction);
    392367        menuBar()->insertItem (QString::null, dbgMenu, dbgMenuId);
    393368        mMainMenu->insertItem (QString::null, dbgMenu, dbgMenuId);
     
    401376    QMenu *helpMenu = new QMenu (this);
    402377
    403     helpContentsAction->addTo (helpMenu);
    404     helpWebAction->addTo( helpMenu );
    405     helpMenu->insertSeparator();
     378    helpMenu->addAction (helpContentsAction);
     379    helpMenu->addAction (helpWebAction);
     380    helpMenu->addSeparator();
    406381#ifdef VBOX_WITH_REGISTRATION
    407     helpRegisterAction->addTo (helpMenu);
     382    helpMenu->addAction (helpRegisterAction);
    408383    helpRegisterAction->setEnabled (vboxGlobal().virtualBox().
    409384        GetExtraData (VBoxDefs::GUI_RegistrationDlgWinID).isEmpty());
    410385#endif
    411     helpAboutAction->addTo( helpMenu );
    412     helpMenu->insertSeparator();
    413     helpResetMessagesAction->addTo (helpMenu);
     386    helpMenu->addAction (helpAboutAction);
     387    helpMenu->addSeparator();
     388    helpMenu->addAction (helpResetMessagesAction);
    414389
    415390    menuBar()->insertItem( QString::null, helpMenu, helpMenuId );
     
    418393    ///// Status bar ////////////////////////////////////////////////////////
    419394
    420     Q3HBox *indicatorBox = new Q3HBox (0, "indicatorBox");
    421     indicatorBox->setSpacing (5);
     395    QWidget *indicatorBox = new QWidget ();
     396    QHBoxLayout *indicatorBoxHLayout = new QHBoxLayout (indicatorBox);
     397    indicatorBoxHLayout->setContentsMargins (0, 0, 0, 0);
     398    indicatorBoxHLayout->setSpacing (5);
    422399    /* i/o devices */
    423     hd_light = new QIStateIndicator (KDeviceActivity_Idle, indicatorBox);
     400    hd_light = new QIStateIndicator (KDeviceActivity_Idle);
    424401    hd_light->setStateIcon (KDeviceActivity_Idle, QPixmap (":/hd_16px.png"));
    425402    hd_light->setStateIcon (KDeviceActivity_Reading, QPixmap (":/hd_read_16px.png"));
    426403    hd_light->setStateIcon (KDeviceActivity_Writing, QPixmap (":/hd_write_16px.png"));
    427404    hd_light->setStateIcon (KDeviceActivity_Null, QPixmap (":/hd_disabled_16px.png"));
    428     cd_light = new QIStateIndicator (KDeviceActivity_Idle, indicatorBox);
     405    indicatorBoxHLayout->addWidget (hd_light);
     406    cd_light = new QIStateIndicator (KDeviceActivity_Idle);
    429407    cd_light->setStateIcon (KDeviceActivity_Idle, QPixmap (":/cd_16px.png"));
    430408    cd_light->setStateIcon (KDeviceActivity_Reading, QPixmap (":/cd_read_16px.png"));
    431409    cd_light->setStateIcon (KDeviceActivity_Writing, QPixmap (":/cd_write_16px.png"));
    432410    cd_light->setStateIcon (KDeviceActivity_Null, QPixmap (":/cd_disabled_16px.png"));
    433     fd_light = new QIStateIndicator (KDeviceActivity_Idle, indicatorBox);
     411    indicatorBoxHLayout->addWidget (cd_light);
     412    fd_light = new QIStateIndicator (KDeviceActivity_Idle);
    434413    fd_light->setStateIcon (KDeviceActivity_Idle, QPixmap (":/fd_16px.png"));
    435414    fd_light->setStateIcon (KDeviceActivity_Reading, QPixmap (":/fd_read_16px.png"));
    436415    fd_light->setStateIcon (KDeviceActivity_Writing, QPixmap (":/fd_write_16px.png"));
    437416    fd_light->setStateIcon (KDeviceActivity_Null, QPixmap (":/fd_disabled_16px.png"));
    438     net_light = new QIStateIndicator (KDeviceActivity_Idle, indicatorBox);
     417    indicatorBoxHLayout->addWidget (fd_light);
     418    net_light = new QIStateIndicator (KDeviceActivity_Idle);
    439419    net_light->setStateIcon (KDeviceActivity_Idle, QPixmap (":/nw_16px.png"));
    440420    net_light->setStateIcon (KDeviceActivity_Reading, QPixmap (":/nw_read_16px.png"));
    441421    net_light->setStateIcon (KDeviceActivity_Writing, QPixmap (":/nw_write_16px.png"));
    442422    net_light->setStateIcon (KDeviceActivity_Null, QPixmap (":/nw_disabled_16px.png"));
    443     usb_light = new QIStateIndicator (KDeviceActivity_Idle, indicatorBox);
     423    indicatorBoxHLayout->addWidget (net_light);
     424    usb_light = new QIStateIndicator (KDeviceActivity_Idle);
    444425    usb_light->setStateIcon (KDeviceActivity_Idle, QPixmap (":/usb_16px.png"));
    445426    usb_light->setStateIcon (KDeviceActivity_Reading, QPixmap (":/usb_read_16px.png"));
    446427    usb_light->setStateIcon (KDeviceActivity_Writing, QPixmap (":/usb_write_16px.png"));
    447428    usb_light->setStateIcon (KDeviceActivity_Null, QPixmap (":/usb_disabled_16px.png"));
    448     sf_light = new QIStateIndicator (KDeviceActivity_Idle, indicatorBox);
     429    indicatorBoxHLayout->addWidget (usb_light);
     430    sf_light = new QIStateIndicator (KDeviceActivity_Idle);
    449431    sf_light->setStateIcon (KDeviceActivity_Idle, QPixmap (":/shared_folder_16px.png"));
    450432    sf_light->setStateIcon (KDeviceActivity_Reading, QPixmap (":/shared_folder_read_16px.png"));
    451433    sf_light->setStateIcon (KDeviceActivity_Writing, QPixmap (":/shared_folder_write_16px.png"));
    452434    sf_light->setStateIcon (KDeviceActivity_Null, QPixmap (":/shared_folder_disabled_16px.png"));
    453 
    454     (new Q3Frame (indicatorBox))->setFrameStyle (Q3Frame::VLine | Q3Frame::Sunken);
     435    indicatorBoxHLayout->addWidget (sf_light);
     436
     437    QFrame *separator = new QFrame();
     438    separator->setFrameStyle (QFrame::VLine | QFrame::Sunken);
     439    indicatorBoxHLayout->addWidget (separator);
    455440
    456441#if 0 // do not show these indicators, information overload
     
    468453
    469454    /* mouse */
    470     mouse_state = new QIStateIndicator (0, indicatorBox);
     455    mouse_state = new QIStateIndicator (0);
    471456    mouse_state->setStateIcon (0, QPixmap (":/mouse_disabled_16px.png"));
    472457    mouse_state->setStateIcon (1, QPixmap (":/mouse_16px.png"));
     
    474459    mouse_state->setStateIcon (3, QPixmap (":/mouse_can_seamless_16px.png"));
    475460    mouse_state->setStateIcon (4, QPixmap (":/mouse_can_seamless_uncaptured_16px.png"));
     461    indicatorBoxHLayout->addWidget (mouse_state);
    476462    /* host key */
    477     hostkey_hbox = new Q3HBox (indicatorBox, "hostkey_hbox");
    478     hostkey_hbox->setSpacing (3);
    479     hostkey_state = new QIStateIndicator (0, hostkey_hbox);
     463    hostkey_hbox = new QWidget();
     464    QHBoxLayout *hostkeyHBoxLayout = new QHBoxLayout (hostkey_hbox);
     465    hostkeyHBoxLayout->setContentsMargins (0, 0, 0, 0);
     466    hostkeyHBoxLayout->setSpacing (3);
     467    indicatorBoxHLayout->addWidget (hostkey_hbox);
     468
     469    hostkey_state = new QIStateIndicator (0);
    480470    hostkey_state->setStateIcon (0, QPixmap (":/hostkey_16px.png"));
    481471    hostkey_state->setStateIcon (1, QPixmap (":/hostkey_captured_16px.png"));
    482472    hostkey_state->setStateIcon (2, QPixmap (":/hostkey_pressed_16px.png"));
    483473    hostkey_state->setStateIcon (3, QPixmap (":/hostkey_captured_pressed_16px.png"));
    484     hostkey_name = new QLabel (QIHotKeyEdit::keyName (vboxGlobal().settings().hostKey()),
    485                                hostkey_hbox, "hostkey_name");
     474    hostkeyHBoxLayout->addWidget (hostkey_state);
     475    hostkey_name = new QLabel (QIHotKeyEdit::keyName (vboxGlobal().settings().hostKey()));
     476    hostkeyHBoxLayout->addWidget (hostkey_name);
    486477    /* add to statusbar */
    487     statusBar()->addWidget (indicatorBox, 0, true);
     478    statusBar()->addPermanentWidget (indicatorBox, 0);
    488479
    489480    /////////////////////////////////////////////////////////////////////////
     
    491482    languageChange();
    492483
    493     setCaption (caption_prefix);
     484    setWindowTitle (caption_prefix);
    494485
    495486    ///// Connections ///////////////////////////////////////////////////////
     
    657648    if (!centralWidget())
    658649    {
    659         setCentralWidget (new QWidget (this, "centralWidget"));
    660         Q3GridLayout *pMainLayout = new Q3GridLayout(centralWidget(), 3, 3, 0, 0);
     650        setCentralWidget (new QWidget (this));
     651        QGridLayout *pMainLayout = new QGridLayout(centralWidget());
     652        pMainLayout->setContentsMargins (0, 0, 0, 0);
     653        pMainLayout->setSpacing (0);
     654
    661655        mShiftingSpacerLeft = new QSpacerItem (0, 0,
    662                                                QSizePolicy::Fixed,
    663                                                QSizePolicy::Fixed);
     656                                               QSizePolicy::Preferred,
     657                                               QSizePolicy::Preferred);
    664658        mShiftingSpacerTop = new QSpacerItem (0, 0,
    665                                               QSizePolicy::Fixed,
    666                                               QSizePolicy::Fixed);
     659                                              QSizePolicy::Preferred,
     660                                              QSizePolicy::Preferred);
    667661        mShiftingSpacerRight = new QSpacerItem (0, 0,
    668                                                 QSizePolicy::Fixed,
    669                                                 QSizePolicy::Fixed);
     662                                                QSizePolicy::Preferred,
     663                                                QSizePolicy::Preferred);
    670664        mShiftingSpacerBottom = new QSpacerItem (0, 0,
    671                                                  QSizePolicy::Fixed,
    672                                                  QSizePolicy::Fixed);
    673         pMainLayout->addItem(mShiftingSpacerLeft, 1, 0);
    674         pMainLayout->addMultiCell(mShiftingSpacerTop, 0, 0, 0, 2);
    675         pMainLayout->addItem(mShiftingSpacerRight, 1, 2);
    676         pMainLayout->addMultiCell(mShiftingSpacerBottom, 2, 2, 0, 2);
     665                                                 QSizePolicy::Preferred,
     666                                                 QSizePolicy::Preferred);
     667        pMainLayout->addItem (mShiftingSpacerTop, 0, 0, 1, -1);
     668        pMainLayout->addItem (mShiftingSpacerLeft, 1, 0);
     669        pMainLayout->addItem (mShiftingSpacerRight, 1, 2);
     670        pMainLayout->addItem (mShiftingSpacerBottom, 2, 0, 1, -1);
    677671    }
    678672
     
    689683    activateUICustomizations();
    690684
    691     static_cast<Q3GridLayout*>(centralWidget()->layout())->addWidget(console, 1, 1, Qt::AlignVCenter | Qt::AlignHCenter);
     685    static_cast<QGridLayout*>(centralWidget()->layout())->addWidget(console, 1, 1, Qt::AlignVCenter | Qt::AlignHCenter);
    692686
    693687    CMachine cmachine = csession.GetMachine();
     
    696690    /* Not on Mac OS X. The dock icon is handled below. */
    697691#ifndef Q_WS_MAC
    698     setIcon (vboxGlobal().vmGuestOSTypeIcon (cmachine.GetOSTypeId()));
     692    setWindowIcon (vboxGlobal().vmGuestOSTypeIcon (cmachine.GetOSTypeId()));
    699693#endif
    700694
     
    803797    /* start an idle timer that will update device lighths */
    804798    connect (idle_timer, SIGNAL (timeout()), SLOT (updateDeviceLights()));
    805     idle_timer->start (50, false);
     799    idle_timer->start (50);
    806800
    807801    connect (console, SIGNAL (mouseStateChanged (int)),
     
    10101004    console->detach();
    10111005
    1012     centralWidget()->layout()->remove( console );
     1006    centralWidget()->layout()->removeWidget (console);
    10131007    delete console;
    10141008    console = 0;
     
    11341128
    11351129    mMainMenu->popup (pos);
    1136     mMainMenu->setActiveWindow();
     1130    mMainMenu->activateWindow();
    11371131    mMainMenu->setActiveItem (0);
    11381132}
     
    11771171        {
    11781172            StatusTipEvent *ev = (StatusTipEvent*) e;
    1179             statusBar()->message (ev->mTip);
     1173            statusBar()->showMessage (ev->mTip);
    11801174            break;
    11811175        }
     
    12541248
    12551249            /* make the Discard checkbox invisible if there are no snapshots */
    1256             dlg.cbDiscardCurState->setShown ((cmachine.GetSnapshotCount() > 0));
     1250            dlg.cbDiscardCurState->setVisible ((cmachine.GetSnapshotCount() > 0));
    12571251
    12581252            if (machine_state != KMachineState_Stuck)
     
    12601254                /* read the last user's choice for the given VM */
    12611255                QStringList lastAction =
    1262                     QStringList::split (',', cmachine.GetExtraData (VBoxDefs::GUI_LastCloseAction));
     1256                    cmachine.GetExtraData (VBoxDefs::GUI_LastCloseAction).split (',');
    12631257                AssertWrapperOk (cmachine);
    12641258                if (lastAction [0] == kPowerOff)
     
    13421336
    13431337                        /* discard the current state if requested */
    1344                         if (dlg.cbDiscardCurState->isShown() &&
     1338                        if (dlg.cbDiscardCurState->isVisible() &&
    13451339                            dlg.cbDiscardCurState->isChecked())
    13461340                        {
     
    16121606
    16131607#if 0
    1614     QToolTip::add (autoresize_state,
     1608    autoresize_state->setToolTip (
    16151609        tr ("Indicates whether the guest display auto-resize function is On "
    16161610            "(<img src=:/auto_resize_on_16px.png/>) or Off (<img src=:/auto_resize_off_16px.png/>). "
    16171611            "Note that this function requires Guest Additions to be installed in the guest OS."));
    16181612#endif
    1619     QToolTip::add (mouse_state,
     1613    mouse_state->setToolTip (
    16201614        tr ("Indicates whether the host mouse pointer is captured by the guest OS:<br>"
    16211615            "<nobr><img src=:/mouse_disabled_16px.png/>&nbsp;&nbsp;pointer is not captured</nobr><br>"
     
    16251619            "<nobr><img src=:/mouse_can_seamless_uncaptured_16px.png/>&nbsp;&nbsp;MI is Off, pointer is not captured</nobr><br>"
    16261620            "Note that the mouse integration feature requires Guest Additions to be installed in the guest OS."));
    1627     QToolTip::add (hostkey_state,
     1621    hostkey_state->setToolTip (
    16281622        tr ("Indicates whether the keyboard is captured by the guest OS "
    16291623            "(<img src=:/hostkey_captured_16px.png/>) or not (<img src=:/hostkey_16px.png/>)."));
    1630     QToolTip::add (hostkey_name,
     1624    hostkey_name->setToolTip (
    16311625        tr ("Shows the currently assigned Host key.<br>"
    16321626            "This key, when pressed alone, toggles the the keyboard and mouse "
     
    16561650            snapshotName = " (" + snapshot.GetName() + ")";
    16571651        }
    1658         setCaption (cmachine.GetName() + snapshotName +
    1659                     " [" + vboxGlobal().toString (machine_state) + "] - " +
    1660                     caption_prefix);
     1652        setWindowTitle (cmachine.GetName() + snapshotName +
     1653                        " [" + vboxGlobal().toString (machine_state) + "] - " +
     1654                        caption_prefix);
    16611655//#ifdef Q_WS_MAC
    16621656//        SetWindowTitleWithCFString (reinterpret_cast <WindowPtr> (this->winId()), CFSTR("sfds"));
     
    17061700                AssertMsgFailed (("Invalid floppy drive state: %d\n", state));
    17071701        }
    1708         QToolTip::add (fd_light, tip.arg (name));
     1702        fd_light->setToolTip (tip.arg (name));
    17091703    }
    17101704    if (element & DVDStuff)
     
    17501744                AssertMsgFailed (("Invalid DVD drive state: %d\n", state));
    17511745        }
    1752         QToolTip::add (cd_light, tip.arg (name));
     1746        cd_light->setToolTip (tip.arg (name));
    17531747    }
    17541748    if (element & HardDiskStuff)
     
    17741768            data += tr ("<br><nobr><b>No hard disks attached</b></nobr>",
    17751769                        "HDD tooltip");
    1776         QToolTip::add (hd_light, tip.arg (data));
     1770        hd_light->setToolTip (tip.arg (data));
    17771771        hd_light->setState (hasDisks ? KDeviceActivity_Idle : KDeviceActivity_Null);
    17781772    }
     
    18141808                       "Network adapters tooltip");
    18151809
    1816         QToolTip::add (net_light, ttip.arg (info));
     1810        net_light->setToolTip (ttip.arg (info));
    18171811    }
    18181812    if (element & USBStuff)
     
    18511845            }
    18521846
    1853             QToolTip::add (usb_light, ttip.arg (info));
     1847            usb_light->setToolTip (ttip.arg (info));
    18541848        }
    18551849    }
     
    18721866            if (vrdpsrv.GetEnabled())
    18731867                tip += tr ("<hr>VRDP Server is listening on port %1").arg (vrdpsrv.GetPort());
    1874             QToolTip::add (vrdp_state, tip);
     1868            vrdp_state->setToolTip (tip);
    18751869#endif
    18761870        }
     
    19021896        }
    19031897
    1904         for (QMap <QString, QString>::ConstIterator it = sfs.begin();
    1905              it != sfs.end(); ++ it)
     1898        for (QMap<QString, QString>::const_iterator it = sfs.constBegin();
     1899             it != sfs.constEnd(); ++it)
    19061900        {
    19071901            /* select slashes depending on the OS type */
     
    19091903                data += QString ("<tr><td><nobr><b>\\\\vboxsvr\\%1</b></nobr></td>"
    19101904                                 "<td><nobr>%2</nobr></td>")
    1911                     .arg (it.key(), it.data());
     1905                    .arg (it.key(), it.value());
    19121906            else
    19131907                data += QString ("<tr><td><nobr><b>%1</b></nobr></td>"
    19141908                                 "<td><nobr>%2</nobr></td></tr>")
    1915                     .arg (it.key(), it.data());
     1909                    .arg (it.key(), it.value());
    19161910        }
    19171911
     
    19231917                            "width=100%>%1</table>").arg (data);
    19241918
    1925         QToolTip::add (sf_light, tip.arg (data));
     1919        sf_light->setToolTip (tip.arg (data));
    19261920    }
    19271921    if (element & PauseAction)
     
    20092003        QString hotKey = aSeamless ? vmSeamlessAction->text() :
    20102004                                     vmFullscreenAction->text();
    2011         hotKey = QStringList::split ('\t', hotKey) [1];
     2005        hotKey = hotKey.split ('\t')[1];
    20122006        Assert (!hotKey.isEmpty());
    20132007
     
    20942088
    20952089        /* Hide all but the central widget containing the console view. */
    2096         QObjectList list = queryList (NULL, NULL, false, false);
    2097         foreach (QObject *obj, list)
    2098         {
    2099             if (obj->isWidgetType() && obj != centralWidget())
     2090        QList<QWidget *> list = findChildren<QWidget *>();
     2091        foreach (QWidget *w, list)
     2092        {
     2093            if (w != centralWidget())
    21002094            {
    2101                 QWidget *w = (QWidget *) obj;
    21022095                if (!w->isHidden())
    21032096                {
     
    21762169
    21772170        /* Reset the shifting spacer. */
    2178         mShiftingSpacerLeft->changeSize (0, 0, QSizePolicy::Fixed, QSizePolicy::Fixed);
    2179         mShiftingSpacerTop->changeSize (0, 0, QSizePolicy::Fixed, QSizePolicy::Fixed);
    2180         mShiftingSpacerRight->changeSize (0, 0, QSizePolicy::Fixed, QSizePolicy::Fixed);
    2181         mShiftingSpacerBottom->changeSize (0, 0, QSizePolicy::Fixed, QSizePolicy::Fixed);
     2171        mShiftingSpacerLeft->changeSize (0, 0, QSizePolicy::Preferred, QSizePolicy::Preferred);
     2172        mShiftingSpacerTop->changeSize (0, 0, QSizePolicy::Preferred, QSizePolicy::Preferred);
     2173        mShiftingSpacerRight->changeSize (0, 0, QSizePolicy::Preferred, QSizePolicy::Preferred);
     2174        mShiftingSpacerBottom->changeSize (0, 0, QSizePolicy::Preferred, QSizePolicy::Preferred);
    21822175
    21832176        /* Restore the previous scroll-view minimum size before the exiting
     
    24402433        /* Check the current snapshot name */
    24412434        QString name = index.GetName();
    2442         int pos = regExp.search (name);
     2435        int pos = regExp.indexIn (name);
    24432436        if (pos != -1)
    24442437            maxSnapShotIndex = regExp.cap (1).toInt() > maxSnapShotIndex ?
     
    24542447
    24552448        CProgress progress =
    2456             cconsole.TakeSnapshot (dlg.leName->text().stripWhiteSpace(),
     2449            cconsole.TakeSnapshot (dlg.leName->text().trimmed(),
    24572450                                   dlg.txeDescription->text());
    24582451
     
    26312624            /* compare the name part ignoring the file case*/
    26322625            QString fn = QFileInfo (path).fileName();
    2633             if (RTPathCompare (name.utf8(), fn.utf8()) == 0)
     2626            if (RTPathCompare (name.toUtf8().constData(), fn.toUtf8().constData()) == 0)
    26342627                return installGuestAdditionsFrom (path);
    26352628        }
     
    26422635                                   .arg (vbox.GetVersion().remove ("_OSE")) + name;
    26432636            QString target = QDir (vboxGlobal().virtualBox().GetHomeFolder())
    2644                                    .absFilePath (name);
     2637                                   .absoluteFilePath (name);
    26452638
    26462639            new VBoxDownloaderWgt (statusBar(), devicesInstallGuestToolsAction,
     
    27902783
    27912784    if (devicesMountFloppyMenu->count() > 0)
    2792         devicesMountFloppyMenu->insertSeparator();
    2793     devicesMountFloppyImageAction->addTo (devicesMountFloppyMenu);
     2785        devicesMountFloppyMenu->addSeparator();
     2786    devicesMountFloppyMenu->addAction (devicesMountFloppyImageAction);
    27942787
    27952788    /* if shown as a context menu */
    27962789    if (devicesMenu->itemParameter (devicesMountFloppyMenuId))
    27972790    {
    2798         devicesMountFloppyMenu->insertSeparator();
    2799         devicesUnmountFloppyAction->addTo (devicesMountFloppyMenu);
     2791        devicesMountFloppyMenu->addSeparator();
     2792        devicesMountFloppyMenu->addAction (devicesUnmountFloppyAction);
    28002793    }
    28012794}
     
    28362829
    28372830    if (devicesMountDVDMenu->count() > 0)
    2838         devicesMountDVDMenu->insertSeparator();
    2839     devicesMountDVDImageAction->addTo (devicesMountDVDMenu);
     2831        devicesMountDVDMenu->addSeparator();
     2832    devicesMountDVDMenu->addAction (devicesMountDVDImageAction);
    28402833
    28412834    /* if shown as a context menu */
     
    28432836    if (devicesMenu->itemParameter (devicesMountDVDMenuId))
    28442837    {
    2845         devicesMountDVDMenu->insertSeparator();
    2846         devicesUnmountDVDAction->addTo (devicesMountDVDMenu);
     2838        devicesMountDVDMenu->addSeparator();
     2839        devicesMountDVDMenu->addAction (devicesUnmountDVDAction);
    28472840    }
    28482841}
     
    29042897{
    29052898    if (statusBarChangedInside)
    2906         statusBar()->clear();
     2899        statusBar()->clearMessage();
    29072900}
    29082901
  • trunk/src/VBox/Frontends/VirtualBox4/src/VBoxGlobal.cpp

    r7382 r7397  
    896896         *  from the below constructor or from constructors/methods it calls.
    897897         */
    898         VBoxConsoleWnd *w = new VBoxConsoleWnd (&mConsoleWnd, 0, "consoleWnd");
     898        VBoxConsoleWnd *w = new VBoxConsoleWnd (&mConsoleWnd, 0);
    899899        Assert (w == mConsoleWnd);
    900900        NOREF(w);
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