diff --git a/.reuse/dep5 b/.reuse/dep5 index 148bb5363..532526354 100644 --- a/.reuse/dep5 +++ b/.reuse/dep5 @@ -34,7 +34,7 @@ Files: src/neochat.notifyrc Copyright: 2020 Tobias Fella License: BSD-2-Clause -Files: src/qml/Component/confetti.png src/qml/Component/glowdot.png +Files: src/qml/confetti.png src/qml/glowdot.png Copyright: 2021 Alexey Andreyev License: CC0-1.0 diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 606399914..5d2cf98f3 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -55,8 +55,8 @@ add_library(neochat STATIC models/devicesmodel.cpp models/devicesmodel.h models/devicesproxymodel.cpp - filetypesingleton.cpp - filetypesingleton.h + filetype.cpp + filetype.h login.cpp login.h models/webshortcutmodel.cpp @@ -129,6 +129,153 @@ add_library(neochat STATIC enums/delegatetype.h ) +qt_add_qml_module(neochat URI org.kde.neochat NO_PLUGIN + QML_FILES + qml/main.qml + qml/AccountMenu.qml + qml/ExploreComponent.qml + qml/ContextMenu.qml + qml/CollapsedRoomDelegate.qml + qml/RoomDelegate.qml + qml/RoomListPage.qml + qml/SpaceListContextMenu.qml + qml/UserInfo.qml + qml/LoadingPage.qml + qml/RoomPage.qml + qml/RoomWindow.qml + qml/JoinRoomPage.qml + qml/ExplorerDelegate.qml + qml/InviteUserPage.qml + qml/StartChatPage.qml + qml/ImageEditorPage.qml + qml/WelcomePage.qml + qml/General.qml + qml/Security.qml + qml/PushNotification.qml + qml/Categories.qml + qml/Permissions.qml + qml/NeochatMaximizeComponent.qml + qml/FancyEffectsContainer.qml + qml/TypingPane.qml + qml/ShimmerGradient.qml + qml/QuickSwitcher.qml + qml/HoverActions.qml + qml/ChatBox.qml + qml/ChatBar.qml + qml/AttachmentPane.qml + qml/ReplyPane.qml + qml/CompletionMenu.qml + qml/PieProgressBar.qml + qml/QuickFormatBar.qml + qml/RoomData.qml + qml/ServerData.qml + qml/EmojiPicker.qml + qml/TimelineDelegate.qml + qml/ReplyComponent.qml + qml/StateDelegate.qml + qml/RichLabel.qml + qml/MessageDelegate.qml + qml/Bubble.qml + qml/SectionDelegate.qml + qml/VideoDelegate.qml + qml/ReactionDelegate.qml + qml/LinkPreviewDelegate.qml + qml/AudioDelegate.qml + qml/FileDelegate.qml + qml/ImageDelegate.qml + qml/EncryptedDelegate.qml + qml/EventDelegate.qml + qml/TextDelegate.qml + qml/ReadMarkerDelegate.qml + qml/PollDelegate.qml + qml/MimeComponent.qml + qml/StateComponent.qml + qml/MessageEditComponent.qml + qml/AvatarFlow.qml + qml/LoginStep.qml + qml/Login.qml + qml/Homeserver.qml + qml/Username.qml + qml/RegisterPassword.qml + qml/Captcha.qml + qml/Terms.qml + qml/Email.qml + qml/Password.qml + qml/LoginRegister.qml + qml/Loading.qml + qml/LoginMethod.qml + qml/Sso.qml + qml/UserDetailDialog.qml + qml/CreateRoomDialog.qml + qml/CreateSpaceDialog.qml + qml/EmojiDialog.qml + qml/OpenFileDialog.qml + qml/KeyVerificationDialog.qml + qml/ConfirmLogoutDialog.qml + qml/PowerLevelDialog.qml + qml/Message.qml + qml/EmojiItem.qml + qml/EmojiRow.qml + qml/EmojiSas.qml + qml/ConfirmDeactivateAccountDialog.qml + qml/VerificationCanceled.qml + qml/GlobalMenu.qml + qml/EditMenu.qml + qml/MessageDelegateContextMenu.qml + qml/FileDelegateContextMenu.qml + qml/MessageSourceSheet.qml + qml/ReportSheet.qml + qml/SettingsPage.qml + qml/ThemeRadioButton.qml + qml/ColorScheme.qml + qml/GeneralSettingsPage.qml + qml/EmoticonsPage.qml + qml/EmoticonEditorPage.qml + qml/EmoticonFormCard.qml + qml/GlobalNotificationsPage.qml + qml/NotificationRuleItem.qml + qml/AppearanceSettingsPage.qml + qml/AccountsPage.qml + qml/AccountEditorPage.qml + qml/DevicesPage.qml + qml/DeviceDelegate.qml + qml/DevicesCard.qml + qml/About.qml + qml/AboutKDE.qml + qml/SonnetConfigPage.qml + qml/NetworkProxyPage.qml + qml/DevtoolsPage.qml + qml/ConfirmEncryptionDialog.qml + qml/RemoveSheet.qml + qml/BanSheet.qml + qml/EmojiTonesPicker.qml + qml/EmojiDelegate.qml + qml/EmojiGrid.qml + qml/SearchPage.qml + qml/LocationDelegate.qml + qml/LocationChooser.qml + qml/TimelineView.qml + qml/InvitationView.qml + qml/AvatarTabButton.qml + qml/SpaceDrawer.qml + qml/OsmLocationPlugin.qml + qml/LiveLocationDelegate.qml + qml/FullScreenMap.qml + qml/LocationsPage.qml + qml/LocationMapItem.qml + qml/RoomDrawer.qml + qml/RoomDrawerPage.qml + qml/DirectChatDrawerHeader.qml + qml/GroupChatDrawerHeader.qml + qml/RoomInformation.qml + qml/RoomMedia.qml + qml/ChooseRoomDialog.qml + qml/ShareAction.qml + RESOURCES + qml/confetti.png + qml/glowdot.png +) + ecm_qt_declare_logging_category(neochat HEADER "messageeventmodel_logging.h" IDENTIFIER "MessageEvent" @@ -147,7 +294,6 @@ ecm_qt_declare_logging_category(neochat add_executable(neochat-app main.cpp - res.qrc ) if(TARGET Qt::WebView) @@ -179,15 +325,12 @@ if(NOT ANDROID) endif() if (NOT ANDROID AND NOT WIN32 AND NOT APPLE) - target_sources(neochat-app PRIVATE res_desktop.qrc) target_compile_definitions(neochat PUBLIC -DHAVE_RUNNER) target_compile_definitions(neochat PUBLIC -DHAVE_X11) target_sources(neochat PRIVATE runner.cpp) -else() - target_sources(neochat-app PRIVATE res_android.qrc) endif() -target_include_directories(neochat PRIVATE ${CMAKE_BINARY_DIR}) +target_include_directories(neochat PRIVATE ${CMAKE_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/models ${CMAKE_CURRENT_SOURCE_DIR}/enums) target_link_libraries(neochat PUBLIC Qt::Core Qt::Quick Qt::Qml Qt::Gui Qt::Multimedia Qt::Network Qt::QuickControls2 KF6::I18n KF6::Kirigami2 KF6::Notifications KF6::ConfigCore KF6::ConfigGui KF6::CoreAddons KF6::SonnetCore KF6::ItemModels QuotientQt6 cmark::cmark QCoro::Core) kconfig_add_kcfg_files(neochat GENERATE_MOC neochatconfig.kcfgc) diff --git a/src/actionshandler.h b/src/actionshandler.h index 4aa11a6d7..69b0fe66d 100644 --- a/src/actionshandler.h +++ b/src/actionshandler.h @@ -4,6 +4,7 @@ #pragma once #include +#include #include @@ -32,6 +33,7 @@ class NeoChatRoom; class ActionsHandler : public QObject { Q_OBJECT + QML_ELEMENT /** * @brief The room that messages will be sent to. diff --git a/src/chatdocumenthandler.h b/src/chatdocumenthandler.h index 788610b9f..4e10be110 100644 --- a/src/chatdocumenthandler.h +++ b/src/chatdocumenthandler.h @@ -4,6 +4,7 @@ #pragma once #include +#include #include #include @@ -58,6 +59,7 @@ class SyntaxHighlighter; class ChatDocumentHandler : public QObject { Q_OBJECT + QML_ELEMENT /** * @brief Is the instance being used to handle an edit message. diff --git a/src/clipboard.h b/src/clipboard.h index b7ed9094c..d9789898c 100644 --- a/src/clipboard.h +++ b/src/clipboard.h @@ -4,6 +4,7 @@ #pragma once #include +#include class QClipboard; class QImage; @@ -18,6 +19,8 @@ class QImage; class Clipboard : public QObject { Q_OBJECT + QML_ELEMENT + QML_SINGLETON /** * @brief Whether the current clipboard content is an image. diff --git a/src/colorschemer.h b/src/colorschemer.h index 9d6ca338c..f9e2a02e2 100644 --- a/src/colorschemer.h +++ b/src/colorschemer.h @@ -4,6 +4,7 @@ #pragma once #include +#include class QAbstractItemModel; class KColorSchemeManager; @@ -19,6 +20,8 @@ class KColorSchemeManager; class ColorSchemer : public QObject { Q_OBJECT + QML_ELEMENT + QML_SINGLETON /** * @brief A QAbstractItemModel of all available color schemes. diff --git a/src/controller.h b/src/controller.h index 72d82df01..492969ea9 100644 --- a/src/controller.h +++ b/src/controller.h @@ -5,6 +5,7 @@ #include "models/pushrulemodel.h" #include +#include #include #include @@ -40,6 +41,8 @@ class ReadPasswordJob; class Controller : public QObject { Q_OBJECT + QML_ELEMENT + QML_SINGLETON /** * @brief The current connection for the rest of NeoChat to use. @@ -90,6 +93,10 @@ public: Q_ENUM(PasswordStatus) static Controller &instance(); + static Controller *create(QQmlEngine *, QJSEngine *) + { + return &instance(); + } void setActiveConnection(NeoChatConnection *connection); [[nodiscard]] NeoChatConnection *activeConnection() const; diff --git a/src/delegatesizehelper.h b/src/delegatesizehelper.h index 08bd42f2b..752a7b96e 100644 --- a/src/delegatesizehelper.h +++ b/src/delegatesizehelper.h @@ -4,6 +4,7 @@ #pragma once #include +#include /** * @class DelegateSizeHelper @@ -23,6 +24,7 @@ class DelegateSizeHelper : public QObject { Q_OBJECT + QML_ELEMENT /** * @brief The width of the component's parent. diff --git a/src/enums/delegatetype.h b/src/enums/delegatetype.h index a6b9a6498..d1e63030d 100644 --- a/src/enums/delegatetype.h +++ b/src/enums/delegatetype.h @@ -4,15 +4,18 @@ #pragma once #include +#include /** * @class DelegateType * * This class is designed to define the DelegateType enumeration. */ -class DelegateType +class DelegateType : public QObject { - Q_GADGET + Q_OBJECT + QML_ELEMENT + QML_UNCREATABLE("") public: /** diff --git a/src/filetype.cpp b/src/filetype.cpp new file mode 100644 index 000000000..18c6bbe68 --- /dev/null +++ b/src/filetype.cpp @@ -0,0 +1,116 @@ +// SPDX-FileCopyrightText: 2021 Noah Davis +// SPDX-License-Identifier: LicenseRef-KDE-Accepted-LGPL + +#include "filetype.h" +#include +#include + +static QStringList byteArrayListToStringList(const QByteArrayList &byteArrayList) +{ + QStringList stringList; + for (const QByteArray &byteArray : byteArrayList) { + stringList.append(QString::fromLocal8Bit(byteArray)); + } + return stringList; +} + +class FileTypePrivate +{ + Q_DECLARE_PUBLIC(FileType) + Q_DISABLE_COPY(FileTypePrivate) +public: + FileTypePrivate(FileType *qq); + FileType *const q_ptr; + QMimeDatabase mimetypeDatabase; + QStringList supportedImageFormats = byteArrayListToStringList(QImageReader::supportedImageFormats()); + QStringList supportedAnimatedImageFormats = byteArrayListToStringList(QMovie::supportedFormats()); +}; + +FileTypePrivate::FileTypePrivate(FileType *qq) + : q_ptr(qq) +{ +} + +FileType::FileType(QObject *parent) + : QObject(parent) + , d_ptr(new FileTypePrivate(this)) +{ +} + +FileType::~FileType() noexcept +{ +} + +QMimeType FileType::mimeTypeForName(const QString &nameOrAlias) const +{ + Q_D(const FileType); + return d->mimetypeDatabase.mimeTypeForName(nameOrAlias); +} + +QMimeType FileType::mimeTypeForFile(const QString &fileName, MatchMode mode) const +{ + Q_D(const FileType); + return d->mimetypeDatabase.mimeTypeForFile(fileName, static_cast(mode)); +} + +QMimeType FileType::mimeTypeForFile(const QFileInfo &fileInfo, MatchMode mode) const +{ + Q_D(const FileType); + return d->mimetypeDatabase.mimeTypeForFile(fileInfo, static_cast(mode)); +} + +QList FileType::mimeTypesForFileName(const QString &fileName) const +{ + Q_D(const FileType); + return d->mimetypeDatabase.mimeTypesForFileName(fileName); +} + +QMimeType FileType::mimeTypeForData(const QByteArray &data) const +{ + Q_D(const FileType); + return d->mimetypeDatabase.mimeTypeForData(data); +} + +QMimeType FileType::mimeTypeForData(QIODevice *device) const +{ + Q_D(const FileType); + return d->mimetypeDatabase.mimeTypeForData(device); +} + +QMimeType FileType::mimeTypeForUrl(const QUrl &url) const +{ + Q_D(const FileType); + return d->mimetypeDatabase.mimeTypeForUrl(url); +} + +QMimeType FileType::mimeTypeForFileNameAndData(const QString &fileName, QIODevice *device) const +{ + Q_D(const FileType); + return d->mimetypeDatabase.mimeTypeForFileNameAndData(fileName, device); +} + +QMimeType FileType::mimeTypeForFileNameAndData(const QString &fileName, const QByteArray &data) const +{ + Q_D(const FileType); + return d->mimetypeDatabase.mimeTypeForFileNameAndData(fileName, data); +} + +QString FileType::suffixForFileName(const QString &fileName) const +{ + Q_D(const FileType); + return d->mimetypeDatabase.suffixForFileName(fileName); +} + +QStringList FileType::supportedImageFormats() const +{ + Q_D(const FileType); + return d->supportedImageFormats; +} + +QStringList FileType::supportedAnimatedImageFormats() const +{ + Q_D(const FileType); + return d->supportedAnimatedImageFormats; +} + +#include "moc_filetype.cpp" diff --git a/src/filetypesingleton.h b/src/filetype.h similarity index 86% rename from src/filetypesingleton.h rename to src/filetype.h index 176aebd61..25105c014 100644 --- a/src/filetypesingleton.h +++ b/src/filetype.h @@ -8,9 +8,10 @@ #include #include #include +#include #include -class FileTypeSingletonPrivate; +class FileTypePrivate; /** * @class FileTypeSingleton @@ -19,9 +20,11 @@ class FileTypeSingletonPrivate; * * @sa QMimeDatabase */ -class FileTypeSingleton : public QObject +class FileType : public QObject { Q_OBJECT + QML_ELEMENT + QML_SINGLETON /** * @brief List of supported image formats. @@ -37,12 +40,9 @@ class FileTypeSingleton : public QObject */ Q_PROPERTY(QStringList supportedAnimatedImageFormats READ supportedAnimatedImageFormats CONSTANT FINAL) - QML_NAMED_ELEMENT(FileType) - QML_SINGLETON - public: - explicit FileTypeSingleton(QObject *parent = nullptr); - ~FileTypeSingleton(); + explicit FileType(QObject *parent = nullptr); + ~FileType(); /** * @brief Returns a MIME type for nameOrAlias or an invalid one if none found. @@ -59,14 +59,14 @@ public: * * @sa QMimeDatabase */ - Q_INVOKABLE QMimeType mimeTypeForFile(const QString &fileName, FileTypeSingleton::MatchMode mode = MatchDefault) const; + Q_INVOKABLE QMimeType mimeTypeForFile(const QString &fileName, FileType::MatchMode mode = MatchDefault) const; /** * @brief Returns a MIME type for fileInfo. * * @sa QMimeDatabase */ - Q_INVOKABLE QMimeType mimeTypeForFile(const QFileInfo &fileInfo, FileTypeSingleton::MatchMode mode = MatchDefault) const; + Q_INVOKABLE QMimeType mimeTypeForFile(const QFileInfo &fileInfo, FileType::MatchMode mode = MatchDefault) const; /** * @brief Returns the MIME types for the file name fileName. @@ -121,9 +121,7 @@ public: QStringList supportedAnimatedImageFormats() const; private: - const QScopedPointer d_ptr; - Q_DECLARE_PRIVATE(FileTypeSingleton) - Q_DISABLE_COPY(FileTypeSingleton) + const QScopedPointer d_ptr; + Q_DECLARE_PRIVATE(FileType) + Q_DISABLE_COPY(FileType) }; - -QML_DECLARE_TYPE(FileTypeSingleton) diff --git a/src/filetypesingleton.cpp b/src/filetypesingleton.cpp deleted file mode 100644 index edb699760..000000000 --- a/src/filetypesingleton.cpp +++ /dev/null @@ -1,116 +0,0 @@ -// SPDX-FileCopyrightText: 2021 Noah Davis -// SPDX-License-Identifier: LicenseRef-KDE-Accepted-LGPL - -#include "filetypesingleton.h" -#include -#include - -static QStringList byteArrayListToStringList(const QByteArrayList &byteArrayList) -{ - QStringList stringList; - for (const QByteArray &byteArray : byteArrayList) { - stringList.append(QString::fromLocal8Bit(byteArray)); - } - return stringList; -} - -class FileTypeSingletonPrivate -{ - Q_DECLARE_PUBLIC(FileTypeSingleton) - Q_DISABLE_COPY(FileTypeSingletonPrivate) -public: - FileTypeSingletonPrivate(FileTypeSingleton *qq); - FileTypeSingleton *const q_ptr; - QMimeDatabase mimetypeDatabase; - QStringList supportedImageFormats = byteArrayListToStringList(QImageReader::supportedImageFormats()); - QStringList supportedAnimatedImageFormats = byteArrayListToStringList(QMovie::supportedFormats()); -}; - -FileTypeSingletonPrivate::FileTypeSingletonPrivate(FileTypeSingleton *qq) - : q_ptr(qq) -{ -} - -FileTypeSingleton::FileTypeSingleton(QObject *parent) - : QObject(parent) - , d_ptr(new FileTypeSingletonPrivate(this)) -{ -} - -FileTypeSingleton::~FileTypeSingleton() noexcept -{ -} - -QMimeType FileTypeSingleton::mimeTypeForName(const QString &nameOrAlias) const -{ - Q_D(const FileTypeSingleton); - return d->mimetypeDatabase.mimeTypeForName(nameOrAlias); -} - -QMimeType FileTypeSingleton::mimeTypeForFile(const QString &fileName, MatchMode mode) const -{ - Q_D(const FileTypeSingleton); - return d->mimetypeDatabase.mimeTypeForFile(fileName, static_cast(mode)); -} - -QMimeType FileTypeSingleton::mimeTypeForFile(const QFileInfo &fileInfo, MatchMode mode) const -{ - Q_D(const FileTypeSingleton); - return d->mimetypeDatabase.mimeTypeForFile(fileInfo, static_cast(mode)); -} - -QList FileTypeSingleton::mimeTypesForFileName(const QString &fileName) const -{ - Q_D(const FileTypeSingleton); - return d->mimetypeDatabase.mimeTypesForFileName(fileName); -} - -QMimeType FileTypeSingleton::mimeTypeForData(const QByteArray &data) const -{ - Q_D(const FileTypeSingleton); - return d->mimetypeDatabase.mimeTypeForData(data); -} - -QMimeType FileTypeSingleton::mimeTypeForData(QIODevice *device) const -{ - Q_D(const FileTypeSingleton); - return d->mimetypeDatabase.mimeTypeForData(device); -} - -QMimeType FileTypeSingleton::mimeTypeForUrl(const QUrl &url) const -{ - Q_D(const FileTypeSingleton); - return d->mimetypeDatabase.mimeTypeForUrl(url); -} - -QMimeType FileTypeSingleton::mimeTypeForFileNameAndData(const QString &fileName, QIODevice *device) const -{ - Q_D(const FileTypeSingleton); - return d->mimetypeDatabase.mimeTypeForFileNameAndData(fileName, device); -} - -QMimeType FileTypeSingleton::mimeTypeForFileNameAndData(const QString &fileName, const QByteArray &data) const -{ - Q_D(const FileTypeSingleton); - return d->mimetypeDatabase.mimeTypeForFileNameAndData(fileName, data); -} - -QString FileTypeSingleton::suffixForFileName(const QString &fileName) const -{ - Q_D(const FileTypeSingleton); - return d->mimetypeDatabase.suffixForFileName(fileName); -} - -QStringList FileTypeSingleton::supportedImageFormats() const -{ - Q_D(const FileTypeSingleton); - return d->supportedImageFormats; -} - -QStringList FileTypeSingleton::supportedAnimatedImageFormats() const -{ - Q_D(const FileTypeSingleton); - return d->supportedAnimatedImageFormats; -} - -#include "moc_filetypesingleton.cpp" diff --git a/src/linkpreviewer.h b/src/linkpreviewer.h index 9edafac3e..00c4cf1f2 100644 --- a/src/linkpreviewer.h +++ b/src/linkpreviewer.h @@ -4,6 +4,7 @@ #pragma once #include +#include #include class NeoChatRoom; @@ -19,6 +20,8 @@ class NeoChatRoom; class LinkPreviewer : public QObject { Q_OBJECT + QML_ELEMENT + /** * @brief The URL to get the preview for. */ diff --git a/src/locationhelper.h b/src/locationhelper.h index 2d396c7d0..0271f33e0 100644 --- a/src/locationhelper.h +++ b/src/locationhelper.h @@ -2,14 +2,17 @@ // SPDX-License-Identifier: LGPL-2.0-or-later #pragma once -#include "linkpreviewer.h" #include +#include +#include #include /** Location related helper functions for QML. */ -class LocationHelper +class LocationHelper : public QObject { - Q_GADGET + Q_OBJECT + QML_ELEMENT + QML_UNCREATABLE("") public: /** Unite two rectanlges. */ Q_INVOKABLE static QRectF unite(const QRectF &r1, const QRectF &r2); diff --git a/src/login.cpp b/src/login.cpp index 643fa57f8..96678678a 100644 --- a/src/login.cpp +++ b/src/login.cpp @@ -13,13 +13,13 @@ using namespace Quotient; -Login::Login(QObject *parent) +LoginHelper::LoginHelper(QObject *parent) : QObject(parent) { init(); } -void Login::init() +void LoginHelper::init() { m_homeserverReachable = false; m_connection = new NeoChatConnection(); @@ -31,7 +31,7 @@ void Login::init() m_supportsPassword = false; m_ssoUrl = QUrl(); - connect(this, &Login::matrixIdChanged, this, [this]() { + connect(this, &LoginHelper::matrixIdChanged, this, [this]() { setHomeserverReachable(false); QRegularExpression validator(QStringLiteral("^\\@?[a-zA-Z0-9\\._=\\-/]+\\:[a-zA-Z0-9\\-]+(\\.[a-zA-Z0-9\\-]+)*(\\:[0-9]+)?$")); if (!validator.match(m_matrixId).hasMatch()) { @@ -105,23 +105,23 @@ void Login::init() }); } -void Login::setHomeserverReachable(bool reachable) +void LoginHelper::setHomeserverReachable(bool reachable) { m_homeserverReachable = reachable; Q_EMIT homeserverReachableChanged(); } -bool Login::homeserverReachable() const +bool LoginHelper::homeserverReachable() const { return m_homeserverReachable; } -QString Login::matrixId() const +QString LoginHelper::matrixId() const { return m_matrixId; } -void Login::setMatrixId(const QString &matrixId) +void LoginHelper::setMatrixId(const QString &matrixId) { m_matrixId = matrixId; if (!m_matrixId.startsWith(QLatin1Char('@'))) { @@ -130,30 +130,30 @@ void Login::setMatrixId(const QString &matrixId) Q_EMIT matrixIdChanged(); } -QString Login::password() const +QString LoginHelper::password() const { return m_password; } -void Login::setPassword(const QString &password) +void LoginHelper::setPassword(const QString &password) { setInvalidPassword(false); m_password = password; Q_EMIT passwordChanged(); } -QString Login::deviceName() const +QString LoginHelper::deviceName() const { return m_deviceName; } -void Login::setDeviceName(const QString &deviceName) +void LoginHelper::setDeviceName(const QString &deviceName) { m_deviceName = deviceName; Q_EMIT deviceNameChanged(); } -void Login::login() +void LoginHelper::login() { m_isLoggingIn = true; Q_EMIT isLoggingInChanged(); @@ -164,22 +164,22 @@ void Login::login() m_connection->loginWithPassword(username, m_password, m_deviceName, QString()); } -bool Login::supportsPassword() const +bool LoginHelper::supportsPassword() const { return m_supportsPassword; } -bool Login::supportsSso() const +bool LoginHelper::supportsSso() const { return m_supportsSso; } -QUrl Login::ssoUrl() const +QUrl LoginHelper::ssoUrl() const { return m_ssoUrl; } -void Login::loginWithSso() +void LoginHelper::loginWithSso() { m_connection->resolveServer(m_matrixId); connectSingleShot(m_connection, &Connection::loginFlowsChanged, this, [this]() { @@ -189,28 +189,28 @@ void Login::loginWithSso() }); } -bool Login::testing() const +bool LoginHelper::testing() const { return m_testing; } -bool Login::isLoggingIn() const +bool LoginHelper::isLoggingIn() const { return m_isLoggingIn; } -bool Login::isLoggedIn() const +bool LoginHelper::isLoggedIn() const { return m_isLoggedIn; } -void Login::setInvalidPassword(bool invalid) +void LoginHelper::setInvalidPassword(bool invalid) { m_invalidPassword = invalid; Q_EMIT isInvalidPasswordChanged(); } -bool Login::isInvalidPassword() const +bool LoginHelper::isInvalidPassword() const { return m_invalidPassword; } diff --git a/src/login.h b/src/login.h index 4916022b4..8155fea62 100644 --- a/src/login.h +++ b/src/login.h @@ -4,18 +4,21 @@ #pragma once #include +#include #include class NeoChatConnection; /** - * @class Login + * @class LoginHelper * * A helper class for logging into a Matrix account. */ -class Login : public QObject +class LoginHelper : public QObject { Q_OBJECT + QML_ELEMENT + QML_SINGLETON /** * @brief Whether the home server for the account is reachable. @@ -76,7 +79,7 @@ class Login : public QObject Q_PROPERTY(bool isInvalidPassword READ isInvalidPassword NOTIFY isInvalidPasswordChanged) public: - explicit Login(QObject *parent = nullptr); + explicit LoginHelper(QObject *parent = nullptr); Q_INVOKABLE void init(); diff --git a/src/main.cpp b/src/main.cpp index 28f1b5c9e..ce624a558 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -44,11 +44,9 @@ #include "actionshandler.h" #include "blurhashimageprovider.h" #include "chatdocumenthandler.h" -#include "clipboard.h" #include "controller.h" #include "delegatesizehelper.h" #include "enums/delegatetype.h" -#include "filetypesingleton.h" #include "linkpreviewer.h" #include "locationhelper.h" #include "logger.h" @@ -82,9 +80,6 @@ #include "models/userlistmodel.h" #include "models/webshortcutmodel.h" #include "neochatconfig.h" -#include "neochatconnection.h" -#include "neochatroom.h" -#include "notificationsmanager.h" #include "pollhandler.h" #include "roommanager.h" #include "spacehierarchycache.h" @@ -109,6 +104,8 @@ using namespace Quotient; +void qml_register_types_org_kde_neochat(); + class NetworkAccessManagerFactory : public QQmlNetworkAccessManagerFactory { QNetworkAccessManager *create(QObject *) override @@ -215,95 +212,18 @@ int main(int argc, char *argv[]) QStringLiteral("/var/config/fontconfig/conf.d/99-noto-mono-color-emoji.conf")); #endif - Clipboard clipboard; - auto config = NeoChatConfig::self(); - FileTypeSingleton fileTypeSingleton; - - Login *login = new Login(); - UrlHelper urlHelper; - #ifdef HAVE_COLORSCHEME ColorSchemer colorScheme; - qmlRegisterSingletonInstance("org.kde.neochat", 1, 0, "ColorSchemer", &colorScheme); - if (!config->colorScheme().isEmpty()) { - colorScheme.apply(config->colorScheme()); + if (!NeoChatConfig::self()->colorScheme().isEmpty()) { + colorScheme.apply(NeoChatConfig::self()->colorScheme()); } #endif - qmlRegisterSingletonInstance("org.kde.neochat", 1, 0, "Controller", &Controller::instance()); - qmlRegisterSingletonInstance("org.kde.neochat", 1, 0, "NotificationsManager", &NotificationsManager::instance()); - qmlRegisterSingletonInstance("org.kde.neochat", 1, 0, "Clipboard", &clipboard); - qmlRegisterSingletonInstance("org.kde.neochat", 1, 0, "Config", config); - qmlRegisterSingletonInstance("org.kde.neochat", 1, 0, "RoomManager", &RoomManager::instance()); - qmlRegisterSingletonInstance("org.kde.neochat", 1, 0, "FileType", &fileTypeSingleton); - qmlRegisterSingletonInstance("org.kde.neochat", 1, 0, "LoginHelper", login); - qmlRegisterSingletonInstance("org.kde.neochat", 1, 0, "UrlHelper", &urlHelper); - qmlRegisterSingletonInstance("org.kde.neochat", 1, 0, "EmojiModel", &EmojiModel::instance()); - qmlRegisterSingletonInstance("org.kde.neochat", 1, 0, "AccountRegistry", &Controller::instance().accounts()); - qmlRegisterSingletonInstance("org.kde.neochat", 1, 0, "SpaceHierarchyCache", &SpaceHierarchyCache::instance()); - qmlRegisterSingletonInstance("org.kde.neochat", 1, 0, "CustomEmojiModel", &CustomEmojiModel::instance()); - qmlRegisterSingletonInstance("org.kde.neochat", 1, 0, "Registration", &Registration::instance()); - qmlRegisterType("org.kde.neochat", 1, 0, "ActionsHandler"); - qmlRegisterType("org.kde.neochat", 1, 0, "ChatDocumentHandler"); - qmlRegisterType("org.kde.neochat", 1, 0, "RoomListModel"); - qmlRegisterType("org.kde.neochat", 1, 0, "WebShortcutModel"); - qmlRegisterType("org.kde.neochat", 1, 0, "UserListModel"); - qmlRegisterType("org.kde.neochat", 1, 0, "MessageEventModel"); - qmlRegisterType("org.kde.neochat", 1, 0, "ReactionModel"); - qmlRegisterType("org.kde.neochat", 1, 0, "MediaMessageFilterModel"); - qmlRegisterType("org.kde.neochat", 1, 0, "MessageFilterModel"); - qmlRegisterType("org.kde.neochat", 1, 0, "UserFilterModel"); - qmlRegisterType("org.kde.neochat", 1, 0, "PublicRoomListModel"); - qmlRegisterType("org.kde.neochat", 1, 0, "UserDirectoryListModel"); - qmlRegisterType("org.kde.neochat", 1, 0, "ServerListModel"); - qmlRegisterType("org.kde.neochat", 1, 0, "SortFilterRoomListModel"); - qmlRegisterType("org.kde.neochat", 1, 0, "SortFilterSpaceListModel"); - qmlRegisterType("org.kde.neochat", 1, 0, "DevicesModel"); - qmlRegisterType("org.kde.neochat", 1, 0, "DevicesProxyModel"); - qmlRegisterType("org.kde.neochat", 1, 0, "LinkPreviewer"); - qmlRegisterType("org.kde.neochat", 1, 0, "CompletionModel"); - qmlRegisterType("org.kde.neochat", 1, 0, "StateModel"); - qmlRegisterType("org.kde.neochat", 1, 0, "StateFilterModel"); - qmlRegisterType("org.kde.neochat", 1, 0, "SearchModel"); - qmlRegisterType("org.kde.neochat", 1, 0, "LiveLocationsModel"); - qmlRegisterType("org.kde.neochat", 1, 0, "LocationsModel"); - qmlRegisterType("org.kde.neochat", 1, 0, "PollHandler"); - qmlRegisterType("org.kde.neochat", 1, 0, "PushRuleModel"); - qmlRegisterType("org.kde.neochat", 1, 0, "StickerModel"); - qmlRegisterType("org.kde.neochat", 1, 0, "ImagePacksModel"); - qmlRegisterType("org.kde.neochat", 1, 0, "AccountEmoticonModel"); - qmlRegisterType("org.kde.neochat", 1, 0, "EmoticonFilterModel"); - qmlRegisterType("org.kde.neochat", 1, 0, "DelegateSizeHelper"); - qmlRegisterType("org.kde.neochat", 1, 0, "MediaSizeHelper"); - qmlRegisterUncreatableType("org.kde.neochat", 1, 0, "DelegateType", "ENUM"_ls); - qmlRegisterUncreatableType("org.kde.neochat", 1, 0, "PushNotificationKind", "ENUM"_ls); - qmlRegisterUncreatableType("org.kde.neochat", 1, 0, "PushNotificationSection", "ENUM"_ls); - qmlRegisterUncreatableType("org.kde.neochat", 1, 0, "PushNotificationState", "ENUM"_ls); - qmlRegisterUncreatableType("org.kde.neochat", 1, 0, "PushNotificationAction", "ENUM"_ls); - qmlRegisterUncreatableType("org.kde.neochat", 1, 0, "NeoChatRoomType", "ENUM"_ls); - qmlRegisterUncreatableType("org.kde.neochat", 1, 0, "User", {}); - qmlRegisterUncreatableType("org.kde.neochat", 1, 0, "NeoChatRoom", {}); - qmlRegisterUncreatableType("org.kde.neochat", 1, 0, "NeoChatConnection", {}); + qml_register_types_org_kde_neochat(); + qmlRegisterSingletonInstance("org.kde.neochat.config", 1, 0, "Config", NeoChatConfig::self()); + qmlRegisterSingletonInstance("org.kde.neochat.accounts", 1, 0, "AccountRegistry", &Controller::instance().accounts()); - qRegisterMetaType("User*"); - qRegisterMetaType("const User*"); - qRegisterMetaType("const Quotient::User*"); - qRegisterMetaType("Room*"); - qRegisterMetaType("MessageEventType"); - qRegisterMetaType("NeoChatRoom*"); - qRegisterMetaType("User*"); - qRegisterMetaType("GetRoomEventsJob*"); - qRegisterMetaType("QMimeType"); - qRegisterMetaType("KeyVerificationSession*"); - qmlRegisterUncreatableType("org.kde.neochat", 1, 0, "KeyVerificationSession", {}); - qRegisterMetaType>("QVector"); - qmlRegisterSingletonType("org.kde.neochat", 1, 0, "About", [](QQmlEngine *engine, QJSEngine *) -> QJSValue { - return engine->toScriptValue(KAboutData::applicationData()); - }); - qmlRegisterSingletonType(QUrl("qrc:/OsmLocationPlugin.qml"_ls), "org.kde.neochat", 1, 0, "OsmLocationPlugin"); - qmlRegisterSingletonType("org.kde.neochat", 1, 0, "LocationHelper", [](QQmlEngine *engine, QJSEngine *) -> QJSValue { - return engine->toScriptValue(LocationHelper()); - }); + // qmlRegisterUncreatableType("org.kde.neochat", 1, 0, "KeyVerificationSession", {}); QQmlApplicationEngine engine; @@ -354,7 +274,7 @@ int main(int argc, char *argv[]) engine.addImageProvider(QLatin1String("mxc"), new MatrixImageProvider); engine.addImageProvider(QLatin1String("blurhash"), new BlurhashImageProvider); - engine.load(QUrl(QStringLiteral("qrc:/main.qml"))); + engine.load(QUrl(QStringLiteral("qrc:/org/kde/neochat/qml/main.qml"))); if (engine.rootObjects().isEmpty()) { return -1; } diff --git a/src/mediasizehelper.h b/src/mediasizehelper.h index f384b9377..68a2bd2c4 100644 --- a/src/mediasizehelper.h +++ b/src/mediasizehelper.h @@ -4,6 +4,7 @@ #pragma once #include +#include #include /** @@ -28,6 +29,7 @@ class MediaSizeHelper : public QObject { Q_OBJECT + QML_ELEMENT /** * @brief The maximum width (in px) the media can be. diff --git a/src/models/accountemoticonmodel.h b/src/models/accountemoticonmodel.h index e0829fd4b..0481ff147 100644 --- a/src/models/accountemoticonmodel.h +++ b/src/models/accountemoticonmodel.h @@ -9,6 +9,7 @@ #include #include #include +#include #include #include @@ -23,6 +24,8 @@ class AccountEmoticonModel : public QAbstractListModel { Q_OBJECT + QML_ELEMENT + /** * @brief The connection to get emoticons from. */ diff --git a/src/models/completionmodel.h b/src/models/completionmodel.h index 2f9fa9ce8..b6f5e18aa 100644 --- a/src/models/completionmodel.h +++ b/src/models/completionmodel.h @@ -4,6 +4,7 @@ #pragma once #include +#include #include #include "roomlistmodel.h" @@ -24,6 +25,7 @@ class RoomListModel; class CompletionModel : public QAbstractListModel { Q_OBJECT + QML_ELEMENT /** * @brief The current text to search for completions. diff --git a/src/models/customemojimodel.h b/src/models/customemojimodel.h index ce4e2f7a7..2ac310c48 100644 --- a/src/models/customemojimodel.h +++ b/src/models/customemojimodel.h @@ -4,6 +4,7 @@ #pragma once #include +#include #include #include @@ -27,6 +28,8 @@ struct CustomEmoji { class CustomEmojiModel : public QAbstractListModel { Q_OBJECT + QML_ELEMENT + QML_SINGLETON public: /** @@ -48,6 +51,10 @@ public: static CustomEmojiModel _instance; return _instance; } + static CustomEmojiModel *create(QQmlEngine *, QJSEngine *) + { + return &instance(); + } /** * @brief Get the given role value at the given index. diff --git a/src/models/devicesmodel.h b/src/models/devicesmodel.h index 70aa9cd9f..45ba6b25d 100644 --- a/src/models/devicesmodel.h +++ b/src/models/devicesmodel.h @@ -5,6 +5,7 @@ #include #include +#include #include @@ -25,6 +26,7 @@ class Connection; class DevicesModel : public QAbstractListModel { Q_OBJECT + QML_ELEMENT /** * @brief The current connection that the model is getting its devices from. diff --git a/src/models/devicesproxymodel.h b/src/models/devicesproxymodel.h index aba2cc72b..a7f84114d 100644 --- a/src/models/devicesproxymodel.h +++ b/src/models/devicesproxymodel.h @@ -3,11 +3,14 @@ #pragma once +#include #include class DevicesProxyModel : public QSortFilterProxyModel { Q_OBJECT + QML_ELEMENT + Q_PROPERTY(int type READ type WRITE setType NOTIFY typeChanged) public: diff --git a/src/models/emojimodel.h b/src/models/emojimodel.h index 88c2a470b..ce57c6a27 100644 --- a/src/models/emojimodel.h +++ b/src/models/emojimodel.h @@ -5,6 +5,7 @@ #include #include +#include #include struct Emoji { @@ -59,6 +60,8 @@ Q_DECLARE_METATYPE(Emoji) class EmojiModel : public QAbstractListModel { Q_OBJECT + QML_ELEMENT + QML_SINGLETON /** * @brief Return a list of recently used emojis. @@ -83,6 +86,10 @@ public: static EmojiModel _instance; return _instance; } + static EmojiModel *create(QQmlEngine *, QJSEngine *) + { + return &instance(); + } /** * @brief Defines the model roles. diff --git a/src/models/emoticonfiltermodel.h b/src/models/emoticonfiltermodel.h index 4d6dc36ba..dca6f8027 100644 --- a/src/models/emoticonfiltermodel.h +++ b/src/models/emoticonfiltermodel.h @@ -3,6 +3,7 @@ #pragma once +#include #include /** @@ -14,6 +15,7 @@ class EmoticonFilterModel : public QSortFilterProxyModel { Q_OBJECT + QML_ELEMENT /** * @brief Whether stickers should be shown diff --git a/src/models/imagepacksmodel.h b/src/models/imagepacksmodel.h index 3c47b5084..940ac3739 100644 --- a/src/models/imagepacksmodel.h +++ b/src/models/imagepacksmodel.h @@ -6,6 +6,7 @@ #include "events/imagepackevent.h" #include #include +#include #include class NeoChatRoom; @@ -21,6 +22,7 @@ class NeoChatRoom; class ImagePacksModel : public QAbstractListModel { Q_OBJECT + QML_ELEMENT /** * @brief The current room that the model is being used in. diff --git a/src/models/livelocationsmodel.h b/src/models/livelocationsmodel.h index d129c9938..433d7a793 100644 --- a/src/models/livelocationsmodel.h +++ b/src/models/livelocationsmodel.h @@ -8,6 +8,7 @@ #include #include +#include #include struct LiveLocationData { @@ -24,6 +25,8 @@ bool operator<(const LiveLocationData &lhs, const LiveLocationData &rhs); class LiveLocationsModel : public QAbstractListModel { Q_OBJECT + QML_ELEMENT + Q_PROPERTY(NeoChatRoom *room MEMBER m_room NOTIFY roomChanged) /** The event id of the beacon start event, ie. the one all suspequent * events use to relate to the same beacon. diff --git a/src/models/locationsmodel.h b/src/models/locationsmodel.h index 17991c20d..3f99b6dd6 100644 --- a/src/models/locationsmodel.h +++ b/src/models/locationsmodel.h @@ -5,6 +5,7 @@ #include #include +#include #include #include "neochatroom.h" @@ -15,6 +16,7 @@ class LocationsModel : public QAbstractListModel { Q_OBJECT + QML_ELEMENT public: enum Roles { diff --git a/src/models/mediamessagefiltermodel.h b/src/models/mediamessagefiltermodel.h index ffecac500..8903f8d2f 100644 --- a/src/models/mediamessagefiltermodel.h +++ b/src/models/mediamessagefiltermodel.h @@ -3,8 +3,8 @@ #pragma once +#include #include -#include #include "models/messagefiltermodel.h" @@ -20,6 +20,8 @@ class MessageFilterModel; class MediaMessageFilterModel : public QSortFilterProxyModel { Q_OBJECT + QML_ELEMENT + public: enum MediaType { Image = 0, diff --git a/src/models/messageeventmodel.h b/src/models/messageeventmodel.h index 0a1565299..c436b0b74 100644 --- a/src/models/messageeventmodel.h +++ b/src/models/messageeventmodel.h @@ -5,6 +5,7 @@ #include #include +#include #include "linkpreviewer.h" #include "neochatroom.h" @@ -25,6 +26,7 @@ class ReactionModel; class MessageEventModel : public QAbstractListModel { Q_OBJECT + QML_ELEMENT /** * @brief The current room that the model is getting its messages from. diff --git a/src/models/messagefiltermodel.h b/src/models/messagefiltermodel.h index 2f5b2666b..c50e4c174 100644 --- a/src/models/messagefiltermodel.h +++ b/src/models/messagefiltermodel.h @@ -3,6 +3,7 @@ #pragma once +#include #include #include "messageeventmodel.h" @@ -21,6 +22,8 @@ class MessageFilterModel : public QSortFilterProxyModel { Q_OBJECT + QML_ELEMENT + public: /** * @brief Defines the model roles. diff --git a/src/models/publicroomlistmodel.h b/src/models/publicroomlistmodel.h index 6f188b9ff..56daae969 100644 --- a/src/models/publicroomlistmodel.h +++ b/src/models/publicroomlistmodel.h @@ -5,6 +5,7 @@ #include #include +#include #include @@ -27,6 +28,7 @@ class Connection; class PublicRoomListModel : public QAbstractListModel { Q_OBJECT + QML_ELEMENT /** * @brief The current connection that the model is getting its rooms from. diff --git a/src/models/pushrulemodel.h b/src/models/pushrulemodel.h index 476b84eae..0e4ed0e09 100644 --- a/src/models/pushrulemodel.h +++ b/src/models/pushrulemodel.h @@ -4,6 +4,7 @@ #pragma once #include +#include #include @@ -20,6 +21,8 @@ class PushNotificationKind : public QObject { Q_OBJECT + QML_ELEMENT + QML_UNCREATABLE("") public: /** @@ -71,6 +74,8 @@ public: class PushNotificationSection : public QObject { Q_OBJECT + QML_ELEMENT + QML_UNCREATABLE("") public: /** @@ -130,6 +135,7 @@ public: class PushRuleModel : public QAbstractListModel { Q_OBJECT + QML_ELEMENT /** * @brief The default state for any newly created keyword rule. diff --git a/src/models/reactionmodel.h b/src/models/reactionmodel.h index d99d2235b..a9f2df796 100644 --- a/src/models/reactionmodel.h +++ b/src/models/reactionmodel.h @@ -4,6 +4,7 @@ #pragma once #include +#include namespace Quotient { @@ -18,6 +19,7 @@ class User; class ReactionModel : public QAbstractListModel { Q_OBJECT + QML_ELEMENT public: /** diff --git a/src/models/roomlistmodel.h b/src/models/roomlistmodel.h index c085ec3e1..3f56eb534 100644 --- a/src/models/roomlistmodel.h +++ b/src/models/roomlistmodel.h @@ -6,6 +6,7 @@ #include #include +#include class NeoChatRoom; @@ -18,6 +19,8 @@ class Room; class NeoChatRoomType : public QObject { Q_OBJECT + QML_ELEMENT + QML_UNCREATABLE("") public: /** @@ -42,6 +45,7 @@ public: class RoomListModel : public QAbstractListModel { Q_OBJECT + QML_ELEMENT /** * @brief The current connection that the model is getting its rooms from. diff --git a/src/models/searchmodel.h b/src/models/searchmodel.h index 8c012acea..4f31b21bb 100644 --- a/src/models/searchmodel.h +++ b/src/models/searchmodel.h @@ -4,6 +4,7 @@ #pragma once #include +#include #include #include @@ -23,6 +24,7 @@ class NeoChatRoom; class SearchModel : public QAbstractListModel { Q_OBJECT + QML_ELEMENT /** * @brief The text to search messages for. diff --git a/src/models/serverlistmodel.h b/src/models/serverlistmodel.h index 0bb796d10..30a28eb32 100644 --- a/src/models/serverlistmodel.h +++ b/src/models/serverlistmodel.h @@ -7,6 +7,7 @@ #include #include +#include #include /** @@ -24,6 +25,7 @@ class ServerListModel : public QAbstractListModel { Q_OBJECT + QML_ELEMENT public: /** diff --git a/src/models/sortfilterroomlistmodel.h b/src/models/sortfilterroomlistmodel.h index 565789309..dd9f222f6 100644 --- a/src/models/sortfilterroomlistmodel.h +++ b/src/models/sortfilterroomlistmodel.h @@ -3,6 +3,7 @@ #pragma once +#include #include /** @@ -27,6 +28,7 @@ class SortFilterRoomListModel : public QSortFilterProxyModel { Q_OBJECT + QML_ELEMENT /** * @brief The order by which the rooms will be sorted. diff --git a/src/models/sortfilterspacelistmodel.h b/src/models/sortfilterspacelistmodel.h index 40c611876..22bc75473 100644 --- a/src/models/sortfilterspacelistmodel.h +++ b/src/models/sortfilterspacelistmodel.h @@ -3,6 +3,7 @@ #pragma once +#include #include /** @@ -16,6 +17,8 @@ class SortFilterSpaceListModel : public QSortFilterProxyModel { Q_OBJECT + QML_ELEMENT + /** * @brief The number of spaces in the model. */ diff --git a/src/models/statefiltermodel.h b/src/models/statefiltermodel.h index 8a1efebd7..eaaed703f 100644 --- a/src/models/statefiltermodel.h +++ b/src/models/statefiltermodel.h @@ -3,6 +3,7 @@ #pragma once +#include #include /** @@ -14,6 +15,7 @@ class StateFilterModel : public QSortFilterProxyModel { Q_OBJECT + QML_ELEMENT public: /** diff --git a/src/models/statemodel.h b/src/models/statemodel.h index cc47db135..d3c7ec5c6 100644 --- a/src/models/statemodel.h +++ b/src/models/statemodel.h @@ -4,6 +4,7 @@ #pragma once #include +#include #include "neochatroom.h" @@ -15,6 +16,7 @@ class StateModel : public QAbstractListModel { Q_OBJECT + QML_ELEMENT /** * @brief The current room that the model is getting its state events from. diff --git a/src/models/stickermodel.h b/src/models/stickermodel.h index 8c4a68998..4c25a3fe8 100644 --- a/src/models/stickermodel.h +++ b/src/models/stickermodel.h @@ -7,6 +7,7 @@ #include "neochatroom.h" #include #include +#include #include class ImagePacksModel; @@ -22,6 +23,7 @@ class ImagePacksModel; class StickerModel : public QAbstractListModel { Q_OBJECT + QML_ELEMENT /** * @brief The image pack that the stickers come from. diff --git a/src/models/userdirectorylistmodel.h b/src/models/userdirectorylistmodel.h index 37006a9f3..d4bceb00a 100644 --- a/src/models/userdirectorylistmodel.h +++ b/src/models/userdirectorylistmodel.h @@ -5,6 +5,7 @@ #include #include +#include #include @@ -26,6 +27,7 @@ class Connection; class UserDirectoryListModel : public QAbstractListModel { Q_OBJECT + QML_ELEMENT /** * @brief The current connection that the model is getting users from. diff --git a/src/models/userfiltermodel.h b/src/models/userfiltermodel.h index a54b26dc1..9952f0fda 100644 --- a/src/models/userfiltermodel.h +++ b/src/models/userfiltermodel.h @@ -3,6 +3,7 @@ #pragma once +#include #include /** @@ -15,6 +16,7 @@ class UserFilterModel : public QSortFilterProxyModel { Q_OBJECT + QML_ELEMENT /** * @brief This property hold the text of the filter. diff --git a/src/models/userlistmodel.h b/src/models/userlistmodel.h index ffb72c4bd..4d1e0bd46 100644 --- a/src/models/userlistmodel.h +++ b/src/models/userlistmodel.h @@ -8,6 +8,7 @@ #include #include #include +#include class NeoChatRoom; @@ -29,6 +30,7 @@ class User; class UserListModel : public QAbstractListModel { Q_OBJECT + QML_ELEMENT /** * @brief The room that the model is getting its users from. diff --git a/src/models/webshortcutmodel.cpp b/src/models/webshortcutmodel.cpp index 2d69a1a57..70b491f9f 100644 --- a/src/models/webshortcutmodel.cpp +++ b/src/models/webshortcutmodel.cpp @@ -10,7 +10,7 @@ #endif #include -struct KWebShortcutModelPrivate { +struct WebShortcutModelPrivate { QString selectedText; #ifdef HAVE_KIO KUriFilterData filterData; @@ -18,27 +18,27 @@ struct KWebShortcutModelPrivate { QStringList searchProviders; }; -KWebShortcutModel::KWebShortcutModel(QObject *parent) +WebShortcutModel::WebShortcutModel(QObject *parent) : QAbstractListModel(parent) - , d(new KWebShortcutModelPrivate) + , d(new WebShortcutModelPrivate) { } -KWebShortcutModel::~KWebShortcutModel() +WebShortcutModel::~WebShortcutModel() { } -QString KWebShortcutModel::selectedText() const +QString WebShortcutModel::selectedText() const { return d->selectedText; } -QString KWebShortcutModel::trunkatedSearchText() const +QString WebShortcutModel::trunkatedSearchText() const { return KStringHandler::rsqueeze(d->selectedText, 21); } -bool KWebShortcutModel::enabled() const +bool WebShortcutModel::enabled() const { #ifdef HAVE_KIO return true; @@ -47,7 +47,7 @@ bool KWebShortcutModel::enabled() const #endif } -void KWebShortcutModel::setSelectedText(const QString &selectedText) +void WebShortcutModel::setSelectedText(const QString &selectedText) { if (d->selectedText == selectedText) { return; @@ -80,7 +80,7 @@ void KWebShortcutModel::setSelectedText(const QString &selectedText) Q_EMIT selectedTextChanged(); } -int KWebShortcutModel::rowCount(const QModelIndex &parent) const +int WebShortcutModel::rowCount(const QModelIndex &parent) const { Q_UNUSED(parent); #ifdef HAVE_KIO @@ -91,7 +91,7 @@ int KWebShortcutModel::rowCount(const QModelIndex &parent) const return 0; } -QVariant KWebShortcutModel::data(const QModelIndex &index, int role) const +QVariant WebShortcutModel::data(const QModelIndex &index, int role) const { if (!index.isValid()) { return {}; @@ -110,7 +110,7 @@ QVariant KWebShortcutModel::data(const QModelIndex &index, int role) const return {}; } -void KWebShortcutModel::trigger(const QString &data) +void WebShortcutModel::trigger(const QString &data) { #ifdef HAVE_KIO KUriFilterData filterData(data); @@ -122,7 +122,7 @@ void KWebShortcutModel::trigger(const QString &data) #endif } -void KWebShortcutModel::configureWebShortcuts() +void WebShortcutModel::configureWebShortcuts() { #ifdef HAVE_KIO auto job = new KIO::CommandLauncherJob(QStringLiteral("kcmshell5"), QStringList() << QStringLiteral("webshortcuts"), this); diff --git a/src/models/webshortcutmodel.h b/src/models/webshortcutmodel.h index 1a596ec51..662f90e20 100644 --- a/src/models/webshortcutmodel.h +++ b/src/models/webshortcutmodel.h @@ -4,12 +4,13 @@ #pragma once #include +#include #include -struct KWebShortcutModelPrivate; +struct WebShortcutModelPrivate; /** - * @class KWebShortcutModel + * @class WebShortcutModel * * This class defines the model for listing web shortcuts for a specified selectedText. * @@ -45,9 +46,10 @@ struct KWebShortcutModelPrivate; * } * ``` */ -class KWebShortcutModel : public QAbstractListModel +class WebShortcutModel : public QAbstractListModel { Q_OBJECT + QML_ELEMENT /** * @brief The text to find web shortcuts for. @@ -64,8 +66,8 @@ class KWebShortcutModel : public QAbstractListModel */ Q_PROPERTY(bool enabled READ enabled CONSTANT) public: - explicit KWebShortcutModel(QObject *parent = nullptr); - ~KWebShortcutModel(); + explicit WebShortcutModel(QObject *parent = nullptr); + ~WebShortcutModel(); QString selectedText() const; void setSelectedText(const QString &selectedText); @@ -103,5 +105,5 @@ Q_SIGNALS: void openUrl(const QUrl &url); private: - std::unique_ptr d; + std::unique_ptr d; }; diff --git a/src/neochatconnection.h b/src/neochatconnection.h index 907fd3e7f..81491df74 100644 --- a/src/neochatconnection.h +++ b/src/neochatconnection.h @@ -4,12 +4,15 @@ #pragma once #include +#include #include class NeoChatConnection : public Quotient::Connection { Q_OBJECT + QML_ELEMENT + QML_UNCREATABLE("") /** * @brief The account label for this account. diff --git a/src/neochatroom.h b/src/neochatroom.h index 39a3e838d..df1e5b320 100644 --- a/src/neochatroom.h +++ b/src/neochatroom.h @@ -7,6 +7,7 @@ #include #include +#include #include #include @@ -22,6 +23,8 @@ class User; class PushNotificationState : public QObject { Q_OBJECT + QML_ELEMENT + QML_UNCREATABLE("") public: /** @@ -63,6 +66,8 @@ struct Mention { class NeoChatRoom : public Quotient::Room { Q_OBJECT + QML_ELEMENT + QML_UNCREATABLE("") /** * @brief A list of users currently typing in the room. diff --git a/src/notificationsmanager.h b/src/notificationsmanager.h index 1f6fc0e32..fd51e13c7 100644 --- a/src/notificationsmanager.h +++ b/src/notificationsmanager.h @@ -8,6 +8,7 @@ #include #include #include +#include #include #include #include @@ -19,6 +20,8 @@ class NeoChatRoom; class PushNotificationAction : public QObject { Q_OBJECT + QML_ELEMENT + QML_UNCREATABLE("") public: /** @@ -51,9 +54,15 @@ public: class NotificationsManager : public QObject { Q_OBJECT + QML_ELEMENT + QML_SINGLETON public: static NotificationsManager &instance(); + static NotificationsManager *create(QQmlEngine *, QJSEngine *) + { + return &instance(); + } /** * @brief Display a native notification for an message. diff --git a/src/pollhandler.h b/src/pollhandler.h index aa19cc24b..af545ad03 100644 --- a/src/pollhandler.h +++ b/src/pollhandler.h @@ -6,6 +6,7 @@ #include #include #include +#include class NeoChatRoom; @@ -23,6 +24,7 @@ class NeoChatRoom; class PollHandler : public QObject { Q_OBJECT + QML_ELEMENT /** * @brief The current room for the poll. diff --git a/src/qml/Settings/About.qml b/src/qml/About.qml similarity index 100% rename from src/qml/Settings/About.qml rename to src/qml/About.qml diff --git a/src/qml/Settings/AboutKDE.qml b/src/qml/AboutKDE.qml similarity index 100% rename from src/qml/Settings/AboutKDE.qml rename to src/qml/AboutKDE.qml diff --git a/src/qml/Settings/AccountEditorPage.qml b/src/qml/AccountEditorPage.qml similarity index 97% rename from src/qml/Settings/AccountEditorPage.qml rename to src/qml/AccountEditorPage.qml index 6ae942bd3..6496bdab7 100644 --- a/src/qml/Settings/AccountEditorPage.qml +++ b/src/qml/AccountEditorPage.qml @@ -212,7 +212,7 @@ FormCard.FormCardPage { FormCard.FormButtonDelegate { id: deactivateAccountButton text: i18n("Deactivate Account") - onClicked: pageStack.pushDialogLayer("qrc:/ConfirmDeactivateAccountDialog.qml", {connection: root.connection}, {title: i18nc("@title", "Confirm Deactivating Account")}) + onClicked: pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/ConfirmDeactivateAccountDialog.qml", {connection: root.connection}, {title: i18nc("@title", "Confirm Deactivating Account")}) } } } diff --git a/src/qml/Page/RoomList/AccountMenu.qml b/src/qml/AccountMenu.qml similarity index 80% rename from src/qml/Page/RoomList/AccountMenu.qml rename to src/qml/AccountMenu.qml index a4f28bbc8..0fbd2b718 100644 --- a/src/qml/Page/RoomList/AccountMenu.qml +++ b/src/qml/AccountMenu.qml @@ -8,7 +8,7 @@ import QtQuick.Layouts import org.kde.kirigami as Kirigami import org.kde.neochat -import '../Dialog' as Dialog +import org.kde.neochat.config QQC2.Menu { id: root @@ -20,7 +20,7 @@ QQC2.Menu { QQC2.MenuItem { text: i18n("Edit this account") icon.name: "document-edit" - onTriggered: pageStack.pushDialogLayer("qrc:/AccountEditorPage.qml", { + onTriggered: pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/AccountEditorPage.qml", { connection: root.connection }, { title: i18n("Account editor") @@ -29,7 +29,7 @@ QQC2.Menu { QQC2.MenuItem { text: i18n("Notification settings") icon.name: "notifications" - onTriggered: pageStack.pushDialogLayer("qrc:/SettingsPage.qml", { + onTriggered: pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/SettingsPage.qml", { defaultPage: "notifications", connection: root.connection, }, { @@ -39,7 +39,7 @@ QQC2.Menu { QQC2.MenuItem { text: i18n("Devices") icon.name: "computer-symbolic" - onTriggered: pageStack.pushDialogLayer("qrc:/SettingsPage.qml", { + onTriggered: pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/SettingsPage.qml", { defaultPage: "devices", connection: root.connection, }, { @@ -54,7 +54,7 @@ QQC2.Menu { Component { id: confirmLogoutDialogComponent - Dialog.ConfirmLogout { + ConfirmLogoutDialog { connection: root.connection } } diff --git a/src/qml/Settings/AccountsPage.qml b/src/qml/AccountsPage.qml similarity index 94% rename from src/qml/Settings/AccountsPage.qml rename to src/qml/AccountsPage.qml index c023e1134..5be384bec 100644 --- a/src/qml/Settings/AccountsPage.qml +++ b/src/qml/AccountsPage.qml @@ -12,7 +12,7 @@ import org.kde.kirigamiaddons.formcard as FormCard import org.kde.kirigamiaddons.labs.components as KirigamiComponents import org.kde.neochat -import 'Dialog' as Dialog +import org.kde.neochat.accounts FormCard.FormCardPage { id: root @@ -29,7 +29,7 @@ FormCard.FormCardPage { id: accountDelegate required property NeoChatConnection connection Layout.fillWidth: true - onClicked: pageStack.layers.push("qrc:/AccountEditorPage.qml", { + onClicked: pageStack.layers.push("qrc:/org/kde/neochat/qml/AccountEditorPage.qml", { connection: accountDelegate.connection }, { title: i18n("Account editor") @@ -76,7 +76,7 @@ FormCard.FormCardPage { Component { id: confirmLogoutDialogComponent - Dialog.ConfirmLogout { + ConfirmLogoutDialog { connection: model.connection onAccepted: { if (AccountRegistry.accountCount === 1) { @@ -99,7 +99,7 @@ FormCard.FormCardPage { id: addAccountDelegate text: i18n("Add Account") icon.name: "list-add" - onClicked: pageStack.layers.push("qrc:/WelcomePage.qml") + onClicked: pageStack.layers.push("qrc:/org/kde/neochat/qml/WelcomePage.qml") } } diff --git a/src/qml/Settings/AppearanceSettingsPage.qml b/src/qml/AppearanceSettingsPage.qml similarity index 99% rename from src/qml/Settings/AppearanceSettingsPage.qml rename to src/qml/AppearanceSettingsPage.qml index 407224ea5..88332abaa 100644 --- a/src/qml/Settings/AppearanceSettingsPage.qml +++ b/src/qml/AppearanceSettingsPage.qml @@ -11,6 +11,7 @@ import org.kde.kirigamiaddons.formcard as FormCard import org.kde.kirigamiaddons.labs.components as KirigamiComponents import org.kde.neochat +import org.kde.neochat.config FormCard.FormCardPage { id: root @@ -212,7 +213,7 @@ FormCard.FormCardPage { Loader { id: colorSchemeDelegate visible: item !== null && Qt.platform.os !== "android" - source: "qrc:/ColorScheme.qml" + source: "qrc:/org/kde/neochat/qml/ColorScheme.qml" Layout.fillWidth: true } } diff --git a/src/qml/Component/ChatBox/AttachmentPane.qml b/src/qml/AttachmentPane.qml similarity index 100% rename from src/qml/Component/ChatBox/AttachmentPane.qml rename to src/qml/AttachmentPane.qml diff --git a/src/qml/Component/Timeline/AudioDelegate.qml b/src/qml/AudioDelegate.qml similarity index 100% rename from src/qml/Component/Timeline/AudioDelegate.qml rename to src/qml/AudioDelegate.qml diff --git a/src/qml/Component/Timeline/AvatarFlow.qml b/src/qml/AvatarFlow.qml similarity index 100% rename from src/qml/Component/Timeline/AvatarFlow.qml rename to src/qml/AvatarFlow.qml diff --git a/src/qml/Component/AvatarTabButton.qml b/src/qml/AvatarTabButton.qml similarity index 100% rename from src/qml/Component/AvatarTabButton.qml rename to src/qml/AvatarTabButton.qml diff --git a/src/qml/Menu/Timeline/BanSheet.qml b/src/qml/BanSheet.qml similarity index 100% rename from src/qml/Menu/Timeline/BanSheet.qml rename to src/qml/BanSheet.qml diff --git a/src/qml/Component/Timeline/Bubble.qml b/src/qml/Bubble.qml similarity index 100% rename from src/qml/Component/Timeline/Bubble.qml rename to src/qml/Bubble.qml diff --git a/src/qml/Component/Login/Captcha.qml b/src/qml/Captcha.qml similarity index 94% rename from src/qml/Component/Login/Captcha.qml rename to src/qml/Captcha.qml index fd6b7b41a..f096f993f 100644 --- a/src/qml/Component/Login/Captcha.qml +++ b/src/qml/Captcha.qml @@ -43,6 +43,6 @@ LoginStep { } } previousAction: Kirigami.Action { - onTriggered: root.processed("qrc:/Username.qml") + onTriggered: root.processed("qrc:/org/kde/neochat/qml/Username.qml") } } diff --git a/src/qml/RoomSettings/Categories.qml b/src/qml/Categories.qml similarity index 100% rename from src/qml/RoomSettings/Categories.qml rename to src/qml/Categories.qml diff --git a/src/qml/Component/ChatBox/ChatBar.qml b/src/qml/ChatBar.qml similarity index 99% rename from src/qml/Component/ChatBox/ChatBar.qml rename to src/qml/ChatBar.qml index 771b9e2f3..4a6b979c0 100644 --- a/src/qml/Component/ChatBox/ChatBar.qml +++ b/src/qml/ChatBar.qml @@ -10,6 +10,7 @@ import Qt.labs.platform as Platform import org.kde.kirigami as Kirigami import org.kde.neochat +import org.kde.neochat.config /** * @brief The component which handles the message sending. diff --git a/src/qml/Component/ChatBox/ChatBox.qml b/src/qml/ChatBox.qml similarity index 100% rename from src/qml/Component/ChatBox/ChatBox.qml rename to src/qml/ChatBox.qml diff --git a/src/qml/Page/ChooseRoomDialog.qml b/src/qml/ChooseRoomDialog.qml similarity index 97% rename from src/qml/Page/ChooseRoomDialog.qml rename to src/qml/ChooseRoomDialog.qml index 9cd4b5f62..42ce72859 100644 --- a/src/qml/Page/ChooseRoomDialog.qml +++ b/src/qml/ChooseRoomDialog.qml @@ -8,8 +8,6 @@ import org.kde.kirigami as Kirigami import org.kde.neochat -import "./RoomList" - Kirigami.ScrollablePage { id: root diff --git a/src/qml/Page/RoomList/CollapsedRoomDelegate.qml b/src/qml/CollapsedRoomDelegate.qml similarity index 98% rename from src/qml/Page/RoomList/CollapsedRoomDelegate.qml rename to src/qml/CollapsedRoomDelegate.qml index 09469e7d2..cb2432d2d 100644 --- a/src/qml/Page/RoomList/CollapsedRoomDelegate.qml +++ b/src/qml/CollapsedRoomDelegate.qml @@ -11,8 +11,7 @@ import org.kde.kirigamiaddons.labs.components as KirigamiComponents import org.kde.kitemmodels import org.kde.neochat - -import './' as RoomList +import org.kde.neochat.config QQC2.ItemDelegate { id: root diff --git a/src/qml/Settings/ColorScheme.qml b/src/qml/ColorScheme.qml similarity index 95% rename from src/qml/Settings/ColorScheme.qml rename to src/qml/ColorScheme.qml index 6601b0675..f81315e68 100644 --- a/src/qml/Settings/ColorScheme.qml +++ b/src/qml/ColorScheme.qml @@ -7,6 +7,7 @@ import QtQuick.Layouts import org.kde.kirigamiaddons.formcard as FormCard import org.kde.neochat +import org.kde.neochat.config FormCard.FormComboBoxDelegate { id: root diff --git a/src/qml/Component/ChatBox/CompletionMenu.qml b/src/qml/CompletionMenu.qml similarity index 100% rename from src/qml/Component/ChatBox/CompletionMenu.qml rename to src/qml/CompletionMenu.qml diff --git a/src/qml/Dialog/ConfirmDeactivateAccountDialog.qml b/src/qml/ConfirmDeactivateAccountDialog.qml similarity index 100% rename from src/qml/Dialog/ConfirmDeactivateAccountDialog.qml rename to src/qml/ConfirmDeactivateAccountDialog.qml diff --git a/src/qml/Dialog/ConfirmEncryptionDialog.qml b/src/qml/ConfirmEncryptionDialog.qml similarity index 100% rename from src/qml/Dialog/ConfirmEncryptionDialog.qml rename to src/qml/ConfirmEncryptionDialog.qml diff --git a/src/qml/Dialog/ConfirmLogout.qml b/src/qml/ConfirmLogoutDialog.qml similarity index 100% rename from src/qml/Dialog/ConfirmLogout.qml rename to src/qml/ConfirmLogoutDialog.qml diff --git a/src/qml/Page/RoomList/ContextMenu.qml b/src/qml/ContextMenu.qml similarity index 96% rename from src/qml/Page/RoomList/ContextMenu.qml rename to src/qml/ContextMenu.qml index 0b2a2c9bf..f5bd4c4e7 100644 --- a/src/qml/Page/RoomList/ContextMenu.qml +++ b/src/qml/ContextMenu.qml @@ -120,7 +120,7 @@ Loader { QQC2.MenuItem { text: i18n("Room Settings") icon.name: "configure" - onTriggered: QQC2.ApplicationWindow.window.pageStack.pushDialogLayer('qrc:/Categories.qml', {room: room, connection: connection}, { title: i18n("Room Settings") }) + onTriggered: QQC2.ApplicationWindow.window.pageStack.pushDialogLayer('qrc:/org/kde/neochat/qml/Categories.qml', {room: room, connection: connection}, { title: i18n("Room Settings") }) } QQC2.MenuSeparator {} @@ -190,7 +190,7 @@ Loader { QQC2.ToolButton { icon.name: 'settings-configure' onClicked: { - QQC2.ApplicationWindow.window.pageStack.pushDialogLayer('qrc:/Categories.qml', {room: room, connection: root.connection}, { title: i18n("Room Settings") }) + QQC2.ApplicationWindow.window.pageStack.pushDialogLayer('qrc:/org/kde/neochat/qml/Categories.qml', {room: room, connection: root.connection}, { title: i18n("Room Settings") }) drawer.close() } } diff --git a/src/qml/Dialog/CreateRoomDialog.qml b/src/qml/CreateRoomDialog.qml similarity index 100% rename from src/qml/Dialog/CreateRoomDialog.qml rename to src/qml/CreateRoomDialog.qml diff --git a/src/qml/Dialog/CreateSpaceDialog.qml b/src/qml/CreateSpaceDialog.qml similarity index 100% rename from src/qml/Dialog/CreateSpaceDialog.qml rename to src/qml/CreateSpaceDialog.qml diff --git a/src/qml/Settings/DeviceDelegate.qml b/src/qml/DeviceDelegate.qml similarity index 100% rename from src/qml/Settings/DeviceDelegate.qml rename to src/qml/DeviceDelegate.qml diff --git a/src/qml/Settings/DevicesCard.qml b/src/qml/DevicesCard.qml similarity index 100% rename from src/qml/Settings/DevicesCard.qml rename to src/qml/DevicesCard.qml diff --git a/src/qml/Settings/DevicesPage.qml b/src/qml/DevicesPage.qml similarity index 100% rename from src/qml/Settings/DevicesPage.qml rename to src/qml/DevicesPage.qml diff --git a/src/qml/Page/DevtoolsPage.qml b/src/qml/DevtoolsPage.qml similarity index 100% rename from src/qml/Page/DevtoolsPage.qml rename to src/qml/DevtoolsPage.qml diff --git a/src/qml/RoomDrawer/DirectChatDrawerHeader.qml b/src/qml/DirectChatDrawerHeader.qml similarity index 100% rename from src/qml/RoomDrawer/DirectChatDrawerHeader.qml rename to src/qml/DirectChatDrawerHeader.qml diff --git a/src/qml/Menu/EditMenu.qml b/src/qml/EditMenu.qml similarity index 100% rename from src/qml/Menu/EditMenu.qml rename to src/qml/EditMenu.qml diff --git a/src/qml/Component/Login/Email.qml b/src/qml/Email.qml similarity index 95% rename from src/qml/Component/Login/Email.qml rename to src/qml/Email.qml index fd973083c..a1bc4f0c0 100644 --- a/src/qml/Component/Login/Email.qml +++ b/src/qml/Email.qml @@ -53,6 +53,6 @@ LoginStep { } } previousAction: Kirigami.Action { - onTriggered: root.processed("qrc:/Username.qml") + onTriggered: root.processed("qrc:/org/kde/neochat/qml/Username.qml") } } diff --git a/src/qml/Component/Emoji/EmojiDelegate.qml b/src/qml/EmojiDelegate.qml similarity index 100% rename from src/qml/Component/Emoji/EmojiDelegate.qml rename to src/qml/EmojiDelegate.qml diff --git a/src/qml/Dialog/EmojiDialog.qml b/src/qml/EmojiDialog.qml similarity index 100% rename from src/qml/Dialog/EmojiDialog.qml rename to src/qml/EmojiDialog.qml diff --git a/src/qml/Component/Emoji/EmojiGrid.qml b/src/qml/EmojiGrid.qml similarity index 100% rename from src/qml/Component/Emoji/EmojiGrid.qml rename to src/qml/EmojiGrid.qml diff --git a/src/qml/Dialog/KeyVerification/EmojiItem.qml b/src/qml/EmojiItem.qml similarity index 100% rename from src/qml/Dialog/KeyVerification/EmojiItem.qml rename to src/qml/EmojiItem.qml diff --git a/src/qml/Component/Emoji/EmojiPicker.qml b/src/qml/EmojiPicker.qml similarity index 100% rename from src/qml/Component/Emoji/EmojiPicker.qml rename to src/qml/EmojiPicker.qml diff --git a/src/qml/Dialog/KeyVerification/EmojiRow.qml b/src/qml/EmojiRow.qml similarity index 100% rename from src/qml/Dialog/KeyVerification/EmojiRow.qml rename to src/qml/EmojiRow.qml diff --git a/src/qml/Dialog/KeyVerification/EmojiSas.qml b/src/qml/EmojiSas.qml similarity index 100% rename from src/qml/Dialog/KeyVerification/EmojiSas.qml rename to src/qml/EmojiSas.qml diff --git a/src/qml/Component/Emoji/EmojiTonesPicker.qml b/src/qml/EmojiTonesPicker.qml similarity index 100% rename from src/qml/Component/Emoji/EmojiTonesPicker.qml rename to src/qml/EmojiTonesPicker.qml diff --git a/src/qml/Settings/EmoticonEditorPage.qml b/src/qml/EmoticonEditorPage.qml similarity index 100% rename from src/qml/Settings/EmoticonEditorPage.qml rename to src/qml/EmoticonEditorPage.qml diff --git a/src/qml/Settings/EmoticonFormCard.qml b/src/qml/EmoticonFormCard.qml similarity index 100% rename from src/qml/Settings/EmoticonFormCard.qml rename to src/qml/EmoticonFormCard.qml diff --git a/src/qml/Settings/EmoticonsPage.qml b/src/qml/EmoticonsPage.qml similarity index 100% rename from src/qml/Settings/EmoticonsPage.qml rename to src/qml/EmoticonsPage.qml diff --git a/src/qml/Component/Timeline/EncryptedDelegate.qml b/src/qml/EncryptedDelegate.qml similarity index 97% rename from src/qml/Component/Timeline/EncryptedDelegate.qml rename to src/qml/EncryptedDelegate.qml index d14dc0aa8..1b32c8849 100644 --- a/src/qml/Component/Timeline/EncryptedDelegate.qml +++ b/src/qml/EncryptedDelegate.qml @@ -6,6 +6,7 @@ import QtQuick.Layouts import org.kde.kirigami as Kirigami import org.kde.neochat +import org.kde.neochat.config /** * @brief A timeline delegate for an encrypted message that can't be decrypted. diff --git a/src/qml/Component/Timeline/EventDelegate.qml b/src/qml/EventDelegate.qml similarity index 100% rename from src/qml/Component/Timeline/EventDelegate.qml rename to src/qml/EventDelegate.qml diff --git a/src/qml/Page/RoomList/ExploreComponent.qml b/src/qml/ExploreComponent.qml similarity index 87% rename from src/qml/Page/RoomList/ExploreComponent.qml rename to src/qml/ExploreComponent.qml index 81e382604..19e6f6c25 100644 --- a/src/qml/Page/RoomList/ExploreComponent.qml +++ b/src/qml/ExploreComponent.qml @@ -21,7 +21,7 @@ RowLayout { text: i18n("Explore rooms") icon.name: "compass" onTriggered: { - let dialog = pageStack.pushDialogLayer("qrc:/JoinRoomPage.qml", {connection: root.connection}, {title: i18nc("@title", "Explore Rooms")}) + let dialog = pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/JoinRoomPage.qml", {connection: root.connection}, {title: i18nc("@title", "Explore Rooms")}) dialog.roomSelected.connect((roomId, displayName, avatarUrl, alias, topic, memberCount, isJoined) => { if (isJoined) { RoomManager.enterRoom(root.connection.room(roomId)) @@ -34,13 +34,13 @@ RowLayout { property Kirigami.Action chatAction: Kirigami.Action { text: i18n("Start a Chat") icon.name: "list-add-user" - onTriggered: pageStack.pushDialogLayer("qrc:/StartChatPage.qml", {connection: root.connection}, {title: i18nc("@title", "Start a Chat")}) + onTriggered: pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/StartChatPage.qml", {connection: root.connection}, {title: i18nc("@title", "Start a Chat")}) } property Kirigami.Action roomAction: Kirigami.Action { text: i18n("Create a Room") icon.name: "system-users" onTriggered: { - pageStack.pushDialogLayer("qrc:/CreateRoomDialog.qml", {connection: root.connection}, {title: i18nc("@title", "Create a Room")}) + pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/CreateRoomDialog.qml", {connection: root.connection}, {title: i18nc("@title", "Create a Room")}) } shortcut: StandardKey.New } @@ -48,7 +48,7 @@ RowLayout { text: i18n("Create a Space") icon.name: "list-add" onTriggered: { - pageStack.pushDialogLayer("qrc:/CreateSpaceDialog.qml", {connection: root.connection}, {title: i18nc("@title", "Create a Space")}) + pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/CreateSpaceDialog.qml", {connection: root.connection}, {title: i18nc("@title", "Create a Space")}) } } diff --git a/src/qml/Page/ExplorerDelegate.qml b/src/qml/ExplorerDelegate.qml similarity index 100% rename from src/qml/Page/ExplorerDelegate.qml rename to src/qml/ExplorerDelegate.qml diff --git a/src/qml/Component/FancyEffectsContainer.qml b/src/qml/FancyEffectsContainer.qml similarity index 97% rename from src/qml/Component/FancyEffectsContainer.qml rename to src/qml/FancyEffectsContainer.qml index 71b9b623d..477c37b69 100644 --- a/src/qml/Component/FancyEffectsContainer.qml +++ b/src/qml/FancyEffectsContainer.qml @@ -61,7 +61,7 @@ Item { } ImageParticle { - source: "qrc:/confetti.png" + source: "qrc:/org/kde/neochat/qml/confetti.png" entryEffect: ImageParticle.Scale rotationVariation: 360 rotationVelocity: 90 @@ -205,7 +205,7 @@ Item { ImageParticle { id: fireworksParticleA system: fireworksSystem - source: "qrc:/glowdot.png" + source: "qrc:/org/kde/neochat/qml/glowdot.png" alphaVariation: root.isThemeDark ? 0.1 : 0.1 alpha: root.isThemeDark ? 0.5 : 1 groups: ["a"] @@ -216,7 +216,7 @@ Item { ImageParticle { system: fireworksSystem - source: "qrc:/glowdot.png" + source: "qrc:/org/kde/neochat/qml/glowdot.png" color: root.isThemeDark ? "white" : "gold" alphaVariation: root.isThemeDark ? 0.1 : 0.1 alpha: root.isThemeDark ? 0.5 : 1 @@ -229,7 +229,7 @@ Item { ImageParticle { id: fireworksParticleB system: fireworksSystem - source: "qrc:/glowdot.png" + source: "qrc:/org/kde/neochat/qml/glowdot.png" alphaVariation: root.isThemeDark ? 0.1 : 0.1 alpha: root.isThemeDark ? 0.5 : 1 groups: ["b"] diff --git a/src/qml/Component/Timeline/FileDelegate.qml b/src/qml/FileDelegate.qml similarity index 99% rename from src/qml/Component/Timeline/FileDelegate.qml rename to src/qml/FileDelegate.qml index 9b7483e86..45c6d8269 100644 --- a/src/qml/Component/Timeline/FileDelegate.qml +++ b/src/qml/FileDelegate.qml @@ -9,6 +9,7 @@ import Qt.labs.platform import org.kde.kirigami as Kirigami import org.kde.neochat +import org.kde.neochat.config /** * @brief A timeline delegate for an file message. diff --git a/src/qml/Menu/Timeline/FileDelegateContextMenu.qml b/src/qml/FileDelegateContextMenu.qml similarity index 95% rename from src/qml/Menu/Timeline/FileDelegateContextMenu.qml rename to src/qml/FileDelegateContextMenu.qml index 9385118e6..a8a498817 100644 --- a/src/qml/Menu/Timeline/FileDelegateContextMenu.qml +++ b/src/qml/FileDelegateContextMenu.qml @@ -8,6 +8,7 @@ import Qt.labs.platform import org.kde.kirigami as Kirigami import org.kde.neochat +import org.kde.neochat.config /** * @brief The menu for media messages. @@ -75,7 +76,7 @@ MessageDelegateContextMenu { text: i18n("Remove") icon.name: "edit-delete-remove" icon.color: "red" - onTriggered: applicationWindow().pageStack.pushDialogLayer("qrc:/RemoveSheet.qml", {room: currentRoom, eventId: eventId}, { + onTriggered: applicationWindow().pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/RemoveSheet.qml", {room: currentRoom, eventId: eventId}, { title: i18nc("@title", "Remove Message"), width: Kirigami.Units.gridUnit * 25 }) @@ -84,7 +85,7 @@ MessageDelegateContextMenu { text: i18nc("@action:button 'Report' as in 'Report this event to the administrators'", "Report") icon.name: "dialog-warning-symbolic" visible: author.id !== currentRoom.localUser.id - onTriggered: applicationWindow().pageStack.pushDialogLayer("qrc:/ReportSheet.qml", {room: currentRoom, eventId: eventId}, { + onTriggered: applicationWindow().pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/ReportSheet.qml", {room: currentRoom, eventId: eventId}, { title: i18nc("@title", "Report Message"), width: Kirigami.Units.gridUnit * 25 }) diff --git a/src/qml/Component/FullScreenMap.qml b/src/qml/FullScreenMap.qml similarity index 100% rename from src/qml/Component/FullScreenMap.qml rename to src/qml/FullScreenMap.qml diff --git a/src/qml/RoomSettings/General.qml b/src/qml/General.qml similarity index 100% rename from src/qml/RoomSettings/General.qml rename to src/qml/General.qml diff --git a/src/qml/Settings/GeneralSettingsPage.qml b/src/qml/GeneralSettingsPage.qml similarity index 99% rename from src/qml/Settings/GeneralSettingsPage.qml rename to src/qml/GeneralSettingsPage.qml index d9a448e1a..dae4a30a7 100644 --- a/src/qml/Settings/GeneralSettingsPage.qml +++ b/src/qml/GeneralSettingsPage.qml @@ -9,6 +9,7 @@ import org.kde.kirigami as Kirigami import org.kde.kirigamiaddons.formcard as FormCard import org.kde.neochat +import org.kde.neochat.config FormCard.FormCardPage { title: i18nc("@title:window", "General") diff --git a/src/qml/Menu/GlobalMenu.qml b/src/qml/GlobalMenu.qml similarity index 88% rename from src/qml/Menu/GlobalMenu.qml rename to src/qml/GlobalMenu.qml index bde9cd201..b74f65345 100644 --- a/src/qml/Menu/GlobalMenu.qml +++ b/src/qml/GlobalMenu.qml @@ -8,6 +8,8 @@ import QtQuick.Window import QtQuick.Layouts import org.kde.neochat +import org.kde.neochat.config +import org.kde.neochat.accounts Labs.MenuBar { id: root @@ -26,7 +28,7 @@ Labs.MenuBar { text: i18nc("menu", "Configure NeoChat...") shortcut: StandardKey.Preferences - onTriggered: pageStack.pushDialogLayer("qrc:/SettingsPage.qml", { + onTriggered: pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/SettingsPage.qml", { connection: root.connection }, { title: i18n("Configure") @@ -45,7 +47,7 @@ Labs.MenuBar { Labs.MenuItem { text: i18nc("menu", "New Private Chat…") enabled: pageStack.layers.currentItem.title !== i18n("Start a Chat") && AccountRegistry.accountCount > 0 - onTriggered: pushReplaceLayer("qrc:/StartChatPage.qml", {connection: root.connection}) + onTriggered: pushReplaceLayer("qrc:/org/kde/neochat/qml/StartChatPage.qml", {connection: root.connection}) } Labs.MenuItem { text: i18nc("menu", "New Group…") @@ -59,7 +61,7 @@ Labs.MenuBar { Labs.MenuItem { text: i18nc("menu", "Browse Chats…") onTriggered: { - let dialog = pageStack.pushDialogLayer("qrc:/JoinRoomPage.qml", {connection: root.connection}, {title: i18nc("@title", "Explore Rooms")}) + let dialog = pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/JoinRoomPage.qml", {connection: root.connection}, {title: i18nc("@title", "Explore Rooms")}) dialog.roomSelected.connect((roomId, displayName, avatarUrl, alias, topic, memberCount, isJoined) => { if (isJoined) { RoomManager.enterRoom(root.connection.room(roomId)) diff --git a/src/qml/Settings/GlobalNotificationsPage.qml b/src/qml/GlobalNotificationsPage.qml similarity index 100% rename from src/qml/Settings/GlobalNotificationsPage.qml rename to src/qml/GlobalNotificationsPage.qml diff --git a/src/qml/RoomDrawer/GroupChatDrawerHeader.qml b/src/qml/GroupChatDrawerHeader.qml similarity index 100% rename from src/qml/RoomDrawer/GroupChatDrawerHeader.qml rename to src/qml/GroupChatDrawerHeader.qml diff --git a/src/qml/Component/Login/Homeserver.qml b/src/qml/Homeserver.qml similarity index 88% rename from src/qml/Component/Login/Homeserver.qml rename to src/qml/Homeserver.qml index cc7cc9d8b..baec25375 100644 --- a/src/qml/Component/Login/Homeserver.qml +++ b/src/qml/Homeserver.qml @@ -38,9 +38,9 @@ LoginStep { nextAction: Kirigami.Action { text: Registration.testing ? i18n("Loading") : null enabled: Registration.status > Registration.ServerNoRegistration - onTriggered: root.processed("qrc:/Username.qml"); + onTriggered: root.processed("qrc:/org/kde/neochat/qml/Username.qml"); } previousAction: Kirigami.Action { - onTriggered: root.processed("qrc:/LoginRegister.qml") + onTriggered: root.processed("qrc:/org/kde/neochat/qml/LoginRegister.qml") } } diff --git a/src/qml/Component/HoverActions.qml b/src/qml/HoverActions.qml similarity index 100% rename from src/qml/Component/HoverActions.qml rename to src/qml/HoverActions.qml diff --git a/src/qml/Component/Timeline/ImageDelegate.qml b/src/qml/ImageDelegate.qml similarity index 100% rename from src/qml/Component/Timeline/ImageDelegate.qml rename to src/qml/ImageDelegate.qml diff --git a/src/qml/Page/ImageEditorPage.qml b/src/qml/ImageEditorPage.qml similarity index 100% rename from src/qml/Page/ImageEditorPage.qml rename to src/qml/ImageEditorPage.qml diff --git a/src/qml/Component/InvitationView.qml b/src/qml/InvitationView.qml similarity index 100% rename from src/qml/Component/InvitationView.qml rename to src/qml/InvitationView.qml diff --git a/src/qml/Page/InviteUserPage.qml b/src/qml/InviteUserPage.qml similarity index 100% rename from src/qml/Page/InviteUserPage.qml rename to src/qml/InviteUserPage.qml diff --git a/src/qml/Page/JoinRoomPage.qml b/src/qml/JoinRoomPage.qml similarity index 100% rename from src/qml/Page/JoinRoomPage.qml rename to src/qml/JoinRoomPage.qml diff --git a/src/qml/Dialog/KeyVerification/KeyVerificationDialog.qml b/src/qml/KeyVerificationDialog.qml similarity index 100% rename from src/qml/Dialog/KeyVerification/KeyVerificationDialog.qml rename to src/qml/KeyVerificationDialog.qml diff --git a/src/qml/Component/Timeline/LinkPreviewDelegate.qml b/src/qml/LinkPreviewDelegate.qml similarity index 100% rename from src/qml/Component/Timeline/LinkPreviewDelegate.qml rename to src/qml/LinkPreviewDelegate.qml diff --git a/src/qml/Component/Timeline/LiveLocationDelegate.qml b/src/qml/LiveLocationDelegate.qml similarity index 100% rename from src/qml/Component/Timeline/LiveLocationDelegate.qml rename to src/qml/LiveLocationDelegate.qml diff --git a/src/qml/Component/Login/Loading.qml b/src/qml/Loading.qml similarity index 100% rename from src/qml/Component/Login/Loading.qml rename to src/qml/Loading.qml diff --git a/src/qml/Page/LoadingPage.qml b/src/qml/LoadingPage.qml similarity index 100% rename from src/qml/Page/LoadingPage.qml rename to src/qml/LoadingPage.qml diff --git a/src/qml/Component/ChatBox/LocationChooser.qml b/src/qml/LocationChooser.qml similarity index 100% rename from src/qml/Component/ChatBox/LocationChooser.qml rename to src/qml/LocationChooser.qml diff --git a/src/qml/Component/Timeline/LocationDelegate.qml b/src/qml/LocationDelegate.qml similarity index 100% rename from src/qml/Component/Timeline/LocationDelegate.qml rename to src/qml/LocationDelegate.qml diff --git a/src/qml/Component/LocationMapItem.qml b/src/qml/LocationMapItem.qml similarity index 100% rename from src/qml/Component/LocationMapItem.qml rename to src/qml/LocationMapItem.qml diff --git a/src/qml/Component/LocationPage.qml b/src/qml/LocationsPage.qml similarity index 100% rename from src/qml/Component/LocationPage.qml rename to src/qml/LocationsPage.qml diff --git a/src/qml/Component/Login/Login.qml b/src/qml/Login.qml similarity index 83% rename from src/qml/Component/Login/Login.qml rename to src/qml/Login.qml index d0da810d6..a4d49a634 100644 --- a/src/qml/Component/Login/Login.qml +++ b/src/qml/Login.qml @@ -37,18 +37,18 @@ LoginStep { text: LoginHelper.isLoggedIn ? i18n("Already logged in") : (LoginHelper.testing && matrixIdField.acceptableInput) ? i18n("Loading…") : i18nc("@action:button", "Continue") onTriggered: { if (LoginHelper.supportsSso && LoginHelper.supportsPassword) { - processed("qrc:/LoginMethod.qml"); + processed("qrc:/org/kde/neochat/qml/LoginMethod.qml"); } else if (LoginHelper.supportsSso) { - processed("qrc:/Sso.qml"); + processed("qrc:/org/kde/neochat/qml/Sso.qml"); } else { - processed("qrc:/Password.qml"); + processed("qrc:/org/kde/neochat/qml/Password.qml"); } } enabled: LoginHelper.homeserverReachable } previousAction: Kirigami.Action { onTriggered: { - root.processed("qrc:/LoginRegister.qml") + root.processed("qrc:/org/kde/neochat/qml/LoginRegister.qml") } } } diff --git a/src/qml/Component/Login/LoginMethod.qml b/src/qml/LoginMethod.qml similarity index 81% rename from src/qml/Component/Login/LoginMethod.qml rename to src/qml/LoginMethod.qml index 381797cc5..df1aaf32b 100644 --- a/src/qml/Component/Login/LoginMethod.qml +++ b/src/qml/LoginMethod.qml @@ -16,12 +16,12 @@ LoginStep { FormCard.FormButtonDelegate { id: loginPasswordButton text: i18nc("@action:button", "Login with password") - onClicked: processed("qrc:/Password.qml") + onClicked: processed("qrc:/org/kde/neochat/qml/Password.qml") } FormCard.FormButtonDelegate { id: loginSsoButton text: i18nc("@action:button", "Login with single sign-on") - onClicked: processed("qrc:/Sso.qml") + onClicked: processed("qrc:/org/kde/neochat/qml/Sso.qml") } } diff --git a/src/qml/Component/Login/LoginRegister.qml b/src/qml/LoginRegister.qml similarity index 79% rename from src/qml/Component/Login/LoginRegister.qml rename to src/qml/LoginRegister.qml index 6fe588e7c..512ff6b8d 100644 --- a/src/qml/Component/Login/LoginRegister.qml +++ b/src/qml/LoginRegister.qml @@ -18,11 +18,11 @@ LoginStep { FormCard.FormButtonDelegate { id: loginButton text: i18nc("@action:button", "Login") - onClicked: root.processed("qrc:/Login.qml") + onClicked: root.processed("qrc:/org/kde/neochat/qml/Login.qml") } FormCard.FormButtonDelegate { text: i18nc("@action:button", "Register") - onClicked: root.processed("qrc:/Homeserver.qml") + onClicked: root.processed("qrc:/org/kde/neochat/qml/Homeserver.qml") } } diff --git a/src/qml/Component/Login/LoginStep.qml b/src/qml/LoginStep.qml similarity index 100% rename from src/qml/Component/Login/LoginStep.qml rename to src/qml/LoginStep.qml diff --git a/src/qml/Dialog/KeyVerification/Message.qml b/src/qml/Message.qml similarity index 100% rename from src/qml/Dialog/KeyVerification/Message.qml rename to src/qml/Message.qml diff --git a/src/qml/Component/Timeline/MessageDelegate.qml b/src/qml/MessageDelegate.qml similarity index 99% rename from src/qml/Component/Timeline/MessageDelegate.qml rename to src/qml/MessageDelegate.qml index 2056da85d..49260f48f 100644 --- a/src/qml/Component/Timeline/MessageDelegate.qml +++ b/src/qml/MessageDelegate.qml @@ -10,6 +10,7 @@ import org.kde.kirigami as Kirigami import org.kde.kirigamiaddons.labs.components as KirigamiComponents import org.kde.neochat +import org.kde.neochat.config /** * @brief The base delegate for all messages in the timeline. diff --git a/src/qml/Menu/Timeline/MessageDelegateContextMenu.qml b/src/qml/MessageDelegateContextMenu.qml similarity index 98% rename from src/qml/Menu/Timeline/MessageDelegateContextMenu.qml rename to src/qml/MessageDelegateContextMenu.qml index c59f05a1d..8a875da0d 100644 --- a/src/qml/Menu/Timeline/MessageDelegateContextMenu.qml +++ b/src/qml/MessageDelegateContextMenu.qml @@ -10,6 +10,7 @@ import org.kde.kirigamiaddons.components as KirigamiComponents import org.kde.kirigamiaddons.formcard as FormCard import org.kde.neochat +import org.kde.neochat.config /** * @brief The base menu for most message types. @@ -109,7 +110,7 @@ Loader { text: i18nc("@action:inmenu As in 'Forward this message'", "Forward") icon.name: "mail-forward-symbolic" onTriggered: { - let page = applicationWindow().pageStack.pushDialogLayer("qrc:/ChooseRoomDialog.qml", { + let page = applicationWindow().pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/ChooseRoomDialog.qml", { connection: root.connection }, { title: i18nc("@title", "Forward Message"), @@ -126,7 +127,7 @@ Loader { text: i18n("Remove") icon.name: "edit-delete-remove" icon.color: "red" - onTriggered: applicationWindow().pageStack.pushDialogLayer("qrc:/RemoveSheet.qml", {room: currentRoom, eventId: eventId}, { + onTriggered: applicationWindow().pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/RemoveSheet.qml", {room: currentRoom, eventId: eventId}, { title: i18nc("@title", "Remove Message"), width: Kirigami.Units.gridUnit * 25 }) @@ -140,7 +141,7 @@ Loader { text: i18nc("@action:button 'Report' as in 'Report this event to the administrators'", "Report") icon.name: "dialog-warning-symbolic" visible: author.isLocalUser - onTriggered: applicationWindow().pageStack.pushDialogLayer("qrc:/ReportSheet.qml", {room: currentRoom, eventId: eventId}, { + onTriggered: applicationWindow().pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/ReportSheet.qml", {room: currentRoom, eventId: eventId}, { title: i18nc("@title", "Report Message"), width: Kirigami.Units.gridUnit * 25 }) diff --git a/src/qml/Component/Timeline/MessageEditComponent.qml b/src/qml/MessageEditComponent.qml similarity index 100% rename from src/qml/Component/Timeline/MessageEditComponent.qml rename to src/qml/MessageEditComponent.qml diff --git a/src/qml/Menu/Timeline/MessageSourceSheet.qml b/src/qml/MessageSourceSheet.qml similarity index 100% rename from src/qml/Menu/Timeline/MessageSourceSheet.qml rename to src/qml/MessageSourceSheet.qml diff --git a/src/qml/Component/Timeline/MimeComponent.qml b/src/qml/MimeComponent.qml similarity index 100% rename from src/qml/Component/Timeline/MimeComponent.qml rename to src/qml/MimeComponent.qml diff --git a/src/qml/Component/NeochatMaximizeComponent.qml b/src/qml/NeochatMaximizeComponent.qml similarity index 99% rename from src/qml/Component/NeochatMaximizeComponent.qml rename to src/qml/NeochatMaximizeComponent.qml index 0dee5a585..f72dfffe0 100644 --- a/src/qml/Component/NeochatMaximizeComponent.qml +++ b/src/qml/NeochatMaximizeComponent.qml @@ -10,6 +10,7 @@ import org.kde.kirigami as Kirigami import org.kde.kirigamiaddons.labs.components as Components import org.kde.neochat +import org.kde.neochat.config Components.AlbumMaximizeComponent { id: root diff --git a/src/qml/Settings/NetworkProxyPage.qml b/src/qml/NetworkProxyPage.qml similarity index 99% rename from src/qml/Settings/NetworkProxyPage.qml rename to src/qml/NetworkProxyPage.qml index 28faf7a17..1c10af758 100644 --- a/src/qml/Settings/NetworkProxyPage.qml +++ b/src/qml/NetworkProxyPage.qml @@ -8,6 +8,7 @@ import QtQuick.Layouts import org.kde.kirigamiaddons.formcard as FormCard import org.kde.neochat +import org.kde.neochat.config FormCard.FormCardPage { id: root diff --git a/src/qml/Settings/NotificationRuleItem.qml b/src/qml/NotificationRuleItem.qml similarity index 100% rename from src/qml/Settings/NotificationRuleItem.qml rename to src/qml/NotificationRuleItem.qml diff --git a/src/qml/Dialog/OpenFileDialog.qml b/src/qml/OpenFileDialog.qml similarity index 100% rename from src/qml/Dialog/OpenFileDialog.qml rename to src/qml/OpenFileDialog.qml diff --git a/src/qml/Component/Timeline/OsmLocationPlugin.qml b/src/qml/OsmLocationPlugin.qml similarity index 100% rename from src/qml/Component/Timeline/OsmLocationPlugin.qml rename to src/qml/OsmLocationPlugin.qml diff --git a/src/qml/Component/Login/Password.qml b/src/qml/Password.qml similarity index 90% rename from src/qml/Component/Login/Password.qml rename to src/qml/Password.qml index 7cbef1235..204d9cda2 100644 --- a/src/qml/Component/Login/Password.qml +++ b/src/qml/Password.qml @@ -15,7 +15,7 @@ LoginStep { Connections { target: LoginHelper function onConnected() { - processed("qrc:/Loading.qml") + processed("qrc:/org/kde/neochat/qml/Loading.qml") } } @@ -45,6 +45,6 @@ LoginStep { } } previousAction: Kirigami.Action { - onTriggered: processed("qrc:/Login.qml") + onTriggered: processed("qrc:/org/kde/neochat/qml/Login.qml") } } diff --git a/src/qml/RoomSettings/Permissions.qml b/src/qml/Permissions.qml similarity index 100% rename from src/qml/RoomSettings/Permissions.qml rename to src/qml/Permissions.qml diff --git a/src/qml/Component/ChatBox/PieProgressBar.qml b/src/qml/PieProgressBar.qml similarity index 100% rename from src/qml/Component/ChatBox/PieProgressBar.qml rename to src/qml/PieProgressBar.qml diff --git a/src/qml/Component/Timeline/PollDelegate.qml b/src/qml/PollDelegate.qml similarity index 100% rename from src/qml/Component/Timeline/PollDelegate.qml rename to src/qml/PollDelegate.qml diff --git a/src/qml/Dialog/PowerLevelDialog.qml b/src/qml/PowerLevelDialog.qml similarity index 100% rename from src/qml/Dialog/PowerLevelDialog.qml rename to src/qml/PowerLevelDialog.qml diff --git a/src/qml/RoomSettings/PushNotification.qml b/src/qml/PushNotification.qml similarity index 100% rename from src/qml/RoomSettings/PushNotification.qml rename to src/qml/PushNotification.qml diff --git a/src/qml/Component/ChatBox/QuickFormatBar.qml b/src/qml/QuickFormatBar.qml similarity index 100% rename from src/qml/Component/ChatBox/QuickFormatBar.qml rename to src/qml/QuickFormatBar.qml diff --git a/src/qml/Component/QuickSwitcher.qml b/src/qml/QuickSwitcher.qml similarity index 97% rename from src/qml/Component/QuickSwitcher.qml rename to src/qml/QuickSwitcher.qml index 0514a1c3f..ea3267b95 100644 --- a/src/qml/Component/QuickSwitcher.qml +++ b/src/qml/QuickSwitcher.qml @@ -9,7 +9,6 @@ import org.kde.kirigami as Kirigami import org.kde.kitemmodels import org.kde.neochat -import './RoomList' as RoomList QQC2.Dialog { id: root @@ -90,7 +89,7 @@ QQC2.Dialog { } } - delegate: RoomList.RoomDelegate { + delegate: RoomDelegate { filterText: searchField.text connection: root.connection diff --git a/src/qml/Component/Timeline/ReactionDelegate.qml b/src/qml/ReactionDelegate.qml similarity index 100% rename from src/qml/Component/Timeline/ReactionDelegate.qml rename to src/qml/ReactionDelegate.qml diff --git a/src/qml/Component/Timeline/ReadMarkerDelegate.qml b/src/qml/ReadMarkerDelegate.qml similarity index 100% rename from src/qml/Component/Timeline/ReadMarkerDelegate.qml rename to src/qml/ReadMarkerDelegate.qml diff --git a/src/qml/Component/Login/RegisterPassword.qml b/src/qml/RegisterPassword.qml similarity index 94% rename from src/qml/Component/Login/RegisterPassword.qml rename to src/qml/RegisterPassword.qml index 8310f73e5..e223f5770 100644 --- a/src/qml/Component/Login/RegisterPassword.qml +++ b/src/qml/RegisterPassword.qml @@ -45,6 +45,6 @@ LoginStep { } previousAction: Kirigami.Action { - onTriggered: root.processed("qrc:/Username.qml") + onTriggered: root.processed("qrc:/org/kde/neochat/qml/Username.qml") } } diff --git a/src/qml/Menu/Timeline/RemoveSheet.qml b/src/qml/RemoveSheet.qml similarity index 100% rename from src/qml/Menu/Timeline/RemoveSheet.qml rename to src/qml/RemoveSheet.qml diff --git a/src/qml/Component/Timeline/ReplyComponent.qml b/src/qml/ReplyComponent.qml similarity index 100% rename from src/qml/Component/Timeline/ReplyComponent.qml rename to src/qml/ReplyComponent.qml diff --git a/src/qml/Component/ChatBox/ReplyPane.qml b/src/qml/ReplyPane.qml similarity index 100% rename from src/qml/Component/ChatBox/ReplyPane.qml rename to src/qml/ReplyPane.qml diff --git a/src/qml/Menu/Timeline/ReportSheet.qml b/src/qml/ReportSheet.qml similarity index 100% rename from src/qml/Menu/Timeline/ReportSheet.qml rename to src/qml/ReportSheet.qml diff --git a/src/qml/Component/Timeline/RichLabel.qml b/src/qml/RichLabel.qml similarity index 100% rename from src/qml/Component/Timeline/RichLabel.qml rename to src/qml/RichLabel.qml diff --git a/src/qml/Component/Devtools/RoomData.qml b/src/qml/RoomData.qml similarity index 96% rename from src/qml/Component/Devtools/RoomData.qml rename to src/qml/RoomData.qml index 1280341d1..e882bfbda 100644 --- a/src/qml/Component/Devtools/RoomData.qml +++ b/src/qml/RoomData.qml @@ -63,7 +63,7 @@ ColumnLayout { model: root.room.accountDataEventTypes delegate: FormCard.FormButtonDelegate { text: modelData - onClicked: applicationWindow().pageStack.pushDialogLayer("qrc:/MessageSourceSheet.qml", { + onClicked: applicationWindow().pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/MessageSourceSheet.qml", { "sourceText": root.room.roomAcountDataJson(text) }, { "title": i18n("Event Source"), @@ -89,7 +89,7 @@ ColumnLayout { delegate: FormCard.FormButtonDelegate { text: model.type description: model.stateKey - onClicked: applicationWindow().pageStack.pushDialogLayer('qrc:/MessageSourceSheet.qml', { + onClicked: applicationWindow().pageStack.pushDialogLayer('qrc:/org/kde/neochat/qml/MessageSourceSheet.qml', { sourceText: stateModel.stateEventJson(stateEventFilterModel.mapToSource(stateEventFilterModel.index(model.index, 0))) }, { title: i18n("Event Source"), diff --git a/src/qml/Page/RoomList/RoomDelegate.qml b/src/qml/RoomDelegate.qml similarity index 97% rename from src/qml/Page/RoomList/RoomDelegate.qml rename to src/qml/RoomDelegate.qml index 50f1b4b79..59dd56360 100644 --- a/src/qml/Page/RoomList/RoomDelegate.qml +++ b/src/qml/RoomDelegate.qml @@ -12,8 +12,7 @@ import org.kde.kirigamiaddons.labs.components as Components import org.kde.kitemmodels import org.kde.neochat - -import './' as RoomList +import org.kde.neochat.config Delegates.RoundedItemDelegate { id: root @@ -136,7 +135,7 @@ Delegates.RoundedItemDelegate { } function createRoomListContextMenu() { - const component = Qt.createComponent("qrc:/RoomList/ContextMenu.qml") + const component = Qt.createComponent("qrc:/org/kde/neochat/qml/ContextMenu.qml") if (component.status === Component.Error) { console.error(component.errorString()); } diff --git a/src/qml/RoomDrawer/RoomDrawer.qml b/src/qml/RoomDrawer.qml similarity index 96% rename from src/qml/RoomDrawer/RoomDrawer.qml rename to src/qml/RoomDrawer.qml index b188c8826..826aa376e 100644 --- a/src/qml/RoomDrawer/RoomDrawer.qml +++ b/src/qml/RoomDrawer.qml @@ -10,6 +10,7 @@ import org.kde.kirigami as Kirigami import org.kde.kitemmodels import org.kde.neochat +import org.kde.neochat.config Kirigami.OverlayDrawer { id: root @@ -100,7 +101,7 @@ Kirigami.OverlayDrawer { text: i18n("Room settings") display: QQC2.AbstractButton.IconOnly - onClicked: QQC2.ApplicationWindow.window.pageStack.pushDialogLayer('qrc:/Categories.qml', {room: room, connection: root.connection}, { title: i18n("Room Settings") }) + onClicked: QQC2.ApplicationWindow.window.pageStack.pushDialogLayer('qrc:/org/kde/neochat/qml/Categories.qml', {room: room, connection: root.connection}, { title: i18n("Room Settings") }) QQC2.ToolTip.text: text QQC2.ToolTip.delay: Kirigami.Units.toolTipDelay diff --git a/src/qml/RoomDrawer/RoomDrawerPage.qml b/src/qml/RoomDrawerPage.qml similarity index 95% rename from src/qml/RoomDrawer/RoomDrawerPage.qml rename to src/qml/RoomDrawerPage.qml index 7a2ccd4f3..d14710f47 100644 --- a/src/qml/RoomDrawer/RoomDrawerPage.qml +++ b/src/qml/RoomDrawerPage.qml @@ -44,7 +44,7 @@ Kirigami.Page { displayHint: Kirigami.DisplayHint.IconOnly text: i18n("Settings") icon.name: "settings-configure" - onTriggered: applicationWindow().pageStack.pushDialogLayer('qrc:/Categories.qml', {room: root.room, connection: root.connection}, { title: i18n("Room Settings") }) + onTriggered: applicationWindow().pageStack.pushDialogLayer('qrc:/org/kde/neochat/qml/Categories.qml', {room: root.room, connection: root.connection}, { title: i18n("Room Settings") }) } ] diff --git a/src/qml/RoomDrawer/RoomInformation.qml b/src/qml/RoomInformation.qml similarity index 94% rename from src/qml/RoomDrawer/RoomInformation.qml rename to src/qml/RoomInformation.qml index b071d8dec..3515537f5 100644 --- a/src/qml/RoomDrawer/RoomInformation.qml +++ b/src/qml/RoomInformation.qml @@ -11,6 +11,7 @@ import org.kde.kirigamiaddons.labs.components as KirigamiComponents import org.kde.kitemmodels import org.kde.neochat +import org.kde.neochat.config /** * @brief Component for visualising the room information. @@ -79,7 +80,7 @@ QQC2.ScrollView { Layout.fillWidth: true onClicked: { - applicationWindow().pageStack.pushDialogLayer("qrc:/DevtoolsPage.qml", {room: root.room, connection: root.connection}, {title: i18n("Developer Tools")}) + applicationWindow().pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/DevtoolsPage.qml", {room: root.room, connection: root.connection}, {title: i18n("Developer Tools")}) } } @@ -92,7 +93,7 @@ QQC2.ScrollView { Layout.fillWidth: true onClicked: { - pageStack.pushDialogLayer("qrc:/SearchPage.qml", { + pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/SearchPage.qml", { currentRoom: root.room, connection: root.connection }, { @@ -118,7 +119,7 @@ QQC2.ScrollView { icon.name: "map-flat" text: i18n("Show locations for this room") - onClicked: pageStack.pushDialogLayer("qrc:/LocationsPage.qml", { + onClicked: pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/LocationsPage.qml", { room: root.room }, { title: i18nc("Locations on a map", "Locations") @@ -140,7 +141,7 @@ QQC2.ScrollView { icon.name: "list-add-user" onClicked: { - applicationWindow().pageStack.pushDialogLayer("qrc:/InviteUserPage.qml", {room: root.room}, {title: i18nc("@title", "Invite a User")}) + applicationWindow().pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/InviteUserPage.qml", {room: root.room}, {title: i18nc("@title", "Invite a User")}) } QQC2.ToolTip.text: i18n("Invite user to room") diff --git a/src/qml/Page/RoomList/Page.qml b/src/qml/RoomListPage.qml similarity index 98% rename from src/qml/Page/RoomList/Page.qml rename to src/qml/RoomListPage.qml index b9c1748a1..7e2f15525 100644 --- a/src/qml/Page/RoomList/Page.qml +++ b/src/qml/RoomListPage.qml @@ -10,9 +10,8 @@ import QtQml.Models import org.kde.kirigami as Kirigami import org.kde.neochat - -import './' as RoomList -import '../' as NeoChat +import org.kde.neochat.config +import org.kde.neochat.accounts Kirigami.Page { id: root @@ -98,7 +97,7 @@ Kirigami.Page { anchors.fill: parent spacing: 0 - NeoChat.SpaceDrawer { + SpaceDrawer { id: spaceDrawer Layout.preferredWidth: spaceDrawer.enabled ? Kirigami.Units.gridUnit * 3 : 0 Layout.fillHeight: true @@ -164,7 +163,7 @@ Kirigami.Page { icon.name: sortFilterRoomListModel.filterText.length > 0 ? "search" : "list-add" text: sortFilterRoomListModel.filterText.length > 0 ? i18n("Search in room directory") : i18n("Explore rooms") onTriggered: { - let dialog = pageStack.layers.push("qrc:/JoinRoomPage.qml", { + let dialog = pageStack.layers.push("qrc:/org/kde/neochat/qml/JoinRoomPage.qml", { connection: root.connection, keyword: sortFilterRoomListModel.filterText }, { @@ -258,7 +257,7 @@ Kirigami.Page { Component { id: collapsedModeListComponent - RoomList.CollapsedRoomDelegate { + CollapsedRoomDelegate { filterText: sortFilterRoomListModel.filterText } } @@ -266,7 +265,7 @@ Kirigami.Page { Component { id: normalModeListComponent - RoomList.RoomDelegate { + RoomDelegate { filterText: sortFilterRoomListModel.filterText connection: root.connection diff --git a/src/qml/RoomDrawer/RoomMedia.qml b/src/qml/RoomMedia.qml similarity index 100% rename from src/qml/RoomDrawer/RoomMedia.qml rename to src/qml/RoomMedia.qml diff --git a/src/qml/Page/RoomPage.qml b/src/qml/RoomPage.qml similarity index 99% rename from src/qml/Page/RoomPage.qml rename to src/qml/RoomPage.qml index c4cd4b04a..068d40ccc 100644 --- a/src/qml/Page/RoomPage.qml +++ b/src/qml/RoomPage.qml @@ -12,6 +12,7 @@ import org.kde.kirigami as Kirigami import org.kde.kitemmodels import org.kde.neochat +import org.kde.neochat.config Kirigami.Page { id: root @@ -202,7 +203,7 @@ Kirigami.Page { } function onShowEventSource(eventId) { - applicationWindow().pageStack.pushDialogLayer('qrc:/MessageSourceSheet.qml', { + applicationWindow().pageStack.pushDialogLayer('qrc:/org/kde/neochat/qml/MessageSourceSheet.qml', { sourceText: root.currentRoom.getEventJsonSource(eventId) }, { title: i18n("Message Source"), diff --git a/src/qml/Page/RoomWindow.qml b/src/qml/RoomWindow.qml similarity index 100% rename from src/qml/Page/RoomWindow.qml rename to src/qml/RoomWindow.qml diff --git a/src/qml/Page/SearchPage.qml b/src/qml/SearchPage.qml similarity index 100% rename from src/qml/Page/SearchPage.qml rename to src/qml/SearchPage.qml diff --git a/src/qml/Component/Timeline/SectionDelegate.qml b/src/qml/SectionDelegate.qml similarity index 97% rename from src/qml/Component/Timeline/SectionDelegate.qml rename to src/qml/SectionDelegate.qml index 7ad37246f..4d9dc5c39 100644 --- a/src/qml/Component/Timeline/SectionDelegate.qml +++ b/src/qml/SectionDelegate.qml @@ -9,6 +9,7 @@ import QtQuick.Layouts import org.kde.kirigami as Kirigami import org.kde.neochat +import org.kde.neochat.config QQC2.ItemDelegate { id: root diff --git a/src/qml/RoomSettings/Security.qml b/src/qml/Security.qml similarity index 100% rename from src/qml/RoomSettings/Security.qml rename to src/qml/Security.qml diff --git a/src/qml/Component/Devtools/ServerData.qml b/src/qml/ServerData.qml similarity index 100% rename from src/qml/Component/Devtools/ServerData.qml rename to src/qml/ServerData.qml diff --git a/src/qml/Settings/SettingsPage.qml b/src/qml/SettingsPage.qml similarity index 100% rename from src/qml/Settings/SettingsPage.qml rename to src/qml/SettingsPage.qml diff --git a/src/qml/Menu/ShareAction.qml b/src/qml/ShareAction.qml similarity index 98% rename from src/qml/Menu/ShareAction.qml rename to src/qml/ShareAction.qml index b5bafe794..72dc29e53 100644 --- a/src/qml/Menu/ShareAction.qml +++ b/src/qml/ShareAction.qml @@ -55,7 +55,7 @@ Purpose.PurposeAlternativesModel { icon.name: model.iconName onTriggered: { doBeforeSharing(); - applicationWindow().pageStack.pushDialogLayer('qrc:/ShareDialog.qml', { + applicationWindow().pageStack.pushDialogLayer('qrc:/org/kde/neochat/qml/ShareDialog.qml', { title: root.tooltip, index: index, model: root._instantiator.model diff --git a/src/qml/Menu/ShareActionAndroid.qml b/src/qml/ShareActionAndroid.qml similarity index 100% rename from src/qml/Menu/ShareActionAndroid.qml rename to src/qml/ShareActionAndroid.qml diff --git a/src/qml/Menu/ShareDialog.qml b/src/qml/ShareDialog.qml similarity index 100% rename from src/qml/Menu/ShareDialog.qml rename to src/qml/ShareDialog.qml diff --git a/src/qml/Component/ShimmerGradient.qml b/src/qml/ShimmerGradient.qml similarity index 100% rename from src/qml/Component/ShimmerGradient.qml rename to src/qml/ShimmerGradient.qml diff --git a/src/qml/Settings/SonnetConfigPage.qml b/src/qml/SonnetConfigPage.qml similarity index 100% rename from src/qml/Settings/SonnetConfigPage.qml rename to src/qml/SonnetConfigPage.qml diff --git a/src/qml/Page/RoomList/SpaceDrawer.qml b/src/qml/SpaceDrawer.qml similarity index 100% rename from src/qml/Page/RoomList/SpaceDrawer.qml rename to src/qml/SpaceDrawer.qml diff --git a/src/qml/Page/RoomList/SpaceListContextMenu.qml b/src/qml/SpaceListContextMenu.qml similarity index 94% rename from src/qml/Page/RoomList/SpaceListContextMenu.qml rename to src/qml/SpaceListContextMenu.qml index 56b7b99e3..8c1a58803 100644 --- a/src/qml/Page/RoomList/SpaceListContextMenu.qml +++ b/src/qml/SpaceListContextMenu.qml @@ -45,7 +45,7 @@ Loader { QQC2.MenuItem { text: i18nc("'Space' is a matrix space", "Space Settings") icon.name: 'settings-configure' - onTriggered: QQC2.ApplicationWindow.window.pageStack.pushDialogLayer('qrc:/Categories.qml', {room: room, connection: connection}, { title: i18n("Space Settings") }) + onTriggered: QQC2.ApplicationWindow.window.pageStack.pushDialogLayer('qrc:/org/kde/neochat/qml/Categories.qml', {room: room, connection: connection}, { title: i18n("Space Settings") }) } QQC2.MenuSeparator {} @@ -125,7 +125,7 @@ Loader { FormCard.FormButtonDelegate { text: i18nc("'Space' is a matrix space", "Space Settings") icon.name: 'settings-configure' - onClicked: QQC2.ApplicationWindow.window.pageStack.pushDialogLayer('qrc:/Categories.qml', {room: room, connection: connection}, { title: i18n("Space Settings") }) + onClicked: QQC2.ApplicationWindow.window.pageStack.pushDialogLayer('qrc:/org/kde/neochat/qml/Categories.qml', {room: room, connection: connection}, { title: i18n("Space Settings") }) } FormCard.FormButtonDelegate { diff --git a/src/qml/Component/Login/Sso.qml b/src/qml/Sso.qml similarity index 86% rename from src/qml/Component/Login/Sso.qml rename to src/qml/Sso.qml index 2e1aa88f0..f972949fc 100644 --- a/src/qml/Component/Login/Sso.qml +++ b/src/qml/Sso.qml @@ -22,7 +22,7 @@ LoginStep { UrlHelper.openUrl(LoginHelper.ssoUrl) } function onConnected() { - processed("qrc:/Loading.qml") + processed("qrc:/org/kde/neochat/qml/Loading.qml") } } @@ -31,7 +31,7 @@ LoginStep { } previousAction: Kirigami.Action { - onTriggered: processed("qrc:/Login.qml") + onTriggered: processed("qrc:/org/kde/neochat/qml/Login.qml") } nextAction: Kirigami.Action { diff --git a/src/qml/Page/StartChatPage.qml b/src/qml/StartChatPage.qml similarity index 100% rename from src/qml/Page/StartChatPage.qml rename to src/qml/StartChatPage.qml diff --git a/src/qml/Component/Timeline/StateComponent.qml b/src/qml/StateComponent.qml similarity index 100% rename from src/qml/Component/Timeline/StateComponent.qml rename to src/qml/StateComponent.qml diff --git a/src/qml/Component/Timeline/StateDelegate.qml b/src/qml/StateDelegate.qml similarity index 99% rename from src/qml/Component/Timeline/StateDelegate.qml rename to src/qml/StateDelegate.qml index 489aaa502..d404e8938 100644 --- a/src/qml/Component/Timeline/StateDelegate.qml +++ b/src/qml/StateDelegate.qml @@ -9,6 +9,7 @@ import org.kde.kirigami as Kirigami import org.kde.kirigamiaddons.labs.components as KirigamiComponents import org.kde.neochat +import org.kde.neochat.config /** * @brief A timeline delegate for visualising an aggregated list of consecutive state events. diff --git a/src/qml/Component/Login/Terms.qml b/src/qml/Terms.qml similarity index 92% rename from src/qml/Component/Login/Terms.qml rename to src/qml/Terms.qml index 22e10ee58..6bae206b9 100644 --- a/src/qml/Component/Login/Terms.qml +++ b/src/qml/Terms.qml @@ -33,6 +33,6 @@ LoginStep { } } previousAction: Kirigami.Action { - onTriggered: root.processed("qrc:/Username.qml") + onTriggered: root.processed("qrc:/org/kde/neochat/qml/Username.qml") } } diff --git a/src/qml/Component/Timeline/TextDelegate.qml b/src/qml/TextDelegate.qml similarity index 98% rename from src/qml/Component/Timeline/TextDelegate.qml rename to src/qml/TextDelegate.qml index 1ce772de8..c89de9909 100644 --- a/src/qml/Component/Timeline/TextDelegate.qml +++ b/src/qml/TextDelegate.qml @@ -7,6 +7,7 @@ import QtQuick.Layouts import Qt.labs.qmlmodels import org.kde.neochat +import org.kde.neochat.config /** * @brief A timeline delegate for a text message. diff --git a/src/qml/Settings/ThemeRadioButton.qml b/src/qml/ThemeRadioButton.qml similarity index 100% rename from src/qml/Settings/ThemeRadioButton.qml rename to src/qml/ThemeRadioButton.qml diff --git a/src/qml/Component/Timeline/TimelineDelegate.qml b/src/qml/TimelineDelegate.qml similarity index 99% rename from src/qml/Component/Timeline/TimelineDelegate.qml rename to src/qml/TimelineDelegate.qml index a0991e21b..8b5145df7 100644 --- a/src/qml/Component/Timeline/TimelineDelegate.qml +++ b/src/qml/TimelineDelegate.qml @@ -7,6 +7,7 @@ import QtQuick.Controls as QQC2 import org.kde.kirigami as Kirigami import org.kde.neochat +import org.kde.neochat.config /** * @brief The base Item for all delegates in the timeline. diff --git a/src/qml/Component/TimelineView.qml b/src/qml/TimelineView.qml similarity index 99% rename from src/qml/Component/TimelineView.qml rename to src/qml/TimelineView.qml index f2ba23a90..285ba385c 100644 --- a/src/qml/Component/TimelineView.qml +++ b/src/qml/TimelineView.qml @@ -11,6 +11,7 @@ import org.kde.kirigami as Kirigami import org.kde.kitemmodels import org.kde.neochat +import org.kde.neochat.config QQC2.ScrollView { id: root diff --git a/src/qml/Component/TypingPane.qml b/src/qml/TypingPane.qml similarity index 100% rename from src/qml/Component/TypingPane.qml rename to src/qml/TypingPane.qml diff --git a/src/qml/Dialog/UserDetailDialog.qml b/src/qml/UserDetailDialog.qml similarity index 97% rename from src/qml/Dialog/UserDetailDialog.qml rename to src/qml/UserDetailDialog.qml index 6f6fe143e..6e85366b0 100644 --- a/src/qml/Dialog/UserDetailDialog.qml +++ b/src/qml/UserDetailDialog.qml @@ -122,7 +122,7 @@ Kirigami.Dialog { icon.name: "im-ban-user" icon.color: Kirigami.Theme.negativeTextColor onTriggered: { - applicationWindow().pageStack.pushDialogLayer("qrc:/BanSheet.qml", {room: root.room, userId: root.user.id}, { + applicationWindow().pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/BanSheet.qml", {room: root.room, userId: root.user.id}, { title: i18nc("@title", "Ban User"), width: Kirigami.Units.gridUnit * 25 }) @@ -177,7 +177,7 @@ Kirigami.Dialog { icon.name: "delete" icon.color: Kirigami.Theme.negativeTextColor onTriggered: { - applicationWindow().pageStack.pushDialogLayer("qrc:/RemoveSheet.qml", {room: root.room, userId: root.user.id}, { + applicationWindow().pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/RemoveSheet.qml", {room: root.room, userId: root.user.id}, { title: i18nc("@title", "Remove Messages"), width: Kirigami.Units.gridUnit * 25 }) diff --git a/src/qml/Page/RoomList/UserInfo.qml b/src/qml/UserInfo.qml similarity index 96% rename from src/qml/Page/RoomList/UserInfo.qml rename to src/qml/UserInfo.qml index 2af6ee0a4..4ae774153 100644 --- a/src/qml/Page/RoomList/UserInfo.qml +++ b/src/qml/UserInfo.qml @@ -9,6 +9,8 @@ import org.kde.kirigamiaddons.labs.components as KirigamiComponents import org.kde.kirigamiaddons.delegates as Delegates import org.kde.neochat +import org.kde.neochat.config +import org.kde.neochat.accounts QQC2.ToolBar { id: root @@ -50,7 +52,7 @@ QQC2.ToolBar { } onClicked: { - pageStack.pushDialogLayer("qrc:/WelcomePage.qml", {}, { + pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/WelcomePage.qml", {}, { title: i18nc("@title:window", "Login"), }); if (switchUserButton.checked) { @@ -164,7 +166,7 @@ QQC2.ToolBar { if (button == Qt.RightButton) { accountMenu.open(); } else { - pageStack.pushDialogLayer(Qt.resolvedUrl('qrc:/AccountEditorPage.qml'), { + pageStack.pushDialogLayer(Qt.resolvedUrl('qrc:/org/kde/neochat/qml/AccountEditorPage.qml'), { connection: root.connection }, { title: i18n("Account editor") @@ -233,7 +235,7 @@ QQC2.ToolBar { } QQC2.ToolButton { icon.name: "settings-configure" - onClicked: pageStack.pushDialogLayer("qrc:/SettingsPage.qml", {connection: root.connection}, { title: i18n("Configure") }) + onClicked: pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/SettingsPage.qml", {connection: root.connection}, { title: i18n("Configure") }) text: i18n("Open Settings") display: QQC2.AbstractButton.IconOnly Layout.minimumWidth: Layout.preferredWidth diff --git a/src/qml/Component/Login/Username.qml b/src/qml/Username.qml similarity index 87% rename from src/qml/Component/Login/Username.qml rename to src/qml/Username.qml index 3aabe1960..a65e79e69 100644 --- a/src/qml/Component/Login/Username.qml +++ b/src/qml/Username.qml @@ -35,11 +35,11 @@ LoginStep { nextAction: Kirigami.Action { text: Registration.status === Registration.TestingUsername ? i18n("Loading") : null - onTriggered: root.processed("qrc:/RegisterPassword.qml") + onTriggered: root.processed("qrc:/org/kde/neochat/qml/RegisterPassword.qml") enabled: Registration.status === Registration.Ready } previousAction: Kirigami.Action { - onTriggered: root.processed("qrc:/Homeserver.qml") + onTriggered: root.processed("qrc:/org/kde/neochat/qml/Homeserver.qml") } } diff --git a/src/qml/Dialog/KeyVerification/VerificationCanceled.qml b/src/qml/VerificationCanceled.qml similarity index 100% rename from src/qml/Dialog/KeyVerification/VerificationCanceled.qml rename to src/qml/VerificationCanceled.qml diff --git a/src/qml/Component/Timeline/VideoDelegate.qml b/src/qml/VideoDelegate.qml similarity index 100% rename from src/qml/Component/Timeline/VideoDelegate.qml rename to src/qml/VideoDelegate.qml diff --git a/src/qml/Page/WelcomePage.qml b/src/qml/WelcomePage.qml similarity index 90% rename from src/qml/Page/WelcomePage.qml rename to src/qml/WelcomePage.qml index 27aa3a1a9..96b363dcd 100644 --- a/src/qml/Page/WelcomePage.qml +++ b/src/qml/WelcomePage.qml @@ -9,6 +9,7 @@ import org.kde.kirigami as Kirigami import org.kde.kirigamiaddons.formcard as FormCard import org.kde.neochat +import org.kde.neochat.accounts FormCard.FormCardPage { id: root @@ -51,7 +52,7 @@ FormCard.FormCardPage { Loader { id: module Layout.fillWidth: true - source: "qrc:/LoginRegister.qml" + source: "qrc:/org/kde/neochat/qml/LoginRegister.qml" Connections { id: stepConnections @@ -81,16 +82,16 @@ FormCard.FormCardPage { target: Registration function onNextStepChanged() { if (Registration.nextStep === "m.login.recaptcha") { - stepConnections.onProcessed("qrc:/Captcha.qml") + stepConnections.onProcessed("qrc:/org/kde/neochat/qml/Captcha.qml") } if (Registration.nextStep === "m.login.terms") { - stepConnections.onProcessed("qrc:/Terms.qml") + stepConnections.onProcessed("qrc:/org/kde/neochat/qml/Terms.qml") } if (Registration.nextStep === "m.login.email.identity") { - stepConnections.onProcessed("qrc:/Email.qml") + stepConnections.onProcessed("qrc:/org/kde/neochat/qml/Email.qml") } if (Registration.nextStep === "loading") { - stepConnections.onProcessed("qrc:/Loading.qml") + stepConnections.onProcessed("qrc:/org/kde/neochat/qml/Loading.qml") } } } diff --git a/src/qml/Component/confetti.png b/src/qml/confetti.png similarity index 100% rename from src/qml/Component/confetti.png rename to src/qml/confetti.png diff --git a/src/qml/Component/glowdot.png b/src/qml/glowdot.png similarity index 100% rename from src/qml/Component/glowdot.png rename to src/qml/glowdot.png diff --git a/src/qml/main.qml b/src/qml/main.qml index c0b97fda8..9a4513f98 100644 --- a/src/qml/main.qml +++ b/src/qml/main.qml @@ -9,15 +9,15 @@ import QtQuick.Layouts import org.kde.kirigami as Kirigami import org.kde.neochat -import './RoomList' as RoomList -import './Dialog' as Dialog +import org.kde.neochat.config +import org.kde.neochat.accounts Kirigami.ApplicationWindow { id: root property int columnWidth: Kirigami.Units.gridUnit * 13 - property RoomList.Page roomListPage + property RoomListPage roomListPage property bool roomListLoaded: false property RoomPage roomPage @@ -89,7 +89,7 @@ Kirigami.ApplicationWindow { target: RoomManager function onPushRoom(room, event) { - root.roomPage = pageStack.push("qrc:/RoomPage.qml", {connection: root.connection}); + root.roomPage = pageStack.push("qrc:/org/kde/neochat/qml/RoomPage.qml", {connection: root.connection}); root.roomPage.forceActiveFocus(); if (event.length > 0) { roomPage.goToEvent(event); @@ -134,7 +134,7 @@ Kirigami.ApplicationWindow { } function openRoomDrawer() { - pageStack.push("qrc:/RoomDrawerPage.qml", { + pageStack.push("qrc:/org/kde/neochat/qml/RoomDrawerPage.qml", { connection: root.connection }) } @@ -197,7 +197,7 @@ Kirigami.ApplicationWindow { Component { id: roomListComponent - RoomList.Page { + RoomListPage { id: roomList connection: root.connection @@ -239,7 +239,7 @@ Kirigami.ApplicationWindow { RoomManager.reset(); pageStack.clear(); roomListLoaded = false; - pageStack.push("qrc:/WelcomePage.qml"); + pageStack.push("qrc:/org/kde/neochat/qml/WelcomePage.qml"); } } } @@ -249,7 +249,7 @@ Kirigami.ApplicationWindow { function onInitiated() { if (AccountRegistry.accountCount === 0) { - pageStack.replace("qrc:/WelcomePage.qml", {}); + pageStack.replace("qrc:/org/kde/neochat/qml/WelcomePage.qml", {}); } else if (!roomListLoaded) { pageStack.replace(roomListComponent); roomListLoaded = true; @@ -392,7 +392,7 @@ Kirigami.ApplicationWindow { Shortcut { sequence: "Ctrl+Shift+," onActivated: { - pageStack.pushDialogLayer("qrc:/SettingsPage.qml", {connection: root.connection}, { title: i18n("Configure") }) + pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/SettingsPage.qml", {connection: root.connection}, { title: i18n("Configure") }) } } } diff --git a/src/registration.h b/src/registration.h index a429c4a1c..a62e0220f 100644 --- a/src/registration.h +++ b/src/registration.h @@ -6,6 +6,7 @@ #include #include #include +#include #include #include #include @@ -58,6 +59,8 @@ public: class Registration : public QObject { Q_OBJECT + QML_ELEMENT + QML_SINGLETON Q_PROPERTY(QString homeserver READ homeserver WRITE setHomeserver NOTIFY homeserverChanged) Q_PROPERTY(QString username READ username WRITE setUsername NOTIFY usernameChanged) @@ -88,6 +91,10 @@ public: static Registration _instance; return _instance; } + static Registration *create(QQmlEngine *, QJSEngine *) + { + return &instance(); + } Q_INVOKABLE void registerAccount(); Q_INVOKABLE void registerEmail(); diff --git a/src/res.qrc b/src/res.qrc deleted file mode 100644 index f9656db92..000000000 --- a/src/res.qrc +++ /dev/null @@ -1,150 +0,0 @@ - - - ../org.kde.neochat.svg - ../org.kde.neochat.tray.svg - - qml/main.qml - - qml/Page/RoomList/AccountMenu.qml - qml/Page/RoomList/ExploreComponent.qml - qml/Page/RoomList/ContextMenu.qml - qml/Page/RoomList/CollapsedRoomDelegate.qml - qml/Page/RoomList/RoomDelegate.qml - qml/Page/RoomList/Page.qml - qml/Page/RoomList/SpaceListContextMenu.qml - qml/Page/RoomList/UserInfo.qml - - qml/Page/LoadingPage.qml - qml/Page/RoomPage.qml - qml/Page/RoomWindow.qml - qml/Page/JoinRoomPage.qml - qml/Page/ExplorerDelegate.qml - qml/Page/InviteUserPage.qml - qml/Page/StartChatPage.qml - qml/Page/ImageEditorPage.qml - qml/Page/WelcomePage.qml - qml/RoomSettings/General.qml - qml/RoomSettings/Security.qml - qml/RoomSettings/PushNotification.qml - qml/RoomSettings/Categories.qml - qml/RoomSettings/Permissions.qml - qml/Component/NeochatMaximizeComponent.qml - qml/Component/FancyEffectsContainer.qml - qml/Component/TypingPane.qml - qml/Component/ShimmerGradient.qml - qml/Component/QuickSwitcher.qml - qml/Component/HoverActions.qml - qml/Component/ChatBox/ChatBox.qml - qml/Component/ChatBox/ChatBar.qml - qml/Component/ChatBox/AttachmentPane.qml - qml/Component/ChatBox/ReplyPane.qml - qml/Component/ChatBox/CompletionMenu.qml - qml/Component/ChatBox/PieProgressBar.qml - qml/Component/ChatBox/QuickFormatBar.qml - qml/Component/Devtools/RoomData.qml - qml/Component/Devtools/ServerData.qml - qml/Component/Emoji/EmojiPicker.qml - qml/Component/Timeline/TimelineDelegate.qml - qml/Component/Timeline/ReplyComponent.qml - qml/Component/Timeline/StateDelegate.qml - qml/Component/Timeline/RichLabel.qml - qml/Component/Timeline/MessageDelegate.qml - qml/Component/Timeline/Bubble.qml - qml/Component/Timeline/SectionDelegate.qml - qml/Component/Timeline/VideoDelegate.qml - qml/Component/Timeline/ReactionDelegate.qml - qml/Component/Timeline/LinkPreviewDelegate.qml - qml/Component/Timeline/AudioDelegate.qml - qml/Component/Timeline/FileDelegate.qml - qml/Component/Timeline/ImageDelegate.qml - qml/Component/Timeline/EncryptedDelegate.qml - qml/Component/Timeline/EventDelegate.qml - qml/Component/Timeline/TextDelegate.qml - qml/Component/Timeline/ReadMarkerDelegate.qml - qml/Component/Timeline/PollDelegate.qml - qml/Component/Timeline/MimeComponent.qml - qml/Component/Timeline/StateComponent.qml - qml/Component/Timeline/MessageEditComponent.qml - qml/Component/Timeline/AvatarFlow.qml - qml/Component/Login/LoginStep.qml - qml/Component/Login/Login.qml - qml/Component/Login/Homeserver.qml - qml/Component/Login/Username.qml - qml/Component/Login/RegisterPassword.qml - qml/Component/Login/Captcha.qml - qml/Component/Login/Terms.qml - qml/Component/Login/Email.qml - qml/Component/Login/Password.qml - qml/Component/Login/LoginRegister.qml - qml/Component/Login/Loading.qml - qml/Component/Login/LoginMethod.qml - qml/Component/Login/Sso.qml - qml/Dialog/UserDetailDialog.qml - qml/Dialog/CreateRoomDialog.qml - qml/Dialog/CreateSpaceDialog.qml - qml/Dialog/EmojiDialog.qml - qml/Dialog/OpenFileDialog.qml - qml/Dialog/KeyVerification/KeyVerificationDialog.qml - qml/Dialog/ConfirmLogout.qml - qml/Dialog/PowerLevelDialog.qml - qml/Dialog/KeyVerification/Message.qml - qml/Dialog/KeyVerification/EmojiItem.qml - qml/Dialog/KeyVerification/EmojiRow.qml - qml/Dialog/KeyVerification/EmojiSas.qml - qml/Dialog/ConfirmDeactivateAccountDialog.qml - qml/Dialog/KeyVerification/VerificationCanceled.qml - qml/Menu/GlobalMenu.qml - qml/Menu/EditMenu.qml - qml/Menu/Timeline/MessageDelegateContextMenu.qml - qml/Menu/Timeline/FileDelegateContextMenu.qml - qml/Menu/Timeline/MessageSourceSheet.qml - qml/Menu/Timeline/ReportSheet.qml - qml/Component/glowdot.png - qml/Component/confetti.png - qml/Settings/SettingsPage.qml - qml/Settings/ThemeRadioButton.qml - qml/Settings/ColorScheme.qml - qml/Settings/GeneralSettingsPage.qml - qml/Settings/EmoticonsPage.qml - qml/Settings/EmoticonEditorPage.qml - qml/Settings/EmoticonFormCard.qml - qml/Settings/GlobalNotificationsPage.qml - qml/Settings/NotificationRuleItem.qml - qml/Settings/AppearanceSettingsPage.qml - qml/Settings/AccountsPage.qml - qml/Settings/AccountEditorPage.qml - qml/Settings/DevicesPage.qml - qml/Settings/DeviceDelegate.qml - qml/Settings/DevicesCard.qml - qml/Settings/About.qml - qml/Settings/AboutKDE.qml - qml/Settings/SonnetConfigPage.qml - qml/Settings/NetworkProxyPage.qml - qml/Page/DevtoolsPage.qml - qml/Dialog/ConfirmEncryptionDialog.qml - qml/Menu/Timeline/RemoveSheet.qml - qml/Menu/Timeline/BanSheet.qml - qml/Component/Emoji/EmojiTonesPicker.qml - qml/Component/Emoji/EmojiDelegate.qml - qml/Component/Emoji/EmojiGrid.qml - qml/Page/SearchPage.qml - qml/Component/Timeline/LocationDelegate.qml - qml/Component/ChatBox/LocationChooser.qml - qml/Component/TimelineView.qml - qml/Component/InvitationView.qml - qml/Component/AvatarTabButton.qml - qml/Page/RoomList/SpaceDrawer.qml - qml/Component/Timeline/OsmLocationPlugin.qml - qml/Component/Timeline/LiveLocationDelegate.qml - qml/Component/FullScreenMap.qml - qml/Component/LocationPage.qml - qml/Component/LocationMapItem.qml - qml/RoomDrawer/RoomDrawer.qml - qml/RoomDrawer/RoomDrawerPage.qml - qml/RoomDrawer/DirectChatDrawerHeader.qml - qml/RoomDrawer/GroupChatDrawerHeader.qml - qml/RoomDrawer/RoomInformation.qml - qml/RoomDrawer/RoomMedia.qml - qml/Page/ChooseRoomDialog.qml - - diff --git a/src/res_android.qrc b/src/res_android.qrc deleted file mode 100644 index 385c34bb9..000000000 --- a/src/res_android.qrc +++ /dev/null @@ -1,5 +0,0 @@ - - - qml/Menu/ShareActionAndroid.qml - - diff --git a/src/res_desktop.qrc b/src/res_desktop.qrc deleted file mode 100644 index 27f468a8e..000000000 --- a/src/res_desktop.qrc +++ /dev/null @@ -1,6 +0,0 @@ - - - qml/Menu/ShareAction.qml - qml/Menu/ShareDialog.qml - - diff --git a/src/roommanager.h b/src/roommanager.h index 44169fd22..8b52bd9cf 100644 --- a/src/roommanager.h +++ b/src/roommanager.h @@ -6,6 +6,7 @@ #include #include #include +#include #include #include @@ -33,6 +34,8 @@ using namespace Quotient; class RoomManager : public QObject, public UriResolverBase { Q_OBJECT + QML_ELEMENT + QML_SINGLETON /** * @brief The current open room in NeoChat, if any. @@ -87,6 +90,10 @@ public: explicit RoomManager(QObject *parent = nullptr); virtual ~RoomManager(); static RoomManager &instance(); + static RoomManager *create(QQmlEngine *, QJSEngine *) + { + return &instance(); + } NeoChatRoom *currentRoom() const; diff --git a/src/spacehierarchycache.h b/src/spacehierarchycache.h index 926719302..facec1aea 100644 --- a/src/spacehierarchycache.h +++ b/src/spacehierarchycache.h @@ -5,6 +5,7 @@ #include #include +#include #include #include @@ -23,6 +24,8 @@ class Room; class SpaceHierarchyCache : public QObject { Q_OBJECT + QML_ELEMENT + QML_SINGLETON public: static SpaceHierarchyCache &instance() @@ -30,6 +33,10 @@ public: static SpaceHierarchyCache _instance; return _instance; } + static SpaceHierarchyCache *create(QQmlEngine *, QJSEngine *) + { + return &instance(); + } /** * @brief Return the list of child rooms for the given space ID. diff --git a/src/urlhelper.h b/src/urlhelper.h index 31d4431e1..1615ae071 100644 --- a/src/urlhelper.h +++ b/src/urlhelper.h @@ -4,6 +4,7 @@ #pragma once #include +#include #include /** @@ -14,6 +15,9 @@ class UrlHelper : public QObject { Q_OBJECT + QML_ELEMENT + QML_SINGLETON + public: /** * @brief Open the given URL in an appropriate app.