1
/* ****************************************************************************
2
This file is part of KAider
4
Copyright (C) 2007 by Nick Shaforostoff <shafff@ukr.net>
6
This program is free software; you can redistribute it and/or modify
7
it under the terms of the GNU General Public License as published by
8
the Free Software Foundation; either version 2 of the License, or
9
(at your option) any later version.
11
This program is distributed in the hope that it will be useful,
12
but WITHOUT ANY WARRANTY; without even the implied warranty of
13
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
GNU General Public License for more details.
16
You should have received a copy of the GNU General Public License
17
along with this program; if not, write to the Free Software
18
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20
In addition, as a special exception, the copyright holders give
21
permission to link the code of this program with any edition of
22
the Qt library by Trolltech AS, Norway (or with modified versions
23
of Qt that use the same license as Qt), and distribute linked
24
combinations including the two. You must obey the GNU General
25
Public License in all respects for all of the code used other than
26
Qt. If you modify this file, you may extend this exception to
27
your version of the file, but you are not obligated to do so. If
28
you do not wish to do so, delete this exception statement from
31
**************************************************************************** */
40
#include <kapplication.h>
41
#include <kaboutdata.h>
42
#include <kcmdlineargs.h>
45
#include <threadweaver/ThreadWeaver.h>
47
static const char version[] = KAIDER_VERSION;
48
static const char description[] =
49
I18N_NOOP("Computer-aided translation system.\nDon't translate what had already been translated!");
51
int main(int argc, char **argv)
53
KAboutData about("lokalize", 0, ki18nc("@title", "Lokalize"), version, ki18n(description),
54
KAboutData::License_GPL, ki18nc("@info:credit", "(c) 2007-2008 Nick Shaforostoff\n(c) 1999-2006 The KBabel developers") /*, KLocalizedString(), 0, "shafff@ukr.net"*/);
55
about.addAuthor( ki18n("Nick Shaforostoff"), KLocalizedString(), "shaforostoff@kde.ru" );
56
about.addCredit (ki18n("Google Inc."), ki18n("sponsored development as part of Google Summer Of Code program"), QByteArray(), "http://google.com");
57
about.addCredit (ki18n("Stephan Johach"), ki18n("bug fixing patches"), "hunsum@gmx.de");
58
KCmdLineArgs::init(argc, argv, &about);
60
KCmdLineOptions options;
61
options.add("merge-source <URL>", ki18n( "Source for the merge mode" ));
62
options.add("project <filename>", ki18n( "Project file. "
63
"Opens specified project-file in Project Manager if no translation files specified" ));
64
options.add("+[URL]", ki18n( "Document to open" ));
65
KCmdLineArgs::addCmdLineOptions(options);
69
// see if we are starting with session management
70
if (app.isSessionRestored())
76
// no session.. just start up normally
77
KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
79
if (!args->getOption("project").isEmpty())
81
QString path = args->getOption("project").toUtf8();
82
// load needs an absolute path
83
// FIXME: I do not know how to handle urls here
84
QFileInfo info( path );
85
Project::instance()->load( info.absoluteFilePath() );
87
if (args->count() == 0)
89
if(Project::instance()->isLoaded())
91
Project::instance()->openProjectWindow();
99
KAider *widget = new KAider;
100
widget->fileOpen(args->url(0));
101
if (!args->getOption("merge-source").isEmpty())
102
widget->mergeOpen(KCmdLineArgs::makeURL(args->getOption("merge-source").toUtf8()));
103
// KUrl a(args->arg(0));
104
// QMetaObject::invokeMethod(widget,
105
// SLOT(fileOpen(KUrl)),
106
// Qt::QueuedConnection,
115
if (Project::instance()->isLoaded())
117
ThreadWeaver::Weaver::instance()->dequeue();
119
kWarning()<<"Finishing jobs...";
120
Project::instance()->save();
121
/* CloseDBJob* closeDBJob=new CloseDBJob(Project::instance()->id(),Project::instance());
122
// connect(closeDBJob,SIGNAL(failed(ThreadWeaver::Job*)),Project::instance(),SLOT(deleteScanJob(ThreadWeaver::Job*)));
123
// connect(closeDBJob,SIGNAL(done(ThreadWeaver::Job*)),Project::instance(),SLOT(deleteScanJob(ThreadWeaver::Job*)));
124
ThreadWeaver::Weaver::instance()->enqueue(closeDBJob);*/
125
ThreadWeaver::Weaver::instance()->finish();