File indexing completed on 2024-11-17 04:20:15
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 #include <MauiKit3/Calendar/moduleinfo.h> 0010 0011 #include <KAboutData> 0012 #include <KI18n/KLocalizedString> 0013 0014 #include "../project_version.h" 0015 0016 //Useful for setting quickly an app template 0017 #define ORG_NAME "Maui" 0018 #define PROJECT_NAME "Agenda" 0019 #define COMPONENT_NAME "agenda" 0020 #define PROJECT_DESCRIPTION "View and organize your events" 0021 0022 #define PRODUCT_NAME "maui/agenda" 0023 #define PROJECT_PAGE "https://mauikit.org" 0024 #define REPORT_PAGE "https://invent.kde.org/maui/index-fm/-/issues" 0025 0026 int main(int argc, char *argv[]) 0027 { 0028 QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); 0029 0030 QApplication app(argc, argv); 0031 0032 app.setOrganizationName(QStringLiteral(ORG_NAME)); 0033 app.setWindowIcon(QIcon(":/logo.png")); 0034 0035 KLocalizedString::setApplicationDomain(COMPONENT_NAME); 0036 0037 KAboutData about(QStringLiteral(COMPONENT_NAME), 0038 QStringLiteral(PROJECT_NAME), 0039 PROJECT_VERSION_STRING, 0040 i18n(PROJECT_DESCRIPTION), 0041 KAboutLicense::LGPL_V3, 0042 APP_COPYRIGHT_NOTICE, 0043 QString(GIT_BRANCH) + "/" + QString(GIT_COMMIT_HASH)); 0044 0045 about.addAuthor(QStringLiteral("Camilo Higuita"), i18n("Developer"), QStringLiteral("milo.h@aol.com")); 0046 0047 about.setHomepage(PROJECT_PAGE); 0048 about.setProductName(PRODUCT_NAME); 0049 about.setBugAddress(REPORT_PAGE); 0050 about.setOrganizationDomain(PROJECT_URI); 0051 about.setProgramLogo(app.windowIcon()); 0052 0053 about.addCredit(i18n("Kalendar Developers")); 0054 0055 const auto AkonadiData = MauiKitCalendar::aboutAkonadi(); 0056 about.addComponent(AkonadiData.name(), "", AkonadiData.version(), AkonadiData.webAddress()); 0057 0058 const auto CalData = MauiKitCalendar::aboutData(); 0059 about.addComponent(CalData.name(), MauiKitCalendar::buildVersion(), CalData.version(), CalData.webAddress()); 0060 0061 KAboutData::setApplicationData(about); 0062 MauiApp::instance()->setIconName("qrc:/logo.svg"); 0063 0064 QCommandLineParser parser; 0065 parser.setApplicationDescription(about.shortDescription()); 0066 parser.process(app); 0067 about.processCommandLine(&parser); 0068 0069 QQmlApplicationEngine engine; 0070 0071 engine.rootContext()->setContextObject(new KLocalizedContext(&engine)); 0072 0073 const QUrl url(QStringLiteral("qrc:/main.qml")); 0074 QObject::connect(&engine, &QQmlApplicationEngine::objectCreated, 0075 &app, [url](QObject *obj, const QUrl &objUrl) { 0076 if (!obj && url == objUrl) 0077 QCoreApplication::exit(-1); 0078 }, Qt::QueuedConnection); 0079 engine.load(url); 0080 0081 return app.exec(); 0082 }