From 4a4699692270906976a9bc99d4c11f625fd756c6 Mon Sep 17 00:00:00 2001 From: Robert Bieber Date: Sat, 17 Jul 2010 00:35:54 +0000 Subject: Theme Editor: Integrated target db with project creation code. Now changing the target option in the New Project dialog will change the available options for wps documents, and the target id is stored in the new config file git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27451 a1c6a512-1295-4272-9138-f99709370657 --- utils/themeeditor/gui/editorwindow.cpp | 1 + utils/themeeditor/gui/newprojectdialog.cpp | 43 +++++++++++++++++++++++++++++- utils/themeeditor/gui/newprojectdialog.h | 1 + utils/themeeditor/models/targetdata.h | 5 ++++ 4 files changed, 49 insertions(+), 1 deletion(-) diff --git a/utils/themeeditor/gui/editorwindow.cpp b/utils/themeeditor/gui/editorwindow.cpp index 043c08badd..b5eea633f9 100644 --- a/utils/themeeditor/gui/editorwindow.cpp +++ b/utils/themeeditor/gui/editorwindow.cpp @@ -332,6 +332,7 @@ void EditorWindow::newProject() /* Generating the config file */ QString config = tr("# Config file for ") + info.name + "\n"; + config.append("#target: " + info.target + "\n\n"); QString wpsBase = "/.rockbox/wps/"; if(info.sbs) config.append("sbs: " + wpsBase + info.name + ".sbs\n"); diff --git a/utils/themeeditor/gui/newprojectdialog.cpp b/utils/themeeditor/gui/newprojectdialog.cpp index 0df3250c5b..2e9cbd609c 100644 --- a/utils/themeeditor/gui/newprojectdialog.cpp +++ b/utils/themeeditor/gui/newprojectdialog.cpp @@ -49,10 +49,13 @@ NewProjectDialog::NewProjectDialog(QWidget *parent) : { ui->targetBox->insertItem(i, QIcon(), targets.name(i), targets.id(i)); } + targetChange(0); - /* Connecting the browse button */ + /* Connecting the browse button and target box */ QObject::connect(ui->browseButton, SIGNAL(clicked()), this, SLOT(browse())); + QObject::connect(ui->targetBox, SIGNAL(currentIndexChanged(int)), + this, SLOT(targetChange(int))); } NewProjectDialog::~NewProjectDialog() @@ -114,3 +117,41 @@ void NewProjectDialog::browse() ui->locationBox->text()); ui->locationBox->setText(path); } + +void NewProjectDialog::targetChange(int target) +{ + TargetData targets; + + if(targets.fm(target)) + { + ui->fmsBox->setEnabled(true); + ui->rfmsBox->setEnabled(true); + } + else + { + ui->fmsBox->setChecked(false); + ui->rfmsBox->setChecked(false); + + ui->fmsBox->setEnabled(false); + ui->rfmsBox->setEnabled(false); + } + + if(targets.remoteDepth(target) == TargetData::None) + { + ui->rwpsBox->setChecked(false); + ui->rsbsBox->setChecked(false); + ui->rfmsBox->setChecked(false); + + ui->rsbsBox->setEnabled(false); + ui->rwpsBox->setEnabled(false); + ui->rfmsBox->setEnabled(false); + } + else + { + ui->rsbsBox->setEnabled(true); + ui->rwpsBox->setEnabled(true); + if(targets.fm(target)) + ui->rfmsBox->setEnabled(true); + } + +} diff --git a/utils/themeeditor/gui/newprojectdialog.h b/utils/themeeditor/gui/newprojectdialog.h index 6a54a133bc..7d1a710a1d 100644 --- a/utils/themeeditor/gui/newprojectdialog.h +++ b/utils/themeeditor/gui/newprojectdialog.h @@ -88,6 +88,7 @@ public slots: private slots: void browse(); + void targetChange(int target); private: Ui::NewProjectDialog *ui; diff --git a/utils/themeeditor/models/targetdata.h b/utils/themeeditor/models/targetdata.h index 6178509514..ef7ac5c8a9 100644 --- a/utils/themeeditor/models/targetdata.h +++ b/utils/themeeditor/models/targetdata.h @@ -47,6 +47,11 @@ public: QString id(int index){ return indices.key(index, ""); } QString name(int index){ return entries[index].name; } + QRect screenSize(int index){ return entries[index].size; } + QRect remoteSize(int index){ return entries[index].rSize; } + ScreenDepth screenDepth(int index){ return entries[index].depth; } + ScreenDepth remoteDepth(int index){ return entries[index].rDepth; } + bool fm(int index){ return entries[index].fm; } private: struct Entry -- cgit v1.2.3