From e4169665a91333266a94f3340bd7279e01e876cc Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Tue, 23 Jul 2013 20:23:32 -0700 Subject: [PATCH 1/9] changes to CMakeLists to up to qt5 --- cmake/macros/SetupHifiLibrary.cmake | 3 ++- cmake/macros/SetupHifiProject.cmake | 2 +- interface/CMakeLists.txt | 6 +++--- interface/external/fervor/CMakeLists.txt | 6 +++--- libraries/avatars/CMakeLists.txt | 4 ++++ libraries/shared/CMakeLists.txt | 4 ++++ 6 files changed, 17 insertions(+), 8 deletions(-) diff --git a/cmake/macros/SetupHifiLibrary.cmake b/cmake/macros/SetupHifiLibrary.cmake index b7d0af7499..c6a84e1838 100644 --- a/cmake/macros/SetupHifiLibrary.cmake +++ b/cmake/macros/SetupHifiLibrary.cmake @@ -3,11 +3,12 @@ MACRO(SETUP_HIFI_LIBRARY TARGET) # grab the implemenation and header files file(GLOB LIB_SRCS src/*.h src/*.cpp) + set(LIB_SRCS ${LIB_SRCS} ${WRAPPED_SRCS}) # create a library and set the property so it can be referenced later add_library(${TARGET} ${LIB_SRCS}) - find_package(Qt4 REQUIRED QtCore) + find_package(Qt5 REQUIRED QtCore) include(${QT_USE_FILE}) SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -isystem ${QT_QTGUI_INCLUDE_DIR}") diff --git a/cmake/macros/SetupHifiProject.cmake b/cmake/macros/SetupHifiProject.cmake index 8360dc66b6..80ced2ab73 100644 --- a/cmake/macros/SetupHifiProject.cmake +++ b/cmake/macros/SetupHifiProject.cmake @@ -8,7 +8,7 @@ MACRO(SETUP_HIFI_PROJECT TARGET INCLUDE_QT) add_executable(${TARGET} ${TARGET_SRCS}) IF (${INCLUDE_QT}) - find_package(Qt4 REQUIRED QtCore) + find_package(Qt5 REQUIRED QtCore) include(${QT_USE_FILE}) SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -isystem ${QT_QTGUI_INCLUDE_DIR}") ENDIF() diff --git a/interface/CMakeLists.txt b/interface/CMakeLists.txt index ae87d53939..bc8949cbb6 100755 --- a/interface/CMakeLists.txt +++ b/interface/CMakeLists.txt @@ -67,7 +67,7 @@ if (APPLE) endif (APPLE) -find_package(Qt4 REQUIRED QtCore QtGui QtNetwork QtOpenGL QtWebKit QtSvg) +find_package(Qt5 REQUIRED QtCore QtGui QtNetwork QtOpenGL QtWebKit QtSvg) include(${QT_USE_FILE}) SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -isystem ${QT_QTGUI_INCLUDE_DIR}") @@ -76,8 +76,8 @@ add_subdirectory(external/fervor/) include_directories(external/fervor/) # run qt moc on qt-enabled headers -qt4_wrap_cpp(INTERFACE_SRCS src/Application.h src/Webcam.h src/avatar/AvatarVoxelSystem.h - src/avatar/Face.h src/ui/BandwidthDialog.h src/ui/VoxelStatsDialog.h) +qt5_wrap_cpp(INTERFACE_SRCS src/Application.h src/Webcam.h src/avatar/AvatarVoxelSystem.h + src/avatar/Face.h src/ui/BandwidthDialog.h src/ui/VoxelStatsDialog.h) # create the executable, make it a bundle on OS X add_executable(${TARGET_NAME} MACOSX_BUNDLE ${INTERFACE_SRCS}) diff --git a/interface/external/fervor/CMakeLists.txt b/interface/external/fervor/CMakeLists.txt index f257bb4431..9cba3816f8 100644 --- a/interface/external/fervor/CMakeLists.txt +++ b/interface/external/fervor/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 2.8) project(Fervor) -find_package(Qt4 REQUIRED) +find_package(Qt5 REQUIRED) add_definitions(-DFV_GUI) @@ -13,8 +13,8 @@ list(REMOVE_ITEM FERVOR_HEADERS ${HEADER_PATH}/fvversioncomparator.h) file(GLOB FERVOR_UI *.ui) -qt4_wrap_ui(FERVOR_WRAPPED_UI ${FERVOR_UI}) -qt4_wrap_cpp(FERVOR_MOC_SOURCES ${FERVOR_HEADERS}) +qt5_wrap_ui(FERVOR_WRAPPED_UI ${FERVOR_UI}) +qt5_wrap_cpp(FERVOR_MOC_SOURCES ${FERVOR_HEADERS}) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/../cmake/modules/") find_package(Quazip REQUIRED) diff --git a/libraries/avatars/CMakeLists.txt b/libraries/avatars/CMakeLists.txt index 207057e244..5827f94ebb 100644 --- a/libraries/avatars/CMakeLists.txt +++ b/libraries/avatars/CMakeLists.txt @@ -8,6 +8,10 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/../../cm set(TARGET_NAME avatars) +find_package(Qt5 REQUIRED QtCore) +include(${QT_USE_FILE}) +qt5_wrap_cpp(WRAPPED_SRCS src/AvatarData.h) + include(${MACRO_DIR}/SetupHifiLibrary.cmake) setup_hifi_library(${TARGET_NAME}) diff --git a/libraries/shared/CMakeLists.txt b/libraries/shared/CMakeLists.txt index cf1c603b7d..328221ba60 100644 --- a/libraries/shared/CMakeLists.txt +++ b/libraries/shared/CMakeLists.txt @@ -6,6 +6,10 @@ set(MACRO_DIR ${ROOT_DIR}/cmake/macros) set(TARGET_NAME shared) project(${TARGET_NAME}) +find_package(Qt5 REQUIRED QtCore) +include(${QT_USE_FILE}) +qt5_wrap_cpp(WRAPPED_SRCS src/NodeData.h) + include(${MACRO_DIR}/SetupHifiLibrary.cmake) setup_hifi_library(${TARGET_NAME}) From a8afaea542e991487f779e2f7e5cdcca2dfae001 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Tue, 23 Jul 2013 20:49:08 -0700 Subject: [PATCH 2/9] switch to new qt5 find module setup --- cmake/macros/SetupHifiLibrary.cmake | 2 +- cmake/macros/SetupHifiProject.cmake | 2 +- interface/CMakeLists.txt | 8 +++++++- interface/external/fervor/CMakeLists.txt | 2 +- libraries/avatars/CMakeLists.txt | 2 +- libraries/shared/CMakeLists.txt | 2 +- 6 files changed, 12 insertions(+), 6 deletions(-) diff --git a/cmake/macros/SetupHifiLibrary.cmake b/cmake/macros/SetupHifiLibrary.cmake index c6a84e1838..fc6bd9117f 100644 --- a/cmake/macros/SetupHifiLibrary.cmake +++ b/cmake/macros/SetupHifiLibrary.cmake @@ -8,7 +8,7 @@ MACRO(SETUP_HIFI_LIBRARY TARGET) # create a library and set the property so it can be referenced later add_library(${TARGET} ${LIB_SRCS}) - find_package(Qt5 REQUIRED QtCore) + find_package(Qt5Core REQUIRED) include(${QT_USE_FILE}) SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -isystem ${QT_QTGUI_INCLUDE_DIR}") diff --git a/cmake/macros/SetupHifiProject.cmake b/cmake/macros/SetupHifiProject.cmake index 80ced2ab73..27d768e3f5 100644 --- a/cmake/macros/SetupHifiProject.cmake +++ b/cmake/macros/SetupHifiProject.cmake @@ -8,7 +8,7 @@ MACRO(SETUP_HIFI_PROJECT TARGET INCLUDE_QT) add_executable(${TARGET} ${TARGET_SRCS}) IF (${INCLUDE_QT}) - find_package(Qt5 REQUIRED QtCore) + find_package(Qt5Core REQUIRED) include(${QT_USE_FILE}) SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -isystem ${QT_QTGUI_INCLUDE_DIR}") ENDIF() diff --git a/interface/CMakeLists.txt b/interface/CMakeLists.txt index bc8949cbb6..ca99dda2f5 100755 --- a/interface/CMakeLists.txt +++ b/interface/CMakeLists.txt @@ -67,7 +67,13 @@ if (APPLE) endif (APPLE) -find_package(Qt5 REQUIRED QtCore QtGui QtNetwork QtOpenGL QtWebKit QtSvg) +find_package(Qt5Core REQUIRED) +find_package(Qt5Gui REQUIRED) +find_package(Qt5Network REQUIRED) +find_package(Qt5OpenGL REQUIRED) +find_package(Qt5WebKit REQUIRED) +find_package(Qt5Svg REQUIRED) + include(${QT_USE_FILE}) SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -isystem ${QT_QTGUI_INCLUDE_DIR}") diff --git a/interface/external/fervor/CMakeLists.txt b/interface/external/fervor/CMakeLists.txt index 9cba3816f8..111e69a865 100644 --- a/interface/external/fervor/CMakeLists.txt +++ b/interface/external/fervor/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 2.8) project(Fervor) -find_package(Qt5 REQUIRED) +find_package(QtCore QtNetwork REQUIRED) add_definitions(-DFV_GUI) diff --git a/libraries/avatars/CMakeLists.txt b/libraries/avatars/CMakeLists.txt index 5827f94ebb..8afbae145b 100644 --- a/libraries/avatars/CMakeLists.txt +++ b/libraries/avatars/CMakeLists.txt @@ -8,7 +8,7 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/../../cm set(TARGET_NAME avatars) -find_package(Qt5 REQUIRED QtCore) +find_package(Qt5Core) include(${QT_USE_FILE}) qt5_wrap_cpp(WRAPPED_SRCS src/AvatarData.h) diff --git a/libraries/shared/CMakeLists.txt b/libraries/shared/CMakeLists.txt index 328221ba60..0dcf13f418 100644 --- a/libraries/shared/CMakeLists.txt +++ b/libraries/shared/CMakeLists.txt @@ -6,7 +6,7 @@ set(MACRO_DIR ${ROOT_DIR}/cmake/macros) set(TARGET_NAME shared) project(${TARGET_NAME}) -find_package(Qt5 REQUIRED QtCore) +find_package(Qt5Core REQUIRED) include(${QT_USE_FILE}) qt5_wrap_cpp(WRAPPED_SRCS src/NodeData.h) From 7fde47655e44417af634895849d0c69168742757 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Wed, 24 Jul 2013 11:28:42 -0700 Subject: [PATCH 3/9] add Makefiles to the gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index cebf9eb113..9dc509bc19 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ CMakeFiles/ CMakeScripts/ cmake_install.cmake build/ +Makefile # Xcode *.xcodeproj From 9f2b2d09a9cc399807955a8b050e25d8a69c41f2 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Wed, 24 Jul 2013 11:29:12 -0700 Subject: [PATCH 4/9] changes to CMakeLists for Qt5 --- CMakeLists.txt | 7 +++++++ cmake/macros/SetupHifiLibrary.cmake | 3 +-- cmake/macros/SetupHifiProject.cmake | 3 +-- interface/CMakeLists.txt | 9 ++++----- interface/external/fervor/CMakeLists.txt | 11 ++++++----- interface/external/fervor/fvplatform.h | 2 +- libraries/avatars/CMakeLists.txt | 4 ++-- libraries/shared/CMakeLists.txt | 4 ++-- libraries/shared/src/NodeList.cpp | 2 +- 9 files changed, 25 insertions(+), 20 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8af8081975..34392a7c5d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,6 +2,13 @@ cmake_minimum_required(VERSION 2.8) project(hifi) +set(CMAKE_PREFIX_PATH "/usr/local/Cellar/qt5/5.1.0/lib/cmake") + +# Find includes in corresponding build directories +set(CMAKE_INCLUDE_CURRENT_DIR ON) +# Instruct CMake to run moc automatically when needed. +set(CMAKE_AUTOMOC ON) + add_subdirectory(animation-server) add_subdirectory(avatar-mixer) add_subdirectory(audio-mixer) diff --git a/cmake/macros/SetupHifiLibrary.cmake b/cmake/macros/SetupHifiLibrary.cmake index fc6bd9117f..79bf16e1a0 100644 --- a/cmake/macros/SetupHifiLibrary.cmake +++ b/cmake/macros/SetupHifiLibrary.cmake @@ -9,8 +9,7 @@ MACRO(SETUP_HIFI_LIBRARY TARGET) add_library(${TARGET} ${LIB_SRCS}) find_package(Qt5Core REQUIRED) - include(${QT_USE_FILE}) - SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -isystem ${QT_QTGUI_INCLUDE_DIR}") + qt5_use_modules(${TARGET} Core) target_link_libraries(${TARGET} ${QT_LIBRARIES}) ENDMACRO(SETUP_HIFI_LIBRARY _target) \ No newline at end of file diff --git a/cmake/macros/SetupHifiProject.cmake b/cmake/macros/SetupHifiProject.cmake index 27d768e3f5..455ca89701 100644 --- a/cmake/macros/SetupHifiProject.cmake +++ b/cmake/macros/SetupHifiProject.cmake @@ -9,8 +9,7 @@ MACRO(SETUP_HIFI_PROJECT TARGET INCLUDE_QT) IF (${INCLUDE_QT}) find_package(Qt5Core REQUIRED) - include(${QT_USE_FILE}) - SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -isystem ${QT_QTGUI_INCLUDE_DIR}") + qt5_use_modules(${TARGET} Core) ENDIF() target_link_libraries(${TARGET} ${QT_LIBRARIES}) diff --git a/interface/CMakeLists.txt b/interface/CMakeLists.txt index ca99dda2f5..b5fd7f8895 100755 --- a/interface/CMakeLists.txt +++ b/interface/CMakeLists.txt @@ -74,20 +74,19 @@ find_package(Qt5OpenGL REQUIRED) find_package(Qt5WebKit REQUIRED) find_package(Qt5Svg REQUIRED) -include(${QT_USE_FILE}) -SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -isystem ${QT_QTGUI_INCLUDE_DIR}") - set(QUAZIP_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/external/quazip) add_subdirectory(external/fervor/) include_directories(external/fervor/) # run qt moc on qt-enabled headers -qt5_wrap_cpp(INTERFACE_SRCS src/Application.h src/Webcam.h src/avatar/AvatarVoxelSystem.h - src/avatar/Face.h src/ui/BandwidthDialog.h src/ui/VoxelStatsDialog.h) +# qt5_wrap_cpp(INTERFACE_SRCS src/Application.h src/Webcam.h src/avatar/AvatarVoxelSystem.h +# src/avatar/Face.h src/ui/BandwidthDialog.h src/ui/VoxelStatsDialog.h) # create the executable, make it a bundle on OS X add_executable(${TARGET_NAME} MACOSX_BUNDLE ${INTERFACE_SRCS}) +qt5_use_modules(${TARGET_NAME} Core Gui Network OpenGL WebKit Svg) + # link in the hifi shared library include(${MACRO_DIR}/LinkHifiLibrary.cmake) diff --git a/interface/external/fervor/CMakeLists.txt b/interface/external/fervor/CMakeLists.txt index 111e69a865..0568c32e51 100644 --- a/interface/external/fervor/CMakeLists.txt +++ b/interface/external/fervor/CMakeLists.txt @@ -1,6 +1,8 @@ cmake_minimum_required(VERSION 2.8) project(Fervor) -find_package(QtCore QtNetwork REQUIRED) +find_package(Qt5Core REQUIRED) +find_package(Qt5Network REQUIRED) +find_package(Qt5Widgets REQUIRED) add_definitions(-DFV_GUI) @@ -13,9 +15,6 @@ list(REMOVE_ITEM FERVOR_HEADERS ${HEADER_PATH}/fvversioncomparator.h) file(GLOB FERVOR_UI *.ui) -qt5_wrap_ui(FERVOR_WRAPPED_UI ${FERVOR_UI}) -qt5_wrap_cpp(FERVOR_MOC_SOURCES ${FERVOR_HEADERS}) - set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/../cmake/modules/") find_package(Quazip REQUIRED) @@ -25,4 +24,6 @@ include_directories( ) add_library(fervor ${FERVOR_SOURCES} ${FERVOR_HEADERS} ${FERVOR_MOC_SOURCES} ${FERVOR_WRAPPED_UI}) -target_link_libraries(fervor ${QUAZIP_LIBRARIES}) \ No newline at end of file +target_link_libraries(fervor ${QUAZIP_LIBRARIES}) + +qt5_use_modules(fervor Core Network Widgets) \ No newline at end of file diff --git a/interface/external/fervor/fvplatform.h b/interface/external/fervor/fvplatform.h index a527518097..a98f04a1ce 100755 --- a/interface/external/fervor/fvplatform.h +++ b/interface/external/fervor/fvplatform.h @@ -1,7 +1,7 @@ #ifndef FVPLATFORM_H #define FVPLATFORM_H -#include +#include class FvPlatform : public QObject { diff --git a/libraries/avatars/CMakeLists.txt b/libraries/avatars/CMakeLists.txt index 8afbae145b..7968b5a003 100644 --- a/libraries/avatars/CMakeLists.txt +++ b/libraries/avatars/CMakeLists.txt @@ -9,12 +9,12 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/../../cm set(TARGET_NAME avatars) find_package(Qt5Core) -include(${QT_USE_FILE}) -qt5_wrap_cpp(WRAPPED_SRCS src/AvatarData.h) include(${MACRO_DIR}/SetupHifiLibrary.cmake) setup_hifi_library(${TARGET_NAME}) +qt5_use_modules(${TARGET_NAME} Core) + include(${MACRO_DIR}/IncludeGLM.cmake) include_glm(${TARGET_NAME} ${ROOT_DIR}) diff --git a/libraries/shared/CMakeLists.txt b/libraries/shared/CMakeLists.txt index 0dcf13f418..b0c2771f48 100644 --- a/libraries/shared/CMakeLists.txt +++ b/libraries/shared/CMakeLists.txt @@ -7,12 +7,12 @@ set(TARGET_NAME shared) project(${TARGET_NAME}) find_package(Qt5Core REQUIRED) -include(${QT_USE_FILE}) -qt5_wrap_cpp(WRAPPED_SRCS src/NodeData.h) include(${MACRO_DIR}/SetupHifiLibrary.cmake) setup_hifi_library(${TARGET_NAME}) +qt5_use_modules(${TARGET_NAME} Core) + set(EXTERNAL_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/external) if (WIN32) diff --git a/libraries/shared/src/NodeList.cpp b/libraries/shared/src/NodeList.cpp index 9406c6b14d..42aa024e9d 100644 --- a/libraries/shared/src/NodeList.cpp +++ b/libraries/shared/src/NodeList.cpp @@ -512,7 +512,7 @@ void NodeList::loadData(QSettings *settings) { if (domainServerHostname.size() > 0) { memset(_domainHostname, 0, MAX_HOSTNAME_BYTES); - memcpy(_domainHostname, domainServerHostname.toAscii().constData(), domainServerHostname.size()); + memcpy(_domainHostname, domainServerHostname.toLocal8Bit().constData(), domainServerHostname.size()); } settings->endGroup(); From f27eb5e1d8b90b4e534faca655b2be697e7f3aa0 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Wed, 24 Jul 2013 12:06:55 -0700 Subject: [PATCH 5/9] small code changes for qt5 compatibility --- interface/external/fervor/CMakeLists.txt | 4 +++ interface/src/Application.cpp | 30 +++++++++++----------- interface/src/avatar/AvatarVoxelSystem.cpp | 4 +-- interface/src/ui/ChatEntry.cpp | 2 +- 4 files changed, 22 insertions(+), 18 deletions(-) diff --git a/interface/external/fervor/CMakeLists.txt b/interface/external/fervor/CMakeLists.txt index 0568c32e51..62968d8833 100644 --- a/interface/external/fervor/CMakeLists.txt +++ b/interface/external/fervor/CMakeLists.txt @@ -9,6 +9,10 @@ add_definitions(-DFV_GUI) file(GLOB FERVOR_SOURCES *.cpp) file(GLOB FERVOR_HEADERS *.h) +file(GLOB FERVOR_UI *.ui) + +qt5_wrap_ui(FERVOR_WRAPPED_UI ${FERVOR_UI}) + LIST(GET FERVOR_HEADERS 1 FIRST_HEADER) GET_FILENAME_COMPONENT(HEADER_PATH ${FIRST_HEADER} PATH) list(REMOVE_ITEM FERVOR_HEADERS ${HEADER_PATH}/fvversioncomparator.h) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 0c7820d673..958affebb5 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -166,9 +166,9 @@ void GLCanvas::wheelEvent(QWheelEvent* event) { Application::getInstance()->wheelEvent(event); } -void messageHandler(QtMsgType type, const char* message) { - fprintf(stdout, "%s", message); - LogDisplay::instance.addMessage(message); +void messageHandler(QtMsgType type, const QMessageLogContext& context, const QString &message) { + fprintf(stdout, "%s", message.toLocal8Bit().constData()); + LogDisplay::instance.addMessage(message.toLocal8Bit().constData()); } Application::Application(int& argc, char** argv, timeval &startup_time) : @@ -223,7 +223,7 @@ Application::Application(int& argc, char** argv, timeval &startup_time) : _applicationStartupTime = startup_time; _window->setWindowTitle("Interface"); - qInstallMsgHandler(messageHandler); + qInstallMessageHandler(messageHandler); unsigned int listenPort = 0; // bind to an ephemeral port by default const char** constArgv = const_cast(argv); @@ -1217,7 +1217,7 @@ void Application::editPreferences() { if (domainServerHostname->text().size() > 0) { // the user input a new hostname, use that - newHostname = domainServerHostname->text().toAscii(); + newHostname = domainServerHostname->text().toLocal8Bit(); } else { // the user left the field blank, use the default hostname newHostname = QByteArray(DEFAULT_DOMAIN_HOSTNAME); @@ -1513,12 +1513,12 @@ bool Application::sendVoxelsOperation(VoxelNode* node, void* extraData) { } void Application::exportVoxels() { - QString desktopLocation = QDesktopServices::storageLocation(QDesktopServices::DesktopLocation); + QString desktopLocation = QStandardPaths::writableLocation(QStandardPaths::DesktopLocation); QString suggestedName = desktopLocation.append("/voxels.svo"); QString fileNameString = QFileDialog::getSaveFileName(_glWidget, tr("Export Voxels"), suggestedName, tr("Sparse Voxel Octree Files (*.svo)")); - QByteArray fileNameAscii = fileNameString.toAscii(); + QByteArray fileNameAscii = fileNameString.toLocal8Bit(); const char* fileName = fileNameAscii.data(); VoxelNode* selectedNode = _voxels.getVoxelAt(_mouseVoxel.x, _mouseVoxel.y, _mouseVoxel.z, _mouseVoxel.s); if (selectedNode) { @@ -1533,11 +1533,11 @@ void Application::exportVoxels() { const char* IMPORT_FILE_TYPES = "Sparse Voxel Octree Files, Square PNG, Schematic Files (*.svo *.png *.schematic)"; void Application::importVoxelsToClipboard() { - QString desktopLocation = QDesktopServices::storageLocation(QDesktopServices::DesktopLocation); + QString desktopLocation = QStandardPaths::writableLocation(QStandardPaths::DesktopLocation); QString fileNameString = QFileDialog::getOpenFileName(_glWidget, tr("Import Voxels to Clipboard"), desktopLocation, tr(IMPORT_FILE_TYPES)); - QByteArray fileNameAscii = fileNameString.toAscii(); + QByteArray fileNameAscii = fileNameString.toLocal8Bit(); const char* fileName = fileNameAscii.data(); _clipboardTree.eraseAllVoxels(); @@ -1567,11 +1567,11 @@ void Application::importVoxelsToClipboard() { } void Application::importVoxels() { - QString desktopLocation = QDesktopServices::storageLocation(QDesktopServices::DesktopLocation); + QString desktopLocation = QStandardPaths::writableLocation(QStandardPaths::DesktopLocation); QString fileNameString = QFileDialog::getOpenFileName(_glWidget, tr("Import Voxels"), desktopLocation, tr(IMPORT_FILE_TYPES)); - QByteArray fileNameAscii = fileNameString.toAscii(); + QByteArray fileNameAscii = fileNameString.toLocal8Bit(); const char* fileName = fileNameAscii.data(); VoxelTree importVoxels; @@ -2005,7 +2005,7 @@ void Application::update(float deltaTime) { // Set where I am looking based on my mouse ray (so that other people can see) glm::vec3 eyePosition; - if (_isLookingAtOtherAvatar = isLookingAtOtherAvatar(mouseRayOrigin, mouseRayDirection, eyePosition)) { + if ((_isLookingAtOtherAvatar = isLookingAtOtherAvatar(mouseRayOrigin, mouseRayDirection, eyePosition))) { // If the mouse is over another avatar's head... glm::vec3 myLookAtFromMouse(eyePosition); _myAvatar.getHead().setLookAtPosition(myLookAtFromMouse); @@ -2270,7 +2270,7 @@ void Application::updateAvatar(float deltaTime) { _viewFrustum.computePickRay(MIDPOINT_OF_SCREEN, MIDPOINT_OF_SCREEN, screenCenterRayOrigin, screenCenterRayDirection); glm::vec3 eyePosition; - if (_isLookingAtOtherAvatar = isLookingAtOtherAvatar(screenCenterRayOrigin, screenCenterRayDirection, eyePosition)) { + if ((_isLookingAtOtherAvatar = isLookingAtOtherAvatar(screenCenterRayOrigin, screenCenterRayDirection, eyePosition))) { glm::vec3 myLookAtFromMouse(eyePosition); _myAvatar.getHead().setLookAtPosition(myLookAtFromMouse); } @@ -3584,7 +3584,7 @@ void Application::saveSettings(QSettings* settings) { } void Application::importSettings() { - QString locationDir(QDesktopServices::displayName(QDesktopServices::DesktopLocation)); + QString locationDir(QStandardPaths::displayName(QStandardPaths::DesktopLocation)); QString fileName = QFileDialog::getOpenFileName(_window, tr("Open .ini config file"), locationDir, @@ -3596,7 +3596,7 @@ void Application::importSettings() { } void Application::exportSettings() { - QString locationDir(QDesktopServices::displayName(QDesktopServices::DesktopLocation)); + QString locationDir(QStandardPaths::displayName(QStandardPaths::DesktopLocation)); QString fileName = QFileDialog::getSaveFileName(_window, tr("Save .ini config file"), locationDir, diff --git a/interface/src/avatar/AvatarVoxelSystem.cpp b/interface/src/avatar/AvatarVoxelSystem.cpp index c85ea1a343..a9f6b31072 100644 --- a/interface/src/avatar/AvatarVoxelSystem.cpp +++ b/interface/src/avatar/AvatarVoxelSystem.cpp @@ -121,7 +121,7 @@ void AvatarVoxelSystem::setVoxelURL(const QUrl& url) { // handle "file://" urls... if (url.isLocalFile()) { QString pathString = url.path(); - QByteArray pathAsAscii = pathString.toAscii(); + QByteArray pathAsAscii = pathString.toLocal8Bit(); const char* path = pathAsAscii.data(); readFromSVOFile(path); return; @@ -255,7 +255,7 @@ void AvatarVoxelSystem::handleVoxelDownloadProgress(qint64 bytesReceived, qint64 } void AvatarVoxelSystem::handleVoxelReplyError() { - qDebug("%s\n", _voxelReply->errorString().toAscii().constData()); + qDebug("%s\n", _voxelReply->errorString().toLocal8Bit().constData()); _voxelReply->disconnect(this); _voxelReply->deleteLater(); diff --git a/interface/src/ui/ChatEntry.cpp b/interface/src/ui/ChatEntry.cpp index 588c394eb1..f9ea4eb1f6 100644 --- a/interface/src/ui/ChatEntry.cpp +++ b/interface/src/ui/ChatEntry.cpp @@ -66,7 +66,7 @@ bool ChatEntry::keyPressEvent(QKeyEvent* event) { return true; } if (_contents.size() < MAX_CONTENT_LENGTH) { - _contents.insert(_cursorPos, 1, text.at(0).toAscii()); + _contents.insert(_cursorPos, 1, text.at(0).toLatin1()); _cursorPos++; } return true; From b8de278d9010e7d889ed2cf51dbcb14b1473bb2c Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Wed, 24 Jul 2013 12:10:36 -0700 Subject: [PATCH 6/9] use env variable for QT cmake prefix path --- CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 34392a7c5d..afd0ed07f0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,7 +2,8 @@ cmake_minimum_required(VERSION 2.8) project(hifi) -set(CMAKE_PREFIX_PATH "/usr/local/Cellar/qt5/5.1.0/lib/cmake") +message($ENV{QT_CMAKE_PREFIX_PATH}) +set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} $ENV{QT_CMAKE_PREFIX_PATH}) # Find includes in corresponding build directories set(CMAKE_INCLUDE_CURRENT_DIR ON) From 4abb80b4f92e6aaf4d420695e3b068098b379f7b Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Wed, 24 Jul 2013 12:14:52 -0700 Subject: [PATCH 7/9] remove no longer required qt cpp wrap --- interface/CMakeLists.txt | 4 ---- 1 file changed, 4 deletions(-) diff --git a/interface/CMakeLists.txt b/interface/CMakeLists.txt index b5fd7f8895..e5a2880cfd 100755 --- a/interface/CMakeLists.txt +++ b/interface/CMakeLists.txt @@ -78,10 +78,6 @@ set(QUAZIP_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/external/quazip) add_subdirectory(external/fervor/) include_directories(external/fervor/) -# run qt moc on qt-enabled headers -# qt5_wrap_cpp(INTERFACE_SRCS src/Application.h src/Webcam.h src/avatar/AvatarVoxelSystem.h -# src/avatar/Face.h src/ui/BandwidthDialog.h src/ui/VoxelStatsDialog.h) - # create the executable, make it a bundle on OS X add_executable(${TARGET_NAME} MACOSX_BUNDLE ${INTERFACE_SRCS}) From 5708188180a5c699fff2defdcc820bccc760307f Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Wed, 24 Jul 2013 12:22:02 -0700 Subject: [PATCH 8/9] fixes for new message handler for qt5 --- libraries/shared/src/SharedUtil.cpp | 4 ++-- libraries/shared/src/SharedUtil.h | 2 +- voxel-server/src/main.cpp | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/libraries/shared/src/SharedUtil.cpp b/libraries/shared/src/SharedUtil.cpp index 72b5b02f15..b6674fdb32 100644 --- a/libraries/shared/src/SharedUtil.cpp +++ b/libraries/shared/src/SharedUtil.cpp @@ -188,8 +188,8 @@ bool cmdOptionExists(int argc, const char * argv[],const char* option) { return false; } -void sharedMessageHandler(QtMsgType type, const char* message) { - fprintf(stdout, "%s", message); +void sharedMessageHandler(QtMsgType type, const QMessageLogContext& context, const QString &message) { + fprintf(stdout, "%s", message.toLocal8Bit().constData()); } ////////////////////////////////////////////////////////////////////////////////////////// diff --git a/libraries/shared/src/SharedUtil.h b/libraries/shared/src/SharedUtil.h index 37443c2778..d840a83ed9 100644 --- a/libraries/shared/src/SharedUtil.h +++ b/libraries/shared/src/SharedUtil.h @@ -68,7 +68,7 @@ void loadRandomIdentifier(unsigned char* identifierBuffer, int numBytes); const char* getCmdOption(int argc, const char * argv[],const char* option); bool cmdOptionExists(int argc, const char * argv[],const char* option); -void sharedMessageHandler(QtMsgType type, const char* message); +void sharedMessageHandler(QtMsgType type, const QMessageLogContext& context, const QString &message); struct VoxelDetail { float x; diff --git a/voxel-server/src/main.cpp b/voxel-server/src/main.cpp index c009eec2a5..0854dfa4b7 100644 --- a/voxel-server/src/main.cpp +++ b/voxel-server/src/main.cpp @@ -429,7 +429,7 @@ void attachVoxelNodeDataToNode(Node* newNode) { int main(int argc, const char * argv[]) { pthread_mutex_init(&::treeLock, NULL); - qInstallMsgHandler(sharedMessageHandler); + qInstallMessageHandler(sharedMessageHandler); NodeList* nodeList = NodeList::createInstance(NODE_TYPE_VOXEL_SERVER, VOXEL_LISTEN_PORT); setvbuf(stdout, NULL, _IOLBF, 0); From 5f26bbdc0a33a4b023af54dab5d5e1b65327946b Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Wed, 24 Jul 2013 12:22:57 -0700 Subject: [PATCH 9/9] remove debug of QT_CMAKE_PREFIX_PATH --- CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index afd0ed07f0..d803ff373e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,7 +2,6 @@ cmake_minimum_required(VERSION 2.8) project(hifi) -message($ENV{QT_CMAKE_PREFIX_PATH}) set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} $ENV{QT_CMAKE_PREFIX_PATH}) # Find includes in corresponding build directories