Changeset 9820 in vbox for trunk/src/VBox/Frontends/VirtualBox4
- Timestamp:
- Jun 19, 2008 12:56:14 PM (16 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox4
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox4/Makefile.kmk
r9783 r9820 407 407 VirtualBox_QT_UISRCS3 := $(filter-out ui/VBoxGlobalSettingsGeneral.ui,$(VirtualBox_QT_UISRCS3)) 408 408 VirtualBox_QT_UISRCS4 += ui/VBoxGlobalSettingsGeneral.ui 409 410 VirtualBox_QT_UISRCS3 := $(filter-out ui/VBoxGlobalSettingsInput.ui,$(VirtualBox_QT_UISRCS3)) 411 VirtualBox_QT_UISRCS4 += ui/VBoxGlobalSettingsInput.ui 409 412 410 413 VirtualBox_QT_UISRCS3 := $(filter-out ui/VBoxGlobalSettingsDlg.ui,$(VirtualBox_QT_UISRCS3)) … … 572 575 include/VBoxVMSettingsDlg.h \ 573 576 include/VBoxGlobalSettingsGeneral.h \ 577 include/VBoxGlobalSettingsInput.h \ 574 578 include/VBoxGlobalSettingsDlg.h 575 579 … … 659 663 src/VBoxVMSettingsDlg.cpp \ 660 664 src/VBoxGlobalSettingsGeneral.cpp \ 665 src/VBoxGlobalSettingsInput.cpp \ 661 666 src/VBoxGlobalSettingsDlg.cpp 662 667 -
trunk/src/VBox/Frontends/VirtualBox4/include/QIHotKeyEdit.h
r8946 r9820 24 24 #define __QIHotKeyEdit_h__ 25 25 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> 32 29 #endif 33 #if defined (Q_WS_MAC)30 #if defined (Q_WS_MAC) 34 31 #include <Carbon/Carbon.h> 35 32 #endif 36 33 37 #if defined (Q_WS_PM)34 #if defined (Q_WS_PM) 38 35 /* Extra virtual keys returned by QIHotKeyEdit::virtualKey() */ 39 36 #define VK_LSHIFT VK_USERFIRST + 0 … … 52 49 public: 53 50 54 QIHotKeyEdit (QWidget *aParent , const char *aName = 0);51 QIHotKeyEdit (QWidget *aParent); 55 52 virtual ~QIHotKeyEdit(); 56 53 … … 94 91 void focusOutEvent (QFocusEvent *); 95 92 96 void drawContents (QPainter *p);93 void paintEvent (QPaintEvent *); 97 94 98 95 private: … … 102 99 int mKeyVal; 103 100 QString mSymbName; 104 105 QColorGroup mTrueACG;106 101 107 102 #if defined (Q_WS_PM) … … 123 118 124 119 #endif // __QIHotKeyEdit_h__ 120 -
trunk/src/VBox/Frontends/VirtualBox4/src/QIHotKeyEdit.cpp
r9495 r9820 22 22 23 23 #include "QIHotKeyEdit.h" 24 //Added by qt3to4:25 #include <QLabel>26 #include <QFocusEvent>27 28 24 #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> 33 28 34 29 #ifdef Q_WS_WIN … … 42 37 43 38 #if defined (Q_WS_PM) 44 QMap 39 QMap<int, QString> QIHotKeyEdit::sKeyNames; 45 40 #endif 46 41 … … 67 62 #endif 68 63 #include "XKeyboard.h" 69 QMap <QString, QString> QIHotKeyEdit::sKeyNames; 64 QMap<QString, QString> QIHotKeyEdit::sKeyNames; 65 #include <QX11Info> 70 66 #endif 71 67 … … 111 107 const char *QIHotKeyEdit::kNoneSymbName = "<none>"; 112 108 113 QIHotKeyEdit::QIHotKeyEdit (QWidget *aParent , const char *aName) :114 QLabel (aParent , aName)109 QIHotKeyEdit::QIHotKeyEdit (QWidget *aParent) : 110 QLabel (aParent) 115 111 { 116 112 #ifdef Q_WS_X11 117 / / initialize the X keyboard subsystem118 initXKeyboard ( this->x11Display());113 /* Initialize the X keyboard subsystem */ 114 initXKeyboard (QX11Info::display()); 119 115 #endif 120 116 … … 124 120 setAlignment (Qt::AlignHCenter | Qt::AlignBottom); 125 121 setFocusPolicy (Qt::StrongFocus); 122 setAutoFillBackground (true); 126 123 127 124 QPalette p = palette(); 128 125 p.setColor (QPalette::Active, QColorGroup::Foreground, 129 p.color (QPalette::Active, QColorGroup::HighlightedText));126 p.color (QPalette::Active, QColorGroup::Text)); 130 127 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)); 139 129 setPalette (p); 140 130 … … 142 132 mDarwinKeyModifiers = GetCurrentEventKeyModifiers(); 143 133 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; 153 143 154 144 EventHandlerUPP eventHandler = ::NewEventHandlerUPP (QIHotKeyEdit::darwinEventHandlerProc); 155 145 156 146 mDarwinEventHandlerRef = NULL; 157 ::InstallApplicationEventHandler (eventHandler, RT_ELEMENTS ( eventTypes ), &eventTypes[0],147 ::InstallApplicationEventHandler (eventHandler, RT_ELEMENTS (eventTypes), &eventTypes [0], 158 148 this, &mDarwinEventHandlerRef); 159 149 ::DisposeEventHandlerUPP (eventHandler); … … 205 195 QSize QIHotKeyEdit::sizeHint() const 206 196 { 207 constPolish();197 ensurePolished(); 208 198 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" 211 201 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)); 217 208 } 218 209 … … 222 213 QSize QIHotKeyEdit::minimumSizeHint() const 223 214 { 224 constPolish();215 ensurePolished(); 225 216 QFontMetrics fm = fontMetrics(); 226 217 int h = fm.height() + QMAX (2, fm.leading()); … … 717 708 #endif 718 709 719 void QIHotKeyEdit::focusInEvent (QFocusEvent *) 720 { 710 void QIHotKeyEdit::focusInEvent (QFocusEvent *aEvent) 711 { 712 QLabel::focusInEvent (aEvent); 713 721 714 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)); 723 719 setPalette (p); 724 720 } 725 721 726 void QIHotKeyEdit::focusOutEvent (QFocusEvent *) 727 { 722 void QIHotKeyEdit::focusOutEvent (QFocusEvent *aEvent) 723 { 724 QLabel::focusOutEvent (aEvent); 725 728 726 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)); 730 731 setPalette (p); 731 732 } 732 733 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 // } 734 void 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); 744 746 } 745 747 … … 751 753 setText (QString (" %1 ").arg (mSymbName)); 752 754 } 755 -
trunk/src/VBox/Frontends/VirtualBox4/src/VBoxGlobalSettingsDlg.cpp
r9783 r9820 34 34 35 35 #include "VBoxGlobalSettingsGeneral.h" 36 //#include "VBoxGlobalSettingsInput.h"36 #include "VBoxGlobalSettingsInput.h" 37 37 //#include "VBoxGlobalSettingsUSB.h" 38 38 //#include "VBoxGlobalSettingsLanguage.h" … … 297 297 connect (mTwSelector, SIGNAL (currentItemChanged (QTreeWidgetItem*, QTreeWidgetItem*)), 298 298 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 *)));304 299 305 300 // /* Language page */ … … 375 370 const VBoxGlobalSettings &aGs) 376 371 { 377 // /* Input Page */378 // hkeHostKey->setKey (gs.hostKey() );379 // chbAutoCapture->setChecked (gs.autoCapture());380 381 372 // /* USB Page */ 382 373 // #ifdef DEBUG_dmik … … 435 426 436 427 /* General Page */ 437 VBoxGlobalSettingsGeneral::getFrom (aProps, aGs, mPageGeneral );428 VBoxGlobalSettingsGeneral::getFrom (aProps, aGs, mPageGeneral, this); 438 429 439 430 /* Input Page */ 440 //VBoxGlobalSettingsInput::getFrom (aProps, aGs, mPageInput);431 VBoxGlobalSettingsInput::getFrom (aProps, aGs, mPageInput, this); 441 432 442 433 /* USB Page */ … … 455 446 VBoxGlobalSettings &aGs) 456 447 { 457 // /* Input Page */458 // gs.setHostKey (hkeHostKey->key());459 // gs.setAutoCapture (chbAutoCapture->isChecked());460 461 448 // /* USB Page */ 462 449 // /* … … 508 495 509 496 /* Input Page */ 510 //VBoxGlobalSettingsInput::putBackTo (aProps, aGs);497 VBoxGlobalSettingsInput::putBackTo (aProps, aGs); 511 498 512 499 /* USB Page */
Note:
See TracChangeset
for help on using the changeset viewer.