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:
parent
ced4080bc3
commit
eb52a45a0c
4 changed files with 43 additions and 3 deletions
|
@ -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"));
|
||||
|
|
|
@ -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++;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue