summaryrefslogtreecommitdiffstats
path: root/src/main.cpp
blob: 6e4636d36a71a7441e4334ff16c2527e0ce638f9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
/**************************************************************************
*   Copyright (C) 2004 by    Thomas Renninger                             *
*                              <[email protected]>                            *
*                 2004-2007   Danny Kukawka                               *
*                              <[email protected]>, <[email protected]> *
*                                                                         *
*   This program is free software; you can redistribute it and/or modify  *
*   it under the terms of version 2 of the GNU General Public License     *
*   as published by the Free Software Foundation.                         *
*                                                                         *
*   This program is distributed in the hope that it will be useful,       *
*   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
*   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
*   GNU General Public License for more details.                          *
*                                                                         *
*   You should have received a copy of the GNU General Public License     *
*   along with this program; if not, write to the                         *
*   Free Software Foundation, Inc.,                                       *
*   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.          *
***************************************************************************/

#include "kpowersave.h"
#include <kuniqueapplication.h>
#include <kaboutdata.h>
#include <kcmdlineargs.h>
#include <klocale.h>
#include <kiconloader.h>

#include "kpowersave_debug.h"

 /*! 
 *  \file 	main.cpp
 *  \brief 	The file with the \ref kdemain class to start kpowersave.
 */
/*!
 *  \class 	kdemain
 *  \brief 	The kpowersave kdemain class, which is the startpoint of KPowersave.
 *  \author     Thomas Renninger, <[email protected]>
 *  \author     Danny Kukawka, <[email protected]>, <[email protected]>
 *  \date       2004 - 2007
 */

static const char description[] = I18N_NOOP("TDE Frontend for Power Management, Battery Monitoring and Suspend");

KCmdLineOptions options[] = { { "force-acpi-check", I18N_NOOP("Force a new check for ACPI support"), 0 },
			      { "dbg-trace", I18N_NOOP("Trace function entry and leave points for debug\n"), 0 },	
			      { 0, 0, 0 }};

static const char version[] = "0.7.x (0.7.3)";
bool trace = false;

extern "C"
int kdemain(int argc, char **argv)
{
	KAboutData about("kpowersave", I18N_NOOP("KPowersave"), version, description,
			 KAboutData::License_GPL, I18N_NOOP("(c) 2004-2006, Danny Kukawka\n"
							    "(c) 2004 Thomas Renninger"));
	
	about.addAuthor("Danny Kukawka", I18N_NOOP("Current maintainer"), "[email protected]" );
	about.addAuthor("Thomas Renninger", 0, "[email protected]" );
	
	about.addCredit("Holger Macht", I18N_NOOP("Powersave developer and for D-Bus integration"), 
			"[email protected]");
	about.addCredit("Stefan Seyfried", I18N_NOOP("Powersave developer and tester"), 
			"[email protected]");
	about.addCredit("Daniel Gollub", I18N_NOOP("Added basic detailed dialog"), "[email protected]");
	about.addCredit("Michael Biebl", I18N_NOOP("Packaging Debian and Ubuntu"), "[email protected]");
	about.setBugAddress("[email protected]");
	about.setHomepage("http://sourceforge.net/projects/powersave");
	about.setTranslator("_: NAME OF TRANSLATORS\\nYour names","_: EMAIL OF TRANSLATORS\\nYour emails");

	KCmdLineArgs::init(argc, argv, &about);
	KCmdLineArgs::addCmdLineOptions (options);
	KUniqueApplication::addCmdLineOptions();

	KCmdLineArgs *args = KCmdLineArgs::parsedArgs();

	if (!KUniqueApplication::start()) {
		fprintf(stderr, "KPowersave is already running!\n");
		exit(0);
	}

	KUniqueApplication app;
	app.disableSessionManagement();

	kpowersave *mainWin = 0;

	mainWin = new kpowersave(args->isSet( "force-acpi-check" ), args->isSet( "dbg-trace" ));
	app.setMainWidget( mainWin );
	mainWin->show();

	// mainWin has WDestructiveClose flag by default, so it will delete itself.
	return app.exec();
}