Permalink
Browse files

check for css in application path (win32) or Resources bundle folder …

…(osx) if not specified as command line arg
  • Loading branch information...
1 parent b5f307f commit 31b735f6aae11e2a7e0eed36a2ca53161a0b1b63 @jonocole jonocole committed Sep 10, 2009
Showing with 15 additions and 0 deletions.
  1. +15 −0 lib/unicorn/UnicornApplication.cpp
View
15 lib/unicorn/UnicornApplication.cpp
@@ -39,6 +39,8 @@
#include <QDebug>
#include <QLocale>
#include <QTranslator>
+#include <QFile>
+#include <QFileInfo>
unicorn::Application::Application( int& argc, char** argv ) throw( StubbornUserException )
@@ -56,6 +58,19 @@ unicorn::Application::Application( int& argc, char** argv ) throw( StubbornUserE
AEInstallEventHandler( kCoreEventClass, kAEReopenApplication, h, 0, false );
#endif
+ #ifdef Q_WS_MAC
+ #define CSS_PATH "/../Resources/"
+ #else
+ #define CSS_PATH "/"
+ #endif
+ if( styleSheet().isEmpty()) {
+ QString cssFileName = QFileInfo(applicationFilePath()).baseName() + ".css";
+ QFile stylesheetFile( applicationDirPath() + CSS_PATH + cssFileName );
+ stylesheetFile.open( QIODevice::ReadOnly );
+ QString stylesheet( stylesheetFile.readAll() );
+ setStyleSheet( stylesheet );
+ }
+
translate();
GlobalSettings s;

0 comments on commit 31b735f

Please sign in to comment.