]> git.sesse.net Git - kdenlive/blob - src/main.cpp
get ready for 0.7.2 release
[kdenlive] / src / main.cpp
1 /***************************************************************************
2  *   Copyright (C) 2007 by Marco Gittler (g.marco@freenet.de)              *
3  *   Copyright (C) 2008 by Jean-Baptiste Mardelle (jb@kdenlive.org)        *
4  *                                                                         *
5  *   This program is free software; you can redistribute it and/or modify  *
6  *   it under the terms of the GNU General Public License as published by  *
7  *   the Free Software Foundation; either version 2 of the License, or     *
8  *   (at your option) any later version.                                   *
9  *                                                                         *
10  *   This program is distributed in the hope that it will be useful,       *
11  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
12  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
13  *   GNU General Public License for more details.                          *
14  *                                                                         *
15  *   You should have received a copy of the GNU General Public License     *
16  *   along with this program; if not, write to the                         *
17  *   Free Software Foundation, Inc.,                                       *
18  *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA          *
19  ***************************************************************************/
20
21 #include <KApplication>
22 #include <KAboutData>
23 #include <KDebug>
24 #include <KCmdLineArgs>
25 #include <KUrl> //new
26
27 #include "mainwindow.h"
28
29 #ifdef __APPLE_KDE__ || __DARWIN__
30 #include <SDL/SDL.h>
31 #endif
32
33 int main(int argc, char *argv[]) {
34     KAboutData aboutData(QByteArray("kdenlive"), QByteArray("kdenlive"),
35                          ki18n("Kdenlive"), QByteArray("0.7.2"),
36                          ki18n("An open source video editor."),
37                          KAboutData::License_GPL,
38                          ki18n("Copyright (c) 2008 Development team"));
39     aboutData.addAuthor(ki18n("Jean-Baptiste Mardelle"), ki18n("MLT porting, KDE4 porting, Main developer"), "jb@kdenlive.org");
40     aboutData.addAuthor(ki18n("Marco Gittler"), ki18n("MLT Connection, Transition, Effect, Timeline Developer"), "g.marco@freenet.de");
41     aboutData.setHomepage("http://kdenlive.org");
42     aboutData.setCustomAuthorText(ki18n("Please report bugs to http://kdenlive.org/mantis"), ki18n("Please report bugs to <a href=\"http://kdenlive.org/mantis\">http://kdenlive.org/mantis</a>"));
43     aboutData.setTranslator(ki18n("NAME OF TRANSLATORS"), ki18n("EMAIL OF TRANSLATORS"));
44
45     KCmdLineArgs::init(argc, argv, &aboutData);
46
47     KCmdLineOptions options;
48     options.add("mlt-path <path>", ki18n("Set the path for MLT environnement"));
49     options.add("+[file]", ki18n("Document to open")); //new
50     KCmdLineArgs::addCmdLineOptions(options); //new
51
52     KApplication app;
53
54     // see if we are starting with session management
55     if (app.isSessionRestored()) {
56         int n = 1;
57         while (KMainWindow::canBeRestored(n)) {
58             const QString className = KXmlGuiWindow::classNameOfToplevel(n);
59             if (className == QLatin1String("MainWindow")) {
60                 MainWindow* win = new MainWindow();
61                 win->restore(n);
62             } else {
63                 kWarning() << "Unknown class " << className << " in session saved data!";
64             }
65             ++n;
66         }
67     } else {
68         KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); //new
69
70         QString mltPath = args->getOption("mlt-path");
71         KUrl url;
72         if (args->count()) {
73             url = args->url(0);
74         }
75         MainWindow* window = new MainWindow(mltPath, url);
76         window->show();
77
78         args->clear();
79     }
80
81     return app.exec();
82 }