Port to declarative type registration
This commit is contained in:
@@ -34,7 +34,7 @@ Files: src/neochat.notifyrc
|
|||||||
Copyright: 2020 Tobias Fella <tobias.fella@kde.org>
|
Copyright: 2020 Tobias Fella <tobias.fella@kde.org>
|
||||||
License: BSD-2-Clause
|
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 <aa13q@ya.ru>
|
Copyright: 2021 Alexey Andreyev <aa13q@ya.ru>
|
||||||
License: CC0-1.0
|
License: CC0-1.0
|
||||||
|
|
||||||
|
|||||||
@@ -55,8 +55,8 @@ add_library(neochat STATIC
|
|||||||
models/devicesmodel.cpp
|
models/devicesmodel.cpp
|
||||||
models/devicesmodel.h
|
models/devicesmodel.h
|
||||||
models/devicesproxymodel.cpp
|
models/devicesproxymodel.cpp
|
||||||
filetypesingleton.cpp
|
filetype.cpp
|
||||||
filetypesingleton.h
|
filetype.h
|
||||||
login.cpp
|
login.cpp
|
||||||
login.h
|
login.h
|
||||||
models/webshortcutmodel.cpp
|
models/webshortcutmodel.cpp
|
||||||
@@ -129,6 +129,153 @@ add_library(neochat STATIC
|
|||||||
enums/delegatetype.h
|
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
|
ecm_qt_declare_logging_category(neochat
|
||||||
HEADER "messageeventmodel_logging.h"
|
HEADER "messageeventmodel_logging.h"
|
||||||
IDENTIFIER "MessageEvent"
|
IDENTIFIER "MessageEvent"
|
||||||
@@ -147,7 +294,6 @@ ecm_qt_declare_logging_category(neochat
|
|||||||
|
|
||||||
add_executable(neochat-app
|
add_executable(neochat-app
|
||||||
main.cpp
|
main.cpp
|
||||||
res.qrc
|
|
||||||
)
|
)
|
||||||
|
|
||||||
if(TARGET Qt::WebView)
|
if(TARGET Qt::WebView)
|
||||||
@@ -179,15 +325,12 @@ if(NOT ANDROID)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (NOT ANDROID AND NOT WIN32 AND NOT APPLE)
|
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_RUNNER)
|
||||||
target_compile_definitions(neochat PUBLIC -DHAVE_X11)
|
target_compile_definitions(neochat PUBLIC -DHAVE_X11)
|
||||||
target_sources(neochat PRIVATE runner.cpp)
|
target_sources(neochat PRIVATE runner.cpp)
|
||||||
else()
|
|
||||||
target_sources(neochat-app PRIVATE res_android.qrc)
|
|
||||||
endif()
|
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)
|
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)
|
kconfig_add_kcfg_files(neochat GENERATE_MOC neochatconfig.kcfgc)
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
#include <QQmlEngine>
|
||||||
|
|
||||||
#include <Quotient/events/roommessageevent.h>
|
#include <Quotient/events/roommessageevent.h>
|
||||||
|
|
||||||
@@ -32,6 +33,7 @@ class NeoChatRoom;
|
|||||||
class ActionsHandler : public QObject
|
class ActionsHandler : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
QML_ELEMENT
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief The room that messages will be sent to.
|
* @brief The room that messages will be sent to.
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
#include <QQmlEngine>
|
||||||
#include <QQuickTextDocument>
|
#include <QQuickTextDocument>
|
||||||
#include <QTextCursor>
|
#include <QTextCursor>
|
||||||
|
|
||||||
@@ -58,6 +59,7 @@ class SyntaxHighlighter;
|
|||||||
class ChatDocumentHandler : public QObject
|
class ChatDocumentHandler : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
QML_ELEMENT
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Is the instance being used to handle an edit message.
|
* @brief Is the instance being used to handle an edit message.
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
#include <QQmlEngine>
|
||||||
|
|
||||||
class QClipboard;
|
class QClipboard;
|
||||||
class QImage;
|
class QImage;
|
||||||
@@ -18,6 +19,8 @@ class QImage;
|
|||||||
class Clipboard : public QObject
|
class Clipboard : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
QML_ELEMENT
|
||||||
|
QML_SINGLETON
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Whether the current clipboard content is an image.
|
* @brief Whether the current clipboard content is an image.
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
#include <QQmlEngine>
|
||||||
|
|
||||||
class QAbstractItemModel;
|
class QAbstractItemModel;
|
||||||
class KColorSchemeManager;
|
class KColorSchemeManager;
|
||||||
@@ -19,6 +20,8 @@ class KColorSchemeManager;
|
|||||||
class ColorSchemer : public QObject
|
class ColorSchemer : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
QML_ELEMENT
|
||||||
|
QML_SINGLETON
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief A QAbstractItemModel of all available color schemes.
|
* @brief A QAbstractItemModel of all available color schemes.
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
|
|
||||||
#include "models/pushrulemodel.h"
|
#include "models/pushrulemodel.h"
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
#include <QQmlEngine>
|
||||||
#include <QQuickItem>
|
#include <QQuickItem>
|
||||||
|
|
||||||
#include <KFormat>
|
#include <KFormat>
|
||||||
@@ -40,6 +41,8 @@ class ReadPasswordJob;
|
|||||||
class Controller : public QObject
|
class Controller : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
QML_ELEMENT
|
||||||
|
QML_SINGLETON
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief The current connection for the rest of NeoChat to use.
|
* @brief The current connection for the rest of NeoChat to use.
|
||||||
@@ -90,6 +93,10 @@ public:
|
|||||||
Q_ENUM(PasswordStatus)
|
Q_ENUM(PasswordStatus)
|
||||||
|
|
||||||
static Controller &instance();
|
static Controller &instance();
|
||||||
|
static Controller *create(QQmlEngine *, QJSEngine *)
|
||||||
|
{
|
||||||
|
return &instance();
|
||||||
|
}
|
||||||
|
|
||||||
void setActiveConnection(NeoChatConnection *connection);
|
void setActiveConnection(NeoChatConnection *connection);
|
||||||
[[nodiscard]] NeoChatConnection *activeConnection() const;
|
[[nodiscard]] NeoChatConnection *activeConnection() const;
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
#include <QQmlEngine>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class DelegateSizeHelper
|
* @class DelegateSizeHelper
|
||||||
@@ -23,6 +24,7 @@
|
|||||||
class DelegateSizeHelper : public QObject
|
class DelegateSizeHelper : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
QML_ELEMENT
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief The width of the component's parent.
|
* @brief The width of the component's parent.
|
||||||
|
|||||||
@@ -4,15 +4,18 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
#include <QQmlEngine>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class DelegateType
|
* @class DelegateType
|
||||||
*
|
*
|
||||||
* This class is designed to define the DelegateType enumeration.
|
* This class is designed to define the DelegateType enumeration.
|
||||||
*/
|
*/
|
||||||
class DelegateType
|
class DelegateType : public QObject
|
||||||
{
|
{
|
||||||
Q_GADGET
|
Q_OBJECT
|
||||||
|
QML_ELEMENT
|
||||||
|
QML_UNCREATABLE("")
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
|||||||
116
src/filetype.cpp
Normal file
116
src/filetype.cpp
Normal file
@@ -0,0 +1,116 @@
|
|||||||
|
// SPDX-FileCopyrightText: 2021 Noah Davis <noahadvs@gmail.com>
|
||||||
|
// SPDX-License-Identifier: LicenseRef-KDE-Accepted-LGPL
|
||||||
|
|
||||||
|
#include "filetype.h"
|
||||||
|
#include <QImageReader>
|
||||||
|
#include <QMovie>
|
||||||
|
|
||||||
|
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<QMimeDatabase::MatchMode>(mode));
|
||||||
|
}
|
||||||
|
|
||||||
|
QMimeType FileType::mimeTypeForFile(const QFileInfo &fileInfo, MatchMode mode) const
|
||||||
|
{
|
||||||
|
Q_D(const FileType);
|
||||||
|
return d->mimetypeDatabase.mimeTypeForFile(fileInfo, static_cast<QMimeDatabase::MatchMode>(mode));
|
||||||
|
}
|
||||||
|
|
||||||
|
QList<QMimeType> 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"
|
||||||
@@ -8,9 +8,10 @@
|
|||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
#include <QMimeDatabase>
|
#include <QMimeDatabase>
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
#include <QQmlEngine>
|
||||||
#include <qqml.h>
|
#include <qqml.h>
|
||||||
|
|
||||||
class FileTypeSingletonPrivate;
|
class FileTypePrivate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class FileTypeSingleton
|
* @class FileTypeSingleton
|
||||||
@@ -19,9 +20,11 @@ class FileTypeSingletonPrivate;
|
|||||||
*
|
*
|
||||||
* @sa QMimeDatabase
|
* @sa QMimeDatabase
|
||||||
*/
|
*/
|
||||||
class FileTypeSingleton : public QObject
|
class FileType : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
QML_ELEMENT
|
||||||
|
QML_SINGLETON
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief List of supported image formats.
|
* @brief List of supported image formats.
|
||||||
@@ -37,12 +40,9 @@ class FileTypeSingleton : public QObject
|
|||||||
*/
|
*/
|
||||||
Q_PROPERTY(QStringList supportedAnimatedImageFormats READ supportedAnimatedImageFormats CONSTANT FINAL)
|
Q_PROPERTY(QStringList supportedAnimatedImageFormats READ supportedAnimatedImageFormats CONSTANT FINAL)
|
||||||
|
|
||||||
QML_NAMED_ELEMENT(FileType)
|
|
||||||
QML_SINGLETON
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit FileTypeSingleton(QObject *parent = nullptr);
|
explicit FileType(QObject *parent = nullptr);
|
||||||
~FileTypeSingleton();
|
~FileType();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Returns a MIME type for nameOrAlias or an invalid one if none found.
|
* @brief Returns a MIME type for nameOrAlias or an invalid one if none found.
|
||||||
@@ -59,14 +59,14 @@ public:
|
|||||||
*
|
*
|
||||||
* @sa QMimeDatabase
|
* @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.
|
* @brief Returns a MIME type for fileInfo.
|
||||||
*
|
*
|
||||||
* @sa QMimeDatabase
|
* @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.
|
* @brief Returns the MIME types for the file name fileName.
|
||||||
@@ -121,9 +121,7 @@ public:
|
|||||||
QStringList supportedAnimatedImageFormats() const;
|
QStringList supportedAnimatedImageFormats() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const QScopedPointer<FileTypeSingletonPrivate> d_ptr;
|
const QScopedPointer<FileTypePrivate> d_ptr;
|
||||||
Q_DECLARE_PRIVATE(FileTypeSingleton)
|
Q_DECLARE_PRIVATE(FileType)
|
||||||
Q_DISABLE_COPY(FileTypeSingleton)
|
Q_DISABLE_COPY(FileType)
|
||||||
};
|
};
|
||||||
|
|
||||||
QML_DECLARE_TYPE(FileTypeSingleton)
|
|
||||||
@@ -1,116 +0,0 @@
|
|||||||
// SPDX-FileCopyrightText: 2021 Noah Davis <noahadvs@gmail.com>
|
|
||||||
// SPDX-License-Identifier: LicenseRef-KDE-Accepted-LGPL
|
|
||||||
|
|
||||||
#include "filetypesingleton.h"
|
|
||||||
#include <QImageReader>
|
|
||||||
#include <QMovie>
|
|
||||||
|
|
||||||
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<QMimeDatabase::MatchMode>(mode));
|
|
||||||
}
|
|
||||||
|
|
||||||
QMimeType FileTypeSingleton::mimeTypeForFile(const QFileInfo &fileInfo, MatchMode mode) const
|
|
||||||
{
|
|
||||||
Q_D(const FileTypeSingleton);
|
|
||||||
return d->mimetypeDatabase.mimeTypeForFile(fileInfo, static_cast<QMimeDatabase::MatchMode>(mode));
|
|
||||||
}
|
|
||||||
|
|
||||||
QList<QMimeType> 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"
|
|
||||||
@@ -4,6 +4,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
#include <QQmlEngine>
|
||||||
#include <QUrl>
|
#include <QUrl>
|
||||||
|
|
||||||
class NeoChatRoom;
|
class NeoChatRoom;
|
||||||
@@ -19,6 +20,8 @@ class NeoChatRoom;
|
|||||||
class LinkPreviewer : public QObject
|
class LinkPreviewer : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
QML_ELEMENT
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief The URL to get the preview for.
|
* @brief The URL to get the preview for.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -2,14 +2,17 @@
|
|||||||
// SPDX-License-Identifier: LGPL-2.0-or-later
|
// SPDX-License-Identifier: LGPL-2.0-or-later
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "linkpreviewer.h"
|
|
||||||
#include <QMetaType>
|
#include <QMetaType>
|
||||||
|
#include <QObject>
|
||||||
|
#include <QQmlEngine>
|
||||||
#include <QRectF>
|
#include <QRectF>
|
||||||
|
|
||||||
/** Location related helper functions for QML. */
|
/** Location related helper functions for QML. */
|
||||||
class LocationHelper
|
class LocationHelper : public QObject
|
||||||
{
|
{
|
||||||
Q_GADGET
|
Q_OBJECT
|
||||||
|
QML_ELEMENT
|
||||||
|
QML_UNCREATABLE("")
|
||||||
public:
|
public:
|
||||||
/** Unite two rectanlges. */
|
/** Unite two rectanlges. */
|
||||||
Q_INVOKABLE static QRectF unite(const QRectF &r1, const QRectF &r2);
|
Q_INVOKABLE static QRectF unite(const QRectF &r1, const QRectF &r2);
|
||||||
|
|||||||
@@ -13,13 +13,13 @@
|
|||||||
|
|
||||||
using namespace Quotient;
|
using namespace Quotient;
|
||||||
|
|
||||||
Login::Login(QObject *parent)
|
LoginHelper::LoginHelper(QObject *parent)
|
||||||
: QObject(parent)
|
: QObject(parent)
|
||||||
{
|
{
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Login::init()
|
void LoginHelper::init()
|
||||||
{
|
{
|
||||||
m_homeserverReachable = false;
|
m_homeserverReachable = false;
|
||||||
m_connection = new NeoChatConnection();
|
m_connection = new NeoChatConnection();
|
||||||
@@ -31,7 +31,7 @@ void Login::init()
|
|||||||
m_supportsPassword = false;
|
m_supportsPassword = false;
|
||||||
m_ssoUrl = QUrl();
|
m_ssoUrl = QUrl();
|
||||||
|
|
||||||
connect(this, &Login::matrixIdChanged, this, [this]() {
|
connect(this, &LoginHelper::matrixIdChanged, this, [this]() {
|
||||||
setHomeserverReachable(false);
|
setHomeserverReachable(false);
|
||||||
QRegularExpression validator(QStringLiteral("^\\@?[a-zA-Z0-9\\._=\\-/]+\\:[a-zA-Z0-9\\-]+(\\.[a-zA-Z0-9\\-]+)*(\\:[0-9]+)?$"));
|
QRegularExpression validator(QStringLiteral("^\\@?[a-zA-Z0-9\\._=\\-/]+\\:[a-zA-Z0-9\\-]+(\\.[a-zA-Z0-9\\-]+)*(\\:[0-9]+)?$"));
|
||||||
if (!validator.match(m_matrixId).hasMatch()) {
|
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;
|
m_homeserverReachable = reachable;
|
||||||
Q_EMIT homeserverReachableChanged();
|
Q_EMIT homeserverReachableChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Login::homeserverReachable() const
|
bool LoginHelper::homeserverReachable() const
|
||||||
{
|
{
|
||||||
return m_homeserverReachable;
|
return m_homeserverReachable;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString Login::matrixId() const
|
QString LoginHelper::matrixId() const
|
||||||
{
|
{
|
||||||
return m_matrixId;
|
return m_matrixId;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Login::setMatrixId(const QString &matrixId)
|
void LoginHelper::setMatrixId(const QString &matrixId)
|
||||||
{
|
{
|
||||||
m_matrixId = matrixId;
|
m_matrixId = matrixId;
|
||||||
if (!m_matrixId.startsWith(QLatin1Char('@'))) {
|
if (!m_matrixId.startsWith(QLatin1Char('@'))) {
|
||||||
@@ -130,30 +130,30 @@ void Login::setMatrixId(const QString &matrixId)
|
|||||||
Q_EMIT matrixIdChanged();
|
Q_EMIT matrixIdChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString Login::password() const
|
QString LoginHelper::password() const
|
||||||
{
|
{
|
||||||
return m_password;
|
return m_password;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Login::setPassword(const QString &password)
|
void LoginHelper::setPassword(const QString &password)
|
||||||
{
|
{
|
||||||
setInvalidPassword(false);
|
setInvalidPassword(false);
|
||||||
m_password = password;
|
m_password = password;
|
||||||
Q_EMIT passwordChanged();
|
Q_EMIT passwordChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString Login::deviceName() const
|
QString LoginHelper::deviceName() const
|
||||||
{
|
{
|
||||||
return m_deviceName;
|
return m_deviceName;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Login::setDeviceName(const QString &deviceName)
|
void LoginHelper::setDeviceName(const QString &deviceName)
|
||||||
{
|
{
|
||||||
m_deviceName = deviceName;
|
m_deviceName = deviceName;
|
||||||
Q_EMIT deviceNameChanged();
|
Q_EMIT deviceNameChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Login::login()
|
void LoginHelper::login()
|
||||||
{
|
{
|
||||||
m_isLoggingIn = true;
|
m_isLoggingIn = true;
|
||||||
Q_EMIT isLoggingInChanged();
|
Q_EMIT isLoggingInChanged();
|
||||||
@@ -164,22 +164,22 @@ void Login::login()
|
|||||||
m_connection->loginWithPassword(username, m_password, m_deviceName, QString());
|
m_connection->loginWithPassword(username, m_password, m_deviceName, QString());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Login::supportsPassword() const
|
bool LoginHelper::supportsPassword() const
|
||||||
{
|
{
|
||||||
return m_supportsPassword;
|
return m_supportsPassword;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Login::supportsSso() const
|
bool LoginHelper::supportsSso() const
|
||||||
{
|
{
|
||||||
return m_supportsSso;
|
return m_supportsSso;
|
||||||
}
|
}
|
||||||
|
|
||||||
QUrl Login::ssoUrl() const
|
QUrl LoginHelper::ssoUrl() const
|
||||||
{
|
{
|
||||||
return m_ssoUrl;
|
return m_ssoUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Login::loginWithSso()
|
void LoginHelper::loginWithSso()
|
||||||
{
|
{
|
||||||
m_connection->resolveServer(m_matrixId);
|
m_connection->resolveServer(m_matrixId);
|
||||||
connectSingleShot(m_connection, &Connection::loginFlowsChanged, this, [this]() {
|
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;
|
return m_testing;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Login::isLoggingIn() const
|
bool LoginHelper::isLoggingIn() const
|
||||||
{
|
{
|
||||||
return m_isLoggingIn;
|
return m_isLoggingIn;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Login::isLoggedIn() const
|
bool LoginHelper::isLoggedIn() const
|
||||||
{
|
{
|
||||||
return m_isLoggedIn;
|
return m_isLoggedIn;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Login::setInvalidPassword(bool invalid)
|
void LoginHelper::setInvalidPassword(bool invalid)
|
||||||
{
|
{
|
||||||
m_invalidPassword = invalid;
|
m_invalidPassword = invalid;
|
||||||
Q_EMIT isInvalidPasswordChanged();
|
Q_EMIT isInvalidPasswordChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Login::isInvalidPassword() const
|
bool LoginHelper::isInvalidPassword() const
|
||||||
{
|
{
|
||||||
return m_invalidPassword;
|
return m_invalidPassword;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,18 +4,21 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
#include <QQmlEngine>
|
||||||
#include <QUrl>
|
#include <QUrl>
|
||||||
|
|
||||||
class NeoChatConnection;
|
class NeoChatConnection;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class Login
|
* @class LoginHelper
|
||||||
*
|
*
|
||||||
* A helper class for logging into a Matrix account.
|
* A helper class for logging into a Matrix account.
|
||||||
*/
|
*/
|
||||||
class Login : public QObject
|
class LoginHelper : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
QML_ELEMENT
|
||||||
|
QML_SINGLETON
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Whether the home server for the account is reachable.
|
* @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)
|
Q_PROPERTY(bool isInvalidPassword READ isInvalidPassword NOTIFY isInvalidPasswordChanged)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit Login(QObject *parent = nullptr);
|
explicit LoginHelper(QObject *parent = nullptr);
|
||||||
|
|
||||||
Q_INVOKABLE void init();
|
Q_INVOKABLE void init();
|
||||||
|
|
||||||
|
|||||||
98
src/main.cpp
98
src/main.cpp
@@ -44,11 +44,9 @@
|
|||||||
#include "actionshandler.h"
|
#include "actionshandler.h"
|
||||||
#include "blurhashimageprovider.h"
|
#include "blurhashimageprovider.h"
|
||||||
#include "chatdocumenthandler.h"
|
#include "chatdocumenthandler.h"
|
||||||
#include "clipboard.h"
|
|
||||||
#include "controller.h"
|
#include "controller.h"
|
||||||
#include "delegatesizehelper.h"
|
#include "delegatesizehelper.h"
|
||||||
#include "enums/delegatetype.h"
|
#include "enums/delegatetype.h"
|
||||||
#include "filetypesingleton.h"
|
|
||||||
#include "linkpreviewer.h"
|
#include "linkpreviewer.h"
|
||||||
#include "locationhelper.h"
|
#include "locationhelper.h"
|
||||||
#include "logger.h"
|
#include "logger.h"
|
||||||
@@ -82,9 +80,6 @@
|
|||||||
#include "models/userlistmodel.h"
|
#include "models/userlistmodel.h"
|
||||||
#include "models/webshortcutmodel.h"
|
#include "models/webshortcutmodel.h"
|
||||||
#include "neochatconfig.h"
|
#include "neochatconfig.h"
|
||||||
#include "neochatconnection.h"
|
|
||||||
#include "neochatroom.h"
|
|
||||||
#include "notificationsmanager.h"
|
|
||||||
#include "pollhandler.h"
|
#include "pollhandler.h"
|
||||||
#include "roommanager.h"
|
#include "roommanager.h"
|
||||||
#include "spacehierarchycache.h"
|
#include "spacehierarchycache.h"
|
||||||
@@ -109,6 +104,8 @@
|
|||||||
|
|
||||||
using namespace Quotient;
|
using namespace Quotient;
|
||||||
|
|
||||||
|
void qml_register_types_org_kde_neochat();
|
||||||
|
|
||||||
class NetworkAccessManagerFactory : public QQmlNetworkAccessManagerFactory
|
class NetworkAccessManagerFactory : public QQmlNetworkAccessManagerFactory
|
||||||
{
|
{
|
||||||
QNetworkAccessManager *create(QObject *) override
|
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"));
|
QStringLiteral("/var/config/fontconfig/conf.d/99-noto-mono-color-emoji.conf"));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Clipboard clipboard;
|
|
||||||
auto config = NeoChatConfig::self();
|
|
||||||
FileTypeSingleton fileTypeSingleton;
|
|
||||||
|
|
||||||
Login *login = new Login();
|
|
||||||
UrlHelper urlHelper;
|
|
||||||
|
|
||||||
#ifdef HAVE_COLORSCHEME
|
#ifdef HAVE_COLORSCHEME
|
||||||
ColorSchemer colorScheme;
|
ColorSchemer colorScheme;
|
||||||
qmlRegisterSingletonInstance<ColorSchemer>("org.kde.neochat", 1, 0, "ColorSchemer", &colorScheme);
|
if (!NeoChatConfig::self()->colorScheme().isEmpty()) {
|
||||||
if (!config->colorScheme().isEmpty()) {
|
colorScheme.apply(NeoChatConfig::self()->colorScheme());
|
||||||
colorScheme.apply(config->colorScheme());
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
qmlRegisterSingletonInstance("org.kde.neochat", 1, 0, "Controller", &Controller::instance());
|
qml_register_types_org_kde_neochat();
|
||||||
qmlRegisterSingletonInstance("org.kde.neochat", 1, 0, "NotificationsManager", &NotificationsManager::instance());
|
qmlRegisterSingletonInstance("org.kde.neochat.config", 1, 0, "Config", NeoChatConfig::self());
|
||||||
qmlRegisterSingletonInstance("org.kde.neochat", 1, 0, "Clipboard", &clipboard);
|
qmlRegisterSingletonInstance("org.kde.neochat.accounts", 1, 0, "AccountRegistry", &Controller::instance().accounts());
|
||||||
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<ActionsHandler>("org.kde.neochat", 1, 0, "ActionsHandler");
|
|
||||||
qmlRegisterType<ChatDocumentHandler>("org.kde.neochat", 1, 0, "ChatDocumentHandler");
|
|
||||||
qmlRegisterType<RoomListModel>("org.kde.neochat", 1, 0, "RoomListModel");
|
|
||||||
qmlRegisterType<KWebShortcutModel>("org.kde.neochat", 1, 0, "WebShortcutModel");
|
|
||||||
qmlRegisterType<UserListModel>("org.kde.neochat", 1, 0, "UserListModel");
|
|
||||||
qmlRegisterType<MessageEventModel>("org.kde.neochat", 1, 0, "MessageEventModel");
|
|
||||||
qmlRegisterType<ReactionModel>("org.kde.neochat", 1, 0, "ReactionModel");
|
|
||||||
qmlRegisterType<MediaMessageFilterModel>("org.kde.neochat", 1, 0, "MediaMessageFilterModel");
|
|
||||||
qmlRegisterType<MessageFilterModel>("org.kde.neochat", 1, 0, "MessageFilterModel");
|
|
||||||
qmlRegisterType<UserFilterModel>("org.kde.neochat", 1, 0, "UserFilterModel");
|
|
||||||
qmlRegisterType<PublicRoomListModel>("org.kde.neochat", 1, 0, "PublicRoomListModel");
|
|
||||||
qmlRegisterType<UserDirectoryListModel>("org.kde.neochat", 1, 0, "UserDirectoryListModel");
|
|
||||||
qmlRegisterType<ServerListModel>("org.kde.neochat", 1, 0, "ServerListModel");
|
|
||||||
qmlRegisterType<SortFilterRoomListModel>("org.kde.neochat", 1, 0, "SortFilterRoomListModel");
|
|
||||||
qmlRegisterType<SortFilterSpaceListModel>("org.kde.neochat", 1, 0, "SortFilterSpaceListModel");
|
|
||||||
qmlRegisterType<DevicesModel>("org.kde.neochat", 1, 0, "DevicesModel");
|
|
||||||
qmlRegisterType<DevicesProxyModel>("org.kde.neochat", 1, 0, "DevicesProxyModel");
|
|
||||||
qmlRegisterType<LinkPreviewer>("org.kde.neochat", 1, 0, "LinkPreviewer");
|
|
||||||
qmlRegisterType<CompletionModel>("org.kde.neochat", 1, 0, "CompletionModel");
|
|
||||||
qmlRegisterType<StateModel>("org.kde.neochat", 1, 0, "StateModel");
|
|
||||||
qmlRegisterType<StateFilterModel>("org.kde.neochat", 1, 0, "StateFilterModel");
|
|
||||||
qmlRegisterType<SearchModel>("org.kde.neochat", 1, 0, "SearchModel");
|
|
||||||
qmlRegisterType<LiveLocationsModel>("org.kde.neochat", 1, 0, "LiveLocationsModel");
|
|
||||||
qmlRegisterType<LocationsModel>("org.kde.neochat", 1, 0, "LocationsModel");
|
|
||||||
qmlRegisterType<PollHandler>("org.kde.neochat", 1, 0, "PollHandler");
|
|
||||||
qmlRegisterType<PushRuleModel>("org.kde.neochat", 1, 0, "PushRuleModel");
|
|
||||||
qmlRegisterType<StickerModel>("org.kde.neochat", 1, 0, "StickerModel");
|
|
||||||
qmlRegisterType<ImagePacksModel>("org.kde.neochat", 1, 0, "ImagePacksModel");
|
|
||||||
qmlRegisterType<AccountEmoticonModel>("org.kde.neochat", 1, 0, "AccountEmoticonModel");
|
|
||||||
qmlRegisterType<EmoticonFilterModel>("org.kde.neochat", 1, 0, "EmoticonFilterModel");
|
|
||||||
qmlRegisterType<DelegateSizeHelper>("org.kde.neochat", 1, 0, "DelegateSizeHelper");
|
|
||||||
qmlRegisterType<MediaSizeHelper>("org.kde.neochat", 1, 0, "MediaSizeHelper");
|
|
||||||
qmlRegisterUncreatableType<DelegateType>("org.kde.neochat", 1, 0, "DelegateType", "ENUM"_ls);
|
|
||||||
qmlRegisterUncreatableType<PushNotificationKind>("org.kde.neochat", 1, 0, "PushNotificationKind", "ENUM"_ls);
|
|
||||||
qmlRegisterUncreatableType<PushNotificationSection>("org.kde.neochat", 1, 0, "PushNotificationSection", "ENUM"_ls);
|
|
||||||
qmlRegisterUncreatableType<PushNotificationState>("org.kde.neochat", 1, 0, "PushNotificationState", "ENUM"_ls);
|
|
||||||
qmlRegisterUncreatableType<PushNotificationAction>("org.kde.neochat", 1, 0, "PushNotificationAction", "ENUM"_ls);
|
|
||||||
qmlRegisterUncreatableType<NeoChatRoomType>("org.kde.neochat", 1, 0, "NeoChatRoomType", "ENUM"_ls);
|
|
||||||
qmlRegisterUncreatableType<User>("org.kde.neochat", 1, 0, "User", {});
|
|
||||||
qmlRegisterUncreatableType<NeoChatRoom>("org.kde.neochat", 1, 0, "NeoChatRoom", {});
|
|
||||||
qmlRegisterUncreatableType<NeoChatConnection>("org.kde.neochat", 1, 0, "NeoChatConnection", {});
|
|
||||||
|
|
||||||
qRegisterMetaType<User *>("User*");
|
// qmlRegisterUncreatableType<KeyVerificationSession>("org.kde.neochat", 1, 0, "KeyVerificationSession", {});
|
||||||
qRegisterMetaType<User *>("const User*");
|
|
||||||
qRegisterMetaType<User *>("const Quotient::User*");
|
|
||||||
qRegisterMetaType<Room *>("Room*");
|
|
||||||
qRegisterMetaType<MessageEventType>("MessageEventType");
|
|
||||||
qRegisterMetaType<NeoChatRoom *>("NeoChatRoom*");
|
|
||||||
qRegisterMetaType<User *>("User*");
|
|
||||||
qRegisterMetaType<GetRoomEventsJob *>("GetRoomEventsJob*");
|
|
||||||
qRegisterMetaType<QMimeType>("QMimeType");
|
|
||||||
qRegisterMetaType<KeyVerificationSession *>("KeyVerificationSession*");
|
|
||||||
qmlRegisterUncreatableType<KeyVerificationSession>("org.kde.neochat", 1, 0, "KeyVerificationSession", {});
|
|
||||||
qRegisterMetaType<QVector<EmojiEntry>>("QVector<EmojiEntry>");
|
|
||||||
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());
|
|
||||||
});
|
|
||||||
|
|
||||||
QQmlApplicationEngine engine;
|
QQmlApplicationEngine engine;
|
||||||
|
|
||||||
@@ -354,7 +274,7 @@ int main(int argc, char *argv[])
|
|||||||
engine.addImageProvider(QLatin1String("mxc"), new MatrixImageProvider);
|
engine.addImageProvider(QLatin1String("mxc"), new MatrixImageProvider);
|
||||||
engine.addImageProvider(QLatin1String("blurhash"), new BlurhashImageProvider);
|
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()) {
|
if (engine.rootObjects().isEmpty()) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
#include <QQmlEngine>
|
||||||
#include <QSize>
|
#include <QSize>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -28,6 +29,7 @@
|
|||||||
class MediaSizeHelper : public QObject
|
class MediaSizeHelper : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
QML_ELEMENT
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief The maximum width (in px) the media can be.
|
* @brief The maximum width (in px) the media can be.
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
#include <QCoroTask>
|
#include <QCoroTask>
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QPointer>
|
#include <QPointer>
|
||||||
|
#include <QQmlEngine>
|
||||||
#include <QVector>
|
#include <QVector>
|
||||||
|
|
||||||
#include <Quotient/connection.h>
|
#include <Quotient/connection.h>
|
||||||
@@ -23,6 +24,8 @@
|
|||||||
class AccountEmoticonModel : public QAbstractListModel
|
class AccountEmoticonModel : public QAbstractListModel
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
QML_ELEMENT
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief The connection to get emoticons from.
|
* @brief The connection to get emoticons from.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <QConcatenateTablesProxyModel>
|
#include <QConcatenateTablesProxyModel>
|
||||||
|
#include <QQmlEngine>
|
||||||
#include <QSortFilterProxyModel>
|
#include <QSortFilterProxyModel>
|
||||||
|
|
||||||
#include "roomlistmodel.h"
|
#include "roomlistmodel.h"
|
||||||
@@ -24,6 +25,7 @@ class RoomListModel;
|
|||||||
class CompletionModel : public QAbstractListModel
|
class CompletionModel : public QAbstractListModel
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
QML_ELEMENT
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief The current text to search for completions.
|
* @brief The current text to search for completions.
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <QAbstractListModel>
|
#include <QAbstractListModel>
|
||||||
|
#include <QQmlEngine>
|
||||||
#include <QRegularExpression>
|
#include <QRegularExpression>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
@@ -27,6 +28,8 @@ struct CustomEmoji {
|
|||||||
class CustomEmojiModel : public QAbstractListModel
|
class CustomEmojiModel : public QAbstractListModel
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
QML_ELEMENT
|
||||||
|
QML_SINGLETON
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
@@ -48,6 +51,10 @@ public:
|
|||||||
static CustomEmojiModel _instance;
|
static CustomEmojiModel _instance;
|
||||||
return _instance;
|
return _instance;
|
||||||
}
|
}
|
||||||
|
static CustomEmojiModel *create(QQmlEngine *, QJSEngine *)
|
||||||
|
{
|
||||||
|
return &instance();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get the given role value at the given index.
|
* @brief Get the given role value at the given index.
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
|
|
||||||
#include <QAbstractListModel>
|
#include <QAbstractListModel>
|
||||||
#include <QPointer>
|
#include <QPointer>
|
||||||
|
#include <QQmlEngine>
|
||||||
|
|
||||||
#include <Quotient/csapi/definitions/client_device.h>
|
#include <Quotient/csapi/definitions/client_device.h>
|
||||||
|
|
||||||
@@ -25,6 +26,7 @@ class Connection;
|
|||||||
class DevicesModel : public QAbstractListModel
|
class DevicesModel : public QAbstractListModel
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
QML_ELEMENT
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief The current connection that the model is getting its devices from.
|
* @brief The current connection that the model is getting its devices from.
|
||||||
|
|||||||
@@ -3,11 +3,14 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <QQmlEngine>
|
||||||
#include <QSortFilterProxyModel>
|
#include <QSortFilterProxyModel>
|
||||||
|
|
||||||
class DevicesProxyModel : public QSortFilterProxyModel
|
class DevicesProxyModel : public QSortFilterProxyModel
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
QML_ELEMENT
|
||||||
|
|
||||||
Q_PROPERTY(int type READ type WRITE setType NOTIFY typeChanged)
|
Q_PROPERTY(int type READ type WRITE setType NOTIFY typeChanged)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
|
|
||||||
#include <QAbstractListModel>
|
#include <QAbstractListModel>
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
#include <QQmlEngine>
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
|
|
||||||
struct Emoji {
|
struct Emoji {
|
||||||
@@ -59,6 +60,8 @@ Q_DECLARE_METATYPE(Emoji)
|
|||||||
class EmojiModel : public QAbstractListModel
|
class EmojiModel : public QAbstractListModel
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
QML_ELEMENT
|
||||||
|
QML_SINGLETON
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Return a list of recently used emojis.
|
* @brief Return a list of recently used emojis.
|
||||||
@@ -83,6 +86,10 @@ public:
|
|||||||
static EmojiModel _instance;
|
static EmojiModel _instance;
|
||||||
return _instance;
|
return _instance;
|
||||||
}
|
}
|
||||||
|
static EmojiModel *create(QQmlEngine *, QJSEngine *)
|
||||||
|
{
|
||||||
|
return &instance();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Defines the model roles.
|
* @brief Defines the model roles.
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <QQmlEngine>
|
||||||
#include <QSortFilterProxyModel>
|
#include <QSortFilterProxyModel>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -14,6 +15,7 @@
|
|||||||
class EmoticonFilterModel : public QSortFilterProxyModel
|
class EmoticonFilterModel : public QSortFilterProxyModel
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
QML_ELEMENT
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Whether stickers should be shown
|
* @brief Whether stickers should be shown
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
#include "events/imagepackevent.h"
|
#include "events/imagepackevent.h"
|
||||||
#include <QAbstractListModel>
|
#include <QAbstractListModel>
|
||||||
#include <QPointer>
|
#include <QPointer>
|
||||||
|
#include <QQmlEngine>
|
||||||
#include <QVector>
|
#include <QVector>
|
||||||
|
|
||||||
class NeoChatRoom;
|
class NeoChatRoom;
|
||||||
@@ -21,6 +22,7 @@ class NeoChatRoom;
|
|||||||
class ImagePacksModel : public QAbstractListModel
|
class ImagePacksModel : public QAbstractListModel
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
QML_ELEMENT
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief The current room that the model is being used in.
|
* @brief The current room that the model is being used in.
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
#include <QAbstractListModel>
|
#include <QAbstractListModel>
|
||||||
#include <QPointer>
|
#include <QPointer>
|
||||||
|
#include <QQmlEngine>
|
||||||
#include <QRectF>
|
#include <QRectF>
|
||||||
|
|
||||||
struct LiveLocationData {
|
struct LiveLocationData {
|
||||||
@@ -24,6 +25,8 @@ bool operator<(const LiveLocationData &lhs, const LiveLocationData &rhs);
|
|||||||
class LiveLocationsModel : public QAbstractListModel
|
class LiveLocationsModel : public QAbstractListModel
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
QML_ELEMENT
|
||||||
|
|
||||||
Q_PROPERTY(NeoChatRoom *room MEMBER m_room NOTIFY roomChanged)
|
Q_PROPERTY(NeoChatRoom *room MEMBER m_room NOTIFY roomChanged)
|
||||||
/** The event id of the beacon start event, ie. the one all suspequent
|
/** The event id of the beacon start event, ie. the one all suspequent
|
||||||
* events use to relate to the same beacon.
|
* events use to relate to the same beacon.
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
|
|
||||||
#include <QAbstractListModel>
|
#include <QAbstractListModel>
|
||||||
#include <QPointer>
|
#include <QPointer>
|
||||||
|
#include <QQmlEngine>
|
||||||
#include <QRectF>
|
#include <QRectF>
|
||||||
|
|
||||||
#include "neochatroom.h"
|
#include "neochatroom.h"
|
||||||
@@ -15,6 +16,7 @@
|
|||||||
class LocationsModel : public QAbstractListModel
|
class LocationsModel : public QAbstractListModel
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
QML_ELEMENT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum Roles {
|
enum Roles {
|
||||||
|
|||||||
@@ -3,8 +3,8 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <QQmlEngine>
|
||||||
#include <QSortFilterProxyModel>
|
#include <QSortFilterProxyModel>
|
||||||
#include <qobjectdefs.h>
|
|
||||||
|
|
||||||
#include "models/messagefiltermodel.h"
|
#include "models/messagefiltermodel.h"
|
||||||
|
|
||||||
@@ -20,6 +20,8 @@ class MessageFilterModel;
|
|||||||
class MediaMessageFilterModel : public QSortFilterProxyModel
|
class MediaMessageFilterModel : public QSortFilterProxyModel
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
QML_ELEMENT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum MediaType {
|
enum MediaType {
|
||||||
Image = 0,
|
Image = 0,
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
|
|
||||||
#include <KFormat>
|
#include <KFormat>
|
||||||
#include <QAbstractListModel>
|
#include <QAbstractListModel>
|
||||||
|
#include <QQmlEngine>
|
||||||
|
|
||||||
#include "linkpreviewer.h"
|
#include "linkpreviewer.h"
|
||||||
#include "neochatroom.h"
|
#include "neochatroom.h"
|
||||||
@@ -25,6 +26,7 @@ class ReactionModel;
|
|||||||
class MessageEventModel : public QAbstractListModel
|
class MessageEventModel : public QAbstractListModel
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
QML_ELEMENT
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief The current room that the model is getting its messages from.
|
* @brief The current room that the model is getting its messages from.
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <QQmlEngine>
|
||||||
#include <QSortFilterProxyModel>
|
#include <QSortFilterProxyModel>
|
||||||
|
|
||||||
#include "messageeventmodel.h"
|
#include "messageeventmodel.h"
|
||||||
@@ -21,6 +22,8 @@
|
|||||||
class MessageFilterModel : public QSortFilterProxyModel
|
class MessageFilterModel : public QSortFilterProxyModel
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
QML_ELEMENT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* @brief Defines the model roles.
|
* @brief Defines the model roles.
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
|
|
||||||
#include <QAbstractListModel>
|
#include <QAbstractListModel>
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
#include <QQmlEngine>
|
||||||
|
|
||||||
#include <Quotient/csapi/list_public_rooms.h>
|
#include <Quotient/csapi/list_public_rooms.h>
|
||||||
|
|
||||||
@@ -27,6 +28,7 @@ class Connection;
|
|||||||
class PublicRoomListModel : public QAbstractListModel
|
class PublicRoomListModel : public QAbstractListModel
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
QML_ELEMENT
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief The current connection that the model is getting its rooms from.
|
* @brief The current connection that the model is getting its rooms from.
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <QAbstractListModel>
|
#include <QAbstractListModel>
|
||||||
|
#include <QQmlEngine>
|
||||||
|
|
||||||
#include <Quotient/csapi/definitions/push_rule.h>
|
#include <Quotient/csapi/definitions/push_rule.h>
|
||||||
|
|
||||||
@@ -20,6 +21,8 @@
|
|||||||
class PushNotificationKind : public QObject
|
class PushNotificationKind : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
QML_ELEMENT
|
||||||
|
QML_UNCREATABLE("")
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
@@ -71,6 +74,8 @@ public:
|
|||||||
class PushNotificationSection : public QObject
|
class PushNotificationSection : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
QML_ELEMENT
|
||||||
|
QML_UNCREATABLE("")
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
@@ -130,6 +135,7 @@ public:
|
|||||||
class PushRuleModel : public QAbstractListModel
|
class PushRuleModel : public QAbstractListModel
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
QML_ELEMENT
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief The default state for any newly created keyword rule.
|
* @brief The default state for any newly created keyword rule.
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <QAbstractListModel>
|
#include <QAbstractListModel>
|
||||||
|
#include <QQmlEngine>
|
||||||
|
|
||||||
namespace Quotient
|
namespace Quotient
|
||||||
{
|
{
|
||||||
@@ -18,6 +19,7 @@ class User;
|
|||||||
class ReactionModel : public QAbstractListModel
|
class ReactionModel : public QAbstractListModel
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
QML_ELEMENT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
#include <Quotient/events/roomevent.h>
|
#include <Quotient/events/roomevent.h>
|
||||||
|
|
||||||
#include <QAbstractListModel>
|
#include <QAbstractListModel>
|
||||||
|
#include <QQmlEngine>
|
||||||
|
|
||||||
class NeoChatRoom;
|
class NeoChatRoom;
|
||||||
|
|
||||||
@@ -18,6 +19,8 @@ class Room;
|
|||||||
class NeoChatRoomType : public QObject
|
class NeoChatRoomType : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
QML_ELEMENT
|
||||||
|
QML_UNCREATABLE("")
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
@@ -42,6 +45,7 @@ public:
|
|||||||
class RoomListModel : public QAbstractListModel
|
class RoomListModel : public QAbstractListModel
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
QML_ELEMENT
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief The current connection that the model is getting its rooms from.
|
* @brief The current connection that the model is getting its rooms from.
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <QAbstractListModel>
|
#include <QAbstractListModel>
|
||||||
|
#include <QQmlEngine>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
|
||||||
#include <Quotient/csapi/search.h>
|
#include <Quotient/csapi/search.h>
|
||||||
@@ -23,6 +24,7 @@ class NeoChatRoom;
|
|||||||
class SearchModel : public QAbstractListModel
|
class SearchModel : public QAbstractListModel
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
QML_ELEMENT
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief The text to search messages for.
|
* @brief The text to search messages for.
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
|
|
||||||
#include <QAbstractListModel>
|
#include <QAbstractListModel>
|
||||||
#include <QPointer>
|
#include <QPointer>
|
||||||
|
#include <QQmlEngine>
|
||||||
#include <QUrl>
|
#include <QUrl>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -24,6 +25,7 @@
|
|||||||
class ServerListModel : public QAbstractListModel
|
class ServerListModel : public QAbstractListModel
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
QML_ELEMENT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <QQmlEngine>
|
||||||
#include <QSortFilterProxyModel>
|
#include <QSortFilterProxyModel>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -27,6 +28,7 @@
|
|||||||
class SortFilterRoomListModel : public QSortFilterProxyModel
|
class SortFilterRoomListModel : public QSortFilterProxyModel
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
QML_ELEMENT
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief The order by which the rooms will be sorted.
|
* @brief The order by which the rooms will be sorted.
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <QQmlEngine>
|
||||||
#include <QSortFilterProxyModel>
|
#include <QSortFilterProxyModel>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -16,6 +17,8 @@
|
|||||||
class SortFilterSpaceListModel : public QSortFilterProxyModel
|
class SortFilterSpaceListModel : public QSortFilterProxyModel
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
QML_ELEMENT
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief The number of spaces in the model.
|
* @brief The number of spaces in the model.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <QQmlEngine>
|
||||||
#include <QSortFilterProxyModel>
|
#include <QSortFilterProxyModel>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -14,6 +15,7 @@
|
|||||||
class StateFilterModel : public QSortFilterProxyModel
|
class StateFilterModel : public QSortFilterProxyModel
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
QML_ELEMENT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <QAbstractListModel>
|
#include <QAbstractListModel>
|
||||||
|
#include <QQmlEngine>
|
||||||
|
|
||||||
#include "neochatroom.h"
|
#include "neochatroom.h"
|
||||||
|
|
||||||
@@ -15,6 +16,7 @@
|
|||||||
class StateModel : public QAbstractListModel
|
class StateModel : public QAbstractListModel
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
QML_ELEMENT
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief The current room that the model is getting its state events from.
|
* @brief The current room that the model is getting its state events from.
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
#include "neochatroom.h"
|
#include "neochatroom.h"
|
||||||
#include <QAbstractListModel>
|
#include <QAbstractListModel>
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
#include <QQmlEngine>
|
||||||
#include <QVector>
|
#include <QVector>
|
||||||
|
|
||||||
class ImagePacksModel;
|
class ImagePacksModel;
|
||||||
@@ -22,6 +23,7 @@ class ImagePacksModel;
|
|||||||
class StickerModel : public QAbstractListModel
|
class StickerModel : public QAbstractListModel
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
QML_ELEMENT
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief The image pack that the stickers come from.
|
* @brief The image pack that the stickers come from.
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
|
|
||||||
#include <QAbstractListModel>
|
#include <QAbstractListModel>
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
#include <QQmlEngine>
|
||||||
|
|
||||||
#include <Quotient/csapi/users.h>
|
#include <Quotient/csapi/users.h>
|
||||||
|
|
||||||
@@ -26,6 +27,7 @@ class Connection;
|
|||||||
class UserDirectoryListModel : public QAbstractListModel
|
class UserDirectoryListModel : public QAbstractListModel
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
QML_ELEMENT
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief The current connection that the model is getting users from.
|
* @brief The current connection that the model is getting users from.
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <QQmlEngine>
|
||||||
#include <QSortFilterProxyModel>
|
#include <QSortFilterProxyModel>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -15,6 +16,7 @@
|
|||||||
class UserFilterModel : public QSortFilterProxyModel
|
class UserFilterModel : public QSortFilterProxyModel
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
QML_ELEMENT
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief This property hold the text of the filter.
|
* @brief This property hold the text of the filter.
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
#include <QAbstractListModel>
|
#include <QAbstractListModel>
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QPointer>
|
#include <QPointer>
|
||||||
|
#include <QQmlEngine>
|
||||||
|
|
||||||
class NeoChatRoom;
|
class NeoChatRoom;
|
||||||
|
|
||||||
@@ -29,6 +30,7 @@ class User;
|
|||||||
class UserListModel : public QAbstractListModel
|
class UserListModel : public QAbstractListModel
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
QML_ELEMENT
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief The room that the model is getting its users from.
|
* @brief The room that the model is getting its users from.
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
#endif
|
#endif
|
||||||
#include <KStringHandler>
|
#include <KStringHandler>
|
||||||
|
|
||||||
struct KWebShortcutModelPrivate {
|
struct WebShortcutModelPrivate {
|
||||||
QString selectedText;
|
QString selectedText;
|
||||||
#ifdef HAVE_KIO
|
#ifdef HAVE_KIO
|
||||||
KUriFilterData filterData;
|
KUriFilterData filterData;
|
||||||
@@ -18,27 +18,27 @@ struct KWebShortcutModelPrivate {
|
|||||||
QStringList searchProviders;
|
QStringList searchProviders;
|
||||||
};
|
};
|
||||||
|
|
||||||
KWebShortcutModel::KWebShortcutModel(QObject *parent)
|
WebShortcutModel::WebShortcutModel(QObject *parent)
|
||||||
: QAbstractListModel(parent)
|
: QAbstractListModel(parent)
|
||||||
, d(new KWebShortcutModelPrivate)
|
, d(new WebShortcutModelPrivate)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
KWebShortcutModel::~KWebShortcutModel()
|
WebShortcutModel::~WebShortcutModel()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
QString KWebShortcutModel::selectedText() const
|
QString WebShortcutModel::selectedText() const
|
||||||
{
|
{
|
||||||
return d->selectedText;
|
return d->selectedText;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString KWebShortcutModel::trunkatedSearchText() const
|
QString WebShortcutModel::trunkatedSearchText() const
|
||||||
{
|
{
|
||||||
return KStringHandler::rsqueeze(d->selectedText, 21);
|
return KStringHandler::rsqueeze(d->selectedText, 21);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool KWebShortcutModel::enabled() const
|
bool WebShortcutModel::enabled() const
|
||||||
{
|
{
|
||||||
#ifdef HAVE_KIO
|
#ifdef HAVE_KIO
|
||||||
return true;
|
return true;
|
||||||
@@ -47,7 +47,7 @@ bool KWebShortcutModel::enabled() const
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void KWebShortcutModel::setSelectedText(const QString &selectedText)
|
void WebShortcutModel::setSelectedText(const QString &selectedText)
|
||||||
{
|
{
|
||||||
if (d->selectedText == selectedText) {
|
if (d->selectedText == selectedText) {
|
||||||
return;
|
return;
|
||||||
@@ -80,7 +80,7 @@ void KWebShortcutModel::setSelectedText(const QString &selectedText)
|
|||||||
Q_EMIT selectedTextChanged();
|
Q_EMIT selectedTextChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
int KWebShortcutModel::rowCount(const QModelIndex &parent) const
|
int WebShortcutModel::rowCount(const QModelIndex &parent) const
|
||||||
{
|
{
|
||||||
Q_UNUSED(parent);
|
Q_UNUSED(parent);
|
||||||
#ifdef HAVE_KIO
|
#ifdef HAVE_KIO
|
||||||
@@ -91,7 +91,7 @@ int KWebShortcutModel::rowCount(const QModelIndex &parent) const
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant KWebShortcutModel::data(const QModelIndex &index, int role) const
|
QVariant WebShortcutModel::data(const QModelIndex &index, int role) const
|
||||||
{
|
{
|
||||||
if (!index.isValid()) {
|
if (!index.isValid()) {
|
||||||
return {};
|
return {};
|
||||||
@@ -110,7 +110,7 @@ QVariant KWebShortcutModel::data(const QModelIndex &index, int role) const
|
|||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
void KWebShortcutModel::trigger(const QString &data)
|
void WebShortcutModel::trigger(const QString &data)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_KIO
|
#ifdef HAVE_KIO
|
||||||
KUriFilterData filterData(data);
|
KUriFilterData filterData(data);
|
||||||
@@ -122,7 +122,7 @@ void KWebShortcutModel::trigger(const QString &data)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void KWebShortcutModel::configureWebShortcuts()
|
void WebShortcutModel::configureWebShortcuts()
|
||||||
{
|
{
|
||||||
#ifdef HAVE_KIO
|
#ifdef HAVE_KIO
|
||||||
auto job = new KIO::CommandLauncherJob(QStringLiteral("kcmshell5"), QStringList() << QStringLiteral("webshortcuts"), this);
|
auto job = new KIO::CommandLauncherJob(QStringLiteral("kcmshell5"), QStringList() << QStringLiteral("webshortcuts"), this);
|
||||||
|
|||||||
@@ -4,12 +4,13 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <QAbstractListModel>
|
#include <QAbstractListModel>
|
||||||
|
#include <QQmlEngine>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
struct KWebShortcutModelPrivate;
|
struct WebShortcutModelPrivate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class KWebShortcutModel
|
* @class WebShortcutModel
|
||||||
*
|
*
|
||||||
* This class defines the model for listing web shortcuts for a specified selectedText.
|
* 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
|
Q_OBJECT
|
||||||
|
QML_ELEMENT
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief The text to find web shortcuts for.
|
* @brief The text to find web shortcuts for.
|
||||||
@@ -64,8 +66,8 @@ class KWebShortcutModel : public QAbstractListModel
|
|||||||
*/
|
*/
|
||||||
Q_PROPERTY(bool enabled READ enabled CONSTANT)
|
Q_PROPERTY(bool enabled READ enabled CONSTANT)
|
||||||
public:
|
public:
|
||||||
explicit KWebShortcutModel(QObject *parent = nullptr);
|
explicit WebShortcutModel(QObject *parent = nullptr);
|
||||||
~KWebShortcutModel();
|
~WebShortcutModel();
|
||||||
|
|
||||||
QString selectedText() const;
|
QString selectedText() const;
|
||||||
void setSelectedText(const QString &selectedText);
|
void setSelectedText(const QString &selectedText);
|
||||||
@@ -103,5 +105,5 @@ Q_SIGNALS:
|
|||||||
void openUrl(const QUrl &url);
|
void openUrl(const QUrl &url);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::unique_ptr<KWebShortcutModelPrivate> d;
|
std::unique_ptr<WebShortcutModelPrivate> d;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -4,12 +4,15 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
#include <QQmlEngine>
|
||||||
|
|
||||||
#include <Quotient/connection.h>
|
#include <Quotient/connection.h>
|
||||||
|
|
||||||
class NeoChatConnection : public Quotient::Connection
|
class NeoChatConnection : public Quotient::Connection
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
QML_ELEMENT
|
||||||
|
QML_UNCREATABLE("")
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief The account label for this account.
|
* @brief The account label for this account.
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
|
|
||||||
#include <QCache>
|
#include <QCache>
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
#include <QQmlEngine>
|
||||||
#include <QTextCursor>
|
#include <QTextCursor>
|
||||||
|
|
||||||
#include <QCoroTask>
|
#include <QCoroTask>
|
||||||
@@ -22,6 +23,8 @@ class User;
|
|||||||
class PushNotificationState : public QObject
|
class PushNotificationState : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
QML_ELEMENT
|
||||||
|
QML_UNCREATABLE("")
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
@@ -63,6 +66,8 @@ struct Mention {
|
|||||||
class NeoChatRoom : public Quotient::Room
|
class NeoChatRoom : public Quotient::Room
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
QML_ELEMENT
|
||||||
|
QML_UNCREATABLE("")
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief A list of users currently typing in the room.
|
* @brief A list of users currently typing in the room.
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
#include <QMap>
|
#include <QMap>
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QPointer>
|
#include <QPointer>
|
||||||
|
#include <QQmlEngine>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <Quotient/csapi/notifications.h>
|
#include <Quotient/csapi/notifications.h>
|
||||||
#include <Quotient/jobs/basejob.h>
|
#include <Quotient/jobs/basejob.h>
|
||||||
@@ -19,6 +20,8 @@ class NeoChatRoom;
|
|||||||
class PushNotificationAction : public QObject
|
class PushNotificationAction : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
QML_ELEMENT
|
||||||
|
QML_UNCREATABLE("")
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
@@ -51,9 +54,15 @@ public:
|
|||||||
class NotificationsManager : public QObject
|
class NotificationsManager : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
QML_ELEMENT
|
||||||
|
QML_SINGLETON
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static NotificationsManager &instance();
|
static NotificationsManager &instance();
|
||||||
|
static NotificationsManager *create(QQmlEngine *, QJSEngine *)
|
||||||
|
{
|
||||||
|
return &instance();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Display a native notification for an message.
|
* @brief Display a native notification for an message.
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
#include <QJsonObject>
|
#include <QJsonObject>
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QPair>
|
#include <QPair>
|
||||||
|
#include <QQmlEngine>
|
||||||
|
|
||||||
class NeoChatRoom;
|
class NeoChatRoom;
|
||||||
|
|
||||||
@@ -23,6 +24,7 @@ class NeoChatRoom;
|
|||||||
class PollHandler : public QObject
|
class PollHandler : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
QML_ELEMENT
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief The current room for the poll.
|
* @brief The current room for the poll.
|
||||||
|
|||||||
@@ -212,7 +212,7 @@ FormCard.FormCardPage {
|
|||||||
FormCard.FormButtonDelegate {
|
FormCard.FormButtonDelegate {
|
||||||
id: deactivateAccountButton
|
id: deactivateAccountButton
|
||||||
text: i18n("Deactivate Account")
|
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")})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -8,7 +8,7 @@ import QtQuick.Layouts
|
|||||||
import org.kde.kirigami as Kirigami
|
import org.kde.kirigami as Kirigami
|
||||||
|
|
||||||
import org.kde.neochat
|
import org.kde.neochat
|
||||||
import '../Dialog' as Dialog
|
import org.kde.neochat.config
|
||||||
|
|
||||||
QQC2.Menu {
|
QQC2.Menu {
|
||||||
id: root
|
id: root
|
||||||
@@ -20,7 +20,7 @@ QQC2.Menu {
|
|||||||
QQC2.MenuItem {
|
QQC2.MenuItem {
|
||||||
text: i18n("Edit this account")
|
text: i18n("Edit this account")
|
||||||
icon.name: "document-edit"
|
icon.name: "document-edit"
|
||||||
onTriggered: pageStack.pushDialogLayer("qrc:/AccountEditorPage.qml", {
|
onTriggered: pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/AccountEditorPage.qml", {
|
||||||
connection: root.connection
|
connection: root.connection
|
||||||
}, {
|
}, {
|
||||||
title: i18n("Account editor")
|
title: i18n("Account editor")
|
||||||
@@ -29,7 +29,7 @@ QQC2.Menu {
|
|||||||
QQC2.MenuItem {
|
QQC2.MenuItem {
|
||||||
text: i18n("Notification settings")
|
text: i18n("Notification settings")
|
||||||
icon.name: "notifications"
|
icon.name: "notifications"
|
||||||
onTriggered: pageStack.pushDialogLayer("qrc:/SettingsPage.qml", {
|
onTriggered: pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/SettingsPage.qml", {
|
||||||
defaultPage: "notifications",
|
defaultPage: "notifications",
|
||||||
connection: root.connection,
|
connection: root.connection,
|
||||||
}, {
|
}, {
|
||||||
@@ -39,7 +39,7 @@ QQC2.Menu {
|
|||||||
QQC2.MenuItem {
|
QQC2.MenuItem {
|
||||||
text: i18n("Devices")
|
text: i18n("Devices")
|
||||||
icon.name: "computer-symbolic"
|
icon.name: "computer-symbolic"
|
||||||
onTriggered: pageStack.pushDialogLayer("qrc:/SettingsPage.qml", {
|
onTriggered: pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/SettingsPage.qml", {
|
||||||
defaultPage: "devices",
|
defaultPage: "devices",
|
||||||
connection: root.connection,
|
connection: root.connection,
|
||||||
}, {
|
}, {
|
||||||
@@ -54,7 +54,7 @@ QQC2.Menu {
|
|||||||
|
|
||||||
Component {
|
Component {
|
||||||
id: confirmLogoutDialogComponent
|
id: confirmLogoutDialogComponent
|
||||||
Dialog.ConfirmLogout {
|
ConfirmLogoutDialog {
|
||||||
connection: root.connection
|
connection: root.connection
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -12,7 +12,7 @@ import org.kde.kirigamiaddons.formcard as FormCard
|
|||||||
import org.kde.kirigamiaddons.labs.components as KirigamiComponents
|
import org.kde.kirigamiaddons.labs.components as KirigamiComponents
|
||||||
|
|
||||||
import org.kde.neochat
|
import org.kde.neochat
|
||||||
import 'Dialog' as Dialog
|
import org.kde.neochat.accounts
|
||||||
|
|
||||||
FormCard.FormCardPage {
|
FormCard.FormCardPage {
|
||||||
id: root
|
id: root
|
||||||
@@ -29,7 +29,7 @@ FormCard.FormCardPage {
|
|||||||
id: accountDelegate
|
id: accountDelegate
|
||||||
required property NeoChatConnection connection
|
required property NeoChatConnection connection
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
onClicked: pageStack.layers.push("qrc:/AccountEditorPage.qml", {
|
onClicked: pageStack.layers.push("qrc:/org/kde/neochat/qml/AccountEditorPage.qml", {
|
||||||
connection: accountDelegate.connection
|
connection: accountDelegate.connection
|
||||||
}, {
|
}, {
|
||||||
title: i18n("Account editor")
|
title: i18n("Account editor")
|
||||||
@@ -76,7 +76,7 @@ FormCard.FormCardPage {
|
|||||||
|
|
||||||
Component {
|
Component {
|
||||||
id: confirmLogoutDialogComponent
|
id: confirmLogoutDialogComponent
|
||||||
Dialog.ConfirmLogout {
|
ConfirmLogoutDialog {
|
||||||
connection: model.connection
|
connection: model.connection
|
||||||
onAccepted: {
|
onAccepted: {
|
||||||
if (AccountRegistry.accountCount === 1) {
|
if (AccountRegistry.accountCount === 1) {
|
||||||
@@ -99,7 +99,7 @@ FormCard.FormCardPage {
|
|||||||
id: addAccountDelegate
|
id: addAccountDelegate
|
||||||
text: i18n("Add Account")
|
text: i18n("Add Account")
|
||||||
icon.name: "list-add"
|
icon.name: "list-add"
|
||||||
onClicked: pageStack.layers.push("qrc:/WelcomePage.qml")
|
onClicked: pageStack.layers.push("qrc:/org/kde/neochat/qml/WelcomePage.qml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -11,6 +11,7 @@ import org.kde.kirigamiaddons.formcard as FormCard
|
|||||||
import org.kde.kirigamiaddons.labs.components as KirigamiComponents
|
import org.kde.kirigamiaddons.labs.components as KirigamiComponents
|
||||||
|
|
||||||
import org.kde.neochat
|
import org.kde.neochat
|
||||||
|
import org.kde.neochat.config
|
||||||
|
|
||||||
FormCard.FormCardPage {
|
FormCard.FormCardPage {
|
||||||
id: root
|
id: root
|
||||||
@@ -212,7 +213,7 @@ FormCard.FormCardPage {
|
|||||||
Loader {
|
Loader {
|
||||||
id: colorSchemeDelegate
|
id: colorSchemeDelegate
|
||||||
visible: item !== null && Qt.platform.os !== "android"
|
visible: item !== null && Qt.platform.os !== "android"
|
||||||
source: "qrc:/ColorScheme.qml"
|
source: "qrc:/org/kde/neochat/qml/ColorScheme.qml"
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -43,6 +43,6 @@ LoginStep {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
previousAction: Kirigami.Action {
|
previousAction: Kirigami.Action {
|
||||||
onTriggered: root.processed("qrc:/Username.qml")
|
onTriggered: root.processed("qrc:/org/kde/neochat/qml/Username.qml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -10,6 +10,7 @@ import Qt.labs.platform as Platform
|
|||||||
|
|
||||||
import org.kde.kirigami as Kirigami
|
import org.kde.kirigami as Kirigami
|
||||||
import org.kde.neochat
|
import org.kde.neochat
|
||||||
|
import org.kde.neochat.config
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief The component which handles the message sending.
|
* @brief The component which handles the message sending.
|
||||||
@@ -8,8 +8,6 @@ import org.kde.kirigami as Kirigami
|
|||||||
|
|
||||||
import org.kde.neochat
|
import org.kde.neochat
|
||||||
|
|
||||||
import "./RoomList"
|
|
||||||
|
|
||||||
Kirigami.ScrollablePage {
|
Kirigami.ScrollablePage {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
@@ -11,8 +11,7 @@ import org.kde.kirigamiaddons.labs.components as KirigamiComponents
|
|||||||
import org.kde.kitemmodels
|
import org.kde.kitemmodels
|
||||||
|
|
||||||
import org.kde.neochat
|
import org.kde.neochat
|
||||||
|
import org.kde.neochat.config
|
||||||
import './' as RoomList
|
|
||||||
|
|
||||||
QQC2.ItemDelegate {
|
QQC2.ItemDelegate {
|
||||||
id: root
|
id: root
|
||||||
@@ -7,6 +7,7 @@ import QtQuick.Layouts
|
|||||||
import org.kde.kirigamiaddons.formcard as FormCard
|
import org.kde.kirigamiaddons.formcard as FormCard
|
||||||
|
|
||||||
import org.kde.neochat
|
import org.kde.neochat
|
||||||
|
import org.kde.neochat.config
|
||||||
|
|
||||||
FormCard.FormComboBoxDelegate {
|
FormCard.FormComboBoxDelegate {
|
||||||
id: root
|
id: root
|
||||||
@@ -120,7 +120,7 @@ Loader {
|
|||||||
QQC2.MenuItem {
|
QQC2.MenuItem {
|
||||||
text: i18n("Room Settings")
|
text: i18n("Room Settings")
|
||||||
icon.name: "configure"
|
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 {}
|
QQC2.MenuSeparator {}
|
||||||
@@ -190,7 +190,7 @@ Loader {
|
|||||||
QQC2.ToolButton {
|
QQC2.ToolButton {
|
||||||
icon.name: 'settings-configure'
|
icon.name: 'settings-configure'
|
||||||
onClicked: {
|
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()
|
drawer.close()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -53,6 +53,6 @@ LoginStep {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
previousAction: Kirigami.Action {
|
previousAction: Kirigami.Action {
|
||||||
onTriggered: root.processed("qrc:/Username.qml")
|
onTriggered: root.processed("qrc:/org/kde/neochat/qml/Username.qml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -6,6 +6,7 @@ import QtQuick.Layouts
|
|||||||
|
|
||||||
import org.kde.kirigami as Kirigami
|
import org.kde.kirigami as Kirigami
|
||||||
import org.kde.neochat
|
import org.kde.neochat
|
||||||
|
import org.kde.neochat.config
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief A timeline delegate for an encrypted message that can't be decrypted.
|
* @brief A timeline delegate for an encrypted message that can't be decrypted.
|
||||||
@@ -21,7 +21,7 @@ RowLayout {
|
|||||||
text: i18n("Explore rooms")
|
text: i18n("Explore rooms")
|
||||||
icon.name: "compass"
|
icon.name: "compass"
|
||||||
onTriggered: {
|
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) => {
|
dialog.roomSelected.connect((roomId, displayName, avatarUrl, alias, topic, memberCount, isJoined) => {
|
||||||
if (isJoined) {
|
if (isJoined) {
|
||||||
RoomManager.enterRoom(root.connection.room(roomId))
|
RoomManager.enterRoom(root.connection.room(roomId))
|
||||||
@@ -34,13 +34,13 @@ RowLayout {
|
|||||||
property Kirigami.Action chatAction: Kirigami.Action {
|
property Kirigami.Action chatAction: Kirigami.Action {
|
||||||
text: i18n("Start a Chat")
|
text: i18n("Start a Chat")
|
||||||
icon.name: "list-add-user"
|
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 {
|
property Kirigami.Action roomAction: Kirigami.Action {
|
||||||
text: i18n("Create a Room")
|
text: i18n("Create a Room")
|
||||||
icon.name: "system-users"
|
icon.name: "system-users"
|
||||||
onTriggered: {
|
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
|
shortcut: StandardKey.New
|
||||||
}
|
}
|
||||||
@@ -48,7 +48,7 @@ RowLayout {
|
|||||||
text: i18n("Create a Space")
|
text: i18n("Create a Space")
|
||||||
icon.name: "list-add"
|
icon.name: "list-add"
|
||||||
onTriggered: {
|
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")})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -61,7 +61,7 @@ Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ImageParticle {
|
ImageParticle {
|
||||||
source: "qrc:/confetti.png"
|
source: "qrc:/org/kde/neochat/qml/confetti.png"
|
||||||
entryEffect: ImageParticle.Scale
|
entryEffect: ImageParticle.Scale
|
||||||
rotationVariation: 360
|
rotationVariation: 360
|
||||||
rotationVelocity: 90
|
rotationVelocity: 90
|
||||||
@@ -205,7 +205,7 @@ Item {
|
|||||||
ImageParticle {
|
ImageParticle {
|
||||||
id: fireworksParticleA
|
id: fireworksParticleA
|
||||||
system: fireworksSystem
|
system: fireworksSystem
|
||||||
source: "qrc:/glowdot.png"
|
source: "qrc:/org/kde/neochat/qml/glowdot.png"
|
||||||
alphaVariation: root.isThemeDark ? 0.1 : 0.1
|
alphaVariation: root.isThemeDark ? 0.1 : 0.1
|
||||||
alpha: root.isThemeDark ? 0.5 : 1
|
alpha: root.isThemeDark ? 0.5 : 1
|
||||||
groups: ["a"]
|
groups: ["a"]
|
||||||
@@ -216,7 +216,7 @@ Item {
|
|||||||
|
|
||||||
ImageParticle {
|
ImageParticle {
|
||||||
system: fireworksSystem
|
system: fireworksSystem
|
||||||
source: "qrc:/glowdot.png"
|
source: "qrc:/org/kde/neochat/qml/glowdot.png"
|
||||||
color: root.isThemeDark ? "white" : "gold"
|
color: root.isThemeDark ? "white" : "gold"
|
||||||
alphaVariation: root.isThemeDark ? 0.1 : 0.1
|
alphaVariation: root.isThemeDark ? 0.1 : 0.1
|
||||||
alpha: root.isThemeDark ? 0.5 : 1
|
alpha: root.isThemeDark ? 0.5 : 1
|
||||||
@@ -229,7 +229,7 @@ Item {
|
|||||||
ImageParticle {
|
ImageParticle {
|
||||||
id: fireworksParticleB
|
id: fireworksParticleB
|
||||||
system: fireworksSystem
|
system: fireworksSystem
|
||||||
source: "qrc:/glowdot.png"
|
source: "qrc:/org/kde/neochat/qml/glowdot.png"
|
||||||
alphaVariation: root.isThemeDark ? 0.1 : 0.1
|
alphaVariation: root.isThemeDark ? 0.1 : 0.1
|
||||||
alpha: root.isThemeDark ? 0.5 : 1
|
alpha: root.isThemeDark ? 0.5 : 1
|
||||||
groups: ["b"]
|
groups: ["b"]
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user