Changeset 81110 in vbox
- Timestamp:
- Oct 4, 2019 9:57:56 AM (5 years ago)
- svn:sync-xref-src-repo-rev:
- 133735
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/softkeyboard
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/softkeyboard/UISoftKeyboard.cpp
r80048 r81110 21 21 #include <QColorDialog> 22 22 #include <QComboBox> 23 #include <QDir> 23 24 #include <QFile> 24 25 #include <QGroupBox> … … 28 29 #include <QLineEdit> 29 30 #include <QListWidget> 30 #include <QMenu>31 31 #include <QPainter> 32 32 #include <QPicture> 33 #include <QPushButton>34 33 #include <QSplitter> 35 34 #include <QStatusBar> … … 43 42 /* GUI includes: */ 44 43 #include "UIDesktopWidgetWatchdog.h" 45 #include "QIDialogButtonBox.h"46 #include "QIFileDialog.h"47 44 #include "UIExtraDataManager.h" 48 45 #include "UIIconPool.h" … … 51 48 #include "UISession.h" 52 49 #include "UISoftKeyboard.h" 53 #include "QIToolButton.h"54 50 #include "UICommon.h" 55 51 #ifdef VBOX_WS_MAC 56 52 # include "VBoxUtils-darwin.h" 57 53 #endif 58 59 /* COM includes: */60 #include "CGuest.h"61 #include "CEventSource.h"62 54 63 55 /* Forward declarations: */ … … 154 146 QUuid m_uId; 155 147 QString m_strName; 156 QVector<UISoftKeyboardRow> m_rows;148 QVector<UISoftKeyboardRow> m_rows; 157 149 QMap<int, UISoftKeyboardKey*> m_lockKeys; 158 150 }; 159 151 160 152 /********************************************************************************************************************************* 161 * UI LayoutEditor definition. *153 * UIKeyboardLayoutEditor definition. * 162 154 *********************************************************************************************************************************/ 163 155 164 class UI LayoutEditor : public QIWithRetranslateUI<QWidget>156 class UIKeyboardLayoutEditor : public QIWithRetranslateUI<QWidget> 165 157 { 166 158 Q_OBJECT; … … 174 166 public: 175 167 176 UI LayoutEditor(QWidget *pParent = 0);168 UIKeyboardLayoutEditor(QWidget *pParent = 0); 177 169 void setKey(UISoftKeyboardKey *pKey); 178 170 void setLayoutToEdit(UISoftKeyboardLayout *pLayout); … … 196 188 private: 197 189 198 void prepareObjects();199 void prepareConnections();190 void prepareObjects(); 191 void prepareConnections(); 200 192 QWidget *prepareKeyCaptionEditWidgets(); 201 void resetKeyWidgets();193 void resetKeyWidgets(); 202 194 QGridLayout *m_pEditorLayout; 203 195 QToolButton *m_pGoBackButton; 204 QGroupBox *m_pSelectedKeyGroupBox; 205 QGroupBox *m_pCaptionEditGroupBox; 206 207 QComboBox *m_pPhysicalLayoutCombo; 208 QLabel *m_pTitleLabel; 209 QLabel *m_pPhysicalLayoutLabel; 210 QLabel *m_pLayoutNameLabel; 211 QLabel *m_pLayoutNativeNameLabel; 212 QLabel *m_pScanCodeLabel; 213 QLabel *m_pPositionLabel; 214 QLabel *m_pBaseCaptionLabel; 215 QLabel *m_pShiftCaptionLabel; 216 QLabel *m_pAltGrCaptionLabel; 217 QLabel *m_pShiftAltGrCaptionLabel; 218 219 QLineEdit *m_pLayoutNameEdit; 220 QLineEdit *m_pLayoutNativeNameEdit; 221 QLineEdit *m_pScanCodeEdit; 222 QLineEdit *m_pPositionEdit; 223 QLineEdit *m_pBaseCaptionEdit; 224 QLineEdit *m_pShiftCaptionEdit; 225 QLineEdit *m_pAltGrCaptionEdit; 226 QLineEdit *m_pShiftAltGrCaptionEdit; 196 QGroupBox *m_pSelectedKeyGroupBox; 197 QGroupBox *m_pCaptionEditGroupBox; 198 QComboBox *m_pPhysicalLayoutCombo; 199 QLabel *m_pTitleLabel; 200 QLabel *m_pPhysicalLayoutLabel; 201 QLabel *m_pLayoutNameLabel; 202 QLabel *m_pLayoutNativeNameLabel; 203 QLabel *m_pScanCodeLabel; 204 QLabel *m_pPositionLabel; 205 QLabel *m_pBaseCaptionLabel; 206 QLabel *m_pShiftCaptionLabel; 207 QLabel *m_pAltGrCaptionLabel; 208 QLabel *m_pShiftAltGrCaptionLabel; 209 QLineEdit *m_pLayoutNameEdit; 210 QLineEdit *m_pLayoutNativeNameEdit; 211 QLineEdit *m_pScanCodeEdit; 212 QLineEdit *m_pPositionEdit; 213 QLineEdit *m_pBaseCaptionEdit; 214 QLineEdit *m_pShiftCaptionEdit; 215 QLineEdit *m_pAltGrCaptionEdit; 216 QLineEdit *m_pShiftAltGrCaptionEdit; 227 217 228 218 /** The key which is being currently edited. Might be Null. */ … … 238 228 class UILayoutSelector : public QIWithRetranslateUI<QWidget> 239 229 { 230 240 231 Q_OBJECT; 241 232 … … 285 276 class UISoftKeyboardRow 286 277 { 278 287 279 public: 288 280 … … 382 374 void updateState(bool fPressed); 383 375 384 QRect 376 QRect m_keyGeometry; 385 377 /** Stores the key polygon in local coordinates. */ 386 QPolygon 378 QPolygon m_polygon; 387 379 KeyType m_enmType; 388 380 KeyState m_enmState; 389 381 /** Key width as it is read from the xml file. */ 390 int 382 int m_iWidth; 391 383 /** Key height as it is read from the xml file. */ 392 int 393 int 394 LONG 384 int m_iHeight; 385 int m_iSpaceWidthAfter; 386 LONG m_scanCode; 395 387 QVector<LONG> m_scanCodePrefix; 396 388 … … 404 396 405 397 /** Key's position in the layout. */ 406 int 398 int m_iPosition; 407 399 UISoftKeyboardWidget *m_pParentWidget; 408 409 400 LONG m_iUsageId; 410 401 LONG m_iUsagePage; 411 412 402 bool m_fIsNumPadKey; 413 403 bool m_fIsOSMenuKey; … … 476 466 private: 477 467 468 QMap<int, KeyCaptions> m_keyCapMap; 469 QMap<int, QPicture> m_pictureMap; 470 478 471 /** The UUID of the physical layout used by this layout. */ 479 QUuid m_physicalLayoutUuid; 480 481 QMap<int, KeyCaptions> m_keyCapMap; 482 QMap<int, QPicture> m_pictureMap; 483 472 QUuid m_physicalLayoutUuid; 484 473 /** This is the English name of the layout. */ 485 474 QString m_strName; … … 497 486 class UISoftKeyboardColorTheme 498 487 { 488 499 489 public: 500 490 … … 506 496 507 497 private: 498 508 499 QVector<QColor> m_colors; 509 500 }; … … 517 508 { 518 509 Q_OBJECT; 510 519 511 enum Mode 520 512 { … … 554 546 void deleteCurrentLayout(); 555 547 void toggleEditMode(bool fIsEditMode); 556 /** Is called when the captions in UISoftKeyboardKey is changed and forward this changes to 557 * corresponding UISoftKeyboardLayout */ 558 //void updateKeyCaptionsInLayout(UISoftKeyboardKey *pKey); 548 559 549 void saveCurentLayoutToFile(); 560 550 void copyCurentLayout(); … … 638 628 int m_iRightMargin; 639 629 int m_iBottomMargin; 640 641 Mode m_enmMode; 642 643 bool m_fHideOSMenuKeys; 644 bool m_fHideNumPad; 630 Mode m_enmMode; 631 bool m_fHideOSMenuKeys; 632 bool m_fHideNumPad; 645 633 }; 646 634 … … 711 699 virtual void retranslateUi() /* override */; 712 700 713 private slots:714 715 716 701 private: 717 702 … … 847 832 848 833 /********************************************************************************************************************************* 849 * UI LayoutEditor implementation. *834 * UIKeyboardLayoutEditor implementation. * 850 835 *********************************************************************************************************************************/ 851 836 852 UI LayoutEditor::UILayoutEditor(QWidget *pParent /* = 0 */)837 UIKeyboardLayoutEditor::UIKeyboardLayoutEditor(QWidget *pParent /* = 0 */) 853 838 :QIWithRetranslateUI<QWidget>(pParent) 854 839 , m_pEditorLayout(0) … … 882 867 } 883 868 884 void UI LayoutEditor::setKey(UISoftKeyboardKey *pKey)869 void UIKeyboardLayoutEditor::setKey(UISoftKeyboardKey *pKey) 885 870 { 886 871 if (m_pKey == pKey || !m_pLayout) … … 923 908 } 924 909 925 void UI LayoutEditor::setLayoutToEdit(UISoftKeyboardLayout *pLayout)910 void UIKeyboardLayoutEditor::setLayoutToEdit(UISoftKeyboardLayout *pLayout) 926 911 { 927 912 if (m_pLayout == pLayout) … … 947 932 } 948 933 949 void UI LayoutEditor::setPhysicalLayoutList(const QVector<UISoftKeyboardPhysicalLayout> &physicalLayouts)934 void UIKeyboardLayoutEditor::setPhysicalLayoutList(const QVector<UISoftKeyboardPhysicalLayout> &physicalLayouts) 950 935 { 951 936 if (!m_pPhysicalLayoutCombo) … … 956 941 } 957 942 958 void UI LayoutEditor::retranslateUi()943 void UIKeyboardLayoutEditor::retranslateUi() 959 944 { 960 945 if (m_pTitleLabel) … … 997 982 } 998 983 999 void UI LayoutEditor::sltKeyBaseCaptionChange(const QString &strCaption)984 void UIKeyboardLayoutEditor::sltKeyBaseCaptionChange(const QString &strCaption) 1000 985 { 1001 986 if (!m_pKey || !m_pLayout) … … 1007 992 } 1008 993 1009 void UI LayoutEditor::sltKeyShiftCaptionChange(const QString &strCaption)994 void UIKeyboardLayoutEditor::sltKeyShiftCaptionChange(const QString &strCaption) 1010 995 { 1011 996 if (!m_pKey || !m_pLayout) … … 1017 1002 } 1018 1003 1019 void UI LayoutEditor::sltKeyAltGrCaptionChange(const QString &strCaption)1004 void UIKeyboardLayoutEditor::sltKeyAltGrCaptionChange(const QString &strCaption) 1020 1005 { 1021 1006 if (!m_pKey || !m_pLayout) … … 1027 1012 } 1028 1013 1029 void UI LayoutEditor::sltKeyShiftAltGrCaptionChange(const QString &strCaption)1014 void UIKeyboardLayoutEditor::sltKeyShiftAltGrCaptionChange(const QString &strCaption) 1030 1015 { 1031 1016 if (!m_pKey || !m_pLayout) … … 1037 1022 } 1038 1023 1039 void UI LayoutEditor::sltPhysicalLayoutChanged()1024 void UIKeyboardLayoutEditor::sltPhysicalLayoutChanged() 1040 1025 { 1041 1026 if (!m_pPhysicalLayoutCombo || !m_pLayout) … … 1047 1032 } 1048 1033 1049 void UI LayoutEditor::sltLayoutNameChanged(const QString &strName)1034 void UIKeyboardLayoutEditor::sltLayoutNameChanged(const QString &strName) 1050 1035 { 1051 1036 if (!m_pLayout || m_pLayout->name() == strName) … … 1055 1040 } 1056 1041 1057 void UI LayoutEditor::sltLayoutNativeNameChanged(const QString &strNativeName)1042 void UIKeyboardLayoutEditor::sltLayoutNativeNameChanged(const QString &strNativeName) 1058 1043 { 1059 1044 if (!m_pLayout || m_pLayout->nativeName() == strNativeName) … … 1063 1048 } 1064 1049 1065 void UI LayoutEditor::prepareObjects()1050 void UIKeyboardLayoutEditor::prepareObjects() 1066 1051 { 1067 1052 m_pEditorLayout = new QGridLayout; … … 1074 1059 m_pGoBackButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); 1075 1060 m_pGoBackButton->setIcon(UIIconPool::defaultIcon(UIIconPool::UIDefaultIconType_ArrowBack)); 1076 //m_pGoBackButton->setStyleSheet("QToolButton { border: 0px none black; margin: 0px 0px 0px 0px; } QToolButton::menu-indicator {image: none;}");1077 1061 m_pGoBackButton->setAutoRaise(true); 1078 1062 m_pEditorLayout->addWidget(m_pGoBackButton, 0, 0, 1, 1); 1079 connect(m_pGoBackButton, &QToolButton::clicked, this, &UI LayoutEditor::sigGoBackButton);1063 connect(m_pGoBackButton, &QToolButton::clicked, this, &UIKeyboardLayoutEditor::sigGoBackButton); 1080 1064 m_pTitleLabel = new QLabel; 1081 1065 pTitleLayout->addWidget(m_pTitleLabel); … … 1089 1073 m_pEditorLayout->addWidget(m_pLayoutNativeNameLabel, 2, 0, 1, 1); 1090 1074 m_pEditorLayout->addWidget(m_pLayoutNativeNameEdit, 2, 1, 1, 1); 1091 connect(m_pLayoutNativeNameEdit, &QLineEdit::textChanged, this, &UI LayoutEditor::sltLayoutNativeNameChanged);1075 connect(m_pLayoutNativeNameEdit, &QLineEdit::textChanged, this, &UIKeyboardLayoutEditor::sltLayoutNativeNameChanged); 1092 1076 1093 1077 … … 1097 1081 m_pEditorLayout->addWidget(m_pLayoutNameLabel, 3, 0, 1, 1); 1098 1082 m_pEditorLayout->addWidget(m_pLayoutNameEdit, 3, 1, 1, 1); 1099 connect(m_pLayoutNameEdit, &QLineEdit::textChanged, this, &UI LayoutEditor::sltLayoutNameChanged);1083 connect(m_pLayoutNameEdit, &QLineEdit::textChanged, this, &UIKeyboardLayoutEditor::sltLayoutNameChanged); 1100 1084 1101 1085 … … 1106 1090 m_pEditorLayout->addWidget(m_pPhysicalLayoutCombo, 4, 1, 1, 1); 1107 1091 connect(m_pPhysicalLayoutCombo, static_cast<void(QComboBox::*)(int)>(&QComboBox::currentIndexChanged), 1108 this, &UI LayoutEditor::sltPhysicalLayoutChanged);1092 this, &UIKeyboardLayoutEditor::sltPhysicalLayoutChanged); 1109 1093 1110 1094 m_pSelectedKeyGroupBox = new QGroupBox; … … 1141 1125 } 1142 1126 1143 QWidget *UI LayoutEditor::prepareKeyCaptionEditWidgets()1127 QWidget *UIKeyboardLayoutEditor::prepareKeyCaptionEditWidgets() 1144 1128 { 1145 1129 m_pCaptionEditGroupBox = new QGroupBox; … … 1159 1143 pCaptionEditorLayout->addWidget(m_pBaseCaptionLabel, 0, 0); 1160 1144 pCaptionEditorLayout->addWidget(m_pBaseCaptionEdit, 0, 1); 1161 connect(m_pBaseCaptionEdit, &QLineEdit::textChanged, this, &UI LayoutEditor::sltKeyBaseCaptionChange);1145 connect(m_pBaseCaptionEdit, &QLineEdit::textChanged, this, &UIKeyboardLayoutEditor::sltKeyBaseCaptionChange); 1162 1146 1163 1147 m_pShiftCaptionLabel = new QLabel; … … 1166 1150 pCaptionEditorLayout->addWidget(m_pShiftCaptionLabel, 1, 0); 1167 1151 pCaptionEditorLayout->addWidget(m_pShiftCaptionEdit, 1, 1); 1168 connect(m_pShiftCaptionEdit, &QLineEdit::textChanged, this, &UI LayoutEditor::sltKeyShiftCaptionChange);1152 connect(m_pShiftCaptionEdit, &QLineEdit::textChanged, this, &UIKeyboardLayoutEditor::sltKeyShiftCaptionChange); 1169 1153 1170 1154 m_pAltGrCaptionLabel = new QLabel; … … 1173 1157 pCaptionEditorLayout->addWidget(m_pAltGrCaptionLabel, 2, 0); 1174 1158 pCaptionEditorLayout->addWidget(m_pAltGrCaptionEdit, 2, 1); 1175 connect(m_pAltGrCaptionEdit, &QLineEdit::textChanged, this, &UI LayoutEditor::sltKeyAltGrCaptionChange);1159 connect(m_pAltGrCaptionEdit, &QLineEdit::textChanged, this, &UIKeyboardLayoutEditor::sltKeyAltGrCaptionChange); 1176 1160 1177 1161 m_pShiftAltGrCaptionLabel = new QLabel; … … 1180 1164 pCaptionEditorLayout->addWidget(m_pShiftAltGrCaptionLabel, 3, 0); 1181 1165 pCaptionEditorLayout->addWidget(m_pShiftAltGrCaptionEdit, 3, 1); 1182 connect(m_pShiftAltGrCaptionEdit, &QLineEdit::textChanged, this, &UI LayoutEditor::sltKeyShiftAltGrCaptionChange);1166 connect(m_pShiftAltGrCaptionEdit, &QLineEdit::textChanged, this, &UIKeyboardLayoutEditor::sltKeyShiftAltGrCaptionChange); 1183 1167 1184 1168 … … 1189 1173 } 1190 1174 1191 void UI LayoutEditor::reset()1175 void UIKeyboardLayoutEditor::reset() 1192 1176 { 1193 1177 if (m_pLayoutNameEdit) … … 1196 1180 } 1197 1181 1198 void UI LayoutEditor::resetKeyWidgets()1182 void UIKeyboardLayoutEditor::resetKeyWidgets() 1199 1183 { 1200 1184 if (m_pScanCodeEdit) … … 1321 1305 m_pCloseButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); 1322 1306 m_pCloseButton->setIcon(UIIconPool::defaultIcon(UIIconPool::UIDefaultIconType_DialogCancel)); 1323 //m_pCloseButton->setStyleSheet("QToolButton { border: 0px none black; margin: 0px 0px 0px 0px; } QToolButton::menu-indicator {image: none;}");1324 1307 m_pCloseButton->setAutoRaise(true); 1325 1308 connect(m_pCloseButton, &QToolButton::clicked, this, &UILayoutSelector::sigCloseLayoutList); … … 2123 2106 painter.drawPolygon(key.polygon()); 2124 2107 2125 //m_pCurrentKeyboardLayout->drawText(key.position(), key.keyGeometry(), painter);2126 2108 m_pCurrentKeyboardLayout->drawTextInRect(key.position(), key.keyGeometry(), painter); 2127 2109 … … 3486 3468 , m_pCenterWidget(pCenterWidget) 3487 3469 , m_pMainLayout(0) 3488 , m_pKeyboardWidget(0)3489 3470 , m_strMachineName(strMachineName) 3490 3471 , m_pSplitter(0) 3491 3472 , m_pSidePanelWidget(0) 3473 , m_pKeyboardWidget(0) 3492 3474 , m_pLayoutEditor(0) 3493 3475 , m_pLayoutSelector(0) … … 3719 3701 m_pSidePanelWidget->addWidget(m_pLayoutSelector); 3720 3702 3721 m_pLayoutEditor = new UI LayoutEditor;3703 m_pLayoutEditor = new UIKeyboardLayoutEditor; 3722 3704 if (m_pLayoutEditor) 3723 3705 m_pSidePanelWidget->addWidget(m_pLayoutEditor); … … 3766 3748 connect(m_pLayoutSelector, &UILayoutSelector::sigDeleteLayout, this, &UISoftKeyboard::sltDeleteLayout); 3767 3749 connect(m_pLayoutSelector, &UILayoutSelector::sigCopyLayout, this, &UISoftKeyboard::sltCopyLayout); 3768 connect(m_pLayoutEditor, &UI LayoutEditor::sigGoBackButton, this, &UISoftKeyboard::sltShowLayoutSelector);3769 connect(m_pLayoutEditor, &UI LayoutEditor::sigLayoutEdited, this, &UISoftKeyboard::sltLayoutEdited);3770 connect(m_pLayoutEditor, &UI LayoutEditor::sigKeyCaptionsEdited, this, &UISoftKeyboard::sltKeyCaptionsEdited);3750 connect(m_pLayoutEditor, &UIKeyboardLayoutEditor::sigGoBackButton, this, &UISoftKeyboard::sltShowLayoutSelector); 3751 connect(m_pLayoutEditor, &UIKeyboardLayoutEditor::sigLayoutEdited, this, &UISoftKeyboard::sltLayoutEdited); 3752 connect(m_pLayoutEditor, &UIKeyboardLayoutEditor::sigKeyCaptionsEdited, this, &UISoftKeyboard::sltKeyCaptionsEdited); 3771 3753 3772 3754 connect(m_pStatusBarWidget, &UISoftKeyboardStatusBarWidget::sigShowHideSidePanel, this, &UISoftKeyboard::sltShowHideSidePanel); … … 3812 3794 const QRect desktopRect = gpDesktop->availableGeometry(this); 3813 3795 int iDefaultWidth = desktopRect.width() / 2; 3814 int iDefaultHeight = iDefaultWidth * fKeyboardAspectRatio; //desktopRect.height() * 3 / 4;3796 int iDefaultHeight = iDefaultWidth * fKeyboardAspectRatio; 3815 3797 QRect defaultGeometry(0, 0, iDefaultWidth, iDefaultHeight); 3816 3798 -
trunk/src/VBox/Frontends/VirtualBox/src/softkeyboard/UISoftKeyboard.h
r79781 r81110 23 23 24 24 /* Qt includes: */ 25 #include <Q Widget>25 #include <QMainWindow> 26 26 27 27 /* COM includes: */ 28 #include "COMEnums.h" 29 #include "CGuest.h" 30 #include "CEventListener.h" 28 #include "COMDefs.h" 31 29 32 30 /* GUI includes: */ 33 #include "QIManagerDialog.h"34 31 #include "QIWithRetranslateUI.h" 35 32 36 33 /* Forward declarations: */ 34 class CKeyboard; 37 35 class QHBoxLayout; 38 class QVBoxLayout;39 36 class QToolButton; 40 class UI LayoutEditor;37 class UIKeyboardLayoutEditor; 41 38 class UILayoutSelector; 42 39 class UISession; 43 40 class UISoftKeyboardKey; 44 class UISoftKeyboardLayout;45 41 class UISoftKeyboardSettingsWidget; 46 42 class UISoftKeyboardStatusBarWidget; … … 107 103 QWidget *m_pCenterWidget; 108 104 QHBoxLayout *m_pMainLayout; 109 UISoftKeyboardWidget *m_pKeyboardWidget;110 QS tring m_strMachineName;111 QS plitter *m_pSplitter;112 QStackedWidget *m_pSidePanelWidget;113 UI LayoutEditor*m_pLayoutEditor;114 UILayoutSelector *m_pLayoutSelector;105 QString m_strMachineName; 106 QSplitter *m_pSplitter; 107 QStackedWidget *m_pSidePanelWidget; 108 UISoftKeyboardWidget *m_pKeyboardWidget; 109 UIKeyboardLayoutEditor *m_pLayoutEditor; 110 UILayoutSelector *m_pLayoutSelector; 115 111 116 112 UISoftKeyboardSettingsWidget *m_pSettingsWidget; 117 113 UISoftKeyboardStatusBarWidget *m_pStatusBarWidget; 118 119 114 }; 120 115
Note:
See TracChangeset
for help on using the changeset viewer.