summaryrefslogtreecommitdiff
path: root/utils/themeeditor/gui
diff options
context:
space:
mode:
authorRobert Bieber <robby@bieberphoto.com>2010-06-26 05:18:21 +0000
committerRobert Bieber <robby@bieberphoto.com>2010-06-26 05:18:21 +0000
commitc32728c91c2579688d3e7ffc4afbea1acf2385e0 (patch)
treece1732eadbc0f4160fbe434563f2bf8b3e5b5d1c /utils/themeeditor/gui
parentd93164d6c94791d7be6ab71c4a6a2a84f982ba09 (diff)
downloadrockbox-c32728c91c2579688d3e7ffc4afbea1acf2385e0.zip
rockbox-c32728c91c2579688d3e7ffc4afbea1acf2385e0.tar.gz
rockbox-c32728c91c2579688d3e7ffc4afbea1acf2385e0.tar.bz2
rockbox-c32728c91c2579688d3e7ffc4afbea1acf2385e0.tar.xz
Theme Editor: Began integrating device configuration panel with renderer
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27135 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'utils/themeeditor/gui')
-rw-r--r--utils/themeeditor/gui/configdocument.h1
-rw-r--r--utils/themeeditor/gui/devicestate.cpp41
-rw-r--r--utils/themeeditor/gui/devicestate.h1
-rw-r--r--utils/themeeditor/gui/editorwindow.cpp12
-rw-r--r--utils/themeeditor/gui/skindocument.cpp16
-rw-r--r--utils/themeeditor/gui/skindocument.h9
6 files changed, 69 insertions, 11 deletions
diff --git a/utils/themeeditor/gui/configdocument.h b/utils/themeeditor/gui/configdocument.h
index 0057ac1..e91c5cc 100644
--- a/utils/themeeditor/gui/configdocument.h
+++ b/utils/themeeditor/gui/configdocument.h
@@ -75,7 +75,6 @@ private slots:
void addClicked();
void textChanged();
-
private:
Ui::ConfigDocument *ui;
QList<QHBoxLayout*> containers;
diff --git a/utils/themeeditor/gui/devicestate.cpp b/utils/themeeditor/gui/devicestate.cpp
index 3933926..80efd4d 100644
--- a/utils/themeeditor/gui/devicestate.cpp
+++ b/utils/themeeditor/gui/devicestate.cpp
@@ -234,6 +234,47 @@ QVariant DeviceState::data(QString tag)
return QVariant();
}
+void DeviceState::setData(QString tag, QVariant data)
+{
+ QPair<InputType, QWidget*> found =
+ inputs.value(tag, QPair<InputType, QWidget*>(Slide, 0));
+
+ if(found.second == 0)
+ return;
+
+ switch(found.first)
+ {
+ case Text:
+ dynamic_cast<QLineEdit*>(found.second)->setText(data.toString());
+ break;
+
+ case Slide:
+ dynamic_cast<QSlider*>(found.second)->setValue(data.toInt());
+ break;
+
+ case Spin:
+ dynamic_cast<QSpinBox*>(found.second)->setValue(data.toInt());
+ break;
+
+ case DSpin:
+ dynamic_cast<QDoubleSpinBox*>(found.second)->setValue(data.toDouble());
+ break;
+
+ case Combo:
+ dynamic_cast<QComboBox*>
+ (found.second)->
+ setCurrentIndex(dynamic_cast<QComboBox*>
+ (found.second)->findText(data.toString()));
+ break;
+
+ case Check:
+ dynamic_cast<QCheckBox*>(found.second)->setChecked(data.toBool());
+ break;
+ }
+
+ emit settingsChanged();
+}
+
void DeviceState::input()
{
emit settingsChanged();
diff --git a/utils/themeeditor/gui/devicestate.h b/utils/themeeditor/gui/devicestate.h
index c680e2c..cae3cef 100644
--- a/utils/themeeditor/gui/devicestate.h
+++ b/utils/themeeditor/gui/devicestate.h
@@ -47,6 +47,7 @@ public:
virtual ~DeviceState();
QVariant data(QString tag);
+ void setData(QString tag, QVariant data);
signals:
void settingsChanged();
diff --git a/utils/themeeditor/gui/editorwindow.cpp b/utils/themeeditor/gui/editorwindow.cpp
index 94e744e..b778a1f 100644
--- a/utils/themeeditor/gui/editorwindow.cpp
+++ b/utils/themeeditor/gui/editorwindow.cpp
@@ -66,7 +66,8 @@ void EditorWindow::loadTabFromSkinFile(QString fileName)
}
/* Adding a new document*/
- SkinDocument* doc = new SkinDocument(parseStatus, fileName, project);
+ SkinDocument* doc = new SkinDocument(parseStatus, fileName, project,
+ deviceConfig);
addTab(doc);
ui->editorTabs->setCurrentWidget(doc);
@@ -219,7 +220,7 @@ void EditorWindow::addTab(TabContent *doc)
void EditorWindow::newTab()
{
- SkinDocument* doc = new SkinDocument(parseStatus, project);
+ SkinDocument* doc = new SkinDocument(parseStatus, project, deviceConfig);
addTab(doc);
ui->editorTabs->setCurrentWidget(doc);
}
@@ -345,6 +346,13 @@ void EditorWindow::openProject()
project = new ProjectModel(fileName, this);
ui->projectTree->setModel(project);
+ if(project->getSetting("#screenwidth") != "")
+ deviceConfig->setData("screenwidth",
+ project->getSetting("#screenwidth"));
+ if(project->getSetting("#screenheight") != "")
+ deviceConfig->setData("screenheight",
+ project->getSetting("#screenheight"));
+
QObject::connect(ui->projectTree, SIGNAL(activated(QModelIndex)),
project, SLOT(activated(QModelIndex)));
diff --git a/utils/themeeditor/gui/skindocument.cpp b/utils/themeeditor/gui/skindocument.cpp
index 8c98255..4f48d34 100644
--- a/utils/themeeditor/gui/skindocument.cpp
+++ b/utils/themeeditor/gui/skindocument.cpp
@@ -30,9 +30,9 @@
#include <iostream>
SkinDocument::SkinDocument(QLabel* statusLabel, ProjectModel* project,
- QWidget *parent)
+ DeviceState* device, QWidget *parent)
:TabContent(parent), statusLabel(statusLabel),
- project(project)
+ project(project), device(device)
{
setupUI();
@@ -44,9 +44,11 @@ SkinDocument::SkinDocument(QLabel* statusLabel, ProjectModel* project,
}
SkinDocument::SkinDocument(QLabel* statusLabel, QString file,
- ProjectModel* project, QWidget *parent)
+ ProjectModel* project, DeviceState* device,
+ QWidget *parent)
:TabContent(parent), fileName(file),
- statusLabel(statusLabel), project(project)
+ statusLabel(statusLabel), project(project),
+ device(device)
{
setupUI();
blockUpdate = false;
@@ -145,6 +147,10 @@ void SkinDocument::setupUI()
QObject::connect(editor, SIGNAL(cursorPositionChanged()),
this, SLOT(cursorChanged()));
+ /* Connecting to device setting changes */
+ QObject::connect(device, SIGNAL(settingsChanged()),
+ this, SLOT(deviceChanged()));
+
settingsChanged();
}
@@ -257,7 +263,7 @@ void SkinDocument::codeChanged()
else
emit titleChanged(titleText);
- model->render(project, &fileName);
+ model->render(project, device, &fileName);
cursorChanged();
diff --git a/utils/themeeditor/gui/skindocument.h b/utils/themeeditor/gui/skindocument.h
index f6ceb73..c6b3687 100644
--- a/utils/themeeditor/gui/skindocument.h
+++ b/utils/themeeditor/gui/skindocument.h
@@ -33,6 +33,7 @@
#include "codeeditor.h"
#include "tabcontent.h"
#include "projectmodel.h"
+#include "devicestate.h"
class SkinDocument : public TabContent
{
@@ -49,9 +50,9 @@ public:
}
SkinDocument(QLabel* statusLabel, ProjectModel* project = 0,
- QWidget *parent = 0);
+ DeviceState* device = 0, QWidget *parent = 0);
SkinDocument(QLabel* statusLabel, QString file, ProjectModel* project = 0,
- QWidget* parent = 0);
+ DeviceState* device = 0, QWidget* parent = 0);
virtual ~SkinDocument();
void connectPrefs(PreferencesDialog* prefs);
@@ -70,7 +71,7 @@ public:
TabType type() const{ return Skin; }
- QGraphicsScene* scene(){ return model->render(project, &fileName); }
+ QGraphicsScene* scene(){ return model->render(project, device, &fileName); }
signals:
@@ -80,6 +81,7 @@ public slots:
private slots:
void codeChanged();
+ void deviceChanged(){ scene(); }
private:
void setupUI();
@@ -101,6 +103,7 @@ private:
bool blockUpdate;
ProjectModel* project;
+ DeviceState* device;
};
#endif // SKINDOCUMENT_H