1.1 --- a/shortcuts.cpp Fri Feb 19 13:47:03 2010 +0000
1.2 +++ b/shortcuts.cpp Thu Feb 25 11:03:52 2010 +0000
1.3 @@ -1,8 +1,11 @@
1.4 -#include "shortcuts.h"
1.5 +#include <QDebug>
1.6 +#include <QMultiMap>
1.7
1.8 #include <iostream>
1.9 using namespace std;
1.10
1.11 +#include "shortcuts.h"
1.12 +
1.13 /////////////////////////////////////////////////////////////////
1.14 // Shortcut
1.15 /////////////////////////////////////////////////////////////////
1.16 @@ -17,20 +20,24 @@
1.17 {
1.18 }
1.19
1.20 -void Switchboard::addConnection (QAction *a, const QString &desc)
1.21 +void Switchboard::addConnection (QAction *a, const QString &group)
1.22 {
1.23 - QKeySequence ks=QKeySequence::fromString (desc);
1.24 - actions.append (a);
1.25 - if (!desc.isEmpty()) keys.append (new QKeySequence (ks));
1.26 - if (a) a->setShortcut (ks);
1.27 + actions.insert(group,a);
1.28 }
1.29
1.30 void Switchboard::print ()
1.31 {
1.32 - for (int i=0;i<actions.size();++i)
1.33 + QString g;
1.34 + foreach (g,actions.uniqueKeys())
1.35 {
1.36 - cout <<actions.at(i)->shortcut().toString().toStdString();
1.37 - cout << " Action: " <<actions.at(i)->text().toStdString();
1.38 + cout <<"Group: "<<g.toStdString()<<endl;
1.39 + QList <QAction*> values=actions.values(g);
1.40 + for (int i=0;i<values.size();++i)
1.41 + {
1.42 + cout<<QString (" %1: %2")
1.43 + .arg(values.at(i)->text().left(30),30)
1.44 + .arg(values.at(i)->shortcut().toString()).toStdString()<<endl;
1.45 + }
1.46 cout <<endl;
1.47 }
1.48 }