Warning, file /office/calligra/braindump/src/main.cpp was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /*
0002  *  Copyright (c) 2009 Cyrille Berger <cberger@cberger.net>
0003  *
0004  * This library is free software; you can redistribute it and/or
0005  * modify it under the terms of the GNU Lesser General Public
0006  * License as published by the Free Software Foundation;
0007  * either version 2, or (at your option) any later version of the License.
0008  *
0009  * This library is distributed in the hope that it will be useful,
0010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0012  * Lesser General Public License for more details.
0013  *
0014  * You should have received a copy of the GNU Lesser General Public License
0015  * along with this library; see the file COPYING.  If not, write to
0016  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0017  * Boston, MA 02110-1301, USA.
0018  */
0019 
0020 
0021 #include <QApplication>
0022 #include <QCommandLineParser>
0023 #include <QLoggingCategory>
0024 
0025 #include <kiconloader.h>
0026 
0027 #include "AboutData.h"
0028 #include "MainWindow.h"
0029 #include "KoGlobal.h"
0030 #include "RootSection.h"
0031 #include "SectionsIO.h"
0032 
0033 #include <Calligra2Migration.h>
0034 
0035 int main(int argc, char **argv)
0036 {
0037     /**
0038      * Disable debug output by default, only log warnings.
0039      * Debug logs can be controlled by the environment variable QT_LOGGING_RULES.
0040      *
0041      * For example, to get full debug output, run the following:
0042      * QT_LOGGING_RULES="calligra.*=true" braindump
0043      *
0044      * See: http://doc.qt.io/qt-5/qloggingcategory.html
0045      */
0046     QLoggingCategory::setFilterRules("calligra.*.debug=false\n"
0047                                      "calligra.*.warning=true");
0048 
0049     QApplication app(argc, argv);
0050 
0051     // Migrate data from kde4 to kf5 locations
0052     Calligra2Migration m("braindump");
0053     m.setConfigFiles(QStringList() << QStringLiteral("braindumprc"));
0054     m.setUiFiles(QStringList() << QStringLiteral("braindumpview.rc"));
0055     m.migrate();
0056 
0057     KAboutData about = newBrainDumpAboutData();
0058     KAboutData::setApplicationData(about);
0059 
0060     QCommandLineParser parser;
0061     about.setupCommandLine(&parser);
0062 
0063     parser.process(app);
0064 
0065     about.processCommandLine(&parser);
0066 
0067     KIconLoader::global()->addAppDir("calligra");
0068     KoGlobal::initialize();
0069 
0070     RootSection* doc = new RootSection;
0071 
0072     MainWindow* window = new MainWindow(doc);
0073     window->setVisible(true);
0074 
0075     app.exec();
0076 
0077     // Ensure the root section is saved
0078     doc->sectionsIO()->save();
0079 
0080     delete doc;
0081     app.exit(0);
0082 }