diff --git a/CMakeLists.txt b/CMakeLists.txt index bc4e7cff7..90ab0aacb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -19,8 +19,13 @@ include(KDEClangFormat) include(KDECMakeSettings) include(KDECompilerSettings NO_POLICY_SCOPE) +ecm_setup_version(0.1.0 + VARIABLE_PREFIX NEOCHAT + VERSION_HEADER ${CMAKE_CURRENT_BINARY_DIR}/neochat-version.h +) + find_package(Qt5 ${QT_MIN_VERSION} REQUIRED NO_MODULE COMPONENTS Widgets Core Quick Gui QuickControls2 Multimedia Svg) -find_package(KF5 ${REQUIRED_KF5_VERSION} REQUIRED COMPONENTS Kirigami2 ItemModels I18n Notifications Config) +find_package(KF5 ${REQUIRED_KF5_VERSION} REQUIRED COMPONENTS Kirigami2 ItemModels I18n Notifications Config CoreAddons) if(ANDROID) find_package(OpenSSL REQUIRED) diff --git a/qml/main.qml b/qml/main.qml index d571eb1f8..038fe4702 100644 --- a/qml/main.qml +++ b/qml/main.qml @@ -25,6 +25,25 @@ Kirigami.ApplicationWindow { handleVisible: enabled && (pageStack.currentItem instanceof RoomPage) } + globalDrawer: Kirigami.GlobalDrawer { + isMenu: true + actions: [ + Kirigami.Action { + text: i18n("About Neochat") + iconName: "help-about" + onTriggered: pageStack.layers.push(aboutPage) + enabled: pageStack.layers.currentItem.title !== i18n("About") + } + ] + } + + Component { + id: aboutPage + Kirigami.AboutPage { + aboutData: Controller.aboutData + } + } + pageStack.initialPage: LoadingPage {} Component { diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index f694be8ec..eb693b5de 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -18,7 +18,8 @@ add_executable(neochat ../res.qrc ) -target_link_libraries(neochat PRIVATE Qt5::Quick Qt5::Qml Qt5::Gui Qt5::Network Qt5::QuickControls2 KF5::I18n KF5::Kirigami2 KF5::Notifications KF5::ConfigCore Quotient cmark::cmark) +target_include_directories(neochat PRIVATE ${CMAKE_BINARY_DIR}) +target_link_libraries(neochat PRIVATE Qt5::Quick Qt5::Qml Qt5::Gui Qt5::Network Qt5::QuickControls2 KF5::I18n KF5::Kirigami2 KF5::Notifications KF5::ConfigCore KF5::CoreAddons Quotient cmark::cmark) if(ANDROID) target_link_libraries(neochat PRIVATE Qt5::Svg OpenSSL::SSL) diff --git a/src/controller.cpp b/src/controller.cpp index 58605936e..2f7c87d04 100644 --- a/src/controller.cpp +++ b/src/controller.cpp @@ -414,3 +414,14 @@ void Controller::markAllMessagesAsRead(Connection *conn) room->markAllMessagesAsRead(); } } + +void Controller::setAboutData(KAboutData aboutData) +{ + m_aboutData = aboutData; + Q_EMIT aboutDataChanged(); +} + +KAboutData Controller::aboutData() const +{ + return m_aboutData; +} diff --git a/src/controller.h b/src/controller.h index 5629cef51..3109679e2 100644 --- a/src/controller.h +++ b/src/controller.h @@ -13,6 +13,8 @@ #include #include +#include + #include "connection.h" #include "csapi/list_public_rooms.h" #include "room.h" @@ -29,6 +31,7 @@ class Controller : public QObject Q_PROPERTY(Connection *connection READ connection WRITE setConnection NOTIFY connectionChanged) Q_PROPERTY(bool isOnline READ isOnline NOTIFY isOnlineChanged) Q_PROPERTY(bool busy READ busy WRITE setBusy NOTIFY busyChanged) + Q_PROPERTY(KAboutData aboutData READ aboutData WRITE setAboutData NOTIFY aboutDataChanged) public: static Controller &instance() @@ -102,6 +105,9 @@ public: Q_EMIT connectionChanged(); } + void setAboutData(KAboutData aboutData); + KAboutData aboutData() const; + private: explicit Controller(QObject *parent = nullptr); ~Controller(); @@ -119,6 +125,8 @@ private: void loadSettings(); void saveSettings() const; + KAboutData m_aboutData; + private Q_SLOTS: void invokeLogin(); @@ -134,6 +142,7 @@ Q_SIGNALS: void unreadCountChanged(); void connectionChanged(); void isOnlineChanged(); + void aboutDataChanged(); public Q_SLOTS: void logout(Quotient::Connection *conn); diff --git a/src/main.cpp b/src/main.cpp index 47addd12b..befe30970 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -10,9 +10,13 @@ #include #include #include +#include #include #include +#include + +#include "neochat-version.h" #include "accountlistmodel.h" #include "controller.h" @@ -86,6 +90,20 @@ int main(int argc, char *argv[]) engine.rootContext()->setContextObject(new KLocalizedContext(&engine)); KLocalizedString::setApplicationDomain("neochat"); + QCommandLineParser parser; + parser.setApplicationDescription(i18n("Client for the matrix communication protocol")); + + KAboutData about(QStringLiteral("neochat"), i18n("Neochat"), QStringLiteral(NEOCHAT_VERSION_STRING), i18n("Matrix client"), KAboutLicense::GPL_V3, i18n("© 2018-2020 Black Hat, 2020 KDE Community")); + about.addAuthor(i18n("Black Hat"), QString(), QStringLiteral("bhat@encom.eu.org")); + about.addAuthor(i18n("Carl Schwan"), QString(), QStringLiteral("carl@carlschwan.eu")); + about.addAuthor(i18n("Tobias Fella"), QString(), QStringLiteral("fella@posteo.de")); + + about.setupCommandLine(&parser); + parser.process(app); + about.processCommandLine(&parser); + + Controller::instance().setAboutData(about); + engine.addImportPath("qrc:/imports"); MatrixImageProvider *matrixImageProvider = new MatrixImageProvider(); engine.rootContext()->setContextProperty("imageProvider", matrixImageProvider);