File indexing completed on 2024-04-28 16:16:03

0001 /* This file is part of the KDE project
0002    Copyright (C) 2001-2002 Lennart Kudling <kudling@kde.org>
0003    Copyright (C) 2002,2004 David Faure <faure@kde.org>
0004    Copyright (C) 2003,2005 Laurent Montel <montel@kde.org>
0005    Copyright (C) 2003,2007 Rob Buis <buis@kde.org>
0006    Copyright (C) 2003 Stephan Binner <binner@kde.org>
0007    Copyright (C) 2004 Waldo Bastian <bastian@kde.org>
0008    Copyright (C) 2005 Thomas Zander <zander@kde.org>
0009    Copyright (C) 2006 Inge Wallin <inge@lysator.liu.se>
0010    Copyright (C) 2006 Jan Hambrecht <jaham@gmx.net>
0011    Copyright (C) 2007 Chusslove Illich <caslav.ilic@gmx.net>
0012 
0013    This library is free software; you can redistribute it and/or
0014    modify it under the terms of the GNU Library General Public
0015    License as published by the Free Software Foundation; either
0016    version 2 of the License, or (at your option) any later version.
0017 
0018    This library is distributed in the hope that it will be useful,
0019    but WITHOUT ANY WARRANTY; without even the implied warranty of
0020    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0021    Library General Public License for more details.
0022 
0023    You should have received a copy of the GNU Library General Public License
0024    along with this library; see the file COPYING.LIB.  If not, write to
0025    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0026  * Boston, MA 02110-1301, USA.
0027 */
0028 
0029 #include "ui/splash/hi256-app-calligrakarbon.xpm"
0030 #include <QSplashScreen>
0031 #include <QHideEvent>
0032 #include <QLoggingCategory>
0033 
0034 #include <KoApplication.h>
0035 #include <Calligra2Migration.h>
0036 
0037 #include <KarbonFactory.h>
0038 #include <KarbonDocument.h>
0039 #include <ui/KarbonAboutData.h>
0040 
0041 #ifdef MAINTANER_WANTED_SPLASH
0042 class KoSplashScreen : public QSplashScreen
0043 {
0044 public:
0045     explicit KoSplashScreen(const QPixmap& pixmap) : QSplashScreen(pixmap) {}
0046 
0047     void hideEvent(QHideEvent *event) override
0048     {
0049         event->accept();
0050         deleteLater();
0051     }
0052 };
0053 #endif
0054 
0055 extern "C" Q_DECL_EXPORT int kdemain( int argc, char* argv[] )
0056 {
0057     /**
0058      * Disable debug output by default, only log warnings.
0059      * Debug logs can be controlled by the environment variable QT_LOGGING_RULES.
0060      *
0061      * For example, to get full debug output, run the following:
0062      * QT_LOGGING_RULES="calligra.*=true" karbon
0063      *
0064      * See: http://doc.qt.io/qt-5/qloggingcategory.html
0065      */
0066     QLoggingCategory::setFilterRules("calligra.*.debug=false\n"
0067                                      "calligra.*.warning=true");
0068 
0069     KoApplication app(KARBON_MIME_TYPE, QStringLiteral("calligrakarbon"), newKarbonAboutData, argc, argv);
0070 
0071     // Migrate data from kde4 to kf5 locations
0072     Calligra2Migration m("karbon");
0073     m.setConfigFiles(QStringList() << QStringLiteral("karbonrc"));
0074     m.setUiFiles(QStringList() << QStringLiteral("karbon.rc")<< QStringLiteral("karbon_readonly.rc"));
0075     m.migrate();
0076 
0077     if (!app.start()) {  // parses command line args, create initial docs and mainwindows
0078         return 1;
0079     }
0080 
0081 #ifdef MAINTANER_WANTED_SPLASH
0082     // After creating the KoApplication then create the pixmap from an xpm: we cannot get the
0083     // location of our datadir before we've started our components,
0084     // so use an xpm.
0085     QSplashScreen *splashScreen = new KoSplashScreen(QPixmap(splash_screen_xpm));
0086     splashScreen->show();
0087     splashScreen->showMessage("<p style=\"color:black\">"
0088     "<b>Calligra Karbon is unmaintained!</b><br><br>"
0089     "The Calligra community welcomes someone to take over.<br><br>"
0090     "See community.kde.org/Calligra</p>");
0091 #endif
0092 
0093     return app.exec();
0094 }