X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=src%2Fqtui%2Finputwidget.cpp;h=b444cfa95fde0d83842e297a7e9754f440ba215e;hb=8f2ee00f4edef1693628d3af0bdee84d725eb754;hp=f93c7d963a3f66e8db2350e61c4d1547e2982e0b;hpb=fcacaaf16551524c7ebb6114254d005274cc3d63;p=quassel.git diff --git a/src/qtui/inputwidget.cpp b/src/qtui/inputwidget.cpp index f93c7d96..b444cfa9 100644 --- a/src/qtui/inputwidget.cpp +++ b/src/qtui/inputwidget.cpp @@ -35,6 +35,7 @@ #include "qtui.h" #include "qtuisettings.h" #include "tabcompleter.h" +#include "util.h" const int leftMargin = 3; @@ -43,7 +44,7 @@ InputWidget::InputWidget(QWidget *parent) _networkId(0) { ui.setupUi(this); - connect(ui.ownNick, SIGNAL(activated(QString)), this, SLOT(changeNick(QString))); + connect(ui.ownNick, selectOverload(&QComboBox::activated), this, &InputWidget::changeNick); layout()->setAlignment(ui.ownNick, Qt::AlignBottom); layout()->setAlignment(ui.inputEdit, Qt::AlignBottom); @@ -111,43 +112,23 @@ InputWidget::InputWidget(QWidget *parent) new TabCompleter(ui.inputEdit); UiStyleSettings fs("Fonts"); - fs.notify("UseCustomInputWidgetFont", this, SLOT(setUseCustomFont(QVariant))); - fs.notify("InputWidget", this, SLOT(setCustomFont(QVariant))); + fs.notify("UseCustomInputWidgetFont", this, &InputWidget::setUseCustomFont); + fs.notify("InputWidget", this, &InputWidget::setCustomFont); if (fs.value("UseCustomInputWidgetFont", false).toBool()) setCustomFont(fs.value("InputWidget", QFont())); UiSettings s("InputWidget"); - - s.notify("EnableEmacsMode", this, SLOT(setEnableEmacsMode(QVariant))); - setEnableEmacsMode(s.value("EnableEmacsMode", false)); - - s.notify("ShowNickSelector", this, SLOT(setShowNickSelector(QVariant))); - setShowNickSelector(s.value("ShowNickSelector", true)); - - s.notify("ShowStyleButtons", this, SLOT(setShowStyleButtons(QVariant))); - setShowStyleButtons(s.value("ShowStyleButtons", true)); - - s.notify("EnablePerChatHistory", this, SLOT(setEnablePerChatHistory(QVariant))); - setEnablePerChatHistory(s.value("EnablePerChatHistory", true)); - - s.notify("MaxNumLines", this, SLOT(setMaxLines(QVariant))); - setMaxLines(s.value("MaxNumLines", 5)); - - s.notify("EnableScrollBars", this, SLOT(setScrollBarsEnabled(QVariant))); - setScrollBarsEnabled(s.value("EnableScrollBars", true)); - - s.notify("EnableLineWrap", this, SLOT(setLineWrapEnabled(QVariant))); - setLineWrapEnabled(s.value("EnableLineWrap", true)); - - s.notify("EnableMultiLine", this, SLOT(setMultiLineEnabled(QVariant))); - setMultiLineEnabled(s.value("EnableMultiLine", true)); + s.initAndNotify("EnableEmacsMode", this, &InputWidget::setEnableEmacsMode, false); + s.initAndNotify("ShowNickSelector", this, &InputWidget::setShowNickSelector, true); + s.initAndNotify("ShowStyleButtons", this, &InputWidget::setShowStyleButtons, true); + s.initAndNotify("EnablePerChatHistory", this, &InputWidget::setEnablePerChatHistory, true); + s.initAndNotify("MaxNumLines", this, &InputWidget::setMaxLines, 5); + s.initAndNotify("EnableScrollBars", this, &InputWidget::setScrollBarsEnabled, true); + s.initAndNotify("EnableLineWrap", this, &InputWidget::setLineWrapEnabled, true); + s.initAndNotify("EnableMultiLine", this, &InputWidget::setMultiLineEnabled, true); ActionCollection *coll = QtUi::actionCollection(); - - auto *activateInputline = coll->add("FocusInputLine"); - connect(activateInputline, SIGNAL(triggered()), SLOT(setFocus())); - activateInputline->setText(tr("Focus Input Line")); - activateInputline->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_L)); + coll->addAction("FocusInputLine", new Action{tr("Focus Input Line"), coll, this, selectOverload<>(&QWidget::setFocus), QKeySequence(Qt::CTRL + Qt::Key_L)}); connect(inputLine(), &MultiLineEdit::textEntered, this, &InputWidget::onTextEntered, Qt::QueuedConnection); // make sure the line is already reset, bug #984 connect(inputLine(), &QTextEdit::currentCharFormatChanged, this, &InputWidget::currentCharFormatChanged);