Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump Qt version #79

Merged
merged 10 commits into from
Jun 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 29 additions & 31 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ on:
env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release
AQT_VERSION: '==2.1.*'
QT_VERSION: '6.5.0'
AQT_VERSION: '==3.1.*'
QT_VERSION: '6.7.1'

jobs:
# send-slack-notification:
Expand Down Expand Up @@ -174,7 +174,8 @@ jobs:
OGRE_DIR: ${{github.workspace}}/ogre-build/SDK/CMake/
CMAKE_GENERATOR: "MinGW Makefiles"
ASSIMP_DIR: C:/PROGRA~2/Assimp
run: cmake -S . -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DQT_QMAKE_EXECUTABLE=qmake -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DCMAKE_EXE_LINKER_FLAGS=-static -DQt6_DIR=D:/a/QtMeshEditor/Qt/6.5.0/gcc_64/lib/cmake/Qt6 -DQT_DIR=D:/a/QtMeshEditor/Qt/6.5.0/gcc_64/lib/cmake/Qt6 -DQt6GuiTools_DIR=D:/a/QtMeshEditor/Qt/6.5.0/gcc_64/lib/cmake/Qt6GuiTools -DOGRE_DIR=${{github.workspace}}/ogre-build/SDK/CMake/ -DASSIMP_DIR=C:/PROGRA~2/Assimp/lib/cmake/assimp-5.2
run: |
cmake -S . -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DQT_QMAKE_EXECUTABLE=qmake -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DCMAKE_EXE_LINKER_FLAGS=-static -DQt6_DIR=D:/a/QtMeshEditor/Qt/${{env.QT_VERSION}}/gcc_64/lib/cmake/Qt6 -DQT_DIR=D:/a/QtMeshEditor/Qt/${{env.QT_VERSION}}/gcc_64/lib/cmake/Qt6 -DQt6GuiTools_DIR=D:/a/QtMeshEditor/Qt/${{env.QT_VERSION}}/gcc_64/lib/cmake/Qt6GuiTools -DOGRE_DIR=${{github.workspace}}/ogre-build/SDK/CMake/ -DASSIMP_DIR=C:/PROGRA~2/Assimp/lib/cmake/assimp-5.2
shell: cmd

- name: Build
Expand Down Expand Up @@ -336,13 +337,10 @@ jobs:
sudo make install -j8

build-linux:
# The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac.
# You can convert this to a matrix build if you need cross-platform coverage.
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
needs: [build-n-cache-assimp-linux, build-n-cache-ogre-linux]
runs-on: ubuntu-latest
env:
LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.11.1/x64/lib:/home/runner/work/QtMeshEditor/Qt/6.5.0/gcc_64/lib/:/usr/local/lib/:/usr/local/lib/OGRE/:/usr/local/lib/pkgconfig/
LD_LIBRARY_PATH: /usr/local/lib/:/usr/local/lib/OGRE/:/usr/local/lib/pkgconfig/
steps:
- uses: actions/checkout@v3.5.3
with:
Expand All @@ -355,7 +353,7 @@ jobs:
version: ${{ env.QT_VERSION }}
host: 'linux'
target: 'desktop'
arch: 'gcc_64'
arch: 'linux_gcc_64'

- name: change folder permissions
run: |
Expand Down Expand Up @@ -400,18 +398,18 @@ jobs:
sudo cmake -S . -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} \
-DASSIMP_DIR=/usr/local/lib/cmake/assimp-5.2 \
-DASSIMP_INCLUDE_DIR=/usr/local/include/assimp \
-DQt6_DIR=/home/runner/work/QtMeshEditor/Qt/6.5.0/gcc_64/lib/cmake/Qt6 \
-DQT_DIR=/home/runner/work/QtMeshEditor/Qt/6.5.0/gcc_64/lib/cmake/Qt6 \
-DQt6GuiTools_DIR=/home/runner/work/QtMeshEditor/Qt/6.5.0/gcc_64/lib/cmake/Qt6GuiTools
-DQt6_DIR=/home/runner/work/QtMeshEditor/Qt/${{ env.QT_VERSION }}/gcc_64/lib/cmake/Qt6 \
-DQT_DIR=/home/runner/work/QtMeshEditor/Qt/${{ env.QT_VERSION }}/gcc_64/lib/cmake/Qt6 \
-DQt6GuiTools_DIR=/home/runner/work/QtMeshEditor/Qt/${{ env.QT_VERSION }}/gcc_64/lib/cmake/Qt6GuiTools

- name: Build
run: sudo make install -j8

- name: Add missing libraries
run: |
sudo cp -R /home/runner/work/QtMeshEditor/Qt/6.5.0/gcc_64/lib/libicui18n.* ./bin
sudo cp -R /home/runner/work/QtMeshEditor/Qt/6.5.0/gcc_64/lib/libicuuc.* ./bin
sudo cp -R /home/runner/work/QtMeshEditor/Qt/6.5.0/gcc_64/lib/libicudata.* ./bin
sudo cp -R /home/runner/work/QtMeshEditor/Qt/${{ env.QT_VERSION }}/gcc_64/lib/libicui18n.* ./bin
sudo cp -R /home/runner/work/QtMeshEditor/Qt/${{ env.QT_VERSION }}/gcc_64/lib/libicuuc.* ./bin
sudo cp -R /home/runner/work/QtMeshEditor/Qt/${{ env.QT_VERSION }}/gcc_64/lib/libicudata.* ./bin

- name: Manual Pack
run: |
Expand Down Expand Up @@ -463,7 +461,7 @@ jobs:
runs-on: ubuntu-latest
permissions: read-all
env:
LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.11.1/x64/lib:/home/runner/work/QtMeshEditor/Qt/6.5.0/gcc_64/lib/:/usr/local/lib/:/usr/local/lib/OGRE/:/usr/local/lib/pkgconfig/:/lib/x86_64-linux-gnu/
LD_LIBRARY_PATH: gcc_64/lib/:/usr/local/lib/:/usr/local/lib/OGRE/:/usr/local/lib/pkgconfig/:/lib/x86_64-linux-gnu/
BUILD_WRAPPER_OUT_DIR: ./
QT_QPA_PLATFORM: minimal
QT_DEBUG_PLUGINS: 1
Expand All @@ -481,7 +479,7 @@ jobs:
version: ${{ env.QT_VERSION }}
host: 'linux'
target: 'desktop'
arch: 'gcc_64'
arch: 'linux_gcc_64'

- name: change folder permissions
run: |
Expand Down Expand Up @@ -527,9 +525,9 @@ jobs:
sudo cmake -S . -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} \
-DASSIMP_DIR=/usr/local/lib/cmake/assimp-5.2 \
-DASSIMP_INCLUDE_DIR=/usr/local/include/assimp \
-DQt6_DIR=/home/runner/work/QtMeshEditor/Qt/6.5.0/gcc_64/lib/cmake/Qt6 \
-DQT_DIR=/home/runner/work/QtMeshEditor/Qt/6.5.0/gcc_64/lib/cmake/Qt6 \
-DQt6GuiTools_DIR=/home/runner/work/QtMeshEditor/Qt/6.5.0/gcc_64/lib/cmake/Qt6GuiTools \
-DQt6_DIR=/home/runner/work/QtMeshEditor/Qt/${{ env.QT_VERSION }}/gcc_64/lib/cmake/Qt6 \
-DQT_DIR=/home/runner/work/QtMeshEditor/Qt/${{ env.QT_VERSION }}/gcc_64/lib/cmake/Qt6 \
-DQt6GuiTools_DIR=/home/runner/work/QtMeshEditor/Qt/${{ env.QT_VERSION }}/gcc_64/lib/cmake/Qt6GuiTools \
-DBUILD_TESTS=ON -DCMAKE_CXX_FLAGS=--coverage -DCMAKE_EXE_LINKER_FLAGS=--coverage \
-DBUILD_QT_MESH_EDITOR=OFF

Expand All @@ -541,9 +539,9 @@ jobs:

- name: Add missing libraries
run: |
sudo cp -R /home/runner/work/QtMeshEditor/Qt/6.5.0/gcc_64/lib/libicui18n.* ./bin
sudo cp -R /home/runner/work/QtMeshEditor/Qt/6.5.0/gcc_64/lib/libicuuc.* ./bin
sudo cp -R /home/runner/work/QtMeshEditor/Qt/6.5.0/gcc_64/lib/libicudata.* ./bin
sudo cp -R /home/runner/work/QtMeshEditor/Qt/${{ env.QT_VERSION }}/gcc_64/lib/libicui18n.* ./bin
sudo cp -R /home/runner/work/QtMeshEditor/Qt/${{ env.QT_VERSION }}/gcc_64/lib/libicuuc.* ./bin
sudo cp -R /home/runner/work/QtMeshEditor/Qt/${{ env.QT_VERSION }}/gcc_64/lib/libicudata.* ./bin
sudo cp -R ./bin/*.so* /lib/x86_64-linux-gnu
sudo cp -R /usr/local/lib/OGRE/* /lib/x86_64-linux-gnu
sudo cp -R /usr/local/lib/OGRE/* ./bin
Expand All @@ -556,7 +554,7 @@ jobs:
run: |
export QT_QPA_PLATFORM="minimal"
export QT_DEBUG_PLUGINS=1
sudo cp -R /home/runner/work/QtMeshEditor/Qt/6.5.0/gcc_64/lib/ /lib/x86_64-linux-gnu/
sudo cp -R /home/runner/work/QtMeshEditor/Qt/${{ env.QT_VERSION }}/gcc_64/lib/ /lib/x86_64-linux-gnu/
sudo apt -y install libxcb-xinerama0 libxcb-cursor0 libx11-dev xvfb
Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &
export DISPLAY=:99
Expand Down Expand Up @@ -768,9 +766,9 @@ jobs:
-DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} \
-DASSIMP_DIR=/usr/local/lib/cmake/assimp-5.4 \
-DASSIMP_INCLUDE_DIR=/usr/local/include/assimp \
-DQt6_DIR=/Users/runner/work/QtMeshEditor/Qt/6.5.0/clang_64/lib/cmake/Qt6 \
-DQT_DIR=/Users/runner/work/QtMeshEditor/Qt/6.5.0/clang_64/lib/cmake/Qt6 \
-DQt6GuiTools_DIR=/Users/runner/work/QtMeshEditor/Qt/6.5.0/clang_64/lib/cmake/Qt6GuiTools \
-DQt6_DIR=/Users/runner/work/QtMeshEditor/Qt/${{ env.QT_VERSION }}/clang_64/lib/cmake/Qt6 \
-DQT_DIR=/Users/runner/work/QtMeshEditor/Qt/${{ env.QT_VERSION }}/clang_64/lib/cmake/Qt6 \
-DQt6GuiTools_DIR=/Users/runner/work/QtMeshEditor/Qt/${{ env.QT_VERSION }}/clang_64/lib/cmake/Qt6GuiTools \
-DOGRE_DIR=${{github.workspace}}/ogre/SDK/CMake/

- name: Build
Expand All @@ -780,11 +778,11 @@ jobs:

- name: Copy Qt libs to app folder
run: |
sudo cp -R /Users/runner/work/QtMeshEditor/Qt/6.5.0/macos/lib/QtWidgets.framework ${{github.workspace}}/bin/QtMeshEditor.app/Contents/MacOS/QtWidgets.framework
sudo cp -R /Users/runner/work/QtMeshEditor/Qt/6.5.0/macos/lib/QtCore.framework ${{github.workspace}}/bin/QtMeshEditor.app/Contents/MacOS/QtCore.framework
sudo cp -R /Users/runner/work/QtMeshEditor/Qt/6.5.0/macos/lib/QtGui.framework ${{github.workspace}}/bin/QtMeshEditor.app/Contents/MacOS/QtGui.framework
sudo cp -R /Users/runner/work/QtMeshEditor/Qt/6.5.0/macos/lib/QtDBus.framework ${{github.workspace}}/bin/QtMeshEditor.app/Contents/MacOS/QtDBus.framework
sudo cp -R /Users/runner/work/QtMeshEditor/Qt/6.5.0/macos/plugins/platforms ${{github.workspace}}/bin/QtMeshEditor.app/Contents/MacOS/platforms
sudo cp -R /Users/runner/work/QtMeshEditor/Qt/${{ env.QT_VERSION }}/macos/lib/QtWidgets.framework ${{github.workspace}}/bin/QtMeshEditor.app/Contents/MacOS/QtWidgets.framework
sudo cp -R /Users/runner/work/QtMeshEditor/Qt/${{ env.QT_VERSION }}/macos/lib/QtCore.framework ${{github.workspace}}/bin/QtMeshEditor.app/Contents/MacOS/QtCore.framework
sudo cp -R /Users/runner/work/QtMeshEditor/Qt/${{ env.QT_VERSION }}/macos/lib/QtGui.framework ${{github.workspace}}/bin/QtMeshEditor.app/Contents/MacOS/QtGui.framework
sudo cp -R /Users/runner/work/QtMeshEditor/Qt/${{ env.QT_VERSION }}/macos/lib/QtDBus.framework ${{github.workspace}}/bin/QtMeshEditor.app/Contents/MacOS/QtDBus.framework
sudo cp -R /Users/runner/work/QtMeshEditor/Qt/${{ env.QT_VERSION }}/macos/plugins/platforms ${{github.workspace}}/bin/QtMeshEditor.app/Contents/MacOS/platforms
sudo cp -R /usr/local/lib/libassimp* ${{github.workspace}}/bin/QtMeshEditor.app/Contents/MacOS/

- name: Prepare for packing
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,6 @@ src/qrc_resource.cpp
**/.cache/*
compile_commands.json
install_manifest.txt
.ninja_deps
.ninja_log
build.ninja
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON)
##############################################################
#Find Qt Packages
find_package(QT NAMES Qt6)
find_package(Qt6 REQUIRED COMPONENTS Core Widgets Gui QuickWidgets Quick Test)
find_package(Qt6 REQUIRED COMPONENTS Core Widgets Gui QuickWidgets Quick Test Network)

message("Found Qt (${QT_VERSION_MAJOR})")

Expand All @@ -74,6 +74,7 @@ SET (QTLIBLIST
Qt${QT_VERSION_MAJOR}Widgets
Qt${QT_VERSION_MAJOR}QuickWidgets
Qt${QT_VERSION_MAJOR}Quick
Qt${QT_VERSION_MAJOR}Network
)
FOREACH(qtlib ${QTLIBLIST})
include_directories(${${qtlib}_INCLUDE_DIRS})
Expand Down
3 changes: 2 additions & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,7 @@ ${ASSIMP_LIBRARIES}
Qt::Gui
Qt::Core
Qt::Widgets
Qt::Network
)
ENDIF()

Expand Down Expand Up @@ -273,7 +274,7 @@ if(BUILD_TESTS)
${OGRE_Codec_Assimp_LIBRARY_REL} #TODO: find a better way to link ogreassimp
${OGRE_LIBRARIES}
${ASSIMP_LIBRARIES}
Qt::Widgets Qt::Core Qt::Gui Qt::Test)
Qt::Widgets Qt::Core Qt::Gui Qt::Test Qt::Network)

ADD_DEPENDENCIES(UnitTests ui)

Expand Down
1 change: 1 addition & 0 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ int main(int argc, char *argv[])
QCoreApplication::setOrganizationName("QtMeshEditor");
QCoreApplication::setOrganizationDomain("none");
QCoreApplication::setApplicationName("QtMeshEditor");
QCoreApplication::setApplicationVersion(QTMESHEDITOR_VERSION);

a.setStyle(QStyleFactory::create("Fusion"));

Expand Down
57 changes: 56 additions & 1 deletion src/mainwindow.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
#include <QMessageBox>
#include <QSettings>
#include <QApplication>
#include <QNetworkRequest>
#include <QNetworkReply>
#include <QJsonDocument>
#include <QJsonObject>
#include <QJsonValue>
#include <QJsonArray>
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include "OgreWidget.h"
Expand All @@ -21,7 +27,8 @@
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent), ui(new Ui::MainWindow),
customPaletteColorDialog(new QColorDialog(this)),
ambientLightColorDialog(new QColorDialog(this))
ambientLightColorDialog(new QColorDialog(this)),
networkManager(new QNetworkAccessManager(this))
{
ui->setupUi(this);

Expand Down Expand Up @@ -97,6 +104,7 @@ MainWindow::~MainWindow()
}

delete ui;
delete networkManager;
if(m_pTransformWidget)
{
delete m_pTransformWidget;
Expand Down Expand Up @@ -696,3 +704,50 @@ void MainWindow::custom_Palette_Color_Selected(const QColor &color)
ui->actionCustom->blockSignals(false);
}


void MainWindow::on_actionVerify_Update_triggered()
{
// Verify if the latest release on GitHub is equal to the current version
// If not, ask the user if he wants to update
// If yes, download the latest release and install it

// Send a GET request to the GitHub API to retrieve the latest release information
QNetworkRequest request(QUrl("https://api.github.com/repos/fernandotonon/QtMeshEditor/releases/latest"));
QNetworkReply* reply = networkManager->get(request);

// Connect the finished signal to a slot to handle the response
connect(reply, &QNetworkReply::finished, [=]() {
if (reply->error() == QNetworkReply::NoError) {
// Read the response data
QByteArray data = reply->readAll();

// Parse the JSON response
QJsonDocument doc = QJsonDocument::fromJson(data);
QJsonObject obj = doc.object();

// Get the tag name of the latest release
QString latestVersion = obj.value("tag_name").toString();
QString currentVersion = QApplication::applicationVersion();
if (latestVersion == currentVersion) {
// The latest release is equal to the current version
QMessageBox::information(nullptr, "Update", "You're using the latest release.");
} else {
// The latest release is different from the current version
QMessageBox::StandardButton reply = QMessageBox::question(nullptr, "Update", "A new version is available. Do you want to update?", QMessageBox::Yes | QMessageBox::No);
// if yes, open the download link in the default browser
if (reply == QMessageBox::Yes) {
QString downloadUrl = obj.value("html_url").toString();
QDesktopServices::openUrl(QUrl(downloadUrl));
}
}
} else {
// Handle the error
qDebug() << "Error: " << reply->errorString();
}

// Clean up
reply->deleteLater();
});

}

4 changes: 4 additions & 0 deletions src/mainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include <QTableWidget>
#include <QColorDialog>
#include <OgreFrameListener.h>
#include <QNetworkAccessManager>

#include "TransformOperator.h"

Expand Down Expand Up @@ -70,6 +71,8 @@ private slots:

void on_actionCustom_toggled(bool arg1);

void on_actionVerify_Update_triggered();

public slots:
void setPlaying(bool playing);

Expand All @@ -90,6 +93,7 @@ public slots:
QString mCurrentPalette;
QColorDialog* customPaletteColorDialog;
QColorDialog* ambientLightColorDialog;
QNetworkAccessManager *networkManager;

void custom_Palette_Color_Selected(const QColor& color);
protected:
Expand Down
22 changes: 13 additions & 9 deletions ui_files/mainwindow.ui
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<string>QtMeshEditor</string>
</property>
<property name="windowIcon">
<iconset resource="../resources/resource.qrc">
<iconset>
<normaloff>:/icones/icone.ico</normaloff>:/icones/icone.ico</iconset>
</property>
<property name="documentMode">
Expand Down Expand Up @@ -102,6 +102,7 @@
<string>Help</string>
</property>
<addaction name="actionAbout"/>
<addaction name="actionVerify_Update"/>
</widget>
<addaction name="menuFile"/>
<addaction name="menuOp_es"/>
Expand Down Expand Up @@ -220,7 +221,7 @@
</action>
<action name="actionAdd_Primitive">
<property name="icon">
<iconset resource="../resources/resource.qrc">
<iconset>
<normaloff>:/icones/cube.png</normaloff>:/icones/cube.png</iconset>
</property>
<property name="text">
Expand Down Expand Up @@ -278,7 +279,7 @@
<bool>true</bool>
</property>
<property name="icon">
<iconset resource="../resources/resource.qrc">
<iconset>
<normaloff>:/icones/move.png</normaloff>:/icones/move.png</iconset>
</property>
<property name="text">
Expand All @@ -296,7 +297,7 @@
<bool>true</bool>
</property>
<property name="icon">
<iconset resource="../resources/resource.qrc">
<iconset>
<normaloff>:/icones/rotacionar.png</normaloff>:/icones/rotacionar.png</iconset>
</property>
<property name="text">
Expand All @@ -314,7 +315,7 @@
<bool>false</bool>
</property>
<property name="icon">
<iconset resource="../resources/resource.qrc">
<iconset>
<normaloff>:/icones/selecionar.png</normaloff>:/icones/selecionar.png</iconset>
</property>
<property name="text">
Expand All @@ -326,7 +327,7 @@
</action>
<action name="actionRemove_Object">
<property name="icon">
<iconset resource="../resources/resource.qrc">
<iconset>
<normaloff>:/icones/remove.png</normaloff>:/icones/remove.png</iconset>
</property>
<property name="text">
Expand Down Expand Up @@ -415,10 +416,13 @@
<string>Custom</string>
</property>
</action>
<action name="actionVerify_Update">
<property name="text">
<string>Verify Update</string>
</property>
</action>
</widget>
<layoutdefault spacing="6" margin="11"/>
<resources>
<include location="../resources/resource.qrc"/>
</resources>
<resources/>
<connections/>
</ui>
Loading