summaryrefslogtreecommitdiff
path: root/utils/themeeditor
diff options
context:
space:
mode:
Diffstat (limited to 'utils/themeeditor')
-rw-r--r--utils/themeeditor/editorwindow.cpp12
-rw-r--r--utils/themeeditor/editorwindow.h1
-rw-r--r--utils/themeeditor/parsetreemodel.cpp5
-rw-r--r--utils/themeeditor/skin_parser.c8
-rw-r--r--utils/themeeditor/skindocument.cpp9
-rw-r--r--utils/themeeditor/skindocument.h11
6 files changed, 35 insertions, 11 deletions
diff --git a/utils/themeeditor/editorwindow.cpp b/utils/themeeditor/editorwindow.cpp
index bc66fec425..dfc4b5981e 100644
--- a/utils/themeeditor/editorwindow.cpp
+++ b/utils/themeeditor/editorwindow.cpp
@@ -25,6 +25,7 @@
25#include <QDesktopWidget> 25#include <QDesktopWidget>
26#include <QFileSystemModel> 26#include <QFileSystemModel>
27#include <QSettings> 27#include <QSettings>
28#include <QFileDialog>
28 29
29EditorWindow::EditorWindow(QWidget *parent) : 30EditorWindow::EditorWindow(QWidget *parent) :
30 QMainWindow(parent), 31 QMainWindow(parent),
@@ -183,6 +184,17 @@ void EditorWindow::saveCurrentAs()
183 dynamic_cast<SkinDocument*>(ui->editorTabs->currentWidget())->saveAs(); 184 dynamic_cast<SkinDocument*>(ui->editorTabs->currentWidget())->saveAs();
184} 185}
185 186
187void EditorWindow::openFile()
188{
189 QStringList fileNames;
190 QSettings settings;
191
192 settings.beginGroup("SkinDocument");
193 QString directory = settings.value("defaultDirectory", "").toString();
194 fileNames = QFileDialog::getOpenFileNames(this, tr("Open Files"), directory,
195 SkinDocument::fileFilter());
196}
197
186 198
187void EditorWindow::tabTitleChanged(QString title) 199void EditorWindow::tabTitleChanged(QString title)
188{ 200{
diff --git a/utils/themeeditor/editorwindow.h b/utils/themeeditor/editorwindow.h
index bf1228acec..e7fd96a548 100644
--- a/utils/themeeditor/editorwindow.h
+++ b/utils/themeeditor/editorwindow.h
@@ -49,6 +49,7 @@ private slots:
49 void closeCurrent(); 49 void closeCurrent();
50 void saveCurrent(); 50 void saveCurrent();
51 void saveCurrentAs(); 51 void saveCurrentAs();
52 void openFile();
52 void tabTitleChanged(QString title); 53 void tabTitleChanged(QString title);
53 void updateCurrent(); /* Generates code in the current tab */ 54 void updateCurrent(); /* Generates code in the current tab */
54 55
diff --git a/utils/themeeditor/parsetreemodel.cpp b/utils/themeeditor/parsetreemodel.cpp
index eecdc98334..8da0c26ef3 100644
--- a/utils/themeeditor/parsetreemodel.cpp
+++ b/utils/themeeditor/parsetreemodel.cpp
@@ -49,7 +49,10 @@ ParseTreeModel::~ParseTreeModel()
49 49
50QString ParseTreeModel::genCode() 50QString ParseTreeModel::genCode()
51{ 51{
52 return root->genCode(); 52 if(root)
53 return root->genCode();
54 else
55 return "";
53} 56}
54 57
55bool ParseTreeModel::changeTree(const char *document) 58bool ParseTreeModel::changeTree(const char *document)
diff --git a/utils/themeeditor/skin_parser.c b/utils/themeeditor/skin_parser.c
index a771fe7584..c7df7af0c0 100644
--- a/utils/themeeditor/skin_parser.c
+++ b/utils/themeeditor/skin_parser.c
@@ -685,9 +685,15 @@ int skin_parse_conditional(struct skin_element* element, char** document)
685 while(nested) 685 while(nested)
686 { 686 {
687 if(*cursor == ENUMLISTOPENSYM) 687 if(*cursor == ENUMLISTOPENSYM)
688 {
688 nested++; 689 nested++;
689 if(*cursor == ENUMLISTCLOSESYM) 690 break;
691 }
692 else if(*cursor == ENUMLISTCLOSESYM)
693 {
690 nested--; 694 nested--;
695 break;
696 }
691 cursor++; 697 cursor++;
692 } 698 }
693 } 699 }
diff --git a/utils/themeeditor/skindocument.cpp b/utils/themeeditor/skindocument.cpp
index aada24daac..469401d07b 100644
--- a/utils/themeeditor/skindocument.cpp
+++ b/utils/themeeditor/skindocument.cpp
@@ -28,12 +28,7 @@
28#include <QFileDialog> 28#include <QFileDialog>
29 29
30SkinDocument::SkinDocument(QWidget *parent) : 30SkinDocument::SkinDocument(QWidget *parent) :
31 QWidget(parent), fileFilter(tr("WPS Files (*.wps *.rwps);;" 31 QWidget(parent)
32 "SBS Files (*.sbs *.rsbs);;"
33 "FMS Files (*.fms *.rfms);;"
34 "All Skin Files (*.wps *.rwps *.sbs "
35 "*.rsbs *.fms *.rfms);;"
36 "All Files (*.*)"))
37{ 32{
38 setupUI(); 33 setupUI();
39 34
@@ -147,7 +142,7 @@ void SkinDocument::saveAs()
147 directory = settings.value("defaultDirectory", "").toString(); 142 directory = settings.value("defaultDirectory", "").toString();
148 143
149 fileName = QFileDialog::getSaveFileName(this, tr("Save Document"), 144 fileName = QFileDialog::getSaveFileName(this, tr("Save Document"),
150 directory, fileFilter); 145 directory, fileFilter());
151 directory = fileName; 146 directory = fileName;
152 if(fileName == "") 147 if(fileName == "")
153 return; 148 return;
diff --git a/utils/themeeditor/skindocument.h b/utils/themeeditor/skindocument.h
index f222543522..4546c42edb 100644
--- a/utils/themeeditor/skindocument.h
+++ b/utils/themeeditor/skindocument.h
@@ -33,8 +33,15 @@ class SkinDocument : public QWidget
33{ 33{
34Q_OBJECT 34Q_OBJECT
35public: 35public:
36 const QString fileFilter; 36 static QString fileFilter()
37 37 {
38 return tr("WPS Files (*.wps *.rwps);;"
39 "SBS Files (*.sbs *.rsbs);;"
40 "FMS Files (*.fms *.rfms);;"
41 "All Skin Files (*.wps *.rwps *.sbs "
42 "*.rsbs *.fms *.rfms);;"
43 "All Files (*.*)");
44 }
38 45
39 SkinDocument(QWidget *parent = 0); 46 SkinDocument(QWidget *parent = 0);
40 virtual ~SkinDocument(); 47 virtual ~SkinDocument();