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