mirror of
https://github.com/barry-ran/QtScrcpy.git
synced 2025-07-31 21:08:38 +00:00
初次提交
This commit is contained in:
parent
66c811566e
commit
3d7db41aff
10 changed files with 941 additions and 0 deletions
39
src/QtScrcpy.pro
Normal file
39
src/QtScrcpy.pro
Normal file
|
@ -0,0 +1,39 @@
|
|||
#-------------------------------------------------
|
||||
#
|
||||
# Project created by QtCreator 2018-10-07T12:36:10
|
||||
#
|
||||
#-------------------------------------------------
|
||||
|
||||
QT += core gui
|
||||
QT += network
|
||||
|
||||
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
|
||||
|
||||
TARGET = QtScrcpy
|
||||
TEMPLATE = app
|
||||
|
||||
# The following define makes your compiler emit warnings if you use
|
||||
# any feature of Qt which has been marked as deprecated (the exact warnings
|
||||
# depend on your compiler). Please consult the documentation of the
|
||||
# deprecated API in order to know how to port your code away from it.
|
||||
DEFINES += QT_DEPRECATED_WARNINGS
|
||||
|
||||
# You can also make your code fail to compile if you use deprecated APIs.
|
||||
# In order to do so, uncomment the following line.
|
||||
# You can also select to disable deprecated APIs only up to a certain version of Qt.
|
||||
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
|
||||
|
||||
|
||||
SOURCES += \
|
||||
main.cpp \
|
||||
dialog.cpp \
|
||||
adbprocess.cpp \
|
||||
server.cpp
|
||||
|
||||
HEADERS += \
|
||||
dialog.h \
|
||||
adbprocess.h \
|
||||
server.h
|
||||
|
||||
FORMS += \
|
||||
dialog.ui
|
318
src/QtScrcpy.pro.user
Normal file
318
src/QtScrcpy.pro.user
Normal file
|
@ -0,0 +1,318 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE QtCreatorProject>
|
||||
<!-- Written by QtCreator 4.6.2, 2018-10-09T23:46:57. -->
|
||||
<qtcreator>
|
||||
<data>
|
||||
<variable>EnvironmentId</variable>
|
||||
<value type="QByteArray">{49c3991c-71bb-4f46-826d-1d1cf5cba2d4}</value>
|
||||
</data>
|
||||
<data>
|
||||
<variable>ProjectExplorer.Project.ActiveTarget</variable>
|
||||
<value type="int">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="int" 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.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="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="bool" key="EditorConfiguration.inEntireDocument">false</value>
|
||||
</valuemap>
|
||||
</data>
|
||||
<data>
|
||||
<variable>ProjectExplorer.Project.PluginSettings</variable>
|
||||
<valuemap type="QVariantMap"/>
|
||||
</data>
|
||||
<data>
|
||||
<variable>ProjectExplorer.Project.Target.0</variable>
|
||||
<valuemap type="QVariantMap">
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop Qt 5.9.6 MSVC2015 32bit</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop Qt 5.9.6 MSVC2015 32bit</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">qt.596.win32_msvc2015_kit</value>
|
||||
<value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
|
||||
<value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
|
||||
<value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
|
||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">G:/QT/code/build-QtScrcpy-Desktop_Qt_5_9_6_MSVC2015_32bit-Debug</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.DefaultDisplayName">qmake</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
|
||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">true</value>
|
||||
<value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
|
||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
|
||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.SeparateDebugInfo">false</value>
|
||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.UseQtQuickCompiler">false</value>
|
||||
</valuemap>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
|
||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
||||
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"/>
|
||||
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
|
||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
|
||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></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.DefaultDisplayName">Make</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
||||
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"/>
|
||||
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
|
||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
|
||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></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.UserEnvironmentChanges"/>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Debug</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Debug</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
|
||||
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">2</value>
|
||||
<value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
|
||||
</valuemap>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1">
|
||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">G:/QT/code/build-QtScrcpy-Desktop_Qt_5_9_6_MSVC2015_32bit-Release</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.DefaultDisplayName">qmake</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
|
||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>
|
||||
<value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
|
||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
|
||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.SeparateDebugInfo">false</value>
|
||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.UseQtQuickCompiler">false</value>
|
||||
</valuemap>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
|
||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
||||
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"/>
|
||||
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
|
||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
|
||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></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.DefaultDisplayName">Make</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
||||
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"/>
|
||||
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
|
||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
|
||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></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.UserEnvironmentChanges"/>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Release</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Release</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
|
||||
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
|
||||
<value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
|
||||
</valuemap>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.2">
|
||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">G:/QT/code/build-QtScrcpy-Desktop_Qt_5_9_6_MSVC2015_32bit-Profile</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.DefaultDisplayName">qmake</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
|
||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">true</value>
|
||||
<value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
|
||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
|
||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.SeparateDebugInfo">true</value>
|
||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.UseQtQuickCompiler">false</value>
|
||||
</valuemap>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
|
||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
||||
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"/>
|
||||
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
|
||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
|
||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></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.DefaultDisplayName">Make</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
||||
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"/>
|
||||
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
|
||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
|
||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></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.UserEnvironmentChanges"/>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Profile</value>
|
||||
<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="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">3</value>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
||||
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">部署</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">部署设置</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
|
||||
<value type="bool" key="Analyzer.QmlProfiler.AggregateTraces">false</value>
|
||||
<value type="bool" key="Analyzer.QmlProfiler.FlushEnabled">false</value>
|
||||
<value type="uint" key="Analyzer.QmlProfiler.FlushInterval">1000</value>
|
||||
<value type="QString" key="Analyzer.QmlProfiler.LastTraceFile"></value>
|
||||
<value type="bool" key="Analyzer.QmlProfiler.Settings.UseGlobalSettings">true</value>
|
||||
<valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
|
||||
<value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
|
||||
<value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
|
||||
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
|
||||
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
|
||||
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
|
||||
<value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
|
||||
<value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
|
||||
<value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
|
||||
<value type="int" key="Analyzer.Valgrind.LeakCheckOnFinish">1</value>
|
||||
<value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
|
||||
<valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
|
||||
<value type="int" key="Analyzer.Valgrind.SelfModifyingCodeDetection">1</value>
|
||||
<value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value>
|
||||
<value type="bool" key="Analyzer.Valgrind.ShowReachable">false</value>
|
||||
<value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
|
||||
<value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
|
||||
<valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
|
||||
<value type="int">0</value>
|
||||
<value type="int">1</value>
|
||||
<value type="int">2</value>
|
||||
<value type="int">3</value>
|
||||
<value type="int">4</value>
|
||||
<value type="int">5</value>
|
||||
<value type="int">6</value>
|
||||
<value type="int">7</value>
|
||||
<value type="int">8</value>
|
||||
<value type="int">9</value>
|
||||
<value type="int">10</value>
|
||||
<value type="int">11</value>
|
||||
<value type="int">12</value>
|
||||
<value type="int">13</value>
|
||||
<value type="int">14</value>
|
||||
</valuelist>
|
||||
<value type="int" key="PE.EnvironmentAspect.Base">2</value>
|
||||
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">QtScrcpy</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:G:/QT/code/QtScrcpy/QtScrcpy.pro</value>
|
||||
<value type="bool" key="QmakeProjectManager.QmakeRunConfiguration.UseLibrarySearchPath">true</value>
|
||||
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"></value>
|
||||
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">QtScrcpy.pro</value>
|
||||
<value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value>
|
||||
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"></value>
|
||||
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory.default">G:/QT/code/build-QtScrcpy-Desktop_Qt_5_9_6_MSVC2015_32bit-Debug</value>
|
||||
<value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
|
||||
<value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
|
||||
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
|
||||
<value type="bool" key="RunConfiguration.UseMultiProcess">false</value>
|
||||
<value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
|
||||
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
|
||||
</valuemap>
|
||||
</data>
|
||||
<data>
|
||||
<variable>ProjectExplorer.Project.TargetCount</variable>
|
||||
<value type="int">1</value>
|
||||
</data>
|
||||
<data>
|
||||
<variable>ProjectExplorer.Project.Updater.FileVersion</variable>
|
||||
<value type="int">18</value>
|
||||
</data>
|
||||
<data>
|
||||
<variable>Version</variable>
|
||||
<value type="int">18</value>
|
||||
</data>
|
||||
</qtcreator>
|
160
src/adbprocess.cpp
Normal file
160
src/adbprocess.cpp
Normal file
|
@ -0,0 +1,160 @@
|
|||
#include "adbprocess.h"
|
||||
|
||||
#include <QProcess>
|
||||
#include <QCoreApplication>
|
||||
#include <QDebug>
|
||||
|
||||
QString AdbProcess::s_adbPath = "";
|
||||
|
||||
AdbProcess::AdbProcess(QObject *parent)
|
||||
: QProcess(parent)
|
||||
{
|
||||
initSignals();
|
||||
}
|
||||
|
||||
AdbProcess::~AdbProcess()
|
||||
{
|
||||
if (isRuning()) {
|
||||
close();
|
||||
}
|
||||
}
|
||||
|
||||
const QString& AdbProcess::getAdbPath()
|
||||
{
|
||||
if (s_adbPath.isEmpty()) {
|
||||
s_adbPath = QString::fromLocal8Bit(qgetenv("QTSCRCPY_ADB_PATH"));
|
||||
if (s_adbPath.isEmpty()) {
|
||||
s_adbPath = "adb";
|
||||
}
|
||||
}
|
||||
return s_adbPath;
|
||||
}
|
||||
|
||||
void AdbProcess::initSignals()
|
||||
{
|
||||
// aboutToQuit not exit event loop, so deletelater is ok
|
||||
//connect(QCoreApplication::instance(), &QCoreApplication::aboutToQuit, this, &AdbProcess::deleteLater);
|
||||
|
||||
connect(this, static_cast<void(QProcess::*)(int, QProcess::ExitStatus)>(&QProcess::finished), this,
|
||||
[this](int exitCode, QProcess::ExitStatus exitStatus){
|
||||
if (NormalExit == exitStatus && 0 == exitCode) {
|
||||
emit adbProcessResult(AER_SUCCESS);
|
||||
} else {
|
||||
emit adbProcessResult(AER_ERROR_CMD);
|
||||
}
|
||||
|
||||
qDebug() << ">>>>>>>>" << __FUNCTION__;
|
||||
qDebug() << "adb return " << exitCode << "exit status " << exitStatus;
|
||||
});
|
||||
|
||||
connect(this, &QProcess::errorOccurred, this,
|
||||
[this](QProcess::ProcessError error){
|
||||
if (QProcess::FailedToStart == error) {
|
||||
emit adbProcessResult(AER_ERROR_MISSING_BINARY);
|
||||
} else {
|
||||
emit adbProcessResult(AER_ERROR_START);
|
||||
QString err = QString("qprocess start error:%1 %2").arg(program()).arg(arguments().join(" "));
|
||||
qCritical(err.toStdString().c_str());
|
||||
}
|
||||
});
|
||||
|
||||
connect(this, &QProcess::readyReadStandardError, this,
|
||||
[this](){
|
||||
qDebug() << ">>>>>>>>" << __FUNCTION__;
|
||||
qDebug() << QString::fromLocal8Bit(readAllStandardError());
|
||||
});
|
||||
|
||||
connect(this, &QProcess::readyReadStandardOutput, this,
|
||||
[this](){
|
||||
qDebug() << ">>>>>>>>" << __FUNCTION__;
|
||||
qDebug() << QString::fromLocal8Bit(readAllStandardOutput());
|
||||
});
|
||||
|
||||
connect(this, &QProcess::started, this,
|
||||
[this](){
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
void AdbProcess::execute(const QString& serial, const QStringList& args)
|
||||
{
|
||||
QStringList adbArgs;
|
||||
if (!serial.isEmpty()) {
|
||||
adbArgs << "-s" << serial;
|
||||
}
|
||||
adbArgs << args;
|
||||
start(getAdbPath(), adbArgs);
|
||||
//start("C:\\Users\\Barry\\Desktop\\sockettool.exe", Q_NULLPTR);
|
||||
}
|
||||
|
||||
bool AdbProcess::isRuning()
|
||||
{
|
||||
if (QProcess::NotRunning == state()) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
void AdbProcess::forward(const QString& serial, quint16 localPort, const QString& deviceSocketName)
|
||||
{
|
||||
QStringList adbArgs;
|
||||
adbArgs << "forward";
|
||||
adbArgs << QString("tcp:%1").arg(localPort);
|
||||
adbArgs << QString("localabstract:%1").arg(deviceSocketName);
|
||||
execute(serial, adbArgs);
|
||||
}
|
||||
|
||||
void AdbProcess::forwardRemove(const QString& serial, quint16 localPort)
|
||||
{
|
||||
QStringList adbArgs;
|
||||
adbArgs << "forward";
|
||||
adbArgs << "--remove";
|
||||
adbArgs << QString("tcp:%1").arg(localPort);
|
||||
execute(serial, adbArgs);
|
||||
}
|
||||
|
||||
void AdbProcess::reverse(const QString& serial, const QString& deviceSocketName, quint16 localPort)
|
||||
{
|
||||
QStringList adbArgs;
|
||||
adbArgs << "reverse";
|
||||
adbArgs << QString("localabstract:%1").arg(deviceSocketName);
|
||||
adbArgs << QString("tcp:%1").arg(localPort);
|
||||
execute(serial, adbArgs);
|
||||
}
|
||||
|
||||
void AdbProcess::reverseRemove(const QString& serial, const QString& deviceSocketName)
|
||||
{
|
||||
QStringList adbArgs;
|
||||
adbArgs << "reverse";
|
||||
adbArgs << "--remove";
|
||||
adbArgs << QString("localabstract:%1").arg(deviceSocketName);
|
||||
execute(serial, adbArgs);
|
||||
}
|
||||
|
||||
void AdbProcess::push(const QString& serial, const QString& local, const QString& remote)
|
||||
{
|
||||
QStringList adbArgs;
|
||||
adbArgs << "push";
|
||||
adbArgs << local;
|
||||
adbArgs << remote;
|
||||
execute(serial, adbArgs);
|
||||
}
|
||||
|
||||
void AdbProcess::install(const QString& serial, const QString& local)
|
||||
{
|
||||
QStringList adbArgs;
|
||||
adbArgs << "install";
|
||||
adbArgs << "-r";
|
||||
adbArgs << local;
|
||||
execute(serial, adbArgs);
|
||||
}
|
||||
|
||||
void AdbProcess::removePath(const QString& serial, const QString& path)
|
||||
{
|
||||
QStringList adbArgs;
|
||||
adbArgs << "shell";
|
||||
adbArgs << "rm";
|
||||
adbArgs << path;
|
||||
execute(serial, adbArgs);
|
||||
}
|
42
src/adbprocess.h
Normal file
42
src/adbprocess.h
Normal file
|
@ -0,0 +1,42 @@
|
|||
#ifndef ADBPROCESS_H
|
||||
#define ADBPROCESS_H
|
||||
|
||||
#include <QProcess>
|
||||
|
||||
class AdbProcess : public QProcess
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
enum ADB_EXEC_RESULT {
|
||||
AER_SUCCESS, // 执行成功
|
||||
AER_ERROR_START, // 启动失败
|
||||
AER_ERROR_CMD, // 命令执行失败
|
||||
AER_ERROR_MISSING_BINARY, // 找不到文件
|
||||
};
|
||||
|
||||
explicit AdbProcess(QObject *parent = nullptr);
|
||||
~AdbProcess();
|
||||
|
||||
void execute(const QString& serial, const QStringList& args);
|
||||
void forward(const QString& serial, quint16 localPort, const QString& deviceSocketName);
|
||||
void forwardRemove(const QString& serial, quint16 localPort);
|
||||
void reverse(const QString& serial, const QString& deviceSocketName, quint16 localPort);
|
||||
void reverseRemove(const QString& serial, const QString& deviceSocketName);
|
||||
void push(const QString& serial, const QString& local, const QString& remote);
|
||||
void install(const QString& serial, const QString& local);
|
||||
void removePath(const QString& serial, const QString& path);
|
||||
bool isRuning();
|
||||
|
||||
static const QString& getAdbPath();
|
||||
|
||||
signals:
|
||||
void adbProcessResult(ADB_EXEC_RESULT processResult);
|
||||
|
||||
private:
|
||||
void initSignals();
|
||||
|
||||
static QString s_adbPath;
|
||||
};
|
||||
|
||||
#endif // ADBPROCESS_H
|
24
src/dialog.cpp
Normal file
24
src/dialog.cpp
Normal file
|
@ -0,0 +1,24 @@
|
|||
#include "dialog.h"
|
||||
#include "ui_dialog.h"
|
||||
#include "adbprocess.h"
|
||||
|
||||
Dialog::Dialog(QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::Dialog)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
}
|
||||
|
||||
Dialog::~Dialog()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void Dialog::on_adbProcess_clicked()
|
||||
{
|
||||
AdbProcess* adb = new AdbProcess();
|
||||
connect(adb, &AdbProcess::adbProcessResult, this, [this](AdbProcess::ADB_EXEC_RESULT processResult){
|
||||
sender()->deleteLater();
|
||||
});
|
||||
adb->execute("", QStringList() << "devices");
|
||||
}
|
25
src/dialog.h
Normal file
25
src/dialog.h
Normal file
|
@ -0,0 +1,25 @@
|
|||
#ifndef DIALOG_H
|
||||
#define DIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
namespace Ui {
|
||||
class Dialog;
|
||||
}
|
||||
|
||||
class Dialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit Dialog(QWidget *parent = 0);
|
||||
~Dialog();
|
||||
|
||||
private slots:
|
||||
void on_adbProcess_clicked();
|
||||
|
||||
private:
|
||||
Ui::Dialog *ui;
|
||||
};
|
||||
|
||||
#endif // DIALOG_H
|
33
src/dialog.ui
Normal file
33
src/dialog.ui
Normal file
|
@ -0,0 +1,33 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>Dialog</class>
|
||||
<widget class="QDialog" name="Dialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>300</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Dialog</string>
|
||||
</property>
|
||||
<widget class="QPushButton" name="adbProcess">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>30</x>
|
||||
<y>20</y>
|
||||
<width>93</width>
|
||||
<height>28</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>PushButton</string>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<layoutdefault spacing="6" margin="11"/>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
17
src/main.cpp
Normal file
17
src/main.cpp
Normal file
|
@ -0,0 +1,17 @@
|
|||
#include "dialog.h"
|
||||
|
||||
#include <QApplication>
|
||||
#include <QDebug>
|
||||
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QApplication a(argc, argv);
|
||||
|
||||
qputenv("QTSCRCPY_ADB_PATH", "C:\\Users\\Barry\\Desktop\\scrcpy-win64\\adb.exe");
|
||||
|
||||
Dialog w;
|
||||
w.show();
|
||||
|
||||
return a.exec();
|
||||
}
|
221
src/server.cpp
Normal file
221
src/server.cpp
Normal file
|
@ -0,0 +1,221 @@
|
|||
#include <QDebug>
|
||||
|
||||
#include "server.h"
|
||||
|
||||
#define DEVICE_SERVER_PATH "/data/local/tmp/scrcpy-server.jar"
|
||||
#define SOCKET_NAME "qtscrcpy"
|
||||
|
||||
Server::Server(QObject *parent) : QObject(parent)
|
||||
{
|
||||
connect(&m_workProcess, &AdbProcess::adbProcessResult, this, &Server::onWorkProcessResult);
|
||||
}
|
||||
|
||||
const QString& Server::getServerPath()
|
||||
{
|
||||
if (m_serverPath.isEmpty()) {
|
||||
m_serverPath = QString::fromLocal8Bit(qgetenv("QTSCRCPY_SERVER_PATH"));
|
||||
if (m_serverPath.isEmpty()) {
|
||||
m_serverPath = "scrcpy-server.jar";
|
||||
}
|
||||
}
|
||||
return m_serverPath;
|
||||
}
|
||||
|
||||
bool Server::pushServer()
|
||||
{
|
||||
if (m_workProcess.isRuning()) {
|
||||
m_workProcess.kill();
|
||||
}
|
||||
m_workProcess.push(m_serial, getServerPath(), DEVICE_SERVER_PATH);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Server::removeServer()
|
||||
{
|
||||
if (m_workProcess.isRuning()) {
|
||||
m_workProcess.kill();
|
||||
}
|
||||
m_workProcess.removePath(m_serial, DEVICE_SERVER_PATH);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Server::enableTunnelReverse()
|
||||
{
|
||||
if (m_workProcess.isRuning()) {
|
||||
m_workProcess.kill();
|
||||
}
|
||||
m_workProcess.reverse(m_serial, SOCKET_NAME, m_localPort);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Server::disableTunnelReverse()
|
||||
{
|
||||
if (m_workProcess.isRuning()) {
|
||||
m_workProcess.kill();
|
||||
}
|
||||
m_workProcess.reverseRemove(m_serial, SOCKET_NAME);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Server::enableTunnelForward()
|
||||
{
|
||||
if (m_workProcess.isRuning()) {
|
||||
m_workProcess.kill();
|
||||
}
|
||||
m_workProcess.forward(m_serial, m_localPort, SOCKET_NAME);
|
||||
return true;
|
||||
}
|
||||
bool Server::disableTunnelForward()
|
||||
{
|
||||
if (m_workProcess.isRuning()) {
|
||||
m_workProcess.kill();
|
||||
}
|
||||
m_workProcess.forwardRemove(m_serial, m_localPort);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Server::execute()
|
||||
{
|
||||
AdbProcess* adb = new AdbProcess();
|
||||
if (!adb) {
|
||||
return false;
|
||||
}
|
||||
QStringList args;
|
||||
args << "shell";
|
||||
args << QString("CLASSPATH=%1").arg(DEVICE_SERVER_PATH);
|
||||
args << "app_process";
|
||||
args << "/"; // unused;
|
||||
args << "com.genymobile.scrcpy.Server";
|
||||
args << QString::number(m_maxSize);
|
||||
args << QString::number(m_bitRate);
|
||||
args << (m_tunnelForward ? "true" : "false");
|
||||
args << (m_crop.isEmpty() ? "" : m_crop);
|
||||
|
||||
connect(adb, &AdbProcess::adbProcessResult, this, [this](AdbProcess::ADB_EXEC_RESULT processResult){
|
||||
if (AdbProcess::AER_SUCCESS == processResult) {
|
||||
|
||||
}
|
||||
sender()->deleteLater();
|
||||
});
|
||||
adb->execute(m_serial, args);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Server::start(const QString& serial, quint16 localPort, quint16 maxSize, quint32 bitRate, const QString& crop)
|
||||
{
|
||||
if (serial.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
m_localPort = localPort;
|
||||
m_maxSize = maxSize;
|
||||
m_bitRate = bitRate;
|
||||
m_crop = crop;
|
||||
|
||||
m_serverStartStep = SSS_PUSH;
|
||||
return startServerByStep();
|
||||
}
|
||||
|
||||
bool Server::startServerByStep()
|
||||
{
|
||||
// push, enable tunnel et start the server
|
||||
if (SSS_NULL != m_serverStartStep) {
|
||||
switch (m_serverStartStep) {
|
||||
case SSS_PUSH:
|
||||
return pushServer();
|
||||
case SSS_ENABLE_TUNNEL_REVERSE:
|
||||
return enableTunnelReverse();
|
||||
break;
|
||||
case SSS_ENABLE_TUNNEL_FORWARD:
|
||||
return enableTunnelForward();
|
||||
break;
|
||||
case SSS_EXECUTE_SERVER:
|
||||
// if "adb reverse" does not work (e.g. over "adb connect"), it fallbacks to
|
||||
// "adb forward", so the app socket is the client
|
||||
if (m_tunnelForward) {
|
||||
// At the application level, the device part is "the server" because it
|
||||
// serves video stream and control. However, at the network level, the
|
||||
// client listens and the server connects to the client. That way, the
|
||||
// client can listen before starting the server app, so there is no need to
|
||||
// try to connect until the server socket is listening on the device.
|
||||
m_serverSocket.setMaxPendingConnections(1);
|
||||
if (!m_serverSocket.listen(QHostAddress::LocalHost, m_localPort)) {
|
||||
qCritical(QString("Could not listen on port %1").arg(m_localPort).toStdString().c_str());
|
||||
m_serverStartStep = SSS_NULL;
|
||||
if (m_tunnelForward) {
|
||||
disableTunnelForward();
|
||||
} else {
|
||||
disableTunnelReverse();
|
||||
}
|
||||
emit serverStartResult(false);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// server will connect to our server socket
|
||||
return execute();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void Server::onWorkProcessResult(AdbProcess::ADB_EXEC_RESULT processResult)
|
||||
{
|
||||
if (SSS_NULL != m_serverStartStep) {
|
||||
switch (m_serverStartStep) {
|
||||
case SSS_PUSH:
|
||||
if (AdbProcess::AER_SUCCESS != processResult) {
|
||||
qCritical("adb push");
|
||||
m_serverStartStep = SSS_NULL;
|
||||
emit serverStartResult(false);
|
||||
} else {
|
||||
m_serverCopiedToDevice = true;
|
||||
m_serverStartStep = SSS_ENABLE_TUNNEL_REVERSE;
|
||||
startServerByStep();
|
||||
}
|
||||
break;
|
||||
case SSS_ENABLE_TUNNEL_REVERSE:
|
||||
if (AdbProcess::AER_SUCCESS != processResult) {
|
||||
qCritical("adb reverse");
|
||||
m_tunnelForward = true;
|
||||
m_serverStartStep = SSS_ENABLE_TUNNEL_FORWARD;
|
||||
startServerByStep();
|
||||
} else {
|
||||
m_serverStartStep = SSS_EXECUTE_SERVER;
|
||||
startServerByStep();
|
||||
}
|
||||
break;
|
||||
case SSS_ENABLE_TUNNEL_FORWARD:
|
||||
if (AdbProcess::AER_SUCCESS != processResult) {
|
||||
qCritical("adb forward");
|
||||
m_serverStartStep = SSS_NULL;
|
||||
emit serverStartResult(false);
|
||||
} else {
|
||||
m_serverStartStep = SSS_EXECUTE_SERVER;
|
||||
startServerByStep();
|
||||
}
|
||||
break;
|
||||
case SSS_EXECUTE_SERVER:
|
||||
if (AdbProcess::AER_SUCCESS != processResult) {
|
||||
if (!m_tunnelForward) {
|
||||
m_serverSocket.close();
|
||||
disableTunnelReverse();
|
||||
} else {
|
||||
disableTunnelForward();
|
||||
}
|
||||
qCritical("adb shell start server failed");
|
||||
m_serverStartStep = SSS_NULL;
|
||||
emit serverStartResult(false);
|
||||
} else {
|
||||
m_serverStartStep = SSS_NULL;
|
||||
m_tunnelEnabled = true;
|
||||
emit serverStartResult(true);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
62
src/server.h
Normal file
62
src/server.h
Normal file
|
@ -0,0 +1,62 @@
|
|||
#ifndef SERVER_H
|
||||
#define SERVER_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QTcpSocket>
|
||||
#include <QTcpServer>
|
||||
|
||||
#include "adbprocess.h"
|
||||
|
||||
class Server : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
enum SERVER_START_STEP {
|
||||
SSS_NULL,
|
||||
SSS_PUSH,
|
||||
SSS_ENABLE_TUNNEL_REVERSE,
|
||||
SSS_ENABLE_TUNNEL_FORWARD,
|
||||
SSS_EXECUTE_SERVER,
|
||||
};
|
||||
public:
|
||||
explicit Server(QObject *parent = nullptr);
|
||||
|
||||
bool start(const QString& serial, quint16 localPort, quint16 maxSize, quint32 bitRate, const QString& crop);
|
||||
|
||||
bool pushServer();
|
||||
bool removeServer();
|
||||
bool enableTunnelReverse();
|
||||
bool disableTunnelReverse();
|
||||
bool enableTunnelForward();
|
||||
bool disableTunnelForward();
|
||||
|
||||
bool execute();
|
||||
|
||||
signals:
|
||||
void serverStartResult(bool success);
|
||||
|
||||
public slots:
|
||||
void onWorkProcessResult(AdbProcess::ADB_EXEC_RESULT processResult);
|
||||
|
||||
private:
|
||||
const QString& getServerPath();
|
||||
bool startServerByStep();
|
||||
|
||||
QString m_serverPath = "";
|
||||
AdbProcess m_workProcess;
|
||||
QString m_serial = "";
|
||||
AdbProcess m_serverProcess;
|
||||
QTcpServer m_serverSocket; // only used if !tunnel_forward
|
||||
QTcpSocket m_deviceSocket;
|
||||
quint16 m_localPort = 0;
|
||||
bool m_tunnelEnabled = false;
|
||||
bool m_tunnelForward = false; // use "adb forward" instead of "adb reverse"
|
||||
bool m_serverCopiedToDevice = false;
|
||||
quint16 m_maxSize = 0;
|
||||
quint32 m_bitRate = 0;
|
||||
QString m_crop = "";
|
||||
|
||||
SERVER_START_STEP m_serverStartStep = SSS_NULL;
|
||||
};
|
||||
|
||||
#endif // SERVER_H
|
Loading…
Add table
Add a link
Reference in a new issue