diff options
author | Jussi Kuokkanen <jussi.kuokkanen@protonmail.com> | 2020-08-29 00:26:45 +0300 |
---|---|---|
committer | Jussi Kuokkanen <jussi.kuokkanen@protonmail.com> | 2020-08-29 00:26:45 +0300 |
commit | 9ad9c8ddf07495ac6581edf7ca11463d7c0f78c9 (patch) | |
tree | 37259524232c9351381051ebc903aa2e0d056851 | |
parent | lint (diff) | |
download | nheko-9ad9c8ddf07495ac6581edf7ca11463d7c0f78c9.tar.xz |
fix build and remove commented code
-rw-r--r-- | CMakeLists.txt | 2 | ||||
-rwxr-xr-x | scripts/emoji_codegen.py | 9 | ||||
-rw-r--r-- | src/TextInputWidget.cpp | 5 | ||||
-rw-r--r-- | src/emoji/EmojiSearchModel.h | 7 |
4 files changed, 8 insertions, 15 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index d2dffccd..7295cc54 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -245,7 +245,6 @@ set(SRC_FILES src/emoji/Category.cpp src/emoji/EmojiModel.cpp src/emoji/ItemDelegate.cpp - src/emoji/KeyboardSelector.cpp src/emoji/Panel.cpp src/emoji/PickButton.cpp src/emoji/Provider.cpp @@ -460,7 +459,6 @@ qt5_wrap_cpp(MOC_HEADERS src/emoji/Category.h src/emoji/EmojiModel.h src/emoji/ItemDelegate.h - src/emoji/KeyboardSelector.h src/emoji/Panel.h src/emoji/PickButton.h src/emoji/Provider.h diff --git a/scripts/emoji_codegen.py b/scripts/emoji_codegen.py index b39feb34..466246ed 100755 --- a/scripts/emoji_codegen.py +++ b/scripts/emoji_codegen.py @@ -11,12 +11,15 @@ class Emoji(object): self.code = repr(code.encode('utf-8'))[1:].strip("'") self.shortname = shortname +def to_shortcode(shortname): + return shortname.replace(" ", "-").replace(":", "-") + def generate_code(emojis, category): tmpl = Template(''' const std::vector<Emoji> emoji::Provider::{{ category }} = { // {{ category.capitalize() }} {%- for e in emoji %} - Emoji{QString::fromUtf8("{{ e.code }}"), "{{ e.shortname }}", emoji::EmojiCategory::{{ category.capitalize() }}}, + Emoji{QString::fromUtf8("{{ e.code }}"), "{{ e.shortname }}", "{{ to_shortcode(e.shortname) }}", emoji::EmojiCategory::{{ category.capitalize() }}}, {%- endfor %} }; ''') @@ -30,7 +33,7 @@ const QVector<Emoji> emoji::Provider::emoji = { {%- for c in kwargs.items() %} // {{ c[0].capitalize() }} {%- for e in c[1] %} - Emoji{QString::fromUtf8("{{ e.code }}"), "{{ e.shortname }}", emoji::EmojiCategory::{{ c[0].capitalize() }}}, + Emoji{QString::fromUtf8("{{ e.code }}"), "{{ e.shortname }}", "{{ to_shortcode(e.shortname) }}", emoji::EmojiCategory::{{ c[0].capitalize() }}}, {%- endfor %} {%- endfor %} }; @@ -101,4 +104,4 @@ if __name__ == '__main__': generate_code(objects, 'objects') generate_code(symbols, 'symbols') generate_code(flags, 'flags') - generate_qml_list(people=people, nature=nature, food=food, activity=activity, travel=travel, objects=objects, symbols=symbols, flags=flags) \ No newline at end of file + generate_qml_list(people=people, nature=nature, food=food, activity=activity, travel=travel, objects=objects, symbols=symbols, flags=flags) diff --git a/src/TextInputWidget.cpp b/src/TextInputWidget.cpp index 17018392..08883cca 100644 --- a/src/TextInputWidget.cpp +++ b/src/TextInputWidget.cpp @@ -15,6 +15,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ +#include <QAbstractItemView> #include <QAbstractTextDocumentLayout> #include <QBuffer> #include <QClipboard> @@ -36,7 +37,6 @@ #include "TextInputWidget.h" #include "Utils.h" #include "emoji/EmojiSearchModel.h" -#include "emoji/KeyboardSelector.h" #include "emoji/Provider.h" #include "ui/FlatButton.h" #include "ui/LoadingIndicator.h" @@ -250,7 +250,6 @@ FilteredTextEdit::keyPressEvent(QKeyEvent *event) QTextEdit::keyPressEvent(event); emoji_popup_open_ = true; emoji_completion_model_->setFilterRegExp(wordUnderCursor()); - // completer_->setCompletionPrefix(wordUnderCursor()); completer_->popup()->setCurrentIndex(completer_->completionModel()->index(0, 0)); completer_->complete(completerRect()); break; @@ -310,9 +309,7 @@ FilteredTextEdit::keyPressEvent(QKeyEvent *event) if (emoji_popup_open_) { // Update completion - emoji_completion_model_->setFilterRegExp(wordUnderCursor()); - // completer_->setCompletionPrefix(wordUnderCursor()); completer_->popup()->setCurrentIndex( completer_->completionModel()->index(0, 0)); completer_->complete(completerRect()); diff --git a/src/emoji/EmojiSearchModel.h b/src/emoji/EmojiSearchModel.h index 87fa0403..1ff5f4e9 100644 --- a/src/emoji/EmojiSearchModel.h +++ b/src/emoji/EmojiSearchModel.h @@ -5,8 +5,6 @@ #include <QDebug> #include <QEvent> #include <QSortFilterProxyModel> -#include <qabstractitemmodel.h> -#include <qsortfilterproxymodel.h> namespace emoji { @@ -28,10 +26,7 @@ public: } return QSortFilterProxyModel::data(index, role); } - /*int rowCount(const QModelIndex &parent) const override { - auto row_count = QSortFilterProxyModel::rowCount(parent); - return (row_count < 7) ? row_count : 7; - }*/ + private: QString toShortcode(QString shortname) const { |