mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-21 22:24:07 +01:00
Stable (#1905)
* 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:
parent
391ba5476f
commit
50da694fff
6 changed files with 43 additions and 24 deletions
|
@ -143,6 +143,8 @@ public:
|
||||||
"/behaviour/autocompletion/prefixOnlyCompletion", true};
|
"/behaviour/autocompletion/prefixOnlyCompletion", true};
|
||||||
BoolSetting userCompletionOnlyWithAt = {
|
BoolSetting userCompletionOnlyWithAt = {
|
||||||
"/behaviour/autocompletion/userCompletionOnlyWithAt", false};
|
"/behaviour/autocompletion/userCompletionOnlyWithAt", false};
|
||||||
|
BoolSetting emoteCompletionWithColon = {
|
||||||
|
"/behaviour/autocompletion/emoteCompletionWithColon", true};
|
||||||
|
|
||||||
FloatSetting pauseOnHoverDuration = {"/behaviour/pauseOnHoverDuration", 0};
|
FloatSetting pauseOnHoverDuration = {"/behaviour/pauseOnHoverDuration", 0};
|
||||||
EnumSetting<Qt::KeyboardModifier> pauseChatModifier = {
|
EnumSetting<Qt::KeyboardModifier> pauseChatModifier = {
|
||||||
|
|
|
@ -33,6 +33,11 @@ void GenericListView::setModel(GenericListModel *model)
|
||||||
QListView::setModel(model);
|
QListView::setModel(model);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GenericListView::setInvokeActionOnTab(bool value)
|
||||||
|
{
|
||||||
|
this->invokeActionOnTab_ = value;
|
||||||
|
}
|
||||||
|
|
||||||
bool GenericListView::eventFilter(QObject * /*watched*/, QEvent *event)
|
bool GenericListView::eventFilter(QObject * /*watched*/, QEvent *event)
|
||||||
{
|
{
|
||||||
if (!this->model_)
|
if (!this->model_)
|
||||||
|
@ -47,30 +52,10 @@ bool GenericListView::eventFilter(QObject * /*watched*/, QEvent *event)
|
||||||
const int curRow = curIdx.row();
|
const int curRow = curIdx.row();
|
||||||
const int count = this->model_->rowCount(curIdx);
|
const int count = this->model_->rowCount(curIdx);
|
||||||
|
|
||||||
if (key == Qt::Key_Down || key == Qt::Key_Tab)
|
if (key == Qt::Key_Enter || key == Qt::Key_Return ||
|
||||||
{
|
(key == Qt::Key_Tab && this->invokeActionOnTab_))
|
||||||
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)
|
|
||||||
{
|
{
|
||||||
|
// keep this before the other tab handler
|
||||||
if (count <= 0)
|
if (count <= 0)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
@ -82,6 +67,29 @@ bool GenericListView::eventFilter(QObject * /*watched*/, QEvent *event)
|
||||||
emit this->closeRequested();
|
emit this->closeRequested();
|
||||||
return true;
|
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)
|
else if (key == Qt::Key_Escape)
|
||||||
{
|
{
|
||||||
emit this->closeRequested();
|
emit this->closeRequested();
|
||||||
|
|
|
@ -18,6 +18,7 @@ public:
|
||||||
|
|
||||||
virtual void setModel(QAbstractItemModel *model) override;
|
virtual void setModel(QAbstractItemModel *model) override;
|
||||||
void setModel(GenericListModel *);
|
void setModel(GenericListModel *);
|
||||||
|
void setInvokeActionOnTab(bool);
|
||||||
bool eventFilter(QObject *watched, QEvent *event) override;
|
bool eventFilter(QObject *watched, QEvent *event) override;
|
||||||
|
|
||||||
GenericListModel *model_{};
|
GenericListModel *model_{};
|
||||||
|
@ -27,6 +28,9 @@ public:
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void closeRequested();
|
void closeRequested();
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool invokeActionOnTab_{};
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace chatterino
|
} // namespace chatterino
|
||||||
|
|
|
@ -474,6 +474,8 @@ void GeneralPage::initLayout(SettingsLayout &layout)
|
||||||
layout.addCheckbox("Animate", s.animateEmotes);
|
layout.addCheckbox("Animate", s.animateEmotes);
|
||||||
layout.addCheckbox("Animate only when Chatterino is focused",
|
layout.addCheckbox("Animate only when Chatterino is focused",
|
||||||
s.animationsWhenFocused);
|
s.animationsWhenFocused);
|
||||||
|
layout.addCheckbox("Enable emote auto-completion by typing :",
|
||||||
|
s.emoteCompletionWithColon);
|
||||||
layout.addDropdown<float>(
|
layout.addDropdown<float>(
|
||||||
"Size", {"0.5x", "0.75x", "Default", "1.25x", "1.5x", "2x"},
|
"Size", {"0.5x", "0.75x", "Default", "1.25x", "1.5x", "2x"},
|
||||||
s.emoteScale,
|
s.emoteScale,
|
||||||
|
|
|
@ -62,6 +62,7 @@ void EmoteInputPopup::initLayout()
|
||||||
|
|
||||||
auto listView =
|
auto listView =
|
||||||
creator.emplace<GenericListView>().assign(&this->ui_.listView);
|
creator.emplace<GenericListView>().assign(&this->ui_.listView);
|
||||||
|
listView->setInvokeActionOnTab(true);
|
||||||
|
|
||||||
listView->setModel(&this->model_);
|
listView->setModel(&this->model_);
|
||||||
QObject::connect(listView.getElement(), &GenericListView::closeRequested,
|
QObject::connect(listView.getElement(), &GenericListView::closeRequested,
|
||||||
|
|
|
@ -459,9 +459,11 @@ void SplitInput::onCursorPositionChanged()
|
||||||
|
|
||||||
void SplitInput::updateColonMenu()
|
void SplitInput::updateColonMenu()
|
||||||
{
|
{
|
||||||
if (!dynamic_cast<TwitchChannel *>(this->split_->getChannel().get()))
|
if (!getSettings()->emoteCompletionWithColon ||
|
||||||
|
!dynamic_cast<TwitchChannel *>(this->split_->getChannel().get()))
|
||||||
{
|
{
|
||||||
this->hideColonMenu();
|
this->hideColonMenu();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// check if in :
|
// check if in :
|
||||||
|
|
Loading…
Reference in a new issue