Add KConfigXt configs

This commit is contained in:
Carl Schwan
2020-11-09 22:36:40 +01:00
parent a8b95791e2
commit f98834bb03
4 changed files with 28 additions and 1 deletions

View File

@@ -20,7 +20,8 @@ add_executable(neochat
)
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)
target_link_libraries(neochat PRIVATE Qt5::Quick Qt5::Qml Qt5::Gui Qt5::Network Qt5::QuickControls2 KF5::I18n KF5::Kirigami2 KF5::Notifications KF5::ConfigCore KF5::ConfigGui KF5::CoreAddons Quotient cmark::cmark)
kconfig_add_kcfg_files(neochat GENERATE_MOC neochatconfig.kcfgc)
if(ANDROID)
target_link_libraries(neochat PRIVATE Qt5::Svg OpenSSL::SSL)

View File

@@ -36,6 +36,7 @@
#include "trayicon.h"
#include "userdirectorylistmodel.h"
#include "userlistmodel.h"
#include "neochatconfig.h"
using namespace Quotient;
@@ -59,9 +60,11 @@ int main(int argc, char *argv[])
app.setWindowIcon(QIcon(":/assets/img/icon.png"));
Clipboard clipboard;
NeoChatConfig config;
qmlRegisterSingletonInstance("org.kde.neochat", 1, 0, "Controller", &Controller::instance());
qmlRegisterSingletonInstance("org.kde.neochat", 1, 0, "Clipboard", &clipboard);
qmlRegisterSingletonInstance("org.kde.neochat", 1, 0, "Config", &config);
qmlRegisterType<AccountListModel>("org.kde.neochat", 1, 0, "AccountListModel");
qmlRegisterType<RoomListModel>("org.kde.neochat", 1, 0, "RoomListModel");
qmlRegisterType<UserListModel>("org.kde.neochat", 1, 0, "UserListModel");

15
src/neochatconfig.kcfg Normal file
View File

@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<kcfg xmlns="http://www.kde.org/standards/kcfg/1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0
http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" >
<group name="General">
<entry name="CollapsedSections" type="StringList">
<label>Collapsed sections in the room list</label>
</entry>
<entry name="OpenRoom" type="String">
<label>Latest opened room.</label>
</entry>
</group>
</kcfg>

8
src/neochatconfig.kcfgc Normal file
View File

@@ -0,0 +1,8 @@
# SPDX-FileCopyrightText: (C) 2020 Carl Schwan <carl@carlschwan.eu>
# SPDX-License-Identifier: LGPL-2.1-or-later
File=neochatconfig.kcfg
ClassName=NeoChatConfig
Mutators=true
DefaultValueGetters=true
GenerateProperties=true
ParentInConstructor=true