+
+ // we reset the nick selecter as we have no confirmation yet, that this will succeed.
+ // if the action succeeds it will be properly updated anyways.
+ updateNickSelector();
+ Client::userInput(BufferInfo::fakeStatusBuffer(net->networkId()), QString("/NICK %1").arg(newNick));
+}
+
+void InputWidget::on_inputEdit_textEntered(const QString &text) const {
+ Client::userInput(currentBufferInfo(), text);
+ actionTextBold->setChecked(false);
+ actionTextUnderline->setChecked(false);
+ actionTextItalic->setChecked(false);
+ inputLine()->setFontWeight(QFont::Normal);
+ inputLine()->setFontUnderline(false);
+ inputLine()->setFontItalic(false);
+}
+
+void InputWidget::mergeFormatOnWordOrSelection(const QTextCharFormat &format) {
+ QTextCursor cursor = inputLine()->textCursor();
+ if (!cursor.hasSelection())
+ cursor.select(QTextCursor::WordUnderCursor);
+ cursor.mergeCharFormat(format);
+ inputLine()->mergeCurrentCharFormat(format);
+}
+
+void InputWidget::currentCharFormatChanged(const QTextCharFormat &format) {
+ fontChanged(format.font());
+ colorChanged(format.foreground().color(), format.background().color());
+}
+
+void InputWidget::textBold()
+{
+ if (inputLine()->hasFocus()) {
+ QTextCharFormat fmt;
+ fmt.setFontWeight(actionTextBold->isChecked() ? QFont::Bold : QFont::Normal);
+ mergeFormatOnWordOrSelection(fmt);
+ }
+}
+
+void InputWidget::textUnderline()
+{
+ if (inputLine()->hasFocus()) {
+ QTextCharFormat fmt;
+ fmt.setFontUnderline(actionTextUnderline->isChecked());
+ mergeFormatOnWordOrSelection(fmt);
+ }
+}
+
+void InputWidget::textItalic()
+{
+ if (inputLine()->hasFocus()) {
+ QTextCharFormat fmt;
+ fmt.setFontItalic(actionTextItalic->isChecked());
+ mergeFormatOnWordOrSelection(fmt);
+ }
+}
+
+void InputWidget::fontChanged(const QFont &f)
+{
+ actionTextBold->setChecked(f.bold());
+ actionTextItalic->setChecked(f.italic());
+ actionTextUnderline->setChecked(f.underline());
+}
+
+void InputWidget::colorChanged(const QColor &fg, const QColor &bg) {
+ //TODO update colorpicker
+}
+
+// MOUSE WHEEL FILTER
+MouseWheelFilter::MouseWheelFilter(QObject *parent)
+ : QObject(parent)
+{