drop Qt4 support

Wed, 10 Jan 2018 22:54:09 +0200

author
Santeri Piippo
date
Wed, 10 Jan 2018 22:54:09 +0200
changeset 1226
d1199d965235
parent 1225
ffcbdce88978
child 1227
1a26b6502a91

drop Qt4 support

CMakeLists.txt file | annotate | diff | comparison | revisions
src/glRenderer.cpp file | annotate | diff | comparison | revisions
src/glShared.h file | annotate | diff | comparison | revisions
src/macros.h file | annotate | diff | comparison | revisions
src/partdownloader.cpp file | annotate | diff | comparison | revisions
--- a/CMakeLists.txt	Sat Jan 06 17:57:03 2018 +0200
+++ b/CMakeLists.txt	Wed Jan 10 22:54:09 2018 +0200
@@ -9,17 +9,12 @@
 cmake_minimum_required (VERSION 2.6)
 
 option (TRANSPARENT_DIRECT_COLORS "Enables non-standard transparent direct colors" OFF)
-option (USE_QT5 "Use Qt5 instead of Qt4" OFF)
 
-if (USE_QT5)
-	find_package (Qt5Widgets REQUIRED)
-	find_package (Qt5Core REQUIRED)
-	find_package (Qt5OpenGL REQUIRED)
-	find_package (Qt5Network REQUIRED)
-	set (CMAKE_AUTOMOC ON)
-else()
-	find_package (Qt4 REQUIRED)
-endif()
+find_package (Qt5Widgets REQUIRED)
+find_package (Qt5Core REQUIRED)
+find_package (Qt5OpenGL REQUIRED)
+find_package (Qt5Network REQUIRED)
+set (CMAKE_AUTOMOC ON)
 
 find_package (OpenGL REQUIRED)
 
@@ -188,34 +183,15 @@
 	endif()
 endif()
 
-if (USE_QT5)
-	qt5_add_resources (LDFORGE_QRC ${LDFORGE_RESOURCES})
-	qt5_wrap_ui (LDFORGE_FORMS_HEADERS ${LDFORGE_FORMS})
-	add_executable (ldforge WIN32 ${LDFORGE_SOURCES} ${LDFORGE_HEADERS}
-		${LDFORGE_QRC} ${LDFORGE_FORMS_HEADERS}
-		${CMAKE_BINARY_DIR}/configurationvaluebag.cpp)
-else()
-	qt4_wrap_ui (LDFORGE_FORMS_HEADERS ${LDFORGE_FORMS})
-	qt4_add_resources (LDFORGE_RCC ${LDFORGE_RESOURCES})
-	add_executable (ldforge WIN32 ${LDFORGE_SOURCES} ${LDFORGE_RCC}
-		${LDFORGE_FORMS_HEADERS} ${LDFORGE_HEADERS}
-		${CMAKE_BINARY_DIR}/configurationvaluebag.cpp)
-endif()
+qt5_add_resources (LDFORGE_QRC ${LDFORGE_RESOURCES})
+qt5_wrap_ui (LDFORGE_FORMS_HEADERS ${LDFORGE_FORMS})
+add_executable (ldforge WIN32 ${LDFORGE_SOURCES} ${LDFORGE_HEADERS}
+	${LDFORGE_QRC} ${LDFORGE_FORMS_HEADERS}
+	${CMAKE_BINARY_DIR}/configurationvaluebag.cpp)
 
 set_source_files_properties (${LDFORGE_HEADERS} PROPERTIES HEADER_FILE_ONLY TRUE)
 set_target_properties (ldforge PROPERTIES AUTOMOC 1)
-
-if (USE_QT5)
-	target_link_libraries (ldforge Qt5::Widgets Qt5::Network Qt5::OpenGL ${OPENGL_LIBRARIES})
-else()
-	target_link_libraries (ldforge
-		${QT_QTCORE_LIBRARY}
-		${QT_QTGUI_LIBRARY}
-		${QT_QTNETWORK_LIBRARY}
-		${QT_QTOPENGL_LIBRARY}
-		${OPENGL_LIBRARIES}
-	)
-endif()
+target_link_libraries (ldforge Qt5::Widgets Qt5::Network Qt5::OpenGL ${OPENGL_LIBRARIES})
 
 add_custom_target (config_collection ALL
 	COMMAND python
--- a/src/glRenderer.cpp	Sat Jan 06 17:57:03 2018 +0200
+++ b/src/glRenderer.cpp	Wed Jan 10 22:54:09 2018 +0200
@@ -260,9 +260,7 @@
 //
 void GLRenderer::initializeGL()
 {
-#ifdef USE_QT5
 	initializeOpenGLFunctions();
-#endif
 	setBackground();
 	glLineWidth(config->lineThickness());
 	glLineStipple(1, 0x6666);
@@ -844,12 +842,7 @@
 	// Update 2d position
 	m_mousePosition = ev->pos();
 	m_globalpos = ev->globalPos();
-
-#ifndef USE_QT5
-	m_mousePositionF = ev->posF();
-#else
 	m_mousePositionF = ev->localPos();
-#endif
 
 	// Calculate 3d position of the cursor
 	m_position3D = (camera() != EFreeCamera) ? convert2dTo3d(m_mousePosition, true) : Vertex {};
--- a/src/glShared.h	Sat Jan 06 17:57:03 2018 +0200
+++ b/src/glShared.h	Wed Jan 10 22:54:09 2018 +0200
@@ -17,11 +17,7 @@
  */
 
 #pragma once
-
-#ifdef USE_QT5
-# include <QOpenGLFunctions>
-#endif
-
+#include <QOpenGLFunctions>
 #include "basics.h"
 
 class LDObject;
@@ -70,25 +66,3 @@
 
 MAKE_ITERABLE_ENUM(SurfaceVboType)
 MAKE_ITERABLE_ENUM(ComplementVboType)
-
-#ifndef USE_QT5
-// Placeholder QOpenGLFunctions for Qt 4.x support
-struct QOpenGLFunctions
-{
-	void initializeOpenGLFunctions() {}
-};
-
-#endif
-
-// KDevelop doesn't seem to understand some VBO stuff
-#ifdef IN_IDE_PARSER
-using GLint = int;
-using GLsizei = int;
-using GLenum = unsigned int;
-using GLuint = unsigned int;
-void glBindBuffer(GLenum, GLuint);
-void glGenBuffers(GLuint, GLuint*);
-void glDeleteBuffers(GLuint, GLuint*);
-void glBufferData(GLuint, GLuint, void*, GLuint);
-void glBufferSubData(GLenum, GLint, GLsizei, void*);
-#endif
--- a/src/macros.h	Sat Jan 06 17:57:03 2018 +0200
+++ b/src/macros.h	Wed Jan 10 22:54:09 2018 +0200
@@ -49,10 +49,6 @@
 	inline T operator++(T& a, int) { T result = a; a = (T)((int) a + 1); return result; } \
 	inline T operator--(T& a, int) { T result = a; a = (T)((int) a - 1); return result; }
 
-#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
-# define USE_QT5
-#endif
-
 #define FOR_ENUM_NAME_HELPER(LINE) enum_iterator_ ## LINE
 #define FOR_ENUM_NAME(LINE) FOR_ENUM_NAME_HELPER(LINE)
 
--- a/src/partdownloader.cpp	Sat Jan 06 17:57:03 2018 +0200
+++ b/src/partdownloader.cpp	Wed Jan 10 22:54:09 2018 +0200
@@ -43,13 +43,7 @@
 	m_source(SourceType(0))
 {
 	ui.setupUi(this);
-
-#ifdef USE_QT5
 	ui.progressTable->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);
-#else
-	ui.progressTable->horizontalHeader()->setResizeMode(PartLabelColumn, QHeaderView::Stretch);
-#endif
-
 	m_downloadButton = new QPushButton(tr("Download"));
 	ui.buttonBox->addButton(m_downloadButton, QDialogButtonBox::ActionRole);
 	button(Abort)->setEnabled(false);

mercurial