+ UiStyleSettings fs("Fonts");
+ 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.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();
+ 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);
+}
+
+void InputWidget::setUseCustomFont(const QVariant& v)
+{
+ if (v.toBool()) {
+ UiStyleSettings fs("Fonts");
+ setCustomFont(fs.value("InputWidget"));
+ }
+ else
+ setCustomFont(QFont());
+}