File indexing completed on 2024-04-28 03:51:00

0001 /****************************************************************************
0002 **
0003 ** Copyright (C) 2016 by Sandro S. Andrade <sandroandrade@kde.org>
0004 **
0005 ** This program is free software; you can redistribute it and/or
0006 ** modify it under the terms of the GNU General Public License as
0007 ** published by the Free Software Foundation; either version 2 of
0008 ** the License or (at your option) version 3 or any later version
0009 ** accepted by the membership of KDE e.V. (or its successor approved
0010 ** by the membership of KDE e.V.), which shall act as a proxy
0011 ** defined in Section 14 of version 3 of the license.
0012 **
0013 ** This program is distributed in the hope that it will be useful,
0014 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
0015 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0016 ** GNU General Public License for more details.
0017 **
0018 ** You should have received a copy of the GNU General Public License
0019 ** along with this program.  If not, see <http://www.gnu.org/licenses/>.
0020 **
0021 ****************************************************************************/
0022 
0023 #include "core.h"
0024 #include <app/minuet_version.h>
0025 
0026 #if !defined(Q_OS_ANDROID)
0027 #include <KAboutData>
0028 #include <KCrash>
0029 #include <KLocalizedString>
0030 #endif
0031 
0032 #include <QCommandLineParser>
0033 #include <QDir>
0034 #include <QFile>
0035 #include <QGuiApplication>
0036 #include <QIcon>
0037 
0038 #include <QDebug>
0039 
0040 int main(int argc, char *argv[])
0041 {
0042 #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
0043     QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
0044 #endif
0045     QGuiApplication application(argc, argv);
0046 
0047 #if !defined(Q_OS_ANDROID)
0048     KCrash::initialize();
0049 
0050     KLocalizedString::setApplicationDomain("minuet");
0051 
0052     KAboutData aboutData(QStringLiteral("minuet"), i18n("Minuet"),
0053                          QStringLiteral(MINUET_VERSION_STRING),
0054                          i18n("A KDE application for music education"), KAboutLicense::GPL,
0055                          i18n("(c) 2016, Sandro S. Andrade (sandroandrade@kde.org)"));
0056     aboutData.addAuthor(QStringLiteral("Sandro S. Andrade"), i18n("Developer"),
0057                         QStringLiteral("sandroandrade@kde.org"));
0058     aboutData.addAuthor(QStringLiteral("Ayush Shah"), i18n("Developer"),
0059                         QStringLiteral("1595ayush@gmail.com"));
0060     aboutData.addAuthor(QStringLiteral("Alessandro Longo"), i18n("Minuet Icon Designer"),
0061                         QStringLiteral("alessandro.longo@kdemail.net"));
0062 #endif
0063 
0064     QGuiApplication::setWindowIcon(QIcon(QStringLiteral(":/minuet.png")));
0065 
0066     QCommandLineParser parser;
0067 #if !defined(Q_OS_ANDROID)
0068     KAboutData::setApplicationData(aboutData);
0069     aboutData.setupCommandLine(&parser);
0070 #else
0071     parser.addHelpOption();
0072     parser.addVersionOption();
0073 #endif
0074     parser.process(application);
0075 #if !defined(Q_OS_ANDROID)
0076     aboutData.processCommandLine(&parser);
0077 #endif
0078 
0079 #if defined(Q_OS_ANDROID)
0080     if (!QFile("/data/data/org.kde.minuet/files/sf_GMbank.sf2").exists()) {
0081         if (QFile("assets:/share/sf_GMbank.sf2")
0082                 .copy("/data/data/org.kde.minuet/files/sf_GMbank.sf2"))
0083             qDebug() << "COPIED "
0084                      << QFileInfo("/data/data/org.kde.minuet/files/sf_GMbank.sf2").size()
0085                      << "b soundfound file to /data/data/org.kde.minuet/files/sf_GMbank.sf2";
0086     }
0087 #endif
0088     Minuet::Core::initialize();
0089 
0090     return QGuiApplication::exec();
0091 }