Changeset 79126 in vbox
- Timestamp:
- Jun 13, 2019 10:55:00 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/softkeyboard/UISoftKeyboard.cpp
r79121 r79126 285 285 286 286 public: 287 287 UISoftKeyboardLayout() 288 :m_pPhysicalLayout(0){} 288 289 /** The physical layout used by this layout. */ 289 290 UISoftKeyboardPhysicalLayout *m_pPhysicalLayout; … … 385 386 int m_iRightMargin; 386 387 int m_iBottomMargin; 387 bool m_fInKeyCapEditMode;388 388 389 389 QMenu *m_pContextMenu; … … 434 434 }; 435 435 436 bool parseFile(const QString &strFileName , UISoftKeyboardLayout &layout, QUuid &physicalLayoutUid);436 bool parseFile(const QString &strFileName); 437 437 438 438 private: 439 439 440 441 void parseKey(QMap<int, KeyCaptions> &keyCapMap); 440 void parseKey(); 442 441 QXmlStreamReader m_xmlReader; 442 /** Map key is the key position and the value is the captions of the key. */ 443 QMap<int, KeyCaptions> m_keyCapMap; 444 QUuid m_physicalLayoutUid; 445 QString m_strName; 443 446 }; 444 447 … … 980 983 , m_iRightMargin(10) 981 984 , m_iBottomMargin(10) 982 , m_fInKeyCapEditMode(false)983 985 , m_pContextMenu(0) 984 986 , m_pShowPositionsAction(0) … … 1517 1519 return false; 1518 1520 1519 m_layouts.append(UISoftKeyboardLayout());1520 UISoftKeyboardLayout &newLayout = m_layouts.back();1521 1521 UIKeyboardLayoutReader keyboardLayoutReader; 1522 QUuid physicalLayoutUid; 1523 if (!keyboardLayoutReader.parseFile(strLayoutName, newLayout, physicalLayoutUid)) 1524 { 1525 m_layouts.removeLast(); 1522 1523 if (!keyboardLayoutReader.parseFile(strLayoutName)) 1526 1524 return false; 1527 } 1525 1526 // m_layouts.append(UISoftKeyboardLayout()); 1527 // UISoftKeyboardLayout &newLayout = m_layouts.back(); 1528 1529 1530 /* Search for the physical layout among the one stored in m_pPhysicalLayout: */ 1531 // for (int i = 0; i < m_physicalLayouts.size(); ++i) 1532 // { 1533 // if (physicalLayoutUid == m_physicalLayouts[i].m_uId) 1534 // newLayout.m_pPhysicalLayout = &(m_physicalLayouts[i]); 1535 // } 1536 1537 // /* If no pyhsical layout with the UUID the keyboard layout refers is found then cancel loading the keyboard layout: */ 1538 // if (!newLayout.m_pPhysicalLayout) 1539 // { 1540 // m_layouts.removeLast(); 1541 // return false; 1542 // } 1528 1543 return true; 1529 // //const QMap<int, QString> &keyCapMap = keyCapReader.keyCapMap();1530 1531 // //for (int i = 0; i < m_rows.size(); ++i)1532 // {1533 // //QVector<UISoftKeyboardKey> &keys = m_rows[i].keys();1534 // // for (int j = 0; j < keys.size(); ++j)1535 // // {1536 // // UISoftKeyboardKey &key = keys[j];1537 // // if (keyCapMap.contains(key.position()))1538 // // key.setKeyCap(keyCapMap[key.position()]);1539 // // }1540 // }1541 // emit sigKeyCapChange(strFileName);1542 1544 1543 1545 } … … 1856 1858 *********************************************************************************************************************************/ 1857 1859 1858 bool UIKeyboardLayoutReader::parseFile(const QString &strFileName , UISoftKeyboardLayout &layout, QUuid &physicalLayoutUid)1860 bool UIKeyboardLayoutReader::parseFile(const QString &strFileName) 1859 1861 { 1860 1862 QFile xmlFile(strFileName); … … 1870 1872 return false; 1871 1873 1872 /** Map key is the key position and the value is the captions of the key. */1873 QMap<int, KeyCaptions> keyCapMap;1874 1875 1874 while (m_xmlReader.readNextStartElement()) 1876 1875 { 1877 1876 if (m_xmlReader.name() == "key") 1878 parseKey( keyCapMap);1877 parseKey(); 1879 1878 else if (m_xmlReader.name() == "name") 1880 layout.m_strName = m_xmlReader.readElementText();1879 m_strName = m_xmlReader.readElementText(); 1881 1880 else if (m_xmlReader.name() == "physicallayoutid") 1882 physicalLayoutUid = QUuid(m_xmlReader.readElementText());1881 m_physicalLayoutUid = QUuid(m_xmlReader.readElementText()); 1883 1882 else 1884 1883 m_xmlReader.skipCurrentElement(); … … 1887 1886 } 1888 1887 1889 void UIKeyboardLayoutReader::parseKey( QMap<int, KeyCaptions> &keyCapMap)1888 void UIKeyboardLayoutReader::parseKey() 1890 1889 { 1891 1890 KeyCaptions keyCaptions; … … 1904 1903 m_xmlReader.skipCurrentElement(); 1905 1904 } 1906 keyCapMap.insert(iKeyPosition, keyCaptions);1905 m_keyCapMap.insert(iKeyPosition, keyCaptions); 1907 1906 } 1908 1907
Note:
See TracChangeset
for help on using the changeset viewer.