1
0
Fork 0
forked from len0rd/rockbox

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()