Add AboutPage
This commit is contained in:
@@ -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)
|
||||
|
||||
19
qml/main.qml
19
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 {
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -13,6 +13,8 @@
|
||||
#include <QObject>
|
||||
#include <QSystemTrayIcon>
|
||||
|
||||
#include <KAboutData>
|
||||
|
||||
#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);
|
||||
|
||||
18
src/main.cpp
18
src/main.cpp
@@ -10,9 +10,13 @@
|
||||
#include <QQmlApplicationEngine>
|
||||
#include <QQmlContext>
|
||||
#include <QQuickStyle>
|
||||
#include <QCommandLineParser>
|
||||
|
||||
#include <KLocalizedContext>
|
||||
#include <KLocalizedString>
|
||||
#include <KAboutData>
|
||||
|
||||
#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);
|
||||
|
||||
Reference in New Issue
Block a user