VirtualBox

Ignore:
Timestamp:
Jun 26, 2019 12:12:54 PM (6 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
131589
Message:

FE/Qt: bugref:6143. Adding a native langage name to layouts

Location:
trunk/src/VBox/Frontends/VirtualBox
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/softkeyboard/UISoftKeyboard.cpp

    r79356 r79357  
    166166    void sltPhysicalLayoutChanged();
    167167    void sltLayoutNameChanged(const QString &strCaption);
     168    void sltLayoutNativeNameChanged(const QString &strCaption);
    168169
    169170private:
     
    183184    QLabel *m_pPhysicalLayoutLabel;
    184185    QLabel *m_pLayoutNameLabel;
     186    QLabel *m_pLayoutNativeNameLabel;
    185187    QLabel *m_pScanCodeLabel;
    186188    QLabel *m_pPositionLabel;
     
    191193
    192194    QLineEdit *m_pLayoutNameEdit;
     195    QLineEdit *m_pLayoutNativeNameEdit;
    193196    QLineEdit *m_pScanCodeEdit;
    194197    QLineEdit *m_pPositionEdit;
     
    410413    const QString &name() const;
    411414
     415    void setNativeName(const QString &strLocaName);
     416    const QString &nativeName() const;
     417
    412418    void setSourceFilePath(const QString& strSourceFilePath);
    413419    const QString& sourceFilePath() const;
     
    437443      * Map key is the key position and the value is the captions of the key. */
    438444    QMap<int, KeyCaptions> m_keyCapMap;
    439 
     445    /** This is the English name of the layout. */
    440446    QString m_strName;
     447    QString m_strNativeName;
    441448    QString m_strSourceFilePath;
    442449    bool    m_fEditable;
     
    602609    const QUuid &physicalLayoutUUID() const;
    603610    const QString &name() const;
     611    const QString &nativeName() const;
    604612    const QMap<int, KeyCaptions> &keyCapMap() const;
    605613
     
    612620    QUuid m_physicalLayoutUid;
    613621    QString m_strName;
     622    QString m_strNativeName;
    614623};
    615624
     
    698707    , m_pPhysicalLayoutLabel(0)
    699708    , m_pLayoutNameLabel(0)
     709    , m_pLayoutNativeNameLabel(0)
    700710    , m_pScanCodeLabel(0)
    701711    , m_pPositionLabel(0)
     
    705715    , m_pShiftAltGrCaptionLabel(0)
    706716    , m_pLayoutNameEdit(0)
     717    , m_pLayoutNativeNameEdit(0)
    707718    , m_pScanCodeEdit(0)
    708719    , m_pPositionEdit(0)
     
    769780        m_pLayoutNameEdit->setText(m_pLayout ? m_pLayout->name() : QString());
    770781
     782    if (m_pLayoutNativeNameEdit)
     783        m_pLayoutNativeNameEdit->setText(m_pLayout ? m_pLayout->nativeName() : QString());
     784
    771785    if (m_pPhysicalLayoutCombo && m_pLayout)
    772786    {
     
    799813        m_pPhysicalLayoutLabel->setText(UISoftKeyboard::tr("Physical Layout"));
    800814    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"));
    802818    if (m_pScanCodeLabel)
    803819        m_pScanCodeLabel->setText(UISoftKeyboard::tr("Scan Code"));
     
    868884}
    869885
     886void 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
    870894void UILayoutEditor::prepareObjects()
    871895{
     
    889913    m_pEditorLayout->addLayout(pTitleLayout, 0, 0, 1, 2);
    890914
     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
    891922
    892923    m_pLayoutNameLabel = new QLabel;
    893924    m_pLayoutNameEdit = new QLineEdit;
    894925    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);
    897928    connect(m_pLayoutNameEdit, &QLineEdit::textChanged, this, &UILayoutEditor::sltLayoutNameChanged);
    898929
     
    901932    m_pPhysicalLayoutCombo = new QComboBox;
    902933    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);
    905936    connect(m_pPhysicalLayoutCombo, static_cast<void(QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
    906937            this, &UILayoutEditor::sltPhysicalLayoutChanged);
     
    909940    m_pSelectedKeyGroupBox->setEnabled(false);
    910941
    911     m_pEditorLayout->addWidget(m_pSelectedKeyGroupBox, 4, 0, 1, 2);
     942    m_pEditorLayout->addWidget(m_pSelectedKeyGroupBox, 5, 0, 1, 2);
    912943    QGridLayout *pSelectedKeyLayout = new QGridLayout(m_pSelectedKeyGroupBox);
    913944    pSelectedKeyLayout->setSpacing(0);
     
    15641595}
    15651596
     1597void UISoftKeyboardLayout::setNativeName(const QString &strNativeName)
     1598{
     1599    m_strNativeName = strNativeName;
     1600}
     1601
     1602const QString &UISoftKeyboardLayout::nativeName() const
     1603{
     1604    return m_strNativeName;
     1605}
     1606
    15661607void UISoftKeyboardLayout::setEditable(bool fEditable)
    15671608{
     
    16021643{
    16031644    if (m_strName != otherLayout.m_strName)
     1645        return false;
     1646    if (m_strNativeName != otherLayout.m_strNativeName)
    16041647        return false;
    16051648    if (m_physicalLayoutUuid != otherLayout.m_physicalLayoutUuid)
     
    18391882    xmlWriter.writeStartElement("layout");
    18401883    xmlWriter.writeTextElement("name", m_pCurrentKeyboardLayout->name());
     1884    xmlWriter.writeTextElement("nativename", m_pCurrentKeyboardLayout->nativeName());
    18411885    xmlWriter.writeTextElement("physicallayoutid", pPhysicalLayout->m_uId.toString());
    18421886
     
    18701914{
    18711915    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"));
    18731922    newLayout.setName(strNewName);
     1923    newLayout.setNativeName(strNewNativeName);
    18741924    newLayout.setEditable(true);
    18751925    newLayout.setIsFromResources(false);
     
    22472297    newLayout.setPhysicalLayoutUuid(pPhysicalLayout->m_uId);
    22482298    newLayout.setName(keyboardLayoutReader.name());
     2299    newLayout.setNativeName(keyboardLayoutReader.nativeName());
    22492300    newLayout.setSourceFilePath(strLayoutFileName);
    22502301    newLayout.setKeyCapMap(keyboardLayoutReader.keyCapMap());
     
    26532704        else if (m_xmlReader.name() == "name")
    26542705            m_strName = m_xmlReader.readElementText();
     2706        else if (m_xmlReader.name() == "nativename")
     2707            m_strNativeName = m_xmlReader.readElementText();
    26552708        else if (m_xmlReader.name() == "physicallayoutid")
    26562709            m_physicalLayoutUid = QUuid(m_xmlReader.readElementText());
     
    26692722{
    26702723    return m_strName;
     2724}
     2725
     2726const QString &UIKeyboardLayoutReader::nativeName() const
     2727{
     2728    return m_strNativeName;
    26712729}
    26722730
  • trunk/src/VBox/Frontends/VirtualBox/xml/german.xml

    r79281 r79357  
    22<layout>
    33    <name>German</name>
     4    <nativename>Deutsch</nativename>
    45    <physicallayoutid>{d41a0398-92a0-4ba4-beba-3d91a5dd0e50}</physicallayoutid>
    56    <key>
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette