Changed: Port some tools to Qt 5

This commit is contained in:
kervala 2015-12-05 18:48:59 +01:00
parent 4dcbe1faad
commit a9df401efd
13 changed files with 100 additions and 36 deletions

View file

@ -143,7 +143,25 @@ IF(WITH_SSE2)
ENDIF(WITH_SSE3)
ENDIF(WITH_SSE2)
IF(WITH_QT5)
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.11 FATAL_ERROR)
FIND_PACKAGE(Qt5Core QUIET)
IF(Qt5Core_FOUND)
FIND_PACKAGE(Qt5Gui)
FIND_PACKAGE(Qt5Widgets)
FIND_PACKAGE(Qt5OpenGL)
FIND_PACKAGE(Qt5Xml)
FIND_PACKAGE(Qt5LinguistTools)
FIND_PACKAGE(Qt5Network)
ELSE()
MESSAGE(WARNING "Unable to find Qt 5")
ENDIF()
ENDIF()
IF(WITH_QT)
# Use Qt 4
FIND_PACKAGE(Qt4 COMPONENTS QtCore QtGui QtXml QtOpenGL REQUIRED)
ENDIF(WITH_QT)

View file

@ -226,7 +226,8 @@ MACRO(NL_SETUP_DEFAULT_OPTIONS)
# GUI toolkits
###
OPTION(WITH_GTK "With GTK Support" OFF)
OPTION(WITH_QT "With QT Support" OFF)
OPTION(WITH_QT "With Qt 4 Support" OFF)
OPTION(WITH_QT5 "With Qt 5 Support" OFF)
IF(WIN32 AND MFC_FOUND)
OPTION(WITH_MFC "With MFC Support" ON )

View file

@ -1,10 +1,10 @@
SUBDIRS(bnp_make disp_sheet_id extract_filename lock make_sheet_id xml_packer)
IF(WITH_QT)
IF(WITH_QT OR WITH_QT5)
ADD_SUBDIRECTORY(words_dic_qt)
ADD_SUBDIRECTORY(message_box_qt)
ADD_SUBDIRECTORY(crash_report)
ENDIF(WITH_QT)
ENDIF()
IF(WIN32)
ADD_SUBDIRECTORY(exec_timeout)
@ -17,7 +17,7 @@ IF(WIN32)
ADD_SUBDIRECTORY(log_analyser)
ADD_SUBDIRECTORY(log_analyser_plug_ins)
ADD_SUBDIRECTORY(words_dic)
ENDIF(MFC_FOUND)
ENDIF(WIN32)
ENDIF()
ENDIF()
ADD_SUBDIRECTORY(probe_timers)

View file

@ -1,6 +1,6 @@
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SRC_DIR} ${QT_INCLUDES})
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SRC_DIR})
FILE(GLOB CRASHREPORT_SRC *.cpp)
FILE(GLOB CRASHREPORT_HDR *h)
FILE(GLOB CRASHREPORT_HDR *.h)
SET(CRASHREPORT_MOC_HDR
crash_report_socket.h
@ -17,20 +17,30 @@ SET(QT_USE_QTMAIN TRUE)
SET(QT_USE_QTOPENGL FALSE)
SET(QT_USE_QTXML FALSE)
IF(WITH_QT)
INCLUDE_DIRECTORIES(${QT_INCLUDES})
INCLUDE(${QT_USE_FILE})
ADD_DEFINITIONS(${QT_DEFINITIONS})
QT4_WRAP_CPP(CRASHREPORT_MOC_SRC ${CRASHREPORT_MOC_HDR})
QT4_WRAP_UI(CRASHREPORT_UI_HDR ${CRASHREPORT_UI})
SET(QT_LIBRARIES ${QT_LIBRARIES} ${QT_QTMAIN_LIBRARY})
ELSE()
QT5_WRAP_CPP(CRASHREPORT_MOC_SRC ${CRASHREPORT_MOC_HDR})
QT5_WRAP_UI(CRASHREPORT_UI_HDR ${CRASHREPORT_UI})
SET(QT_LIBRARIES Qt5::Widgets Qt5::Core Qt5::Gui Qt5::Network)
ENDIF()
SOURCE_GROUP(QtResources FILES ${CRASHREPORT_UI})
SOURCE_GROUP(QtGeneratedUiHdr FILES ${CRASHREPORT_UI_HDR})
SOURCE_GROUP(QtGeneratedMocQrcSrc FILES ${CRASHREPORT_MOC_SRC})
SOURCE_GROUP("source files" FILES ${CRASHREPORT_SRC})
SOURCE_GROUP("header files" FILES ${CRASHREPORT_HDR})
ADD_EXECUTABLE(crash_report WIN32 MACOSX_BUNDLE ${CRASHREPORT_SRC} ${CRASHREPORT_MOC_HDR} ${CRASHREPORT_MOC_SRC} ${CRASHREPORT_UI_HDR})
TARGET_LINK_LIBRARIES(crash_report ${QT_LIBRARIES} ${QT_QTMAIN_LIBRARY})
ADD_EXECUTABLE(crash_report WIN32 MACOSX_BUNDLE ${CRASHREPORT_SRC} ${CRASHREPORT_HDR} ${CRASHREPORT_MOC_SRC} ${CRASHREPORT_UI_HDR})
TARGET_LINK_LIBRARIES(crash_report ${QT_LIBRARIES})
NL_DEFAULT_PROPS(crash_report "NeL, Tools, Misc: Crash Report")
NL_ADD_RUNTIME_FLAGS(crash_report)

View file

@ -20,8 +20,13 @@
#ifndef RCERROR_DATA
#define RCERROR_DATA
#include <QString>
#include <qglobal.h>
#ifdef Q_COMPILER_RVALUE_REFS
#undef Q_COMPILER_RVALUE_REFS
#endif
#include <QString>
struct SCrashReportData
{

View file

@ -20,9 +20,10 @@
#ifndef RCERROR_SOCKET
#define RCERROR_SOCKET
#include <QObject>
#include "crash_report_data.h"
#include <QObject>
class CCrashReportSocketPvt;
class QNetworkReply;

View file

@ -20,6 +20,7 @@
#ifndef RCERROR_WIDGET
#define RCERROR_WIDGET
#include "crash_report_data.h"
#include "ui_crash_report_widget.h"
#include <vector>

View file

@ -1,13 +1,18 @@
INCLUDE_DIRECTORIES(${QT_INCLUDES} ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
IF(WITH_QT)
INCLUDE_DIRECTORIES(${QT_INCLUDES})
INCLUDE(${QT_USE_FILE})
ELSE()
SET(QT_LIBRARIES Qt5::Widgets Qt5::Core Qt5::Gui)
ENDIF()
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
FILE(GLOB MESSAGE_BOX_SRC *.cpp)
SET( QT_USE_QT3SUPPORT TRUE)
SET( QT_USE_QTXML TRUE)
ADD_EXECUTABLE(message_box_qt ${MESSAGE_BOX_SRC})
ADD_EXECUTABLE(message_box_qt WIN32 ${MESSAGE_BOX_SRC})
TARGET_LINK_LIBRARIES(message_box_qt ${QT_LIBRARIES} nelmisc)
NL_DEFAULT_PROPS(message_box_qt "NeL, Tools, Misc: Qt Message Box")
NL_ADD_RUNTIME_FLAGS(message_box_qt)

View file

@ -1,3 +1,9 @@
#include <qglobal.h>
#ifdef Q_COMPILER_RVALUE_REFS
#undef Q_COMPILER_RVALUE_REFS
#endif
#include <QApplication>
#include <QFile>
#include <QMessageBox>

View file

@ -1,17 +1,20 @@
INCLUDE_DIRECTORIES(${QT_INCLUDES} ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
INCLUDE( ${QT_USE_FILE} )
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
FILE(GLOB WORDS_DIC_SRC *.cpp)
FILE(GLOB WORDS_DIC_SRC *.cpp *.h)
SET(WORDS_DIC_HDR words_dicDlg.h)
SET(WORDS_DIC_UIS words_dic_Qt.ui)
SET(WORDS_DIC_RCS words_dic_Qt.qrc)
IF(WIN32)
SET(WORDS_DIC_RC words_dic.rc)
ENDIF(WIN32)
ENDIF()
ADD_DEFINITIONS(-DNL_WORDS_DIC_CFG="\\"${NL_ETC_PREFIX}/\\"")
IF(WITH_QT)
INCLUDE_DIRECTORIES(${QT_INCLUDES})
INCLUDE(${QT_USE_FILE})
SET(QT_USE_QT3SUPPORT TRUE)
SET(QT_USE_QTXML TRUE)
@ -19,14 +22,20 @@ QT4_ADD_RESOURCES( WORDS_DIC_RC_SRCS ${WORDS_DIC_RCS} )
QT4_WRAP_UI(WORDS_DIC_UI_HDRS ${WORDS_DIC_UIS})
QT4_WRAP_CPP(WORDS_DIC_MOC_SRCS ${WORDS_DIC_HDR})
ADD_EXECUTABLE(words_dic_qt ${WORDS_DIC_SRC} ${WORDS_DIC_MOC_SRCS} ${WORDS_DIC_RC_SRCS} ${WORDS_DIC_UI_HDRS} ${WORDS_DIC_RC})
ADD_DEFINITIONS(${QT_DEFINITIONS})
ELSE()
SET(QT_LIBRARIES Qt5::Widgets Qt5::Core Qt5::Gui)
QT5_ADD_RESOURCES(WORDS_DIC_RC_SRCS ${WORDS_DIC_RCS})
QT5_WRAP_UI(WORDS_DIC_UI_HDRS ${WORDS_DIC_UIS})
QT5_WRAP_CPP(WORDS_DIC_MOC_SRCS ${WORDS_DIC_HDR})
ENDIF()
ADD_EXECUTABLE(words_dic_qt WIN32 ${WORDS_DIC_SRC} ${WORDS_DIC_MOC_SRCS} ${WORDS_DIC_RC_SRCS} ${WORDS_DIC_UI_HDRS} ${WORDS_DIC_RC})
TARGET_LINK_LIBRARIES(words_dic_qt ${QT_LIBRARIES} nelmisc)
NL_DEFAULT_PROPS(words_dic_qt "NeL, Tools, Misc: Qt Words Dic")
NL_ADD_RUNTIME_FLAGS(words_dic_qt)
ADD_DEFINITIONS(${QT_DEFINITIONS})
INSTALL(TARGETS words_dic_qt RUNTIME DESTINATION ${NL_BIN_PREFIX} COMPONENT toolsmisc)
INSTALL(FILES words_dic.cfg DESTINATION ${NL_ETC_PREFIX} COMPONENT toolsmisc)

View file

@ -1,7 +1,8 @@
#include "words_dicDlg.h"
#include <QApplication>
#include "nel/misc/app_context.h"
#include "nel/misc/path.h"
#include "words_dicDlg.h"
#ifdef NL_OS_UNIX
#include <stdlib.h>

View file

@ -1,10 +1,12 @@
#include "words_dicDlg.h"
#include <QtGui>
#include <QString>
#include <QListWidgetItem>
#include <QMessageBox>
#include <QtAlgorithms>
#include <QSplashScreen>
#include <nel/misc/words_dictionary.h>
#include "words_dicDlg.h"
using namespace std;
using namespace NLMISC;

View file

@ -1,7 +1,12 @@
#ifndef WORDS_DICDLG_H
#define WORDS_DICDLG_H
#include <qglobal.h>
#ifdef Q_COMPILER_RVALUE_REFS
#undef Q_COMPILER_RVALUE_REFS
#endif
#include <QMainWindow>
#include "ui_words_dic_Qt.h"