summaryrefslogtreecommitdiffstats
path: root/utils
diff options
context:
space:
mode:
authorRobert Bieber <robby@bieberphoto.com>2010-06-29 06:14:36 +0000
committerRobert Bieber <robby@bieberphoto.com>2010-06-29 06:14:36 +0000
commit449a895372354f8c9abeec28a147f6b88d53a269 (patch)
treea158ecad4d7aefe397601e6c3b10f9330c04da7d /utils
parentaa13a5377ce4b982110fc44f2f9a6636d81e8d8d (diff)
downloadrockbox-449a895372354f8c9abeec28a147f6b88d53a269.tar.gz
rockbox-449a895372354f8c9abeec28a147f6b88d53a269.zip
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
Diffstat (limited to 'utils')
-rw-r--r--utils/themeeditor/gui/devicestate.cpp3
-rw-r--r--utils/themeeditor/gui/devicestate.h5
-rw-r--r--utils/themeeditor/gui/editorwindow.cpp15
-rw-r--r--utils/themeeditor/gui/skindocument.cpp4
-rw-r--r--utils/themeeditor/gui/skindocument.h1
-rw-r--r--utils/themeeditor/main.cpp8
-rw-r--r--utils/themeeditor/models/parsetreenode.cpp9
-rw-r--r--utils/themeeditor/resources/deviceoptions15
8 files changed, 32 insertions, 28 deletions
diff --git a/utils/themeeditor/gui/devicestate.cpp b/utils/themeeditor/gui/devicestate.cpp
index 80efd4d4d1..f4907e1935 100644
--- a/utils/themeeditor/gui/devicestate.cpp
+++ b/utils/themeeditor/gui/devicestate.cpp
@@ -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 =
inputs.value(tag, QPair<InputType, QWidget*>(Slide, 0));
diff --git a/utils/themeeditor/gui/devicestate.h b/utils/themeeditor/gui/devicestate.h
index cae3cef7e1..d3a6c4650f 100644
--- a/utils/themeeditor/gui/devicestate.h
+++ b/utils/themeeditor/gui/devicestate.h
@@ -28,6 +28,8 @@
#include <QVariant>
#include <QTabWidget>
+#include "skin_parser.h"
+
class DeviceState : public QWidget {
Q_OBJECT
@@ -46,7 +48,8 @@ public:
DeviceState(QWidget *parent = 0);
virtual ~DeviceState();
- QVariant data(QString tag);
+ QVariant data(QString tag, int paramCount = 0,
+ skin_tag_parameter* params = 0);
void setData(QString tag, QVariant data);
signals:
diff --git a/utils/themeeditor/gui/editorwindow.cpp b/utils/themeeditor/gui/editorwindow.cpp
index ea6c91f074..96f855242d 100644
--- a/utils/themeeditor/gui/editorwindow.cpp
+++ b/utils/themeeditor/gui/editorwindow.cpp
@@ -499,14 +499,13 @@ void EditorWindow::updateCurrent()
void EditorWindow::lineChanged(int line)
{
- ui->parseTree->collapseAll();
- ParseTreeModel* model = dynamic_cast<ParseTreeModel*>
- (ui->parseTree->model());
- parseTreeSelection = new QItemSelectionModel(model);
- expandLine(model, QModelIndex(), line);
- sizeColumns();
- ui->parseTree->setSelectionModel(parseTreeSelection);
-
+ ui->parseTree->collapseAll();
+ ParseTreeModel* model = dynamic_cast<ParseTreeModel*>
+ (ui->parseTree->model());
+ parseTreeSelection = new QItemSelectionModel(model);
+ expandLine(model, QModelIndex(), line);
+ sizeColumns();
+ ui->parseTree->setSelectionModel(parseTreeSelection);
}
void EditorWindow::undo()
diff --git a/utils/themeeditor/gui/skindocument.cpp b/utils/themeeditor/gui/skindocument.cpp
index f8206e1a26..28e5297b48 100644
--- a/utils/themeeditor/gui/skindocument.cpp
+++ b/utils/themeeditor/gui/skindocument.cpp
@@ -41,6 +41,7 @@ SkinDocument::SkinDocument(QLabel* statusLabel, ProjectModel* project,
saved = "";
parseStatus = tr("Empty document");
blockUpdate = false;
+ currentLine = -1;
}
SkinDocument::SkinDocument(QLabel* statusLabel, QString file,
@@ -208,8 +209,9 @@ void SkinDocument::cursorChanged()
parseStatus = tr("Errors in document");
statusLabel->setText(parseStatus);
}
- else
+ else if(editor->textCursor().blockNumber() != currentLine)
{
+ currentLine = editor->textCursor().blockNumber();
emit lineChanged(editor->textCursor().blockNumber() + 1);
}
diff --git a/utils/themeeditor/gui/skindocument.h b/utils/themeeditor/gui/skindocument.h
index 1713023779..7563b3cb53 100644
--- a/utils/themeeditor/gui/skindocument.h
+++ b/utils/themeeditor/gui/skindocument.h
@@ -97,6 +97,7 @@ private:
QString fileName;
QString saved;
QString parseStatus;
+ int currentLine;
QLayout* layout;
CodeEditor* editor;
diff --git a/utils/themeeditor/main.cpp b/utils/themeeditor/main.cpp
index 78df1878f6..5dc52a0b88 100644
--- a/utils/themeeditor/main.cpp
+++ b/utils/themeeditor/main.cpp
@@ -19,18 +19,10 @@
*
****************************************************************************/
-#include "skin_parser.h"
-#include "skin_debug.h"
#include "editorwindow.h"
-#include <cstdlib>
-#include <cstdio>
-#include <iostream>
-
#include <QtGui/QApplication>
-#include "parsetreemodel.h"
-
int main(int argc, char* argv[])
{
QApplication app(argc, argv);
diff --git a/utils/themeeditor/models/parsetreenode.cpp b/utils/themeeditor/models/parsetreenode.cpp
index 45cd62f8a6..bdc0c309b8 100644
--- a/utils/themeeditor/models/parsetreenode.cpp
+++ b/utils/themeeditor/models/parsetreenode.cpp
@@ -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)
{
if(element->type == LINE)
@@ -524,10 +524,13 @@ void ParseTreeNode::render(const RBRenderInfo &info, RBViewport* viewport)
}
else if(element->type == TAG)
{
-
if(!execTag(info, viewport))
viewport->write(evalTag(info).toString());
-
+ }
+ else if(element->type == CONDITIONAL)
+ {
+ int child = evalTag(info, true, element->children_count).toInt();
+ //children[0]->render(info, viewport);
}
}
diff --git a/utils/themeeditor/resources/deviceoptions b/utils/themeeditor/resources/deviceoptions
index 855c8baaeb..b9081c6253 100644
--- a/utils/themeeditor/resources/deviceoptions
+++ b/utils/themeeditor/resources/deviceoptions
@@ -23,6 +23,9 @@
#
# 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
# performing much of any error checking on it: screwing up the syntax may very
# well segfault the application on startup
@@ -100,14 +103,14 @@ pr ; Time Remaining ; text ; 2:00
ps ; Shuffle ; check ; true
pt ; Total Track Time ; text ; 3:00
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
pE ; Track Ending ; check ; false
Sp ; Playback Pitch ; fspin(50,200) ; 100
rp ; Song Playcount ; spin(0,10000) ; 20
rr ; Song Rating ; spin(0,10) ; 5
ra ; Autoscore ; spin(0,10) ; 7
-$C ; Album Art Available ; check ; true
+?C ; Album Art Available ; check ; true
[Hardware Status]
bl ; Battery Level (-1 for unknown) ; spin(-1,100) ; 50
@@ -122,7 +125,7 @@ lh ; Hard Disk Activity ; check ; true
[Playback Status]
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
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
@@ -137,7 +140,7 @@ ck ; 24h Hour (No Padding) ; text ; 9
cI ; 12h Hour ; text ; 09
cl ; 12h Hour (No Padding) ; text ; 9
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
cS ; Second (Padded) ; text ; 50
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
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 (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 (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]
Rp ; Target Has Recorder ; check ; false