VirtualBox

Ignore:
Timestamp:
Jun 19, 2008 12:56:14 PM (16 years ago)
Author:
vboxsync
Message:

Fe/Qt4: GlobalInputSettings ported to qt4, fixed tab-order for GlobalGeneralSettings.

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

Legend:

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

    r9783 r9820  
    407407VirtualBox_QT_UISRCS3 := $(filter-out ui/VBoxGlobalSettingsGeneral.ui,$(VirtualBox_QT_UISRCS3))
    408408VirtualBox_QT_UISRCS4 += ui/VBoxGlobalSettingsGeneral.ui
     409
     410VirtualBox_QT_UISRCS3 := $(filter-out ui/VBoxGlobalSettingsInput.ui,$(VirtualBox_QT_UISRCS3))
     411VirtualBox_QT_UISRCS4 += ui/VBoxGlobalSettingsInput.ui
    409412
    410413VirtualBox_QT_UISRCS3 := $(filter-out ui/VBoxGlobalSettingsDlg.ui,$(VirtualBox_QT_UISRCS3))
     
    572575        include/VBoxVMSettingsDlg.h \
    573576        include/VBoxGlobalSettingsGeneral.h \
     577        include/VBoxGlobalSettingsInput.h \
    574578        include/VBoxGlobalSettingsDlg.h
    575579
     
    659663        src/VBoxVMSettingsDlg.cpp \
    660664        src/VBoxGlobalSettingsGeneral.cpp \
     665        src/VBoxGlobalSettingsInput.cpp \
    661666        src/VBoxGlobalSettingsDlg.cpp
    662667
  • trunk/src/VBox/Frontends/VirtualBox4/include/QIHotKeyEdit.h

    r8946 r9820  
    2424#define __QIHotKeyEdit_h__
    2525
    26 #include <qlabel.h>
    27 //Added by qt3to4:
    28 #include <QPalette>
    29 #include <QFocusEvent>
    30 #if defined(Q_WS_X11)
    31 #include <qmap.h>
     26#include <QLabel>
     27#if defined (Q_WS_X11)
     28#include <QMap>
    3229#endif
    33 #if defined(Q_WS_MAC)
     30#if defined (Q_WS_MAC)
    3431#include <Carbon/Carbon.h>
    3532#endif
    3633
    37 #if defined(Q_WS_PM)
     34#if defined (Q_WS_PM)
    3835/* Extra virtual keys returned by QIHotKeyEdit::virtualKey() */
    3936#define VK_LSHIFT   VK_USERFIRST + 0
     
    5249public:
    5350
    54     QIHotKeyEdit (QWidget *aParent, const char *aName = 0);
     51    QIHotKeyEdit (QWidget *aParent);
    5552    virtual ~QIHotKeyEdit();
    5653
     
    9491    void focusOutEvent (QFocusEvent *);
    9592
    96     void drawContents (QPainter *p);
     93    void paintEvent (QPaintEvent *);
    9794
    9895private:
     
    10299    int mKeyVal;
    103100    QString mSymbName;
    104 
    105     QColorGroup mTrueACG;
    106101
    107102#if defined (Q_WS_PM)
     
    123118
    124119#endif // __QIHotKeyEdit_h__
     120
  • trunk/src/VBox/Frontends/VirtualBox4/src/QIHotKeyEdit.cpp

    r9495 r9820  
    2222
    2323#include "QIHotKeyEdit.h"
    24 //Added by qt3to4:
    25 #include <QLabel>
    26 #include <QFocusEvent>
    27 
    2824#include "VBoxDefs.h"
    29 
    30 #include <qapplication.h>
    31 #include <qstyle.h>
    32 #include <qlineedit.h>
     25#include <QApplication>
     26#include <QStyleOption>
     27#include <QStylePainter>
    3328
    3429#ifdef Q_WS_WIN
     
    4237
    4338#if defined (Q_WS_PM)
    44 QMap <int, QString> QIHotKeyEdit::sKeyNames;
     39QMap<int, QString> QIHotKeyEdit::sKeyNames;
    4540#endif
    4641
     
    6762#endif
    6863#include "XKeyboard.h"
    69 QMap <QString, QString> QIHotKeyEdit::sKeyNames;
     64QMap<QString, QString> QIHotKeyEdit::sKeyNames;
     65#include <QX11Info>
    7066#endif
    7167
     
    111107const char *QIHotKeyEdit::kNoneSymbName = "<none>";
    112108
    113 QIHotKeyEdit::QIHotKeyEdit (QWidget *aParent, const char *aName) :
    114     QLabel (aParent, aName)
     109QIHotKeyEdit::QIHotKeyEdit (QWidget *aParent) :
     110    QLabel (aParent)
    115111{
    116112#ifdef Q_WS_X11
    117     // initialize the X keyboard subsystem
    118     initXKeyboard (this->x11Display());
     113    /* Initialize the X keyboard subsystem */
     114    initXKeyboard (QX11Info::display());
    119115#endif
    120116
     
    124120    setAlignment (Qt::AlignHCenter | Qt::AlignBottom);
    125121    setFocusPolicy (Qt::StrongFocus);
     122    setAutoFillBackground (true);
    126123
    127124    QPalette p = palette();
    128125    p.setColor (QPalette::Active, QColorGroup::Foreground,
    129         p.color (QPalette::Active, QColorGroup::HighlightedText));
     126                p.color (QPalette::Active, QColorGroup::Text));
    130127    p.setColor (QPalette::Active, QColorGroup::Background,
    131         p.color (QPalette::Active, QColorGroup::Highlight));
    132     p.setColor (QPalette::Inactive, QColorGroup::Foreground,
    133         p.color (QPalette::Active, QColorGroup::Text));
    134     p.setColor (QPalette::Inactive, QColorGroup::Background,
    135         p.color (QPalette::Active, QColorGroup::Base));
    136 
    137     mTrueACG = p.active();
    138     p.setActive (p.inactive());
     128                p.color (QPalette::Active, QColorGroup::Base));
    139129    setPalette (p);
    140130
     
    142132    mDarwinKeyModifiers = GetCurrentEventKeyModifiers();
    143133
    144     EventTypeSpec eventTypes[4];
    145     eventTypes[0].eventClass = kEventClassKeyboard;
    146     eventTypes[0].eventKind  = kEventRawKeyDown;
    147     eventTypes[1].eventClass = kEventClassKeyboard;
    148     eventTypes[1].eventKind  = kEventRawKeyUp;
    149     eventTypes[2].eventClass = kEventClassKeyboard;
    150     eventTypes[2].eventKind  = kEventRawKeyRepeat;
    151     eventTypes[3].eventClass = kEventClassKeyboard;
    152     eventTypes[3].eventKind  = kEventRawKeyModifiersChanged;
     134    EventTypeSpec eventTypes [4];
     135    eventTypes [0].eventClass = kEventClassKeyboard;
     136    eventTypes [0].eventKind  = kEventRawKeyDown;
     137    eventTypes [1].eventClass = kEventClassKeyboard;
     138    eventTypes [1].eventKind  = kEventRawKeyUp;
     139    eventTypes [2].eventClass = kEventClassKeyboard;
     140    eventTypes [2].eventKind  = kEventRawKeyRepeat;
     141    eventTypes [3].eventClass = kEventClassKeyboard;
     142    eventTypes [3].eventKind  = kEventRawKeyModifiersChanged;
    153143
    154144    EventHandlerUPP eventHandler = ::NewEventHandlerUPP (QIHotKeyEdit::darwinEventHandlerProc);
    155145
    156146    mDarwinEventHandlerRef = NULL;
    157     ::InstallApplicationEventHandler (eventHandler, RT_ELEMENTS( eventTypes ), &eventTypes[0],
     147    ::InstallApplicationEventHandler (eventHandler, RT_ELEMENTS (eventTypes), &eventTypes [0],
    158148                                      this, &mDarwinEventHandlerRef);
    159149    ::DisposeEventHandlerUPP (eventHandler);
     
    205195QSize QIHotKeyEdit::sizeHint() const
    206196{
    207     constPolish();
     197    ensurePolished();
    208198    QFontMetrics fm (font());
    209     int h = QMAX(fm.lineSpacing(), 14) + 2;
    210     int w = fm.width( 'x' ) * 17; // "some"
     199    int h = QMAX (fm.lineSpacing(), 14) + 2;
     200    int w = fm.width ('x') * 17; // "some"
    211201    int m = frameWidth() * 2;
    212 //#warning port me
    213 //    return (style()->sizeFromContents (QStyle::CT_LineEdit, this,
    214 //                                      QSize (w + m, h + m)
    215 //                                      .expandedTo(QApplication::globalStrut())));
    216     return QSize(10,10);
     202    QStyleOption option;
     203    option.initFrom (this);
     204    return (style()->sizeFromContents (QStyle::CT_LineEdit, &option,
     205                                       QSize (w + m, h + m)
     206                                       .expandedTo (QApplication::globalStrut()),
     207                                       this));
    217208}
    218209
     
    222213QSize QIHotKeyEdit::minimumSizeHint() const
    223214{
    224     constPolish();
     215    ensurePolished();
    225216    QFontMetrics fm = fontMetrics();
    226217    int h = fm.height() + QMAX (2, fm.leading());
     
    717708#endif
    718709
    719 void QIHotKeyEdit::focusInEvent (QFocusEvent *)
    720 {
     710void QIHotKeyEdit::focusInEvent (QFocusEvent *aEvent)
     711{
     712    QLabel::focusInEvent (aEvent);
     713
    721714    QPalette p = palette();
    722     p.setActive (mTrueACG);
     715    p.setColor (QPalette::Active, QColorGroup::Foreground,
     716                p.color (QPalette::Active, QColorGroup::HighlightedText));
     717    p.setColor (QPalette::Active, QColorGroup::Background,
     718                p.color (QPalette::Active, QColorGroup::Highlight));
    723719    setPalette (p);
    724720}
    725721
    726 void QIHotKeyEdit::focusOutEvent (QFocusEvent *)
    727 {
     722void QIHotKeyEdit::focusOutEvent (QFocusEvent *aEvent)
     723{
     724    QLabel::focusOutEvent (aEvent);
     725
    728726    QPalette p = palette();
    729     p.setActive (p.inactive());
     727    p.setColor (QPalette::Active, QColorGroup::Foreground,
     728                p.color (QPalette::Active, QColorGroup::Text));
     729    p.setColor (QPalette::Active, QColorGroup::Background,
     730                p.color (QPalette::Active, QColorGroup::Base));
    730731    setPalette (p);
    731732}
    732733
    733 void QIHotKeyEdit::drawContents (QPainter * p)
    734 {
    735 //#warning port me
    736 //    QLabel::drawContents (p);
    737 //    if (hasFocus())
    738 //    {
    739 //        style().drawPrimitive (
    740 //            QStyle::PE_FocusRect, p, contentsRect(), colorGroup(),
    741 //            QStyle::State_None,
    742 //            QStyleOption( colorGroup().background()));
    743 //    }
     734void QIHotKeyEdit::paintEvent (QPaintEvent *aEvent)
     735{
     736    if (hasFocus())
     737    {
     738        QStylePainter painter (this);
     739        QStyleOptionFocusRect option;
     740        option.initFrom (this);
     741        option.backgroundColor = palette().color (QPalette::Background);
     742        option.rect = contentsRect();
     743        painter.drawPrimitive (QStyle::PE_FrameFocusRect, option);
     744    }
     745    QLabel::paintEvent (aEvent);
    744746}
    745747
     
    751753    setText (QString (" %1 ").arg (mSymbName));
    752754}
     755
  • trunk/src/VBox/Frontends/VirtualBox4/src/VBoxGlobalSettingsDlg.cpp

    r9783 r9820  
    3434
    3535#include "VBoxGlobalSettingsGeneral.h"
    36 //#include "VBoxGlobalSettingsInput.h"
     36#include "VBoxGlobalSettingsInput.h"
    3737//#include "VBoxGlobalSettingsUSB.h"
    3838//#include "VBoxGlobalSettingsLanguage.h"
     
    297297    connect (mTwSelector, SIGNAL (currentItemChanged (QTreeWidgetItem*, QTreeWidgetItem*)),
    298298             this, SLOT (settingsGroupChanged (QTreeWidgetItem *, QTreeWidgetItem*)));
    299 
    300 //     /* Keyboard page */
    301 //     wvalKeyboard = new QIWidgetValidator (pagePath (pageKeyboard), pageKeyboard, this);
    302 //     connect (wvalKeyboard, SIGNAL (validityChanged (const QIWidgetValidator *)),
    303 //              this, SLOT (enableOk( const QIWidgetValidator *)));
    304299
    305300//     /* Language page */
     
    375370                                     const VBoxGlobalSettings &aGs)
    376371{
    377 //     /* Input Page */
    378 //     hkeHostKey->setKey (gs.hostKey() );
    379 //     chbAutoCapture->setChecked (gs.autoCapture());
    380 
    381372//     /* USB Page */
    382373// #ifdef DEBUG_dmik
     
    435426
    436427    /* General Page */
    437     VBoxGlobalSettingsGeneral::getFrom (aProps, aGs, mPageGeneral);
     428    VBoxGlobalSettingsGeneral::getFrom (aProps, aGs, mPageGeneral, this);
    438429
    439430    /* Input Page */
    440     //VBoxGlobalSettingsInput::getFrom (aProps, aGs, mPageInput);
     431    VBoxGlobalSettingsInput::getFrom (aProps, aGs, mPageInput, this);
    441432
    442433    /* USB Page */
     
    455446                                            VBoxGlobalSettings &aGs)
    456447{
    457 //     /* Input Page */
    458 //     gs.setHostKey (hkeHostKey->key());
    459 //     gs.setAutoCapture (chbAutoCapture->isChecked());
    460 
    461448//     /* USB Page */
    462449//     /*
     
    508495
    509496    /* Input Page */
    510     //VBoxGlobalSettingsInput::putBackTo (aProps, aGs);
     497    VBoxGlobalSettingsInput::putBackTo (aProps, aGs);
    511498
    512499    /* USB Page */
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