From b39c20e55734884b062ac76b8f3169c5da5d512a Mon Sep 17 00:00:00 2001 From: Dominik Riebeling Date: Sun, 6 Jul 2008 19:57:22 +0000 Subject: Make encoder selection update on device change. This includes a workaround as the settings object currently doesn't allow getting the encoder for any other than the selected device. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17968 a1c6a512-1295-4272-9138-f99709370657 --- rbutil/rbutilqt/configure.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'rbutil/rbutilqt/configure.cpp') diff --git a/rbutil/rbutilqt/configure.cpp b/rbutil/rbutilqt/configure.cpp index a34f3b985f..0aedf32998 100644 --- a/rbutil/rbutilqt/configure.cpp +++ b/rbutil/rbutilqt/configure.cpp @@ -80,6 +80,7 @@ Config::Config(QWidget *parent,int index) : QDialog(parent) connect(ui.configTts, SIGNAL(clicked()), this, SLOT(configTts())); connect(ui.configEncoder, SIGNAL(clicked()), this, SLOT(configEnc())); connect(ui.comboTts, SIGNAL(currentIndexChanged(int)), this, SLOT(updateTtsState(int))); + connect(ui.treeDevices, SIGNAL(itemSelectionChanged()), this, SLOT(updateEncState())); } @@ -319,8 +320,19 @@ void Config::updateTtsState(int index) void Config::updateEncState() { - ui.encoderName->setText(EncBase::getEncoderName(settings->curEncoder())); + // FIXME: this is a workaround to make the encoder follow the device selection + // even with the settings (and thus the device) being saved. Needs to be redone + // properly later by extending the settings object + if(ui.treeDevices->selectedItems().size() == 0) + return; + + QString devname = ui.treeDevices->selectedItems().at(0)->data(0, Qt::UserRole).toString(); + QString olddevice = settings->curPlatform(); + settings->setCurPlatform(devname); QString encoder = settings->curEncoder(); + ui.encoderName->setText(EncBase::getEncoderName(settings->curEncoder())); + settings->setCurPlatform(olddevice); + EncBase* enc = EncBase::getEncoder(encoder); enc->setCfg(settings); -- cgit v1.2.3