summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorRobert Bieber <robby@bieberphoto.com>2010-06-06 03:35:40 +0000
committerRobert Bieber <robby@bieberphoto.com>2010-06-06 03:35:40 +0000
commitf3491e97d0d96f8df8a3c5a16efdef19c0796770 (patch)
treeb5de3be4832afe9ab7e213ea12d8faa2a3335632 /utils
parent5619b4f6cf968b8d5820d214790ec29f7f109a63 (diff)
Theme Editor: Began working on open document functionality (still incomplete), fixed a nested conditional parsing bug in the parser, and fixed segfault-on-codegen-from-empty-tree bug
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26609 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'utils')
-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 @@
#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 bf1228acec..e7fd96a548 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 eecdc98334..8da0c26ef3 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 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)
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 aada24daac..469401d07b 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 f222543522..4546c42edb 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();