let's create some templates so that the user knows how to start off
authorsheepluva
Sat, 22 Oct 2011 19:37:39 +0200
changeset 6186 255aff92216d
parent 6185 a6aa2d44f390
child 6187 59ff93c0ae2d
let's create some templates so that the user knows how to start off
QTfrontend/main.cpp
--- a/QTfrontend/main.cpp	Sat Oct 22 18:24:36 2011 +0200
+++ b/QTfrontend/main.cpp	Sat Oct 22 19:37:39 2011 +0200
@@ -165,6 +165,27 @@
         return 1;
     }
 
+    // copy data/default css files to cfgdir as templates
+    QString userCssDir = cfgdir->absolutePath() + "/Data/css";
+    if (checkForDir(userCssDir))
+    {
+        QString defaultCssDir = ":res/css";
+        QStringList cssFiles = QDir(defaultCssDir).entryList(QDir::Files);
+        foreach (const QString & cssFile, cssFiles)
+        {
+            QString srcName = datadir->absolutePath()+"/css/"+cssFile;
+
+            if (!QFile::exists(srcName))
+                srcName = defaultCssDir+"/"+cssFile;
+
+            QString tmpName = userCssDir + "/template_" + cssFile;
+            if (QFile::exists(tmpName))
+                QFile::remove(tmpName);
+
+            QFile(srcName).copy(tmpName);
+        }
+    }
+
     {
         QStringList themes;