mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-22 11:00:48 +03:00
Group emoji and dialogs with namespaces
This commit is contained in:
parent
32c8340577
commit
eae069ad93
31 changed files with 200 additions and 179 deletions
|
@ -141,17 +141,17 @@ endif()
|
|||
#
|
||||
set(SRC_FILES
|
||||
# Dialogs
|
||||
src/dialogs/ImageOverlayDialog.cc
|
||||
src/dialogs/JoinRoomDialog.cc
|
||||
src/dialogs/LeaveRoomDialog.cc
|
||||
src/dialogs/LogoutDialog.cc
|
||||
src/dialogs/ImageOverlay.cc
|
||||
src/dialogs/JoinRoom.cc
|
||||
src/dialogs/LeaveRoom.cc
|
||||
src/dialogs/Logout.cc
|
||||
|
||||
# Emoji
|
||||
src/emoji/EmojiCategory.cc
|
||||
src/emoji/EmojiItemDelegate.cc
|
||||
src/emoji/EmojiPanel.cc
|
||||
src/emoji/EmojiPickButton.cc
|
||||
src/emoji/EmojiProvider.cc
|
||||
src/emoji/Category.cc
|
||||
src/emoji/ItemDelegate.cc
|
||||
src/emoji/Panel.cc
|
||||
src/emoji/PickButton.cc
|
||||
src/emoji/Provider.cc
|
||||
|
||||
# Timeline
|
||||
src/timeline/TimelineViewManager.cc
|
||||
|
@ -245,17 +245,16 @@ include_directories(${LMDB_INCLUDE_DIR})
|
|||
|
||||
qt5_wrap_cpp(MOC_HEADERS
|
||||
# Dialogs
|
||||
include/dialogs/ImageOverlayDialog.h
|
||||
include/dialogs/JoinRoomDialog.h
|
||||
include/dialogs/LeaveRoomDialog.h
|
||||
include/dialogs/LogoutDialog.h
|
||||
include/dialogs/ImageOverlay.h
|
||||
include/dialogs/JoinRoom.h
|
||||
include/dialogs/LeaveRoom.h
|
||||
include/dialogs/Logout.h
|
||||
|
||||
# Emoji
|
||||
include/emoji/EmojiCategory.h
|
||||
include/emoji/EmojiItemDelegate.h
|
||||
include/emoji/EmojiPanel.h
|
||||
include/emoji/EmojiPickButton.h
|
||||
include/emoji/EmojiProvider.h
|
||||
include/emoji/Category.h
|
||||
include/emoji/ItemDelegate.h
|
||||
include/emoji/Panel.h
|
||||
include/emoji/PickButton.h
|
||||
|
||||
# Timeline
|
||||
include/timeline/TimelineItem.h
|
||||
|
|
|
@ -24,7 +24,8 @@
|
|||
#include <QVBoxLayout>
|
||||
#include <QWidget>
|
||||
|
||||
class JoinRoomDialog;
|
||||
#include "dialogs/LeaveRoom.h"
|
||||
|
||||
class LeaveRoomDialog;
|
||||
class MatrixClient;
|
||||
class OverlayModal;
|
||||
|
@ -82,10 +83,9 @@ private:
|
|||
QPushButton *joinRoomButton_;
|
||||
|
||||
OverlayModal *joinRoomModal_;
|
||||
JoinRoomDialog *joinRoomDialog_;
|
||||
|
||||
QSharedPointer<OverlayModal> leaveRoomModal_;
|
||||
QSharedPointer<LeaveRoomDialog> leaveRoomDialog_;
|
||||
QSharedPointer<dialogs::LeaveRoom> leaveRoomDialog_;
|
||||
|
||||
QMap<QString, QSharedPointer<RoomInfoListItem>> rooms_;
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
#include "Image.h"
|
||||
#include "LoadingIndicator.h"
|
||||
|
||||
#include "emoji/EmojiPickButton.h"
|
||||
#include "emoji/PickButton.h"
|
||||
|
||||
namespace msgs = matrix::events::messages;
|
||||
|
||||
|
@ -107,5 +107,5 @@ private:
|
|||
|
||||
FlatButton *sendFileBtn_;
|
||||
FlatButton *sendMessageBtn_;
|
||||
EmojiPickButton *emojiBtn_;
|
||||
emoji::PickButton *emojiBtn_;
|
||||
};
|
||||
|
|
|
@ -26,10 +26,11 @@
|
|||
#include <QSharedPointer>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
#include "dialogs/LeaveRoom.h"
|
||||
|
||||
class Avatar;
|
||||
class FlatButton;
|
||||
class Label;
|
||||
class LeaveRoomDialog;
|
||||
class Menu;
|
||||
class OverlayModal;
|
||||
class RoomSettings;
|
||||
|
@ -79,7 +80,7 @@ private:
|
|||
FlatButton *settingsBtn_;
|
||||
|
||||
QSharedPointer<OverlayModal> leaveRoomModal_;
|
||||
QSharedPointer<LeaveRoomDialog> leaveRoomDialog_;
|
||||
QSharedPointer<dialogs::LeaveRoom> leaveRoomDialog_;
|
||||
|
||||
Avatar *avatar_;
|
||||
|
||||
|
|
|
@ -20,9 +20,10 @@
|
|||
#include <QLabel>
|
||||
#include <QLayout>
|
||||
|
||||
#include "dialogs/Logout.h"
|
||||
|
||||
class Avatar;
|
||||
class FlatButton;
|
||||
class LogoutDialog;
|
||||
class OverlayModal;
|
||||
|
||||
class UserInfoWidget : public QWidget
|
||||
|
@ -68,7 +69,7 @@ private:
|
|||
QImage avatar_image_;
|
||||
|
||||
QSharedPointer<OverlayModal> logoutModal_;
|
||||
QSharedPointer<LogoutDialog> logoutDialog_;
|
||||
QSharedPointer<dialogs::Logout> logoutDialog_;
|
||||
|
||||
int logoutButtonSize_;
|
||||
};
|
||||
|
|
|
@ -21,11 +21,13 @@
|
|||
#include <QMouseEvent>
|
||||
#include <QPixmap>
|
||||
|
||||
class ImageOverlayDialog : public QWidget
|
||||
namespace dialogs {
|
||||
|
||||
class ImageOverlay : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
ImageOverlayDialog(QPixmap image, QWidget *parent = nullptr);
|
||||
ImageOverlay(QPixmap image, QWidget *parent = nullptr);
|
||||
|
||||
protected:
|
||||
void mousePressEvent(QMouseEvent *event) override;
|
||||
|
@ -44,3 +46,4 @@ private:
|
|||
QRect close_button_;
|
||||
QRect screen_;
|
||||
};
|
||||
} // dialogs
|
|
@ -5,11 +5,13 @@
|
|||
|
||||
class FlatButton;
|
||||
|
||||
class JoinRoomDialog : public QFrame
|
||||
namespace dialogs {
|
||||
|
||||
class JoinRoom : public QFrame
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
JoinRoomDialog(QWidget *parent = nullptr);
|
||||
JoinRoom(QWidget *parent = nullptr);
|
||||
|
||||
signals:
|
||||
void closing(bool isJoining, QString roomAlias);
|
||||
|
@ -20,3 +22,5 @@ private:
|
|||
|
||||
QLineEdit *roomAliasEdit_;
|
||||
};
|
||||
|
||||
} // dialogs
|
|
@ -4,11 +4,13 @@
|
|||
|
||||
class FlatButton;
|
||||
|
||||
class LeaveRoomDialog : public QFrame
|
||||
namespace dialogs {
|
||||
|
||||
class LeaveRoom : public QFrame
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit LeaveRoomDialog(QWidget *parent = nullptr);
|
||||
explicit LeaveRoom(QWidget *parent = nullptr);
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *event) override;
|
||||
|
@ -20,3 +22,4 @@ private:
|
|||
FlatButton *confirmBtn_;
|
||||
FlatButton *cancelBtn_;
|
||||
};
|
||||
} // dialogs
|
|
@ -21,11 +21,13 @@
|
|||
|
||||
class FlatButton;
|
||||
|
||||
class LogoutDialog : public QFrame
|
||||
namespace dialogs {
|
||||
|
||||
class Logout : public QFrame
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit LogoutDialog(QWidget *parent = nullptr);
|
||||
explicit Logout(QWidget *parent = nullptr);
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *event) override;
|
||||
|
@ -37,3 +39,4 @@ private:
|
|||
FlatButton *confirmBtn_;
|
||||
FlatButton *cancelBtn_;
|
||||
};
|
||||
} // dialogs
|
|
@ -22,17 +22,17 @@
|
|||
#include <QListView>
|
||||
#include <QStandardItemModel>
|
||||
|
||||
#include "EmojiItemDelegate.h"
|
||||
#include "ItemDelegate.h"
|
||||
|
||||
class EmojiProvider;
|
||||
namespace emoji {
|
||||
|
||||
class EmojiCategory : public QWidget
|
||||
class Category : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
EmojiCategory(QString category, QList<Emoji> emoji, QWidget *parent = nullptr);
|
||||
~EmojiCategory();
|
||||
Category(QString category, QList<Emoji> emoji, QWidget *parent = nullptr);
|
||||
~Category();
|
||||
|
||||
signals:
|
||||
void emojiSelected(const QString &emoji);
|
||||
|
@ -52,8 +52,9 @@ private:
|
|||
QStandardItemModel *itemModel_;
|
||||
QListView *emojiListView_;
|
||||
|
||||
Emoji *data_;
|
||||
EmojiItemDelegate *delegate_;
|
||||
emoji::Emoji *data_;
|
||||
emoji::ItemDelegate *delegate_;
|
||||
|
||||
QLabel *category_;
|
||||
};
|
||||
} // namespace emoji
|
|
@ -21,15 +21,17 @@
|
|||
#include <QStandardItemModel>
|
||||
#include <QStyledItemDelegate>
|
||||
|
||||
#include "EmojiProvider.h"
|
||||
#include "Provider.h"
|
||||
|
||||
class EmojiItemDelegate : public QStyledItemDelegate
|
||||
namespace emoji {
|
||||
|
||||
class ItemDelegate : public QStyledItemDelegate
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit EmojiItemDelegate(QObject *parent = nullptr);
|
||||
~EmojiItemDelegate();
|
||||
explicit ItemDelegate(QObject *parent = nullptr);
|
||||
~ItemDelegate();
|
||||
|
||||
void paint(QPainter *painter,
|
||||
const QStyleOptionViewItem &option,
|
||||
|
@ -38,3 +40,4 @@ public:
|
|||
private:
|
||||
Emoji *data_;
|
||||
};
|
||||
} // namespace emoji
|
|
@ -19,16 +19,18 @@
|
|||
|
||||
#include <QScrollArea>
|
||||
|
||||
#include "EmojiProvider.h"
|
||||
#include "Provider.h"
|
||||
|
||||
class EmojiCategory;
|
||||
namespace emoji {
|
||||
|
||||
class EmojiPanel : public QWidget
|
||||
class Category;
|
||||
|
||||
class Panel : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
EmojiPanel(QWidget *parent = nullptr);
|
||||
Panel(QWidget *parent = nullptr);
|
||||
|
||||
signals:
|
||||
void mouseLeft();
|
||||
|
@ -39,9 +41,9 @@ protected:
|
|||
void paintEvent(QPaintEvent *event);
|
||||
|
||||
private:
|
||||
void showEmojiCategory(const EmojiCategory *category);
|
||||
void showCategory(const Category *category);
|
||||
|
||||
EmojiProvider emoji_provider_;
|
||||
Provider emoji_provider_;
|
||||
|
||||
QScrollArea *scrollArea_;
|
||||
|
||||
|
@ -53,3 +55,4 @@ private:
|
|||
|
||||
int categoryIconSize_;
|
||||
};
|
||||
} // namespace emoji
|
|
@ -22,13 +22,15 @@
|
|||
|
||||
#include "FlatButton.h"
|
||||
|
||||
class EmojiPanel;
|
||||
namespace emoji {
|
||||
|
||||
class EmojiPickButton : public FlatButton
|
||||
class Panel;
|
||||
|
||||
class PickButton : public FlatButton
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit EmojiPickButton(QWidget *parent = nullptr);
|
||||
explicit PickButton(QWidget *parent = nullptr);
|
||||
|
||||
signals:
|
||||
void emojiSelected(const QString &emoji);
|
||||
|
@ -44,5 +46,6 @@ private:
|
|||
// Horizontal distance from panel's bottom right corner.
|
||||
int horizontal_distance_ = 70;
|
||||
|
||||
QSharedPointer<EmojiPanel> panel_;
|
||||
QSharedPointer<Panel> panel_;
|
||||
};
|
||||
} // namespace emoji
|
|
@ -19,6 +19,8 @@
|
|||
|
||||
#include <QList>
|
||||
|
||||
namespace emoji {
|
||||
|
||||
struct Emoji
|
||||
{
|
||||
// Unicode code.
|
||||
|
@ -27,7 +29,7 @@ struct Emoji
|
|||
QString shortname;
|
||||
};
|
||||
|
||||
class EmojiProvider
|
||||
class Provider
|
||||
{
|
||||
public:
|
||||
static const QList<Emoji> people;
|
||||
|
@ -39,3 +41,4 @@ public:
|
|||
static const QList<Emoji> symbols;
|
||||
static const QList<Emoji> flags;
|
||||
};
|
||||
} // namespace emoji
|
|
@ -71,8 +71,8 @@ Avatar {
|
|||
color: #f2f2f2;
|
||||
}
|
||||
|
||||
LogoutDialog,
|
||||
LeaveRoomDialog {
|
||||
dialogs--Logout,
|
||||
dialogs--LeaveRoom {
|
||||
background-color: #383c4a;
|
||||
color: #caccd1;
|
||||
}
|
||||
|
@ -84,14 +84,14 @@ RegisterPage {
|
|||
color: #caccd1;
|
||||
}
|
||||
|
||||
EmojiPanel,
|
||||
EmojiPanel > * {
|
||||
background-color: #383c4a;
|
||||
emoji--Panel,
|
||||
emoji--Panel > * {
|
||||
background-color: #313440;
|
||||
color: #caccd1;
|
||||
}
|
||||
|
||||
EmojiCategory,
|
||||
EmojiCategory > * {
|
||||
emoji--Category,
|
||||
emoji--Category > * {
|
||||
background-color: #383c4a;
|
||||
color: #caccd1;
|
||||
}
|
||||
|
|
|
@ -73,39 +73,27 @@ Avatar {
|
|||
color: #555459;
|
||||
}
|
||||
|
||||
LogoutDialog {
|
||||
background-color: white;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
LeaveRoomDialog {
|
||||
background-color: white;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
WelcomePage {
|
||||
background-color: white;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
LoginPage {
|
||||
dialogs--Logout,
|
||||
dialogs--LeaveRoom {
|
||||
background-color: white;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
WelcomePage,
|
||||
LoginPage,
|
||||
RegisterPage {
|
||||
background-color: white;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
EmojiPanel,
|
||||
EmojiPanel > * {
|
||||
background-color: white;
|
||||
emoji--Panel,
|
||||
emoji--Panel > * {
|
||||
background-color: #eee;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
EmojiCategory,
|
||||
EmojiCategory > * {
|
||||
emoji--Category,
|
||||
emoji--Category > * {
|
||||
background-color: white;
|
||||
color: #ccc;
|
||||
}
|
||||
|
|
|
@ -64,13 +64,13 @@ UserInfoWidget > * {
|
|||
background-color: palette(window);
|
||||
}
|
||||
|
||||
EmojiCategory,
|
||||
EmojiCategory > * {
|
||||
emoji--Category,
|
||||
emoji--Category > * {
|
||||
background-color: palette(window);
|
||||
}
|
||||
|
||||
EmojiPanel,
|
||||
EmojiPanel > * {
|
||||
emoji--Panel,
|
||||
emoji--Panel > * {
|
||||
background-color: palette(window);
|
||||
}
|
||||
|
||||
|
|
|
@ -18,9 +18,6 @@
|
|||
#include <QDebug>
|
||||
#include <QObject>
|
||||
|
||||
#include "dialogs/JoinRoomDialog.h"
|
||||
#include "dialogs/LeaveRoomDialog.h"
|
||||
|
||||
#include "MainWindow.h"
|
||||
#include "MatrixClient.h"
|
||||
#include "OverlayModal.h"
|
||||
|
@ -159,10 +156,10 @@ void
|
|||
RoomList::openLeaveRoomDialog(const QString &room_id)
|
||||
{
|
||||
if (leaveRoomDialog_.isNull()) {
|
||||
leaveRoomDialog_ = QSharedPointer<LeaveRoomDialog>(new LeaveRoomDialog(this));
|
||||
leaveRoomDialog_ = QSharedPointer<dialogs::LeaveRoom>(new dialogs::LeaveRoom(this));
|
||||
|
||||
connect(leaveRoomDialog_.data(),
|
||||
&LeaveRoomDialog::closing,
|
||||
&dialogs::LeaveRoom::closing,
|
||||
this,
|
||||
[=](bool leaving) { closeLeaveRoomDialog(leaving, room_id); });
|
||||
}
|
||||
|
|
|
@ -211,7 +211,7 @@ TextInputWidget::TextInputWidget(QWidget *parent)
|
|||
sendMessageBtn_->setIcon(send_message_icon);
|
||||
sendMessageBtn_->setIconSize(QSize(24, 24));
|
||||
|
||||
emojiBtn_ = new EmojiPickButton(this);
|
||||
emojiBtn_ = new emoji::PickButton(this);
|
||||
|
||||
QIcon emoji_icon;
|
||||
emoji_icon.addFile(":/icons/icons/ui/smile.png");
|
||||
|
|
|
@ -27,8 +27,6 @@
|
|||
#include "RoomSettings.h"
|
||||
#include "TopRoomBar.h"
|
||||
|
||||
#include "dialogs/LeaveRoomDialog.h"
|
||||
|
||||
TopRoomBar::TopRoomBar(QWidget *parent)
|
||||
: QWidget(parent)
|
||||
, buttonSize_{32}
|
||||
|
@ -94,7 +92,7 @@ TopRoomBar::TopRoomBar(QWidget *parent)
|
|||
connect(leaveRoom_, &QAction::triggered, this, [=]() {
|
||||
if (leaveRoomDialog_.isNull()) {
|
||||
leaveRoomDialog_ =
|
||||
QSharedPointer<LeaveRoomDialog>(new LeaveRoomDialog(this));
|
||||
QSharedPointer<dialogs::LeaveRoom>(new dialogs::LeaveRoom(this));
|
||||
|
||||
connect(leaveRoomDialog_.data(),
|
||||
SIGNAL(closing(bool)),
|
||||
|
|
|
@ -24,8 +24,6 @@
|
|||
#include "OverlayModal.h"
|
||||
#include "UserInfoWidget.h"
|
||||
|
||||
#include "dialogs/LogoutDialog.h"
|
||||
|
||||
UserInfoWidget::UserInfoWidget(QWidget *parent)
|
||||
: QWidget(parent)
|
||||
, display_name_("User")
|
||||
|
@ -94,7 +92,7 @@ UserInfoWidget::UserInfoWidget(QWidget *parent)
|
|||
// Show the confirmation dialog.
|
||||
connect(logoutButton_, &QPushButton::clicked, this, [=]() {
|
||||
if (logoutDialog_.isNull()) {
|
||||
logoutDialog_ = QSharedPointer<LogoutDialog>(new LogoutDialog(this));
|
||||
logoutDialog_ = QSharedPointer<dialogs::Logout>(new dialogs::Logout(this));
|
||||
connect(logoutDialog_.data(),
|
||||
SIGNAL(closing(bool)),
|
||||
this,
|
||||
|
|
|
@ -19,9 +19,11 @@
|
|||
#include <QDesktopWidget>
|
||||
#include <QPainter>
|
||||
|
||||
#include "dialogs/ImageOverlayDialog.h"
|
||||
#include "dialogs/ImageOverlay.h"
|
||||
|
||||
ImageOverlayDialog::ImageOverlayDialog(QPixmap image, QWidget *parent)
|
||||
using namespace dialogs;
|
||||
|
||||
ImageOverlay::ImageOverlay(QPixmap image, QWidget *parent)
|
||||
: QWidget{parent}
|
||||
, originalImage_{image}
|
||||
{
|
||||
|
@ -47,7 +49,7 @@ ImageOverlayDialog::ImageOverlayDialog(QPixmap image, QWidget *parent)
|
|||
|
||||
// TODO: Move this into Utils
|
||||
void
|
||||
ImageOverlayDialog::scaleImage(int max_width, int max_height)
|
||||
ImageOverlay::scaleImage(int max_width, int max_height)
|
||||
{
|
||||
if (originalImage_.isNull())
|
||||
return;
|
||||
|
@ -73,7 +75,7 @@ ImageOverlayDialog::scaleImage(int max_width, int max_height)
|
|||
}
|
||||
|
||||
void
|
||||
ImageOverlayDialog::paintEvent(QPaintEvent *event)
|
||||
ImageOverlay::paintEvent(QPaintEvent *event)
|
||||
{
|
||||
Q_UNUSED(event);
|
||||
|
||||
|
@ -117,7 +119,7 @@ ImageOverlayDialog::paintEvent(QPaintEvent *event)
|
|||
}
|
||||
|
||||
void
|
||||
ImageOverlayDialog::mousePressEvent(QMouseEvent *event)
|
||||
ImageOverlay::mousePressEvent(QMouseEvent *event)
|
||||
{
|
||||
if (event->button() != Qt::LeftButton)
|
||||
return;
|
|
@ -5,9 +5,11 @@
|
|||
#include "FlatButton.h"
|
||||
#include "Theme.h"
|
||||
|
||||
#include "dialogs/JoinRoomDialog.h"
|
||||
#include "dialogs/JoinRoom.h"
|
||||
|
||||
JoinRoomDialog::JoinRoomDialog(QWidget *parent)
|
||||
using namespace dialogs;
|
||||
|
||||
JoinRoom::JoinRoom(QWidget *parent)
|
||||
: QFrame(parent)
|
||||
{
|
||||
setMaximumSize(400, 400);
|
|
@ -6,9 +6,11 @@
|
|||
#include "FlatButton.h"
|
||||
#include "Theme.h"
|
||||
|
||||
#include "dialogs/LeaveRoomDialog.h"
|
||||
#include "dialogs/LeaveRoom.h"
|
||||
|
||||
LeaveRoomDialog::LeaveRoomDialog(QWidget *parent)
|
||||
using namespace dialogs;
|
||||
|
||||
LeaveRoom::LeaveRoom(QWidget *parent)
|
||||
: QFrame(parent)
|
||||
{
|
||||
setMaximumSize(400, 400);
|
||||
|
@ -45,7 +47,7 @@ LeaveRoomDialog::LeaveRoomDialog(QWidget *parent)
|
|||
}
|
||||
|
||||
void
|
||||
LeaveRoomDialog::paintEvent(QPaintEvent *)
|
||||
LeaveRoom::paintEvent(QPaintEvent *)
|
||||
{
|
||||
QStyleOption opt;
|
||||
opt.init(this);
|
|
@ -24,9 +24,11 @@
|
|||
#include "FlatButton.h"
|
||||
#include "Theme.h"
|
||||
|
||||
#include "dialogs/LogoutDialog.h"
|
||||
#include "dialogs/Logout.h"
|
||||
|
||||
LogoutDialog::LogoutDialog(QWidget *parent)
|
||||
using namespace dialogs;
|
||||
|
||||
Logout::Logout(QWidget *parent)
|
||||
: QFrame(parent)
|
||||
{
|
||||
setMaximumSize(400, 400);
|
||||
|
@ -63,7 +65,7 @@ LogoutDialog::LogoutDialog(QWidget *parent)
|
|||
}
|
||||
|
||||
void
|
||||
LogoutDialog::paintEvent(QPaintEvent *)
|
||||
Logout::paintEvent(QPaintEvent *)
|
||||
{
|
||||
QStyleOption opt;
|
||||
opt.init(this);
|
|
@ -21,9 +21,11 @@
|
|||
|
||||
#include "Config.h"
|
||||
|
||||
#include "emoji/EmojiCategory.h"
|
||||
#include "emoji/Category.h"
|
||||
|
||||
EmojiCategory::EmojiCategory(QString category, QList<Emoji> emoji, QWidget *parent)
|
||||
using namespace emoji;
|
||||
|
||||
Category::Category(QString category, QList<Emoji> emoji, QWidget *parent)
|
||||
: QWidget(parent)
|
||||
{
|
||||
mainLayout_ = new QVBoxLayout(this);
|
||||
|
@ -33,7 +35,7 @@ EmojiCategory::EmojiCategory(QString category, QList<Emoji> emoji, QWidget *pare
|
|||
emojiListView_ = new QListView();
|
||||
itemModel_ = new QStandardItemModel(this);
|
||||
|
||||
delegate_ = new EmojiItemDelegate(this);
|
||||
delegate_ = new ItemDelegate(this);
|
||||
data_ = new Emoji;
|
||||
|
||||
emojiListView_->setItemDelegate(delegate_);
|
||||
|
@ -75,11 +77,11 @@ EmojiCategory::EmojiCategory(QString category, QList<Emoji> emoji, QWidget *pare
|
|||
mainLayout_->addWidget(category_);
|
||||
mainLayout_->addWidget(emojiListView_);
|
||||
|
||||
connect(emojiListView_, &QListView::clicked, this, &EmojiCategory::clickIndex);
|
||||
connect(emojiListView_, &QListView::clicked, this, &Category::clickIndex);
|
||||
}
|
||||
|
||||
void
|
||||
EmojiCategory::paintEvent(QPaintEvent *)
|
||||
Category::paintEvent(QPaintEvent *)
|
||||
{
|
||||
QStyleOption opt;
|
||||
opt.init(this);
|
||||
|
@ -87,4 +89,4 @@ EmojiCategory::paintEvent(QPaintEvent *)
|
|||
style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);
|
||||
}
|
||||
|
||||
EmojiCategory::~EmojiCategory() {}
|
||||
Category::~Category() {}
|
|
@ -18,20 +18,22 @@
|
|||
#include <QDebug>
|
||||
#include <QPainter>
|
||||
|
||||
#include "emoji/EmojiItemDelegate.h"
|
||||
#include "emoji/ItemDelegate.h"
|
||||
|
||||
EmojiItemDelegate::EmojiItemDelegate(QObject *parent)
|
||||
using namespace emoji;
|
||||
|
||||
ItemDelegate::ItemDelegate(QObject *parent)
|
||||
: QStyledItemDelegate(parent)
|
||||
{
|
||||
data_ = new Emoji;
|
||||
}
|
||||
|
||||
EmojiItemDelegate::~EmojiItemDelegate() { delete data_; }
|
||||
ItemDelegate::~ItemDelegate() { delete data_; }
|
||||
|
||||
void
|
||||
EmojiItemDelegate::paint(QPainter *painter,
|
||||
const QStyleOptionViewItem &option,
|
||||
const QModelIndex &index) const
|
||||
ItemDelegate::paint(QPainter *painter,
|
||||
const QStyleOptionViewItem &option,
|
||||
const QModelIndex &index) const
|
||||
{
|
||||
Q_UNUSED(index);
|
||||
|
|
@ -22,10 +22,12 @@
|
|||
#include "DropShadow.h"
|
||||
#include "FlatButton.h"
|
||||
|
||||
#include "emoji/EmojiCategory.h"
|
||||
#include "emoji/EmojiPanel.h"
|
||||
#include "emoji/Category.h"
|
||||
#include "emoji/Panel.h"
|
||||
|
||||
EmojiPanel::EmojiPanel(QWidget *parent)
|
||||
using namespace emoji;
|
||||
|
||||
Panel::Panel(QWidget *parent)
|
||||
: QWidget(parent)
|
||||
, shadowMargin_{2}
|
||||
, width_{370}
|
||||
|
@ -53,9 +55,6 @@ EmojiPanel::EmojiPanel(QWidget *parent)
|
|||
contentLayout->setSpacing(0);
|
||||
|
||||
auto emojiCategories = new QFrame(mainWidget);
|
||||
emojiCategories->setStyleSheet(
|
||||
QString("background-color: %1")
|
||||
.arg(palette().color(QPalette::Window).darker(110).name()));
|
||||
|
||||
auto categoriesLayout = new QHBoxLayout(emojiCategories);
|
||||
categoriesLayout->setSpacing(0);
|
||||
|
@ -124,79 +123,78 @@ EmojiPanel::EmojiPanel(QWidget *parent)
|
|||
scrollArea_->setWidget(scrollWidget);
|
||||
|
||||
auto peopleEmoji =
|
||||
new EmojiCategory(tr("Smileys & People"), emoji_provider_.people, scrollWidget);
|
||||
new Category(tr("Smileys & People"), emoji_provider_.people, scrollWidget);
|
||||
scrollLayout->addWidget(peopleEmoji);
|
||||
|
||||
auto natureEmoji =
|
||||
new EmojiCategory(tr("Animals & Nature"), emoji_provider_.nature, scrollWidget);
|
||||
new Category(tr("Animals & Nature"), emoji_provider_.nature, scrollWidget);
|
||||
scrollLayout->addWidget(natureEmoji);
|
||||
|
||||
auto foodEmoji = new EmojiCategory(tr("Food & Drink"), emoji_provider_.food, scrollWidget);
|
||||
auto foodEmoji = new Category(tr("Food & Drink"), emoji_provider_.food, scrollWidget);
|
||||
scrollLayout->addWidget(foodEmoji);
|
||||
|
||||
auto activityEmoji =
|
||||
new EmojiCategory(tr("Activity"), emoji_provider_.activity, scrollWidget);
|
||||
auto activityEmoji = new Category(tr("Activity"), emoji_provider_.activity, scrollWidget);
|
||||
scrollLayout->addWidget(activityEmoji);
|
||||
|
||||
auto travelEmoji =
|
||||
new EmojiCategory(tr("Travel & Places"), emoji_provider_.travel, scrollWidget);
|
||||
new Category(tr("Travel & Places"), emoji_provider_.travel, scrollWidget);
|
||||
scrollLayout->addWidget(travelEmoji);
|
||||
|
||||
auto objectsEmoji = new EmojiCategory(tr("Objects"), emoji_provider_.objects, scrollWidget);
|
||||
auto objectsEmoji = new Category(tr("Objects"), emoji_provider_.objects, scrollWidget);
|
||||
scrollLayout->addWidget(objectsEmoji);
|
||||
|
||||
auto symbolsEmoji = new EmojiCategory(tr("Symbols"), emoji_provider_.symbols, scrollWidget);
|
||||
auto symbolsEmoji = new Category(tr("Symbols"), emoji_provider_.symbols, scrollWidget);
|
||||
scrollLayout->addWidget(symbolsEmoji);
|
||||
|
||||
auto flagsEmoji = new EmojiCategory(tr("Flags"), emoji_provider_.flags, scrollWidget);
|
||||
auto flagsEmoji = new Category(tr("Flags"), emoji_provider_.flags, scrollWidget);
|
||||
scrollLayout->addWidget(flagsEmoji);
|
||||
|
||||
contentLayout->addWidget(scrollArea_);
|
||||
contentLayout->addWidget(emojiCategories);
|
||||
|
||||
connect(peopleEmoji, &EmojiCategory::emojiSelected, this, &EmojiPanel::emojiSelected);
|
||||
connect(peopleEmoji, &Category::emojiSelected, this, &Panel::emojiSelected);
|
||||
connect(peopleCategory, &QPushButton::clicked, [this, peopleEmoji]() {
|
||||
this->showEmojiCategory(peopleEmoji);
|
||||
this->showCategory(peopleEmoji);
|
||||
});
|
||||
|
||||
connect(natureEmoji, &EmojiCategory::emojiSelected, this, &EmojiPanel::emojiSelected);
|
||||
connect(natureEmoji, &Category::emojiSelected, this, &Panel::emojiSelected);
|
||||
connect(natureCategory_, &QPushButton::clicked, [this, natureEmoji]() {
|
||||
this->showEmojiCategory(natureEmoji);
|
||||
this->showCategory(natureEmoji);
|
||||
});
|
||||
|
||||
connect(foodEmoji, &EmojiCategory::emojiSelected, this, &EmojiPanel::emojiSelected);
|
||||
connect(foodEmoji, &Category::emojiSelected, this, &Panel::emojiSelected);
|
||||
connect(foodCategory_, &QPushButton::clicked, [this, foodEmoji]() {
|
||||
this->showEmojiCategory(foodEmoji);
|
||||
this->showCategory(foodEmoji);
|
||||
});
|
||||
|
||||
connect(activityEmoji, &EmojiCategory::emojiSelected, this, &EmojiPanel::emojiSelected);
|
||||
connect(activityEmoji, &Category::emojiSelected, this, &Panel::emojiSelected);
|
||||
connect(activityCategory, &QPushButton::clicked, [this, activityEmoji]() {
|
||||
this->showEmojiCategory(activityEmoji);
|
||||
this->showCategory(activityEmoji);
|
||||
});
|
||||
|
||||
connect(travelEmoji, &EmojiCategory::emojiSelected, this, &EmojiPanel::emojiSelected);
|
||||
connect(travelEmoji, &Category::emojiSelected, this, &Panel::emojiSelected);
|
||||
connect(travelCategory, &QPushButton::clicked, [this, travelEmoji]() {
|
||||
this->showEmojiCategory(travelEmoji);
|
||||
this->showCategory(travelEmoji);
|
||||
});
|
||||
|
||||
connect(objectsEmoji, &EmojiCategory::emojiSelected, this, &EmojiPanel::emojiSelected);
|
||||
connect(objectsEmoji, &Category::emojiSelected, this, &Panel::emojiSelected);
|
||||
connect(objectsCategory, &QPushButton::clicked, [this, objectsEmoji]() {
|
||||
this->showEmojiCategory(objectsEmoji);
|
||||
this->showCategory(objectsEmoji);
|
||||
});
|
||||
|
||||
connect(symbolsEmoji, &EmojiCategory::emojiSelected, this, &EmojiPanel::emojiSelected);
|
||||
connect(symbolsEmoji, &Category::emojiSelected, this, &Panel::emojiSelected);
|
||||
connect(symbolsCategory, &QPushButton::clicked, [this, symbolsEmoji]() {
|
||||
this->showEmojiCategory(symbolsEmoji);
|
||||
this->showCategory(symbolsEmoji);
|
||||
});
|
||||
|
||||
connect(flagsEmoji, &EmojiCategory::emojiSelected, this, &EmojiPanel::emojiSelected);
|
||||
connect(flagsEmoji, &Category::emojiSelected, this, &Panel::emojiSelected);
|
||||
connect(flagsCategory, &QPushButton::clicked, [this, flagsEmoji]() {
|
||||
this->showEmojiCategory(flagsEmoji);
|
||||
this->showCategory(flagsEmoji);
|
||||
});
|
||||
}
|
||||
|
||||
void
|
||||
EmojiPanel::showEmojiCategory(const EmojiCategory *category)
|
||||
Panel::showCategory(const Category *category)
|
||||
{
|
||||
auto posToGo = category->mapToParent(QPoint()).y();
|
||||
auto current = scrollArea_->verticalScrollBar()->value();
|
||||
|
@ -217,13 +215,13 @@ EmojiPanel::showEmojiCategory(const EmojiCategory *category)
|
|||
}
|
||||
|
||||
void
|
||||
EmojiPanel::leaveEvent(QEvent *)
|
||||
Panel::leaveEvent(QEvent *)
|
||||
{
|
||||
hide();
|
||||
}
|
||||
|
||||
void
|
||||
EmojiPanel::paintEvent(QPaintEvent *event)
|
||||
Panel::paintEvent(QPaintEvent *event)
|
||||
{
|
||||
Q_UNUSED(event);
|
||||
|
|
@ -15,23 +15,24 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "emoji/EmojiPickButton.h"
|
||||
#include "emoji/EmojiPanel.h"
|
||||
#include "emoji/PickButton.h"
|
||||
#include "emoji/Panel.h"
|
||||
|
||||
EmojiPickButton::EmojiPickButton(QWidget *parent)
|
||||
using namespace emoji;
|
||||
|
||||
PickButton::PickButton(QWidget *parent)
|
||||
: FlatButton(parent)
|
||||
, panel_{nullptr}
|
||||
{}
|
||||
|
||||
void
|
||||
EmojiPickButton::enterEvent(QEvent *e)
|
||||
PickButton::enterEvent(QEvent *e)
|
||||
{
|
||||
Q_UNUSED(e);
|
||||
|
||||
if (panel_.isNull()) {
|
||||
panel_ = QSharedPointer<EmojiPanel>(new EmojiPanel(this));
|
||||
connect(
|
||||
panel_.data(), &EmojiPanel::emojiSelected, this, &EmojiPickButton::emojiSelected);
|
||||
panel_ = QSharedPointer<Panel>(new Panel(this));
|
||||
connect(panel_.data(), &Panel::emojiSelected, this, &PickButton::emojiSelected);
|
||||
}
|
||||
|
||||
QPoint pos(rect().x(), rect().y());
|
||||
|
@ -47,7 +48,7 @@ EmojiPickButton::enterEvent(QEvent *e)
|
|||
}
|
||||
|
||||
void
|
||||
EmojiPickButton::leaveEvent(QEvent *e)
|
||||
PickButton::leaveEvent(QEvent *e)
|
||||
{
|
||||
Q_UNUSED(e);
|
||||
|
|
@ -17,9 +17,11 @@
|
|||
|
||||
#include <QByteArray>
|
||||
|
||||
#include "emoji/EmojiProvider.h"
|
||||
#include "emoji/Provider.h"
|
||||
|
||||
const QList<Emoji> EmojiProvider::people = {
|
||||
using namespace emoji;
|
||||
|
||||
const QList<Emoji> Provider::people = {
|
||||
Emoji{QString::fromUtf8("\xf0\x9f\x98\x80"), ":grinning:"},
|
||||
Emoji{QString::fromUtf8("\xf0\x9f\x98\x81"), ":grin:"},
|
||||
Emoji{QString::fromUtf8("\xf0\x9f\x98\x82"), ":joy:"},
|
||||
|
@ -229,7 +231,7 @@ const QList<Emoji> EmojiProvider::people = {
|
|||
Emoji{QString::fromUtf8("\xf0\x9f\x92\xbc"), ":briefcase:"},
|
||||
};
|
||||
|
||||
const QList<Emoji> EmojiProvider::nature = {
|
||||
const QList<Emoji> Provider::nature = {
|
||||
Emoji{QString::fromUtf8("\xf0\x9f\x99\x88"), ":see_no_evil:"},
|
||||
Emoji{QString::fromUtf8("\xf0\x9f\x99\x89"), ":hear_no_evil:"},
|
||||
Emoji{QString::fromUtf8("\xf0\x9f\x99\x8a"), ":speak_no_evil:"},
|
||||
|
@ -392,7 +394,7 @@ const QList<Emoji> EmojiProvider::nature = {
|
|||
Emoji{QString::fromUtf8("\xf0\x9f\x8e\x8d"), ":bamboo:"},
|
||||
};
|
||||
|
||||
const QList<Emoji> EmojiProvider::food = {
|
||||
const QList<Emoji> Provider::food = {
|
||||
Emoji{QString::fromUtf8("\xf0\x9f\x8d\x87"), ":grapes:"},
|
||||
Emoji{QString::fromUtf8("\xf0\x9f\x8d\x88"), ":melon:"},
|
||||
Emoji{QString::fromUtf8("\xf0\x9f\x8d\x89"), ":watermelon:"},
|
||||
|
@ -480,7 +482,7 @@ const QList<Emoji> EmojiProvider::food = {
|
|||
Emoji{QString::fromUtf8("\xf0\x9f\xa5\x84"), ":spoon:"},
|
||||
};
|
||||
|
||||
const QList<Emoji> EmojiProvider::activity = {
|
||||
const QList<Emoji> Provider::activity = {
|
||||
Emoji{QString::fromUtf8("\xf0\x9f\x91\xbe"), ":space_invader:"},
|
||||
Emoji{QString::fromUtf8("\xf0\x9f\x95\xb4"), ":levitate:"},
|
||||
Emoji{QString::fromUtf8("\xf0\x9f\xa4\xba"), ":fencer:"},
|
||||
|
@ -622,7 +624,7 @@ const QList<Emoji> EmojiProvider::activity = {
|
|||
Emoji{QString::fromUtf8("\xf0\x9f\x8f\xb9"), ":bow_and_arrow:"},
|
||||
};
|
||||
|
||||
const QList<Emoji> EmojiProvider::travel = {
|
||||
const QList<Emoji> Provider::travel = {
|
||||
Emoji{QString::fromUtf8("\xf0\x9f\x8f\x8e"), ":race_car:"},
|
||||
Emoji{QString::fromUtf8("\xf0\x9f\x8f\x8d"), ":motorcycle:"},
|
||||
Emoji{QString::fromUtf8("\xf0\x9f\x97\xbe"), ":japan:"},
|
||||
|
@ -743,7 +745,7 @@ const QList<Emoji> EmojiProvider::travel = {
|
|||
Emoji{QString::fromUtf8("\xf0\x9f\x8f\x81"), ":checkered_flag:"},
|
||||
};
|
||||
|
||||
const QList<Emoji> EmojiProvider::objects = {
|
||||
const QList<Emoji> Provider::objects = {
|
||||
Emoji{QString::fromUtf8("\xe2\x98\xa0"), ":skull_crossbones:"},
|
||||
Emoji{QString::fromUtf8("\xf0\x9f\x92\x8c"), ":love_letter:"},
|
||||
Emoji{QString::fromUtf8("\xf0\x9f\x92\xa3"), ":bomb:"},
|
||||
|
@ -926,7 +928,7 @@ const QList<Emoji> EmojiProvider::objects = {
|
|||
Emoji{QString::fromUtf8("\xf0\x9f\x8f\xb3\xf0\x9f\x8c\x88"), ":rainbow_flag:"},
|
||||
};
|
||||
|
||||
const QList<Emoji> EmojiProvider::symbols = {
|
||||
const QList<Emoji> Provider::symbols = {
|
||||
Emoji{QString::fromUtf8("\xf0\x9f\x91\x81\xf0\x9f\x97\xa8"), ":eye_in_speech_bubble:"},
|
||||
Emoji{QString::fromUtf8("\xf0\x9f\x92\x98"), ":cupid:"},
|
||||
Emoji{QString::fromUtf8("\xe2\x9d\xa4"), ":heart:"},
|
||||
|
@ -1204,7 +1206,7 @@ const QList<Emoji> EmojiProvider::symbols = {
|
|||
Emoji{QString::fromUtf8("\xf0\x9f\x94\xb5"), ":blue_circle:"},
|
||||
};
|
||||
|
||||
const QList<Emoji> EmojiProvider::flags = {
|
||||
const QList<Emoji> Provider::flags = {
|
||||
Emoji{QString::fromUtf8("\xf0\x9f\x87\xa6\xf0\x9f\x87\xa8"), ":flag_ac:"},
|
||||
Emoji{QString::fromUtf8("\xf0\x9f\x87\xa6\xf0\x9f\x87\xa9"), ":flag_ad:"},
|
||||
Emoji{QString::fromUtf8("\xf0\x9f\x87\xa6\xf0\x9f\x87\xaa"), ":flag_ae:"},
|
|
@ -22,7 +22,7 @@
|
|||
#include <QPainter>
|
||||
#include <QPixmap>
|
||||
|
||||
#include "dialogs/ImageOverlayDialog.h"
|
||||
#include "dialogs/ImageOverlay.h"
|
||||
#include "timeline/widgets/ImageItem.h"
|
||||
|
||||
namespace events = matrix::events;
|
||||
|
@ -165,7 +165,7 @@ ImageItem::mousePressEvent(QMouseEvent *event)
|
|||
if (QRect(0, height_ - bottom_height_, width_, bottom_height_).contains(point)) {
|
||||
openUrl();
|
||||
} else {
|
||||
auto image_dialog = new ImageOverlayDialog(image_, this);
|
||||
auto image_dialog = new dialogs::ImageOverlay(image_, this);
|
||||
image_dialog->show();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue