summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Rettberg2017-11-15 16:29:56 +0100
committerSimon Rettberg2017-11-15 16:29:56 +0100
commit2261e82dbc4716fc83314e9e247f0d1e76629700 (patch)
tree47228d4a03b2a8b773518981999a80ccf1ecd4cd
parentFix logic expression (diff)
downloadvmchooser2-2261e82dbc4716fc83314e9e247f0d1e76629700.tar.gz
vmchooser2-2261e82dbc4716fc83314e9e247f0d1e76629700.tar.xz
vmchooser2-2261e82dbc4716fc83314e9e247f0d1e76629700.zip
Use Qt 5
-rw-r--r--CMakeLists.txt49
-rw-r--r--src/httpxmldownloader.cpp3
-rw-r--r--src/main.cpp2
3 files changed, 29 insertions, 25 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4fdaaf3..885ca52 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 2.6)
+cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR)
# project name
project(vmchooser)
@@ -7,38 +7,40 @@ set(CMAKE_BUILD_TYPE Debug)
set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g -Wall -Wextra -pedantic -Werror -Wno-multichar")
set(CMAKE_CXX_FLAGS_RELEASE "-O2 -Wno-multichar")
+set(CMAKE_CXX_STANDARD 11)
+# Some cmake versions can't understand the CMAKE_CXX_STANDARD option above?
+SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11" )
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+set(CMAKE_AUTOMOC ON)
+
file(GLOB_RECURSE VMCHOOSER_SOURCES src/*.cpp)
-file(GLOB_RECURSE VMCHOOSER_MOC_HEADERS src/*.h)
file(GLOB_RECURSE VMCHOOSER_UIS src/ui/*.ui)
file(GLOB_RECURSE VMCHOOSER_RESOURCES src/*.qrc)
file(GLOB_RECURSE VMCHOOSER_TSS src/i18n/*.ts)
-include_directories(${CMAKE_CURRENT_BINARY_DIR} ./)
+include_directories(
+ ${CMAKE_CURRENT_SOURCE_DIR}
+ ${CMAKE_CURRENT_BINARY_DIR}
+)
#
-# Qt4
+# Qt5
#
-find_package(Qt4 4.5.0 REQUIRED)
-if(QT4_FOUND)
- message(STATUS "Qt4 found")
-else(QT4_FOUND)
- message(FATAL_ERROR "Qt4 not found")
-endif(QT4_FOUND)
+find_package(Qt5 COMPONENTS Widgets Svg LinguistTools Network Xml REQUIRED)
-set(QT_USE_QTXML TRUE)
-set(QT_USE_QTSVG TRUE)
-set(QT_USE_QTNETWORK TRUE)
+QT5_WRAP_UI(VMCHOOSER_UI_HEADERS ${VMCHOOSER_UIS})
-include(${QT_USE_FILE})
+#include(${QT_USE_FILE})
-option(UPDATE_TRANSLATIONS "Update .ts files (WARNING: make clean will delete the .ts files!)")
+option(UPDATE_TRANSLATIONS "Update .ts files (WARNING: make clean will delete the .ts files!)" OFF)
if(VMCHOOSER_TSS)
if (UPDATE_TRANSLATIONS)
set (FILES_TO_TRANSLATE ${FILES_TO_TRANSLATE} ${VMCHOOSER_SOURCES} ${VMCHOOSER_UIS})
- QT4_CREATE_TRANSLATION(VMCHOOSER_QMS ${FILES_TO_TRANSLATE} ${VMCHOOSER_TSS} OPTIONS -noobsolete)
+ QT5_CREATE_TRANSLATION(VMCHOOSER_QMS ${FILES_TO_TRANSLATE} ${VMCHOOSER_TSS} OPTIONS -noobsolete)
message(STATUS ".tr files have been updated")
else (UPDATE_TRANSLATIONS)
- QT4_ADD_TRANSLATION(VMCHOOSER_QMS ${VMCHOOSER_TSS})
+ QT5_ADD_TRANSLATION(VMCHOOSER_QMS ${VMCHOOSER_TSS})
endif (UPDATE_TRANSLATIONS)
# write a resource file for qm files
@@ -54,25 +56,26 @@ if(VMCHOOSER_TSS)
#add_custom_target(translations_target DEPENDS ${VMCHOOSER_QMS})
endif(VMCHOOSER_TSS)
-QT4_ADD_RESOURCES(VMCHOOSER_RC_SOURCES ${VMCHOOSER_RESOURCES})
-QT4_WRAP_UI(VMCHOOSER_UI_HEADERS ${VMCHOOSER_UIS})
-QT4_WRAP_CPP(VMCHOOSER_MOC_SOURCES ${VMCHOOSER_MOC_HEADERS})
+QT5_ADD_RESOURCES(VMCHOOSER_RC_SOURCES ${VMCHOOSER_RESOURCES})
#
# build vmchooser
#
add_executable(vmchooser
${VMCHOOSER_SOURCES}
- ${VMCHOOSER_MOC_SOURCES}
${VMCHOOSER_UI_HEADERS}
${VMCHOOSER_RC_SOURCES}
${VMCHOOSER_QMS}
)
target_link_libraries(vmchooser
- ${QT_LIBRARIES}
+ Qt5::Widgets
+ Qt5::Svg
+ Qt5::Network
+ Qt5::Xml
)
-
+
install(TARGETS vmchooser RUNTIME DESTINATION bin)
install(FILES default.desktop DESTINATION /usr/share/xsessions)
install(DIRECTORY themes DESTINATION /usr/local/share/vmchooser)
+
diff --git a/src/httpxmldownloader.cpp b/src/httpxmldownloader.cpp
index bebcfd0..45d1e79 100644
--- a/src/httpxmldownloader.cpp
+++ b/src/httpxmldownloader.cpp
@@ -1,6 +1,7 @@
#include "httpxmldownloader.h"
#include <QDebug>
+#include <QUrlQuery>
HttpXmlDownloader::HttpXmlDownloader() {
nam = new QNetworkAccessManager(this);
@@ -9,7 +10,7 @@ HttpXmlDownloader::HttpXmlDownloader() {
QNetworkReply* HttpXmlDownloader::makeRequest(const QString& xmlurl, const QString& locationIds) {
QUrl url(xmlurl);
if (!locationIds.isEmpty()) {
- url.addQueryItem("locations", locationIds);
+ QUrlQuery(url).addQueryItem("locations", locationIds);
}
return nam->get(QNetworkRequest(url));
}
diff --git a/src/main.cpp b/src/main.cpp
index 31bd20e..d24b253 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -3,7 +3,7 @@
#include <QSettings>
#include <QTranslator>
#include <QtAlgorithms>
-#include <QtGui/QApplication>
+#include <QtWidgets/QApplication>
#include <QDesktopWidget>
#include <QLocale>
#include <QtDebug>