added shortcuts.h and .cpp
authorinsilmaril
Tue Nov 17 08:24:59 2009 +0000 (2009-11-17)
changeset 8062a33304714ba
parent 805 fc7a93ff97c3
child 807 f9f7922989d8
added shortcuts.h and .cpp
main.cpp
shortcuts.cpp
shortcuts.h
version.h
vymview.cpp
     1.1 --- a/main.cpp	Mon Nov 16 09:47:10 2009 +0000
     1.2 +++ b/main.cpp	Tue Nov 17 08:24:59 2009 +0000
     1.3 @@ -26,6 +26,7 @@
     1.4  QString vymVersion;
     1.5  QString vymBuildDate;
     1.6  QString vymCodeName;
     1.7 +QString vymInstanceName;
     1.8  
     1.9  Main *mainWindow;				// used in BranchObj::select()								
    1.10  
    1.11 @@ -70,6 +71,7 @@
    1.12  	options.add ("debug", Option::Switch, "d", "debug");
    1.13  	options.add ("version", Option::Switch, "v","version");
    1.14  	options.add ("local", Option::Switch, "l", "local");
    1.15 +	options.add ("name", Option::Switch, "n", "name");
    1.16  	options.add ("help", Option::Switch, "h", "help");
    1.17  	options.add ("quit", Option::Switch, "q", "quit");
    1.18  	options.add ("run", Option::String, "r", "run");
    1.19 @@ -101,7 +103,13 @@
    1.20  	
    1.21  	// Register for DBUS
    1.22  	if (debug) cout << "PID="<<getpid()<<endl;
    1.23 -	dbusConnection.registerService (QString ("org.insilmaril.vym-%1").arg(getpid()));
    1.24 +	QString pidString=QString ("%1").arg(getpid());
    1.25 +	dbusConnection.registerService ("org.insilmaril.vym-"+pidString);
    1.26 +	if (options.isOn ("name"))
    1.27 +		vymInstanceName=options.getArg ("name");
    1.28 +	else
    1.29 +		vymInstanceName=pidString;
    1.30 +	
    1.31  
    1.32  	// Use /usr/share/vym or /usr/local/share/vym or . ?
    1.33  	// First try options
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/shortcuts.cpp	Tue Nov 17 08:24:59 2009 +0000
     2.3 @@ -0,0 +1,36 @@
     2.4 +#include "shortcuts.h"
     2.5 +
     2.6 +#include <iostream>
     2.7 +using namespace std;
     2.8 +
     2.9 +/////////////////////////////////////////////////////////////////
    2.10 +// Shortcut
    2.11 +/////////////////////////////////////////////////////////////////
    2.12 +Shortcut::Shortcut(QWidget *parent) :QShortcut (parent)
    2.13 +{
    2.14 +}
    2.15 +
    2.16 +/////////////////////////////////////////////////////////////////
    2.17 +// Switchboard
    2.18 +/////////////////////////////////////////////////////////////////
    2.19 +Switchboard::Switchboard ()
    2.20 +{
    2.21 +}
    2.22 +
    2.23 +void Switchboard::addConnection (QAction *a, const QString &desc)
    2.24 +{	
    2.25 +	QKeySequence ks=QKeySequence::fromString (desc);
    2.26 +	actions.append (a);
    2.27 +	if (!desc.isEmpty()) keys.append (new QKeySequence (ks));
    2.28 +	if (a) a->setShortcut (ks);
    2.29 +}
    2.30 +
    2.31 +void Switchboard::print ()
    2.32 +{
    2.33 +	for (int i=0;i<actions.size();++i)
    2.34 +	{
    2.35 +		cout <<actions.at(i)->shortcut().toString().toStdString();
    2.36 +		cout << "  Action: " <<actions.at(i)->text().toStdString();
    2.37 +		cout <<endl;
    2.38 +	}
    2.39 +}
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/shortcuts.h	Tue Nov 17 08:24:59 2009 +0000
     3.3 @@ -0,0 +1,32 @@
     3.4 +#ifndef SHORTCUTS_H
     3.5 +#define SHORTCUTS_H
     3.6 +
     3.7 +#include <QAction>
     3.8 +#include <QShortcut>
     3.9 +#include <QString>
    3.10 +
    3.11 +class Shortcut:public QShortcut {
    3.12 +public:
    3.13 +	Shortcut(QWidget *parent=NULL);
    3.14 +	void setGroup(const QString &);
    3.15 +	QString getGroup ();
    3.16 +	void setContextName (const QString &);
    3.17 +	QString getContextName();
    3.18 +
    3.19 +protected:
    3.20 +	QString group;
    3.21 +	QString context;
    3.22 +};
    3.23 +
    3.24 +class Switchboard {
    3.25 +public:
    3.26 +    Switchboard ();
    3.27 +	void addConnection(QAction *a,const QString &s);
    3.28 +//	void addFunction (Function,
    3.29 +	void print();
    3.30 +protected:  
    3.31 +	QList <QKeySequence*> keys;
    3.32 +	QList <QAction*> actions;
    3.33 +};
    3.34 +
    3.35 +#endif
     4.1 --- a/version.h	Mon Nov 16 09:47:10 2009 +0000
     4.2 +++ b/version.h	Tue Nov 17 08:24:59 2009 +0000
     4.3 @@ -7,7 +7,7 @@
     4.4  #define __VYM_VERSION "1.13.0"
     4.5  //#define __VYM_CODENAME "Codename: RC-1"
     4.6  #define __VYM_CODENAME "Codename: development version, not for production!"
     4.7 -#define __VYM_BUILD_DATE "2009-11-12"
     4.8 +#define __VYM_BUILD_DATE "2009-11-16"
     4.9  
    4.10  
    4.11  bool checkVersion(const QString &);
     5.1 --- a/vymview.cpp	Mon Nov 16 09:47:10 2009 +0000
     5.2 +++ b/vymview.cpp	Tue Nov 17 08:24:59 2009 +0000
     5.3 @@ -127,7 +127,7 @@
     5.4  	mainWindow->changeSelection (model,newsel,oldsel);	// FIXME-5 maybe connect VymModel <-> MainWindow directly?
     5.5  	// would require to also get current model in mainWindow
     5.6  
     5.7 -	cout << "VV::changeSelection   newsel.count="<<newsel.indexes().count()<<endl;
     5.8 +	//cout << "VV::changeSelection   newsel.count="<<newsel.indexes().count()<<endl;
     5.9  
    5.10  	if (newsel.indexes().count()>0)
    5.11  	{
    5.12 @@ -149,7 +149,7 @@
    5.13  	// Notify mainwindow to update satellites, but map selection to 
    5.14  	// original model first
    5.15  
    5.16 -	cout << "VV::changeProxySelection   newsel.count="<<newsel.indexes().count()<<endl;
    5.17 +	//cout << "VV::changeProxySelection   newsel.count="<<newsel.indexes().count()<<endl;
    5.18  	if (!newsel.indexes().isEmpty())
    5.19  	{
    5.20  	/* FIXME-2 need to set current, too