Changeset 846 for trunk/src/gui/kernel/qkeysequence.cpp
- Timestamp:
- May 5, 2011, 5:36:53 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/vendor/nokia/qt/4.7.2 (added) merged: 845 /branches/vendor/nokia/qt/current merged: 844 /branches/vendor/nokia/qt/4.6.3 removed
- Property svn:mergeinfo changed
-
trunk/src/gui/kernel/qkeysequence.cpp
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 391 391 const char* name; 392 392 } keyname[] = { 393 //: This and all following "incomprehensible" strings in QShortcut context 394 //: are key names. Please use the localized names appearing on actual 395 //: keyboards or whatever is commonly used. 393 396 { Qt::Key_Space, QT_TRANSLATE_NOOP("QShortcut", "Space") }, 394 397 { Qt::Key_Escape, QT_TRANSLATE_NOOP("QShortcut", "Esc") }, … … 437 440 { Qt::Key_MediaNext, QT_TRANSLATE_NOOP("QShortcut", "Media Next") }, 438 441 { Qt::Key_MediaRecord, QT_TRANSLATE_NOOP("QShortcut", "Media Record") }, 442 //: Media player pause button 443 { Qt::Key_MediaPause, QT_TRANSLATE_NOOP("QShortcut", "Media Pause") }, 444 //: Media player button to toggle between playing and paused 445 { Qt::Key_MediaTogglePlayPause, QT_TRANSLATE_NOOP("QShortcut", "Toggle Media Play/Pause") }, 439 446 { Qt::Key_HomePage, QT_TRANSLATE_NOOP("QShortcut", "Home Page") }, 440 447 { Qt::Key_Favorites, QT_TRANSLATE_NOOP("QShortcut", "Favorites") }, … … 573 580 // -------------------------------------------------------------- 574 581 // Device keys 575 { Qt::Key_Context1, QT_TRANSLATE_NOOP("QShortcut", "Context1") }, 576 { Qt::Key_Context2, QT_TRANSLATE_NOOP("QShortcut", "Context2") }, 577 { Qt::Key_Context3, QT_TRANSLATE_NOOP("QShortcut", "Context3") }, 578 { Qt::Key_Context4, QT_TRANSLATE_NOOP("QShortcut", "Context4") }, 579 { Qt::Key_Call, QT_TRANSLATE_NOOP("QShortcut", "Call") }, 580 { Qt::Key_Hangup, QT_TRANSLATE_NOOP("QShortcut", "Hangup") }, 581 { Qt::Key_Flip, QT_TRANSLATE_NOOP("QShortcut", "Flip") }, 582 582 { Qt::Key_Context1, QT_TRANSLATE_NOOP("QShortcut", "Context1") }, 583 { Qt::Key_Context2, QT_TRANSLATE_NOOP("QShortcut", "Context2") }, 584 { Qt::Key_Context3, QT_TRANSLATE_NOOP("QShortcut", "Context3") }, 585 { Qt::Key_Context4, QT_TRANSLATE_NOOP("QShortcut", "Context4") }, 586 //: Button to start a call (note: a separate button is used to end the call) 587 { Qt::Key_Call, QT_TRANSLATE_NOOP("QShortcut", "Call") }, 588 //: Button to end a call (note: a separate button is used to start the call) 589 { Qt::Key_Hangup, QT_TRANSLATE_NOOP("QShortcut", "Hangup") }, 590 //: Button that will hang up if we're in call, or make a call if we're not. 591 { Qt::Key_ToggleCallHangup, QT_TRANSLATE_NOOP("QShortcut", "Toggle Call/Hangup") }, 592 { Qt::Key_Flip, QT_TRANSLATE_NOOP("QShortcut", "Flip") }, 593 //: Button to trigger voice dialing 594 { Qt::Key_VoiceDial, QT_TRANSLATE_NOOP("QShortcut", "Voice Dial") }, 595 //: Button to redial the last number called 596 { Qt::Key_LastNumberRedial, QT_TRANSLATE_NOOP("QShortcut", "Last Number Redial") }, 597 //: Button to trigger the camera shutter (take a picture) 598 { Qt::Key_Camera, QT_TRANSLATE_NOOP("QShortcut", "Camera Shutter") }, 599 //: Button to focus the camera 600 { Qt::Key_CameraFocus, QT_TRANSLATE_NOOP("QShortcut", "Camera Focus") }, 601 602 // -------------------------------------------------------------- 603 // Japanese keyboard support 604 { Qt::Key_Kanji, QT_TRANSLATE_NOOP("QShortcut", "Kanji") }, 605 { Qt::Key_Muhenkan, QT_TRANSLATE_NOOP("QShortcut", "Muhenkan") }, 606 { Qt::Key_Henkan, QT_TRANSLATE_NOOP("QShortcut", "Henkan") }, 607 { Qt::Key_Romaji, QT_TRANSLATE_NOOP("QShortcut", "Romaji") }, 608 { Qt::Key_Hiragana, QT_TRANSLATE_NOOP("QShortcut", "Hiragana") }, 609 { Qt::Key_Katakana, QT_TRANSLATE_NOOP("QShortcut", "Katakana") }, 610 { Qt::Key_Hiragana_Katakana,QT_TRANSLATE_NOOP("QShortcut", "Hiragana Katakana") }, 611 { Qt::Key_Zenkaku, QT_TRANSLATE_NOOP("QShortcut", "Zenkaku") }, 612 { Qt::Key_Hankaku, QT_TRANSLATE_NOOP("QShortcut", "Hankaku") }, 613 { Qt::Key_Zenkaku_Hankaku, QT_TRANSLATE_NOOP("QShortcut", "Zenkaku Hankaku") }, 614 { Qt::Key_Touroku, QT_TRANSLATE_NOOP("QShortcut", "Touroku") }, 615 { Qt::Key_Massyo, QT_TRANSLATE_NOOP("QShortcut", "Massyo") }, 616 { Qt::Key_Kana_Lock, QT_TRANSLATE_NOOP("QShortcut", "Kana Lock") }, 617 { Qt::Key_Kana_Shift, QT_TRANSLATE_NOOP("QShortcut", "Kana Shift") }, 618 { Qt::Key_Eisu_Shift, QT_TRANSLATE_NOOP("QShortcut", "Eisu Shift") }, 619 { Qt::Key_Eisu_toggle, QT_TRANSLATE_NOOP("QShortcut", "Eisu toggle") }, 620 { Qt::Key_Codeinput, QT_TRANSLATE_NOOP("QShortcut", "Code input") }, 621 { Qt::Key_MultipleCandidate,QT_TRANSLATE_NOOP("QShortcut", "Multiple Candidate") }, 622 { Qt::Key_PreviousCandidate,QT_TRANSLATE_NOOP("QShortcut", "Previous Candidate") }, 623 624 // -------------------------------------------------------------- 625 // Korean keyboard support 626 { Qt::Key_Hangul, QT_TRANSLATE_NOOP("QShortcut", "Hangul") }, 627 { Qt::Key_Hangul_Start, QT_TRANSLATE_NOOP("QShortcut", "Hangul Start") }, 628 { Qt::Key_Hangul_End, QT_TRANSLATE_NOOP("QShortcut", "Hangul End") }, 629 { Qt::Key_Hangul_Hanja, QT_TRANSLATE_NOOP("QShortcut", "Hangul Hanja") }, 630 { Qt::Key_Hangul_Jamo, QT_TRANSLATE_NOOP("QShortcut", "Hangul Jamo") }, 631 { Qt::Key_Hangul_Romaja, QT_TRANSLATE_NOOP("QShortcut", "Hangul Romaja") }, 632 { Qt::Key_Hangul_Jeonja, QT_TRANSLATE_NOOP("QShortcut", "Hangul Jeonja") }, 633 { Qt::Key_Hangul_Banja, QT_TRANSLATE_NOOP("QShortcut", "Hangul Banja") }, 634 { Qt::Key_Hangul_PreHanja, QT_TRANSLATE_NOOP("QShortcut", "Hangul PreHanja") }, 635 { Qt::Key_Hangul_PostHanja,QT_TRANSLATE_NOOP("QShortcut", "Hangul PostHanja") }, 636 { Qt::Key_Hangul_Special, QT_TRANSLATE_NOOP("QShortcut", "Hangul Special") }, 583 637 584 638 { 0, 0 } … … 697 751 {QKeySequence::PreviousChild, 1, Qt::CTRL | Qt::SHIFT | Qt::Key_Backtab, QApplicationPrivate::KB_Win | QApplicationPrivate::KB_X11}, 698 752 {QKeySequence::PreviousChild, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_Backtab, QApplicationPrivate::KB_Mac },//different priority from above 753 {QKeySequence::Paste, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_Insert, QApplicationPrivate::KB_X11}, 699 754 {QKeySequence::SelectStartOfDocument, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_Home, QApplicationPrivate::KB_Win | QApplicationPrivate::KB_X11 | QApplicationPrivate::KB_S60}, 700 755 {QKeySequence::SelectEndOfDocument, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_End, QApplicationPrivate::KB_Win | QApplicationPrivate::KB_X11 | QApplicationPrivate::KB_S60}, … … 862 917 commas, e.g. "Alt+X,Ctrl+S,Q". 863 918 919 \a key should be in NativeText format. 920 864 921 This constructor is typically used with \link QObject::tr() tr 865 922 \endlink(), so that shortcut keys can be replaced in … … 875 932 d = new QKeySequencePrivate(); 876 933 assign(key); 934 } 935 936 /*! 937 \since 4.x 938 Creates a key sequence from the \a key string based on \a format. 939 */ 940 QKeySequence::QKeySequence(const QString &key, QKeySequence::SequenceFormat format) 941 { 942 d = new QKeySequencePrivate(); 943 assign(key, format); 877 944 } 878 945 … … 1039 1106 found = true; 1040 1107 } else { 1041 qWarning("QKeySequence::mnemonic: \"%s\" contains multiple occur ences of '&'", qPrintable(text));1108 qWarning("QKeySequence::mnemonic: \"%s\" contains multiple occurrences of '&'", qPrintable(text)); 1042 1109 #endif 1043 1110 } … … 1056 1123 comma; for example, "Alt+X,Ctrl+S,Z". The return value is the 1057 1124 number of key codes added. 1125 \a keys should be in NativeText format. 1058 1126 */ 1059 1127 int QKeySequence::assign(const QString &ks) 1128 { 1129 return assign(ks, NativeText); 1130 } 1131 1132 /*! 1133 \fn int QKeySequence::assign(const QString &keys, QKeySequence::SequenceFormat format) 1134 \since 4.x 1135 1136 Adds the given \a keys to the key sequence (based on \a format). 1137 \a keys may contain up to four key codes, provided they are 1138 separated by a comma; for example, "Alt+X,Ctrl+S,Z". The return 1139 value is the number of key codes added. 1140 */ 1141 int QKeySequence::assign(const QString &ks, QKeySequence::SequenceFormat format) 1060 1142 { 1061 1143 QString keyseq = ks; … … 1087 1169 part = keyseq.left(-1 == p ? keyseq.length() : p - diff); 1088 1170 keyseq = keyseq.right(-1 == p ? 0 : keyseq.length() - (p + 1)); 1089 d->key[n] = decodeString(part);1171 d->key[n] = QKeySequencePrivate::decodeString(part, format); 1090 1172 ++n; 1091 1173 } … … 1558 1640 QKeySequence QKeySequence::fromString(const QString &str, SequenceFormat format) 1559 1641 { 1560 QStringList sl = str.split(QLatin1String(", ")); 1561 int keys[4] = {0, 0, 0, 0}; 1562 int total = qMin(sl.count(), 4); 1563 for (int i = 0; i < total; ++i) 1564 keys[i] = QKeySequencePrivate::decodeString(sl[i], format); 1565 return QKeySequence(keys[0], keys[1], keys[2], keys[3]); 1642 return QKeySequence(str, format); 1566 1643 } 1567 1644
Note:
See TracChangeset
for help on using the changeset viewer.