1
0
Fork 0
forked from len0rd/rockbox

Theme Editor: Beginning to work on conditional rendering, just made fix to line following code to speed up horizontal scrolling

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27168 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Robert Bieber 2010-06-29 06:14:36 +00:00
parent aa13a5377c
commit 449a895372
8 changed files with 32 additions and 28 deletions

View file

@ -202,7 +202,8 @@ DeviceState::~DeviceState()
{ {
} }
QVariant DeviceState::data(QString tag) QVariant DeviceState::data(QString tag, int paramCount,
skin_tag_parameter *params)
{ {
QPair<InputType, QWidget*> found = QPair<InputType, QWidget*> found =
inputs.value(tag, QPair<InputType, QWidget*>(Slide, 0)); inputs.value(tag, QPair<InputType, QWidget*>(Slide, 0));

View file

@ -28,6 +28,8 @@
#include <QVariant> #include <QVariant>
#include <QTabWidget> #include <QTabWidget>
#include "skin_parser.h"
class DeviceState : public QWidget { class DeviceState : public QWidget {
Q_OBJECT Q_OBJECT
@ -46,7 +48,8 @@ public:
DeviceState(QWidget *parent = 0); DeviceState(QWidget *parent = 0);
virtual ~DeviceState(); virtual ~DeviceState();
QVariant data(QString tag); QVariant data(QString tag, int paramCount = 0,
skin_tag_parameter* params = 0);
void setData(QString tag, QVariant data); void setData(QString tag, QVariant data);
signals: signals:

View file

@ -499,14 +499,13 @@ void EditorWindow::updateCurrent()
void EditorWindow::lineChanged(int line) void EditorWindow::lineChanged(int line)
{ {
ui->parseTree->collapseAll(); ui->parseTree->collapseAll();
ParseTreeModel* model = dynamic_cast<ParseTreeModel*> ParseTreeModel* model = dynamic_cast<ParseTreeModel*>
(ui->parseTree->model()); (ui->parseTree->model());
parseTreeSelection = new QItemSelectionModel(model); parseTreeSelection = new QItemSelectionModel(model);
expandLine(model, QModelIndex(), line); expandLine(model, QModelIndex(), line);
sizeColumns(); sizeColumns();
ui->parseTree->setSelectionModel(parseTreeSelection); ui->parseTree->setSelectionModel(parseTreeSelection);
} }
void EditorWindow::undo() void EditorWindow::undo()

View file

@ -41,6 +41,7 @@ SkinDocument::SkinDocument(QLabel* statusLabel, ProjectModel* project,
saved = ""; saved = "";
parseStatus = tr("Empty document"); parseStatus = tr("Empty document");
blockUpdate = false; blockUpdate = false;
currentLine = -1;
} }
SkinDocument::SkinDocument(QLabel* statusLabel, QString file, SkinDocument::SkinDocument(QLabel* statusLabel, QString file,
@ -208,8 +209,9 @@ void SkinDocument::cursorChanged()
parseStatus = tr("Errors in document"); parseStatus = tr("Errors in document");
statusLabel->setText(parseStatus); statusLabel->setText(parseStatus);
} }
else else if(editor->textCursor().blockNumber() != currentLine)
{ {
currentLine = editor->textCursor().blockNumber();
emit lineChanged(editor->textCursor().blockNumber() + 1); emit lineChanged(editor->textCursor().blockNumber() + 1);
} }

View file

@ -97,6 +97,7 @@ private:
QString fileName; QString fileName;
QString saved; QString saved;
QString parseStatus; QString parseStatus;
int currentLine;
QLayout* layout; QLayout* layout;
CodeEditor* editor; CodeEditor* editor;

View file

@ -19,18 +19,10 @@
* *
****************************************************************************/ ****************************************************************************/
#include "skin_parser.h"
#include "skin_debug.h"
#include "editorwindow.h" #include "editorwindow.h"
#include <cstdlib>
#include <cstdio>
#include <iostream>
#include <QtGui/QApplication> #include <QtGui/QApplication>
#include "parsetreemodel.h"
int main(int argc, char* argv[]) int main(int argc, char* argv[])
{ {
QApplication app(argc, argv); QApplication app(argc, argv);

View file

@ -509,7 +509,7 @@ void ParseTreeNode::render(const RBRenderInfo& info)
} }
/* This version is called for logical lines and such */ /* This version is called for logical lines, tags, conditionals and such */
void ParseTreeNode::render(const RBRenderInfo &info, RBViewport* viewport) void ParseTreeNode::render(const RBRenderInfo &info, RBViewport* viewport)
{ {
if(element->type == LINE) if(element->type == LINE)
@ -524,10 +524,13 @@ void ParseTreeNode::render(const RBRenderInfo &info, RBViewport* viewport)
} }
else if(element->type == TAG) else if(element->type == TAG)
{ {
if(!execTag(info, viewport)) if(!execTag(info, viewport))
viewport->write(evalTag(info).toString()); viewport->write(evalTag(info).toString());
}
else if(element->type == CONDITIONAL)
{
int child = evalTag(info, true, element->children_count).toInt();
//children[0]->render(info, viewport);
} }
} }

View file

@ -23,6 +23,9 @@
# #
# Blank lines are ignored # Blank lines are ignored
# #
# A ? at the beginning of a field indicates that it's a special value for
# conditionals
#
# Be warned: because this file is compiled into the application, I'm not # Be warned: because this file is compiled into the application, I'm not
# performing much of any error checking on it: screwing up the syntax may very # performing much of any error checking on it: screwing up the syntax may very
# well segfault the application on startup # well segfault the application on startup
@ -100,14 +103,14 @@ pr ; Time Remaining ; text ; 2:00
ps ; Shuffle ; check ; true ps ; Shuffle ; check ; true
pt ; Total Track Time ; text ; 3:00 pt ; Total Track Time ; text ; 3:00
pv ; Current Volume (dB) ; spin(-100,100) ; 0 pv ; Current Volume (dB) ; spin(-100,100) ; 0
$pv ; Current Volume (Conditional) ; combo(Mute, Below 0 dB, 0 dB, Above 0 dB) ; 0 dB ?pv ; Current Volume (Conditional) ; combo(Mute, Below 0 dB, 0 dB, Above 0 dB) ; 0 dB
pS ; Track Starting ; check ; true pS ; Track Starting ; check ; true
pE ; Track Ending ; check ; false pE ; Track Ending ; check ; false
Sp ; Playback Pitch ; fspin(50,200) ; 100 Sp ; Playback Pitch ; fspin(50,200) ; 100
rp ; Song Playcount ; spin(0,10000) ; 20 rp ; Song Playcount ; spin(0,10000) ; 20
rr ; Song Rating ; spin(0,10) ; 5 rr ; Song Rating ; spin(0,10) ; 5
ra ; Autoscore ; spin(0,10) ; 7 ra ; Autoscore ; spin(0,10) ; 7
$C ; Album Art Available ; check ; true ?C ; Album Art Available ; check ; true
[Hardware Status] [Hardware Status]
bl ; Battery Level (-1 for unknown) ; spin(-1,100) ; 50 bl ; Battery Level (-1 for unknown) ; spin(-1,100) ; 50
@ -122,7 +125,7 @@ lh ; Hard Disk Activity ; check ; true
[Playback Status] [Playback Status]
rg ; Replaygain Value (dB) ; fspin(-100,20) ; 0 rg ; Replaygain Value (dB) ; fspin(-100,20) ; 0
$rg ; Replaygain Status (Conditional) ; combo(Off, Track, Album, TrackShuffle, AlbumShuffle, No Tag) ; Off ?rg ; Replaygain Status (Conditional) ; combo(Off, Track, Album, TrackShuffle, AlbumShuffle, No Tag) ; Off
mm ; Repeat Mode ; combo(Off, All, One, Shuffle, A-B) ; All mm ; Repeat Mode ; combo(Off, All, One, Shuffle, A-B) ; All
mp ; Playback Mode ; combo(Stop, Play, Pause, Fast Forward, Rewind, Recording, Recording Paused, FM Radio Playing, FM Radio Muted) ; Play mp ; Playback Mode ; combo(Stop, Play, Pause, Fast Forward, Rewind, Recording, Recording Paused, FM Radio Playing, FM Radio Muted) ; Play
xf ; Crossfade Type ; combo(Off, Automatic Track Skip Only, Shuffle, Shuffle or Manual Track Skip, Always) ; Always xf ; Crossfade Type ; combo(Off, Automatic Track Skip Only, Shuffle, Shuffle or Manual Track Skip, Always) ; Always
@ -137,7 +140,7 @@ ck ; 24h Hour (No Padding) ; text ; 9
cI ; 12h Hour ; text ; 09 cI ; 12h Hour ; text ; 09
cl ; 12h Hour (No Padding) ; text ; 9 cl ; 12h Hour (No Padding) ; text ; 9
cm ; Month (Padded) ; text ; 03 cm ; Month (Padded) ; text ; 03
$cm ; Month (Conditional) ; combo(January, February, March, April, May, Jun, July, August, September, October, November, December) ; January ?cm ; Month (Conditional) ; combo(January, February, March, April, May, Jun, July, August, September, October, November, December) ; January
cM ; Minute (Padded) ; text ; 29 cM ; Minute (Padded) ; text ; 29
cS ; Second (Padded) ; text ; 50 cS ; Second (Padded) ; text ; 50
cy ; Last Two Digits of Year (Padded) ; text ; 09 cy ; Last Two Digits of Year (Padded) ; text ; 09
@ -147,9 +150,9 @@ cp ; Lowercase AM or PM ; combo(am,pm) ; am
ca ; Abbreviated Weekday Name ; combo(Sun, Mon, Tue, Thu, Fri, Sat); Tue ca ; Abbreviated Weekday Name ; combo(Sun, Mon, Tue, Thu, Fri, Sat); Tue
cb ; Abbreviated Month Name ; combo(Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec) ; Jan cb ; Abbreviated Month Name ; combo(Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec) ; Jan
cu ; Day of Week (1..7, 1 is Monday) ; spin(1,7) ; 2 cu ; Day of Week (1..7, 1 is Monday) ; spin(1,7) ; 2
$cu ; Day of Week (Monday First, Conditional) ; combo(Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday) ; Tuesday ?cu ; Day of Week (Monday First, Conditional) ; combo(Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday) ; Tuesday
cw ; Day of Week (0..6, 0 is Sunday) ; spin(0,6) ; 2 cw ; Day of Week (0..6, 0 is Sunday) ; spin(0,6) ; 2
$cw ; Day of Week (Sunday First, Conditional) ; combo(Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday) ; Tuesday ?cw ; Day of Week (Sunday First, Conditional) ; combo(Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday) ; Tuesday
[Recording Status] [Recording Status]
Rp ; Target Has Recorder ; check ; false Rp ; Target Has Recorder ; check ; false