From eae069ad93a6822e8cb96522708115793c01c5d7 Mon Sep 17 00:00:00 2001 From: Konstantinos Sideris Date: Thu, 30 Nov 2017 20:02:46 +0200 Subject: Group emoji and dialogs with namespaces --- include/RoomList.h | 6 ++-- include/TextInputWidget.h | 4 +-- include/TopRoomBar.h | 5 +-- include/UserInfoWidget.h | 5 +-- include/dialogs/ImageOverlay.h | 49 +++++++++++++++++++++++++++++ include/dialogs/ImageOverlayDialog.h | 46 --------------------------- include/dialogs/JoinRoom.h | 26 ++++++++++++++++ include/dialogs/JoinRoomDialog.h | 22 ------------- include/dialogs/LeaveRoom.h | 25 +++++++++++++++ include/dialogs/LeaveRoomDialog.h | 22 ------------- include/dialogs/Logout.h | 42 +++++++++++++++++++++++++ include/dialogs/LogoutDialog.h | 39 ----------------------- include/emoji/Category.h | 60 ++++++++++++++++++++++++++++++++++++ include/emoji/EmojiCategory.h | 59 ----------------------------------- include/emoji/EmojiItemDelegate.h | 40 ------------------------ include/emoji/EmojiPanel.h | 55 --------------------------------- include/emoji/EmojiPickButton.h | 48 ----------------------------- include/emoji/EmojiProvider.h | 41 ------------------------ include/emoji/ItemDelegate.h | 43 ++++++++++++++++++++++++++ include/emoji/Panel.h | 58 ++++++++++++++++++++++++++++++++++ include/emoji/PickButton.h | 51 ++++++++++++++++++++++++++++++ include/emoji/Provider.h | 44 ++++++++++++++++++++++++++ 22 files changed, 409 insertions(+), 381 deletions(-) create mode 100644 include/dialogs/ImageOverlay.h delete mode 100644 include/dialogs/ImageOverlayDialog.h create mode 100644 include/dialogs/JoinRoom.h delete mode 100644 include/dialogs/JoinRoomDialog.h create mode 100644 include/dialogs/LeaveRoom.h delete mode 100644 include/dialogs/LeaveRoomDialog.h create mode 100644 include/dialogs/Logout.h delete mode 100644 include/dialogs/LogoutDialog.h create mode 100644 include/emoji/Category.h delete mode 100644 include/emoji/EmojiCategory.h delete mode 100644 include/emoji/EmojiItemDelegate.h delete mode 100644 include/emoji/EmojiPanel.h delete mode 100644 include/emoji/EmojiPickButton.h delete mode 100644 include/emoji/EmojiProvider.h create mode 100644 include/emoji/ItemDelegate.h create mode 100644 include/emoji/Panel.h create mode 100644 include/emoji/PickButton.h create mode 100644 include/emoji/Provider.h (limited to 'include') diff --git a/include/RoomList.h b/include/RoomList.h index aa7c919c..f75f7ba4 100644 --- a/include/RoomList.h +++ b/include/RoomList.h @@ -24,7 +24,8 @@ #include #include -class JoinRoomDialog; +#include "dialogs/LeaveRoom.h" + class LeaveRoomDialog; class MatrixClient; class OverlayModal; @@ -82,10 +83,9 @@ private: QPushButton *joinRoomButton_; OverlayModal *joinRoomModal_; - JoinRoomDialog *joinRoomDialog_; QSharedPointer leaveRoomModal_; - QSharedPointer leaveRoomDialog_; + QSharedPointer leaveRoomDialog_; QMap> rooms_; diff --git a/include/TextInputWidget.h b/include/TextInputWidget.h index ede7b18a..3c338fe3 100644 --- a/include/TextInputWidget.h +++ b/include/TextInputWidget.h @@ -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_; }; diff --git a/include/TopRoomBar.h b/include/TopRoomBar.h index 2f65428d..7bd10356 100644 --- a/include/TopRoomBar.h +++ b/include/TopRoomBar.h @@ -26,10 +26,11 @@ #include #include +#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 leaveRoomModal_; - QSharedPointer leaveRoomDialog_; + QSharedPointer leaveRoomDialog_; Avatar *avatar_; diff --git a/include/UserInfoWidget.h b/include/UserInfoWidget.h index 2acfedb8..3c20380f 100644 --- a/include/UserInfoWidget.h +++ b/include/UserInfoWidget.h @@ -20,9 +20,10 @@ #include #include +#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 logoutModal_; - QSharedPointer logoutDialog_; + QSharedPointer logoutDialog_; int logoutButtonSize_; }; diff --git a/include/dialogs/ImageOverlay.h b/include/dialogs/ImageOverlay.h new file mode 100644 index 00000000..682999ef --- /dev/null +++ b/include/dialogs/ImageOverlay.h @@ -0,0 +1,49 @@ +/* + * nheko Copyright (C) 2017 Konstantinos Sideris + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#pragma once + +#include +#include +#include + +namespace dialogs { + +class ImageOverlay : public QWidget +{ + Q_OBJECT +public: + ImageOverlay(QPixmap image, QWidget *parent = nullptr); + +protected: + void mousePressEvent(QMouseEvent *event) override; + void paintEvent(QPaintEvent *event) override; + +signals: + void closing(); + +private: + void scaleImage(int width, int height); + + QPixmap originalImage_; + QPixmap image_; + + QRect content_; + QRect close_button_; + QRect screen_; +}; +} // dialogs diff --git a/include/dialogs/ImageOverlayDialog.h b/include/dialogs/ImageOverlayDialog.h deleted file mode 100644 index 5159c665..00000000 --- a/include/dialogs/ImageOverlayDialog.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * nheko Copyright (C) 2017 Konstantinos Sideris - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#pragma once - -#include -#include -#include - -class ImageOverlayDialog : public QWidget -{ - Q_OBJECT -public: - ImageOverlayDialog(QPixmap image, QWidget *parent = nullptr); - -protected: - void mousePressEvent(QMouseEvent *event) override; - void paintEvent(QPaintEvent *event) override; - -signals: - void closing(); - -private: - void scaleImage(int width, int height); - - QPixmap originalImage_; - QPixmap image_; - - QRect content_; - QRect close_button_; - QRect screen_; -}; diff --git a/include/dialogs/JoinRoom.h b/include/dialogs/JoinRoom.h new file mode 100644 index 00000000..dbc06bdf --- /dev/null +++ b/include/dialogs/JoinRoom.h @@ -0,0 +1,26 @@ +#pragma once + +#include +#include + +class FlatButton; + +namespace dialogs { + +class JoinRoom : public QFrame +{ + Q_OBJECT +public: + JoinRoom(QWidget *parent = nullptr); + +signals: + void closing(bool isJoining, QString roomAlias); + +private: + FlatButton *confirmBtn_; + FlatButton *cancelBtn_; + + QLineEdit *roomAliasEdit_; +}; + +} // dialogs diff --git a/include/dialogs/JoinRoomDialog.h b/include/dialogs/JoinRoomDialog.h deleted file mode 100644 index 84184733..00000000 --- a/include/dialogs/JoinRoomDialog.h +++ /dev/null @@ -1,22 +0,0 @@ -#pragma once - -#include -#include - -class FlatButton; - -class JoinRoomDialog : public QFrame -{ - Q_OBJECT -public: - JoinRoomDialog(QWidget *parent = nullptr); - -signals: - void closing(bool isJoining, QString roomAlias); - -private: - FlatButton *confirmBtn_; - FlatButton *cancelBtn_; - - QLineEdit *roomAliasEdit_; -}; diff --git a/include/dialogs/LeaveRoom.h b/include/dialogs/LeaveRoom.h new file mode 100644 index 00000000..98e4938d --- /dev/null +++ b/include/dialogs/LeaveRoom.h @@ -0,0 +1,25 @@ +#pragma once + +#include + +class FlatButton; + +namespace dialogs { + +class LeaveRoom : public QFrame +{ + Q_OBJECT +public: + explicit LeaveRoom(QWidget *parent = nullptr); + +protected: + void paintEvent(QPaintEvent *event) override; + +signals: + void closing(bool isLeaving); + +private: + FlatButton *confirmBtn_; + FlatButton *cancelBtn_; +}; +} // dialogs diff --git a/include/dialogs/LeaveRoomDialog.h b/include/dialogs/LeaveRoomDialog.h deleted file mode 100644 index eab022f7..00000000 --- a/include/dialogs/LeaveRoomDialog.h +++ /dev/null @@ -1,22 +0,0 @@ -#pragma once - -#include - -class FlatButton; - -class LeaveRoomDialog : public QFrame -{ - Q_OBJECT -public: - explicit LeaveRoomDialog(QWidget *parent = nullptr); - -protected: - void paintEvent(QPaintEvent *event) override; - -signals: - void closing(bool isLeaving); - -private: - FlatButton *confirmBtn_; - FlatButton *cancelBtn_; -}; diff --git a/include/dialogs/Logout.h b/include/dialogs/Logout.h new file mode 100644 index 00000000..cfefb970 --- /dev/null +++ b/include/dialogs/Logout.h @@ -0,0 +1,42 @@ +/* + * nheko Copyright (C) 2017 Konstantinos Sideris + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#pragma once + +#include + +class FlatButton; + +namespace dialogs { + +class Logout : public QFrame +{ + Q_OBJECT +public: + explicit Logout(QWidget *parent = nullptr); + +protected: + void paintEvent(QPaintEvent *event) override; + +signals: + void closing(bool isLoggingOut); + +private: + FlatButton *confirmBtn_; + FlatButton *cancelBtn_; +}; +} // dialogs diff --git a/include/dialogs/LogoutDialog.h b/include/dialogs/LogoutDialog.h deleted file mode 100644 index a1a5ee4f..00000000 --- a/include/dialogs/LogoutDialog.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * nheko Copyright (C) 2017 Konstantinos Sideris - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#pragma once - -#include - -class FlatButton; - -class LogoutDialog : public QFrame -{ - Q_OBJECT -public: - explicit LogoutDialog(QWidget *parent = nullptr); - -protected: - void paintEvent(QPaintEvent *event) override; - -signals: - void closing(bool isLoggingOut); - -private: - FlatButton *confirmBtn_; - FlatButton *cancelBtn_; -}; diff --git a/include/emoji/Category.h b/include/emoji/Category.h new file mode 100644 index 00000000..0310a4f3 --- /dev/null +++ b/include/emoji/Category.h @@ -0,0 +1,60 @@ +/* + * nheko Copyright (C) 2017 Konstantinos Sideris + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#pragma once + +#include +#include +#include +#include + +#include "ItemDelegate.h" + +namespace emoji { + +class Category : public QWidget +{ + Q_OBJECT + +public: + Category(QString category, QList emoji, QWidget *parent = nullptr); + ~Category(); + +signals: + void emojiSelected(const QString &emoji); + +protected: + void paintEvent(QPaintEvent *event) override; + +private slots: + void clickIndex(const QModelIndex &index) + { + emit emojiSelected(index.data(Qt::UserRole).toString()); + }; + +private: + QVBoxLayout *mainLayout_; + + QStandardItemModel *itemModel_; + QListView *emojiListView_; + + emoji::Emoji *data_; + emoji::ItemDelegate *delegate_; + + QLabel *category_; +}; +} // namespace emoji diff --git a/include/emoji/EmojiCategory.h b/include/emoji/EmojiCategory.h deleted file mode 100644 index be0110f2..00000000 --- a/include/emoji/EmojiCategory.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - * nheko Copyright (C) 2017 Konstantinos Sideris - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#pragma once - -#include -#include -#include -#include - -#include "EmojiItemDelegate.h" - -class EmojiProvider; - -class EmojiCategory : public QWidget -{ - Q_OBJECT - -public: - EmojiCategory(QString category, QList emoji, QWidget *parent = nullptr); - ~EmojiCategory(); - -signals: - void emojiSelected(const QString &emoji); - -protected: - void paintEvent(QPaintEvent *event) override; - -private slots: - void clickIndex(const QModelIndex &index) - { - emit emojiSelected(index.data(Qt::UserRole).toString()); - }; - -private: - QVBoxLayout *mainLayout_; - - QStandardItemModel *itemModel_; - QListView *emojiListView_; - - Emoji *data_; - EmojiItemDelegate *delegate_; - - QLabel *category_; -}; diff --git a/include/emoji/EmojiItemDelegate.h b/include/emoji/EmojiItemDelegate.h deleted file mode 100644 index 15d61f49..00000000 --- a/include/emoji/EmojiItemDelegate.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * nheko Copyright (C) 2017 Konstantinos Sideris - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#pragma once - -#include -#include -#include - -#include "EmojiProvider.h" - -class EmojiItemDelegate : public QStyledItemDelegate -{ - Q_OBJECT - -public: - explicit EmojiItemDelegate(QObject *parent = nullptr); - ~EmojiItemDelegate(); - - void paint(QPainter *painter, - const QStyleOptionViewItem &option, - const QModelIndex &index) const override; - -private: - Emoji *data_; -}; diff --git a/include/emoji/EmojiPanel.h b/include/emoji/EmojiPanel.h deleted file mode 100644 index 9eecc8e0..00000000 --- a/include/emoji/EmojiPanel.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * nheko Copyright (C) 2017 Konstantinos Sideris - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#pragma once - -#include - -#include "EmojiProvider.h" - -class EmojiCategory; - -class EmojiPanel : public QWidget -{ - Q_OBJECT - -public: - EmojiPanel(QWidget *parent = nullptr); - -signals: - void mouseLeft(); - void emojiSelected(const QString &emoji); - -protected: - void leaveEvent(QEvent *event); - void paintEvent(QPaintEvent *event); - -private: - void showEmojiCategory(const EmojiCategory *category); - - EmojiProvider emoji_provider_; - - QScrollArea *scrollArea_; - - int shadowMargin_; - - // Panel dimensions. - int width_; - int height_; - - int categoryIconSize_; -}; diff --git a/include/emoji/EmojiPickButton.h b/include/emoji/EmojiPickButton.h deleted file mode 100644 index 8ef9be9e..00000000 --- a/include/emoji/EmojiPickButton.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * nheko Copyright (C) 2017 Konstantinos Sideris - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#pragma once - -#include -#include - -#include "FlatButton.h" - -class EmojiPanel; - -class EmojiPickButton : public FlatButton -{ - Q_OBJECT -public: - explicit EmojiPickButton(QWidget *parent = nullptr); - -signals: - void emojiSelected(const QString &emoji); - -protected: - void enterEvent(QEvent *e) override; - void leaveEvent(QEvent *e) override; - -private: - // Vertical distance from panel's bottom. - int vertical_distance_ = 10; - - // Horizontal distance from panel's bottom right corner. - int horizontal_distance_ = 70; - - QSharedPointer panel_; -}; diff --git a/include/emoji/EmojiProvider.h b/include/emoji/EmojiProvider.h deleted file mode 100644 index 847157fd..00000000 --- a/include/emoji/EmojiProvider.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * nheko Copyright (C) 2017 Konstantinos Sideris - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#pragma once - -#include - -struct Emoji -{ - // Unicode code. - QString unicode; - // Keyboard shortcut e.g :emoji: - QString shortname; -}; - -class EmojiProvider -{ -public: - static const QList people; - static const QList nature; - static const QList food; - static const QList activity; - static const QList travel; - static const QList objects; - static const QList symbols; - static const QList flags; -}; diff --git a/include/emoji/ItemDelegate.h b/include/emoji/ItemDelegate.h new file mode 100644 index 00000000..e0456308 --- /dev/null +++ b/include/emoji/ItemDelegate.h @@ -0,0 +1,43 @@ +/* + * nheko Copyright (C) 2017 Konstantinos Sideris + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#pragma once + +#include +#include +#include + +#include "Provider.h" + +namespace emoji { + +class ItemDelegate : public QStyledItemDelegate +{ + Q_OBJECT + +public: + explicit ItemDelegate(QObject *parent = nullptr); + ~ItemDelegate(); + + void paint(QPainter *painter, + const QStyleOptionViewItem &option, + const QModelIndex &index) const override; + +private: + Emoji *data_; +}; +} // namespace emoji diff --git a/include/emoji/Panel.h b/include/emoji/Panel.h new file mode 100644 index 00000000..523a855e --- /dev/null +++ b/include/emoji/Panel.h @@ -0,0 +1,58 @@ +/* + * nheko Copyright (C) 2017 Konstantinos Sideris + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#pragma once + +#include + +#include "Provider.h" + +namespace emoji { + +class Category; + +class Panel : public QWidget +{ + Q_OBJECT + +public: + Panel(QWidget *parent = nullptr); + +signals: + void mouseLeft(); + void emojiSelected(const QString &emoji); + +protected: + void leaveEvent(QEvent *event); + void paintEvent(QPaintEvent *event); + +private: + void showCategory(const Category *category); + + Provider emoji_provider_; + + QScrollArea *scrollArea_; + + int shadowMargin_; + + // Panel dimensions. + int width_; + int height_; + + int categoryIconSize_; +}; +} // namespace emoji diff --git a/include/emoji/PickButton.h b/include/emoji/PickButton.h new file mode 100644 index 00000000..d0026828 --- /dev/null +++ b/include/emoji/PickButton.h @@ -0,0 +1,51 @@ +/* + * nheko Copyright (C) 2017 Konstantinos Sideris + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#pragma once + +#include +#include + +#include "FlatButton.h" + +namespace emoji { + +class Panel; + +class PickButton : public FlatButton +{ + Q_OBJECT +public: + explicit PickButton(QWidget *parent = nullptr); + +signals: + void emojiSelected(const QString &emoji); + +protected: + void enterEvent(QEvent *e) override; + void leaveEvent(QEvent *e) override; + +private: + // Vertical distance from panel's bottom. + int vertical_distance_ = 10; + + // Horizontal distance from panel's bottom right corner. + int horizontal_distance_ = 70; + + QSharedPointer panel_; +}; +} // namespace emoji diff --git a/include/emoji/Provider.h b/include/emoji/Provider.h new file mode 100644 index 00000000..8754dabc --- /dev/null +++ b/include/emoji/Provider.h @@ -0,0 +1,44 @@ +/* + * nheko Copyright (C) 2017 Konstantinos Sideris + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#pragma once + +#include + +namespace emoji { + +struct Emoji +{ + // Unicode code. + QString unicode; + // Keyboard shortcut e.g :emoji: + QString shortname; +}; + +class Provider +{ +public: + static const QList people; + static const QList nature; + static const QList food; + static const QList activity; + static const QList travel; + static const QList objects; + static const QList symbols; + static const QList flags; +}; +} // namespace emoji -- cgit 1.5.1