未调试的client
This commit is contained in:
parent
0676ee2391
commit
79cc0432e1
|
@ -1,6 +1,6 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!DOCTYPE QtCreatorProject>
|
<!DOCTYPE QtCreatorProject>
|
||||||
<!-- Written by QtCreator 6.0.2, 2023-01-06T22:44:04. -->
|
<!-- Written by QtCreator 6.0.2, 2023-01-07T14:28:20. -->
|
||||||
<qtcreator>
|
<qtcreator>
|
||||||
<data>
|
<data>
|
||||||
<variable>EnvironmentId</variable>
|
<variable>EnvironmentId</variable>
|
||||||
|
@ -8,7 +8,7 @@
|
||||||
</data>
|
</data>
|
||||||
<data>
|
<data>
|
||||||
<variable>ProjectExplorer.Project.ActiveTarget</variable>
|
<variable>ProjectExplorer.Project.ActiveTarget</variable>
|
||||||
<value type="qlonglong">0</value>
|
<value type="qlonglong">1</value>
|
||||||
</data>
|
</data>
|
||||||
<data>
|
<data>
|
||||||
<variable>ProjectExplorer.Project.EditorSettings</variable>
|
<variable>ProjectExplorer.Project.EditorSettings</variable>
|
||||||
|
@ -102,8 +102,93 @@
|
||||||
<value type="qlonglong" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
|
<value type="qlonglong" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
|
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
|
||||||
<value type="int" key="EnableQmlDebugging">0</value>
|
<value type="int" key="EnableQmlDebugging">0</value>
|
||||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">C:\Users\25761\Desktop\Error-in-"-Util.asciify("build-C:\Users\25761\Desktop\tcpclient\TcpClient-Desktop_Qt_6_2_3_MSVC2019_64bit-Debug")":-SyntaxError:-Expected-token-`)'</value>
|
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">C:\Users\25761\Desktop\Error-in-"-Util.asciify("build-C:\Users\25761\Desktop\tcpclient\TcpClient-Desktop_Qt_6_2_3_MSVC2019_64bit-Profile")":-SyntaxError:-Expected-token-`)'</value>
|
||||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">C:/Users/25761/Desktop/Error-in-"-Util.asciify("build-C:/Users/25761/Desktop/tcpclient/TcpClient-Desktop_Qt_6_2_3_MSVC2019_64bit-Debug")":-SyntaxError:-Expected-token-`)'</value>
|
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">C:/Users/25761/Desktop/Error-in-"-Util.asciify("build-C:/Users/25761/Desktop/tcpclient/TcpClient-Desktop_Qt_6_2_3_MSVC2019_64bit-Profile")":-SyntaxError:-Expected-token-`)'</value>
|
||||||
|
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
||||||
|
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
||||||
|
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
|
||||||
|
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
|
||||||
|
<valuelist type="QVariantList" key="QtProjectManager.QMakeBuildStep.SelectedAbis"/>
|
||||||
|
</valuemap>
|
||||||
|
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
|
||||||
|
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
||||||
|
</valuemap>
|
||||||
|
<value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Build</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
|
||||||
|
</valuemap>
|
||||||
|
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
|
||||||
|
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
||||||
|
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
||||||
|
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
|
||||||
|
</valuemap>
|
||||||
|
<value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Clean</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
|
||||||
|
</valuemap>
|
||||||
|
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
|
||||||
|
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
|
||||||
|
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.CustomParsers"/>
|
||||||
|
<value type="bool" key="ProjectExplorer.BuildConfiguration.ParseStandardOutput">false</value>
|
||||||
|
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Profile</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
|
||||||
|
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
|
||||||
|
<value type="int" key="QtQuickCompiler">0</value>
|
||||||
|
<value type="int" key="SeparateDebugInfo">0</value>
|
||||||
|
</valuemap>
|
||||||
|
<value type="qlonglong" key="ProjectExplorer.Target.BuildConfigurationCount">1</value>
|
||||||
|
<valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">
|
||||||
|
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
||||||
|
<value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Deploy</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
|
||||||
|
</valuemap>
|
||||||
|
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value>
|
||||||
|
<valuemap type="QVariantMap" key="ProjectExplorer.DeployConfiguration.CustomData"/>
|
||||||
|
<value type="bool" key="ProjectExplorer.DeployConfiguration.CustomDataEnabled">false</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value>
|
||||||
|
</valuemap>
|
||||||
|
<value type="qlonglong" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
|
||||||
|
<valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
|
||||||
|
<value type="bool" key="Analyzer.Perf.Settings.UseGlobalSettings">true</value>
|
||||||
|
<value type="bool" key="Analyzer.QmlProfiler.Settings.UseGlobalSettings">true</value>
|
||||||
|
<value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value>
|
||||||
|
<valuelist type="QVariantList" key="CustomOutputParsers"/>
|
||||||
|
<value type="int" key="PE.EnvironmentAspect.Base">2</value>
|
||||||
|
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:C:/Users/25761/Desktop/tcpclient/TcpClient.pro</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.RunConfiguration.BuildKey">C:/Users/25761/Desktop/tcpclient/TcpClient.pro</value>
|
||||||
|
<value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
|
||||||
|
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
|
||||||
|
<value type="bool" key="RunConfiguration.UseLibrarySearchPath">true</value>
|
||||||
|
<value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
|
||||||
|
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
|
||||||
|
<value type="QString" key="RunConfiguration.WorkingDirectory.default">C:/Users/25761/Desktop/Error-in-"-Util.asciify("build-C:/Users/25761/Desktop/tcpclient/TcpClient-Desktop_Qt_6_2_3_MSVC2019_64bit-Profile")":-SyntaxError:-Expected-token-`)'</value>
|
||||||
|
</valuemap>
|
||||||
|
<value type="qlonglong" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
|
||||||
|
</valuemap>
|
||||||
|
</data>
|
||||||
|
<data>
|
||||||
|
<variable>ProjectExplorer.Project.Target.1</variable>
|
||||||
|
<valuemap type="QVariantMap">
|
||||||
|
<value type="QString" key="DeviceType">Desktop</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop Qt 6.2.3 MinGW 64-bit</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop Qt 6.2.3 MinGW 64-bit</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">qt.qt6.623.win64_mingw_kit</value>
|
||||||
|
<value type="qlonglong" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
|
||||||
|
<value type="qlonglong" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
|
||||||
|
<value type="qlonglong" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
|
||||||
|
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
|
||||||
|
<value type="int" key="EnableQmlDebugging">0</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">C:\Users\25761\Desktop\build-TcpClient-Desktop_Qt_6_2_3_MinGW_64_bit-Debug</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">C:/Users/25761/Desktop/build-TcpClient-Desktop_Qt_6_2_3_MinGW_64_bit-Debug</value>
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
||||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||||
|
@ -141,8 +226,8 @@
|
||||||
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">2</value>
|
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">2</value>
|
||||||
</valuemap>
|
</valuemap>
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1">
|
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1">
|
||||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">C:\Users\25761\Desktop\Error-in-"-Util.asciify("build-C:\Users\25761\Desktop\tcpclient\TcpClient-Desktop_Qt_6_2_3_MSVC2019_64bit-Release")":-SyntaxError:-Expected-token-`)'</value>
|
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">C:\Users\25761\Desktop\build-TcpClient-Desktop_Qt_6_2_3_MinGW_64_bit-Release</value>
|
||||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">C:/Users/25761/Desktop/Error-in-"-Util.asciify("build-C:/Users/25761/Desktop/tcpclient/TcpClient-Desktop_Qt_6_2_3_MSVC2019_64bit-Release")":-SyntaxError:-Expected-token-`)'</value>
|
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">C:/Users/25761/Desktop/build-TcpClient-Desktop_Qt_6_2_3_MinGW_64_bit-Release</value>
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
||||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||||
|
@ -182,8 +267,8 @@
|
||||||
</valuemap>
|
</valuemap>
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.2">
|
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.2">
|
||||||
<value type="int" key="EnableQmlDebugging">0</value>
|
<value type="int" key="EnableQmlDebugging">0</value>
|
||||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">C:\Users\25761\Desktop\Error-in-"-Util.asciify("build-C:\Users\25761\Desktop\tcpclient\TcpClient-Desktop_Qt_6_2_3_MSVC2019_64bit-Profile")":-SyntaxError:-Expected-token-`)'</value>
|
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">C:\Users\25761\Desktop\build-TcpClient-Desktop_Qt_6_2_3_MinGW_64_bit-Profile</value>
|
||||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">C:/Users/25761/Desktop/Error-in-"-Util.asciify("build-C:/Users/25761/Desktop/tcpclient/TcpClient-Desktop_Qt_6_2_3_MSVC2019_64bit-Profile")":-SyntaxError:-Expected-token-`)'</value>
|
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">C:/Users/25761/Desktop/build-TcpClient-Desktop_Qt_6_2_3_MinGW_64_bit-Profile</value>
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
||||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||||
|
@ -243,21 +328,21 @@
|
||||||
<valuelist type="QVariantList" key="CustomOutputParsers"/>
|
<valuelist type="QVariantList" key="CustomOutputParsers"/>
|
||||||
<value type="int" key="PE.EnvironmentAspect.Base">2</value>
|
<value type="int" key="PE.EnvironmentAspect.Base">2</value>
|
||||||
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
|
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:C:\Users\25761\Desktop\tcpclient\TcpClient.pro</value>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:C:/Users/25761/Desktop/tcpclient/TcpClient.pro</value>
|
||||||
<value type="QString" key="ProjectExplorer.RunConfiguration.BuildKey">C:\Users\25761\Desktop\tcpclient\TcpClient.pro</value>
|
<value type="QString" key="ProjectExplorer.RunConfiguration.BuildKey">C:/Users/25761/Desktop/tcpclient/TcpClient.pro</value>
|
||||||
<value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
|
<value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
|
||||||
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
|
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
|
||||||
<value type="bool" key="RunConfiguration.UseLibrarySearchPath">true</value>
|
<value type="bool" key="RunConfiguration.UseLibrarySearchPath">true</value>
|
||||||
<value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
|
<value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
|
||||||
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
|
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
|
||||||
<value type="QString" key="RunConfiguration.WorkingDirectory.default">C:/Users/25761/Desktop/Error-in-"-Util.asciify("build-C:/Users/25761/Desktop/tcpclient/TcpClient-Desktop_Qt_6_2_3_MSVC2019_64bit-Debug")":-SyntaxError:-Expected-token-`)'</value>
|
<value type="QString" key="RunConfiguration.WorkingDirectory.default">C:/Users/25761/Desktop/build-TcpClient-Desktop_Qt_6_2_3_MinGW_64_bit-Debug</value>
|
||||||
</valuemap>
|
</valuemap>
|
||||||
<value type="qlonglong" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
|
<value type="qlonglong" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
|
||||||
</valuemap>
|
</valuemap>
|
||||||
</data>
|
</data>
|
||||||
<data>
|
<data>
|
||||||
<variable>ProjectExplorer.Project.TargetCount</variable>
|
<variable>ProjectExplorer.Project.TargetCount</variable>
|
||||||
<value type="qlonglong">1</value>
|
<value type="qlonglong">2</value>
|
||||||
</data>
|
</data>
|
||||||
<data>
|
<data>
|
||||||
<variable>ProjectExplorer.Project.Updater.FileVersion</variable>
|
<variable>ProjectExplorer.Project.Updater.FileVersion</variable>
|
||||||
|
|
|
@ -36,7 +36,7 @@ void DataManager::TCPClientDisconnected()
|
||||||
emit disconnect_from_server();
|
emit disconnect_from_server();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DataManager::recv_from_server(QByteArray &data)
|
void DataManager::recv_from_server(QByteArray data)
|
||||||
{
|
{
|
||||||
QByteArray data_decrypt;
|
QByteArray data_decrypt;
|
||||||
data_decrypt = protocol->data_decrypt(data);
|
data_decrypt = protocol->data_decrypt(data);
|
||||||
|
@ -54,7 +54,14 @@ void DataManager::recv_from_server(QByteArray &data)
|
||||||
sendname = json_data["sendname"].toString();
|
sendname = json_data["sendname"].toString();
|
||||||
filename = json_data["name"].toString();
|
filename = json_data["name"].toString();
|
||||||
file_data = json_data["data"].toString();
|
file_data = json_data["data"].toString();
|
||||||
emit update_file(sendname,filename,file_data);
|
if(json_data["to_user"].toString().isEmpty())
|
||||||
|
{
|
||||||
|
emit update_file(sendname,filename,file_data);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
emit update_file_private(sendname,filename,file_data);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (json_data["type"] == "online_users")
|
else if (json_data["type"] == "online_users")
|
||||||
{
|
{
|
||||||
|
@ -120,7 +127,7 @@ void DataManager::send_to_user(QString sendname,QString to_user,QString text)
|
||||||
void DataManager::send_file_to_all(QString sendname,QString filename,QByteArray file)
|
void DataManager::send_file_to_all(QString sendname,QString filename,QByteArray file)
|
||||||
{
|
{
|
||||||
QByteArray data,data_encrypt;
|
QByteArray data,data_encrypt;
|
||||||
data = protocol->data_maker(Protocol::FILE,sendname,filename,file);
|
data = protocol->data_maker(Protocol::FILE,sendname,filename,QString(file));
|
||||||
data_encrypt = protocol->data_encrypt(data);
|
data_encrypt = protocol->data_encrypt(data);
|
||||||
tcpclient->sendToserver(data_encrypt);
|
tcpclient->sendToserver(data_encrypt);
|
||||||
}
|
}
|
||||||
|
@ -128,7 +135,7 @@ void DataManager::send_file_to_all(QString sendname,QString filename,QByteArray
|
||||||
void DataManager::send_file_private(QString sendname,QString filename,QByteArray file,QString name)
|
void DataManager::send_file_private(QString sendname,QString filename,QByteArray file,QString name)
|
||||||
{
|
{
|
||||||
QByteArray data,data_encrypt;
|
QByteArray data,data_encrypt;
|
||||||
data = protocol->data_maker(Protocol::FILE,name,sendname,filename,file);
|
data = protocol->data_maker(Protocol::FILE,name,sendname,filename,QString(file));
|
||||||
data_encrypt = protocol->data_encrypt(data);
|
data_encrypt = protocol->data_encrypt(data);
|
||||||
tcpclient->sendToserver(data_encrypt);
|
tcpclient->sendToserver(data_encrypt);
|
||||||
}
|
}
|
||||||
|
@ -140,3 +147,11 @@ void DataManager::account_cancellation(QString username)
|
||||||
data_encrypt = protocol->data_encrypt(data);
|
data_encrypt = protocol->data_encrypt(data);
|
||||||
tcpclient->sendToserver(data_encrypt);
|
tcpclient->sendToserver(data_encrypt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DataManager::update_namelist()
|
||||||
|
{
|
||||||
|
QByteArray data,data_encrypt;
|
||||||
|
data = protocol->data_maker(Protocol::REQUEST,QString("update_namelist"));
|
||||||
|
data_encrypt = protocol->data_encrypt(data);
|
||||||
|
tcpclient->sendToserver(data_encrypt);
|
||||||
|
}
|
||||||
|
|
|
@ -30,6 +30,7 @@ signals:
|
||||||
void signup_response(bool result);
|
void signup_response(bool result);
|
||||||
void update_text(QString sendname,QString data);
|
void update_text(QString sendname,QString data);
|
||||||
void update_file(QString sendname,QString filename,QString file_data);
|
void update_file(QString sendname,QString filename,QString file_data);
|
||||||
|
void update_file_private(QString sendname,QString filename,QString file_data);
|
||||||
void update_users(int count,QList<QString>online_users);
|
void update_users(int count,QList<QString>online_users);
|
||||||
|
|
||||||
|
|
||||||
|
@ -43,12 +44,13 @@ public slots:
|
||||||
void send_to_user(QString sendname,QString to_user,QString text);
|
void send_to_user(QString sendname,QString to_user,QString text);
|
||||||
void send_file_to_all(QString sendname,QString filename,QByteArray file);
|
void send_file_to_all(QString sendname,QString filename,QByteArray file);
|
||||||
void send_file_private(QString sendname,QString filename,QByteArray file,QString name);
|
void send_file_private(QString sendname,QString filename,QByteArray file,QString name);
|
||||||
|
void update_namelist();
|
||||||
void account_cancellation(QString username);
|
void account_cancellation(QString username);
|
||||||
|
|
||||||
/******TCPClient******/
|
/******TCPClient******/
|
||||||
void TCPClientConnected();
|
void TCPClientConnected();
|
||||||
void TCPClientDisconnected();
|
void TCPClientDisconnected();
|
||||||
void recv_from_server(QByteArray &data);
|
void recv_from_server(QByteArray data);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -170,9 +170,11 @@ void Login::signin_response(bool result)
|
||||||
connect(mainwidget,&MainWidget::send_to_user,datamanager,&DataManager::send_to_user);
|
connect(mainwidget,&MainWidget::send_to_user,datamanager,&DataManager::send_to_user);
|
||||||
connect(mainwidget,&MainWidget::send_file_private,datamanager,&DataManager::send_file_private);
|
connect(mainwidget,&MainWidget::send_file_private,datamanager,&DataManager::send_file_private);
|
||||||
connect(mainwidget,&MainWidget::send_file_to_all,datamanager,&DataManager::send_file_to_all);
|
connect(mainwidget,&MainWidget::send_file_to_all,datamanager,&DataManager::send_file_to_all);
|
||||||
|
connect(mainwidget,&MainWidget::exit_client,datamanager,&DataManager::update_namelist);
|
||||||
connect(mainwidget,&MainWidget::account_cancellation,datamanager,&DataManager::account_cancellation);
|
connect(mainwidget,&MainWidget::account_cancellation,datamanager,&DataManager::account_cancellation);
|
||||||
connect(datamanager,&DataManager::update_text,mainwidget,&MainWidget::update_text);
|
connect(datamanager,&DataManager::update_text,mainwidget,&MainWidget::update_text);
|
||||||
connect(datamanager,&DataManager::update_file,mainwidget,&MainWidget::update_file);
|
connect(datamanager,&DataManager::update_file,mainwidget,&MainWidget::update_file);
|
||||||
|
connect(datamanager,&DataManager::update_file_private,mainwidget,&MainWidget::update_file_private);
|
||||||
connect(datamanager,&DataManager::update_users,mainwidget,&MainWidget::update_users);
|
connect(datamanager,&DataManager::update_users,mainwidget,&MainWidget::update_users);
|
||||||
connect(mainwidget,&MainWidget::exit_client,this,&Login::exit_client);
|
connect(mainwidget,&MainWidget::exit_client,this,&Login::exit_client);
|
||||||
this->hide();
|
this->hide();
|
||||||
|
|
112
mainwidget.cpp
112
mainwidget.cpp
|
@ -186,16 +186,79 @@ void MainWidget::on_stop_clicked()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWidget::update_text(QString sendname,QString data)
|
||||||
|
{
|
||||||
|
QString currentTime = QTime::currentTime().toString("H:m A");
|
||||||
|
ui->textEdit->append(sendname + " [" + currentTime + "] : " + data);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWidget::update_file(QString sendname,QString filename,QString file_data)
|
||||||
|
{
|
||||||
|
QMessageBox::StandardButton response;
|
||||||
|
QString content = QString("你收到了一个来自%1的群发文件%2,是否接收?").arg(sendname).arg(filename);
|
||||||
|
response = QMessageBox::question(this,"提示",content);
|
||||||
|
if(response == QMessageBox::Yes)
|
||||||
|
{
|
||||||
|
readFile(filename,file_data.toUtf8());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
QMessageBox::information(this,"消息","未接收该文件!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWidget::update_file_private(QString sendname,QString filename,QString file_data)
|
||||||
|
{
|
||||||
|
QMessageBox::StandardButton response;
|
||||||
|
QString content = QString("你收到了%1私发给你的文件%2,是否接收?").arg(sendname).arg(filename);
|
||||||
|
response = QMessageBox::question(this,"提示",content);
|
||||||
|
if(response == QMessageBox::Yes)
|
||||||
|
{
|
||||||
|
readFile(filename,file_data.toUtf8());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
QMessageBox::information(this,"消息","未接收该文件!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWidget::update_users(int count,QList<QString>online_users)
|
||||||
|
{
|
||||||
|
ui->name_list->clear();
|
||||||
|
QList<QString>::iterator it = online_users.begin();
|
||||||
|
for(; it!=online_users.end(); ++it)
|
||||||
|
{
|
||||||
|
ui->name_list->addItem(*it);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool MainWidget::eventFilter(QObject *target, QEvent *event)
|
||||||
|
{
|
||||||
|
if(target == ui->msg_edit) //可替换
|
||||||
|
{
|
||||||
|
if(event->type() == QEvent::KeyPress)//回车键
|
||||||
|
{
|
||||||
|
QKeyEvent *k = static_cast<QKeyEvent *>(event);
|
||||||
|
|
||||||
|
if(k->key() == Qt::Key_Return || k->key() == Qt::Key_Enter)
|
||||||
|
{
|
||||||
|
on_send_btn_clicked(); //替换为需要响应的函数事件,以这里的按钮为例
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return QWidget::eventFilter(target,event);
|
||||||
|
}
|
||||||
|
|
||||||
void MainWidget::sendFile(QString filePath,QString filename,QString name)
|
void MainWidget::sendFile(QString filePath,QString filename,QString name)
|
||||||
{
|
{
|
||||||
//通过fileTcpSocket发送文件
|
|
||||||
|
|
||||||
//发送的数据存入block中
|
//发送的数据存入block中
|
||||||
QByteArray block;
|
QByteArray block;
|
||||||
QFile file(filePath);
|
QFile file(filePath);
|
||||||
//打开文件,定义错误提醒
|
//打开文件,定义错误提醒
|
||||||
if(!file.open(QIODevice::ReadOnly)){
|
if(!file.open(QIODevice::ReadOnly)){
|
||||||
QMessageBox::warning(this,"","无法打开文件!");
|
QMessageBox::warning(this,"错误","无法打开文件!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//打开文件流,以写的方式打开
|
//打开文件流,以写的方式打开
|
||||||
|
@ -220,39 +283,22 @@ void MainWidget::sendFile(QString filePath,QString filename,QString name)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWidget::update_text(QString sendname,QString data)
|
void MainWidget::readFile(QString filename,QByteArray data)
|
||||||
{
|
|
||||||
QString currentTime = QTime::currentTime().toString("H:m A");
|
|
||||||
ui->textEdit->append(sendname + " [" + currentTime + "] : " + data);
|
|
||||||
}
|
|
||||||
|
|
||||||
void MainWidget::update_file(QString sendname,QString filename,QString file_data)
|
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
QString homePath = QDir::homePath();
|
||||||
|
QString filePath = QFileDialog::getExistingDirectory(this,
|
||||||
void MainWidget::update_users(int count,QList<QString>online_users)
|
tr("Open Directory"),
|
||||||
{
|
homePath,
|
||||||
|
QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks);
|
||||||
}
|
QFile outFile(filePath + "/" +filename);
|
||||||
|
if(!outFile.open(QIODevice::WriteOnly)){
|
||||||
bool MainWidget::eventFilter(QObject *target, QEvent *event)
|
QMessageBox::warning(this,"","错误: 无法打开文件.");
|
||||||
{
|
return;
|
||||||
if(target == ui->msg_edit) //可替换
|
|
||||||
{
|
|
||||||
if(event->type() == QEvent::KeyPress)//回车键
|
|
||||||
{
|
|
||||||
QKeyEvent *k = static_cast<QKeyEvent *>(event);
|
|
||||||
|
|
||||||
if(k->key() == Qt::Key_Return || k->key() == Qt::Key_Enter)
|
|
||||||
{
|
|
||||||
on_send_btn_clicked(); //替换为需要响应的函数事件,以这里的按钮为例
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return QWidget::eventFilter(target,event);
|
outFile.write(data);
|
||||||
|
outFile.close();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -25,6 +25,7 @@ public:
|
||||||
explicit MainWidget(QString username,QWidget *parent = nullptr);
|
explicit MainWidget(QString username,QWidget *parent = nullptr);
|
||||||
~MainWidget();
|
~MainWidget();
|
||||||
void sendFile(QString filePath,QString filename,QString name = "");
|
void sendFile(QString filePath,QString filename,QString name = "");
|
||||||
|
void readFile(QString filename,QByteArray data);
|
||||||
bool eventFilter(QObject *target, QEvent *event);
|
bool eventFilter(QObject *target, QEvent *event);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
@ -45,6 +46,7 @@ private slots:
|
||||||
public slots:
|
public slots:
|
||||||
void update_text(QString sendname,QString data);
|
void update_text(QString sendname,QString data);
|
||||||
void update_file(QString sendname,QString filename,QString file_data);
|
void update_file(QString sendname,QString filename,QString file_data);
|
||||||
|
void update_file_private(QString sendname,QString filename,QString file_data);
|
||||||
void update_users(int count,QList<QString>online_users);
|
void update_users(int count,QList<QString>online_users);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
Loading…
Reference in New Issue