Compare commits

...

8 Commits

Author SHA1 Message Date
yydcaib 2998f4097f
上传文件至 'imgs' 2023-01-19 13:52:49 +08:00
yydcaib ff385389a1
上传文件至 'imgs' 2023-01-19 13:52:03 +08:00
Msy-msu 0c8ec77be5 新增了消息提醒功能 2023-01-16 17:28:32 +08:00
Mentalflow 367173d1fc
Bug fixed. 2023-01-15 23:30:53 +08:00
Mentalflow 99d23522b2
Added missing files. 2023-01-15 21:33:10 +08:00
Mentalflow 8dc5fcc462
Add .gitignore and LICENSE. 2023-01-15 21:27:21 +08:00
Msy-msu 02f73ca641 增加了最小化至托盘相关代码 2023-01-15 21:13:39 +08:00
Msy-msu 84cbe95aed 做了一些修改 2023-01-15 17:17:33 +08:00
20 changed files with 405 additions and 330 deletions

172
.gitignore vendored Normal file
View File

@ -0,0 +1,172 @@
# ---> Qt
# C++ objects and libs
*.slo
*.lo
*.o
*.a
*.la
*.lai
*.so
*.so.*
*.dll
*.dylib
# Qt-es
object_script.*.Release
object_script.*.Debug
*_plugin_import.cpp
/.qmake.cache
/.qmake.stash
*.pro.user
*.pro.user.*
*.qbs.user
*.qbs.user.*
*.moc
moc_*.cpp
moc_*.h
qrc_*.cpp
ui_*.h
*.qmlc
*.jsc
Makefile*
*build-*
*.qm
*.prl
# Qt unit tests
target_wrapper.*
# QtCreator
*.autosave
# QtCreator Qml
*.qmlproject.user
*.qmlproject.user.*
# QtCreator CMake
CMakeLists.txt.user*
# QtCreator 4.8< compilation database
compile_commands.json
# QtCreator local machine specific files for imported projects
*creator.user*
*_qmlcache.qrc
# ---> C++
# Prerequisites
*.d
# Compiled Object files
*.slo
*.lo
*.o
*.obj
# Precompiled Headers
*.gch
*.pch
# Compiled Dynamic libraries
*.so
*.dylib
*.dll
# Fortran module files
*.mod
*.smod
# Compiled Static libraries
*.lai
*.la
*.a
*.lib
# Executables
*.exe
*.out
*.app
# ---> C
# Prerequisites
*.d
# Object files
*.o
*.ko
*.obj
*.elf
# Linker output
*.ilk
*.map
*.exp
# Precompiled Headers
*.gch
*.pch
# Libraries
*.lib
*.a
*.la
*.lo
# Shared objects (inc. Windows DLLs)
*.dll
*.so
*.so.*
*.dylib
# Executables
*.exe
*.out
*.app
*.i*86
*.x86_64
*.hex
# Debug files
*.dSYM/
*.su
*.idb
*.pdb
# Kernel Module Compile Results
*.mod*
*.cmd
.tmp_versions/
modules.order
Module.symvers
Mkfile.old
dkms.conf
# ---> macOS
# General
.DS_Store
.AppleDouble
.LSOverride
# Icon must end with two \r
Icon
# Thumbnails
._*
# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent
# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

9
LICENSE Normal file
View File

@ -0,0 +1,9 @@
MIT License
Copyright (c) <year> <copyright holders>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@ -1,4 +1,4 @@
QT += core gui network
QT += core gui network multimedia
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
@ -38,5 +38,5 @@ else: unix:!android: target.path = /opt/$${TARGET}/bin
RESOURCES += \
imgs/imgs.qrc
RC_ICON = imgs/exeicon.ico
RC_FILE += imgs/exeicon.rc
RC_ICON = imgs/icon.ico
RC_FILE += imgs/icon.rc

View File

@ -1,267 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 6.0.2, 2023-01-14T14:51:27. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>
<value type="QByteArray">{d3fed20c-1c94-44fc-8f6a-4dbf39b54775}</value>
</data>
<data>
<variable>ProjectExplorer.Project.ActiveTarget</variable>
<value type="qlonglong">0</value>
</data>
<data>
<variable>ProjectExplorer.Project.EditorSettings</variable>
<valuemap type="QVariantMap">
<value type="bool" key="EditorConfiguration.AutoIndent">true</value>
<value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value>
<value type="bool" key="EditorConfiguration.CamelCaseNavigation">true</value>
<valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0">
<value type="QString" key="language">Cpp</value>
<valuemap type="QVariantMap" key="value">
<value type="QByteArray" key="CurrentPreferences">CppGlobal</value>
</valuemap>
</valuemap>
<valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1">
<value type="QString" key="language">QmlJS</value>
<valuemap type="QVariantMap" key="value">
<value type="QByteArray" key="CurrentPreferences">QmlJSGlobal</value>
</valuemap>
</valuemap>
<value type="qlonglong" key="EditorConfiguration.CodeStyle.Count">2</value>
<value type="QByteArray" key="EditorConfiguration.Codec">UTF-8</value>
<value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value>
<value type="int" key="EditorConfiguration.IndentSize">4</value>
<value type="bool" key="EditorConfiguration.KeyboardTooltips">false</value>
<value type="int" key="EditorConfiguration.MarginColumn">80</value>
<value type="bool" key="EditorConfiguration.MouseHiding">true</value>
<value type="bool" key="EditorConfiguration.MouseNavigation">true</value>
<value type="int" key="EditorConfiguration.PaddingMode">1</value>
<value type="bool" key="EditorConfiguration.PreferSingleLineComments">false</value>
<value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value>
<value type="bool" key="EditorConfiguration.ShowMargin">false</value>
<value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value>
<value type="bool" key="EditorConfiguration.SmartSelectionChanging">true</value>
<value type="bool" key="EditorConfiguration.SpacesForTabs">true</value>
<value type="int" key="EditorConfiguration.TabKeyBehavior">0</value>
<value type="int" key="EditorConfiguration.TabSize">8</value>
<value type="bool" key="EditorConfiguration.UseGlobal">true</value>
<value type="bool" key="EditorConfiguration.UseIndenter">false</value>
<value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value>
<value type="bool" key="EditorConfiguration.addFinalNewLine">true</value>
<value type="bool" key="EditorConfiguration.cleanIndentation">true</value>
<value type="bool" key="EditorConfiguration.cleanWhitespace">true</value>
<value type="QString" key="EditorConfiguration.ignoreFileTypes">*.md, *.MD, Makefile</value>
<value type="bool" key="EditorConfiguration.inEntireDocument">false</value>
<value type="bool" key="EditorConfiguration.skipTrailingWhitespace">true</value>
</valuemap>
</data>
<data>
<variable>ProjectExplorer.Project.PluginSettings</variable>
<valuemap type="QVariantMap">
<valuemap type="QVariantMap" key="AutoTest.ActiveFrameworks">
<value type="bool" key="AutoTest.Framework.Boost">true</value>
<value type="bool" key="AutoTest.Framework.CTest">false</value>
<value type="bool" key="AutoTest.Framework.Catch">true</value>
<value type="bool" key="AutoTest.Framework.GTest">true</value>
<value type="bool" key="AutoTest.Framework.QtQuickTest">true</value>
<value type="bool" key="AutoTest.Framework.QtTest">true</value>
</valuemap>
<valuemap type="QVariantMap" key="AutoTest.CheckStates"/>
<value type="int" key="AutoTest.RunAfterBuild">0</value>
<value type="bool" key="AutoTest.UseGlobal">true</value>
<valuelist type="QVariantList" key="ClangCodeModel.CustomCommandLineKey">
<value type="QString">-fno-delayed-template-parsing</value>
</valuelist>
<value type="bool" key="ClangCodeModel.UseGlobalConfig">true</value>
<value type="QString" key="ClangCodeModel.WarningConfigId">Builtin.BuildSystem</value>
<valuemap type="QVariantMap" key="ClangTools">
<value type="bool" key="ClangTools.AnalyzeOpenFiles">true</value>
<value type="bool" key="ClangTools.BuildBeforeAnalysis">true</value>
<value type="QString" key="ClangTools.DiagnosticConfig">Builtin.DefaultTidyAndClazy</value>
<value type="int" key="ClangTools.ParallelJobs">4</value>
<valuelist type="QVariantList" key="ClangTools.SelectedDirs"/>
<valuelist type="QVariantList" key="ClangTools.SelectedFiles"/>
<valuelist type="QVariantList" key="ClangTools.SuppressedDiagnostics"/>
<value type="bool" key="ClangTools.UseGlobalSettings">true</value>
</valuemap>
</valuemap>
</data>
<data>
<variable>ProjectExplorer.Project.Target.0</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">2</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\Error-in-&quot;-Util.asciify(&quot;build-C:\Users\25761\Desktop\tcpclient\TcpClient-Desktop_Qt_6_2_3_MinGW_64_bit-Profile&quot;)&quot;:-SyntaxError:-Expected-token-`)'</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">C:/Users/25761/Desktop/Error-in-&quot;-Util.asciify(&quot;build-C:/Users/25761/Desktop/tcpclient/TcpClient-Desktop_Qt_6_2_3_MinGW_64_bit-Profile&quot;)&quot;:-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>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1">
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">C:\Users\25761\Desktop\Error-in-&quot;-Util.asciify(&quot;build-C:\Users\25761\Desktop\tcpclient\TcpClient-Desktop_Qt_6_2_3_MinGW_64_bit-111&quot;)&quot;:-SyntaxError:-Expected-token-`)'</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">C:/Users/25761/Desktop/Error-in-&quot;-Util.asciify(&quot;build-C:/Users/25761/Desktop/tcpclient/TcpClient-Desktop_Qt_6_2_3_MinGW_64_bit-111&quot;)&quot;:-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">111</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>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.2">
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">C:\Users\25761\Desktop\build-TcpClient-Desktop_Qt_6_2_3_MinGW_64_bit-111</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">C:/Users/25761/Desktop/build-TcpClient-Desktop_Qt_6_2_3_MinGW_64_bit-111</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">1112</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>
</valuemap>
<value type="qlonglong" key="ProjectExplorer.Target.BuildConfigurationCount">3</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/build-TcpClient-Desktop_Qt_6_2_3_MinGW_64_bit-111</value>
</valuemap>
<value type="qlonglong" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
</valuemap>
</data>
<data>
<variable>ProjectExplorer.Project.TargetCount</variable>
<value type="qlonglong">1</value>
</data>
<data>
<variable>ProjectExplorer.Project.Updater.FileVersion</variable>
<value type="int">22</value>
</data>
<data>
<variable>Version</variable>
<value type="int">22</value>
</data>
</qtcreator>

View File

@ -9,6 +9,7 @@ DataManager::DataManager(QObject *parent)
connect(tcpclient, &TCPClient::TCPClientDisconnected, this, &DataManager::TCPClientDisconnected);
connect(tcpclient, &TCPClient::recv_data, this, &DataManager::recv_from_server);
tcpclient->setServer("ourdocs.cn",35137);
tcpclient->setTimeOut(500);
tcpclient->configAndrun();
// tcpclient->setCallBack(recv_from_server);
protocol = Protocol::getInstance();
@ -46,6 +47,7 @@ void DataManager::recv_from_server(QByteArray data)
QJsonDocument json_data = QJsonDocument::fromJson(list[i]);
if (json_data["type"] == "message")
{
emit new_message();
QString data, sendname;
sendname = json_data["sendname"].toString();
data = json_data["data"].toString();
@ -54,6 +56,7 @@ void DataManager::recv_from_server(QByteArray data)
}
else if (json_data["type"] == "file")
{
emit new_message();
QString filename, file_data, sendname;
sendname = json_data["sendname"].toString();
filename = json_data["name"].toString();

View File

@ -26,6 +26,7 @@ private:
signals:
void connect_to_server();
void disconnect_from_server();
void new_message();
void signin_response(bool result);
void signup_response(bool result);
void update_text(QString sendname,QString data);

BIN
imgs/empty.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 908 B

BIN
imgs/icon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 9.6 KiB

1
imgs/icon.rc Normal file
View File

@ -0,0 +1 @@
IDI_ICON1 ICON DISCARDABLE "icon.ico"

View File

@ -11,5 +11,7 @@
<file>save.png</file>
<file>send.png</file>
<file>text.png</file>
<file>empty.png</file>
<file>remind.wav</file>
</qresource>
</RCC>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.7 KiB

After

Width:  |  Height:  |  Size: 16 KiB

BIN
imgs/remind.wav Normal file

Binary file not shown.

View File

@ -1,5 +1,6 @@
#include "login.h"
#include "ui_login.h"
#include <QPointer>
Login::Login(QWidget *parent) :
QMainWindow(parent),
@ -74,7 +75,7 @@ void Login::paintEvent(QPaintEvent *event)
// painter.drawPath(painterPath);
//设置阴影
QGraphicsDropShadowEffect *shadow = new QGraphicsDropShadowEffect(this);
QPointer<QGraphicsDropShadowEffect> shadow(new QGraphicsDropShadowEffect(this));
shadow->setOffset(0, 0); //设置阴影距离
shadow->setColor(QColor("#87CEFA")); //设置阴影颜色
shadow->setBlurRadius(10); //设置阴影圆角
@ -177,6 +178,7 @@ void Login::signin_response(bool result)
connect(datamanager,&DataManager::update_file_private,mainwidget,&MainWidget::update_file_private);
connect(datamanager,&DataManager::update_users,mainwidget,&MainWidget::update_users);
connect(datamanager,&DataManager::disconnect_from_server,mainwidget,&MainWidget::disconnect_form_server);
connect(datamanager,&DataManager::new_message,mainwidget,&MainWidget::slot_new_message);
connect(mainwidget,&MainWidget::exit_client,this,&Login::exit_client);
this->hide();
mainwidget->show();
@ -237,7 +239,7 @@ void Login::exit_client()
/************************************private functions************************************/
void Login::zoom_down(QPushButton* btn)
{
QPropertyAnimation *animalton = new QPropertyAnimation(btn,"geometry");
QScopedPointer<QPropertyAnimation> animalton(new QPropertyAnimation(btn,"geometry"));
//设置间隔时间
animalton->setDuration(200);
//设置起始位置
@ -252,7 +254,7 @@ void Login::zoom_down(QPushButton* btn)
void Login::zoom_up(QPushButton* btn)
{
QPropertyAnimation *animalton = new QPropertyAnimation(btn,"geometry");
QScopedPointer<QPropertyAnimation>animalton(new QPropertyAnimation(btn,"geometry"));
animalton->setDuration(200);
animalton->setStartValue(QRect(btn->x(),btn->y()+5,btn->width(),btn->height()));
animalton->setEndValue(QRect(btn->x(),btn->y(),btn->width(),btn->height()));

View File

@ -54,10 +54,10 @@ private:
QPoint point;
QString user,passwd;
static Login login_instance;
Login *login;
Signup *signup;
MainWidget *mainwidget;
DataManager *datamanager;
QPointer<Login> login;
QPointer<Signup> signup;
QPointer<MainWidget> mainwidget;
QPointer<DataManager> datamanager;
bool connect_flag = false;
void new_closebutton(QPushButton* btn, QString position,QSize size);

View File

@ -1,5 +1,6 @@
#include "mainwidget.h"
#include "ui_mainwidget.h"
#include <QPointer>
MainWidget::MainWidget(QString username,QWidget *parent) :
QWidget(parent),
@ -13,8 +14,9 @@ MainWidget::MainWidget(QString username,QWidget *parent) :
ui->name_list->setEditTriggers(QAbstractItemView::NoEditTriggers); //不允许编辑
//ui->name_list->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
ui->name_list->verticalScrollBar()->setStyleSheet("QScrollBar{width:16px;}");
//ui->name_list->verticalScrollBar()->setStyleSheet("QScrollBar{width:16px;}");
/****************文本显示栏初始设置********************/
ui->textEdit->setReadOnly(true);
ui->textEdit->setFocusPolicy(Qt::NoFocus);
//防止QTextBrowser中的内容被重定向
@ -44,6 +46,12 @@ MainWidget::MainWidget(QString username,QWidget *parent) :
ui->save_btn->setMouseTracking(true);
ui->save_btn->setToolTip(QStringLiteral("保存聊天记录"));
CreateSystemTray();
effect = new QSoundEffect(this);
effect->setSource(QUrl("qrc:/remind.wav"));
effect->setLoopCount(1);
effect->setVolume(0.95f);
ui->msg_edit->installEventFilter(this);//设置完后自动调用其eventFilter函数
this->username = username;
}
@ -78,7 +86,7 @@ void MainWidget::on_send_text_clicked()
QString currentTime = QTime::currentTime().toString("H:mm A");
QString html = "<a href=\"file:///" + filePath + "\">" + filename + "</a>";
qDebug() << html;
ui->textEdit->append("<span><font color=\"MediumBlue\"><b>" + username + " [" + currentTime + "] send a file \"" + html + "\"</b></font></span>");
ui->textEdit->append("<p><font color=\"MediumBlue\"><b>" + username + " [" + currentTime + "] send a file \"" + html + "\"</b></font></p>");
this->sendFile(filePath,filename);
}
else //私发文件
@ -108,7 +116,7 @@ void MainWidget::on_send_text_clicked()
QString currentTime = QTime::currentTime().toString("H:mm A");
QString html = "<a href=\"file:///" + filePath + "\">" + filename + "</a>";
qDebug() << html;
ui->textEdit->append("<span><font color=\"MediumBlue\"><b>" + username + " [" + currentTime + "] send " + name + " a private file \"" + html + "\"</b></font><span>");
ui->textEdit->append("<p><font color=\"MediumBlue\"><b>" + username + " [" + currentTime + "] send " + name + " a private file \"" + html + "\"</b></font><p>");
this->sendFile(filePath,filename,name);
}
}
@ -170,8 +178,7 @@ void MainWidget::on_send_btn_clicked()
{
zoom_down(ui->send_btn);
zoom_up(ui->send_btn);
QString text;
text = ui->msg_edit->text();
QString text = ui->msg_edit->text();
if(text.isEmpty())
{
QMessageBox::warning(this, "发送失败", "输入不能为空!");
@ -185,7 +192,7 @@ void MainWidget::on_send_btn_clicked()
QString to_user = text.mid(1,n-1);
QString insert = "tell you quietly:";
QString data_text = insert + text.mid(n,-1);
QString text_self = QString("私发给%1:%2").arg(to_user).arg(text.mid(n));
QString text_self = QString("私发给%1:%2").arg(to_user, text.mid(n));
qDebug() << text_self;
if(username == to_user)
{
@ -207,14 +214,14 @@ void MainWidget::on_send_btn_clicked()
else
{
QString currentTime = QTime::currentTime().toString("H:m A");
ui->textEdit->append("<span><font color=\"MediumBlue\"><b>" + username + " [" + currentTime + "] </b> " + text_self + "</font></span>");
ui->textEdit->append("<p><font color=\"MediumBlue\"><b>" + username + " [" + currentTime + "] </b> " + text_self + "</font></p>");
emit send_to_user(username,to_user,data_text);
}
}
else
{
QString currentTime = QTime::currentTime().toString("H:m A");
ui->textEdit->append("<span><font color=\"MediumBlue\"><b>" + username + " [" + currentTime + "] :</b> " + text + "</font></span>");
ui->textEdit->append("<p><font color=\"MediumBlue\"><b>" + username + " [" + currentTime + "] :</b> " + text + "</font></p>");
emit send_text(username,text);
}
}
@ -234,19 +241,7 @@ void MainWidget::on_exit_btn_clicked()
{
zoom_down(ui->exit_btn);
zoom_up(ui->exit_btn);
QMessageBox::StandardButton response;
response = QMessageBox::question(this, "退出", tr("是否退出软件?"));
if(response == QMessageBox::Yes)
{
//emit exit_client();
//emit update_namelist(username);
this->close();
}
else
{
return;
}
close();
}
void MainWidget::on_stop_clicked()
@ -272,7 +267,7 @@ void MainWidget::on_stop_clicked()
void MainWidget::update_text(QString sendname,QString data)
{
QString currentTime = QTime::currentTime().toString("H:m A");
ui->textEdit->append("<span>" + sendname + " [" + currentTime + "] : " + data + "</span>");
ui->textEdit->append("<p>" + sendname + " [" + currentTime + "] : " + data + "</p>");
qDebug() << sendname + " [" + currentTime + "] : " + data;
}
@ -281,7 +276,7 @@ void MainWidget::update_file(QString sendname,QString filename,QString file_data
readFile(filename,QByteArray::fromHex(file_data.toUtf8()));
QString currentTime = QTime::currentTime().toString("H:m A");
QString html = "<a href=\"file:///./Document/" + filename + "\">" + filename + "</a>";
QString msg = "<span>" + username + " [" + currentTime + "] : " + QString("收到了一个来自%1的群发文件:").arg(sendname) + html + "</span>";
QString msg = "<p>" + username + " [" + currentTime + "] : " + QString("收到了一个来自%1的群发文件:").arg(sendname) + html + "</p>";
ui->textEdit->append(msg);
qDebug() << msg;
}
@ -291,7 +286,7 @@ void MainWidget::update_file_private(QString sendname,QString filename,QString f
readFile(filename,QByteArray::fromHex(file_data.toUtf8()));
QString currentTime = QTime::currentTime().toString("H:m A");
QString html = "<a href=\"file:///./Document/" + filename + "\">" + filename + "</a>";
QString msg = "<span>" + username + " [" + currentTime + "] : " + QString("收到了一个来自%1的私发文件:").arg(sendname) + html + "</span>";
QString msg = "<p>" + username + " [" + currentTime + "] : " + QString("收到了一个来自%1的私发文件:").arg(sendname) + html + "</p>";
ui->textEdit->append(msg);
qDebug() << msg;
}
@ -350,11 +345,47 @@ void MainWidget::update_users(int count,QList<QString>online_users)
void MainWidget::disconnect_form_server()
{
QMessageBox::critical(this,"连接超时","请检查您的网络连接!");
qApp->quit();
}
void MainWidget::slot_new_message()
{
emit new_message();
}
void MainWidget::message_reminder()
{
QApplication::alert(this);// 任务栏通知
ui->textEdit->append("<span style=\"font-size:12px;color:LightGray;\">&nbsp;&nbsp;&nbsp;&nbsp;"
"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"
"—————————以下是新消息—————————\n</span>");
disconnect(this,&MainWidget::new_message,this,&MainWidget::message_reminder);
if (TimerFlash == NULL)
{
flashCount = 0;
TimerFlash = new QTimer(this);
connect(TimerFlash, &QTimer::timeout, this, &MainWidget::onFlashTimerOut);
TimerFlash->start(500);
}
}
void MainWidget::onFlashTimerOut()
{
flashCount++;
if (flashCount % 2 == 1)
{
SystemTray->setIcon(QIcon(":/empty.png"));
}
else
{
SystemTray->setIcon(QIcon(":/icon.png"));
}
}
void MainWidget::sendFile(QString filePath,QString filename,QString name)
{
//发送的数据存入block中
QByteArray block;
QFile file(filePath);
//打开文件,定义错误提醒
if(!file.open(QIODevice::ReadOnly)){
@ -362,10 +393,6 @@ void MainWidget::sendFile(QString filePath,QString filename,QString name)
return;
}
/*打开文件流,以写的方式打开
QDataStream out(&block,QIODevice::WriteOnly);
out.setVersion(QDataStream::Qt_5_8);*/
//将数据读取到QByteArray
QByteArray dataOfFile = file.readAll();
//关闭文件
@ -380,7 +407,7 @@ void MainWidget::sendFile(QString filePath,QString filename,QString name)
{
emit send_file_private(username,filename,dataOfFile,name);
}
QProgressDialog *progressDlg = new QProgressDialog(this);
QScopedPointer<QProgressDialog> progressDlg(new QProgressDialog(this));
progressDlg->setWindowModality(Qt::WindowModal);
progressDlg->setMinimumDuration(0);
progressDlg->setAttribute(Qt::WA_DeleteOnClose, true);
@ -402,9 +429,6 @@ void MainWidget::sendFile(QString filePath,QString filename,QString name)
void MainWidget::readFile(QString filename,QByteArray data)
{
/*QString homePath = QDir::homePath();
QString filePath = QFileDialog::getExistingDirectory(thistr("Open Directory"),homePath,
QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks);*/
QString filepath = "./Document";
QDir dir(filepath);
if(dir.exists())
@ -430,6 +454,79 @@ void MainWidget::readFile(QString filename,QByteArray data)
}
}
void MainWidget::CreateSystemTray()
{
//创建菜单对象和托盘图标对象
TrayMennu = new QMenu(this);
SystemTray = new QSystemTrayIcon(this);
//创建菜单项
ActionShow = new QAction(tr("Show"), this);
ActionQuit = new QAction(tr("Exit"), this);
connect(ActionShow,&QAction::triggered,this,[=](){
if(this->isMinimized())
{
this->showNormal();
}
this->show();
//SystemTray->hide();
});
connect(ActionQuit,&QAction::triggered,this,[=](){
qApp->quit();
});
connect(SystemTray,&QSystemTrayIcon::activated,this,[=](){
if(this->isMinimized())
{
this->showNormal();
}
this->show();
//SystemTray->hide();
});
//添加菜单项
TrayMennu->addAction(ActionShow);
TrayMennu->addSeparator();
TrayMennu->addAction(ActionQuit);
//为系统托盘设置菜单为m_pTrayMennu
SystemTray->setContextMenu(TrayMennu);
SystemTray->setIcon(QIcon(":/icon.png"));
SystemTray->show();
}
void MainWidget::zoom_down(QPushButton* btn)
{
QPointer<QPropertyAnimation> animalton(new QPropertyAnimation(btn,"geometry"));
animalton->setDuration(150);
animalton->setStartValue(QRect(btn->x(),btn->y(),btn->width(),btn->height()));
animalton->setEndValue(QRect(btn->x(),btn->y()+5,btn->width(),btn->height()));
animalton->setEasingCurve(QEasingCurve::OutBounce);
animalton->start();
}
void MainWidget::zoom_up(QPushButton* btn)
{
QPointer<QPropertyAnimation> animalton(new QPropertyAnimation(btn,"geometry"));
animalton->setDuration(150);
animalton->setStartValue(QRect(btn->x(),btn->y()+5,btn->width(),btn->height()));
animalton->setEndValue(QRect(btn->x(),btn->y(),btn->width(),btn->height()));
animalton->setEasingCurve(QEasingCurve::OutBounce);
animalton->start();
}
void MainWidget::changeEvent(QEvent *event)
{
if(event->type()!=QEvent::WindowStateChange)
return;
if(this->windowState()==Qt::WindowMinimized)
{
connect(this,&MainWidget::new_message,this,&MainWidget::message_reminder);
connect(this,&MainWidget::new_message,effect, &QSoundEffect::play);
}
}
bool MainWidget::eventFilter(QObject *target, QEvent *event)
{
if(target == ui->msg_edit) //可替换
@ -448,23 +545,43 @@ bool MainWidget::eventFilter(QObject *target, QEvent *event)
return QWidget::eventFilter(target,event);
}
void MainWidget::zoom_down(QPushButton* btn)
void MainWidget::showEvent(QShowEvent *event)
{
QPropertyAnimation *animalton = new QPropertyAnimation(btn,"geometry");
animalton->setDuration(150);
animalton->setStartValue(QRect(btn->x(),btn->y(),btn->width(),btn->height()));
animalton->setEndValue(QRect(btn->x(),btn->y()+5,btn->width(),btn->height()));
animalton->setEasingCurve(QEasingCurve::OutBounce);
animalton->start();
if(TimerFlash != NULL)
{
qDebug() << "有信息到来显示窗体";
disconnect(this,&MainWidget::new_message,effect, &QSoundEffect::play);
SystemTray->setIcon(QIcon(":/icon.png"));
delete TimerFlash;
TimerFlash = NULL;
}
}
void MainWidget::zoom_up(QPushButton* btn)
void MainWidget::closeEvent(QCloseEvent *event)
{
QPropertyAnimation *animalton = new QPropertyAnimation(btn,"geometry");
animalton->setDuration(150);
animalton->setStartValue(QRect(btn->x(),btn->y()+5,btn->width(),btn->height()));
animalton->setEndValue(QRect(btn->x(),btn->y(),btn->width(),btn->height()));
animalton->setEasingCurve(QEasingCurve::OutBounce);
animalton->start();
std::function<void(int)> callback;
callback = [=](int r)->void{
switch (r)
{
case QMessageBox::Ok:
{
event->accept();
qApp->quit();
break;
}
default:
{
event->ignore();
this->hide();
connect(this,&MainWidget::new_message,this,&MainWidget::message_reminder);
connect(this,&MainWidget::new_message,effect, &QSoundEffect::play);
break;
}
}
};
QMessageBox box(QMessageBox::Question,QString("退出"), QString("确定退出软件?否则将最小化窗口"),QMessageBox::Ok|QMessageBox::Cancel);
box.button(QMessageBox::Ok)->setText("");
box.button(QMessageBox::Cancel)->setText("");
callback(box.exec());
event->ignore();
}

View File

@ -4,6 +4,8 @@
#include <QWidget>
#include <QListWidgetItem>
#include <QList>
#include <QMenu>
#include <QSystemTrayIcon>
#include <QMessageBox>
#include <QTime>
#include <QFile>
@ -14,6 +16,8 @@
#include <QScrollBar>
#include <QKeyEvent>
#include <QDate>
#include <QSoundEffect>
#include <QTimer>
#include <QDesktopServices>
#include <QPropertyAnimation>
@ -40,6 +44,8 @@ signals:
void exit_client();
void update_namelist(QString username);
void account_cancellation(QString username);
void Minimized();
void new_message();
private slots:
void on_send_text_clicked();
@ -48,18 +54,39 @@ private slots:
void on_name_list_itemDoubleClicked(QListWidgetItem *item);
void on_exit_btn_clicked();
void on_stop_clicked();
void message_reminder();
void onFlashTimerOut();
public slots:
void update_text(QString sendname,QString 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 disconnect_form_server();
void slot_new_message();
private:
Ui::MainWidget *ui;
QString username;
QPointer<QMenu> TrayMennu; //系统托盘右键菜单项
QPointer<QSystemTrayIcon> SystemTray; //系统托盘图标
//右键菜单栏选项
QPointer<QAction> ActionShow;
QPointer<QAction> ActionQuit;
QPointer<QTimer> TimerNotice;
QPointer<QTimer> TimerFlash = NULL;
uint flashCount;
QPointer<QSoundEffect> effect;
void zoom_up(QPushButton* btn);
void zoom_down(QPushButton* btn);
void CreateSystemTray();
void showEvent(QShowEvent *event);
void closeEvent(QCloseEvent *event);
void changeEvent(QEvent *event);
};
#endif // MAINWIDGET_H

View File

@ -1,11 +1,12 @@
#include "signup.h"
#include "ui_signup.h"
#include <QPointer>
Signup::Signup(QWidget *parent) : QWidget(parent),
ui(new Ui::Signup)
{
ui->setupUi(this);
QPixmap *pix = new QPixmap(":/blue.png");
QScopedPointer<QPixmap> pix (new QPixmap(":/blue.png"));
QSize sz = ui->label_image->size();
ui->label_image->setPixmap(pix->scaled(sz));
@ -13,7 +14,7 @@ Signup::Signup(QWidget *parent) : QWidget(parent),
this->setWindowFlags(Qt::FramelessWindowHint); //无边框
//设置阴影
QGraphicsDropShadowEffect *shadow = new QGraphicsDropShadowEffect(this);
QPointer<QGraphicsDropShadowEffect> shadow (new QGraphicsDropShadowEffect(this));
shadow->setOffset(-3, 0);
shadow->setColor(QColor("#888888"));
shadow->setBlurRadius(30);
@ -22,7 +23,6 @@ Signup::Signup(QWidget *parent) : QWidget(parent),
Signup::~Signup()
{
emit
delete ui;
}

View File

@ -70,7 +70,7 @@ void TCPClient::readSocket()
while(socket.bytesAvailable())//循环接收
{
recv += socket.readAll();
if (!socket.waitForReadyRead(500))//超时停止接收
if (!socket.waitForReadyRead(_timeout))//超时停止接收
{
/*QString error = sock->errorString();
string error_t = error.toStdString();
@ -87,6 +87,12 @@ void TCPClient::readSocket()
emit recv_data(recv);
}
void TCPClient::setTimeOut(int timeout)
{
_timeout = timeout;
}
void TCPClient::setCallBack(void (*callback)(QString &mac, quint16 port, QByteArray &data))
{
_callback = callback;

View File

@ -14,6 +14,7 @@ public:
void configAndrun();
void setCallBack(void (*callback)(QString &ip, quint16 port,QByteArray &data));
void setServer(QString IP, quint16 port);
void setTimeOut(int timeout);
private slots:
void readSocket();
void connected();
@ -24,6 +25,7 @@ private:
static void _sleep(int msec);
static QTcpSocket socket;
static TCPClient tcpclient_instance;
int _timeout = 20;
QString server_ip = "127.0.0.1";
quint16 server_port = 7890;
bool has_found = false;