r17864 by jghali - fix broken shortcut handling
scribus-commit
scribus-commit at lists.scribus.net
Fri Nov 9 00:55:30 UTC 2012
Author: jghali
Date: Fri Nov 9 00:55:30 2012
New Revision: 17864
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=17864
Log:
fix broken shortcut handling
Modified:
trunk/Scribus/scribus/commonstrings.cpp
trunk/Scribus/scribus/prefsmanager.cpp
trunk/Scribus/scribus/ui/prefs_keyboardshortcuts.cpp
trunk/Scribus/scribus/ui/prefs_keyboardshortcuts.h
Modified: trunk/Scribus/scribus/commonstrings.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17864&path=/trunk/Scribus/scribus/commonstrings.cpp
==============================================================================
--- trunk/Scribus/scribus/commonstrings.cpp (original)
+++ trunk/Scribus/scribus/commonstrings.cpp Fri Nov 9 00:55:30 2012
@@ -449,6 +449,7 @@
CommonStrings::metaModifier=tr("Ctrl");
#endif
#ifdef Q_OS_WIN32
+ CommonStrings::controlModifier=tr("Ctrl");
CommonStrings::metaModifier=tr("Windows");
#endif
#if !defined(Q_OS_WIN32) && !defined(Q_OS_MAC)
Modified: trunk/Scribus/scribus/prefsmanager.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17864&path=/trunk/Scribus/scribus/prefsmanager.cpp
==============================================================================
--- trunk/Scribus/scribus/prefsmanager.cpp (original)
+++ trunk/Scribus/scribus/prefsmanager.cpp Fri Nov 9 00:55:30 2012
@@ -1704,15 +1704,7 @@
continue;
QDomElement kscc=docu.createElement("Shortcut");
kscc.setAttribute("Action",ksc.value().actionName);
- QString ks(Prefs_KeyboardShortcuts::getKeyText(ksc.value().keySequence));
-#ifdef Q_OS_MAC
- ks.replace("Ctrl","Meta");
- ks.replace("Cmd","Ctrl");
-#endif
-#ifdef Q_OS_WIN32
- ks.replace("Windows","Meta");
-#endif
- kscc.setAttribute("KeySequence",ks);
+ kscc.setAttribute("KeySequence", Prefs_KeyboardShortcuts::getKeyText(ksc.value().keySequence));
elem.appendChild(kscc);
}
QDomElement cosd=docu.createElement("DefaultColorSet");
Modified: trunk/Scribus/scribus/ui/prefs_keyboardshortcuts.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17864&path=/trunk/Scribus/scribus/ui/prefs_keyboardshortcuts.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/prefs_keyboardshortcuts.cpp (original)
+++ trunk/Scribus/scribus/ui/prefs_keyboardshortcuts.cpp Fri Nov 9 00:55:30 2012
@@ -221,9 +221,9 @@
{
if (it.value().keySequence.isEmpty() && it.key().isEmpty())
continue;
- QDomElement function_shortcut=doc.createElement("function");
- function_shortcut.setAttribute("name",it.key());
- function_shortcut.setAttribute("shortcut",getKeyText(it.value().keySequence));
+ QDomElement function_shortcut = doc.createElement("function");
+ function_shortcut.setAttribute("name", it.key());
+ function_shortcut.setAttribute("shortcut", getKeyText(it.value().keySequence));
keySetElement.appendChild(function_shortcut);
}
QFile f(filename);
@@ -289,6 +289,24 @@
}
QString Prefs_KeyboardShortcuts::getKeyText(int KeyC)
+{
+ if ((KeyC & ~(Qt::META | Qt::CTRL | Qt::ALT | Qt::SHIFT)) == 0)
+ return "";
+ // on OSX Qt translates modifiers to forsaken symbols, arrows and the like
+ // we prefer plain English
+ QString res;
+ if ((KeyC & Qt::META) != 0)
+ res += "Meta+";
+ if ((KeyC & Qt::CTRL) != 0)
+ res += "Ctrl+";
+ if ((KeyC & Qt::ALT) != 0)
+ res += "Alt+";
+ if ((KeyC & Qt::SHIFT) != 0)
+ res += "Shift+";
+ return res + QString(QKeySequence(KeyC & ~(Qt::META | Qt::CTRL | Qt::ALT | Qt::SHIFT)));
+}
+
+QString Prefs_KeyboardShortcuts::getTrKeyText(int KeyC)
{
if ((KeyC & ~(Qt::META | Qt::CTRL | Qt::ALT | Qt::SHIFT)) == 0)
return "";
@@ -500,13 +518,13 @@
break;
default:
keyCode |= k->key();
- keyDisplay->setText(getKeyText(keyCode));
+ keyDisplay->setText(getTrKeyText(keyCode));
releaseKeyboard();
if (checkKey(keyCode))
{
QMessageBox::information(this, CommonStrings::trWarning,
tr("The %1 key sequence is already in use by \"%2\"")
- .arg(getKeyText(keyCode))
+ .arg(getTrKeyText(keyCode))
.arg(getAction(keyCode)),
CommonStrings::tr_OK);
selectedLVI->setText(1,keyMap[lviToActionMap[selectedLVI]].keySequence);
Modified: trunk/Scribus/scribus/ui/prefs_keyboardshortcuts.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17864&path=/trunk/Scribus/scribus/ui/prefs_keyboardshortcuts.h
==============================================================================
--- trunk/Scribus/scribus/ui/prefs_keyboardshortcuts.h (original)
+++ trunk/Scribus/scribus/ui/prefs_keyboardshortcuts.h Fri Nov 9 00:55:30 2012
@@ -34,7 +34,9 @@
bool event( QEvent* ev );
void keyPressEvent(QKeyEvent *k);
void keyReleaseEvent(QKeyEvent *k);
+
static QString getKeyText(int KeyC);
+ static QString getTrKeyText(int KeyC);
public slots:
void languageChange();
More information about the scribus-commit
mailing list