From eb52a45a0c1f42386dbc0e148e81972ae3878b71 Mon Sep 17 00:00:00 2001 From: Robert Bieber Date: Sun, 18 Jul 2010 00:39:40 +0000 Subject: Theme Editor: If a pr project specifies a valid #target value, its settings are now loaded into the device configuration panel when the theme is loaded git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27476 a1c6a512-1295-4272-9138-f99709370657 --- utils/themeeditor/gui/editorwindow.cpp | 22 ++++++++++++++++++++++ utils/themeeditor/models/targetdata.cpp | 9 ++++++++- utils/themeeditor/models/targetdata.h | 6 ++++-- utils/themeeditor/resources/targetdb | 9 +++++++++ 4 files changed, 43 insertions(+), 3 deletions(-) (limited to 'utils') diff --git a/utils/themeeditor/gui/editorwindow.cpp b/utils/themeeditor/gui/editorwindow.cpp index b5eea633f9..57de72358a 100644 --- a/utils/themeeditor/gui/editorwindow.cpp +++ b/utils/themeeditor/gui/editorwindow.cpp @@ -728,6 +728,28 @@ void EditorWindow::loadProjectFile(QString fileName) project = new ProjectModel(fileName, this); ui->projectTree->setModel(project); + /* Setting target info if necessary */ + TargetData targets; + QString target = project->getSetting("#target", ""); + if(target != "" && targets.index(target) >= 0) + { + int index = targets.index(target); + + QRect screen = targets.screenSize(index); + deviceConfig->setData("screenwidth", screen.width()); + deviceConfig->setData("screenheight", screen.height()); + + if(targets.remoteDepth(index) != TargetData::None) + { + QRect remote = targets.remoteSize(index); + deviceConfig->setData("remotewidth", remote.width()); + deviceConfig->setData("remoteheight", remote.height()); + } + + deviceConfig->setData("tp", targets.fm(index)); + deviceConfig->setData("Rp", targets.canRecord(index)); + } + if(project->getSetting("#screenwidth") != "") deviceConfig->setData("screenwidth", project->getSetting("#screenwidth")); diff --git a/utils/themeeditor/models/targetdata.cpp b/utils/themeeditor/models/targetdata.cpp index a20a4cf18f..70d231988b 100644 --- a/utils/themeeditor/models/targetdata.cpp +++ b/utils/themeeditor/models/targetdata.cpp @@ -49,6 +49,7 @@ TargetData::TargetData(QString file) QRect rSize(0, 0, 0, 0); ScreenDepth rDepth = None; bool fm = false; + bool record = false; if(id == "") break; @@ -119,13 +120,19 @@ TargetData::TargetData(QString file) if(s.toLower() == "yes") fm = true; } + else if(key.toLower() == "record") + { + QString s = scanString(data, cursor); + if(s.toLower() == "yes") + record = true; + } } } /* Checking for the closing '}' and adding the entry */ if(require('}', data, cursor)) { - entries.append(Entry(name, size, depth, rSize, rDepth, fm)); + entries.append(Entry(name, size, depth, rSize, rDepth, fm, record)); indices.insert(id, index); index++; } diff --git a/utils/themeeditor/models/targetdata.h b/utils/themeeditor/models/targetdata.h index ef7ac5c8a9..09276c5966 100644 --- a/utils/themeeditor/models/targetdata.h +++ b/utils/themeeditor/models/targetdata.h @@ -52,14 +52,15 @@ public: ScreenDepth screenDepth(int index){ return entries[index].depth; } ScreenDepth remoteDepth(int index){ return entries[index].rDepth; } bool fm(int index){ return entries[index].fm; } + bool canRecord(int index){ return entries[index].record; } private: struct Entry { Entry(QString name, QRect size, ScreenDepth depth, QRect rSize, - ScreenDepth rDepth, bool fm) + ScreenDepth rDepth, bool fm, bool record) : name(name), size(size), depth(depth), rSize(rSize), - rDepth(rDepth), fm(fm){ } + rDepth(rDepth), fm(fm), record(record){ } QString name; QRect size; @@ -67,6 +68,7 @@ private: QRect rSize; ScreenDepth rDepth; bool fm; + bool record; }; static const QString reserved; diff --git a/utils/themeeditor/resources/targetdb b/utils/themeeditor/resources/targetdb index 414e8f03f3..fa0b33cacc 100644 --- a/utils/themeeditor/resources/targetdb +++ b/utils/themeeditor/resources/targetdb @@ -4,6 +4,7 @@ ipod12 screen : 160 x 128 @ grey fm : no remote : no + record : yes } ipod3 @@ -12,6 +13,7 @@ ipod3 screen : 160 x 128 @ grey fm : no remote : no + record : yes } ipod4 @@ -20,6 +22,7 @@ ipod4 screen : 160 x 128 @ grey fm : no remote : no + record : yes } ipodmini12 @@ -28,6 +31,7 @@ ipodmini12 screen : 138 x 110 @ grey fm : no remote : no + record : yes } ipodcolor @@ -36,6 +40,7 @@ ipodcolor screen : 220 x 176 @ rgb fm : no remote : no + record : yes } ipodnano1 @@ -44,6 +49,7 @@ ipodnano1 screen : 176 x 132 @ rgb fm : no remote : no + record : yes } ipodvideo @@ -52,6 +58,7 @@ ipodvideo screen : 320 x 240 @ rgb fm : no remote : no + record : yes } # Olympus units @@ -62,6 +69,7 @@ mrobe100 screen : 160 x 128 @ mono fm : no remote : 79 x 16 @ mono + record : yes } mrobe500 @@ -70,4 +78,5 @@ mrobe500 screen : 640 x 480 @ rgb fm : no remote : 79 x 16 @ mono + record : yes } -- cgit v1.2.3