* fixed SearchWindow memory leak

* Update CHANGELOG.md

* added DebugCount for BaseWindow

* [Bug Fix] Color of second user highlight cannot be set (#1898)

* Highlighting: Fix bug preventing user highlight from being set

Before this commit, only the row of a clicked cell was checked, but not
the tab it was clicked in.

Since the "Whispers" row is the second row in the "Messages" tab on the
highlighting page, the color picker was not opened for the second entry
in the "Users" tab either. This commit fixes the bug by also checking
tab the cell was clicked in.

* Update CHANGELOG.md

* Emote Popup Improvements (#1895)

* Put exact matching emotes first

* Close GenericListView on Escape press

* smol fix

* fixed emote input when not in the first char

* fixes #1902

* closes #1904

Co-authored-by: Leon Richardt <leon.richardt@gmail.com>
Co-authored-by: Daniel <24928223+dnsge@users.noreply.github.com>
This commit is contained in:
fourtf 2020-08-23 11:28:22 +02:00 committed by GitHub
parent 391ba5476f
commit 50da694fff
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 43 additions and 24 deletions

View file

@ -143,6 +143,8 @@ public:
"/behaviour/autocompletion/prefixOnlyCompletion", true};
BoolSetting userCompletionOnlyWithAt = {
"/behaviour/autocompletion/userCompletionOnlyWithAt", false};
BoolSetting emoteCompletionWithColon = {
"/behaviour/autocompletion/emoteCompletionWithColon", true};
FloatSetting pauseOnHoverDuration = {"/behaviour/pauseOnHoverDuration", 0};
EnumSetting<Qt::KeyboardModifier> pauseChatModifier = {

View file

@ -33,6 +33,11 @@ void GenericListView::setModel(GenericListModel *model)
QListView::setModel(model);
}
void GenericListView::setInvokeActionOnTab(bool value)
{
this->invokeActionOnTab_ = value;
}
bool GenericListView::eventFilter(QObject * /*watched*/, QEvent *event)
{
if (!this->model_)
@ -47,30 +52,10 @@ bool GenericListView::eventFilter(QObject * /*watched*/, QEvent *event)
const int curRow = curIdx.row();
const int count = this->model_->rowCount(curIdx);
if (key == Qt::Key_Down || key == Qt::Key_Tab)
{
if (count <= 0)
return true;
const int newRow = (curRow + 1) % count;
this->setCurrentIndex(curIdx.siblingAtRow(newRow));
return true;
}
else if (key == Qt::Key_Up || key == Qt::Key_Backtab)
{
if (count <= 0)
return true;
int newRow = curRow - 1;
if (newRow < 0)
newRow += count;
this->setCurrentIndex(curIdx.siblingAtRow(newRow));
return true;
}
else if (key == Qt::Key_Enter || key == Qt::Key_Return)
if (key == Qt::Key_Enter || key == Qt::Key_Return ||
(key == Qt::Key_Tab && this->invokeActionOnTab_))
{
// keep this before the other tab handler
if (count <= 0)
return true;
@ -82,6 +67,29 @@ bool GenericListView::eventFilter(QObject * /*watched*/, QEvent *event)
emit this->closeRequested();
return true;
}
else if (key == Qt::Key_Down || key == Qt::Key_Tab)
{
if (count <= 0)
return true;
const int newRow = (curRow + 1) % count;
this->setCurrentIndex(curIdx.siblingAtRow(newRow));
return true;
}
else if (key == Qt::Key_Up ||
(!this->invokeActionOnTab_ && key == Qt::Key_Backtab))
{
if (count <= 0)
return true;
int newRow = curRow - 1;
if (newRow < 0)
newRow += count;
this->setCurrentIndex(curIdx.siblingAtRow(newRow));
return true;
}
else if (key == Qt::Key_Escape)
{
emit this->closeRequested();

View file

@ -18,6 +18,7 @@ public:
virtual void setModel(QAbstractItemModel *model) override;
void setModel(GenericListModel *);
void setInvokeActionOnTab(bool);
bool eventFilter(QObject *watched, QEvent *event) override;
GenericListModel *model_{};
@ -27,6 +28,9 @@ public:
signals:
void closeRequested();
private:
bool invokeActionOnTab_{};
};
} // namespace chatterino

View file

@ -474,6 +474,8 @@ void GeneralPage::initLayout(SettingsLayout &layout)
layout.addCheckbox("Animate", s.animateEmotes);
layout.addCheckbox("Animate only when Chatterino is focused",
s.animationsWhenFocused);
layout.addCheckbox("Enable emote auto-completion by typing :",
s.emoteCompletionWithColon);
layout.addDropdown<float>(
"Size", {"0.5x", "0.75x", "Default", "1.25x", "1.5x", "2x"},
s.emoteScale,

View file

@ -62,6 +62,7 @@ void EmoteInputPopup::initLayout()
auto listView =
creator.emplace<GenericListView>().assign(&this->ui_.listView);
listView->setInvokeActionOnTab(true);
listView->setModel(&this->model_);
QObject::connect(listView.getElement(), &GenericListView::closeRequested,

View file

@ -459,9 +459,11 @@ void SplitInput::onCursorPositionChanged()
void SplitInput::updateColonMenu()
{
if (!dynamic_cast<TwitchChannel *>(this->split_->getChannel().get()))
if (!getSettings()->emoteCompletionWithColon ||
!dynamic_cast<TwitchChannel *>(this->split_->getChannel().get()))
{
this->hideColonMenu();
return;
}
// check if in :