summaryrefslogtreecommitdiffstats
path: root/src/main.cpp
blob: 792729fa6d73d463cfab943bc13f9844a7abbc1a (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

/***************************************************************************
*   Copyright (C) 2003-2005 by                                            *
*   Unai Garro ([email protected])                             *
*   Jason Kivlighn ([email protected])                                  *
*                                                                         *
*   This program is free software; you can redistribute it and/or modify  *
*   it under the terms of the GNU General Public License as published by  *
*   the Free Software Foundation; either version 2 of the License, or     *
*   (at your option) any later version.                                   *
***************************************************************************/

#include "krecipes.h"

#include <iostream>

#include <tdeuniqueapplication.h>
#include <tdeaboutdata.h>
#include <tdecmdlineargs.h>
#include <tdelocale.h>

#include "convert_sqlite3.h"

static const char *description =
    I18N_NOOP( "The TDE Cookbook" );

static const char *version = "1.0-beta1";

static TDECmdLineOptions options[] =
    {
        { "convert-sqlite3", I18N_NOOP("Convert the current SQLite 2.x database to SQLite 3 and exit") , 0 },
        { 0, 0, 0 }
    };

int main( int argc, char **argv )
{
	TDEAboutData about( "krecipes", I18N_NOOP( "Krecipes" ), version, description,
	                  TDEAboutData::License_GPL, I18N_NOOP( "(C) 2003 Unai Garro\n(C) 2004-2006 Jason Kivlighn\n\n___________\n\n\nThis product is RecipeML compatible.\n You can get more information about this file format in:\n http://www.formatdata.com/recipeml" ), 0, 0, "[email protected]" );
	about.addAuthor( "Unai Garro", 0, "[email protected]" );
	about.addAuthor( "Jason Kivlighn", 0, "[email protected]" );
	about.addAuthor( "Cyril Bosselut", 0, "[email protected]" );

	about.addCredit( "Colleen Beamer", I18N_NOOP("Testing, bug reports, suggestions"), "[email protected]" );

	about.setTranslator( I18N_NOOP( "INSERT YOUR NAME HERE" ), I18N_NOOP( "INSERT YOUR EMAIL ADDRESS" ) );
	TDECmdLineArgs::init( argc, argv, &about );
	TDECmdLineArgs::addCmdLineOptions( options );
	TDEUniqueApplication::addCmdLineOptions();

	if ( !TDEUniqueApplication::start() ) {
		std::cout << "Krecipes is already running!" << std::endl;
		return 0;
	}

	TDEUniqueApplication app;

	// see if we are starting with session management
	if ( app.isRestored() ) {
		RESTORE( Krecipes );
	}
	else {
		// no session.. just start up normally
		TDECmdLineArgs *args = TDECmdLineArgs::parsedArgs();

		TQApplication::flushX();

		if ( args->isSet("convert-sqlite3") ) {
			ConvertSQLite3();
			return 0;
		}

		Krecipes * widget = new Krecipes;
		app.setMainWidget( widget );
		widget->show();

		args->clear();
	}

	return app.exec();
}