File indexing completed on 2024-05-05 04:05:12

0001 /***************************************************************************
0002                           main.cpp  -  description
0003                              -------------------
0004     begin                : mer jui 11 22:27:28 EDT 2001
0005     copyright            : (C) 2001 by Gaël de Chalendar
0006     email                : Gael.de.Chalendar@free.fr
0007 
0008 This is the standard main function of a KDE application 
0009 
0010    KsirK is free software; you can redistribute it and/or
0011    modify it under the terms of the GNU General Public
0012    License as published by the Free Software Foundation, either version 2
0013    of the License, or (at your option) any later version.
0014 
0015    This program is distributed in the hope that it will be useful,
0016    but WITHOUT ANY WARRANTY; without even the implied warranty of
0017    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0018    General Public License for more details.
0019 
0020    You should have received a copy of the GNU General Public License
0021    along with this program; if not, write to the Free Software
0022    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
0023    02110-1301, USA
0024 
0025 ***************************************************************************/
0026 
0027 #include "mainwindow.h"
0028 
0029 #include <KAboutData>
0030 #include <KCrash>
0031 #include <KDBusService>
0032 #include <KLocalizedString>
0033 
0034 #include "ksirkskineditor_debug.h"
0035 
0036 #include "../ksirk_version.h"
0037 
0038 #include <KToolBar>
0039 #include <QApplication>
0040 #include <QCommandLineParser>
0041 #include <QCommandLineOption>
0042 
0043 int main(int argc, char *argv[])
0044 {
0045   qCDebug(KSIRKSKINEDITOR_LOG) << "Hello World!";
0046 
0047   QApplication app(argc, argv);
0048   KLocalizedString::setApplicationDomain(QByteArrayLiteral("ksirkskineditor"));
0049 
0050   KAboutData aboutData(
0051     QStringLiteral("ksirkskineditor"),
0052     i18n("KsirK Skin Editor"),
0053     QStringLiteral(KSIRK_VERSION_STRING),
0054     i18n("KsirK Skin Editor"),
0055     KAboutLicense::GPL,
0056     i18n("(c) 2008, Gaël de Chalendar\n"),
0057     i18n("For help and user manual, please see\nThe KsirK Web site"),
0058     QStringLiteral("https://apps.kde.org/ksirk"));
0059   aboutData.addAuthor(i18n("Gaël de Chalendar aka Kleag"),QString(), QStringLiteral("kleag@free.fr"));
0060 
0061     KAboutData::setApplicationData(aboutData);
0062     QApplication::setWindowIcon(QIcon::fromTheme(QStringLiteral("preferences-desktop-locale")));
0063 
0064     KCrash::initialize();
0065 
0066     QCommandLineParser parser;
0067     parser.addOption(QCommandLineOption({QStringLiteral("+[File]")}, i18n("file to open")));
0068     aboutData.setupCommandLine(&parser);
0069     parser.process(app);
0070     aboutData.processCommandLine(&parser);
0071 
0072     KDBusService service;
0073 
0074   if (app.isSessionRestored())
0075   {
0076       kRestoreMainWindows<KsirkSkinEditor::MainWindow>();
0077   }
0078   else
0079   {
0080     qCDebug(KSIRKSKINEDITOR_LOG) << "Creating main window";
0081     KsirkSkinEditor::MainWindow *ksirkskineditor = new KsirkSkinEditor::MainWindow();
0082     ksirkskineditor->show();
0083   }
0084   qCDebug(KSIRKSKINEDITOR_LOG) << "Executing app";
0085   return app.exec();
0086 }