9 /////////////////////////////////////////////////////////////////
11 /////////////////////////////////////////////////////////////////
12 KeySwitch::KeySwitch(const QString &kIdentifier, const QString &kName,
13 const QString &kGroup, const QString &kTag,
14 const QKeySequence &kseq)
16 identifier = kIdentifier;
23 /////////////////////////////////////////////////////////////////
25 /////////////////////////////////////////////////////////////////
26 Switchboard::Switchboard() {}
28 void Switchboard::addGroup(QString gIdentifier, QString gName)
30 if (groups.contains(gIdentifier)) {
31 qDebug() << "Warning switchboard: Shortcut group " << gIdentifier
35 groups.insert(gIdentifier, gName);
38 void Switchboard::addSwitch(QString identifier, QString scope, QAction *action,
41 if (!switches.contains(identifier)) {
42 KeySwitch ksw(identifier, action->text(), scope, tag,
44 switches.insert(scope, ksw);
48 << "Warning switchboard::addSwitch warning: Existing idenifier "
52 QString Switchboard::getASCII()
56 foreach (g, switches.uniqueKeys()) {
57 s += "Scope " + g + ":\n";
58 QList<KeySwitch> values = switches.values(g);
59 for (int i = 0; i < values.size(); ++i) {
60 QString desc = values.at(i).name;
61 QString sc = values.at(i).keySequence.toString();
62 desc = desc.remove('&');
63 desc = desc.remove("...");
64 s += QString(" %1: %2\n").arg(sc, 12).arg(desc);
70 foreach (g, actions.uniqueKeys())
73 QList <QAction*> values=actions.values(g);
74 for (int i=0;i<values.size();++i)
76 QString desc=values.at(i)->text();
77 QString sc=values.at(i)->shortcut().toString();
78 desc=desc.remove('&');
79 desc=desc.remove("...");
80 s+= QString(" %1: %2\n").arg(sc,12).arg(desc);
87 void Switchboard::printASCII() { cout << qPrintable(getASCII()); }
89 void Switchboard::printLaTeX()
92 foreach (g, actions.uniqueKeys()) {
93 cout << "Group: " << qPrintable(g) << "\\\\ \\hline" << endl;
94 QList<QAction *> values = actions.values(g);
95 for (int i = 0; i < values.size(); ++i)
96 if (!values.at(i)->shortcut().toString().isEmpty()) {
97 QString desc = values.at(i)->text();
98 QString sc = values.at(i)->shortcut().toString();
99 desc = desc.remove('&');
100 desc = desc.remove("...");
101 cout << qPrintable(QString(" %1& %2").arg(sc, 12).arg(desc))