Commit db2ac9b5 authored by Sebastian Eichelbaum's avatar Sebastian Eichelbaum

[CHANGE] renamed Qt5 di qtgui. More universal, especially since I now added...

[CHANGE] renamed Qt5 di qtgui. More universal, especially since I now added Qt4 compilation again. Our Qt5 code is Qt4 compatible.
parent 48d69409
......@@ -49,4 +49,4 @@ if [ -x "$OPENWALNUT_USEOPTIMUS" ]; then
fi
# Run OpenWalnut
$runner $BINDIR/openwalnut-qt5 "$@"
$runner $BINDIR/openwalnut-qt "$@"
......@@ -2,4 +2,4 @@
set PATH=./lib/;./bin/;./libExt/;%PATH%
:: Finally, run OpenWalnut
openwalnut-qt5.exe
openwalnut-qt.exe
......@@ -92,7 +92,7 @@ ADD_CUSTOM_TARGET( list_install_tarets
# install targets for different parts
ADD_CUSTOM_TARGET( install_runtime
${CMAKE_COMMAND}
-DCOMPONENT=QT5GUI
-DCOMPONENT=QTGUI
-P ${CMAKE_BINARY_DIR}/cmake_install.cmake
)
ADD_CUSTOM_TARGET( install_lib
......@@ -137,12 +137,12 @@ ADD_DEPENDENCIES( install_devdoc core_devdoc )
ADD_SUBDIRECTORY( core )
# -----------------------------------------------------------------------------------------------------------------------------------------------
# QT5 GUI
# QT GUI
OPTION( OW_GUI_QT5 "Enable this to build the QT5-based OpenWalnut GUI." ON )
IF( OW_GUI_QT5 )
OPTION( OW_GUI_QT "Enable this to build the QT-based OpenWalnut GUI." ON )
IF( OW_GUI_QT )
# build
ADD_SUBDIRECTORY( qt5gui )
ADD_SUBDIRECTORY( qtgui )
ENDIF()
......
......@@ -32,54 +32,60 @@ ENDIF()
# Some common setup
# ---------------------------------------------------------------------------------------------------------------------------------------------------
SET( LibName "qt5gui" )
SET( BinName "openwalnut-qt5" )
SET( LibName "qtgui" )
SET( BinName "openwalnut-qt" )
# ---------------------------------------------------------------------------------------------------------------------------------------------------
# Setup QT5
# Setup QT
# ---------------------------------------------------------------------------------------------------------------------------------------------------
# Special handling if the user specified a QT path manually. Useful when using multiple installations of Qt.
IF( DEFINED ENV{QTDIR} )
MESSAGE( "Using custom Qt path. Ensure you set the path to the directory containing the bin and lib directories." )
SET( CMAKE_PREFIX_PATH "$ENV{QTDIR}/lib/cmake/Qt5Widgets" ${CMAKE_PREFIX_PATH} )
SET( CMAKE_PREFIX_PATH "$ENV{QTDIR}/lib/cmake/Qt5OpenGL" ${CMAKE_PREFIX_PATH} )
SET( CMAKE_PREFIX_PATH "$ENV{QTDIR}/lib/cmake/Qt5WebKitWidgets" ${CMAKE_PREFIX_PATH} )
SET( CMAKE_PREFIX_PATH $ENV{QTDIR} ${CMAKE_PREFIX_PATH} )
endif()
# Package dependencies:
FIND_PACKAGE( Qt5Widgets REQUIRED )
FIND_PACKAGE( Qt5OpenGL REQUIRED )
FIND_PACKAGE( Qt5WebKitWidgets REQUIRED )
OPTION( OW_GUI_FORCE_QT4 "Enable this to build the QT4-based OpenWalnut GUI." ON )
IF( OW_GUI_FORCE_QT4 )
FIND_PACKAGE( Qt4 REQUIRED QtGui QtOpenGL QtWebKit )
SET( QT_Link_Libs Qt4::QtGui Qt4::QtOpenGL Qt4::QtWebKit )
ELSE()
# Special handling if the user specified a QT path manually. Useful when using multiple installations of Qt.
IF( DEFINED ENV{QTDIR} )
MESSAGE( "Using custom Qt path. Ensure you set the path to the directory containing the bin and lib directories." )
SET( CMAKE_PREFIX_PATH "$ENV{QTDIR}/lib/cmake/Qt5Widgets" ${CMAKE_PREFIX_PATH} )
SET( CMAKE_PREFIX_PATH "$ENV{QTDIR}/lib/cmake/Qt5OpenGL" ${CMAKE_PREFIX_PATH} )
SET( CMAKE_PREFIX_PATH "$ENV{QTDIR}/lib/cmake/Qt5WebKitWidgets" ${CMAKE_PREFIX_PATH} )
SET( CMAKE_PREFIX_PATH $ENV{QTDIR} ${CMAKE_PREFIX_PATH} )
endif()
# Package dependencies:
FIND_PACKAGE( Qt5Widgets REQUIRED )
FIND_PACKAGE( Qt5OpenGL REQUIRED )
FIND_PACKAGE( Qt5WebKitWidgets REQUIRED )
INCLUDE_DIRECTORIES( SYSTEM ${Qt5Widgets_INCLUDE_DIRS} )
INCLUDE_DIRECTORIES( SYSTEM ${Qt5OpenGL_INCLUDE_DIRS} )
INCLUDE_DIRECTORIES( SYSTEM ${Qt5WebKitWidgets_INCLUDE_DIRS} )
# Compiling with Qt5 requires some special definitions and flags to be set.
# Collect and set definitions
SET( _QT5_DEFINITIONS "" )
LIST( APPEND _QT5_DEFINITIONS ${Qt5Widgets_DEFINITIONS} )
LIST( APPEND _QT5_DEFINITIONS ${Qt5OpenGL_DEFINITIONS} )
LIST( APPEND _QT5_DEFINITIONS ${Qt5WebKitWidgets_DEFINITIONS} )
LIST( REMOVE_DUPLICATES _QT5_DEFINITIONS )
ADD_DEFINITIONS( ${_QT5_DEFINITIONS} )
# Collect and set compiler flags
SET( _QT5_EXECUTABLE_COMPILE_FLAGS "" )
LIST( APPEND _QT5_EXECUTABLE_COMPILE_FLAGS ${Qt5Widgets_EXECUTABLE_COMPILE_FLAGS} )
LIST( APPEND _QT5_EXECUTABLE_COMPILE_FLAGS ${Qt5OpenGL_EXECUTABLE_COMPILE_FLAGS} )
LIST( APPEND _QT5_EXECUTABLE_COMPILE_FLAGS ${Qt5WebKitWidgets_EXECUTABLE_COMPILE_FLAGS} )
LIST( REMOVE_DUPLICATES _QT5_EXECUTABLE_COMPILE_FLAGS )
SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${_QT5_EXECUTABLE_COMPILE_FLAGS}" )
SET( QT_Link_Libs Qt5::Widgets Qt5::OpenGL Qt5::WebKitWidgets )
ENDIF()
# Includes:
INCLUDE_DIRECTORIES( SYSTEM ${QT_INCLUDE_DIR} )
INCLUDE_DIRECTORIES( SYSTEM ${Qt5Widgets_INCLUDE_DIRS} )
INCLUDE_DIRECTORIES( SYSTEM ${Qt5OpenGL_INCLUDE_DIRS} )
INCLUDE_DIRECTORIES( SYSTEM ${Qt5WebKitWidgets_INCLUDE_DIRS} )
# ---------------------------------------------------------------------------------------------------------------------------------------------------
# GUI compilation options
# ---------------------------------------------------------------------------------------------------------------------------------------------------
# Compiling with Qt5 requires some special definitions and flags to be set.
# Collect and set definitions
SET( _QT5_DEFINITIONS "" )
LIST( APPEND _QT5_DEFINITIONS ${Qt5Widgets_DEFINITIONS} )
LIST( APPEND _QT5_DEFINITIONS ${Qt5OpenGL_DEFINITIONS} )
LIST( APPEND _QT5_DEFINITIONS ${Qt5WebKitWidgets_DEFINITIONS} )
LIST( REMOVE_DUPLICATES _QT5_DEFINITIONS )
ADD_DEFINITIONS( ${_QT5_DEFINITIONS} )
# Collect and set compiler flags
SET( _QT5_EXECUTABLE_COMPILE_FLAGS "" )
LIST( APPEND _QT5_EXECUTABLE_COMPILE_FLAGS ${Qt5Widgets_EXECUTABLE_COMPILE_FLAGS} )
LIST( APPEND _QT5_EXECUTABLE_COMPILE_FLAGS ${Qt5OpenGL_EXECUTABLE_COMPILE_FLAGS} )
LIST( APPEND _QT5_EXECUTABLE_COMPILE_FLAGS ${Qt5WebKitWidgets_EXECUTABLE_COMPILE_FLAGS} )
LIST( REMOVE_DUPLICATES _QT5_EXECUTABLE_COMPILE_FLAGS )
SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${_QT5_EXECUTABLE_COMPILE_FLAGS}" )
# ---------------------------------------------------------------------------------------------------------------------------------------------------
# Add sources as target
......@@ -88,7 +94,7 @@ SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${_QT5_EXECUTABLE_COMPILE_FLAGS}" )
# Collect the compile-files for this target
COLLECT_COMPILE_FILES( "${CMAKE_CURRENT_SOURCE_DIR}" TARGET_CPP_FILES TARGET_H_FILES TARGET_TEST_FILES )
# Qt5 Requires all classes with a QWidget stuff inside to be put into the MOC mechanism. We utilize the automoc mechanism here.
# Qt Requires all classes with a QWidget stuff inside to be put into the MOC mechanism. We utilize the automoc mechanism here.
SET( CMAKE_AUTOMOC ON )
SET( AUTOMOC_MOC_OPTIONS "${OW_CPP_FLAGS_INJECT}" )
......@@ -103,7 +109,7 @@ IF( CMAKE_HOST_SYSTEM MATCHES "Linux" )
SET( ADDITIONAL_TARGET_LINK_LIBRARIES "X11" )
ENDIF()
TARGET_LINK_LIBRARIES( ${BinName} ${OW_LIB_OPENWALNUT}
Qt5::Widgets Qt5::OpenGL Qt5::WebKitWidgets
${QT_Link_Libs}
${Boost_LIBRARIES}
${ADDITIONAL_TARGET_LINK_LIBRARIES} )
......@@ -118,7 +124,7 @@ INSTALL( TARGETS ${BinName}
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
GROUP_READ GROUP_EXECUTE
WORLD_READ WORLD_EXECUTE
COMPONENT "QT5GUI"
COMPONENT "QTGUI"
)
# ---------------------------------------------------------------------------------------------------------------------------------------------------
......@@ -133,21 +139,21 @@ SETUP_TESTS( "${TARGET_TEST_FILES}" "${BinName}" "" )
# ---------------------------------------------------------------------------------------------------------------------------------------------------
# copy our own resources
SETUP_GLOBAL_RESOURCES( ${LibName} "QT5GUI" )
SETUP_GLOBAL_RESOURCES( ${LibName} "QTGUI" )
# where to put doc files?
SET( OW_DOC_DIR_RELATIVE "share/doc/openwalnut-qt5" )
SETUP_COMMON_DOC( ${OW_DOC_DIR_RELATIVE} "QT5GUI" )
SET( OW_DOC_DIR_RELATIVE "share/doc/openwalnut-qt" )
SETUP_COMMON_DOC( ${OW_DOC_DIR_RELATIVE} "QTGUI" )
# also copy all the user documentation we have for qt5gui
# also copy all the user documentation we have for qtgui
SETUP_ADDITIONAL_DIRECTORY( ${OW_DOC_DIR_RELATIVE}
${PROJECT_SOURCE_DIR}/../doc/${LibName}/help/
"QT5GUI"
"QTGUI"
TRUE # this denotes that the contents of doc/user should be copied instead of user directly
)
SETUP_ADDITIONAL_DIRECTORY( ${OW_MAN_DIR_RELATIVE}
${PROJECT_SOURCE_DIR}/../doc/${LibName}/man/
"QT5GUI"
"QTGUI"
TRUE # this denotes that the contents of doc/man should be copied instead of user directly
)
......
......@@ -52,7 +52,7 @@ void WIconManager::addMapping( const std::string& newName, const std::string& ma
QIcon WIconManager::getIcon( const std::string name )
{
// ensure we have a fallback icon
boost::filesystem::path fallback = WPathHelper::getPathHelper()->getSharePath() / "qt5gui" / "default.png";
boost::filesystem::path fallback = WPathHelper::getPathHelper()->getSharePath() / "qtgui" / "default.png";
WAssert( boost::filesystem::exists( fallback ), "Found no icon named: " + name + " and no fallback icon. Installation broken?" );
return getIcon( name, QIcon( QPixmap( QString::fromStdString( fallback.string() ) ) ) );
}
......@@ -68,7 +68,7 @@ QIcon WIconManager::getIcon( const std::string name, const QIcon& defaultIcon )
}
// search file
boost::filesystem::path p = WPathHelper::getPathHelper()->getSharePath() / "qt5gui" / std::string( iconFile + ".png" );
boost::filesystem::path p = WPathHelper::getPathHelper()->getSharePath() / "qtgui" / std::string( iconFile + ".png" );
// and an alternative path
boost::filesystem::path pAlt = WPathHelper::getPathHelper()->getSharePath() / ".." / "pixmaps" / std::string( iconFile + ".png" );
if( boost::filesystem::exists( p ) )
......
......@@ -133,26 +133,26 @@ void WMainWindow::setupGUI()
// Setting setup
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
WSettingAction* hideMenuAction = new WSettingAction( this, "qt5gui/showMenu",
WSettingAction* hideMenuAction = new WSettingAction( this, "qtgui/showMenu",
"Show Menubar",
"Allows you to hide the menu. Can be restored using CTRL-M.",
true,
false,
QKeySequence( Qt::CTRL + Qt::Key_M ) );
WSettingAction* showNavWidgets = new WSettingAction( this, "qt5gui/showNavigationWidgets",
WSettingAction* showNavWidgets = new WSettingAction( this, "qtgui/showNavigationWidgets",
"Show Navigation Views",
"Disables the navigation views completely. This can lead to a speed-up and is "
"recommended for those who do not need them.",
false,
true // this requires a restart
);
m_sliderMinMaxEditSetting = new WSettingAction( this, std::string( "qt5gui/" ) + std::string( "sliderMinMaxEdit" ),
m_sliderMinMaxEditSetting = new WSettingAction( this, std::string( "qtgui/" ) + std::string( "sliderMinMaxEdit" ),
"Slider Min/Max Editing",
"If enabled, the maximum and minimum values of slider can be edited.",
false );
WSettingAction* mtViews = new WSettingAction( this, "qt5gui/ge/multiThreadedViewer",
WSettingAction* mtViews = new WSettingAction( this, "qtgui/ge/multiThreadedViewer",
"Multi-Threaded Views",
"If enabled, the graphic windows are rendered in different threads. This can speed-up "
"rendering on machines with multiple cores. WARNING: can lead to crashes sometimes.",
......@@ -169,7 +169,7 @@ void WMainWindow::setupGUI()
logOptions.push_back( "Info" );
logOptions.push_back( "Warning" );
logOptions.push_back( "Error" );
WSettingMenu* logLevels = new WSettingMenu( this, "qt5gui/logLevel",
WSettingMenu* logLevels = new WSettingMenu( this, "qtgui/logLevel",
"Log-Level",
"Allows one to set the log verbosity.",
1, // info is the default
......@@ -759,7 +759,7 @@ void WMainWindow::openAboutQtDialog()
void WMainWindow::openAboutDialog()
{
std::string filename( WPathHelper::getDocPath().string() + "/openwalnut-qt5/OpenWalnutAbout.html" );
std::string filename( WPathHelper::getDocPath().string() + "/openwalnut-qt/OpenWalnutAbout.html" );
std::string content = readFileIntoString( filename );
std::string windowHeading = std::string( "About OpenWalnut " ) + std::string( W_VERSION );
QMessageBox::about( this, windowHeading.c_str(), content.c_str() );
......@@ -767,7 +767,7 @@ void WMainWindow::openAboutDialog()
void WMainWindow::openSupportDialog()
{
std::string filename( WPathHelper::getDocPath().string() + "/openwalnut-qt5/OpenWalnutSupport.html" );
std::string filename( WPathHelper::getDocPath().string() + "/openwalnut-qt/OpenWalnutSupport.html" );
std::string content = readFileIntoString( filename );
std::string windowHeading = std::string( "Professional Support " ) + std::string( W_VERSION );
QMessageBox* b = new QMessageBox( QMessageBox::Information,
......@@ -782,7 +782,7 @@ void WMainWindow::openSupportDialog()
void WMainWindow::openOpenWalnutHelpDialog()
{
std::string filename( WPathHelper::getDocPath().string() + "/openwalnut-qt5/OpenWalnutHelp.html" );
std::string filename( WPathHelper::getDocPath().string() + "/openwalnut-qt/OpenWalnutHelp.html" );
std::string content = readFileIntoString( filename );
......@@ -796,7 +796,7 @@ void WMainWindow::openOpenWalnutHelpDialog()
window->show();
QWebView *view = new QWebView( this );
QString location( QString( "file://" ) + WPathHelper::getDocPath().string().c_str() + "/openwalnut-qt5/" );
QString location( QString( "file://" ) + WPathHelper::getDocPath().string().c_str() + "/openwalnut-qt/" );
view->setHtml( content.c_str(), QUrl( location ) );
view->show();
layout->addWidget( view );
......@@ -1177,7 +1177,7 @@ void WMainWindow::handleGLVendor()
void WMainWindow::showWelcomeDialog( bool force )
{
// Load welcome file
std::string filename( WPathHelper::getDocPath().string() + "/openwalnut-qt5/OpenWalnutWelcome.html" );
std::string filename( WPathHelper::getDocPath().string() + "/openwalnut-qt/OpenWalnutWelcome.html" );
std::string content = readFileIntoString( filename );
// gen ID for it using version (allows showing release/welcome message for each new release)
......
......@@ -194,17 +194,17 @@ int WQtGui::run()
WPathHelper::getPathHelper()->setBasePaths( walnutBin, boost::filesystem::path( QDir::homePath().toStdString() ) / ".OpenWalnut" );
#endif
QPixmap splashPixmap( QString::fromStdString( ( WPathHelper::getPathHelper()->getSharePath() / "qt5gui" / "splash.png" ).string() ) );
QPixmap splashPixmap( QString::fromStdString( ( WPathHelper::getPathHelper()->getSharePath() / "qtgui" / "splash.png" ).string() ) );
m_splash = new QSplashScreen( splashPixmap );
m_splash->show();
// with the correct paths, we can load the settings
m_settings = new QSettings( QString::fromStdString( ( WPathHelper::getHomePath() / "config.qt5gui" ).string() ), QSettings::IniFormat );
m_settings = new QSettings( QString::fromStdString( ( WPathHelper::getHomePath() / "config.qtgui" ).string() ), QSettings::IniFormat );
WQtModuleConfig::initPathHelper();
// get the minimum log level from preferences
LogLevel logLevel = static_cast< LogLevel >( WQtGui::getSettings().value( "qt5gui/logLevel", LL_DEBUG ).toInt() );
LogLevel logLevel = static_cast< LogLevel >( WQtGui::getSettings().value( "qtgui/logLevel", LL_DEBUG ).toInt() );
WLogger::getLogger()->setDefaultLogLevel( logLevel );
// print the first output
......