Skip to content

Commit

Permalink
Merge pull request #3 from QQxiaoming/dev/qt6
Browse files Browse the repository at this point in the history
already completely migrated to Qt6.
  • Loading branch information
QQxiaoming authored Jul 28, 2022
2 parents 88fc84f + ec424e9 commit 0957b10
Show file tree
Hide file tree
Showing 18 changed files with 54 additions and 122 deletions.
50 changes: 4 additions & 46 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,50 +28,8 @@ jobs:

- name: Install Qt
uses: jurplel/[email protected]

- 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/[email protected]
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/[email protected]
version: '6.2.0'

- name: Setup OpenCV
uses: Dovyski/setup-opencv-action@v1
Expand All @@ -82,22 +40,22 @@ 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
- name: Upload build asserts
uses: actions/[email protected]
with:
name: YUVviewer_Ubuntu1804
name: YUVviewer_Ubuntu2004
path: |
./dpkg/*.deb
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ jobs:

- name: Install Qt
uses: jurplel/[email protected]
with:
version: '6.2.0'

- name: Install prerequisites
run: |
Expand All @@ -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
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ jobs:
uses: jurplel/[email protected]
with:
arch: win64_mingw81
version: '6.2.0'

- name: Cache opencv
uses: actions/cache@v2
Expand Down Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions DEVELOPNOTE.md
Original file line number Diff line number Diff line change
Expand Up @@ -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文件以下内容

Expand All @@ -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
###############################################################################
Expand All @@ -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
###############################################################################
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
2 changes: 1 addition & 1 deletion README_zh_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -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或更高版本
23 changes: 15 additions & 8 deletions build_deb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
###############################################################################


Expand All @@ -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")
Expand Down
6 changes: 3 additions & 3 deletions build_dmg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
###############################################################################


Expand Down
6 changes: 3 additions & 3 deletions build_setup.bat
Original file line number Diff line number Diff line change
Expand Up @@ -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"
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::


Expand Down
2 changes: 1 addition & 1 deletion partform_unix.pri
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
# 定义opencv lib路径
OPENCV_DIR=/home/xiaoming/Desktop/opencv
# 定义版本号路径
YUVVIEWER_VERSION=0.4.10
YUVVIEWER_VERSION=0.5.0
###############################################################################
2 changes: 1 addition & 1 deletion partform_win32.pri
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
# 定义opencv lib路径
OPENCV_DIR=D:\Qt\opencv4.2.0
# 定义版本号路径
YUVVIEWER_VERSION=0.4.10
YUVVIEWER_VERSION=0.5.0
###############################################################################
16 changes: 8 additions & 8 deletions src/ImgViewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand All @@ -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();
}
Expand Down
2 changes: 0 additions & 2 deletions src/YUVviewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
18 changes: 8 additions & 10 deletions src/configFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand All @@ -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();
}
}
Expand All @@ -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");
Expand Down
Binary file added tools/linuxdeploy-plugin-qt-x86_64.AppImage
Binary file not shown.
Binary file added tools/linuxdeploy-x86_64.AppImage
Binary file not shown.
Binary file removed tools/linuxdeployqt
Binary file not shown.
32 changes: 0 additions & 32 deletions tools/readme.md

This file was deleted.

0 comments on commit 0957b10

Please sign in to comment.