#include <QMessageBox>
#include <QToolButton>
+// This defines the unicode symbols for special keys (kCommandUnicode and friends)
+#ifdef Q_WS_MAC
+# include <Carbon/Carbon.h>
+#endif
+
#include "action.h"
#include "actioncollection.h"
#include "iconloader.h"
}
void KeySequenceWidget::updateShortcutDisplay() {
- // make translators happy
- static QString metaKey = tr("Meta", "Meta key");
- static QString altKey = tr("Alt", "Alt key");
- static QString ctrlKey = tr("Ctrl", "Ctrl key");
- static QString shiftKey = tr("Shift", "Shift key");
-
QString s = _keySequence.toString(QKeySequence::NativeText);
s.replace('&', QLatin1String("&&"));
if(_isRecording) {
if(_modifierKeys) {
- if(_modifierKeys & Qt::META) s += metaKey + '+';
-#if defined(Q_WS_MAC)
- if(_modifierKeys & Qt::ALT) s += altKey + '+';
- if(_modifierKeys & Qt::CTRL) s += ctrlKey + '+';
-#elif defined(Q_WS_X11)
- if(_modifierKeys & Qt::CTRL) s += ctrlKey + '+';
- if(_modifierKeys & Qt::ALT) s += altKey + '+';
+#ifdef Q_WS_MAC
+ if(_modifierKeys & Qt::META) s += QChar(kControlUnicode);
+ if(_modifierKeys & Qt::ALT) s += QChar(kOptionUnicode);
+ if(_modifierKeys & Qt::SHIFT) s += QChar(kShiftUnicode);
+ if(_modifierKeys & Qt::CTRL) s += QChar(kCommandUnicode);
+#else
+ if(_modifierKeys & Qt::META) s += tr("Meta", "Meta key") + '+';
+ if(_modifierKeys & Qt::CTRL) s += tr("Ctrl", "Ctrl key") + '+';
+ if(_modifierKeys & Qt::ALT) s += tr("Alt", "Alt key") + '+';
+ if(_modifierKeys & Qt::SHIFT) s += tr("Shift", "Shift key") + '+';
#endif
- if(_modifierKeys & Qt::SHIFT) s += shiftKey + '+';
-
} else {
s = tr("Input", "What the user inputs now will be taken as the new shortcut");
}
if(!actIdx.data(ShortcutsModel::IsConfigurableRole).toBool()) {
QMessageBox::warning(this, tr("Shortcut Conflict"),
- tr("The \"%1\" shortcut is already in use, and cannot be configured.\nPlease choose another one.").arg(seq.toString()),
+ tr("The \"%1\" shortcut is already in use, and cannot be configured.\nPlease choose another one.").arg(seq.toString(QKeySequence::NativeText)),
QMessageBox::Ok);
return false;
}
(tr("The \"%1\" shortcut is ambiguous with the shortcut for the following action:")
+ "<br><ul><li>%2</li></ul><br>"
+ tr("Do you want to reassign this shortcut to the selected action?")
- ).arg(seq.toString(), actIdx.data().toString()),
+ ).arg(seq.toString(QKeySequence::NativeText), actIdx.data().toString()),
QMessageBox::Cancel, this);
box.addButton(tr("Reassign"), QMessageBox::AcceptRole);
if(box.exec() == QMessageBox::Cancel)