Changeset 79206 in vbox
- Timestamp:
- Jun 18, 2019 10:18:26 AM (6 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/softkeyboard
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/softkeyboard/UISoftKeyboard.cpp
r79201 r79206 141 141 void sltKeyShiftCaptionChange(); 142 142 void sltKeyAltGrCaptionChange(); 143 void slt HandlePhysicalLayoutChanged();143 void sltPhysicalLayoutChanged(); 144 144 145 145 private: … … 156 156 157 157 QComboBox *m_pPhysicalLayoutCombo; 158 QLabel *m_pTitleLabel; 158 159 QLabel *m_pPhysicalLayoutLabel; 159 160 QLabel *m_pLayoutNameLabel; … … 187 188 signals: 188 189 190 void sigSaveLayout(); 191 void sigCopyLayout(); 189 192 void sigLayoutSelectionChanged(const QString &strSelectedLayoutName); 190 193 void sigShowLayoutEditor(); … … 211 214 QToolButton *m_pApplyLayoutButton; 212 215 QToolButton *m_pEditLayoutButton; 216 QToolButton *m_pCopyLayoutButton; 217 QToolButton *m_pSaveLayoutButton; 213 218 QLabel *m_pTitleLabel; 214 219 QToolButton *m_pCloseButton; … … 426 431 * corresponding UISoftKeyboardLayout */ 427 432 void updateKeyCaptionsInLayout(UISoftKeyboardKey *pKey); 433 void addLayout(const UISoftKeyboardLayout &newLayout); 428 434 429 435 protected: … … 437 443 private slots: 438 444 439 void slt HandleContextMenuRequest(const QPoint &point);440 void slt HandleSaveLayout();445 void sltContextMenuRequest(const QPoint &point); 446 void sltSaveLayout(); 441 447 void sltPhysicalLayoutForLayoutChanged(int iIndex); 442 448 … … 583 589 , m_pCaptionEditGroupBox(0) 584 590 , m_pPhysicalLayoutCombo(0) 591 , m_pTitleLabel(0) 585 592 , m_pPhysicalLayoutLabel(0) 586 593 , m_pLayoutNameLabel(0) … … 656 663 void UILayoutEditor::retranslateUi() 657 664 { 665 if (m_pTitleLabel) 666 m_pTitleLabel->setText(UISoftKeyboard::tr("Layout Editor")); 658 667 if (m_pGoBackButton) 659 668 m_pGoBackButton->setToolTip(UISoftKeyboard::tr("Return Back to Layout List")); … … 702 711 } 703 712 704 void UILayoutEditor::slt HandlePhysicalLayoutChanged()713 void UILayoutEditor::sltPhysicalLayoutChanged() 705 714 { 706 715 if (!m_pPhysicalLayoutCombo || !m_pLayout) … … 719 728 setLayout(m_pEditorLayout); 720 729 730 QHBoxLayout *pTitleLayout = new QHBoxLayout; 721 731 m_pGoBackButton = new QToolButton; 722 732 m_pGoBackButton->setIcon(UIIconPool::defaultIcon(UIIconPool::UIDefaultIconType_ArrowBack)); … … 724 734 m_pEditorLayout->addWidget(m_pGoBackButton, 0, 0, 1, 1); 725 735 connect(m_pGoBackButton, &QToolButton::pressed, this, &UILayoutEditor::sigGoBackButton); 736 pTitleLayout->addWidget(m_pGoBackButton); 737 pTitleLayout->addStretch(2); 738 m_pTitleLabel = new QLabel; 739 pTitleLayout->addWidget(m_pTitleLabel); 740 m_pEditorLayout->addLayout(pTitleLayout, 0, 0, 1, 2); 741 726 742 727 743 m_pLayoutNameLabel = new QLabel; 728 744 m_pLayoutNameEdit = new QLineEdit; 729 745 m_pLayoutNameLabel->setBuddy(m_pLayoutNameEdit); 730 m_pEditorLayout->addWidget(m_pLayoutNameLabel, 1, 0, 1, 1);731 m_pEditorLayout->addWidget(m_pLayoutNameEdit, 1, 1, 1, 1);746 m_pEditorLayout->addWidget(m_pLayoutNameLabel, 2, 0, 1, 1); 747 m_pEditorLayout->addWidget(m_pLayoutNameEdit, 2, 1, 1, 1); 732 748 connect(m_pLayoutNameEdit, &QLineEdit::editingFinished, this, &UILayoutEditor::sigLayoutEdited); 733 749 … … 736 752 m_pPhysicalLayoutCombo = new QComboBox; 737 753 m_pPhysicalLayoutLabel->setBuddy(m_pPhysicalLayoutCombo); 738 m_pEditorLayout->addWidget(m_pPhysicalLayoutLabel, 2, 0, 1, 1);739 m_pEditorLayout->addWidget(m_pPhysicalLayoutCombo, 2, 1, 1, 1);754 m_pEditorLayout->addWidget(m_pPhysicalLayoutLabel, 3, 0, 1, 1); 755 m_pEditorLayout->addWidget(m_pPhysicalLayoutCombo, 3, 1, 1, 1); 740 756 connect(m_pPhysicalLayoutCombo, static_cast<void(QComboBox::*)(int)>(&QComboBox::currentIndexChanged), 741 this, &UILayoutEditor::slt HandlePhysicalLayoutChanged);757 this, &UILayoutEditor::sltPhysicalLayoutChanged); 742 758 743 759 m_pSelectedKeyGroupBox = new QGroupBox; 744 760 m_pSelectedKeyGroupBox->setEnabled(false); 745 761 746 m_pEditorLayout->addWidget(m_pSelectedKeyGroupBox, 3, 0, 1, 2);762 m_pEditorLayout->addWidget(m_pSelectedKeyGroupBox, 4, 0, 1, 2); 747 763 QGridLayout *pSelectedKeyLayout = new QGridLayout(m_pSelectedKeyGroupBox); 748 764 pSelectedKeyLayout->setSpacing(0); … … 839 855 , m_pApplyLayoutButton(0) 840 856 , m_pEditLayoutButton(0) 857 , m_pCopyLayoutButton(0) 858 , m_pSaveLayoutButton(0) 841 859 , m_pTitleLabel(0) 842 860 , m_pCloseButton(0) … … 878 896 if (m_pEditLayoutButton) 879 897 m_pEditLayoutButton->setToolTip(UISoftKeyboard::tr("Edit the selected layout")); 898 if (m_pCopyLayoutButton) 899 m_pCopyLayoutButton->setToolTip(UISoftKeyboard::tr("Copy the selected layout")); 900 if (m_pSaveLayoutButton) 901 m_pSaveLayoutButton->setToolTip(UISoftKeyboard::tr("Save the selected layout into File")); 880 902 if (m_pTitleLabel) 881 903 m_pTitleLabel->setText(UISoftKeyboard::tr("Layout List")); … … 914 936 pButtonsLayout->addWidget(m_pEditLayoutButton); 915 937 connect(m_pEditLayoutButton, &QToolButton::pressed, this, &UILayoutSelector::sigShowLayoutEditor); 938 939 m_pCopyLayoutButton = new QToolButton; 940 m_pCopyLayoutButton->setIcon(UIIconPool::iconSet(":/vm_clone_16px.png")); 941 pButtonsLayout->addWidget(m_pCopyLayoutButton); 942 connect(m_pCopyLayoutButton, &QToolButton::pressed, this, &UILayoutSelector::sigCopyLayout); 943 944 m_pSaveLayoutButton = new QToolButton; 945 m_pSaveLayoutButton->setIcon(UIIconPool::iconSet(":/vm_save_state_16px.png")); 946 pButtonsLayout->addWidget(m_pSaveLayoutButton); 947 connect(m_pSaveLayoutButton, &QToolButton::pressed, this, &UILayoutSelector::sigSaveLayout); 948 916 949 917 950 pButtonsLayout->addStretch(2); … … 1419 1452 } 1420 1453 1421 void UISoftKeyboardWidget::slt HandleContextMenuRequest(const QPoint &point)1454 void UISoftKeyboardWidget::sltContextMenuRequest(const QPoint &point) 1422 1455 { 1423 1456 showContextMenu(mapToGlobal(point)); 1424 1457 } 1425 1458 1426 // void UISoftKeyboardWidget::slt HandleLoadLayout(QAction *pSenderAction)1459 // void UISoftKeyboardWidget::sltLoadLayout(QAction *pSenderAction) 1427 1460 // { 1428 1461 // if (!pSenderAction) … … 1460 1493 // } 1461 1494 1462 void UISoftKeyboardWidget::slt HandleSaveLayout()1495 void UISoftKeyboardWidget::sltSaveLayout() 1463 1496 { 1464 1497 QString strFileName = QIFileDialog::getSaveFileName(vboxGlobal().documentsPath(), UISoftKeyboard::tr("XML files (*.xml)"), … … 1517 1550 } 1518 1551 1519 // void UISoftKeyboardWidget::slt HandleLoadKeyCapFile()1552 // void UISoftKeyboardWidget::sltLoadKeyCapFile() 1520 1553 // { 1521 1554 // const QString strFileName = QIFileDialog::getOpenFileName(QString(), UISoftKeyboard::tr("XML files (*.xml)"), this, … … 1561 1594 newCaptions.m_strAltGr = pKey->altGrCaption(); 1562 1595 m_pCurrentKeyboardLayout->updateKeyCaptions(pKey->position(), newCaptions); 1596 } 1597 1598 void UISoftKeyboardWidget::addLayout(const UISoftKeyboardLayout &newLayout) 1599 { 1600 m_layouts.append(newLayout); 1563 1601 } 1564 1602 … … 1770 1808 return false; 1771 1809 1772 1773 UISoftKeyboardPhysicalLayout *pPhysicalLayout = 0; 1774 /* Search for the physical layout among the one stored in m_pPhysicalLayout: */ 1775 for (int i = 0; i < m_physicalLayouts.size(); ++i) 1776 { 1777 if (keyboardLayoutReader.physicalLayoutUUID() == m_physicalLayouts[i].m_uId) 1778 pPhysicalLayout = &(m_physicalLayouts[i]); 1779 } 1780 1810 UISoftKeyboardPhysicalLayout *pPhysicalLayout = findPhysicalLayout(keyboardLayoutReader.physicalLayoutUUID()); 1781 1811 /* If no pyhsical layout with the UUID the keyboard layout refers is found then cancel loading the keyboard layout: */ 1782 1812 if (!pPhysicalLayout) … … 1840 1870 setContextMenuPolicy(Qt::CustomContextMenu); 1841 1871 connect(this, &UISoftKeyboardWidget::customContextMenuRequested, 1842 this, &UISoftKeyboardWidget::slt HandleContextMenuRequest);1872 this, &UISoftKeyboardWidget::sltContextMenuRequest); 1843 1873 } 1844 1874 … … 2271 2301 { 2272 2302 m_pKeyboardWidget->loadLayouts(); 2273 /* Update the selector widget: */ 2274 if (m_pLayoutSelector) 2275 { 2276 m_pLayoutSelector->setLayoutList(m_pKeyboardWidget->layoutNameList()); 2277 m_pLayoutSelector->setCurrentLayout(m_pKeyboardWidget->currentLayout() ? m_pKeyboardWidget->currentLayout()->name() : QString()); 2278 } 2303 updateLayoutSelector(); 2279 2304 if (m_pLayoutEditor) 2280 2305 m_pLayoutEditor->setPhysicalLayoutList(m_pKeyboardWidget->physicalLayouts()); … … 2315 2340 } 2316 2341 2317 void UISoftKeyboard::slt HandleKeyboardLedsChange()2342 void UISoftKeyboard::sltKeyboardLedsChange() 2318 2343 { 2319 2344 // bool fNumLockLed = m_pSession->isNumLock(); … … 2322 2347 } 2323 2348 2324 void UISoftKeyboard::slt HandlePutKeyboardSequence(QVector<LONG> sequence)2349 void UISoftKeyboard::sltPutKeyboardSequence(QVector<LONG> sequence) 2325 2350 { 2326 2351 keyboard().PutScancodes(sequence); 2327 2352 } 2328 2353 2329 void UISoftKeyboard::slt HandleStatusBarContextMenuRequest(const QPoint &point)2354 void UISoftKeyboard::sltStatusBarContextMenuRequest(const QPoint &point) 2330 2355 { 2331 2356 if (m_pKeyboardWidget) … … 2380 2405 return; 2381 2406 m_pKeyboardWidget->update(); 2382 if (m_pLayoutSelector) 2383 { 2384 m_pLayoutSelector->setLayoutList(m_pKeyboardWidget->layoutNameList()); 2385 m_pLayoutSelector->setCurrentLayout(m_pKeyboardWidget->currentLayout() ? m_pKeyboardWidget->currentLayout()->name() : QString()); 2386 } 2407 updateLayoutSelector(); 2387 2408 } 2388 2409 … … 2401 2422 return; 2402 2423 m_pSidePanelWidget->setVisible(!m_pSidePanelWidget->isVisible()); 2424 } 2425 2426 void UISoftKeyboard::sltCopyLayout() 2427 { 2428 if (!m_pKeyboardWidget || !m_pKeyboardWidget->currentLayout()) 2429 return; 2430 UISoftKeyboardLayout newLayout(*(m_pKeyboardWidget->currentLayout())); 2431 QString strNewName = QString("%1-%2").arg(newLayout.name()).arg(tr("Copy")); 2432 newLayout.setName(strNewName); 2433 m_pKeyboardWidget->addLayout(newLayout); 2434 updateLayoutSelector(); 2435 } 2436 2437 void UISoftKeyboard::sltSaveLayout() 2438 { 2403 2439 } 2404 2440 … … 2443 2479 void UISoftKeyboard::prepareConnections() 2444 2480 { 2445 connect(m_pSession, &UISession::sigKeyboardLedsChange, this, &UISoftKeyboard::slt HandleKeyboardLedsChange);2446 connect(m_pKeyboardWidget, &UISoftKeyboardWidget::sigPutKeyboardSequence, this, &UISoftKeyboard::slt HandlePutKeyboardSequence);2481 connect(m_pSession, &UISession::sigKeyboardLedsChange, this, &UISoftKeyboard::sltKeyboardLedsChange); 2482 connect(m_pKeyboardWidget, &UISoftKeyboardWidget::sigPutKeyboardSequence, this, &UISoftKeyboard::sltPutKeyboardSequence); 2447 2483 connect(m_pKeyboardWidget, &UISoftKeyboardWidget::sigCurrentLayoutChange, this, &UISoftKeyboard::sltCurentLayoutChanged); 2448 2484 connect(m_pKeyboardWidget, &UISoftKeyboardWidget::sigKeyToEdit, this, &UISoftKeyboard::sltKeyToEditChanged); … … 2451 2487 connect(m_pLayoutSelector, &UILayoutSelector::sigShowLayoutEditor, this, &UISoftKeyboard::sltShowLayoutEditor); 2452 2488 connect(m_pLayoutSelector, &UILayoutSelector::sigCloseLayoutList, this, &UISoftKeyboard::sltShowHideSidePanel); 2489 connect(m_pLayoutSelector, &UILayoutSelector::sigSaveLayout, this, &UISoftKeyboard::sltSaveLayout); 2490 connect(m_pLayoutSelector, &UILayoutSelector::sigCopyLayout, this, &UISoftKeyboard::sltCopyLayout); 2453 2491 connect(m_pLayoutEditor, &UILayoutEditor::sigGoBackButton, this, &UISoftKeyboard::sltShowLayoutSelector); 2454 2492 connect(m_pLayoutEditor, &UILayoutEditor::sigLayoutEdited, this, &UISoftKeyboard::sltLayoutEdited); … … 2480 2518 } 2481 2519 2520 void UISoftKeyboard::updateLayoutSelector() 2521 { 2522 if (!m_pKeyboardWidget || !m_pLayoutSelector) 2523 return; 2524 m_pLayoutSelector->setLayoutList(m_pKeyboardWidget->layoutNameList()); 2525 m_pLayoutSelector->setCurrentLayout(m_pKeyboardWidget->currentLayout() ? m_pKeyboardWidget->currentLayout()->name() : QString()); 2526 } 2527 2482 2528 CKeyboard& UISoftKeyboard::keyboard() const 2483 2529 { -
trunk/src/VBox/Frontends/VirtualBox/src/softkeyboard/UISoftKeyboard.h
r79201 r79206 65 65 private slots: 66 66 67 void slt HandleKeyboardLedsChange();68 void slt HandlePutKeyboardSequence(QVector<LONG> sequence);69 void slt HandleStatusBarContextMenuRequest(const QPoint &point);67 void sltKeyboardLedsChange(); 68 void sltPutKeyboardSequence(QVector<LONG> sequence); 69 void sltStatusBarContextMenuRequest(const QPoint &point); 70 70 /** Handles the signal we get from the layout selector widget. 71 71 * Selection changed is forwarded to the keyboard widget. */ … … 80 80 void sltKeyCaptionsEdited(UISoftKeyboardKey* pKey); 81 81 void sltShowHideSidePanel(); 82 void sltCopyLayout(); 83 void sltSaveLayout(); 82 84 83 85 private: … … 88 90 void loadSettings(); 89 91 void updateStatusBarMessage(const QString &strLayoutName); 92 void updateLayoutSelector(); 90 93 CKeyboard& keyboard() const; 91 94
Note:
See TracChangeset
for help on using the changeset viewer.