trim net nick in frontend
authorsheepluva
Sat, 22 Jan 2011 22:43:54 +0100
changeset 4870 c02406028e02
parent 4869 7a720b5d2247
child 4871 4a99a45ea886
trim net nick in frontend
QTfrontend/hwform.cpp
QTfrontend/pages.cpp
QTfrontend/pages.h
--- a/QTfrontend/hwform.cpp	Sat Jan 22 22:31:05 2011 +0100
+++ b/QTfrontend/hwform.cpp	Sat Jan 22 22:43:54 2011 +0100
@@ -697,7 +697,7 @@
 
 void HWForm::NetConnectServer(const QString & host, quint16 port)
 {
-    _NetConnect(host, port, ui.pageOptions->editNetNick->text());
+    _NetConnect(host, port, ui.pageOptions->editNetNick->text().trimmed());
 }
 
 void HWForm::NetConnectOfficialServer()
--- a/QTfrontend/pages.cpp	Sat Jan 22 22:31:05 2011 +0100
+++ b/QTfrontend/pages.cpp	Sat Jan 22 22:43:54 2011 +0100
@@ -617,6 +617,7 @@
             editNetNick = new QLineEdit(groupMisc);
             editNetNick->setMaxLength(20);
             editNetNick->setText(QLineEdit::tr("unnamed"));
+            connect(editNetNick, SIGNAL(editingFinished()), this, SLOT(trimNetNick()));
             MiscLayout->addWidget(editNetNick, 0, 1);
 
             QLabel *labelLanguage = new QLabel(groupMisc);
@@ -832,6 +833,11 @@
     this->CBResolution->setEnabled(!this->CBFullscreen->isChecked());
 }
 
+void PageOptions::trimNetNick()
+{
+    editNetNick->setText(editNetNick->text().trimmed());
+}
+
 PageNet::PageNet(QWidget* parent) : AbstractPage(parent)
 {
     QFont * font14 = new QFont("MS Shell Dlg", 14);
--- a/QTfrontend/pages.h	Sat Jan 22 22:31:05 2011 +0100
+++ b/QTfrontend/pages.h	Sat Jan 22 22:43:54 2011 +0100
@@ -264,6 +264,7 @@
 private slots:
     void forceFullscreen(int index);
     void setFullscreen(void);
+    void trimNetNick();
 };
 
 class PageNet : public AbstractPage