]> git.sesse.net Git - kdenlive/blob - src/main.cpp
clean encoding profiles using MLT presets & profiles
[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 "config-kdenlive.h"
22 #include "mainwindow.h"
23
24 #include <KApplication>
25 #include <KAboutData>
26 #include <KDebug>
27 #include <KCmdLineArgs>
28 #include <KUrl> //new
29
30
31 int main(int argc, char *argv[])
32 {
33     KAboutData aboutData(QByteArray("kdenlive"), QByteArray("kdenlive"),
34                          ki18n("Kdenlive"), VERSION,
35                          ki18n("An open source video editor."),
36                          KAboutData::License_GPL,
37                          ki18n("Copyright © 2007–2014 Kdenlive authors"));
38     aboutData.addAuthor(ki18n("Jean-Baptiste Mardelle"), ki18n("MLT and KDE SC 4 porting, main developer and maintainer"), "jb@kdenlive.org");
39     aboutData.addAuthor(ki18n("Vincent Pinon"), ki18n("Interim maintainer, bugs fixing, minor functions, profiles updates, etc."), "vpinon@april.org");
40     aboutData.addAuthor(ki18n("Laurent Montel"), ki18n("Bugs fixing, clean up code, optimization etc."), "montel@kde.org");
41     aboutData.addAuthor(ki18n("Marco Gittler"), ki18n("MLT transitions and effects, timeline, audio thumbs"), "g.marco@freenet.de");
42     aboutData.addAuthor(ki18n("Dan Dennedy"), ki18n("Bug fixing, etc."), "dan@dennedy.org");
43     aboutData.addAuthor(ki18n("Simon A. Eugster"), ki18n("Color scopes, bug fixing, etc."), "simon.eu@gmail.com");
44     aboutData.addAuthor(ki18n("Till Theato"), ki18n("Bug fixing, etc."), "root@ttill.de");
45     aboutData.addAuthor(ki18n("Alberto Villa"), ki18n("Bug fixing, logo, etc."), "avilla@FreeBSD.org");
46     aboutData.addAuthor(ki18n("Jean-Michel Poure"), ki18n("Rendering profiles customization"), "jm@poure.com");
47     aboutData.addAuthor(ki18n("Ray Lehtiniemi"), ki18n("Bug fixing, etc."), "rayl@mail.com");
48     aboutData.addAuthor(ki18n("Jason Wood"), ki18n("Original KDE 3 version author (not active anymore)"), "jasonwood@blueyonder.co.uk");
49     aboutData.setHomepage("http://kdenlive.org");
50     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>"));
51     aboutData.setTranslator(ki18n("NAME OF TRANSLATORS"), ki18n("EMAIL OF TRANSLATORS"));
52     aboutData.setBugAddress("http://kdenlive.org/mantis");
53
54     KCmdLineArgs::init(argc, argv, &aboutData);
55
56     KCmdLineOptions options;
57     options.add("mlt-path <path>", ki18n("Set the path for MLT environment"));
58     options.add("+[file]", ki18n("Document to open")); //new
59     options.add("i <clips>", ki18n("Comma separated list of clips to add")); //new
60     KCmdLineArgs::addCmdLineOptions(options); //new
61
62     KApplication app;
63     MainWindow* window = 0;
64
65     // see if we are starting with session management
66     if (app.isSessionRestored()) {
67         int n = 1;
68         while (KMainWindow::canBeRestored(n)) {
69             const QString className = KXmlGuiWindow::classNameOfToplevel(n);
70             if (className == QLatin1String("MainWindow")) {
71                 window = new MainWindow();
72                 window->restore(n);
73             } else {
74                 kWarning() << "Unknown class " << className << " in session saved data!";
75             }
76             ++n;
77         }
78     } else {
79         KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); //new
80         QString clipsToLoad = args->getOption("i");
81         QString mltPath = args->getOption("mlt-path");
82         KUrl url;
83         if (args->count()) {
84             url = args->url(0);
85         }
86         window = new MainWindow(mltPath, url, clipsToLoad);
87         window->show();
88
89         args->clear();
90     }
91     int result = app.exec();
92     return result;
93 }