summary refs log tree commit diff
path: root/src/emoji/Category.cpp
diff options
context:
space:
mode:
authorKonstantinos Sideris <sideris.konstantin@gmail.com>2018-10-07 13:13:14 +0300
committerKonstantinos Sideris <sideris.konstantin@gmail.com>2018-10-07 13:13:14 +0300
commit4b807229aa20d6f4891e35f08d489da427d3d0b6 (patch)
treead5c7d005429f6fa24fa63934b81086125f0113f /src/emoji/Category.cpp
parentAdd the correct parent to scaleCombo (diff)
downloadnheko-4b807229aa20d6f4891e35f08d489da427d3d0b6.tar.xz
Remove built-in emoji picker
Diffstat (limited to 'src/emoji/Category.cpp')
-rw-r--r--src/emoji/Category.cpp90
1 files changed, 0 insertions, 90 deletions
diff --git a/src/emoji/Category.cpp b/src/emoji/Category.cpp
deleted file mode 100644

index fbfbf4fc..00000000 --- a/src/emoji/Category.cpp +++ /dev/null
@@ -1,90 +0,0 @@ -/* - * nheko Copyright (C) 2017 Konstantinos Sideris <siderisk@auth.gr> - * - * 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 <http://www.gnu.org/licenses/>. - */ - -#include <QPainter> -#include <QScrollBar> -#include <QStyleOption> - -#include "Config.h" - -#include "emoji/Category.h" - -using namespace emoji; - -Category::Category(QString category, std::vector<Emoji> emoji, QWidget *parent) - : QWidget(parent) -{ - mainLayout_ = new QVBoxLayout(this); - mainLayout_->setMargin(0); - mainLayout_->setSpacing(0); - - emojiListView_ = new QListView(); - itemModel_ = new QStandardItemModel(this); - - delegate_ = new ItemDelegate(this); - data_ = new Emoji; - - emojiListView_->setItemDelegate(delegate_); - emojiListView_->setModel(itemModel_); - emojiListView_->setViewMode(QListView::IconMode); - emojiListView_->setFlow(QListView::LeftToRight); - emojiListView_->setResizeMode(QListView::Adjust); - emojiListView_->verticalScrollBar()->setEnabled(false); - emojiListView_->horizontalScrollBar()->setEnabled(false); - - const int cols = 7; - const int rows = emoji.size() / 7; - - // TODO: Be precise here. Take the parent into consideration. - emojiListView_->setFixedSize(cols * 50 + 20, rows * 50 + 20); - emojiListView_->setGridSize(QSize(50, 50)); - emojiListView_->setDragEnabled(false); - emojiListView_->setEditTriggers(QAbstractItemView::NoEditTriggers); - - for (const auto &e : emoji) { - data_->unicode = e.unicode; - - auto item = new QStandardItem; - item->setSizeHint(QSize(24, 24)); - - QVariant unicode(data_->unicode); - item->setData(unicode.toString(), Qt::UserRole); - - itemModel_->appendRow(item); - } - - QFont font; - font.setWeight(QFont::Medium); - - category_ = new QLabel(category, this); - category_->setFont(font); - category_->setStyleSheet("margin: 20px 0 20px 8px;"); - - mainLayout_->addWidget(category_); - mainLayout_->addWidget(emojiListView_); - - connect(emojiListView_, &QListView::clicked, this, &Category::clickIndex); -} - -void -Category::paintEvent(QPaintEvent *) -{ - QStyleOption opt; - opt.init(this); - QPainter p(this); - style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this); -}