# HG changeset patch
# User sheepluva
# Date 1319881657 -7200
# Node ID ce60b734fff195ecf6f19615710239cbdbfa3a96
# Parent 505643d4c23d7d3353ff0df9df6ba432516fed66
update name autocompletion after nick change (since own nick isn't suggested)
diff -r 505643d4c23d -r ce60b734fff1 QTfrontend/hwform.cpp
--- a/QTfrontend/hwform.cpp Sat Oct 29 09:19:04 2011 +0200
+++ b/QTfrontend/hwform.cpp Sat Oct 29 11:47:37 2011 +0200
@@ -755,6 +755,9 @@
hwnet->NewNick(newNick);
config->setValue("net/nick", newNick);
config->updNetNick();
+
+ ui.pageRoomsList->setUser(nick);
+ ui.pageNetGame->setUser(nick);
}
void HWForm::NetAuthFailed()
@@ -800,8 +803,6 @@
hwnet=0;
}
- ui.pageRoomsList->chatWidget->clear();
-
hwnet = new HWNewNet();
GoToPage(ID_PAGE_CONNECTING);
@@ -939,6 +940,10 @@
config->setValue("net/nick",nick);
config->updNetNick();
}
+
+ ui.pageRoomsList->setUser(nick);
+ ui.pageNetGame->setUser(nick);
+
hwnet->Connect(hostName, port, nick);
}
diff -r 505643d4c23d -r ce60b734fff1 QTfrontend/ui/page/pagenetgame.cpp
--- a/QTfrontend/ui/page/pagenetgame.cpp Sat Oct 29 09:19:04 2011 +0200
+++ b/QTfrontend/ui/page/pagenetgame.cpp Sat Oct 29 11:47:37 2011 +0200
@@ -174,3 +174,7 @@
leRoomName->setVisible(isMaster);
}
+void PageNetGame::setUser(const QString & nickname)
+{
+ pChatWidget->setUser(nickname);
+}
diff -r 505643d4c23d -r ce60b734fff1 QTfrontend/ui/page/pagenetgame.h
--- a/QTfrontend/ui/page/pagenetgame.h Sat Oct 29 09:19:04 2011 +0200
+++ b/QTfrontend/ui/page/pagenetgame.h Sat Oct 29 11:47:37 2011 +0200
@@ -59,6 +59,7 @@
public slots:
void setReadyStatus(bool isReady);
+ void setUser(const QString & nickname);
void onUpdateClick();
void setMasterMode(bool isMaster);
diff -r 505643d4c23d -r ce60b734fff1 QTfrontend/ui/page/pageroomslist.cpp
--- a/QTfrontend/ui/page/pageroomslist.cpp Sat Oct 29 09:19:04 2011 +0200
+++ b/QTfrontend/ui/page/pageroomslist.cpp Sat Oct 29 11:47:37 2011 +0200
@@ -446,3 +446,8 @@
{
lblCount->setText(tr("%1 players online", 0, cnt).arg(cnt));
}
+
+void PageRoomsList::setUser(const QString & nickname)
+{
+ chatWidget->setUser(nickname);
+}
diff -r 505643d4c23d -r ce60b734fff1 QTfrontend/ui/page/pageroomslist.h
--- a/QTfrontend/ui/page/pageroomslist.h Sat Oct 29 09:19:04 2011 +0200
+++ b/QTfrontend/ui/page/pageroomslist.h Sat Oct 29 11:47:37 2011 +0200
@@ -49,8 +49,9 @@
QLabel * lblCount;
public slots:
+ void setAdmin(bool);
void setRoomsList(const QStringList & list);
- void setAdmin(bool);
+ void setUser(const QString & nickname);
void updateNickCounter(int cnt);
signals:
diff -r 505643d4c23d -r ce60b734fff1 QTfrontend/ui/widget/chatwidget.cpp
--- a/QTfrontend/ui/widget/chatwidget.cpp Sat Oct 29 09:19:04 2011 +0200
+++ b/QTfrontend/ui/widget/chatwidget.cpp Sat Oct 29 11:47:37 2011 +0200
@@ -483,13 +483,13 @@
// "link" nick, but before that encode it in base64 to make sure it can't
// intefere with html/url syntax the nick is put as querystring as putting
// it as host would convert it to it's lower case variant
-QString HWChatWidget::linkedNick(const QString & nickName)
+QString HWChatWidget::linkedNick(const QString & nickname)
{
- if (nickName != m_userNick)
+ if (nickname != m_userNick)
return QString("%2").arg(
- QString(nickName.toUtf8().toBase64())).arg(nickName);
+ QString(nickname.toUtf8().toBase64())).arg(nickname);
else
- return QString("%1").arg(nickName);
+ return QString("%1").arg(nickname);
}
@@ -539,7 +539,8 @@
bool isHL = false;
- if ((!nick.isEmpty()) && (nick != m_userNick))
+ if ((c != 3) && (!nick.isEmpty()) &&
+ (nick != m_userNick) && (m_userNick.isEmpty()))
{
QString lcStr = str.toLower();
@@ -637,7 +638,6 @@
chatText->clear();
chatStrings.clear();
chatNicks->clear();
- m_userNick = gameSettings->value("net/nick","").toString();
// clear and re compile regexp for highlighting
m_highlights.clear();
@@ -971,3 +971,11 @@
return false;
}
+
+
+void HWChatWidget::setUser(const QString & nickname)
+{
+ m_userNick = nickname;
+ nickRemoved(nickname);
+ clear();
+}
diff -r 505643d4c23d -r ce60b734fff1 QTfrontend/ui/widget/chatwidget.h
--- a/QTfrontend/ui/widget/chatwidget.h Sat Oct 29 09:19:04 2011 +0200
+++ b/QTfrontend/ui/widget/chatwidget.h Sat Oct 29 11:47:37 2011 +0200
@@ -78,6 +78,7 @@
void displayError(const QString & message);
void displayNotice(const QString & message);
void displayWarning(const QString & message);
+ void setUser(const QString & nickname);
protected:
virtual void dragEnterEvent(QDragEnterEvent * event);
@@ -99,7 +100,7 @@
bool parseCommand(const QString & line);
void discardStyleSheet();
void saveStyleSheet();
- QString linkedNick(const QString & nickName);
+ QString linkedNick(const QString & nickname);
public slots:
void onChatString(const QString& str);