shortcuts.cpp
author insilmaril
Tue, 30 Mar 2010 17:30:39 +0000
changeset 842 bec082472471
parent 824 36eb4b8f409e
permissions -rw-r--r--
Much improved results in FindResultsWidget
     1 #include <QDebug>
     2 #include <QMultiMap>
     3 
     4 #include <iostream>
     5 using namespace std;
     6 
     7 #include "shortcuts.h"
     8 
     9 /////////////////////////////////////////////////////////////////
    10 // Shortcut
    11 /////////////////////////////////////////////////////////////////
    12 Shortcut::Shortcut(QWidget *parent) :QShortcut (parent)
    13 {
    14 }
    15 
    16 /////////////////////////////////////////////////////////////////
    17 // Switchboard
    18 /////////////////////////////////////////////////////////////////
    19 Switchboard::Switchboard ()
    20 {
    21 }
    22 
    23 void Switchboard::addConnection (QAction *a, const QString &group)
    24 {	
    25 	actions.insert(group,a);
    26 }
    27 
    28 void Switchboard::print ()
    29 {
    30 	QString g;
    31 	foreach (g,actions.uniqueKeys())
    32 	{
    33 		cout <<"Group: "<<g.toStdString()<<endl;
    34 		QList <QAction*> values=actions.values(g);
    35 		for (int i=0;i<values.size();++i)
    36 		{
    37 			cout<<QString ("  %1: %2") 
    38 				.arg(values.at(i)->text().left(30),30)
    39 				.arg(values.at(i)->shortcut().toString()).toStdString()<<endl;
    40 		}
    41 		cout <<endl;
    42 	}
    43 }
    44 
    45 void Switchboard::printLaTeX ()
    46 {
    47 	QString g;
    48 	foreach (g,actions.uniqueKeys())
    49 	{
    50 		cout <<"Group: "<<g.toStdString()<<endl;
    51 		QList <QAction*> values=actions.values(g);
    52 		for (int i=0;i<values.size();++i)
    53 			if (!values.at(i)->shortcut().toString().isEmpty())
    54 				cout<<QString ("  %1& %2\\\\ ") 
    55 					.arg(values.at(i)->text().left(30),30)
    56 					.arg(values.at(i)->shortcut().toString()).toStdString()<<endl;
    57 		cout <<endl;
    58 	}
    59 }