1
0
Fork 0
forked from len0rd/rockbox

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
This commit is contained in:
Robert Bieber 2010-07-18 00:39:40 +00:00
parent ced4080bc3
commit eb52a45a0c
4 changed files with 43 additions and 3 deletions

View file

@ -728,6 +728,28 @@ void EditorWindow::loadProjectFile(QString fileName)
project = new ProjectModel(fileName, this); project = new ProjectModel(fileName, this);
ui->projectTree->setModel(project); 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") != "") if(project->getSetting("#screenwidth") != "")
deviceConfig->setData("screenwidth", deviceConfig->setData("screenwidth",
project->getSetting("#screenwidth")); project->getSetting("#screenwidth"));

View file

@ -49,6 +49,7 @@ TargetData::TargetData(QString file)
QRect rSize(0, 0, 0, 0); QRect rSize(0, 0, 0, 0);
ScreenDepth rDepth = None; ScreenDepth rDepth = None;
bool fm = false; bool fm = false;
bool record = false;
if(id == "") if(id == "")
break; break;
@ -119,13 +120,19 @@ TargetData::TargetData(QString file)
if(s.toLower() == "yes") if(s.toLower() == "yes")
fm = true; 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 */ /* Checking for the closing '}' and adding the entry */
if(require('}', data, cursor)) 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); indices.insert(id, index);
index++; index++;
} }

View file

@ -52,14 +52,15 @@ public:
ScreenDepth screenDepth(int index){ return entries[index].depth; } ScreenDepth screenDepth(int index){ return entries[index].depth; }
ScreenDepth remoteDepth(int index){ return entries[index].rDepth; } ScreenDepth remoteDepth(int index){ return entries[index].rDepth; }
bool fm(int index){ return entries[index].fm; } bool fm(int index){ return entries[index].fm; }
bool canRecord(int index){ return entries[index].record; }
private: private:
struct Entry struct Entry
{ {
Entry(QString name, QRect size, ScreenDepth depth, QRect rSize, 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), : name(name), size(size), depth(depth), rSize(rSize),
rDepth(rDepth), fm(fm){ } rDepth(rDepth), fm(fm), record(record){ }
QString name; QString name;
QRect size; QRect size;
@ -67,6 +68,7 @@ private:
QRect rSize; QRect rSize;
ScreenDepth rDepth; ScreenDepth rDepth;
bool fm; bool fm;
bool record;
}; };
static const QString reserved; static const QString reserved;

View file

@ -4,6 +4,7 @@ ipod12
screen : 160 x 128 @ grey screen : 160 x 128 @ grey
fm : no fm : no
remote : no remote : no
record : yes
} }
ipod3 ipod3
@ -12,6 +13,7 @@ ipod3
screen : 160 x 128 @ grey screen : 160 x 128 @ grey
fm : no fm : no
remote : no remote : no
record : yes
} }
ipod4 ipod4
@ -20,6 +22,7 @@ ipod4
screen : 160 x 128 @ grey screen : 160 x 128 @ grey
fm : no fm : no
remote : no remote : no
record : yes
} }
ipodmini12 ipodmini12
@ -28,6 +31,7 @@ ipodmini12
screen : 138 x 110 @ grey screen : 138 x 110 @ grey
fm : no fm : no
remote : no remote : no
record : yes
} }
ipodcolor ipodcolor
@ -36,6 +40,7 @@ ipodcolor
screen : 220 x 176 @ rgb screen : 220 x 176 @ rgb
fm : no fm : no
remote : no remote : no
record : yes
} }
ipodnano1 ipodnano1
@ -44,6 +49,7 @@ ipodnano1
screen : 176 x 132 @ rgb screen : 176 x 132 @ rgb
fm : no fm : no
remote : no remote : no
record : yes
} }
ipodvideo ipodvideo
@ -52,6 +58,7 @@ ipodvideo
screen : 320 x 240 @ rgb screen : 320 x 240 @ rgb
fm : no fm : no
remote : no remote : no
record : yes
} }
# Olympus units # Olympus units
@ -62,6 +69,7 @@ mrobe100
screen : 160 x 128 @ mono screen : 160 x 128 @ mono
fm : no fm : no
remote : 79 x 16 @ mono remote : 79 x 16 @ mono
record : yes
} }
mrobe500 mrobe500
@ -70,4 +78,5 @@ mrobe500
screen : 640 x 480 @ rgb screen : 640 x 480 @ rgb
fm : no fm : no
remote : 79 x 16 @ mono remote : 79 x 16 @ mono
record : yes
} }