|
From: <cn...@us...> - 2020-10-24 21:10:34
|
Revision: 1057
http://sourceforge.net/p/seq/svn/1057
Author: cn187
Date: 2020-10-24 21:10:31 +0000 (Sat, 24 Oct 2020)
Log Message:
-----------
Replace Q3Accel/int key shortcuts with QShortcut/QKeySequence
Modified Paths:
--------------
showeq/branches/pre_6_0_beta/src/interface.cpp
showeq/branches/pre_6_0_beta/src/map.cpp
showeq/branches/pre_6_0_beta/src/netdiag.cpp
showeq/branches/pre_6_0_beta/src/xmlconv.cpp
showeq/branches/pre_6_0_beta/src/xmlpreferences.cpp
showeq/branches/pre_6_0_beta/src/xmlpreferences.h
Modified: showeq/branches/pre_6_0_beta/src/interface.cpp
===================================================================
--- showeq/branches/pre_6_0_beta/src/interface.cpp 2020-10-24 21:10:18 UTC (rev 1056)
+++ showeq/branches/pre_6_0_beta/src/interface.cpp 2020-10-24 21:10:31 UTC (rev 1057)
@@ -82,7 +82,7 @@
#include <QLineEdit>
#include <QMessageBox>
#include <QFileDialog>
-#include <Q3Accel>
+#include <QShortcut>
#include <QFileInfo>
#include <QFile>
#include <Q3TextStream>
@@ -2449,9 +2449,10 @@
}
show();
- Q3Accel *accel = new Q3Accel(this);
- accel->connectItem( accel->insertItem(Qt::CTRL+Qt::ALT+Qt::Key_S), this, SLOT(toggle_view_statusbar()));
- accel->connectItem( accel->insertItem(Qt::CTRL+Qt::ALT+Qt::Key_T), this, SLOT(toggle_view_menubar()));
+ QShortcut *toggle_view_status_bar_shortcut = new QShortcut(
+ Qt::CTRL+Qt::ALT+Qt::Key_S, this, SLOT(toggle_view_statusbar()));
+ QShortcut *toggle_view_menubar_shortcut = new QShortcut(
+ Qt::CTRL+Qt::ALT+Qt::Key_T, this, SLOT(toggle_view_menubar()));
// load in the docking preferences if any have been saved
QString dockPrefs = pSEQPrefs->getPrefString("DockingInfo", section,
Modified: showeq/branches/pre_6_0_beta/src/map.cpp
===================================================================
--- showeq/branches/pre_6_0_beta/src/map.cpp 2020-10-24 21:10:18 UTC (rev 1056)
+++ showeq/branches/pre_6_0_beta/src/map.cpp 2020-10-24 21:10:31 UTC (rev 1057)
@@ -58,7 +58,7 @@
#include <QPushButton>
#include <QLayout>
#include <Q3ToolBar>
-#include <Q3Accel>
+#include <QShortcut>
#include <QColorDialog>
#include <QFontDialog>
#include <QTimer>
@@ -1689,43 +1689,43 @@
m_showInstanceLocationMarker = pSEQPrefs->getPrefBool(tmpPrefString, prefString, false);
// Accelerators
- Q3Accel *accel = new Q3Accel(this);
- int key;
+ QShortcut *tmpShortcut = nullptr;
+ QKeySequence key;
key = pSEQPrefs->getPrefKey("ZoomInKey", prefString, "+");
- accel->connectItem(accel->insertItem(key), this, SLOT(zoomIn()));
+ tmpShortcut = new QShortcut(key, this, SLOT(zoomIn()));
key = pSEQPrefs->getPrefKey("ZoomOutKey", prefString, "-");
- accel->connectItem(accel->insertItem(key), this, SLOT(zoomOut()));
+ tmpShortcut = new QShortcut(key, this, SLOT(zoomOut()));
key = pSEQPrefs->getPrefKey("PanDownLeftKey", prefString, "Ctrl+1");
- accel->connectItem(accel->insertItem(key), this, SLOT(panDownLeft()));
+ tmpShortcut = new QShortcut(key, this, SLOT(panDownLeft()));
key = pSEQPrefs->getPrefKey("PanDownKey", prefString, "Ctrl+2");
- accel->connectItem(accel->insertItem(key), this, SLOT(panDown()));
+ tmpShortcut = new QShortcut(key, this, SLOT(panDown()));
key = pSEQPrefs->getPrefKey("PanDownRightKey", prefString, "Ctrl+3");
- accel->connectItem(accel->insertItem(key), this, SLOT(panDownRight()));
+ tmpShortcut = new QShortcut(key, this, SLOT(panDownRight()));
key = pSEQPrefs->getPrefKey("PanLeftKey", prefString, "Ctrl+4");
- accel->connectItem(accel->insertItem(key), this, SLOT(panLeft()));
+ tmpShortcut = new QShortcut(key, this, SLOT(panLeft()));
key = pSEQPrefs->getPrefKey("CenterSelectedKey", prefString, "Ctrl+5");
- accel->connectItem(accel->insertItem(key), this, SLOT(viewTarget()));
+ tmpShortcut = new QShortcut(key, this, SLOT(viewTarget()));
key = pSEQPrefs->getPrefKey("PanRightKey", prefString, "Ctrl+6");
- accel->connectItem(accel->insertItem(key), this, SLOT(panRight()));
+ tmpShortcut = new QShortcut(key, this, SLOT(panRight()));
key = pSEQPrefs->getPrefKey("PanUpLeftKey", prefString, "Ctrl+7");
- accel->connectItem(accel->insertItem(key), this, SLOT(panUpLeft()));
+ tmpShortcut = new QShortcut(key, this, SLOT(panUpLeft()));
key = pSEQPrefs->getPrefKey("PanUpKey", prefString, "Ctrl+8");
- accel->connectItem(accel->insertItem(key), this, SLOT(panUp()));
+ tmpShortcut = new QShortcut(key, this, SLOT(panUp()));
key = pSEQPrefs->getPrefKey("PanUpRightKey", prefString, "Ctrl+9");
- accel->connectItem(accel->insertItem(key), this, SLOT(panUpRight()));
+ tmpShortcut = new QShortcut(key, this, SLOT(panUpRight()));
key = pSEQPrefs->getPrefKey("ViewLockKey", prefString, "Ctrl+0");
- accel->connectItem(accel->insertItem(key), this, SLOT(viewLock()));
+ tmpShortcut = new QShortcut(key, this, SLOT(viewLock()));
m_followMode = tFollowPlayer;
Modified: showeq/branches/pre_6_0_beta/src/netdiag.cpp
===================================================================
--- showeq/branches/pre_6_0_beta/src/netdiag.cpp 2020-10-24 21:10:18 UTC (rev 1056)
+++ showeq/branches/pre_6_0_beta/src/netdiag.cpp 2020-10-24 21:10:31 UTC (rev 1057)
@@ -21,7 +21,7 @@
*/
#include <QPushButton>
-#include <Q3Accel>
+#include <QShortcut>
#include <Q3GridLayout>
#include <QLabel>
@@ -160,12 +160,15 @@
m_playbackSpeed->setValue(m_packet->playbackSpeed());
- Q3Accel* accel = new Q3Accel(this);
- int key;
+ QKeySequence key;
+
key = pSEQPrefs->getPrefKey("IncPlaybackSpeedKey", preferenceName(), "Ctrl+X");
- accel->connectItem(accel->insertItem(key), m_packet, SLOT(incPlayback()));
+ QShortcut *incPlayback_shortcut = new QShortcut(key, this);
+ connect (incPlayback_shortcut, SIGNAL(activated()), m_packet, SLOT(incPlayback()));
+
key = pSEQPrefs->getPrefKey("IncPlaybackSpeedKey", preferenceName(), "Ctrl+Z");
- accel->connectItem(accel->insertItem(key), m_packet, SLOT(decPlayback()));
+ QShortcut *decPlayback_shortcut = new QShortcut(key, this);
+ connect (decPlayback_shortcut, SIGNAL(activated()), m_packet, SLOT(decPlayback()));
}
// supply the LCD's with signals
Modified: showeq/branches/pre_6_0_beta/src/xmlconv.cpp
===================================================================
--- showeq/branches/pre_6_0_beta/src/xmlconv.cpp 2020-10-24 21:10:18 UTC (rev 1056)
+++ showeq/branches/pre_6_0_beta/src/xmlconv.cpp 2020-10-24 21:10:31 UTC (rev 1057)
@@ -38,7 +38,7 @@
#include <QRect>
#include <QSize>
#include <QSizePolicy>
-#include <Q3Accel>
+#include <QKeySequence>
#include <QCursor>
#include <QStringList>
#include <QDomElement>
@@ -211,16 +211,12 @@
}
else if (e.tagName() == "key")
{
- int key;
if (e.hasAttribute("sequence"))
{
- key = Q3Accel::stringToKey(e.attribute("sequence"));
+ QKeySequence key(e.attribute("sequence"));
- // fix the key code (deal with Qt brain death)
- key &= ~Qt::UNICODE_ACCEL;
-
- v = QVariant::fromValue<QKeySequence>(key);
- ok = true;
+ v = QVariant::fromValue<QKeySequence>(key);
+ ok = true;
}
}
else if (e.tagName() == "font")
Modified: showeq/branches/pre_6_0_beta/src/xmlpreferences.cpp
===================================================================
--- showeq/branches/pre_6_0_beta/src/xmlpreferences.cpp 2020-10-24 21:10:18 UTC (rev 1056)
+++ showeq/branches/pre_6_0_beta/src/xmlpreferences.cpp 2020-10-24 21:10:31 UTC (rev 1057)
@@ -32,7 +32,6 @@
#include <cstdlib>
#include <QFile>
-#include <Q3Accel>
#include <QDir>
#include <QFileInfo>
#include <QRegExp>
@@ -689,18 +688,17 @@
getPrefMethod(QStringList, StringList, const QStringList&);
// implement get methods that require special behavior
-int XMLPreferences::getPrefKey(const QString& inName,
- const QString& inSection,
- const QString& def,
+QKeySequence XMLPreferences::getPrefKey(const QString& inName,
+ const QString& inSection,
+ const QString& def,
Persistence pers)
{
- return getPrefKey(inName, inSection,
- Q3Accel::stringToKey(def) & ~Qt::UNICODE_ACCEL, pers);
+ return getPrefKey(inName, inSection, QKeySequence(def), pers);
}
-int XMLPreferences::getPrefKey(const QString& inName,
- const QString& inSection,
- int def,
+QKeySequence XMLPreferences::getPrefKey(const QString& inName,
+ const QString& inSection,
+ const QKeySequence& def,
Persistence pers)
{
// try to retrieve the preference
@@ -709,38 +707,30 @@
// if preference was retrieved, return it as a string
if (preference != NULL)
{
- int key = def;
switch(preference->type())
{
case QVariant::KeySequence:
- key = preference->toInt();
- break;
+ return preference->value<QKeySequence>();
case QVariant::String:
// convert it to a key
- key = Q3Accel::stringToKey(preference->toString());
- break;
+ return QKeySequence(preference->value<QKeySequence>());
case QVariant::Int:
case QVariant::UInt:
case QVariant::Double:
- key = preference->toInt();
- break;
+ return QKeySequence(preference->value<QKeySequence>());
default:
qWarning("XMLPreferences::getPrefKey(%s, %s, %d): preference found,\n"
"\tbut type %s is not convertable to type key!",
(const char*)inName, (const char*)inSection, def,
preference->typeName());
+ return QKeySequence(def);
}
- // fix the key code (deal with Qt brain death)
- key &= ~Qt::UNICODE_ACCEL;
-
- // return the key
- return key;
}
// return the default value
- return def;
+ return QKeySequence(def);
}
Modified: showeq/branches/pre_6_0_beta/src/xmlpreferences.h
===================================================================
--- showeq/branches/pre_6_0_beta/src/xmlpreferences.h 2020-10-24 21:10:18 UTC (rev 1056)
+++ showeq/branches/pre_6_0_beta/src/xmlpreferences.h 2020-10-24 21:10:31 UTC (rev 1057)
@@ -45,6 +45,7 @@
#include <QSizePolicy>
#include <QCursor>
#include <QStringList>
+#include <QKeySequence>
// XMLPreferences is a generic class that implements a persistant config
// file in the XML format specified in seqpref.dtd.
@@ -129,10 +130,10 @@
const QRect& def = QRect(), Persistence pers = Any);
QSize getPrefSize(const QString& inName, const QString& inSection,
const QSize& def = QSize(), Persistence pers = Any);
- int getPrefKey(const QString& inName, const QString& inSection,
+ QKeySequence getPrefKey(const QString& inName, const QString& inSection,
const QString& def, Persistence pers = Any);
- int getPrefKey(const QString& inName, const QString& inSection,
- int def, Persistence pers = Any);
+ QKeySequence getPrefKey(const QString& inName, const QString& inSection,
+ const QKeySequence& def, Persistence pers = Any);
QFont getPrefFont(const QString& inName, const QString& inSection,
const QFont& def = QFont(), Persistence pers = Any);
QSizePolicy getPrefSizePolicy(const QString& inName,
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|