File indexing completed on 2024-05-12 13:00:19
0001 /* This file is part of the KDE project 0002 SPDX-FileCopyrightText: 2001-2002 Lennart Kudling <kudling@kde.org> 0003 SPDX-FileCopyrightText: 2002, 2004 David Faure <faure@kde.org> 0004 SPDX-FileCopyrightText: 2003, 2005 Laurent Montel <montel@kde.org> 0005 SPDX-FileCopyrightText: 2003, 2007 Rob Buis <buis@kde.org> 0006 SPDX-FileCopyrightText: 2003 Stephan Binner <binner@kde.org> 0007 SPDX-FileCopyrightText: 2004 Waldo Bastian <bastian@kde.org> 0008 SPDX-FileCopyrightText: 2005 Thomas Zander <zander@kde.org> 0009 SPDX-FileCopyrightText: 2006 Inge Wallin <inge@lysator.liu.se> 0010 SPDX-FileCopyrightText: 2006 Jan Hambrecht <jaham@gmx.net> 0011 SPDX-FileCopyrightText: 2007 Chusslove Illich <caslav.ilic@gmx.net> 0012 0013 SPDX-License-Identifier: LGPL-2.0-or-later 0014 */ 0015 0016 #include "ui/splash/hi256-app-calligrakarbon.xpm" 0017 #include <QSplashScreen> 0018 #include <QHideEvent> 0019 #include <QLoggingCategory> 0020 0021 #include <KoApplication.h> 0022 #include <Calligra2Migration.h> 0023 0024 #include <KarbonFactory.h> 0025 #include <KarbonDocument.h> 0026 #include <ui/KarbonAboutData.h> 0027 0028 #ifdef MAINTANER_WANTED_SPLASH 0029 class KoSplashScreen : public QSplashScreen 0030 { 0031 public: 0032 explicit KoSplashScreen(const QPixmap& pixmap) : QSplashScreen(pixmap) {} 0033 0034 void hideEvent(QHideEvent *event) override 0035 { 0036 event->accept(); 0037 deleteLater(); 0038 } 0039 }; 0040 #endif 0041 0042 int main( int argc, char* argv[] ) 0043 { 0044 /** 0045 * Disable debug output by default, only log warnings. 0046 * Debug logs can be controlled by the environment variable QT_LOGGING_RULES. 0047 * 0048 * For example, to get full debug output, run the following: 0049 * QT_LOGGING_RULES="calligra.*=true" karbon 0050 * 0051 * See: http://doc.qt.io/qt-5/qloggingcategory.html 0052 */ 0053 QLoggingCategory::setFilterRules("calligra.*.debug=false\n" 0054 "calligra.*.warning=true"); 0055 0056 KoApplication app(KARBON_MIME_TYPE, QStringLiteral("calligrakarbon"), newKarbonAboutData, argc, argv); 0057 KLocalizedString::setApplicationDomain("karbon"); 0058 0059 // Migrate data from kde4 to kf5 locations 0060 Calligra2Migration m("karbon"); 0061 m.setConfigFiles(QStringList() << QStringLiteral("karbonrc")); 0062 m.setUiFiles(QStringList() << QStringLiteral("karbon.rc")<< QStringLiteral("karbon_readonly.rc")); 0063 m.migrate(); 0064 0065 if (!app.start()) { // parses command line args, create initial docs and mainwindows 0066 return 1; 0067 } 0068 0069 #ifdef MAINTANER_WANTED_SPLASH 0070 // After creating the KoApplication then create the pixmap from an xpm: we cannot get the 0071 // location of our datadir before we've started our components, 0072 // so use an xpm. 0073 QSplashScreen *splashScreen = new KoSplashScreen(QPixmap(splash_screen_xpm)); 0074 splashScreen->show(); 0075 splashScreen->showMessage("<p style=\"color:black\">" 0076 "<b>Calligra Karbon is unmaintained!</b><br><br>" 0077 "The Calligra community welcomes someone to take over.<br><br>" 0078 "See community.kde.org/Calligra</p>"); 0079 #endif 0080 0081 return app.exec(); 0082 }