mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-26 04:58:49 +03:00
Rename image pack model
This commit is contained in:
parent
50cc0fca3b
commit
0c798554b5
6 changed files with 18 additions and 16 deletions
|
@ -354,7 +354,7 @@ set(SRC_FILES
|
||||||
src/Olm.cpp
|
src/Olm.cpp
|
||||||
src/RegisterPage.cpp
|
src/RegisterPage.cpp
|
||||||
src/SSOHandler.cpp
|
src/SSOHandler.cpp
|
||||||
src/ImagePackModel.cpp
|
src/CombinedImagePackModel.cpp
|
||||||
src/TrayIcon.cpp
|
src/TrayIcon.cpp
|
||||||
src/UserSettingsPage.cpp
|
src/UserSettingsPage.cpp
|
||||||
src/UsersModel.cpp
|
src/UsersModel.cpp
|
||||||
|
@ -558,7 +558,7 @@ qt5_wrap_cpp(MOC_HEADERS
|
||||||
src/MxcImageProvider.h
|
src/MxcImageProvider.h
|
||||||
src/RegisterPage.h
|
src/RegisterPage.h
|
||||||
src/SSOHandler.h
|
src/SSOHandler.h
|
||||||
src/ImagePackModel.h
|
src/CombinedImagePackModel.h
|
||||||
src/TrayIcon.h
|
src/TrayIcon.h
|
||||||
src/UserSettingsPage.h
|
src/UserSettingsPage.h
|
||||||
src/UsersModel.h
|
src/UsersModel.h
|
||||||
|
|
|
@ -2,12 +2,14 @@
|
||||||
//
|
//
|
||||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
#include "ImagePackModel.h"
|
#include "CombinedImagePackModel.h"
|
||||||
|
|
||||||
#include "Cache_p.h"
|
#include "Cache_p.h"
|
||||||
#include "CompletionModelRoles.h"
|
#include "CompletionModelRoles.h"
|
||||||
|
|
||||||
ImagePackModel::ImagePackModel(const std::string &roomId, bool stickers, QObject *parent)
|
CombinedImagePackModel::CombinedImagePackModel(const std::string &roomId,
|
||||||
|
bool stickers,
|
||||||
|
QObject *parent)
|
||||||
: QAbstractListModel(parent)
|
: QAbstractListModel(parent)
|
||||||
, room_id(roomId)
|
, room_id(roomId)
|
||||||
{
|
{
|
||||||
|
@ -27,13 +29,13 @@ ImagePackModel::ImagePackModel(const std::string &roomId, bool stickers, QObject
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
ImagePackModel::rowCount(const QModelIndex &) const
|
CombinedImagePackModel::rowCount(const QModelIndex &) const
|
||||||
{
|
{
|
||||||
return (int)images.size();
|
return (int)images.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
QHash<int, QByteArray>
|
QHash<int, QByteArray>
|
||||||
ImagePackModel::roleNames() const
|
CombinedImagePackModel::roleNames() const
|
||||||
{
|
{
|
||||||
return {
|
return {
|
||||||
{CompletionModel::CompletionRole, "completionRole"},
|
{CompletionModel::CompletionRole, "completionRole"},
|
||||||
|
@ -48,7 +50,7 @@ ImagePackModel::roleNames() const
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant
|
QVariant
|
||||||
ImagePackModel::data(const QModelIndex &index, int role) const
|
CombinedImagePackModel::data(const QModelIndex &index, int role) const
|
||||||
{
|
{
|
||||||
if (hasIndex(index.row(), index.column(), index.parent())) {
|
if (hasIndex(index.row(), index.column(), index.parent())) {
|
||||||
switch (role) {
|
switch (role) {
|
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
#include <mtx/events/mscs/image_packs.hpp>
|
#include <mtx/events/mscs/image_packs.hpp>
|
||||||
|
|
||||||
class ImagePackModel : public QAbstractListModel
|
class CombinedImagePackModel : public QAbstractListModel
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
|
@ -21,7 +21,7 @@ public:
|
||||||
OriginalRow,
|
OriginalRow,
|
||||||
};
|
};
|
||||||
|
|
||||||
ImagePackModel(const std::string &roomId, bool stickers, QObject *parent = nullptr);
|
CombinedImagePackModel(const std::string &roomId, bool stickers, QObject *parent = nullptr);
|
||||||
QHash<int, QByteArray> roleNames() const override;
|
QHash<int, QByteArray> roleNames() const override;
|
||||||
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
|
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||||
QVariant data(const QModelIndex &index, int role) const override;
|
QVariant data(const QModelIndex &index, int role) const override;
|
|
@ -19,9 +19,9 @@
|
||||||
|
|
||||||
#include "Cache.h"
|
#include "Cache.h"
|
||||||
#include "ChatPage.h"
|
#include "ChatPage.h"
|
||||||
|
#include "CombinedImagePackModel.h"
|
||||||
#include "CompletionProxyModel.h"
|
#include "CompletionProxyModel.h"
|
||||||
#include "Config.h"
|
#include "Config.h"
|
||||||
#include "ImagePackModel.h"
|
|
||||||
#include "Logging.h"
|
#include "Logging.h"
|
||||||
#include "MainWindow.h"
|
#include "MainWindow.h"
|
||||||
#include "MatrixClient.h"
|
#include "MatrixClient.h"
|
||||||
|
@ -503,7 +503,7 @@ InputBar::video(const QString &filename,
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
InputBar::sticker(ImagePackModel *model, int row)
|
InputBar::sticker(CombinedImagePackModel *model, int row)
|
||||||
{
|
{
|
||||||
if (!model || row < 0)
|
if (!model || row < 0)
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
#include <mtx/responses/messages.hpp>
|
#include <mtx/responses/messages.hpp>
|
||||||
|
|
||||||
class TimelineModel;
|
class TimelineModel;
|
||||||
class ImagePackModel;
|
class CombinedImagePackModel;
|
||||||
class QMimeData;
|
class QMimeData;
|
||||||
class QDropEvent;
|
class QDropEvent;
|
||||||
class QStringList;
|
class QStringList;
|
||||||
|
@ -58,7 +58,7 @@ public slots:
|
||||||
MarkdownOverride useMarkdown = MarkdownOverride::NOT_SPECIFIED,
|
MarkdownOverride useMarkdown = MarkdownOverride::NOT_SPECIFIED,
|
||||||
bool rainbowify = false);
|
bool rainbowify = false);
|
||||||
void reaction(const QString &reactedEvent, const QString &reactionKey);
|
void reaction(const QString &reactedEvent, const QString &reactionKey);
|
||||||
void sticker(ImagePackModel *model, int row);
|
void sticker(CombinedImagePackModel *model, int row);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void startTyping();
|
void startTyping();
|
||||||
|
|
|
@ -15,11 +15,11 @@
|
||||||
#include "ChatPage.h"
|
#include "ChatPage.h"
|
||||||
#include "Clipboard.h"
|
#include "Clipboard.h"
|
||||||
#include "ColorImageProvider.h"
|
#include "ColorImageProvider.h"
|
||||||
|
#include "CombinedImagePackModel.h"
|
||||||
#include "CompletionProxyModel.h"
|
#include "CompletionProxyModel.h"
|
||||||
#include "DelegateChooser.h"
|
#include "DelegateChooser.h"
|
||||||
#include "DeviceVerificationFlow.h"
|
#include "DeviceVerificationFlow.h"
|
||||||
#include "EventAccessors.h"
|
#include "EventAccessors.h"
|
||||||
#include "ImagePackModel.h"
|
|
||||||
#include "InviteesModel.h"
|
#include "InviteesModel.h"
|
||||||
#include "Logging.h"
|
#include "Logging.h"
|
||||||
#include "MainWindow.h"
|
#include "MainWindow.h"
|
||||||
|
@ -146,7 +146,7 @@ TimelineViewManager::TimelineViewManager(CallManager *callManager, ChatPage *par
|
||||||
qRegisterMetaType<mtx::events::msg::KeyVerificationReady>();
|
qRegisterMetaType<mtx::events::msg::KeyVerificationReady>();
|
||||||
qRegisterMetaType<mtx::events::msg::KeyVerificationRequest>();
|
qRegisterMetaType<mtx::events::msg::KeyVerificationRequest>();
|
||||||
qRegisterMetaType<mtx::events::msg::KeyVerificationStart>();
|
qRegisterMetaType<mtx::events::msg::KeyVerificationStart>();
|
||||||
qRegisterMetaType<ImagePackModel *>();
|
qRegisterMetaType<CombinedImagePackModel *>();
|
||||||
|
|
||||||
qmlRegisterUncreatableMetaObject(qml_mtx_events::staticMetaObject,
|
qmlRegisterUncreatableMetaObject(qml_mtx_events::staticMetaObject,
|
||||||
"im.nheko",
|
"im.nheko",
|
||||||
|
@ -622,7 +622,7 @@ TimelineViewManager::completerFor(QString completerName, QString roomId)
|
||||||
roomModel->setParent(proxy);
|
roomModel->setParent(proxy);
|
||||||
return proxy;
|
return proxy;
|
||||||
} else if (completerName == "stickers") {
|
} else if (completerName == "stickers") {
|
||||||
auto stickerModel = new ImagePackModel(roomId.toStdString(), true);
|
auto stickerModel = new CombinedImagePackModel(roomId.toStdString(), true);
|
||||||
auto proxy = new CompletionProxyModel(stickerModel, 1, static_cast<size_t>(-1) / 4);
|
auto proxy = new CompletionProxyModel(stickerModel, 1, static_cast<size_t>(-1) / 4);
|
||||||
stickerModel->setParent(proxy);
|
stickerModel->setParent(proxy);
|
||||||
return proxy;
|
return proxy;
|
||||||
|
|
Loading…
Reference in a new issue