From f9bd9e311bb800e04f31e180299cc9f0210f2f51 Mon Sep 17 00:00:00 2001 From: tianduanrui Date: Tue, 29 May 2018 09:15:15 +0800 Subject: [PATCH] add support to VLC --- QQtExample.pro | 57 ++- QQtExample_Temp.pro | 152 +------- app-lib/add_library_VLC.pri | 55 +++ .../QQtOpenCVExample/QQtOpenCVExample.pro | 3 +- multi-link/add_base_manager.pri | 3 + multi-link/add_deploy.pri | 192 ---------- multi-link/add_deploy_library.pri | 345 ++++++++++++++++++ multi-link/add_library_QQt.pri | 7 +- ...Link配置模板.pri => 多链接技术配置模板.pri} | 0 test/qqtliveplayer/animationmanager.h | 6 +- test/qqtliveplayer/qqtapp.cpp | 90 ++--- test/qqtliveplayer/qqtliveplayer.pro | 45 +-- test/qqtliveplayer/qqtwindow.cpp | 117 +++--- test/qqtliveplayer/qqtwindow.ui | 4 +- 14 files changed, 566 insertions(+), 510 deletions(-) create mode 100644 app-lib/add_library_VLC.pri create mode 100644 multi-link/add_deploy_library.pri rename multi-link/{多Link配置模板.pri => 多链接技术配置模板.pri} (100%) diff --git a/QQtExample.pro b/QQtExample.pro index ea39e449..88bf4bf9 100644 --- a/QQtExample.pro +++ b/QQtExample.pro @@ -30,6 +30,12 @@ SUBDIRS = #lessThan(QT_MAJOR_VERSION , 5):SUBDIRS += test/qqtwebkittest #lessThan(QT_MAJOR_VERSION , 5):SUBDIRS += test/qqtwebclient +#need OpenCV +#SUBDIRS += examples/QQtOpenCVExample + +#need QZXing, default closed. +#SUBDIRS += examples/qrcodeexample + #----------------------------------------------------------------- #Q3级别 V2 第二版、第二代 #QQt installed to Qt library or @@ -41,14 +47,14 @@ SUBDIRS = #QQt提供QQtApplication帮助App管理Application句柄。 #SUBDIRS += examples/qqtframe2 #必看 -#SUBDIRS += examples/exquisite +# +SUBDIRS += examples/exquisite #SUBDIRS += examples/tabwidgetexamples -#need QZXing, default closed. -#SUBDIRS += examples/qrcodeexample #SUBDIRS += examples/qqtchartexample # -#SUBDIRS += examples/console_app +# +SUBDIRS += examples/console_app #----------------------------------------------------------------- #need webaccessmanager - WebSupport #need QSsl @@ -61,10 +67,12 @@ SUBDIRS = #----------------------------------------------------------------- #some test project #SUBDIRS += test/gumbo_query_test -#SUBDIRS += test/customqvariant +# +SUBDIRS += test/customqvariant #SUBDIRS += test/framelesshelperwidget #SUBDIRS += test/treeviewtest -#SUBDIRS += test/bytearraytest +# +SUBDIRS += test/bytearraytest #!contains(QSYS_PRIVATE, iOS|iOSSimulator){ # SUBDIRS += test/cmdwidget #} @@ -80,18 +88,25 @@ SUBDIRS = #greaterThan(QT_MAJOR_VERSION , 4):SUBDIRS += test/qqtbtfileserver #0000 -#SUBDIRS += test/svgtest -#SUBDIRS += test/qqtdicttest +# +SUBDIRS += test/svgtest +# +SUBDIRS += test/qqtdicttest #必开 -#SUBDIRS += test/qqtdicttest2 +# +SUBDIRS += test/qqtdicttest2 #必开 -#SUBDIRS += test/giftest +# +SUBDIRS += test/giftest #必开 这两个例子是关于QQtAudio的最好展示 -#SUBDIRS += examples/qqtaudioexample +# +SUBDIRS += examples/qqtaudioexample #111111 -#greaterThan(QT_VERSION, 4.6.0):SUBDIRS += test/voicetest -#mac:lessThan(QT_MAJOR_VERSION , 5):SUBDIRS -= test/voicetest +# +greaterThan(QT_VERSION, 4.6.0):SUBDIRS += test/voicetest +# +mac:lessThan(QT_MAJOR_VERSION , 5):SUBDIRS -= test/voicetest #网络创建工具 #SUBDIRS += demo/QQtClientCreator @@ -111,18 +126,20 @@ SUBDIRS = #和QQt脱离开的Multi-link技术 #默认链接QQt,但是可以容易的脱开。 #----------------------------------------------------------------- -#SUBDIRS += test/openglwidgettest -#SUBDIRS += test/osdtest +# +SUBDIRS += test/openglwidgettest +# +SUBDIRS += test/osdtest #SUBDIRS += test/inputtest #SUBDIRS += demo/SysInfoNotify -#SUBDIRS += test/QQtWidgetClickHelperTest -#SUBDIRS += test/QQtWidgetClickSoundHelperTest +# +SUBDIRS += test/QQtWidgetClickHelperTest +# +SUBDIRS += test/QQtWidgetClickSoundHelperTest #这是一对,用于测试Multi-link对其他的lib的链接能力 #SUBDIRS += test/QQtMultiLinkTest -#在subdirs里面添加一次add_base_manager.pri是否可以影响全部子工程 +#在subdirs里面添加一次add_base_manager.pri是否可以影响全部子工程?不会 #SUBDIRS += test/SubDirBaseManagerTest - -SUBDIRS += examples/QQtOpenCVExample diff --git a/QQtExample_Temp.pro b/QQtExample_Temp.pro index b4200cdc..cd0515fc 100644 --- a/QQtExample_Temp.pro +++ b/QQtExample_Temp.pro @@ -10,19 +10,9 @@ TEMPLATE = subdirs SUBDIRS = -##----------------------------------------------------------------- -##Q1级别 V1 第一版、第一代 -##----------------------------------------------------------------- -#古老的链接LibQQt的方式废弃。 -#App管理Application句柄的方式废弃。 -# -SUBDIRS += examples/qqtframe - -# -SUBDIRS += examples/animationframe -# #need vlcQt libvlc library -#SUBDIRS += test/qqtliveplayer +# +SUBDIRS += test/qqtliveplayer #need ffmpeg library #SUBDIRS += test/qqtffmpegplayer @@ -32,139 +22,5 @@ SUBDIRS += examples/animationframe #lessThan(QT_MAJOR_VERSION , 5):SUBDIRS += test/qqtwebkittest #lessThan(QT_MAJOR_VERSION , 5):SUBDIRS += test/qqtwebclient -#----------------------------------------------------------------- -#Q3级别 V2 第二版、第二代 -#QQt installed to Qt library or -#QQt installed to sdk or -#QQt is build -#----------------------------------------------------------------- -#第二种引用LibQQt的方式 -#方法:include(.../LibQQt/multi-link/add_base_manager.pri) -#QQt提供QQtApplication帮助App管理Application句柄。 -# -SUBDIRS += examples/qqtframe2 -#必看 -# -SUBDIRS += examples/exquisite -# -SUBDIRS += examples/tabwidgetexamples -#need QZXing, default closed. -#SUBDIRS += examples/qrcodeexample - -# -SUBDIRS += examples/qqtchartexample -# -# -SUBDIRS += examples/console_app -#----------------------------------------------------------------- -#need webaccessmanager - WebSupport -#need QSsl -#need GumoQuery -#----------------------------------------------------------------- -# -greaterThan(QT_MAJOR_VERSION , 4):SUBDIRS += demo/QtSdkManager -# -greaterThan(QT_MAJOR_VERSION , 4):SUBDIRS += demo/VegeTablesPrice -# -SUBDIRS += demo/GuiBuildTool -# -SUBDIRS += demo/LearnCookieTest -#----------------------------------------------------------------- -#some test project -# -SUBDIRS += test/gumbo_query_test -# -SUBDIRS += test/customqvariant -# -SUBDIRS += test/framelesshelperwidget -# -SUBDIRS += test/treeviewtest -# -SUBDIRS += test/bytearraytest -# -!contains(QSYS_PRIVATE, iOS|iOSSimulator){ -# - SUBDIRS += test/cmdwidget -# -} -# -SUBDIRS += test/coretest -# -SUBDIRS += test/tmpproj - -# -#need QtSoap - WebSupport -## -SUBDIRS += test/easter -# -SUBDIRS += demo/soapQQtOnline -# -##need bluetooth library -# -greaterThan(QT_MAJOR_VERSION , 4):SUBDIRS += test/qqtbtfileserver - -#0000 -# -SUBDIRS += test/svgtest -# -SUBDIRS += test/qqtdicttest -#必开 -# -SUBDIRS += test/qqtdicttest2 -#必开 -# -SUBDIRS += test/giftest - -#必开 这两个例子是关于QQtAudio的最好展示 -# -SUBDIRS += examples/qqtaudioexample -#111111 -# -greaterThan(QT_VERSION, 4.6.0):SUBDIRS += test/voicetest -# -mac:lessThan(QT_MAJOR_VERSION , 5):SUBDIRS -= test/voicetest - -#网络创建工具 -# -SUBDIRS += demo/QQtClientCreator -# -SUBDIRS += demo/QQtServerCreator -#这边是个组合项,客户端和服务器一起的。必看 -# -SUBDIRS += examples/qqtclientexample -# -SUBDIRS += examples/qqtserverexample -#通信协议的复杂的例子 -# -SUBDIRS += examples/qqtnetworkexample - -#udp 嵌入式linux,Qt编译了udp支持,默认是支持的 -# -SUBDIRS += examples/qqtudpexample -# -lessThan(QT_VERSION , 5.8.0):SUBDIRS -= examples/qqtudpexample - -#----------------------------------------------------------------- -#Q5级别 V2 第三版、第二代 -#和QQt脱离开的Multi-link技术 -#默认链接QQt,但是可以容易的脱开。 -#----------------------------------------------------------------- -# -SUBDIRS += test/openglwidgettest -# -SUBDIRS += test/osdtest -# -SUBDIRS += test/inputtest -# -SUBDIRS += demo/SysInfoNotify - -# -SUBDIRS += test/QQtWidgetClickHelperTest -# -SUBDIRS += test/QQtWidgetClickSoundHelperTest - -#这是一对,用于测试Multi-link对其他的lib的链接能力 -SUBDIRS += test/QQtMultiLinkTest - -#在subdirs里面添加一次add_base_manager.pri是否可以影响全部子工程 -SUBDIRS += test/SubDirBaseManagerTest +#need OpenCV +#SUBDIRS += examples/QQtOpenCVExample diff --git a/app-lib/add_library_VLC.pri b/app-lib/add_library_VLC.pri new file mode 100644 index 00000000..72c6b0b2 --- /dev/null +++ b/app-lib/add_library_VLC.pri @@ -0,0 +1,55 @@ +#---------------------------------------------------------------- +#add_library_VLC.pri +#这是给用户提供的方便pri +#这个比较common,允许拷贝到用户工程中更改。 +#---------------------------------------------------------------- + +#添加依赖library +LIBRARYVER = +DEBUG = d +#这个地方,mingw比较特殊必须发布release版本,其他平台不清楚。 +mingw:DEBUG= +contains(BUILD, Release) { + DEBUG= +} + +add_library(VLC, VLCQtCore$${LIBRARYVER}$${DEBUG}) +add_library(VLC, VLCQtWidgets$${LIBRARYVER}$${DEBUG}) + +#添加头文件 (如果头文件目录扩展了,就改这个函数) +defineReplace(get_vlc_header){ + path = $$1 + isEmpty(1)|!isEmpty(2) : error("get_vlc_header(path) requires one arguments.") + + command = + #basic + command += $${path} + command += $${path}/VLCQtCore + command += $${path}/VLCQtWidgets + + return ($$command) +} + +defineTest(add_vlc_header){ + #包含VLC头文件的过程 + header_path = $$get_add_header(VLC) + INCLUDEPATH += $$get_vlc_header($$header_path) + export(INCLUDEPATH) + return (1) +} + +add_vlc_header() + +#这样包含也很好,简洁明了 +#add_header(VLC, VLCQtCore) +#add_header(VLC, VLCQtWidgets) +#... + +#添加宏定义 +#add_defines(xx) + +#发布依赖library +#注意Android也需要这个函数,使用这个函数Android才会发布Library到运行时。上边的只是链接作用。 +defineTest(add_deploy_library_VLC) { + add_deploy_libraries(VLC) +} diff --git a/examples/QQtOpenCVExample/QQtOpenCVExample.pro b/examples/QQtOpenCVExample/QQtOpenCVExample.pro index 802288c6..996a992e 100644 --- a/examples/QQtOpenCVExample/QQtOpenCVExample.pro +++ b/examples/QQtOpenCVExample/QQtOpenCVExample.pro @@ -38,10 +38,11 @@ MOBILITY = include (../../multi-link/add_base_manager.pri) include (../../app-lib/add_custom_manager.pri) -#这里做的事情,可以拷贝到custom manager里面完成。 +#这里做的事情,可以拷贝custom manager到app目录里再custom manager里面完成。 add_version(1,0,0,0) add_deploy() add_deploy_config($$PWD/AppRoot) +add_deploy_library_QQt() #添加其他library include (../../app-lib/add_library_OpenCV.pri) diff --git a/multi-link/add_base_manager.pri b/multi-link/add_base_manager.pri index 92ab9358..e8f5104f 100644 --- a/multi-link/add_base_manager.pri +++ b/multi-link/add_base_manager.pri @@ -28,6 +28,9 @@ include($${PWD}/add_multi_link_technology.pri) #app发布所需要的函数 include ($${PWD}/add_deploy.pri) +#app发布library所需要的函数 +include ($${PWD}/add_deploy_library.pri) + #app发布配置项需要的函数 include ($${PWD}/add_deploy_config.pri) diff --git a/multi-link/add_deploy.pri b/multi-link/add_deploy.pri index 296d09d2..da9942ba 100644 --- a/multi-link/add_deploy.pri +++ b/multi-link/add_deploy.pri @@ -72,128 +72,6 @@ defineReplace(get_add_deploy_on_android) { return ($$command) } -########################################## -#app的发布lib函数命令 -########################################## -#app发布lib到自己的目标里,必须先发布app,如果没有先发布app会出错。 -#lib发布lib,没有的事情 -#解释,从app build目录里拷贝是有原因的,在Creator编译完成后,我把依赖库拷贝过去了,add_library()实现的。 -defineReplace(get_add_deploy_library_on_mac) { - #APP_DEPLOY_PWD - #APP_DEST_PWD - libname = $$1 - librealname = $$2 - isEmpty(1): error("get_add_deploy_library_on_mac(libname, librealname) requires at last one argument") - !isEmpty(3): error("get_add_deploy_library_on_mac(libname, librealname) requires at most two argument") - isEmpty(2): librealname = $${libname} - - #这里有个bug,用户删除了SDK以后,App qmake阶段读取这个SDK,结果读到这个位置,为0...bug,其实不应该为0,应该为用户设置的SDK版本号。 - #解决方法一:忽略第一遍编译。也就是什么SDK都没有的时候,编译一遍,lib生成了SDK,可是不管他,再qmake后编译一遍。能解决。 - libmajorver = $$system(readlink $${LIB_LIB_PWD}/$${librealname}.framework/Versions/Current) - #这里是以防万一lib不存在 但是不能退出?如果是subdirs包含Library的工程,就不能退出。 - isEmpty(libmajorver){ - libmajorver=0 - message($$TARGET link $$libname, unexisted lib.) - } - command = - command += $$MK_DIR $${APP_BUILD_PWD}/$${TARGET}.app/Contents/Frameworks && - #拷贝sdk到build - command += $$COPY_DIR $${LIB_LIB_PWD}/$${librealname}.framework $${APP_BUILD_PWD}/$${TARGET}.app/Contents/Frameworks && - #更改app bundle链接Lib的位置。 - command += install_name_tool -change $${librealname}.framework/Versions/$${libmajorver}/$${librealname} \ - @rpath/$${librealname}.framework/Versions/$${libmajorver}/$${librealname} \ - $${APP_BUILD_PWD}/$${TARGET}.app/Contents/MacOS/$${TARGET} && - command += macdeployqt $${APP_BUILD_PWD}/$${TARGET}.app -verbose=1 && - lessThan(QT_MAJOR_VERSION, 5){ - command += chmod +x $${THIS_PRI_PWD}/mac_deploy_qt4.sh && - command += $${THIS_PRI_PWD}/mac_deploy_qt4.sh $${APP_BUILD_PWD}/$${TARGET}.app/Contents/MacOS/$${TARGET} && - } - - command += $$MK_DIR $${APP_DEPLOY_PWD}/$${TARGET}.app/Contents/Frameworks && - #拷贝sdk到deploy - command += $$COPY_DIR $${LIB_LIB_PWD}/$${librealname}.framework $${APP_DEPLOY_PWD}/$${TARGET}.app/Contents/Frameworks && - #更改app bundle链接Lib的位置。 - command += install_name_tool -change $${librealname}.framework/Versions/$${libmajorver}/$${librealname} \ - @rpath/$${librealname}.framework/Versions/$${libmajorver}/$${librealname} \ - $${APP_DEPLOY_PWD}/$${TARGET}.app/Contents/MacOS/$${TARGET} && - command += macdeployqt $${APP_DEPLOY_PWD}/$${TARGET}.app -verbose=1 - lessThan(QT_MAJOR_VERSION, 5){ - command += && - command += chmod +x $${THIS_PRI_PWD}/mac_deploy_qt4.sh && - command += $${THIS_PRI_PWD}/mac_deploy_qt4.sh $${APP_DEPLOY_PWD}/$${TARGET}.app/Contents/MacOS/$${TARGET} - } - - #message($$command) - - return ($$command) -} - -defineReplace(get_add_deploy_library_on_windows) { - #APP_DEPLOY_PWD - #APP_DEST_PWD - libname = $$1 - librealname = $$2 - isEmpty(1): error("get_add_deploy_library_on_windows(libname, librealname) requires at last one argument") - !isEmpty(3): error("get_add_deploy_library_on_windows(libname, librealname) requires at most two argument") - isEmpty(2): librealname = $${libname} - - command = - command += $$RM $${APP_BUILD_PWD}\\$${librealname}.* $$CMD_SEP - #拷贝sdk到build - command += $$COPY_DIR $${LIB_LIB_PWD}\\$${librealname}.* $${APP_BUILD_PWD} $$CMD_SEP - - command += $$RM $${APP_DEPLOY_PWD}\\$${librealname}.* $$CMD_SEP - #拷贝sdk到deploy - command += $$COPY_DIR $${LIB_LIB_PWD}\\$${librealname}.* $${APP_DEPLOY_PWD} - - #message($$command) - - return ($$command) -} - -defineReplace(get_add_deploy_library_on_linux) { - #APP_DEPLOY_PWD - #APP_DEST_PWD - libname = $$1 - librealname = $$2 - isEmpty(1): error("get_add_deploy_library_on_windows(libname, librealname) requires at last one argument") - !isEmpty(3): error("get_add_deploy_library_on_windows(libname, librealname) requires at most two argument") - isEmpty(2): librealname = $${libname} - - command = - - command += $$RM $${APP_BUILD_PWD}/lib$${libname}.so* $$CMD_SEP - command += $$COPY_DIR $${LIB_LIB_PWD}/lib$${librealname}.so* $${APP_BUILD_PWD} $$CMD_SEP - - command += $$RM $${APP_DEPLOY_PWD}/lib$${libname}.so* $$CMD_SEP - command += $$COPY_DIR $${LIB_LIB_PWD}/lib$${librealname}.so* $${APP_DEPLOY_PWD} - #message($$command) - - return ($$command) -} - -defineReplace(get_add_deploy_library_on_android) { - #APP_DEPLOY_PWD - #APP_DEST_PWD - libname = $$1 - librealname = $$2 - isEmpty(1): error("get_add_deploy_library_on_windows(libname, librealname) requires at last one argument") - !isEmpty(3): error("get_add_deploy_library_on_windows(libname, librealname) requires at most two argument") - isEmpty(2): librealname = $${libname} - - LIB_ANDROID_PATH = $${LIB_LIB_PWD}/lib$${librealname}.so - equals(QMAKE_HOST.os, Windows) { - LIB_ANDROID_PATH~=s,/,\\,g - } - message(Android target $${ANDROID_TARGET_ARCH}) - message($${TARGET} deploy library $${LIB_ANDROID_PATH}) - - command = - command += $${LIB_ANDROID_PATH} - #message($$command) - - return ($$command) -} ################################################################################ #外部用函数 @@ -256,73 +134,3 @@ defineTest(add_deploy) { return (1) } - -defineTest(add_deploy_library) { - #APP_DEPLOY_PWD - #APP_DEST_PWD - - #deploy root - isEmpty(APP_DEPLOY_ROOT){ - message($${TARGET} $${CONFIG_FILE}) - message(APP_DEPLOY_ROOT = /user/set/path is required, please modify .qmake/app_configure.pri ) - error(please check $$CONFIG_FILE under add_multi_link_technology.pri) - } - isEmpty(LIB_SDK_ROOT){ - message($${TARGET} $${CONFIG_FILE}) - message(LIB_SDK_ROOT = /user/set/path is required, please modify .qmake/app_configure.pri ) - error(please check $$CONFIG_FILE under add_multi_link_technology.pri) - } - - #起始位置 编译位置 中间目标位置 - APP_DEST_PWD=$${DESTDIR} - isEmpty(APP_DEST_PWD):APP_DEST_PWD=. - APP_BUILD_PWD = $$APP_DEST_PWD - - #set app deploy pwd - #APP_DEPLOY_PWD is here. - APP_DEPLOY_PWD = $${APP_DEPLOY_ROOT}/$${TARGET}/$${QSYS_STD_DIR} - #不仅仅发布目标为Windows的时候,才需要改变路径 - #开发机为Windows就必须改变。 - #contains(QKIT_PRIVATE, WIN32||WIN64) { - equals(QMAKE_HOST.os, Windows) { - APP_DEPLOY_PWD~=s,/,\\,g - } - - libname = $$1 - librealname = $$2 - isEmpty(1): error("add_deploy_library(libname, librealname) requires at last one argument") - !isEmpty(3): error("add_deploy_library(libname, librealname) requires at most two argument") - isEmpty(2): librealname = $${libname} - - LIB_STD_DIR = $${libname}/$${QSYS_STD_DIR} - LIB_SDK_PWD = $${LIB_SDK_ROOT}/$${LIB_STD_DIR} - LIB_LIB_PWD = $${LIB_SDK_PWD}/lib - equals(QMAKE_HOST.os, Windows) { - LIB_LIB_PWD~=s,/,\\,g - } - - !isEmpty(QMAKE_POST_LINK):QMAKE_POST_LINK += $$CMD_SEP - contains(QSYS_PRIVATE, Win32|Windows||Win64) { - #发布windows版本 - QMAKE_POST_LINK += $$get_add_deploy_library_on_windows($${libname}, $${librealname}) - } else: contains(QSYS_PRIVATE, macOS) { - #发布苹果版本,iOS版本也是这个? - QMAKE_POST_LINK += $$get_add_deploy_library_on_mac($${libname}, $${librealname}) - } else: contains(QSYS_PRIVATE, Android||AndroidX86) { - ANDROID_EXTRA_LIBS += $$get_add_deploy_library_on_android($${libname}, $${librealname}) - } else { - #发布linux、e-linux,这个是一样的。 - QMAKE_POST_LINK += $$get_add_deploy_library_on_linux($${libname}, $${librealname}) - } - - export(QMAKE_POST_LINK) - - message("$${TARGET} has deployed lib $${librealname}.") - return (1) -} - -#判断某个lib是否已经发布 -#避免二次发布,拷贝浪费时间。 -defineTest(has_deployed_lib) { - return(0) -} diff --git a/multi-link/add_deploy_library.pri b/multi-link/add_deploy_library.pri new file mode 100644 index 00000000..2078c88b --- /dev/null +++ b/multi-link/add_deploy_library.pri @@ -0,0 +1,345 @@ +#------------------------------------------------------------- +#add_deploy_library.pri +#提供app发布library函数,只是app工程使用 +#------------------------------------------------------------- + +################################################################################ +#内部用函数 +#获取命令 +################################################################################ +THIS_PRI_PWD = $${PWD} + +############################################################### +#app的发布library命令函数 +############################################################### +#app发布lib到自己的目标里,必须先发布app,如果没有先发布app会出错(macOS)。 +#lib发布lib,没有的事情 +#解释,过去从sdk到build到deploy,现在从sdk到build,从sdk到deploy +defineReplace(get_add_deploy_library_on_mac) { + #APP_DEPLOY_PWD + #APP_DEST_PWD + libname = $$1 + librealname = $$2 + isEmpty(1): error("get_add_deploy_library_on_mac(libname, librealname) requires at last one argument") + !isEmpty(3): error("get_add_deploy_library_on_mac(libname, librealname) requires at most two argument") + isEmpty(2): librealname = $${libname} + + #这里有个bug,用户删除了SDK以后,App qmake阶段读取这个SDK,结果读到这个位置,为0...bug,其实不应该为0,应该为用户设置的SDK版本号。 + #解决方法一:忽略第一遍编译。也就是什么SDK都没有的时候,编译一遍,lib生成了SDK,可是不管他,再qmake后编译一遍。能解决。 + libmajorver = $$system(readlink $${LIB_LIB_PWD}/$${librealname}.framework/Versions/Current) + #这里是以防万一lib不存在 但是不能退出?如果是subdirs包含Library的工程,就不能退出。 + isEmpty(libmajorver){ + libmajorver=0 + message($$TARGET link $$libname, unexisted lib.) + } + command = + command += $$MK_DIR $${APP_BUILD_PWD}/$${TARGET}.app/Contents/Frameworks && + #拷贝sdk到build + command += $$COPY_DIR $${LIB_LIB_PWD}/$${librealname}.framework $${APP_BUILD_PWD}/$${TARGET}.app/Contents/Frameworks && + #更改app bundle链接Lib的位置。 + command += install_name_tool -change $${librealname}.framework/Versions/$${libmajorver}/$${librealname} \ + @rpath/$${librealname}.framework/Versions/$${libmajorver}/$${librealname} \ + $${APP_BUILD_PWD}/$${TARGET}.app/Contents/MacOS/$${TARGET} && + command += macdeployqt $${APP_BUILD_PWD}/$${TARGET}.app -verbose=1 && + lessThan(QT_MAJOR_VERSION, 5){ + command += chmod +x $${THIS_PRI_PWD}/mac_deploy_qt4.sh && + command += $${THIS_PRI_PWD}/mac_deploy_qt4.sh $${APP_BUILD_PWD}/$${TARGET}.app/Contents/MacOS/$${TARGET} && + } + + command += $$MK_DIR $${APP_DEPLOY_PWD}/$${TARGET}.app/Contents/Frameworks && + #拷贝sdk到deploy + command += $$COPY_DIR $${LIB_LIB_PWD}/$${librealname}.framework $${APP_DEPLOY_PWD}/$${TARGET}.app/Contents/Frameworks && + #更改app bundle链接Lib的位置。 + command += install_name_tool -change $${librealname}.framework/Versions/$${libmajorver}/$${librealname} \ + @rpath/$${librealname}.framework/Versions/$${libmajorver}/$${librealname} \ + $${APP_DEPLOY_PWD}/$${TARGET}.app/Contents/MacOS/$${TARGET} && + command += macdeployqt $${APP_DEPLOY_PWD}/$${TARGET}.app -verbose=1 + lessThan(QT_MAJOR_VERSION, 5){ + command += && + command += chmod +x $${THIS_PRI_PWD}/mac_deploy_qt4.sh && + command += $${THIS_PRI_PWD}/mac_deploy_qt4.sh $${APP_DEPLOY_PWD}/$${TARGET}.app/Contents/MacOS/$${TARGET} + } + + #message($$command) + + return ($$command) +} + +defineReplace(get_add_deploy_library_on_windows) { + #APP_DEPLOY_PWD + #APP_DEST_PWD + libname = $$1 + librealname = $$2 + isEmpty(1): error("get_add_deploy_library_on_windows(libname, librealname) requires at last one argument") + !isEmpty(3): error("get_add_deploy_library_on_windows(libname, librealname) requires at most two argument") + isEmpty(2): librealname = $${libname} + + command = + command += $$RM $${APP_BUILD_PWD}\\$${librealname}.* $$CMD_SEP + #拷贝sdk到build + command += $$COPY_DIR $${LIB_LIB_PWD}\\$${librealname}.* $${APP_BUILD_PWD} $$CMD_SEP + + command += $$RM $${APP_DEPLOY_PWD}\\$${librealname}.* $$CMD_SEP + #拷贝sdk到deploy + command += $$COPY_DIR $${LIB_LIB_PWD}\\$${librealname}.* $${APP_DEPLOY_PWD} + + #message($$command) + + return ($$command) +} + +defineReplace(get_add_deploy_library_on_linux) { + #APP_DEPLOY_PWD + #APP_DEST_PWD + libname = $$1 + librealname = $$2 + isEmpty(1): error("get_add_deploy_library_on_windows(libname, librealname) requires at last one argument") + !isEmpty(3): error("get_add_deploy_library_on_windows(libname, librealname) requires at most two argument") + isEmpty(2): librealname = $${libname} + + command = + + command += $$RM $${APP_BUILD_PWD}/lib$${libname}.so* $$CMD_SEP + command += $$COPY_DIR $${LIB_LIB_PWD}/lib$${librealname}.so* $${APP_BUILD_PWD} $$CMD_SEP + + command += $$RM $${APP_DEPLOY_PWD}/lib$${libname}.so* $$CMD_SEP + command += $$COPY_DIR $${LIB_LIB_PWD}/lib$${librealname}.so* $${APP_DEPLOY_PWD} + #message($$command) + + return ($$command) +} + +defineReplace(get_add_deploy_library_on_android) { + #APP_DEPLOY_PWD + #APP_DEST_PWD + libname = $$1 + librealname = $$2 + isEmpty(1): error("get_add_deploy_library_on_windows(libname, librealname) requires at last one argument") + !isEmpty(3): error("get_add_deploy_library_on_windows(libname, librealname) requires at most two argument") + isEmpty(2): librealname = $${libname} + + LIB_ANDROID_PATH = $${LIB_LIB_PWD}/lib$${librealname}.so + equals(QMAKE_HOST.os, Windows) { + LIB_ANDROID_PATH~=s,/,\\,g + } + message(Android target $${ANDROID_TARGET_ARCH}) + message($${TARGET} deploy library $${LIB_ANDROID_PATH}) + + command = + command += $${LIB_ANDROID_PATH} + #message($$command) + + return ($$command) +} + +################################################################################ +#外部用函数 +################################################################################ +defineTest(add_deploy_library) { + #APP_DEPLOY_PWD + #APP_DEST_PWD + + #deploy root + isEmpty(APP_DEPLOY_ROOT){ + message($${TARGET} $${CONFIG_FILE}) + message(APP_DEPLOY_ROOT = /user/set/path is required, please modify .qmake/app_configure.pri ) + error(please check $$CONFIG_FILE under add_multi_link_technology.pri) + } + isEmpty(LIB_SDK_ROOT){ + message($${TARGET} $${CONFIG_FILE}) + message(LIB_SDK_ROOT = /user/set/path is required, please modify .qmake/app_configure.pri ) + error(please check $$CONFIG_FILE under add_multi_link_technology.pri) + } + + #起始位置 编译位置 中间目标位置 + APP_DEST_PWD=$${DESTDIR} + isEmpty(APP_DEST_PWD):APP_DEST_PWD=. + APP_BUILD_PWD = $$APP_DEST_PWD + + #set app deploy pwd + #APP_DEPLOY_PWD is here. + APP_DEPLOY_PWD = $${APP_DEPLOY_ROOT}/$${TARGET}/$${QSYS_STD_DIR} + #不仅仅发布目标为Windows的时候,才需要改变路径 + #开发机为Windows就必须改变。 + #contains(QKIT_PRIVATE, WIN32||WIN64) { + equals(QMAKE_HOST.os, Windows) { + APP_DEPLOY_PWD~=s,/,\\,g + } + + libname = $$1 + librealname = $$2 + isEmpty(1): error("add_deploy_library(libname, librealname) requires at last one argument") + !isEmpty(3): error("add_deploy_library(libname, librealname) requires at most two argument") + isEmpty(2): librealname = $${libname} + + LIB_STD_DIR = $${libname}/$${QSYS_STD_DIR} + LIB_SDK_PWD = $${LIB_SDK_ROOT}/$${LIB_STD_DIR} + LIB_LIB_PWD = $${LIB_SDK_PWD}/lib + equals(QMAKE_HOST.os, Windows) { + LIB_LIB_PWD~=s,/,\\,g + } + + !isEmpty(QMAKE_POST_LINK):QMAKE_POST_LINK += $$CMD_SEP + contains(QSYS_PRIVATE, Win32|Windows||Win64) { + #发布windows版本 + QMAKE_POST_LINK += $$get_add_deploy_library_on_windows($${libname}, $${librealname}) + } else: contains(QSYS_PRIVATE, macOS) { + #发布苹果版本,iOS版本也是这个? + QMAKE_POST_LINK += $$get_add_deploy_library_on_mac($${libname}, $${librealname}) + } else: contains(QSYS_PRIVATE, Android||AndroidX86) { + ANDROID_EXTRA_LIBS += $$get_add_deploy_library_on_android($${libname}, $${librealname}) + } else { + #发布linux、e-linux,这个是一样的。 + QMAKE_POST_LINK += $$get_add_deploy_library_on_linux($${libname}, $${librealname}) + } + + export(QMAKE_POST_LINK) + + message("$${TARGET} has deployed lib $${librealname}.") + return (1) +} + +#判断某个lib是否已经发布 +#避免二次发布,拷贝浪费时间。 +defineTest(has_deployed_library) { + return(0) +} + + +################################################################################ +#内部用函数 +################################################################################ +############################################################### +#app的发布librarys命令函数 +############################################################### +defineReplace(get_add_deploy_libraries_on_mac) { + #APP_DEPLOY_PWD + #APP_DEST_PWD + libname = $$1 + isEmpty(1)|!isEmpty(2): error("get_add_deploy_libraries_on_mac(libname) requires one argument") + + command = + + command += $$COPY_DIR $${LIB_LIB_PWD}/* $${APP_BUILD_PWD} $$CMD_SEP + command += $$COPY_DIR $${LIB_LIB_PWD}/* $${APP_DEPLOY_PWD} + #message($$command) + + return ($$command) +} + +defineReplace(get_add_deploy_libraries_on_windows) { + #APP_DEPLOY_PWD + #APP_DEST_PWD + libname = $$1 + isEmpty(1)|!isEmpty(2): error("get_add_deploy_libraries_on_windows(libname) requires one argument") + + command = + #拷贝sdk到build + command += $$COPY_DIR $${LIB_LIB_PWD}\\* $${APP_BUILD_PWD} $$CMD_SEP + + #拷贝sdk到deploy + command += $$COPY_DIR $${LIB_LIB_PWD}\\* $${APP_DEPLOY_PWD} + + #message($$command) + + return ($$command) +} + +defineReplace(get_add_deploy_libraries_on_linux) { + #APP_DEPLOY_PWD + #APP_DEST_PWD + libname = $$1 + isEmpty(1)|!isEmpty(2): error("get_add_deploy_libraries_on_linux(libname) requires one argument") + + command = + + command += $$COPY_DIR $${LIB_LIB_PWD}/* $${APP_BUILD_PWD} $$CMD_SEP + command += $$COPY_DIR $${LIB_LIB_PWD}/* $${APP_DEPLOY_PWD} + #message($$command) + + return ($$command) +} + +#这个? +defineReplace(get_add_deploy_libraries_on_android) { + #APP_DEPLOY_PWD + #APP_DEST_PWD + libname = $$1 + isEmpty(1)|!isEmpty(2): error("get_add_deploy_libraries_on_linux(libname) requires one argument") + + LIB_ANDROID_PATH = $${LIB_LIB_PWD}/lib$${libname}.so + equals(QMAKE_HOST.os, Windows) { + LIB_ANDROID_PATH~=s,/,\\,g + } + message(Android target $${ANDROID_TARGET_ARCH}) + + command = + command += $${LIB_ANDROID_PATH} + #message($$command) + + return ($$command) +} + +################################################################################ +#外部用函数 +################################################################################ +defineTest(add_deploy_libraries) { + #APP_DEPLOY_PWD + #APP_DEST_PWD + + #deploy root + isEmpty(APP_DEPLOY_ROOT){ + message($${TARGET} $${CONFIG_FILE}) + message(APP_DEPLOY_ROOT = /user/set/path is required, please modify .qmake/app_configure.pri ) + error(please check $$CONFIG_FILE under add_multi_link_technology.pri) + } + isEmpty(LIB_SDK_ROOT){ + message($${TARGET} $${CONFIG_FILE}) + message(LIB_SDK_ROOT = /user/set/path is required, please modify .qmake/app_configure.pri ) + error(please check $$CONFIG_FILE under add_multi_link_technology.pri) + } + + #起始位置 编译位置 中间目标位置 + APP_DEST_PWD=$${DESTDIR} + isEmpty(APP_DEST_PWD):APP_DEST_PWD=. + APP_BUILD_PWD = $$APP_DEST_PWD + + #set app deploy pwd + #APP_DEPLOY_PWD is here. + APP_DEPLOY_PWD = $${APP_DEPLOY_ROOT}/$${TARGET}/$${QSYS_STD_DIR} + #不仅仅发布目标为Windows的时候,才需要改变路径 + #开发机为Windows就必须改变。 + #contains(QKIT_PRIVATE, WIN32||WIN64) { + equals(QMAKE_HOST.os, Windows) { + APP_DEPLOY_PWD~=s,/,\\,g + } + + libname = $$1 + isEmpty(1)|!isEmpty(2): error("add_deploy_libraries(libname) requires one argument") + + LIB_STD_DIR = $${libname}/$${QSYS_STD_DIR} + LIB_SDK_PWD = $${LIB_SDK_ROOT}/$${LIB_STD_DIR} + LIB_LIB_PWD = $${LIB_SDK_PWD}/lib + equals(QMAKE_HOST.os, Windows) { + LIB_LIB_PWD~=s,/,\\,g + } + + !isEmpty(QMAKE_POST_LINK):QMAKE_POST_LINK += $$CMD_SEP + contains(QSYS_PRIVATE, Win32|Windows||Win64) { + #发布windows版本 + QMAKE_POST_LINK += $$get_add_deploy_libraries_on_windows($${libname}) + } else: contains(QSYS_PRIVATE, macOS) { + #发布苹果版本,iOS版本也是这个? + QMAKE_POST_LINK += $$get_add_deploy_libraries_on_mac($${libname}) + } else: contains(QSYS_PRIVATE, Android||AndroidX86) { + ANDROID_EXTRA_LIBS += $$get_add_deploy_libraries_on_android($${libname}) + } else { + #发布linux、e-linux,这个是一样的。 + QMAKE_POST_LINK += $$get_add_deploy_libraries_on_linux($${libname}) + } + + export(QMAKE_POST_LINK) + + message("$${TARGET} has deployed librarys under $${libname}.") + return (1) +} diff --git a/multi-link/add_library_QQt.pri b/multi-link/add_library_QQt.pri index 549599c8..4e3ef8a3 100644 --- a/multi-link/add_library_QQt.pri +++ b/multi-link/add_library_QQt.pri @@ -28,5 +28,10 @@ add_library(QQt) #以上代码只完成了链接libQQt 包含libQQt头文件 包含libQQt宏文件(在宏文件控制下Library的头文件才有精确的意义) #没有发布libQQt -#App在开发中,调用发布App以后 必然需要调用app_deploy_library(QQt)发布QQt到运行时。强大的:从sdk发布到build和deploy位置。 +#App在开发中,调用发布App以后 必然需要调用add_deploy_library(QQt)发布QQt到运行时。强大的:从sdk发布到build和deploy位置。 #调试,正常;发布运行,正常。 +#:) 方便函数 +defineTest(add_deploy_library_QQt){ + add_deploy_library(QQt) + return (1) +} diff --git a/multi-link/多Link配置模板.pri b/multi-link/多链接技术配置模板.pri similarity index 100% rename from multi-link/多Link配置模板.pri rename to multi-link/多链接技术配置模板.pri diff --git a/test/qqtliveplayer/animationmanager.h b/test/qqtliveplayer/animationmanager.h index f1fb9385..198ceb6d 100644 --- a/test/qqtliveplayer/animationmanager.h +++ b/test/qqtliveplayer/animationmanager.h @@ -2,18 +2,18 @@ #define ANIMATIONMANAGER_H #include -#include "qqtdefine.h" +#include "qqt.h" class AnimationManager : public QObject { public: - static AnimationManager *Instance(QObject* parent = 0); + static AnimationManager* Instance ( QObject* parent = 0 ); signals: public slots: protected: - explicit AnimationManager(QObject *parent = nullptr); + explicit AnimationManager ( QObject* parent = nullptr ); private: static AnimationManager* _instance; }; diff --git a/test/qqtliveplayer/qqtapp.cpp b/test/qqtliveplayer/qqtapp.cpp index c57c9645..ab36fca6 100644 --- a/test/qqtliveplayer/qqtapp.cpp +++ b/test/qqtliveplayer/qqtapp.cpp @@ -13,62 +13,62 @@ /* * 转移到Lan协议当中去。 */ -void QQTLanServer(QObject* parent = 0) +void QQTLanServer ( QObject* parent = 0 ) { - static QQtTcpServer* s = new QQtTcpServer(parent); - s->listen(QHostAddress::Any, 8000); + static QQtTcpServer* s = new QQtTcpServer ( parent ); + s->listen ( QHostAddress::Any, 8000 ); - s->installedProtocol(); + //s->installedProtocol(); } -QQTApp::QQTApp(int& argc, char** argv) : QApplication(argc, argv) +QQTApp::QQTApp ( int& argc, char** argv ) : QApplication ( argc, argv ) { #ifndef __QT5__ - QTextCodec::setCodecForTr(QTextCodec::codecForName("UTF-8")); - QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8")); + QTextCodec::setCodecForTr ( QTextCodec::codecForName ( "UTF-8" ) ); + QTextCodec::setCodecForCStrings ( QTextCodec::codecForName ( "UTF-8" ) ); #endif - QTextCodec::setCodecForLocale(QTextCodec::codecForName("UTF-8")); + QTextCodec::setCodecForLocale ( QTextCodec::codecForName ( "UTF-8" ) ); - QApplication::setOrganizationName("QQt"); - QApplication::setOrganizationDomain("qqtliveplayer"); // 专为Mac OS X 准备的 - QApplication::setApplicationName("qqtliveplayer"); - QSettings::setPath(QSettings::NativeFormat, QSettings::UserScope, CONFIG_PATH); - QSettings::setPath(QSettings::NativeFormat, QSettings::SystemScope, CONFIG_PATH); + QApplication::setOrganizationName ( "QQt" ); + QApplication::setOrganizationDomain ( "qqtliveplayer" ); // 专为Mac OS X 准备的 + QApplication::setApplicationName ( "qqtliveplayer" ); + QSettings::setPath ( QSettings::NativeFormat, QSettings::UserScope, CONFIG_PATH ); + QSettings::setPath ( QSettings::NativeFormat, QSettings::SystemScope, CONFIG_PATH ); - system("rm -f /tmp/LCK..ttyS*"); + system ( "rm -f /tmp/LCK..ttyS*" ); #if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) /* * 打印失真与否与此处无关 */ - QApplication::setGraphicsSystem("raster"); + QApplication::setGraphicsSystem ( "raster" ); #endif #ifdef __EMBEDDED_LINUX__ //QApplication::setOverrideCursor(Qt::ArrowCursor); - QWSServer::setCursorVisible(false); + QWSServer::setCursorVisible ( false ); #endif #ifdef __EMBEDDED_LINUX__ QFontDatabase db; #if 0 - int heitiFontID = db.addApplicationFont("/usr/lib/fonts/heiti.ttf"); - QString heiti = db.applicationFontFamilies(heitiFontID).at(0); + int heitiFontID = db.addApplicationFont ( "/usr/lib/fonts/heiti.ttf" ); + QString heiti = db.applicationFontFamilies ( heitiFontID ).at ( 0 ); pline() << heiti; #else - int wenquanyiFontID = db.addApplicationFont("/usr/lib/fonts/wenquanyi.ttf"); - QString wenquanyi = db.applicationFontFamilies(wenquanyiFontID).at(0); + int wenquanyiFontID = db.addApplicationFont ( "/usr/lib/fonts/wenquanyi.ttf" ); + QString wenquanyi = db.applicationFontFamilies ( wenquanyiFontID ).at ( 0 ); pline() << wenquanyi; #endif - QFont font(wenquanyi, 11); - QApplication::setFont(font); + QFont font ( wenquanyi, 11 ); + QApplication::setFont ( font ); #endif pline() << qApp->applicationDirPath(); - language = new QTranslator(this); + language = new QTranslator ( this ); setLanguage(); #if 0 @@ -76,7 +76,7 @@ QQTApp::QQTApp(int& argc, char** argv) : QApplication(argc, argv) * 打开方法数据库 */ managerDB = newDatabaseConn(); - setDatabaseName(managerDB, DB_MANAGER); + setDatabaseName ( managerDB, DB_MANAGER ); #endif #if 1 @@ -86,11 +86,11 @@ QQTApp::QQTApp(int& argc, char** argv) : QApplication(argc, argv) * 可以实现橙色一行选中 * 肯定也能实现表头透明和QQT效果。 */ - QFile styleFile("./skin/default.qss"); - styleFile.open(QIODevice::ReadOnly); - QString styleString(styleFile.readAll());; + QFile styleFile ( "./skin/default.qss" ); + styleFile.open ( QIODevice::ReadOnly ); + QString styleString ( styleFile.readAll() );; styleFile.close(); - setStyleSheet(styleString); + setStyleSheet ( styleString ); /* * 设置所有默认颜色 */ @@ -98,18 +98,18 @@ QQTApp::QQTApp(int& argc, char** argv) : QApplication(argc, argv) #endif #ifdef __EMBEDDED_LINUX__ - QQtInput::Instance()->Init("min", "control", "QQT", 14, 14); + QQtInput::Instance()->Init ( "min", "control", "QQT", 14, 14 ); #endif - qsrand(QTime(0, 0, 0).secsTo(QTime::currentTime())); + qsrand ( QTime ( 0, 0, 0 ).secsTo ( QTime::currentTime() ) ); - QObject::connect(QQtPluginWatcher::Instance(), SIGNAL(storageChanged(int)), - this, SLOT(slotUPanAutoRun(int))); + QObject::connect ( QQtPluginWatcher::Instance(), SIGNAL ( storageChanged ( int ) ), + this, SLOT ( slotUPanAutoRun ( int ) ) ); //QQtTcpClient //QQTCloudClientInstance(this); #ifdef __EMBEDDED_LINUX__ //QQTEthManager - QQtEthenetManager::Instance(this); + QQtEthenetManager::Instance ( this ); #endif //QQtTcpServer //QQTPeerPort @@ -129,25 +129,25 @@ void QQTApp::setLanguage() */ QSettings setting; QString qm; - qm = setting.value("Language").toInt() ? "./lang/en_US.qm" : "./lang/zh_CN.qm"; + qm = setting.value ( "Language" ).toInt() ? "./lang/en_US.qm" : "./lang/zh_CN.qm"; - language->load(qm); + language->load ( qm ); pline() << "currentLanguage" << qm; - installTranslator(language); + installTranslator ( language ); } -void QQTApp::slotUPanAutoRun(int status) +void QQTApp::slotUPanAutoRun ( int status ) { - if (QQtPluginWatcher::E_ADD == status) + if ( QQtPluginWatcher::E_ADD == status ) { QString mP = QQtPluginWatcher::Instance()->upanMountPath(); - QString app = QString("%1/autorun.sh").arg(mP); - QFile file(app); - if (file.exists()) - if (QDialog::Rejected == QQtMsgBox::question(0, tr("Some app want to run in u disk!accepted?"))) + QString app = QString ( "%1/autorun.sh" ).arg ( mP ); + QFile file ( app ); + if ( file.exists() ) + if ( QDialog::Rejected == QQtMsgBox::question ( 0, tr ( "Some app want to run in u disk!accepted?" ) ) ) return; - QProcess* p = new QProcess(this); - p->setWorkingDirectory(mP); - p->start(app); + QProcess* p = new QProcess ( this ); + p->setWorkingDirectory ( mP ); + p->start ( app ); } } diff --git a/test/qqtliveplayer/qqtliveplayer.pro b/test/qqtliveplayer/qqtliveplayer.pro index 68f9ffb7..a3a9002d 100644 --- a/test/qqtliveplayer/qqtliveplayer.pro +++ b/test/qqtliveplayer/qqtliveplayer.pro @@ -3,9 +3,6 @@ # Project created by QtCreator 2016-06-17T10:03:52 # #------------------------------------------------- -include(../../multi-link/add_base_manager.pri) - - QT += core gui greaterThan(QT_MAJOR_VERSION, 4): QT += widgets @@ -15,43 +12,8 @@ TEMPLATE = app INCLUDEPATH += . - CONFIG += c++11 -unix { - LIBS += -lVLCQtCore -lVLCQtWidgets - #QMAKE_CXXFLAGS += -std=c++11 - #LIBS += -L/usr/local/lib -lVLCQtCore -lVLCQtWidgets - INCLUDEPATH += /usr/local/include -} - -win32 { - ## Windows common build here - - contains(QMAKE_TARGET.arch, x86) { - message("x86 build") - - ## Windows x86 (32bit) specific build here - CONFIG(debug, debug|release) { - LIBS += -LC:\\Users\\tdr\\Documents\\QtSolution\\qt4web\\vlcqt\\lib -lVLCQtCored -lVLCQtWidgetsd - } else { - LIBS += -LC:\\Users\\tdr\\Documents\\QtSolution\\qt4web\\vlcqt\\lib -lVLCQtCore -lVLCQtWidgets - } - INCLUDEPATH += C:\\Users\\tdr\\Documents\\QtSolution\\qt4web\\vlcqt\\include - } else { - message("x86_64 build") - - ## Windows x64 (64bit) specific build here - CONFIG(debug, debug|release) { - LIBS += -LC:\\Users\\tdr\\Documents\\QtSolution\\qt4web\\vlcqt64\\lib -lVLCQtCored -lVLCQtWidgetsd - } else { - LIBS += -LC:\\Users\\tdr\\Documents\\QtSolution\\qt4web\\vlcqt64\\lib -lVLCQtCore -lVLCQtWidgets - } - INCLUDEPATH += C:\\Users\\tdr\\Documents\\QtSolution\\qt4web\\vlcqt64\\include - } -} - - SOURCES += $$PWD/main.cpp $$PWD/qqtapp.cpp $$PWD/qqtwindow.cpp \ animationmanager.cpp @@ -60,14 +22,15 @@ HEADERS += $$PWD/qqtapp.h $$PWD/qqtwindow.h \ FORMS += $$PWD/qqtwindow.ui +include(../../multi-link/add_base_manager.pri) #这个的设置有特点,要先设置 add_version (1,0,0,0) - #先发布App #app从build到deploy add_deploy() - #后发布依赖 #libQQt从sdk到build和deploy -add_deploy_library(QQt) +add_deploy_library_QQt() +include(../../app-lib/add_library_VLC.pri) +add_deploy_library_VLC() diff --git a/test/qqtliveplayer/qqtwindow.cpp b/test/qqtliveplayer/qqtwindow.cpp index 2e1edbd0..e5fabb3f 100644 --- a/test/qqtliveplayer/qqtwindow.cpp +++ b/test/qqtliveplayer/qqtwindow.cpp @@ -16,73 +16,75 @@ #include "qqttreewidget.h" #include "qqtsqltreemodel.h" -QQTWindow::QQTWindow(QWidget *parent) : - QStackedWidget(parent), - ui(new Ui::QQTWindow) +QQTWindow::QQTWindow ( QWidget* parent ) : + QStackedWidget ( parent ), + ui ( new Ui::QQTWindow ) { - ui->setupUi(this); + ui->setupUi ( this ); - QQtObjectManager::registerObject(this); + QQtObjectManager::registerObject ( this ); #ifdef __EMBEDDED_LINUX__ /* * 这里只要frameless足够 */ - setWindowFlags(Qt::FramelessWindowHint); + setWindowFlags ( Qt::FramelessWindowHint ); /* * 控件背景透明,显示设置的图片背景或者下一级背景。 */ - setAttribute(Qt::WA_TranslucentBackground, true); + setAttribute ( Qt::WA_TranslucentBackground, true ); #endif - setFixedSize(1024, 600); - moveCenter(this); - setAcceptDrops(true); + setFixedSize ( 1024, 600 ); + moveCenter ( this ); + setAcceptDrops ( true ); - ui->treeView->setModel(QQTTreeWidget::SQLTREE); - ((QQTSqlTreeModel*)ui->treeView->model()) - ->setFilePath("LiveStream.db"); - ((QQTSqlTreeModel*)ui->treeView->model()) - ->query(""); - for(int i = 1; i < 11; i++) - ui->treeView->setColumnHidden(i, true); - ((QQTSqlTreeModel*)ui->treeView->model()) - ->setHeaderData(0, Qt::Horizontal, tr("pindao liebiao")); - connect(ui->treeView, SIGNAL(doubleClicked(const QModelIndex&)), - this, SLOT(doubleClicked(const QModelIndex&))); + QQtSqlTreeModel* model = new QQtSqlTreeModel ( this ); + ui->treeView->setModel ( model ); -#if 1 - QPixmap pixmap("./skin/default/splash.png"); - QSplashScreen splash(pixmap); - splash.showMessage(tr("Loading..."), Qt::AlignBottom); - splash.setFixedSize(600, 400); + ( ( QQtSqlTreeModel* ) ui->treeView->model() ) + ->setAbsoluteFilePath ( "LiveStream.db" ); + ( ( QQtSqlTreeModel* ) ui->treeView->model() ) + ->query ( "" ); + for ( int i = 1; i < 11; i++ ) + ui->treeView->setColumnHidden ( i, true ); + ( ( QQtSqlTreeModel* ) ui->treeView->model() ) + ->setHeaderData ( 0, Qt::Horizontal, tr ( "pindao liebiao" ) ); + connect ( ui->treeView, SIGNAL ( doubleClicked ( const QModelIndex& ) ), + this, SLOT ( doubleClicked ( const QModelIndex& ) ) ); + +#if 0 + QPixmap pixmap ( "./skin/default/splash.png" ); + QSplashScreen splash ( pixmap ); + splash.showMessage ( tr ( "Loading..." ), Qt::AlignBottom ); + splash.setFixedSize ( 600, 400 ); splash.show(); - QQTSleep(400); - splash.finish(this); + QQtSleep ( 400 ); + splash.finish ( this ); #elif 0 /** * set movie in label0 * label0 will dispear in this function */ - QMovie mov("./skin/default/splash.gif"); + QMovie mov ( "./skin/default/splash.gif" ); QLabel label; - label.setMovie(&mov); - label.setFixedSize(400, 300); - moveCenter(&label); + label.setMovie ( &mov ); + label.setFixedSize ( 400, 300 ); + moveCenter ( &label ); mov.start(); label.show(); - QQTSleep(3000); + QQtSleep ( 3000 ); #endif #if 1 //QCoreApplication::setAttribute(Qt::AA_X11InitThreads); //VlcCommon::setPluginPath(QCoreApplication::applicationDirPath() + "/plugins"); - _instance = new VlcInstance(VlcCommon::args(), this); - _player = new VlcMediaPlayer(_instance); - _player->setVideoWidget(ui->widget); - ui->widget->setMediaPlayer(_player); - ui->widget->setWindowFlags(ui->widget->windowFlags()|Qt::WindowTransparentForInput); - ui->horizontalSlider->setMediaPlayer(_player); - ui->horizontalSlider->setVolume(100); + _instance = new VlcInstance ( VlcCommon::args(), this ); + _player = new VlcMediaPlayer ( _instance ); + _player->setVideoWidget ( ui->widget ); + ui->widget->setMediaPlayer ( _player ); + ui->widget->setWindowFlags ( ui->widget->windowFlags() | Qt::WindowTransparentForInput ); + ui->horizontalSlider->setMediaPlayer ( _player ); + ui->horizontalSlider->setVolume ( 100 ); _media = NULL; //VlcMediaPlayer *_player2; @@ -101,7 +103,7 @@ QQTWindow::QQTWindow(QWidget *parent) : * nobody use animation to mainwindow * so this animation use to child window */ - AnimationManager::Instance(this); + AnimationManager::Instance ( this ); } QQTWindow::~QQTWindow() @@ -109,33 +111,33 @@ QQTWindow::~QQTWindow() delete ui; } -void QQTWindow::doubleClicked(const QModelIndex &index) +void QQTWindow::doubleClicked ( const QModelIndex& index ) { - if(!index.parent().isValid()) + if ( !index.parent().isValid() ) return; - QString uri = index.model()->index(index.row(), 1, index.parent()).data().toString(); + QString uri = index.model()->index ( index.row(), 1, index.parent() ).data().toString(); pline() << uri; - if(_player->hasVout()) + if ( _player->hasVout() ) _player->stop(); - if(_media) + if ( _media ) delete _media; //QString url = "http://ivi.bupt.edu.cn/hls/cctv1.m3u8"; - _media = new VlcMedia(uri, _instance); - _player->open(_media); + _media = new VlcMedia ( uri, _instance ); + _player->open ( _media ); } /** * @brief QQTWindow::dragEnterEvent * 当用户拖动文件到窗口部件上时候,就会触发dragEnterEvent事件 */ -void QQTWindow::dragEnterEvent(QDragEnterEvent *event) +void QQTWindow::dragEnterEvent ( QDragEnterEvent* event ) { //如果为文件,则支持拖放 - if (event->mimeData()->hasFormat("text/uri-list")) + if ( event->mimeData()->hasFormat ( "text/uri-list" ) ) event->acceptProposedAction(); } @@ -143,28 +145,29 @@ void QQTWindow::dragEnterEvent(QDragEnterEvent *event) * @brief QQTWindow::dropEvent * 当用户放下这个文件后,就会触发dropEvent事件 */ -void QQTWindow::dropEvent(QDropEvent *event) +void QQTWindow::dropEvent ( QDropEvent* event ) { /** * 注意:这里如果有多文件存在,意思是用户一下子拖动了多个文件,而不是拖动一个目录 * 如果想读取整个目录,自己编写函数实现读取整个目录文件名 */ QList urls = event->mimeData()->urls(); - if(urls.isEmpty()) + if ( urls.isEmpty() ) return; /** * 往文本框中追加文件名 */ - foreach(QUrl url, urls) { + foreach ( QUrl url, urls ) + { QString file_name = url.toLocalFile(); pline() << file_name; - if(_player->hasVout()) + if ( _player->hasVout() ) _player->stop(); - if(_media) + if ( _media ) delete _media; - _media = new VlcMedia(file_name, true, _instance); - _player->open(_media); + _media = new VlcMedia ( file_name, true, _instance ); + _player->open ( _media ); break; } } diff --git a/test/qqtliveplayer/qqtwindow.ui b/test/qqtliveplayer/qqtwindow.ui index 4de1996f..12132975 100644 --- a/test/qqtliveplayer/qqtwindow.ui +++ b/test/qqtliveplayer/qqtwindow.ui @@ -47,7 +47,7 @@ - + 20 @@ -90,7 +90,7 @@ 1 - QQTTreeWidget + QQtTreeWidget QTreeView
qqttreewidget.h