- remove the settings for the font color, size and the possibility to show/hide the...
[rsibreak.git] / src / main.cpp
blob79b1f81d21b7770d382843a0e62e7df91ffb9408
1 /* This file is part of the KDE project
2 Copyright (C) 2005-2007 Tom Albers <tomalbers@kde.nl>
4 This program is free software; you can redistribute it and/or
5 modify it under the terms of the GNU General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 #include <QDBusInterface>
20 #include <kuniqueapplication.h>
21 #include <kstartupinfo.h>
22 #include <kcmdlineargs.h>
23 #include <kaboutdata.h>
24 #include <stdio.h>
25 #include <stdlib.h>
27 #include "rsiwidget.h"
29 /**
30 * @class RSIApplication
31 * @author Tom Albers <tomalbers@kde.nl>
32 * This class is a simple inheritance from KUniqueApplication
33 * the reason that it is reimplemented is that when RSIBreak
34 * is launched a second time it would in the orinal implementation
35 * make the RSIWidget->show(). which we do not want. This
36 * class misses that call.
38 class RSIApplication : public KUniqueApplication {
39 public:
40 /**
41 * Similar to KUniqueApplication::newInstance, only without
42 * the call to raise the widget when a second instance is started.
44 int newInstance()
46 static bool secondMe=false;
47 if (secondMe)
49 QDBusInterface dbus("org.rsibreak.rsibreak", "/rsibreak",
50 "org.rsibreak.rsiwidget");
51 dbus.call("showWhereIAm");
52 } else {
53 secondMe = true;
55 return 0;
59 int main( int argc, char *argv[] )
61 KAboutData aboutData( "rsibreak", 0,
62 ki18n("RSIBreak"),
63 "0.9.0-svn",
64 ki18n("Try to prevent Repetitive Strain Injury by "
65 "reminding a user to rest."),
66 KAboutData::License_GPL,
67 ki18n("(c) 2005-2006, The RSIBreak developers" ),
68 KLocalizedString(),
69 "http://www.rsibreak.org");
71 aboutData.addAuthor( ki18n("Tom Albers"), ki18n("Maintainer and Author"),
72 "tomalbers@kde.nl", "http://www.omat.nl");
74 aboutData.addAuthor( ki18n("Bram Schoenmakers"), ki18n("Author"),
75 "bramschoenmakers@kde.nl" );
77 aboutData.addCredit( ki18n("Tina Trillitzsch"), ki18n("Usability"),
78 "t.trillitzsch@gmx.de");
80 aboutData.addCredit( ki18n("Lee Olson"), ki18n("Logo and Icons"),
81 "clearbeast@gmail.com");
83 aboutData.addCredit( ki18n("Achim Bohnet"),
84 ki18n("Packaging and help with related issues"),
85 "ach@mpe.mpg.de");
87 KCmdLineArgs::init( argc, argv, &aboutData );
89 if (!KUniqueApplication::start())
91 KStartupInfo::handleAutoAppStartedSending();
92 fprintf(stderr, "RSIBreak is already running!\n");
93 exit(0);
96 RSIApplication a;
97 a.disableSessionManagement();
98 // else it will exit(0) when closing any config/about/etc window.
99 a.setQuitOnLastWindowClosed( false );
101 RSIWidget* rsi = new RSIWidget();
103 return a.exec();