Skip to content

Commit

Permalink
修复 赋值错误并优化代码
Browse files Browse the repository at this point in the history
  • Loading branch information
nekosilverfox committed Feb 26, 2024
1 parent a333b93 commit ffbf445
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
24 changes: 12 additions & 12 deletions App/bll_polychat.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,53 +42,53 @@ static QHostAddress getIPAddress()
*/
static bool initLocalUser(QString name, QString groupNumber)
{
localUserName = name;
localUserGroupNumber = groupNumber;
localIpAddress = getIPAddress();
::localUserName = name;
::localUserGroupNumber = groupNumber;
::localIpAddress = getIPAddress();

return true;
}

static QString getLocalUserName()
{
return localUserName;
return ::localUserName;
}
static void setLocalUserName(QString localUserName)
{
localUserName = localUserName;
::localUserName = localUserName;
}

static QString getLocalUserGroupNumber()
{
return localUserGroupNumber;
return ::localUserGroupNumber;
}
static void setLocalUserGroupNumber(QString localUserGroupNumber)
{
localUserGroupNumber = localUserGroupNumber;
::localUserGroupNumber = localUserGroupNumber;
}


static QHostAddress getLocalIpAddress()
{
return localIpAddress;
return ::localIpAddress;
}
static void setLocalIpAddress(QHostAddress localIpAddress)
{
localIpAddress = localIpAddress;
::localIpAddress = localIpAddress;
}

static qint16 getPortChatList()
{
return PORT_CHAT_LIST;
return ::PORT_CHAT_LIST;
}

/** Show ChatList Widget
* @brief initAndShowChatList
*/
static void initAndShowChatList(QWidget* parent)
{
chatList = new ChatList(parent, localUserName, localUserGroupNumber, localIpAddress);
chatList->show();
::chatList = new ChatList(parent, ::localUserName, ::localUserGroupNumber, ::localIpAddress);
::chatList->show();
}

}
Expand Down
4 changes: 2 additions & 2 deletions App/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
#include "tcpserver.h"

#include "db_localdata.h"
QString localUserName = ""; // User Name (get in user login)
QString localUserGroupNumber = ""; // Group number (get in user login)
QString localUserName = ""; // User Name (will get in user login)
QString localUserGroupNumber = ""; // Group number (will get in user login)
QHostAddress localIpAddress = QHostAddress();
ChatList* chatList = nullptr; // Widget ChatList (Only one)

Expand Down

0 comments on commit ffbf445

Please sign in to comment.