VirtualBox

Changeset 9257 in vbox for trunk/src/VBox


Ignore:
Timestamp:
May 30, 2008 2:29:48 PM (17 years ago)
Author:
vboxsync
Message:

FE/Qt4: Merged QIAbstractDialog into QIMainDialog. The log viewer & the
information dialog both using the new QIMainDialog. Additionally the log viewer
provides an proxy icon for the current selected log. Some small fixes in
QIMainDialog.

Location:
trunk/src/VBox/Frontends/VirtualBox4
Files:
2 deleted
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox4/Makefile.kmk

    r9253 r9257  
    441441        include/QIRichLabel.h \
    442442        include/QIAbstractWizard.h \
    443         include/QIAbstractDialog.h \
    444443        include/QIListView.h \
    445444        include/QITreeWidget.h \
     
    524523        src/QIRichLabel.cpp \
    525524        src/QIAbstractWizard.cpp \
    526         src/QIAbstractDialog.cpp \
    527525        src/QIDialog.cpp \
    528526        src/QIDialogButtonBox.cpp \
  • trunk/src/VBox/Frontends/VirtualBox4/include/QIMainDialog.h

    r9245 r9257  
    3030
    3131class QEventLoop;
     32class QSizeGrip;
    3233
    3334class QIMainDialog: public QMainWindow
     
    4546    QString fileForProxyIcon () const;
    4647
     48    void setSizeGripEnabled (bool aEnabled);
     49    bool isSizeGripEnabled () const;
     50
    4751public slots:
    4852
     
    5256
    5357    virtual bool event (QEvent *aEvent);
     58    virtual void resizeEvent (QResizeEvent *aEvent);
     59    virtual void keyPressEvent (QKeyEvent *aEvent);
    5460
    5561protected slots:
     
    7076
    7177    QString mFileForProxyIcon;
     78
     79    QPointer<QSizeGrip> mSizeGrip;
    7280};
    7381
  • trunk/src/VBox/Frontends/VirtualBox4/include/VBoxDiskImageManagerDlg.h

    r9245 r9257  
    6767    void retranslateUi();
    6868    virtual void closeEvent (QCloseEvent *aEvent);
    69     virtual void keyPressEvent (QKeyEvent *aEvent);
    7069    virtual bool eventFilter (QObject *aObject, QEvent *aEvent);
    7170    /* @todo: Currently not used (Ported from Qt3): */
  • trunk/src/VBox/Frontends/VirtualBox4/include/VBoxVMInformationDlg.h

    r9056 r9257  
    2525
    2626#include "VBoxVMInformationDlg.gen.h"
    27 #include "QIAbstractDialog.h"
     27#include "QIMainDialog.h"
    2828#include "COMDefs.h"
    2929#include "QIWithRetranslateUI.h"
     
    3232class QTimer;
    3333
    34 class VBoxVMInformationDlg : public QIWithRetranslateUI2<QIAbstractDialog>,
     34class VBoxVMInformationDlg : public QIWithRetranslateUI2<QIMainDialog>,
    3535                             public Ui::VBoxVMInformationDlg
    3636{
  • trunk/src/VBox/Frontends/VirtualBox4/src/QIMainDialog.cpp

    r9245 r9257  
    3434#include <QUrl>
    3535#include <QMenu>
     36#include <QSizeGrip>
     37#include <QPushButton>
    3638
    3739QIMainDialog::QIMainDialog (QWidget *aParent /* = NULL */, Qt::WindowFlags aFlags /* = Qt::Dialog */)
     
    8284{
    8385    return mFileForProxyIcon;
     86}
     87
     88void QIMainDialog::setSizeGripEnabled (bool aEnabled)
     89{
     90    if (!mSizeGrip && aEnabled)
     91    {
     92        mSizeGrip = new QSizeGrip (this);
     93        mSizeGrip->resize (mSizeGrip->sizeHint());
     94        mSizeGrip->show();
     95    }
     96    else if (mSizeGrip && !aEnabled)
     97        delete mSizeGrip;
     98}
     99
     100bool QIMainDialog::isSizeGripEnabled () const
     101{
     102    return mSizeGrip;
    84103}
    85104
     
    167186}
    168187
     188void QIMainDialog::resizeEvent (QResizeEvent *aEvent)
     189{
     190    QMainWindow::resizeEvent (aEvent);
     191
     192    /* Adjust the size-grip location for the current resize event */
     193    if (mSizeGrip)
     194    {
     195        if (isRightToLeft())
     196            mSizeGrip->move (rect().bottomLeft() - mSizeGrip->rect().bottomLeft());
     197        else
     198            mSizeGrip->move (rect().bottomRight() - mSizeGrip->rect().bottomRight());
     199        aEvent->accept();
     200    }
     201}
     202
     203void QIMainDialog::keyPressEvent (QKeyEvent *aEvent)
     204{
     205#ifdef Q_WS_MAC
     206    if (aEvent->modifiers() == Qt::ControlModifier &&
     207        aEvent->key() == Qt::Key_Period)
     208        reject();
     209    else
     210#endif
     211    if (aEvent->modifiers() == Qt::NoModifier ||
     212        (aEvent->modifiers() & Qt::KeypadModifier && aEvent->key() == Qt::Key_Enter))
     213    {
     214        switch (aEvent->key())
     215        {
     216            case Qt::Key_Enter:
     217            case Qt::Key_Return:
     218                {
     219                    QList<QPushButton*> list = qFindChildren<QPushButton*> (this);
     220                    for (int i=0; i < list.size(); ++i)
     221                    {
     222                        QPushButton *pb = list.at (i);
     223                        if (pb->isDefault() && pb->isVisible())
     224                        {
     225                            if (pb->isEnabled())
     226                                pb->click();
     227                            return;
     228                        }
     229                    }
     230                    break;
     231                }
     232            case Qt::Key_Escape:
     233                {
     234                    reject();
     235                    break;
     236                }
     237        }
     238    }
     239    else
     240        aEvent->ignore();
     241}
     242
    169243void QIMainDialog::accept()
    170244{
  • trunk/src/VBox/Frontends/VirtualBox4/src/VBoxDiskImageManagerDlg.cpp

    r9245 r9257  
    817817    mModelessDialog = NULL;
    818818    aEvent->accept();
    819 }
    820 
    821 void VBoxDiskImageManagerDlg::keyPressEvent (QKeyEvent *aEvent)
    822 {
    823     if (aEvent->modifiers() == Qt::NoModifier ||
    824         (aEvent->modifiers() != Qt::NoModifier && aEvent->key() == Qt::Key_Enter))
    825     {
    826         switch (aEvent->key())
    827         {
    828             case Qt::Key_Enter:
    829             case Qt::Key_Return:
    830                 {
    831                     accept();
    832                     break;
    833                 }
    834             case Qt::Key_Escape:
    835                 {
    836                     reject();
    837                     break;
    838                 }
    839         }
    840     }
    841     else
    842         aEvent->ignore();
    843819}
    844820
  • trunk/src/VBox/Frontends/VirtualBox4/src/VBoxVMInformationDlg.cpp

    r9056 r9257  
    5252                                            const CSession &aSession,
    5353                                            Qt::WindowFlags aFlags)
    54     : QIWithRetranslateUI2<QIAbstractDialog> (aConsole, aFlags)
     54    : QIWithRetranslateUI2<QIMainDialog> (aConsole, aFlags)
    5555    , mIsPolished (false)
    5656    , mConsole (aConsole)
     
    6161    Ui::VBoxVMInformationDlg::setupUi (this);
    6262
    63     /* Initialize parent defaults */
    64     initializeDialog();
     63#ifdef Q_WS_MAC
     64    /* No icon for this window on the mac, cause this would act as proxy icon
     65     * which isn't necessary here. */
     66    setWindowIcon (QIcon());
     67#endif
     68
     69    /* Enable size grip without using a status bar. */
     70    setSizeGripEnabled (true);
    6571
    6672    /* Setup focus-proxy for pages */
     
    250256bool VBoxVMInformationDlg::event (QEvent *aEvent)
    251257{
    252     bool result = QIAbstractDialog::event (aEvent);
     258    bool result = QIMainDialog::event (aEvent);
    253259    switch (aEvent->type())
    254260    {
     
    269275void VBoxVMInformationDlg::resizeEvent (QResizeEvent *aEvent)
    270276{
    271     QIAbstractDialog::resizeEvent (aEvent);
     277    QIMainDialog::resizeEvent (aEvent);
    272278
    273279    /* Store dialog size for this vm */
     
    281287void VBoxVMInformationDlg::showEvent (QShowEvent *aEvent)
    282288{
    283     QIAbstractDialog::showEvent (aEvent);
     289    QIMainDialog::showEvent (aEvent);
    284290
    285291    /* One may think that QWidget::polish() is the right place to do things
  • trunk/src/VBox/Frontends/VirtualBox4/ui/VBoxVMInformationDlg.ui

    r8790 r9257  
    11<ui version="4.0" >
    2  <class>VBoxVMInformationDlg</class>
    32 <comment>
    43 VBox frontends: Qt4 GUI ("VirtualBox"):
     
    1817 additional information or have any questions.
    1918 </comment>
     19 <class>VBoxVMInformationDlg</class>
    2020 <widget class="QMainWindow" name="VBoxVMInformationDlg" >
    2121  <property name="geometry" >
     
    121121   </layout>
    122122  </widget>
    123   <widget class="QStatusBar" name="statusbar" />
    124123 </widget>
    125124 <customwidgets>
  • trunk/src/VBox/Frontends/VirtualBox4/ui/VBoxVMLogViewer.ui

    r9119 r9257  
    5454   </layout>
    5555  </widget>
    56   <widget class="QStatusBar" name="statusbar" />
    5756 </widget>
    5857 <customwidgets>
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