Theme Editor: Made auto-expand/highlight of parse tree optional (through preferences dialog), added Simulation Time variable to device config panel, subline alternation is now dependent on that rather than time in song

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27342 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Robert Bieber 2010-07-07 20:56:16 +00:00
parent 80fa0efd1f
commit de9ba10aab
7 changed files with 66 additions and 16 deletions

View file

@ -506,13 +506,22 @@ void EditorWindow::updateCurrent()
void EditorWindow::lineChanged(int line)
{
QSettings settings;
settings.beginGroup("EditorWindow");
if(settings.value("autoExpandTree", false).toBool())
{
ui->parseTree->collapseAll();
ParseTreeModel* model = dynamic_cast<ParseTreeModel*>
(ui->parseTree->model());
parseTreeSelection = new QItemSelectionModel(model);
expandLine(model, QModelIndex(), line);
expandLine(model, QModelIndex(), line,
settings.value("autoHighlightTree", false).toBool());
sizeColumns();
ui->parseTree->setSelectionModel(parseTreeSelection);
}
settings.endGroup();
}
void EditorWindow::undo()
@ -566,7 +575,7 @@ void EditorWindow::findReplace()
void EditorWindow::expandLine(ParseTreeModel* model, QModelIndex parent,
int line)
int line, bool highlight)
{
for(int i = 0; i < model->rowCount(parent); i++)
{
@ -577,7 +586,7 @@ void EditorWindow::expandLine(ParseTreeModel* model, QModelIndex parent,
QModelIndex data = model->index(i, ParseTreeModel::lineColumn, parent);
QModelIndex recurse = model->index(i, 0, parent);
expandLine(model, recurse, line);
expandLine(model, recurse, line, highlight);
if(model->data(data, Qt::DisplayRole) == line)
{
@ -585,12 +594,18 @@ void EditorWindow::expandLine(ParseTreeModel* model, QModelIndex parent,
ui->parseTree->expand(data);
ui->parseTree->scrollTo(parent, QAbstractItemView::PositionAtTop);
parseTreeSelection->select(data, QItemSelectionModel::Select);
parseTreeSelection->select(dataType, QItemSelectionModel::Select);
parseTreeSelection->select(dataVal, QItemSelectionModel::Select);
if(highlight)
{
parseTreeSelection->select(data,
QItemSelectionModel::Select);
parseTreeSelection->select(dataType,
QItemSelectionModel::Select);
parseTreeSelection->select(dataVal,
QItemSelectionModel::Select);
}
}
}
}
void EditorWindow::sizeColumns()

View file

@ -87,7 +87,8 @@ private:
void setupUI();
void setupMenus();
void addTab(TabContent* doc);
void expandLine(ParseTreeModel* model, QModelIndex parent, int line);
void expandLine(ParseTreeModel* model, QModelIndex parent, int line,
bool highlight);
void sizeColumns();
Ui::EditorWindow *ui;

View file

@ -44,7 +44,7 @@ void PreferencesDialog::loadSettings()
{
loadColors();
loadFont();
loadFontDir();
loadRender();
}
void PreferencesDialog::loadColors()
@ -107,7 +107,7 @@ void PreferencesDialog::loadFont()
}
void PreferencesDialog::loadFontDir()
void PreferencesDialog::loadRender()
{
QSettings settings;
settings.beginGroup("RBFont");
@ -115,13 +115,22 @@ void PreferencesDialog::loadFontDir()
ui->fontBox->setText(settings.value("fontDir", "/").toString());
settings.endGroup();
settings.beginGroup("EditorWindow");
ui->autoExpandBox->setChecked(settings.value("autoExpandTree",
false).toBool());
ui->autoHighlightBox->setChecked(settings.value("autoHighlightTree",
false).toBool());
settings.endGroup();
}
void PreferencesDialog::saveSettings()
{
saveColors();
saveFont();
saveFontDir();
saveRender();
}
void PreferencesDialog::saveColors()
@ -159,7 +168,7 @@ void PreferencesDialog::saveFont()
settings.endGroup();
}
void PreferencesDialog::saveFontDir()
void PreferencesDialog::saveRender()
{
QSettings settings;
settings.beginGroup("RBFont");
@ -167,6 +176,13 @@ void PreferencesDialog::saveFontDir()
settings.setValue("fontDir", ui->fontBox->text());
settings.endGroup();
settings.beginGroup("EditorWindow");
settings.setValue("autoExpandTree", ui->autoExpandBox->isChecked());
settings.setValue("autoHighlightTree", ui->autoHighlightBox->isChecked());
settings.endGroup();
}
void PreferencesDialog::setupUI()

View file

@ -55,11 +55,11 @@ private:
void loadSettings();
void loadColors();
void loadFont();
void loadFontDir();
void loadRender();
void saveSettings();
void saveColors();
void saveFont();
void saveFontDir();
void saveRender();
void setupUI();

View file

@ -23,6 +23,9 @@
<property name="tabPosition">
<enum>QTabWidget::North</enum>
</property>
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="tab_2">
<attribute name="title">
<string>Editor</string>
@ -257,9 +260,23 @@
</widget>
<widget class="QWidget" name="tab">
<attribute name="title">
<string>Fonts</string>
<string>Rendering</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_4">
<item>
<widget class="QCheckBox" name="autoExpandBox">
<property name="text">
<string>Auto-Expand Parse Tree</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="autoHighlightBox">
<property name="text">
<string>Auto-Highlight Parse Tree</string>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_10">
<item>

View file

@ -553,7 +553,7 @@ void ParseTreeNode::render(const RBRenderInfo &info, RBViewport* viewport,
times.append(findBranchTime(children[i], info));
/* Now we figure out which branch to select */
double timeLeft = info.device()->data(QString("?pc")).toDouble();
double timeLeft = info.device()->data(QString("simtime")).toDouble();
int branch = 0;
while(timeLeft > 0)
{

View file

@ -35,6 +35,7 @@ screenwidth ; Screen Width ; spin(0,800) ; 300
screenheight ; Screen Height ; spin(0,800) ; 200
remotewidth ; Remote Width ; spin(0,800) ; 100
remoteheight ; Remote Height ; spin(0,800); 50
simtime ; Simulation Time ; fspin(0, 100000) ; 60.0
showviewports ; Show Viewports ; check ; false
rendersbs ; Render SBS If Available ; check ; true
rtl ; Right-To-Left Language ; check ; false