Changeset 79357 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- Jun 26, 2019 12:12:54 PM (6 years ago)
- svn:sync-xref-src-repo-rev:
- 131589
- Location:
- trunk/src/VBox/Frontends/VirtualBox
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/softkeyboard/UISoftKeyboard.cpp
r79356 r79357 166 166 void sltPhysicalLayoutChanged(); 167 167 void sltLayoutNameChanged(const QString &strCaption); 168 void sltLayoutNativeNameChanged(const QString &strCaption); 168 169 169 170 private: … … 183 184 QLabel *m_pPhysicalLayoutLabel; 184 185 QLabel *m_pLayoutNameLabel; 186 QLabel *m_pLayoutNativeNameLabel; 185 187 QLabel *m_pScanCodeLabel; 186 188 QLabel *m_pPositionLabel; … … 191 193 192 194 QLineEdit *m_pLayoutNameEdit; 195 QLineEdit *m_pLayoutNativeNameEdit; 193 196 QLineEdit *m_pScanCodeEdit; 194 197 QLineEdit *m_pPositionEdit; … … 410 413 const QString &name() const; 411 414 415 void setNativeName(const QString &strLocaName); 416 const QString &nativeName() const; 417 412 418 void setSourceFilePath(const QString& strSourceFilePath); 413 419 const QString& sourceFilePath() const; … … 437 443 * Map key is the key position and the value is the captions of the key. */ 438 444 QMap<int, KeyCaptions> m_keyCapMap; 439 445 /** This is the English name of the layout. */ 440 446 QString m_strName; 447 QString m_strNativeName; 441 448 QString m_strSourceFilePath; 442 449 bool m_fEditable; … … 602 609 const QUuid &physicalLayoutUUID() const; 603 610 const QString &name() const; 611 const QString &nativeName() const; 604 612 const QMap<int, KeyCaptions> &keyCapMap() const; 605 613 … … 612 620 QUuid m_physicalLayoutUid; 613 621 QString m_strName; 622 QString m_strNativeName; 614 623 }; 615 624 … … 698 707 , m_pPhysicalLayoutLabel(0) 699 708 , m_pLayoutNameLabel(0) 709 , m_pLayoutNativeNameLabel(0) 700 710 , m_pScanCodeLabel(0) 701 711 , m_pPositionLabel(0) … … 705 715 , m_pShiftAltGrCaptionLabel(0) 706 716 , m_pLayoutNameEdit(0) 717 , m_pLayoutNativeNameEdit(0) 707 718 , m_pScanCodeEdit(0) 708 719 , m_pPositionEdit(0) … … 769 780 m_pLayoutNameEdit->setText(m_pLayout ? m_pLayout->name() : QString()); 770 781 782 if (m_pLayoutNativeNameEdit) 783 m_pLayoutNativeNameEdit->setText(m_pLayout ? m_pLayout->nativeName() : QString()); 784 771 785 if (m_pPhysicalLayoutCombo && m_pLayout) 772 786 { … … 799 813 m_pPhysicalLayoutLabel->setText(UISoftKeyboard::tr("Physical Layout")); 800 814 if (m_pLayoutNameLabel) 801 m_pLayoutNameLabel->setText(UISoftKeyboard::tr("Layout Name")); 815 m_pLayoutNameLabel->setText(UISoftKeyboard::tr("English Name")); 816 if (m_pLayoutNativeNameLabel) 817 m_pLayoutNativeNameLabel->setText(UISoftKeyboard::tr("Native Language Name")); 802 818 if (m_pScanCodeLabel) 803 819 m_pScanCodeLabel->setText(UISoftKeyboard::tr("Scan Code")); … … 868 884 } 869 885 886 void UILayoutEditor::sltLayoutNativeNameChanged(const QString &strNativeName) 887 { 888 if (!m_pLayout || m_pLayout->nativeName() == strNativeName) 889 return; 890 m_pLayout->setNativeName(strNativeName); 891 emit sigLayoutEdited(); 892 } 893 870 894 void UILayoutEditor::prepareObjects() 871 895 { … … 889 913 m_pEditorLayout->addLayout(pTitleLayout, 0, 0, 1, 2); 890 914 915 m_pLayoutNativeNameLabel = new QLabel; 916 m_pLayoutNativeNameEdit = new QLineEdit; 917 m_pLayoutNativeNameLabel->setBuddy(m_pLayoutNativeNameEdit); 918 m_pEditorLayout->addWidget(m_pLayoutNativeNameLabel, 2, 0, 1, 1); 919 m_pEditorLayout->addWidget(m_pLayoutNativeNameEdit, 2, 1, 1, 1); 920 connect(m_pLayoutNativeNameEdit, &QLineEdit::textChanged, this, &UILayoutEditor::sltLayoutNativeNameChanged); 921 891 922 892 923 m_pLayoutNameLabel = new QLabel; 893 924 m_pLayoutNameEdit = new QLineEdit; 894 925 m_pLayoutNameLabel->setBuddy(m_pLayoutNameEdit); 895 m_pEditorLayout->addWidget(m_pLayoutNameLabel, 2, 0, 1, 1);896 m_pEditorLayout->addWidget(m_pLayoutNameEdit, 2, 1, 1, 1);926 m_pEditorLayout->addWidget(m_pLayoutNameLabel, 3, 0, 1, 1); 927 m_pEditorLayout->addWidget(m_pLayoutNameEdit, 3, 1, 1, 1); 897 928 connect(m_pLayoutNameEdit, &QLineEdit::textChanged, this, &UILayoutEditor::sltLayoutNameChanged); 898 929 … … 901 932 m_pPhysicalLayoutCombo = new QComboBox; 902 933 m_pPhysicalLayoutLabel->setBuddy(m_pPhysicalLayoutCombo); 903 m_pEditorLayout->addWidget(m_pPhysicalLayoutLabel, 3, 0, 1, 1);904 m_pEditorLayout->addWidget(m_pPhysicalLayoutCombo, 3, 1, 1, 1);934 m_pEditorLayout->addWidget(m_pPhysicalLayoutLabel, 4, 0, 1, 1); 935 m_pEditorLayout->addWidget(m_pPhysicalLayoutCombo, 4, 1, 1, 1); 905 936 connect(m_pPhysicalLayoutCombo, static_cast<void(QComboBox::*)(int)>(&QComboBox::currentIndexChanged), 906 937 this, &UILayoutEditor::sltPhysicalLayoutChanged); … … 909 940 m_pSelectedKeyGroupBox->setEnabled(false); 910 941 911 m_pEditorLayout->addWidget(m_pSelectedKeyGroupBox, 4, 0, 1, 2);942 m_pEditorLayout->addWidget(m_pSelectedKeyGroupBox, 5, 0, 1, 2); 912 943 QGridLayout *pSelectedKeyLayout = new QGridLayout(m_pSelectedKeyGroupBox); 913 944 pSelectedKeyLayout->setSpacing(0); … … 1564 1595 } 1565 1596 1597 void UISoftKeyboardLayout::setNativeName(const QString &strNativeName) 1598 { 1599 m_strNativeName = strNativeName; 1600 } 1601 1602 const QString &UISoftKeyboardLayout::nativeName() const 1603 { 1604 return m_strNativeName; 1605 } 1606 1566 1607 void UISoftKeyboardLayout::setEditable(bool fEditable) 1567 1608 { … … 1602 1643 { 1603 1644 if (m_strName != otherLayout.m_strName) 1645 return false; 1646 if (m_strNativeName != otherLayout.m_strNativeName) 1604 1647 return false; 1605 1648 if (m_physicalLayoutUuid != otherLayout.m_physicalLayoutUuid) … … 1839 1882 xmlWriter.writeStartElement("layout"); 1840 1883 xmlWriter.writeTextElement("name", m_pCurrentKeyboardLayout->name()); 1884 xmlWriter.writeTextElement("nativename", m_pCurrentKeyboardLayout->nativeName()); 1841 1885 xmlWriter.writeTextElement("physicallayoutid", pPhysicalLayout->m_uId.toString()); 1842 1886 … … 1870 1914 { 1871 1915 UISoftKeyboardLayout newLayout(*(m_pCurrentKeyboardLayout)); 1872 QString strNewName = QString("%1-%2").arg(newLayout.name()).arg(tr("Copy")); 1916 QString strNewName; 1917 if (!newLayout.name().isEmpty()) 1918 strNewName= QString("%1-%2").arg(newLayout.name()).arg(tr("Copy")); 1919 QString strNewNativeName; 1920 if (!newLayout.nativeName().isEmpty()) 1921 strNewNativeName= QString("%1-%2").arg(newLayout.nativeName()).arg(tr("Copy")); 1873 1922 newLayout.setName(strNewName); 1923 newLayout.setNativeName(strNewNativeName); 1874 1924 newLayout.setEditable(true); 1875 1925 newLayout.setIsFromResources(false); … … 2247 2297 newLayout.setPhysicalLayoutUuid(pPhysicalLayout->m_uId); 2248 2298 newLayout.setName(keyboardLayoutReader.name()); 2299 newLayout.setNativeName(keyboardLayoutReader.nativeName()); 2249 2300 newLayout.setSourceFilePath(strLayoutFileName); 2250 2301 newLayout.setKeyCapMap(keyboardLayoutReader.keyCapMap()); … … 2653 2704 else if (m_xmlReader.name() == "name") 2654 2705 m_strName = m_xmlReader.readElementText(); 2706 else if (m_xmlReader.name() == "nativename") 2707 m_strNativeName = m_xmlReader.readElementText(); 2655 2708 else if (m_xmlReader.name() == "physicallayoutid") 2656 2709 m_physicalLayoutUid = QUuid(m_xmlReader.readElementText()); … … 2669 2722 { 2670 2723 return m_strName; 2724 } 2725 2726 const QString &UIKeyboardLayoutReader::nativeName() const 2727 { 2728 return m_strNativeName; 2671 2729 } 2672 2730 -
trunk/src/VBox/Frontends/VirtualBox/xml/german.xml
r79281 r79357 2 2 <layout> 3 3 <name>German</name> 4 <nativename>Deutsch</nativename> 4 5 <physicallayoutid>{d41a0398-92a0-4ba4-beba-3d91a5dd0e50}</physicallayoutid> 5 6 <key>
Note:
See TracChangeset
for help on using the changeset viewer.