diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 7c72580..942eac1 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -28,50 +28,8 @@ jobs: - name: Install Qt uses: jurplel/install-qt-action@v2.14.0 - - - name: Setup OpenCV - uses: Dovyski/setup-opencv-action@v1 - with: - opencv-version: 4.0.0 - opencv-extra-modules: false - - - name: Install prerequisites - run: | - sudo apt update - sudo apt install -y make gcc patchelf - - - name: Build all - run: | - git fetch --tags --force - git describe --always --long --dirty --abbrev=10 --tags | awk '{print "\""$0"\""}' > git_tag.inc - sed -i 's/git_tag.inc/git_tag.ci.inc/g' YUVviewer.pro - sed -i 's/QT_DIR=\/opt/QT_DIR=$(cd "$(dirname "$0")";pwd)/g' build_deb.sh - sed -i 's/\/home\/xiaoming\/Desktop\/opencv/\/usr\/local/g' build_deb.sh - sed -i 's/\/home\/xiaoming\/Desktop\/opencv/\/usr\/local/g' partform_unix.pri - ./build_deb.sh - - - name: Upload build asserts - uses: actions/upload-artifact@v2.2.4 with: - name: YUVviewer_Ubuntu2004 - path: | - ./dpkg/*.deb - - - name: Run tests - run: | - if ls ./dpkg | grep ".deb" ; then echo "Pass"; else echo "Failed" && exit 1; fi; - timeout --foreground -s SIGKILL 20s ./dpkg/YUVviewer_Linux_*/opt/YUVviewer/YUVviewer --version > >(tee run.log) || { - if cat run.log | grep "YUVviewer" ; then echo "Pass" && exit 0; else echo "Failed" && exit 1; fi; - } - - ubuntu-1804: - runs-on: ubuntu-18.04 - - steps: - - uses: actions/checkout@v2 - - - name: Install Qt - uses: jurplel/install-qt-action@v2.14.0 + version: '6.2.0' - name: Setup OpenCV uses: Dovyski/setup-opencv-action@v1 @@ -82,14 +40,14 @@ jobs: - name: Install prerequisites run: | sudo apt update - sudo apt install -y make gcc patchelf + sudo apt install -y make gcc patchelf chrpath qt5-default - name: Build all run: | git fetch --tags --force git describe --always --long --dirty --abbrev=10 --tags | awk '{print "\""$0"\""}' > git_tag.inc sed -i 's/git_tag.inc/git_tag.ci.inc/g' YUVviewer.pro - sed -i 's/QT_DIR=\/opt/QT_DIR=$(cd "$(dirname "$0")";pwd)/g' build_deb.sh + sed -i 's/QT_DIR=\/opt\/Qt6.2.0\/6.2.0\/gcc_64/QT_DIR=$(cd "$(dirname "$0")";pwd)\/..\/Qt\/6.2.0\/gcc_64/g' build_deb.sh sed -i 's/\/home\/xiaoming\/Desktop\/opencv/\/usr\/local/g' build_deb.sh sed -i 's/\/home\/xiaoming\/Desktop\/opencv/\/usr\/local/g' partform_unix.pri ./build_deb.sh @@ -97,7 +55,7 @@ jobs: - name: Upload build asserts uses: actions/upload-artifact@v2.2.4 with: - name: YUVviewer_Ubuntu1804 + name: YUVviewer_Ubuntu2004 path: | ./dpkg/*.deb diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index 8fd3990..e28ca7b 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -28,6 +28,8 @@ jobs: - name: Install Qt uses: jurplel/install-qt-action@v2.14.0 + with: + version: '6.2.0' - name: Install prerequisites run: | @@ -44,7 +46,7 @@ jobs: git fetch --tags --force git describe --always --long --dirty --abbrev=10 --tags | awk '{print "\""$0"\""}' > git_tag.inc sed -i'.original' -e 's/git_tag.inc/git_tag.ci.inc/g' YUVviewer.pro - sed -i'.original' -e 's/QT_DIR=\/opt/QT_DIR=$(cd "$(dirname "$0")";pwd)/g' build_dmg.sh + sed -i'.original' -e 's/QT_DIR=\/opt\/Qt6.2.0\/6.2.0\/gcc_64/QT_DIR=$(cd "$(dirname "$0")";pwd)\/..\/Qt\/6.2.0\/gcc_64/g' build_dmg.sh sed -i'.original' -e 's/\/home\/xiaoming\/Desktop\/opencv/\/usr\/local/g' build_dmg.sh sed -i'.original' -e 's/\/home\/xiaoming\/Desktop\/opencv/\/usr\/local/g' partform_unix.pri ./build_dmg.sh diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index a5a1443..4b2a400 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -30,6 +30,7 @@ jobs: uses: jurplel/install-qt-action@v2.14.0 with: arch: win64_mingw81 + version: '6.2.0' - name: Cache opencv uses: actions/cache@v2 @@ -62,8 +63,8 @@ jobs: git fetch --tags --force git describe --always --long --dirty --abbrev=10 --tags | ./tools/awk/awk.exe '{print \"\\\"\"$0\"\\\"\"}' > git_tag.inc ./tools/sed/sed.exe -i "s/git_tag.inc/git_tag.ci.inc/g" YUVviewer.pro - ./tools/sed/sed.exe -i "s/QT_DIR=C:\/Qt\/Qt5.12.8\/5.12.8\/mingw73_32\/bin/QT_DIR=%Qt5_Dir%/g" ./build_setup.bat - ./tools/sed/sed.exe -i "s/QT_TOOLS_DIR=C:\/Qt\/Qt5.12.8\/Tools\/mingw730_32\/bin/QT_TOOLS_DIR=C:\/ProgramData\/Chocolatey\/lib\/mingw\/tools\/install\/mingw64\/bin/g" ./build_setup.bat + ./tools/sed/sed.exe -i "s/QT_DIR=C:\/Qt\/Qt6.2.0\/6.2.0\/mingw81_32\/bin/QT_DIR=%Qt5_Dir%/g" ./build_setup.bat + ./tools/sed/sed.exe -i "s/QT_TOOLS_DIR=C:\/Qt\/Qt6.2.0\/Tools\/mingw810_32\/bin/QT_TOOLS_DIR=C:\/ProgramData\/Chocolatey\/lib\/mingw\/tools\/install\/mingw64\/bin/g" ./build_setup.bat ./tools/sed/sed.exe -i "s/OPENCV_DIR=D:\/Qt\/opencv4.2.0\/x64\/mingw\/bin/OPENCV_DIR=C:\/opencv4.0.0\/x64\/mingw\/bin/g" ./build_setup.bat ./tools/sed/sed.exe -i "s/libopencv_imgproc420/libopencv_imgproc400/g" ./build_setup.bat ./tools/sed/sed.exe -i "s/libopencv_core420/libopencv_core400/g" ./build_setup.bat diff --git a/DEVELOPNOTE.md b/DEVELOPNOTE.md index b5943e7..0840dcb 100644 --- a/DEVELOPNOTE.md +++ b/DEVELOPNOTE.md @@ -32,7 +32,7 @@ set "OPENCV_DIR=D:/Qt/opencv4.2.0/x64/mingw/bin" ## linux -- 安装Qt、patchelf工具,编译opencv lib以及linuxdeployqt工具(tools中已编译好适用于ubuntu18.04的linuxdeployqt工具) +- 安装Qt、patchelf工具,编译opencv lib以及linuxdeployqt工具(tools中已编译好适用于ubuntu20.04的linuxdeployqt工具) - 修改partform_unix.pri文件以下内容 @@ -48,7 +48,7 @@ OPENCV_DIR=/home/xiaoming/Desktop/opencv ```sh ############################################################################### # 定义Qt目录 -QT_DIR=/opt/Qt5.12.2/5.12.2/gcc_64 +QT_DIR=/opt/Qt6.2.0/6.2.0/gcc_64 # 定义opencv目录 OPENCV_DIR=/home/xiaoming/Desktop/opencv ############################################################################### @@ -74,7 +74,7 @@ OPENCV_DIR=/home/xiaoming/Desktop/opencv ```sh ############################################################################### # 定义Qt目录 -QT_DIR=/opt/Qt5.12.2/5.12.2/gcc_64 +QT_DIR=/opt/Qt6.2.0/6.2.0/gcc_64 # 定义opencv目录 OPENCV_DIR=/home/xiaoming/Desktop/opencv ############################################################################### diff --git a/README.md b/README.md index 1c33b01..f9985bb 100644 --- a/README.md +++ b/README.md @@ -44,4 +44,4 @@ YV12、YU12/I420、NV21、NV12、YUY2/YUYV、YVYU、UYVY、YUV444、RGB565_L、R If you have suggestions or ideas for this project, please submit issues and pull requests on GitHub or Gitee. -At present, the project will be transferred to the development based on Qt6. The current branch dev/qt6 code has been completely migrated, and the replacement of the main branch may be completed in the next LTS version of Qt6. +At present, the project has been completely migrated to Qt6 development, it is recommended to use version Qt6.2.0 or higher. diff --git a/README_zh_CN.md b/README_zh_CN.md index a967810..fd8350c 100644 --- a/README_zh_CN.md +++ b/README_zh_CN.md @@ -44,4 +44,4 @@ YV12、YU12/I420、NV21、NV12、YUY2/YUYV、YVYU、UYVY、YUV444、RGB565_L、R 如果您对本项目有建议或想法,欢迎在GitHub或Gitee上提交issue和pull requests。 -目前项目即将转移到基于Qt6开发,目前分支dev/qt6代码已完全完成迁移,也许会在下一个Qt6的LTS版本完成main分支的替换。 +目前项目已完全迁移至Qt6开发,建议使用版本Qt6.2.0或更高版本。 diff --git a/build_deb.sh b/build_deb.sh index 68b10ad..8d67822 100755 --- a/build_deb.sh +++ b/build_deb.sh @@ -2,14 +2,14 @@ ############################################################################### # 定义Qt目录 -QT_DIR=/opt/Qt5.12.2/5.12.2/gcc_64 +QT_DIR=/opt/Qt6.2.0/6.2.0/gcc_64 # 定义opencv目录 OPENCV_DIR=/home/xiaoming/Desktop/opencv # 定义版本号 YUVVIEWER_MAJARVERSION="0" -YUVVIEWER_SUBVERSION="4" -YUVVIEWER_REVISION="10" +YUVVIEWER_SUBVERSION="5" +YUVVIEWER_REVISION="0" ############################################################################### @@ -30,13 +30,20 @@ rm -rf ./dpkg/YUVviewer_Linux_"$YUVVIEWER_VERSION"_x86_64 rm -f ./dpkg/YUVviewer_Linux_"$YUVVIEWER_VERSION"_x86_64.deb # 构建打包目录 cp -r ./dpkg/YUVviewer ./dpkg/YUVviewer_Linux_"$YUVVIEWER_VERSION"_x86_64 -mkdir -p ./dpkg/YUVviewer_Linux_"$YUVVIEWER_VERSION"_x86_64/opt/YUVviewer -cp -r ./test ./dpkg/YUVviewer_Linux_"$YUVVIEWER_VERSION"_x86_64/opt/YUVviewer/test -cp ./build_release/out/YUVviewer ./dpkg/YUVviewer_Linux_"$YUVVIEWER_VERSION"_x86_64/opt/YUVviewer/YUVviewer # 使用linuxdeployqt拷贝依赖so库到打包目录 -./tools/linuxdeployqt ./dpkg/YUVviewer_Linux_"$YUVVIEWER_VERSION"_x86_64/opt/YUVviewer/YUVviewer -appimage -rm -rf ./dpkg/YUVviewer_Linux_"$YUVVIEWER_VERSION"_x86_64/opt/YUVviewer/doc ./dpkg/YUVviewer_Linux_"$YUVVIEWER_VERSION"_x86_64/opt/YUVviewer/default.png ./dpkg/YUVviewer_Linux_"$YUVVIEWER_VERSION"_x86_64/opt/YUVviewer/AppRun ./dpkg/YUVviewer_Linux_"$YUVVIEWER_VERSION"_x86_64/opt/YUVviewer/default.desktop +export QMAKE=$QT_DIR/bin/qmake +./tools/linuxdeploy-x86_64.AppImage --executable=./build_release/out/YUVviewer --appdir=./dpkg/YUVviewer_Linux_"$YUVVIEWER_VERSION"_x86_64/opt --plugin=qt +rm -rf ./dpkg/YUVviewer_Linux_"$YUVVIEWER_VERSION"_x86_64/opt/apprun-hooks +mv ./dpkg/YUVviewer_Linux_"$YUVVIEWER_VERSION"_x86_64/opt/usr ./dpkg/YUVviewer_Linux_"$YUVVIEWER_VERSION"_x86_64/opt/YUVviewer +mv ./dpkg/YUVviewer_Linux_"$YUVVIEWER_VERSION"_x86_64/opt/YUVviewer/bin/YUVviewer ./dpkg/YUVviewer_Linux_"$YUVVIEWER_VERSION"_x86_64/opt/YUVviewer/YUVviewer +mv ./dpkg/YUVviewer_Linux_"$YUVVIEWER_VERSION"_x86_64/opt/YUVviewer/bin/qt.conf ./dpkg/YUVviewer_Linux_"$YUVVIEWER_VERSION"_x86_64/opt/YUVviewer/qt.conf +rm -rf ./dpkg/YUVviewer_Linux_"$YUVVIEWER_VERSION"_x86_64/opt/YUVviewer/bin +sed -i "s/Prefix = ..\//Prefix = .\//g" ./dpkg/YUVviewer_Linux_"$YUVVIEWER_VERSION"_x86_64/opt/YUVviewer/qt.conf +chrpath -r "\$ORIGIN/./lib" ./dpkg/YUVviewer_Linux_"$YUVVIEWER_VERSION"_x86_64/opt/YUVviewer/YUVviewer +rm -rf ./dpkg/YUVviewer_Linux_"$YUVVIEWER_VERSION"_x86_64/opt/YUVviewer/share cp ./img/ico.png ./dpkg/YUVviewer_Linux_"$YUVVIEWER_VERSION"_x86_64/opt/YUVviewer/YUVviewer.png +mkdir -p ./dpkg/YUVviewer_Linux_"$YUVVIEWER_VERSION"_x86_64/opt/YUVviewer +cp -r ./test ./dpkg/YUVviewer_Linux_"$YUVVIEWER_VERSION"_x86_64/opt/YUVviewer/test # 配置打包信息 sed -i "s/#VERSION#/$YUVVIEWER_MAJARVERSION.$YUVVIEWER_SUBVERSION$YUVVIEWER_REVISION/g" ./dpkg/YUVviewer_Linux_"$YUVVIEWER_VERSION"_x86_64/DEBIAN/control SIZE=$(du -sh -B 1024 ./dpkg/YUVviewer_Linux_"$YUVVIEWER_VERSION"_x86_64 | sed "s/.\///g") diff --git a/build_dmg.sh b/build_dmg.sh index 8ae53ab..848577f 100755 --- a/build_dmg.sh +++ b/build_dmg.sh @@ -2,14 +2,14 @@ ############################################################################### # 定义Qt目录 -QT_DIR=/opt/Qt5.12.2/5.12.2/gcc_64 +QT_DIR=/opt/Qt6.2.0/6.2.0/gcc_64 # 定义opencv目录 OPENCV_DIR=/home/xiaoming/Desktop/opencv # 定义版本号 YUVVIEWER_MAJARVERSION="0" -YUVVIEWER_SUBVERSION="4" -YUVVIEWER_REVISION="10" +YUVVIEWER_SUBVERSION="5" +YUVVIEWER_REVISION="0" ############################################################################### diff --git a/build_setup.bat b/build_setup.bat index b7adec9..ed4e3fe 100644 --- a/build_setup.bat +++ b/build_setup.bat @@ -2,14 +2,14 @@ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 定义Qt目录 -set "QT_DIR=C:/Qt/Qt5.12.8/5.12.8/mingw73_32/bin" -set "QT_TOOLS_DIR=C:/Qt/Qt5.12.8/Tools/mingw730_32/bin" +set "QT_DIR=C:/Qt/Qt6.2.0/6.2.0/mingw81_32/bin" +set "QT_TOOLS_DIR=C:/Qt/Qt6.2.0/Tools/mingw810_32/bin" :: 定义Inno Setup目录 set "INNO_SETUP_DIR=C:/Program Files (x86)/Inno Setup 6" :: 定义opencv目录 set "OPENCV_DIR=D:/Qt/opencv4.2.0/x64/mingw/bin" :: 定义版本号 -set "YUVVIEWER_VERSION=0.4.10" +set "YUVVIEWER_VERSION=0.5.0" ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: diff --git a/partform_unix.pri b/partform_unix.pri index 01425ab..8c8e55e 100644 --- a/partform_unix.pri +++ b/partform_unix.pri @@ -2,5 +2,5 @@ # 定义opencv lib路径 OPENCV_DIR=/home/xiaoming/Desktop/opencv # 定义版本号路径 -YUVVIEWER_VERSION=0.4.10 +YUVVIEWER_VERSION=0.5.0 ############################################################################### diff --git a/partform_win32.pri b/partform_win32.pri index e32275f..06fab6b 100644 --- a/partform_win32.pri +++ b/partform_win32.pri @@ -2,5 +2,5 @@ # 定义opencv lib路径 OPENCV_DIR=D:\Qt\opencv4.2.0 # 定义版本号路径 -YUVVIEWER_VERSION=0.4.10 +YUVVIEWER_VERSION=0.5.0 ############################################################################### diff --git a/src/ImgViewer.cpp b/src/ImgViewer.cpp index 6e3e4d6..64793a9 100644 --- a/src/ImgViewer.cpp +++ b/src/ImgViewer.cpp @@ -286,10 +286,10 @@ void ImgViewer::wheelEvent(QWheelEvent *event) { if(this->flipRGB) { this->scaled_img = this->scaled_img.rgbSwapped(); } - float new_w = event->x() - - (this->scaled_img.width() * (event->x() - this->point.x())) / (this->scaled_img.width() - setpsize_x); - float new_h = event->y() - - (this->scaled_img.height() * (event->y() - this->point.y())) / (this->scaled_img.height() - setpsize_y); + float new_w = event->position().x() - + (this->scaled_img.width() * (event->position().x() - this->point.x())) / (this->scaled_img.width() - setpsize_x); + float new_h = event->position().y() - + (this->scaled_img.height() * (event->position().y() - this->point.y())) / (this->scaled_img.height() - setpsize_y); this->point = QPoint(new_w, new_h); this->repaint(); } @@ -305,10 +305,10 @@ void ImgViewer::wheelEvent(QWheelEvent *event) { if(this->flipRGB) { this->scaled_img = this->scaled_img.rgbSwapped(); } - float new_w = event->x() - - (this->scaled_img.width() * (event->x() - this->point.x())) / (this->scaled_img.width() + setpsize_x); - float new_h = event->y() - - (this->scaled_img.height() * (event->y() - this->point.y())) / (this->scaled_img.height() + setpsize_y); + float new_w = event->position().x() - + (this->scaled_img.width() * (event->position().x() - this->point.x())) / (this->scaled_img.width() + setpsize_x); + float new_h = event->position().y() - + (this->scaled_img.height() * (event->position().y() - this->point.y())) / (this->scaled_img.height() + setpsize_y); this->point = QPoint(new_w, new_h); this->repaint(); } diff --git a/src/YUVviewer.cpp b/src/YUVviewer.cpp index 6669b61..e442c84 100644 --- a/src/YUVviewer.cpp +++ b/src/YUVviewer.cpp @@ -615,8 +615,6 @@ int main(int argc, char *argv[]) { return 0; } } - QApplication::setAttribute(Qt::AA_EnableHighDpiScaling); - QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps); QApplication::setAttribute(Qt::AA_DontUseNativeDialogs); QApplication::setAttribute(Qt::AA_DontUseNativeMenuBar); QApplication::setAttribute(Qt::AA_DontCreateNativeWidgetSiblings); diff --git a/src/configFile.cpp b/src/configFile.cpp index 3421435..d48318a 100644 --- a/src/configFile.cpp +++ b/src/configFile.cpp @@ -27,7 +27,6 @@ ConfigFile::ConfigFile(QString path) { QFile file(configFilePath); file.open(QFile::WriteOnly | QFile::Text); QXmlStreamWriter writer(&file); - writer.setCodec("UTF-8"); // XML 编码 writer.setAutoFormatting(true); // 自动格式化 writer.writeStartDocument("1.0"); // 开始文档(XML 声明) writer.writeStartElement("config"); @@ -49,21 +48,21 @@ ConfigFile::ConfigFile(QString path) { while(!reader.atEnd()) { if(reader.isStartElement()) { - if(reader.name() == "lastPath") { + if(reader.name().toString() == "lastPath") { config_dict.lastPath = reader.readElementText(); - } else if(reader.name() == "frameSizeType") { + } else if(reader.name().toString() == "frameSizeType") { config_dict.frameSizeType = reader.readElementText(); - } else if(reader.name() == "YUVFormat") { + } else if(reader.name().toString() == "YUVFormat") { config_dict.YUVFormat = reader.readElementText(); - } else if(reader.name() == "frameSize_Width") { + } else if(reader.name().toString() == "frameSize_Width") { config_dict.frameSize_Width = reader.readElementText(); - } else if(reader.name() == "frameSize_Height") { + } else if(reader.name().toString() == "frameSize_Height") { config_dict.frameSize_Height = reader.readElementText(); - } else if(reader.name() == "frameRate") { + } else if(reader.name().toString() == "frameRate") { config_dict.frameRate = reader.readElementText(); - } else if(reader.name() == "startFrame") { + } else if(reader.name().toString() == "startFrame") { config_dict.startFrame = reader.readElementText(); - } else if(reader.name() == "endFrame") { + } else if(reader.name().toString() == "endFrame") { config_dict.endFrame = reader.readElementText(); } } @@ -79,7 +78,6 @@ ConfigFile::~ConfigFile() { file.resize(0); QXmlStreamWriter writer(&file); - writer.setCodec("UTF-8"); // XML 编码 writer.setAutoFormatting(true); // 自动格式化 writer.writeStartDocument("1.0"); // 开始文档(XML 声明) writer.writeStartElement("config"); diff --git a/tools/linuxdeploy-plugin-qt-x86_64.AppImage b/tools/linuxdeploy-plugin-qt-x86_64.AppImage new file mode 100755 index 0000000..7ff6acc Binary files /dev/null and b/tools/linuxdeploy-plugin-qt-x86_64.AppImage differ diff --git a/tools/linuxdeploy-x86_64.AppImage b/tools/linuxdeploy-x86_64.AppImage new file mode 100755 index 0000000..3da1fb0 Binary files /dev/null and b/tools/linuxdeploy-x86_64.AppImage differ diff --git a/tools/linuxdeployqt b/tools/linuxdeployqt deleted file mode 100755 index 04dd935..0000000 Binary files a/tools/linuxdeployqt and /dev/null differ diff --git a/tools/readme.md b/tools/readme.md deleted file mode 100644 index f600bfa..0000000 --- a/tools/readme.md +++ /dev/null @@ -1,32 +0,0 @@ -# 编译linuxdeployqt - -## 获取源码 - -```shell -git clone https://github.com/probonopd/linuxdeployqt.git - -cd linuxdeployqt -``` - -## 屏蔽以下代码 - -```c++ -// openSUSE Leap 15.0 uses glibc 2.26 and is used on OBS - if (strverscmp (glcv, "2.27") >= 0) { //注释版本检查 - qInfo() << "ERROR: The host system is too new."; - qInfo() << "Please run on a system with a glibc version no newer than what comes with the oldest"; - qInfo() << "currently still-supported mainstream distribution (xenial), which is glibc 2.23."; - qInfo() << "This is so that the resulting bundle will work on most still-supported Linux distributions."; - qInfo() << "For more information, please see"; - qInfo() << "https://github.com/probonopd/linuxdeployqt/issues/340"; - return 1; - } -``` - -```shell -cmake . - -make - -cp ./tools/linuxdeployqt ../linuxdeployqt -```