frontend will use the data file misc/qt_style.css instead of hardcoded stylesheet - if the file exists
authorsheepluva
Sat, 22 Oct 2011 01:00:21 +0200
changeset 6176 19ef039a8474
parent 6175 a80833ddaef0
child 6177 5eba8970e8ae
frontend will use the data file misc/qt_style.css instead of hardcoded stylesheet - if the file exists
QTfrontend/main.cpp
--- a/QTfrontend/main.cpp	Sat Oct 22 00:00:48 2011 +0200
+++ b/QTfrontend/main.cpp	Sat Oct 22 01:00:21 2011 +0200
@@ -481,8 +481,24 @@
     // this creates the autoreleasepool that prevents leaking
     CocoaInitializer initializer;
 #endif
+    // load external stylesheet if there is any
+    QFile * file =
+        new QFile(HWDataManager::instance().findFileForRead("misc/qt_style.css"));
 
-    app.form = new HWForm(NULL,styleSheetFromHell);
+    if (file->exists() && file->open(QIODevice::ReadOnly | QIODevice::Text))
+    {
+        QString style = "";
+        QTextStream in(file);
+        while (!in.atEnd())
+        {
+            QString line = in.readLine();
+            if(!line.isEmpty())
+                style.append(line);
+        }
+        app.form = new HWForm(NULL, style);
+    }
+    else
+        app.form = new HWForm(NULL, styleSheetFromHell);
 
     app.form->show();
     return app.exec();