Commit 47c2c86f authored by Mathias Goldau's avatar Mathias Goldau
Browse files

[FIX #408] Now the Q_WS_* macros are replaced by its Q_OS_* macros. Also we...

[FIX #408] Now the Q_WS_* macros are replaced by its Q_OS_* macros. Also we now make use of the QCoreApplication::setAttribute( Qt::AA_X11InitThreads ) function.
parent a1e4670b
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
#include <QApplication> #include <QApplication>
#include <QSplashScreen> #include <QSplashScreen>
#include <QFileDialog> #include <QFileDialog>
#include <QtGlobal> // for QCoreApplication::setAttribute
#include <QtCore/QDir> #include <QtCore/QDir>
#include <QtCore/QSettings> #include <QtCore/QSettings>
...@@ -64,11 +65,6 @@ ...@@ -64,11 +65,6 @@
#include "WQtGui.h" #include "WQtGui.h"
#ifdef Q_WS_X11
#include <X11/Xlib.h> // NOLINT - this needs to be done AFTER Qt has set some defines in their headers and after several other
// headers which are included indirectly, although it is a system header.
#endif
WMainWindow* WQtGui::m_mainWindow = NULL; WMainWindow* WQtGui::m_mainWindow = NULL;
QSettings* WQtGui::m_settings = NULL; QSettings* WQtGui::m_settings = NULL;
...@@ -78,6 +74,7 @@ WQtGui::WQtGui( const boost::program_options::variables_map& options, int argc, ...@@ -78,6 +74,7 @@ WQtGui::WQtGui( const boost::program_options::variables_map& options, int argc,
m_optionsMap( options ), m_optionsMap( options ),
m_loadDeferredOnce( true ) m_loadDeferredOnce( true )
{ {
QCoreApplication::setAttribute( Qt::AA_X11InitThreads );
} }
WQtGui::~WQtGui() WQtGui::~WQtGui()
...@@ -153,16 +150,12 @@ void WQtGui::deferredLoad() ...@@ -153,16 +150,12 @@ void WQtGui::deferredLoad()
int WQtGui::run() int WQtGui::run()
{ {
#ifdef Q_WS_X11
XInitThreads();
#endif
m_splash = NULL; m_splash = NULL;
// init logger // init logger
m_loggerConnection = WLogger::getLogger()->subscribeSignal( WLogger::AddLog, boost::bind( &WQtGui::slotAddLog, this, _1 ) ); m_loggerConnection = WLogger::getLogger()->subscribeSignal( WLogger::AddLog, boost::bind( &WQtGui::slotAddLog, this, _1 ) );
// make qapp instance before using the applicationDirPath() function // make qapp instance before using the applicationDirPath() function
#ifdef Q_WS_MAC #ifdef Q_OS_OSX
//TODO(mario): this should run on all platforms but crashes at least on Linux right now. Therefore, I only use it on OSX //TODO(mario): this should run on all platforms but crashes at least on Linux right now. Therefore, I only use it on OSX
WApplication appl( m_argc, m_argv, true ); WApplication appl( m_argc, m_argv, true );
#else #else
...@@ -174,7 +167,7 @@ int WQtGui::run() ...@@ -174,7 +167,7 @@ int WQtGui::run()
boost::filesystem::path walnutBin = boost::filesystem::path( QApplication::applicationDirPath().toStdString() ); boost::filesystem::path walnutBin = boost::filesystem::path( QApplication::applicationDirPath().toStdString() );
// setup path helper which provides several paths to others // setup path helper which provides several paths to others
#ifdef Q_WS_MAC #ifdef Q_OS_OSX
// apple has a special file hierarchy in so-called bundles // apple has a special file hierarchy in so-called bundles
// this code determines whether we are started from a bundle context // this code determines whether we are started from a bundle context
// and sets the paths according to Apple's guidelines inside the bundle // and sets the paths according to Apple's guidelines inside the bundle
...@@ -263,7 +256,7 @@ int WQtGui::run() ...@@ -263,7 +256,7 @@ int WQtGui::run()
m_widgetFactory = WUIQtWidgetFactory::SPtr( new WUIQtWidgetFactory( m_mainWindow ) ); m_widgetFactory = WUIQtWidgetFactory::SPtr( new WUIQtWidgetFactory( m_mainWindow ) );
#ifdef Q_WS_MAC #ifdef Q_OS_OSX
//TODO(mario): this should run on all platforms but crashes at least on Linux right now. Therefore, I only use it on OSX //TODO(mario): this should run on all platforms but crashes at least on Linux right now. Therefore, I only use it on OSX
appl.setMyMainWidget( m_mainWindow ); appl.setMyMainWidget( m_mainWindow );
#endif #endif
......
...@@ -61,7 +61,7 @@ int WScriptUI::run() ...@@ -61,7 +61,7 @@ int WScriptUI::run()
boost::filesystem::path homePath = boost::filesystem::path( getenv( "HOME" ) ); boost::filesystem::path homePath = boost::filesystem::path( getenv( "HOME" ) );
// setup path helper which provides several paths to others // setup path helper which provides several paths to others
#ifdef Q_WS_MAC #ifdef Q_OS_OSX
// apple has a special file hierarchy in so-called bundles // apple has a special file hierarchy in so-called bundles
// this code determines whether we are started from a bundle context // this code determines whether we are started from a bundle context
// and sets the paths according to Apple's guidelines inside the bundle // and sets the paths according to Apple's guidelines inside the bundle
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment