Changeset 2802 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- May 23, 2007 12:57:12 PM (18 years ago)
- svn:sync-xref-src-repo-rev:
- 21412
- Location:
- trunk/src/VBox/Frontends/VirtualBox
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/VBoxUI.pro
r2431 r2802 24 24 TEMPLATE = app 25 25 LANGUAGE = C++ 26 27 SOURCES = src/QIHotKeyEdit.cpp 26 28 27 29 FORMS = ui/VBoxDiskImageManagerDlg.ui \ -
trunk/src/VBox/Frontends/VirtualBox/include/QIHotKeyEdit.h
r1285 r2802 25 25 26 26 #include <qlabel.h> 27 #ifdef Q_WS_MAC 27 #if defined(Q_WS_X11) 28 #include <qmap.h> 29 #endif 30 #if defined(Q_WS_MAC) 28 31 #include <Carbon/Carbon.h> 29 32 #endif … … 47 50 QSize minimumSizeHint() const; 48 51 52 #if defined(Q_WS_X11) 53 static void languageChange(void); 54 #endif 49 55 static QString keyName (int key); 50 56 static bool isValidKey (int k); … … 80 86 QColorGroup true_acg; 81 87 88 #if defined(Q_WS_X11) 89 static QMap<QString, QString> keyNames; 90 #endif 91 82 92 #if defined(Q_WS_MAC) 83 93 /** Event handler reference. NULL if the handler isn't installed. */ -
trunk/src/VBox/Frontends/VirtualBox/src/QIHotKeyEdit.cpp
r1319 r2802 60 60 #endif 61 61 #include "XKeyboard.h" 62 QMap<QString, QString> QIHotKeyEdit::keyNames; 62 63 #endif 63 64 … … 224 225 return QSize( w + m, h + m ); 225 226 } 227 228 #if defined(Q_WS_X11) 229 /** 230 * Updates the associative array containing the translations of X11 key strings to human 231 * readable key names. 232 */ 233 // static 234 void QIHotKeyEdit::languageChange(void) 235 { 236 keyNames["Shift_L"] = tr ("Left Shift"); 237 keyNames["Shift_R"] = tr ("Right Shift"); 238 keyNames["Control_L"] = tr ("Left Ctrl"); 239 keyNames["Control_R"] = tr ("Right Ctrl"); 240 keyNames["Alt_L"] = tr ("Left Alt"); 241 keyNames["Alt_R"] = tr ("Right Alt"); 242 keyNames["Super_L"] = tr ("Left WinKey"); 243 keyNames["Super_R"] = tr ("Right WinKey"); 244 keyNames["Menu"] = tr ("Menu key"); 245 keyNames["ISO_Level3_Shift"] = tr ("Alt Gr"); 246 keyNames["Caps_Lock"] = tr ("Caps Lock"); 247 keyNames["Scroll_Lock"] = tr ("Scroll Lock"); 248 } 249 #endif 226 250 227 251 /** … … 260 284 char *sn = ::XKeysymToString( (KeySym) key ); 261 285 if ( sn ) 262 name = sn; 286 { 287 if ( keyNames.contains(sn) ) 288 name = keyNames[sn]; 289 else 290 name = sn; 291 } 263 292 else 264 name = QString( "<key_%1>").arg( key );293 name = QString( tr ("<key_%1>") ).arg( key ); 265 294 #elif defined(Q_WS_MAC) 266 295 UInt32 modMask = DarwinKeyCodeToDarwinModifierMask( key ); … … 437 466 char *name = ::XKeysymToString( ks ); 438 467 if ( name ) 439 symbname = name; 468 { 469 if ( keyNames.contains(name) ) 470 symbname = keyNames[name]; 471 else 472 symbname = name; 473 } 440 474 else 441 symbname = QString( "<key_%1>").arg( (int) ks );475 symbname = QString( tr ("<key_%1>") ).arg( (int) ks ); 442 476 // update the display 443 477 updateText(); -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxGlobal.cpp
r2726 r2802 27 27 #include "VBoxConsoleWnd.h" 28 28 #include "VBoxProblemReporter.h" 29 #include "QIHotKeyEdit.h" 29 30 30 31 #include <qapplication.h> … … 1850 1851 1851 1852 detailReportTemplatesReady = false; 1853 #if defined(Q_WS_X11) 1854 /* As X11 does not (to my knowledge) have functionality for providing human readable 1855 * key names, we keep a table of them, which must be updated when the language is 1856 * changed. */ 1857 QIHotKeyEdit::languageChange(); 1858 #endif 1852 1859 } 1853 1860
Note:
See TracChangeset
for help on using the changeset viewer.