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 bc66fec..dfc4b59 100644
--- a/utils/themeeditor/editorwindow.cpp
+++ b/utils/themeeditor/editorwindow.cpp
@@ -25,6 +25,7 @@
#include <QDesktopWidget>
#include <QFileSystemModel>
#include <QSettings>
+#include <QFileDialog>
EditorWindow::EditorWindow(QWidget *parent) :
QMainWindow(parent),
@@ -183,6 +184,17 @@ void EditorWindow::saveCurrentAs()
dynamic_cast<SkinDocument*>(ui->editorTabs->currentWidget())->saveAs();
}
+void EditorWindow::openFile()
+{
+ QStringList fileNames;
+ QSettings settings;
+
+ settings.beginGroup("SkinDocument");
+ QString directory = settings.value("defaultDirectory", "").toString();
+ fileNames = QFileDialog::getOpenFileNames(this, tr("Open Files"), directory,
+ SkinDocument::fileFilter());
+}
+
void EditorWindow::tabTitleChanged(QString title)
{
diff --git a/utils/themeeditor/editorwindow.h b/utils/themeeditor/editorwindow.h
index bf1228a..e7fd96a 100644
--- a/utils/themeeditor/editorwindow.h
+++ b/utils/themeeditor/editorwindow.h
@@ -49,6 +49,7 @@ private slots:
void closeCurrent();
void saveCurrent();
void saveCurrentAs();
+ void openFile();
void tabTitleChanged(QString title);
void updateCurrent(); /* Generates code in the current tab */
diff --git a/utils/themeeditor/parsetreemodel.cpp b/utils/themeeditor/parsetreemodel.cpp
index eecdc98..8da0c26 100644
--- a/utils/themeeditor/parsetreemodel.cpp
+++ b/utils/themeeditor/parsetreemodel.cpp
@@ -49,7 +49,10 @@ ParseTreeModel::~ParseTreeModel()
QString ParseTreeModel::genCode()
{
- return root->genCode();
+ if(root)
+ return root->genCode();
+ else
+ return "";
}
bool ParseTreeModel::changeTree(const char *document)
diff --git a/utils/themeeditor/skin_parser.c b/utils/themeeditor/skin_parser.c
index a771fe7..c7df7af 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)
while(nested)
{
if(*cursor == ENUMLISTOPENSYM)
+ {
nested++;
- if(*cursor == ENUMLISTCLOSESYM)
+ break;
+ }
+ else if(*cursor == ENUMLISTCLOSESYM)
+ {
nested--;
+ break;
+ }
cursor++;
}
}
diff --git a/utils/themeeditor/skindocument.cpp b/utils/themeeditor/skindocument.cpp
index aada24d..469401d 100644
--- a/utils/themeeditor/skindocument.cpp
+++ b/utils/themeeditor/skindocument.cpp
@@ -28,12 +28,7 @@
#include <QFileDialog>
SkinDocument::SkinDocument(QWidget *parent) :
- QWidget(parent), fileFilter(tr("WPS Files (*.wps *.rwps);;"
- "SBS Files (*.sbs *.rsbs);;"
- "FMS Files (*.fms *.rfms);;"
- "All Skin Files (*.wps *.rwps *.sbs "
- "*.rsbs *.fms *.rfms);;"
- "All Files (*.*)"))
+ QWidget(parent)
{
setupUI();
@@ -147,7 +142,7 @@ void SkinDocument::saveAs()
directory = settings.value("defaultDirectory", "").toString();
fileName = QFileDialog::getSaveFileName(this, tr("Save Document"),
- directory, fileFilter);
+ directory, fileFilter());
directory = fileName;
if(fileName == "")
return;
diff --git a/utils/themeeditor/skindocument.h b/utils/themeeditor/skindocument.h
index f222543..4546c42 100644
--- a/utils/themeeditor/skindocument.h
+++ b/utils/themeeditor/skindocument.h
@@ -33,8 +33,15 @@ class SkinDocument : public QWidget
{
Q_OBJECT
public:
- const QString fileFilter;
-
+ static QString fileFilter()
+ {
+ return tr("WPS Files (*.wps *.rwps);;"
+ "SBS Files (*.sbs *.rsbs);;"
+ "FMS Files (*.fms *.rfms);;"
+ "All Skin Files (*.wps *.rwps *.sbs "
+ "*.rsbs *.fms *.rfms);;"
+ "All Files (*.*)");
+ }
SkinDocument(QWidget *parent = 0);
virtual ~SkinDocument();