Ghetto disambiguation for the quick switcher
Fix the Ctrl+K shortcut Fix keyboard focus when the quick switcher is closed Linting
This commit is contained in:
parent
ddb23105f1
commit
fda8fa1f44
@ -79,6 +79,9 @@ signals:
|
||||
void startedTyping();
|
||||
void stoppedTyping();
|
||||
|
||||
protected:
|
||||
void focusInEvent(QFocusEvent *event);
|
||||
|
||||
private:
|
||||
void showUploadSpinner();
|
||||
QString parseEmoteCommand(const QString &cmd);
|
||||
|
@ -562,6 +562,7 @@ ChatPage::showQuickSwitcher()
|
||||
connect(quickSwitcher_.data(), &QuickSwitcher::closing, this, [=]() {
|
||||
if (!this->quickSwitcherModal_.isNull())
|
||||
this->quickSwitcherModal_->fadeOut();
|
||||
this->text_input_->setFocus(Qt::FocusReason::PopupFocusReason);
|
||||
});
|
||||
}
|
||||
|
||||
@ -575,8 +576,12 @@ ChatPage::showQuickSwitcher()
|
||||
|
||||
QMap<QString, QString> rooms;
|
||||
|
||||
for (auto it = state_manager_.constBegin(); it != state_manager_.constEnd(); ++it)
|
||||
rooms.insert(it.value().getName(), it.key());
|
||||
for (auto it = state_manager_.constBegin(); it != state_manager_.constEnd(); ++it) {
|
||||
QString deambiguator = it.value().canonical_alias.content().alias();
|
||||
if (deambiguator == "")
|
||||
deambiguator = it.key();
|
||||
rooms.insert(it.value().getName() + " (" + deambiguator + ")", it.key());
|
||||
}
|
||||
|
||||
quickSwitcher_->setRoomList(rooms);
|
||||
quickSwitcherModal_->fadeIn();
|
||||
|
@ -111,6 +111,11 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
QShortcut *quitShortcut = new QShortcut(QKeySequence::Quit, this);
|
||||
connect(quitShortcut, &QShortcut::activated, this, QApplication::quit);
|
||||
|
||||
QShortcut *quickSwitchShortcut = new QShortcut(QKeySequence("Ctrl+K"), this);
|
||||
connect(quickSwitchShortcut, &QShortcut::activated, this, [=]() {
|
||||
chat_page_->showQuickSwitcher();
|
||||
});
|
||||
|
||||
QSettings settings;
|
||||
|
||||
if (hasActiveUser()) {
|
||||
@ -125,9 +130,6 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
void
|
||||
MainWindow::keyPressEvent(QKeyEvent *e)
|
||||
{
|
||||
if ((e->key() == Qt::Key_K) && (e->modifiers().testFlag(Qt::ControlModifier)))
|
||||
chat_page_->showQuickSwitcher();
|
||||
else
|
||||
QMainWindow::keyPressEvent(e);
|
||||
}
|
||||
|
||||
|
@ -259,3 +259,9 @@ TextInputWidget::stopTyping()
|
||||
{
|
||||
input_->stopTyping();
|
||||
}
|
||||
|
||||
void
|
||||
TextInputWidget::focusInEvent(QFocusEvent *event)
|
||||
{
|
||||
input_->setFocus(event->reason());
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user