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/Category.cpp
src/emoji/EmojiModel.cpp src/emoji/EmojiModel.cpp
src/emoji/ItemDelegate.cpp src/emoji/ItemDelegate.cpp
src/emoji/KeyboardSelector.cpp
src/emoji/Panel.cpp src/emoji/Panel.cpp
src/emoji/PickButton.cpp src/emoji/PickButton.cpp
src/emoji/Provider.cpp src/emoji/Provider.cpp
@ -460,7 +459,6 @@ qt5_wrap_cpp(MOC_HEADERS
src/emoji/Category.h src/emoji/Category.h
src/emoji/EmojiModel.h src/emoji/EmojiModel.h
src/emoji/ItemDelegate.h src/emoji/ItemDelegate.h
src/emoji/KeyboardSelector.h
src/emoji/Panel.h src/emoji/Panel.h
src/emoji/PickButton.h src/emoji/PickButton.h
src/emoji/Provider.h src/emoji/Provider.h

View file

@ -11,12 +11,15 @@ class Emoji(object):
self.code = repr(code.encode('utf-8'))[1:].strip("'") self.code = repr(code.encode('utf-8'))[1:].strip("'")
self.shortname = shortname self.shortname = shortname
def to_shortcode(shortname):
return shortname.replace(" ", "-").replace(":", "-")
def generate_code(emojis, category): def generate_code(emojis, category):
tmpl = Template(''' tmpl = Template('''
const std::vector<Emoji> emoji::Provider::{{ category }} = { const std::vector<Emoji> emoji::Provider::{{ category }} = {
// {{ category.capitalize() }} // {{ category.capitalize() }}
{%- for e in emoji %} {%- 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 %} {%- endfor %}
}; };
''') ''')
@ -30,7 +33,7 @@ const QVector<Emoji> emoji::Provider::emoji = {
{%- for c in kwargs.items() %} {%- for c in kwargs.items() %}
// {{ c[0].capitalize() }} // {{ c[0].capitalize() }}
{%- for e in c[1] %} {%- 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 %}
{%- endfor %} {%- endfor %}
}; };

View file

@ -15,6 +15,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <QAbstractItemView>
#include <QAbstractTextDocumentLayout> #include <QAbstractTextDocumentLayout>
#include <QBuffer> #include <QBuffer>
#include <QClipboard> #include <QClipboard>
@ -36,7 +37,6 @@
#include "TextInputWidget.h" #include "TextInputWidget.h"
#include "Utils.h" #include "Utils.h"
#include "emoji/EmojiSearchModel.h" #include "emoji/EmojiSearchModel.h"
#include "emoji/KeyboardSelector.h"
#include "emoji/Provider.h" #include "emoji/Provider.h"
#include "ui/FlatButton.h" #include "ui/FlatButton.h"
#include "ui/LoadingIndicator.h" #include "ui/LoadingIndicator.h"
@ -250,7 +250,6 @@ FilteredTextEdit::keyPressEvent(QKeyEvent *event)
QTextEdit::keyPressEvent(event); QTextEdit::keyPressEvent(event);
emoji_popup_open_ = true; emoji_popup_open_ = true;
emoji_completion_model_->setFilterRegExp(wordUnderCursor()); emoji_completion_model_->setFilterRegExp(wordUnderCursor());
// completer_->setCompletionPrefix(wordUnderCursor());
completer_->popup()->setCurrentIndex(completer_->completionModel()->index(0, 0)); completer_->popup()->setCurrentIndex(completer_->completionModel()->index(0, 0));
completer_->complete(completerRect()); completer_->complete(completerRect());
break; break;
@ -310,9 +309,7 @@ FilteredTextEdit::keyPressEvent(QKeyEvent *event)
if (emoji_popup_open_) { if (emoji_popup_open_) {
// Update completion // Update completion
emoji_completion_model_->setFilterRegExp(wordUnderCursor()); emoji_completion_model_->setFilterRegExp(wordUnderCursor());
// completer_->setCompletionPrefix(wordUnderCursor());
completer_->popup()->setCurrentIndex( completer_->popup()->setCurrentIndex(
completer_->completionModel()->index(0, 0)); completer_->completionModel()->index(0, 0));
completer_->complete(completerRect()); completer_->complete(completerRect());

View file

@ -5,8 +5,6 @@
#include <QDebug> #include <QDebug>
#include <QEvent> #include <QEvent>
#include <QSortFilterProxyModel> #include <QSortFilterProxyModel>
#include <qabstractitemmodel.h>
#include <qsortfilterproxymodel.h>
namespace emoji { namespace emoji {
@ -28,10 +26,7 @@ public:
} }
return QSortFilterProxyModel::data(index, role); 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: private:
QString toShortcode(QString shortname) const QString toShortcode(QString shortname) const
{ {