2007-08-05 16:17:35 +00:00
|
|
|
/***************************************************************************
|
|
|
|
* __________ __ ___.
|
|
|
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
|
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
|
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
|
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
|
|
* \/ \/ \/ \/ \/
|
|
|
|
*
|
|
|
|
* Copyright (C) 2007 by Dominik Riebeling
|
2007-08-23 22:11:50 +00:00
|
|
|
* $Id$
|
2007-08-05 16:17:35 +00:00
|
|
|
*
|
|
|
|
* All files in this archive are subject to the GNU General Public License.
|
|
|
|
* See the file COPYING in the source tree root for full license agreement.
|
|
|
|
*
|
|
|
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
|
|
|
* KIND, either express or implied.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#include "installtalkwindow.h"
|
|
|
|
#include "ui_installtalkfrm.h"
|
|
|
|
|
2007-08-07 17:49:35 +00:00
|
|
|
#include "browsedirtree.h"
|
2007-12-14 19:49:11 +00:00
|
|
|
#include "configure.h"
|
2007-08-07 17:49:35 +00:00
|
|
|
|
2007-08-05 16:17:35 +00:00
|
|
|
InstallTalkWindow::InstallTalkWindow(QWidget *parent) : QDialog(parent)
|
|
|
|
{
|
|
|
|
ui.setupUi(this);
|
|
|
|
talkcreator = new TalkFileCreator(this);
|
2007-09-15 22:57:07 +00:00
|
|
|
|
2007-08-05 16:17:35 +00:00
|
|
|
connect(ui.buttonBrowse, SIGNAL(clicked()), this, SLOT(browseFolder()));
|
2007-12-14 19:49:11 +00:00
|
|
|
connect(ui.change,SIGNAL(clicked()),this,SLOT(change()));
|
2007-08-28 23:10:42 +00:00
|
|
|
|
2007-08-05 16:17:35 +00:00
|
|
|
ui.OverwriteWav->setChecked(true);
|
|
|
|
ui.RemoveWav->setChecked(true);
|
|
|
|
ui.recursive->setChecked(true);
|
|
|
|
ui.OverwriteTalk->setChecked(true);
|
|
|
|
ui.StripExtensions->setChecked(true);
|
|
|
|
}
|
|
|
|
|
|
|
|
void InstallTalkWindow::browseFolder()
|
|
|
|
{
|
2007-08-07 17:49:35 +00:00
|
|
|
BrowseDirtree browser(this);
|
|
|
|
browser.setFilter(QDir::AllDirs | QDir::NoDotAndDotDot | QDir::NoSymLinks);
|
2007-09-15 22:57:07 +00:00
|
|
|
|
2007-08-05 16:17:35 +00:00
|
|
|
if(QFileInfo(ui.lineTalkFolder->text()).isDir())
|
2007-08-07 17:49:35 +00:00
|
|
|
{
|
2007-09-14 20:10:54 +00:00
|
|
|
browser.setDir(ui.lineTalkFolder->text());
|
2007-08-07 17:49:35 +00:00
|
|
|
}
|
2007-08-05 16:17:35 +00:00
|
|
|
else
|
2007-08-07 17:49:35 +00:00
|
|
|
{
|
2007-09-14 20:10:54 +00:00
|
|
|
browser.setDir("/media"); // FIXME: This looks Linux specific
|
2007-08-07 17:49:35 +00:00
|
|
|
}
|
|
|
|
if(browser.exec() == QDialog::Accepted)
|
|
|
|
{
|
|
|
|
qDebug() << browser.getSelected();
|
|
|
|
setTalkFolder(browser.getSelected());
|
2007-08-05 16:17:35 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void InstallTalkWindow::setTalkFolder(QString folder)
|
|
|
|
{
|
2007-08-28 23:10:42 +00:00
|
|
|
ui.lineTalkFolder->setText(folder);
|
2007-08-05 16:17:35 +00:00
|
|
|
}
|
|
|
|
|
2007-12-14 19:49:11 +00:00
|
|
|
void InstallTalkWindow::change()
|
|
|
|
{
|
|
|
|
Config *cw = new Config(this,4);
|
|
|
|
cw->setUserSettings(userSettings);
|
|
|
|
cw->setDevices(devices);
|
|
|
|
cw->show();
|
|
|
|
connect(cw, SIGNAL(settingsUpdated()), this, SIGNAL(settingsUpdated()));
|
|
|
|
}
|
2007-08-05 16:17:35 +00:00
|
|
|
|
|
|
|
void InstallTalkWindow::accept()
|
|
|
|
{
|
|
|
|
logger = new ProgressLoggerGui(this);
|
|
|
|
logger->show();
|
2007-08-29 21:46:12 +00:00
|
|
|
connect(logger,SIGNAL(closed()),this,SLOT(close()));
|
2007-09-15 22:57:07 +00:00
|
|
|
|
2007-08-05 16:17:35 +00:00
|
|
|
QString folderToTalk = ui.lineTalkFolder->text();
|
2007-12-15 13:13:57 +00:00
|
|
|
|
2007-08-05 16:17:35 +00:00
|
|
|
if(!QFileInfo(folderToTalk).isDir())
|
|
|
|
{
|
2007-09-23 13:35:45 +00:00
|
|
|
logger->addItem(tr("The Folder to Talk is wrong!"),LOGERROR);
|
|
|
|
logger->abort();
|
|
|
|
return;
|
2007-08-05 16:17:35 +00:00
|
|
|
}
|
2007-09-15 22:57:07 +00:00
|
|
|
|
2007-08-28 23:10:42 +00:00
|
|
|
userSettings->setValue("last_talked_folder", folderToTalk);
|
2007-09-15 22:57:07 +00:00
|
|
|
|
2007-08-05 16:17:35 +00:00
|
|
|
userSettings->sync();
|
2007-08-28 23:10:42 +00:00
|
|
|
|
2007-12-14 19:26:54 +00:00
|
|
|
talkcreator->setUserSettings(userSettings);
|
2007-10-19 21:49:07 +00:00
|
|
|
talkcreator->setDir(QDir(folderToTalk));
|
|
|
|
talkcreator->setMountPoint(userSettings->value("mountpoint").toString());
|
2007-09-23 13:35:45 +00:00
|
|
|
|
2007-08-05 16:17:35 +00:00
|
|
|
talkcreator->setOverwriteTalk(ui.OverwriteTalk->isChecked());
|
|
|
|
talkcreator->setOverwriteWav(ui.OverwriteWav->isChecked());
|
|
|
|
talkcreator->setRemoveWav(ui.RemoveWav->isChecked());
|
|
|
|
talkcreator->setRecursive(ui.recursive->isChecked());
|
|
|
|
talkcreator->setStripExtensions(ui.StripExtensions->isChecked());
|
2007-10-12 15:52:04 +00:00
|
|
|
talkcreator->setTalkFolders(ui.talkFolders->isChecked());
|
|
|
|
talkcreator->setTalkFiles(ui.talkFiles->isChecked());
|
2007-08-05 16:17:35 +00:00
|
|
|
|
|
|
|
talkcreator->createTalkFiles(logger);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void InstallTalkWindow::setDeviceSettings(QSettings *dev)
|
|
|
|
{
|
|
|
|
devices = dev;
|
|
|
|
qDebug() << "Install::setDeviceSettings:" << devices;
|
2007-09-15 22:57:07 +00:00
|
|
|
|
2007-12-15 13:13:57 +00:00
|
|
|
QString ttsName = userSettings->value("tts", "none").toString();
|
|
|
|
TTSBase* tts = getTTS(ttsName);
|
|
|
|
tts->setUserCfg(userSettings);
|
|
|
|
if(tts->configOk())
|
|
|
|
ui.labelTtsProfile->setText(tr("Selected TTS engine : <b>%1</b>").arg(ttsName));
|
|
|
|
else
|
|
|
|
ui.labelTtsProfile->setText(tr("Selected TTS Engine: <b>%1</b>").arg("Invalid TTS configuration!"));
|
2007-12-14 19:26:54 +00:00
|
|
|
|
|
|
|
QString encoder = userSettings->value("encoder", "none").toString();
|
|
|
|
EncBase* enc = getEncoder(encoder);
|
|
|
|
enc->setUserCfg(userSettings);
|
|
|
|
if(enc->configOk())
|
|
|
|
ui.labelEncProfile->setText(tr("Selected Encoder: <b>%1</b>").arg(encoder));
|
|
|
|
else
|
|
|
|
ui.labelEncProfile->setText(tr("Selected Encoder: <b>%1</b>").arg("Invalid encoder configuration!"));
|
2007-08-05 16:17:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void InstallTalkWindow::setUserSettings(QSettings *user)
|
|
|
|
{
|
|
|
|
userSettings = user;
|
2007-09-15 22:57:07 +00:00
|
|
|
|
2007-08-28 23:10:42 +00:00
|
|
|
setTalkFolder(userSettings->value("last_talked_folder").toString());
|
|
|
|
|
2007-08-05 16:17:35 +00:00
|
|
|
}
|