diff options
author | Dominik Wenger <domonoky@googlemail.com> | 2008-01-29 21:54:43 +0000 |
---|---|---|
committer | Dominik Wenger <domonoky@googlemail.com> | 2008-01-29 21:54:43 +0000 |
commit | 0c66bdb2b01794448b7676a1b2b5ee5fd8c83371 (patch) | |
tree | 847eba2bd686d6639a002d602a102f36207c554e /rbutil/rbutilqt/encoders.cpp | |
parent | 51f937c2e445eaef345d3a9d15782436bb5e5c27 (diff) | |
download | rockbox-0c66bdb2b01794448b7676a1b2b5ee5fd8c83371.tar.gz rockbox-0c66bdb2b01794448b7676a1b2b5ee5fd8c83371.zip |
rbutil: fix a bug in the new settings object. Seperate the config gui from tts and encoders. (in preparation for cli interface).
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16183 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'rbutil/rbutilqt/encoders.cpp')
-rw-r--r-- | rbutil/rbutilqt/encoders.cpp | 133 |
1 files changed, 11 insertions, 122 deletions
diff --git a/rbutil/rbutilqt/encoders.cpp b/rbutil/rbutilqt/encoders.cpp index 56fcd7c80d..1399ddff75 100644 --- a/rbutil/rbutilqt/encoders.cpp +++ b/rbutil/rbutilqt/encoders.cpp @@ -20,6 +20,9 @@ #include "encoders.h" #include "browsedirtree.h" +#ifndef CONSOLE +#include "encodersgui.h" +#endif static QMap<QString,QString> encoderList; static QMap<QString,EncBase*> encoderCache; @@ -92,11 +95,6 @@ EncExes::EncExes(QString name,QWidget *parent) : EncBase(parent) m_name = name; m_TemplateMap["lame"] = "\"%exe\" %options \"%input\" \"%output\""; - - ui.setupUi(this); - this->hide(); - connect(ui.reset,SIGNAL(clicked()),this,SLOT(reset())); - connect(ui.browse,SIGNAL(clicked()),this,SLOT(browse())); } bool EncExes::start() @@ -131,67 +129,13 @@ bool EncExes::encode(QString input,QString output) return true; } -void EncExes::reset() -{ - ui.encoderpath->setText(""); - ui.encoderoptions->setText(""); -} - -void EncExes::showCfg() -{ - // try to get config from settings - QString exepath =settings->encoderPath(m_name); - ui.encoderoptions->setText(settings->encoderOptions(m_name)); - - if(exepath == "") - { - - // try to autodetect encoder -#if defined(Q_OS_LINUX) || defined(Q_OS_MACX) - QStringList path = QString(getenv("PATH")).split(":", QString::SkipEmptyParts); -#elif defined(Q_OS_WIN) - QStringList path = QString(getenv("PATH")).split(";", QString::SkipEmptyParts); -#endif - qDebug() << path; - - for(int i = 0; i < path.size(); i++) - { - QString executable = QDir::fromNativeSeparators(path.at(i)) + "/" + m_name; -#if defined(Q_OS_WIN) - executable += ".exe"; - QStringList ex = executable.split("\"", QString::SkipEmptyParts); - executable = ex.join(""); -#endif - if(QFileInfo(executable).isExecutable()) - { - qDebug() << "found:" << executable; - exepath = QDir::toNativeSeparators(executable); - break; - } - } - } - - ui.encoderpath->setText(exepath); - - //show dialog - this->exec(); - -} -void EncExes::accept(void) -{ - //save settings in user config - settings->setEncoderPath(m_name,ui.encoderpath->text()); - settings->setEncoderOptions(m_name,ui.encoderoptions->text()); - - // sync settings - settings->sync(); - this->close(); -} -void EncExes::reject(void) +void EncExes::showCfg() { - this->close(); + EncExesGui gui; + gui.setCfg(settings); + gui.showCfg(m_name); } bool EncExes::configOk() @@ -204,34 +148,14 @@ bool EncExes::configOk() return false; } -void EncExes::browse() -{ - BrowseDirtree browser(this); - browser.setFilter(QDir::Dirs | QDir::Files | QDir::NoDotAndDotDot); - if(QFileInfo(ui.encoderpath->text()).isDir()) - { - browser.setDir(ui.encoderpath->text()); - } - if(browser.exec() == QDialog::Accepted) - { - qDebug() << browser.getSelected(); - QString exe = browser.getSelected(); - if(!QFileInfo(exe).isExecutable()) - return; - ui.encoderpath->setText(exe); - } -} /********************************************************************* * RB SPEEX ENCODER **********************************************************************/ EncRbSpeex::EncRbSpeex(QWidget *parent) : EncBase(parent) { - ui.setupUi(this); - this->hide(); - connect(ui.reset,SIGNAL(clicked()),this,SLOT(reset())); - + defaultQuality = 8.f; defaultVolume = 1.f; defaultComplexity = 10; @@ -282,49 +206,14 @@ bool EncRbSpeex::encode(QString input,QString output) return true; } -void EncRbSpeex::reset() -{ - ui.volume->setValue(defaultVolume); - ui.quality->setValue(defaultQuality); - ui.complexity->setValue(defaultComplexity); - ui.narrowband->setChecked(Qt::Unchecked); -} void EncRbSpeex::showCfg() { - //fill in the usersettings - ui.volume->setValue(settings->encoderVolume("rbspeex")); - ui.quality->setValue(settings->encoderQuality("rbspeex")); - ui.complexity->setValue(settings->encoderComplexity("rbspeex")); - - if(settings->encoderNarrowband("rbspeex")) - ui.narrowband->setCheckState(Qt::Checked); - else - ui.narrowband->setCheckState(Qt::Unchecked); - - //show dialog - this->exec(); -} - -void EncRbSpeex::accept(void) -{ - //save settings in user config - settings->setEncoderVolume("rbspeex",ui.volume->value()); - settings->setEncoderQuality("rbspeex",ui.quality->value()); - settings->setEncoderComplexity("rbspeex",ui.complexity->value()); - settings->setEncoderNarrowband("rbspeex",ui.narrowband->isChecked() ? true : false); - - // sync settings - settings->sync(); - this->close(); + EncRbSpeexGui gui; + gui.setCfg(settings); + gui.showCfg(defaultQuality,defaultVolume,defaultComplexity,defaultBand); } -void EncRbSpeex::reject(void) -{ - this->close(); -} - - bool EncRbSpeex::configOk() { bool result=true; |