summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobert Bieber <robby@bieberphoto.com>2010-06-06 02:11:04 +0000
committerRobert Bieber <robby@bieberphoto.com>2010-06-06 02:11:04 +0000
commit5619b4f6cf968b8d5820d214790ec29f7f109a63 (patch)
tree39efebbd0ae096fa742b46dc9989f0669e624cd2
parentbc9b353c3e6f44d61fea7b352ccca915ef62a5d8 (diff)
downloadrockbox-5619b4f6cf968b8d5820d214790ec29f7f109a63.tar.gz
rockbox-5619b4f6cf968b8d5820d214790ec29f7f109a63.tar.bz2
rockbox-5619b4f6cf968b8d5820d214790ec29f7f109a63.zip
Theme Editor: Added code generation with tabs
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26608 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--utils/themeeditor/editorwindow.cpp17
-rw-r--r--utils/themeeditor/editorwindow.h1
-rw-r--r--utils/themeeditor/editorwindow.ui6
-rw-r--r--utils/themeeditor/skindocument.h1
4 files changed, 25 insertions, 0 deletions
diff --git a/utils/themeeditor/editorwindow.cpp b/utils/themeeditor/editorwindow.cpp
index 4d2ed87169..bc66fec425 100644
--- a/utils/themeeditor/editorwindow.cpp
+++ b/utils/themeeditor/editorwindow.cpp
@@ -84,6 +84,10 @@ void EditorWindow::setupUI()
QObject::connect(ui->editorTabs, SIGNAL(tabCloseRequested(int)),
this, SLOT(closeTab(int)));
+ /* Connecting the code gen button */
+ QObject::connect(ui->fromTree, SIGNAL(pressed()),
+ this, SLOT(updateCurrent()));
+
}
void EditorWindow::setupMenus()
@@ -133,6 +137,8 @@ void EditorWindow::shiftTab(int index)
ui->actionSave_Document->setEnabled(false);
ui->actionSave_Document_As->setEnabled(false);
ui->actionClose_Document->setEnabled(false);
+ ui->actionToolbarSave->setEnabled(false);
+ ui->fromTree->setEnabled(false);
}
else
{
@@ -141,6 +147,8 @@ void EditorWindow::shiftTab(int index)
ui->actionSave_Document->setEnabled(true);
ui->actionSave_Document_As->setEnabled(true);
ui->actionClose_Document->setEnabled(true);
+ ui->actionToolbarSave->setEnabled(true);
+ ui->fromTree->setEnabled(true);
}
}
@@ -211,6 +219,15 @@ void EditorWindow::closeEvent(QCloseEvent* event)
event->accept();
}
+void EditorWindow::updateCurrent()
+{
+ if(ui->editorTabs->currentIndex() < 0)
+ return;
+
+ dynamic_cast<SkinDocument*>
+ (ui->editorTabs->currentWidget())->genCode();
+}
+
EditorWindow::~EditorWindow()
{
delete ui;
diff --git a/utils/themeeditor/editorwindow.h b/utils/themeeditor/editorwindow.h
index 0febe54021..bf1228acec 100644
--- a/utils/themeeditor/editorwindow.h
+++ b/utils/themeeditor/editorwindow.h
@@ -50,6 +50,7 @@ private slots:
void saveCurrent();
void saveCurrentAs();
void tabTitleChanged(QString title);
+ void updateCurrent(); /* Generates code in the current tab */
private:
/* Setup functions */
diff --git a/utils/themeeditor/editorwindow.ui b/utils/themeeditor/editorwindow.ui
index b5e6c9d228..b25243f254 100644
--- a/utils/themeeditor/editorwindow.ui
+++ b/utils/themeeditor/editorwindow.ui
@@ -129,6 +129,9 @@
</item>
<item>
<widget class="QPushButton" name="fromTree">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
<property name="text">
<string>Update Code</string>
</property>
@@ -260,6 +263,9 @@
</property>
</action>
<action name="actionToolbarSave">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
<property name="icon">
<iconset resource="resources.qrc">
<normaloff>:/resources/resources/document-save.png</normaloff>:/resources/resources/document-save.png</iconset>
diff --git a/utils/themeeditor/skindocument.h b/utils/themeeditor/skindocument.h
index d00c81f36b..f222543522 100644
--- a/utils/themeeditor/skindocument.h
+++ b/utils/themeeditor/skindocument.h
@@ -41,6 +41,7 @@ public:
ParseTreeModel* getModel(){ return model; }
QString getTitle(){ return title; }
+ void genCode(){ editor->document()->setPlainText(model->genCode()); }
void save();
void saveAs();