fix build and remove commented code

This commit is contained in:
Jussi Kuokkanen 2020-08-29 00:26:45 +03:00
parent 7acd4b3307
commit 9ad9c8ddf0
4 changed files with 8 additions and 15 deletions

View file

@ -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

View file

@ -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)
generate_qml_list(people=people, nature=nature, food=food, activity=activity, travel=travel, objects=objects, symbols=symbols, flags=flags)

View file

@ -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());

View file

@ -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
{