]> git.sesse.net Git - kdenlive/blob - src/main.cpp
* Fix several transition move problems
[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 int main(int argc, char *argv[]) {
30     KAboutData aboutData(QByteArray("kdenlive"), QByteArray("kdenlive"),
31                          ki18n("Kdenlive"), QByteArray("0.7.1"),
32                          ki18n("An open source video editor."),
33                          KAboutData::License_GPL,
34                          ki18n("Copyright (c) 2008 Development team"));
35     aboutData.addAuthor(ki18n("Jean-Baptiste Mardelle"), ki18n("Mlt porting, KDE4 porting, Main developer"), "jb@kdenlive.org");
36     aboutData.addAuthor(ki18n("Marco Gittler"), ki18n("Mlt Connection, Transition, Effect, Timeline Developer"), "g.marco@freenet.de");
37     aboutData.setHomepage("http://kdenlive.org");
38     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>"));
39     aboutData.setTranslator(ki18n("NAME OF TRANSLATORS"), ki18n("EMAIL OF TRANSLATORS"));
40
41     KCmdLineArgs::init(argc, argv, &aboutData);
42
43     KCmdLineOptions options;
44     options.add("mlt-path <path>", ki18n("Set the path for MLT environnement"));
45     options.add("+[file]", ki18n("Document to open")); //new
46     KCmdLineArgs::addCmdLineOptions(options); //new
47
48     KApplication app;
49
50     // see if we are starting with session management
51     if (app.isSessionRestored()) {
52         int n = 1;
53         while (KMainWindow::canBeRestored(n)) {
54             const QString className = KXmlGuiWindow::classNameOfToplevel(n);
55             if (className == QLatin1String("MainWindow")) {
56                 MainWindow* win = new MainWindow();
57                 win->restore(n);
58             } else {
59                 kWarning() << "Unknown class " << className << " in session saved data!";
60             }
61             ++n;
62         }
63     } else {
64         KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); //new
65
66         QString mltPath = args->getOption("mlt-path");
67         KUrl url;
68         if (args->count()) {
69             url = args->url(0);
70         }
71         MainWindow* window = new MainWindow(mltPath, url);
72         window->show();
73
74         args->clear();
75     }
76
77     return app.exec();
78 }