File indexing completed on 2024-11-24 04:18:34
0001 #include <QApplication> 0002 #include <QQmlApplicationEngine> 0003 #include <QCommandLineParser> 0004 #include <QDate> 0005 #include <QIcon> 0006 #include <QQmlContext> 0007 0008 #include <MauiKit3/Core/mauiapp.h> 0009 0010 #include <KAboutData> 0011 #include <KI18n/KLocalizedString> 0012 0013 #include "../project_version.h" 0014 0015 #include "code/compressedfile.h" 0016 #include "code/arca.h" 0017 0018 //Useful for setting quickly an app template 0019 #define ORG_NAME "Maui" 0020 #define PROJECT_NAME "Arca" 0021 #define COMPONENT_NAME "arca" 0022 #define PROJECT_DESCRIPTION "Archive manager and explorer." 0023 #define PROJECT_YEAR "2022" 0024 #define PRODUCT_NAME "maui/arca" 0025 #define PROJECT_PAGE "https://mauikit.org" 0026 #define REPORT_PAGE "https://github.com/Nitrux/arca/issues/new" 0027 0028 int main(int argc, char *argv[]) 0029 { 0030 QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); 0031 0032 QApplication app(argc, argv); 0033 0034 app.setOrganizationName(QStringLiteral(ORG_NAME)); 0035 app.setWindowIcon(QIcon(":/logo.png")); 0036 0037 0038 KLocalizedString::setApplicationDomain(COMPONENT_NAME); 0039 0040 KAboutData about(QStringLiteral(COMPONENT_NAME), i18n(PROJECT_NAME), PROJECT_VERSION_STRING, i18n(PROJECT_DESCRIPTION), 0041 KAboutLicense::LGPL_V3, QString("© %1-%2 %3 Development Team").arg(PROJECT_YEAR, QString::number(QDate::currentDate().year()), ORG_NAME), QString(GIT_BRANCH) + "/" + QString(GIT_COMMIT_HASH)); 0042 0043 about.addAuthor(i18n("Camilo Higuita"), i18n("Developer"), QStringLiteral("milo.h@aol.com")); 0044 0045 about.setHomepage(PROJECT_PAGE); 0046 about.setProductName(PRODUCT_NAME); 0047 about.setBugAddress(REPORT_PAGE); 0048 about.setOrganizationDomain(PROJECT_URI); 0049 about.setProgramLogo(app.windowIcon()); 0050 0051 KAboutData::setApplicationData(about); 0052 MauiApp::instance()->setIconName("qrc:/logo.svg"); 0053 0054 QCommandLineParser parser; 0055 parser.setApplicationDescription(about.shortDescription()); 0056 parser.process(app); 0057 about.processCommandLine(&parser); 0058 0059 QQmlApplicationEngine engine; 0060 engine.rootContext()->setContextObject(new KLocalizedContext(&engine)); 0061 0062 const QUrl url(QStringLiteral("qrc:/main.qml")); 0063 QObject::connect(&engine, &QQmlApplicationEngine::objectCreated, 0064 &app, [url](QObject *obj, const QUrl &objUrl) { 0065 if (!obj && url == objUrl) 0066 QCoreApplication::exit(-1); 0067 }, Qt::QueuedConnection); 0068 0069 0070 engine.rootContext()->setContextObject(new KLocalizedContext(&engine)); 0071 0072 qmlRegisterSingletonInstance<Arca>(PROJECT_URI, 1, 0, "Arc", Arca::instance()); 0073 qmlRegisterType<CompressedFile>(PROJECT_URI, 1, 0, "CompressedFile"); 0074 0075 engine.load(url); 0076 0077 return app.exec(); 0078 }