modernize: Use '= default' instead of empty ctor/dtor bodies
[quassel.git] / src / qtui / inputwidget.cpp
index 8d84233..a832207 100644 (file)
@@ -118,11 +118,6 @@ InputWidget::InputWidget(QWidget *parent)
 
     UiSettings s("InputWidget");
 
-#ifdef HAVE_KDE4
-    s.notify("EnableSpellCheck", this, SLOT(setEnableSpellCheck(QVariant)));
-    setEnableSpellCheck(s.value("EnableSpellCheck", false));
-#endif
-
     s.notify("EnableEmacsMode", this, SLOT(setEnableEmacsMode(QVariant)));
     setEnableEmacsMode(s.value("EnableEmacsMode", false));
 
@@ -159,11 +154,6 @@ InputWidget::InputWidget(QWidget *parent)
 }
 
 
-InputWidget::~InputWidget()
-{
-}
-
-
 void InputWidget::setUseCustomFont(const QVariant &v)
 {
     if (v.toBool()) {
@@ -189,12 +179,6 @@ void InputWidget::setCustomFont(const QVariant &v)
 }
 
 
-void InputWidget::setEnableSpellCheck(const QVariant &v)
-{
-    ui.inputEdit->setSpellCheckEnabled(v.toBool());
-}
-
-
 void InputWidget::setEnableEmacsMode(const QVariant &v)
 {
     ui.inputEdit->setEmacsMode(v.toBool());
@@ -385,7 +369,7 @@ const Network *InputWidget::currentNetwork() const
 BufferInfo InputWidget::currentBufferInfo() const
 {
     return selectionModel()->currentIndex().data(NetworkModel::BufferInfoRole).value<BufferInfo>();
-};
+}
 
 
 void InputWidget::applyFormatActiveColor()
@@ -438,9 +422,9 @@ void InputWidget::setNetwork(NetworkId networkId)
 
     const Network *previousNet = Client::network(_networkId);
     if (previousNet) {
-        disconnect(previousNet, 0, this, 0);
+        disconnect(previousNet, nullptr, this, nullptr);
         if (previousNet->me())
-            disconnect(previousNet->me(), 0, this, 0);
+            disconnect(previousNet->me(), nullptr, this, nullptr);
     }
 
     _networkId = networkId;
@@ -483,7 +467,7 @@ void InputWidget::setIdentity(IdentityId identityId)
 
     const Identity *previousIdentity = Client::identity(_identityId);
     if (previousIdentity)
-        disconnect(previousIdentity, 0, this, 0);
+        disconnect(previousIdentity, nullptr, this, nullptr);
 
     _identityId = identityId;
 
@@ -554,16 +538,16 @@ void InputWidget::changeNick(const QString &newNick) const
 void InputWidget::onTextEntered(const QString &text)
 {
     Client::userInput(currentBufferInfo(), text);
-    ui.boldButton->setChecked(false);
-    ui.underlineButton->setChecked(false);
-    ui.italicButton->setChecked(false);
 
+    // Remove formatting from entered text
+    // TODO: Offer a way to convert pasted text to mIRC formatting codes
     setFormatClear(true);
 }
 
 
 void InputWidget::setFormatClear(const bool global)
 {
+    // Apply formatting
     QTextCharFormat fmt;
     fmt.setFontWeight(QFont::Normal);
     fmt.setFontUnderline(false);
@@ -575,30 +559,44 @@ void InputWidget::setFormatClear(const bool global)
     } else {
         setFormatOnSelection(fmt);
     }
+
+    // Make sure UI state follows
+    ui.boldButton->setChecked(false);
+    ui.italicButton->setChecked(false);
+    ui.underlineButton->setChecked(false);
 }
 
 
 void InputWidget::setFormatBold(const bool bold)
 {
+    // Apply formatting
     QTextCharFormat fmt;
     fmt.setFontWeight(bold ? QFont::Bold : QFont::Normal);
     mergeFormatOnSelection(fmt);
+    // Make sure UI state follows
+    ui.boldButton->setChecked(bold);
 }
 
 
 void InputWidget::setFormatItalic(const bool italic)
 {
+    // Apply formatting
     QTextCharFormat fmt;
     fmt.setFontItalic(italic);
     mergeFormatOnSelection(fmt);
+    // Make sure UI state follows
+    ui.italicButton->setChecked(italic);
 }
 
 
 void InputWidget::setFormatUnderline(const bool underline)
 {
+    // Apply formatting
     QTextCharFormat fmt;
     fmt.setFontUnderline(underline);
     mergeFormatOnSelection(fmt);
+    // Make sure UI state follows
+    ui.underlineButton->setChecked(underline);
 }