fix local mention crash
This commit is contained in:
parent
14e8fcdd44
commit
e2be1cd897
3 changed files with 52 additions and 39 deletions
|
@ -298,6 +298,14 @@ void ChatView::appendMessage(QString message, QString sender, UserLevelFlags use
|
||||||
}
|
}
|
||||||
else if (index == mentionFirstIndex)
|
else if (index == mentionFirstIndex)
|
||||||
{
|
{
|
||||||
|
if (tabSupervisor->isALocalGame())
|
||||||
|
{
|
||||||
|
cursor.insertText("@");
|
||||||
|
message = message.mid(1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
|
||||||
QMap<QString, UserListTWI *> userList = tabSupervisor->getUserListsTab()->getAllUsersList()->getUsers();
|
QMap<QString, UserListTWI *> userList = tabSupervisor->getUserListsTab()->getAllUsersList()->getUsers();
|
||||||
|
|
||||||
int firstSpace = message.indexOf(" ");
|
int firstSpace = message.indexOf(" ");
|
||||||
|
@ -348,9 +356,10 @@ void ChatView::appendMessage(QString message, QString sender, UserLevelFlags use
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
message = message.mid(1); // Not certain when this would ever be reached, but just incase
|
message = message.mid(1); // Not certain when this would ever be reached, but just incase lets skip the character
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -184,6 +184,7 @@ int TabSupervisor::myAddTab(Tab *tab)
|
||||||
|
|
||||||
void TabSupervisor::start(const ServerInfo_User &_userInfo)
|
void TabSupervisor::start(const ServerInfo_User &_userInfo)
|
||||||
{
|
{
|
||||||
|
isLocalGame = false;
|
||||||
userInfo = new ServerInfo_User(_userInfo);
|
userInfo = new ServerInfo_User(_userInfo);
|
||||||
|
|
||||||
tabServer = new TabServer(this, client);
|
tabServer = new TabServer(this, client);
|
||||||
|
@ -227,6 +228,7 @@ void TabSupervisor::startLocal(const QList<AbstractClient *> &_clients)
|
||||||
tabDeckStorage = 0;
|
tabDeckStorage = 0;
|
||||||
tabReplays = 0;
|
tabReplays = 0;
|
||||||
tabAdmin = 0;
|
tabAdmin = 0;
|
||||||
|
isLocalGame = true;
|
||||||
userInfo = new ServerInfo_User;
|
userInfo = new ServerInfo_User;
|
||||||
localClients = _clients;
|
localClients = _clients;
|
||||||
for (int i = 0; i < localClients.size(); ++i)
|
for (int i = 0; i < localClients.size(); ++i)
|
||||||
|
|
|
@ -60,6 +60,7 @@ private:
|
||||||
void addCloseButtonToTab(Tab *tab, int tabIndex);
|
void addCloseButtonToTab(Tab *tab, int tabIndex);
|
||||||
QString sanitizeTabName(QString dirty) const;
|
QString sanitizeTabName(QString dirty) const;
|
||||||
QString sanitizeHtml(QString dirty) const;
|
QString sanitizeHtml(QString dirty) const;
|
||||||
|
bool isLocalGame;
|
||||||
public:
|
public:
|
||||||
TabSupervisor(AbstractClient *_client, QWidget *parent = 0);
|
TabSupervisor(AbstractClient *_client, QWidget *parent = 0);
|
||||||
~TabSupervisor();
|
~TabSupervisor();
|
||||||
|
@ -67,6 +68,7 @@ public:
|
||||||
void start(const ServerInfo_User &userInfo);
|
void start(const ServerInfo_User &userInfo);
|
||||||
void startLocal(const QList<AbstractClient *> &_clients);
|
void startLocal(const QList<AbstractClient *> &_clients);
|
||||||
void stop();
|
void stop();
|
||||||
|
bool isALocalGame() const { return isLocalGame; }
|
||||||
int getGameCount() const { return gameTabs.size(); }
|
int getGameCount() const { return gameTabs.size(); }
|
||||||
TabUserLists *getUserListsTab() const { return tabUserLists; }
|
TabUserLists *getUserListsTab() const { return tabUserLists; }
|
||||||
ServerInfo_User *getUserInfo() const { return userInfo; }
|
ServerInfo_User *getUserInfo() const { return userInfo; }
|
||||||
|
|
Loading…
Reference in a new issue