summaryrefslogtreecommitdiff
path: root/rbutil/rbutilqt/encodersgui.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'rbutil/rbutilqt/encodersgui.cpp')
-rw-r--r--rbutil/rbutilqt/encodersgui.cpp171
1 files changed, 0 insertions, 171 deletions
diff --git a/rbutil/rbutilqt/encodersgui.cpp b/rbutil/rbutilqt/encodersgui.cpp
deleted file mode 100644
index 3d1619f807..0000000000
--- a/rbutil/rbutilqt/encodersgui.cpp
+++ /dev/null
@@ -1,171 +0,0 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 *
9 * Copyright (C) 2007 by Dominik Wenger
10 * $Id$
11 *
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
14 *
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
17 *
18 ****************************************************************************/
19
20#include "encodersgui.h"
21
22#include "rbsettings.h"
23#include "browsedirtree.h"
24
25EncExesGui::EncExesGui(QDialog* parent) : QDialog(parent)
26{
27 ui.setupUi(this);
28 this->hide();
29 connect(ui.reset,SIGNAL(clicked()),this,SLOT(reset()));
30 connect(ui.browse,SIGNAL(clicked()),this,SLOT(browse()));
31}
32
33void EncExesGui::showCfg(QString name)
34{
35 m_name = name;
36 // try to get config from settings
37 QString exepath =settings->subValue(m_name, RbSettings::EncoderPath).toString();
38 ui.encoderoptions->setText(settings->subValue(m_name, RbSettings::EncoderOptions).toString());
39
40 if(exepath == "")
41 {
42
43 // try to autodetect encoder
44#if defined(Q_OS_LINUX) || defined(Q_OS_MACX) || defined(Q_OS_OPENBSD)
45 QStringList path = QString(getenv("PATH")).split(":", QString::SkipEmptyParts);
46#elif defined(Q_OS_WIN)
47 QStringList path = QString(getenv("PATH")).split(";", QString::SkipEmptyParts);
48#endif
49 qDebug() << path;
50
51 for(int i = 0; i < path.size(); i++)
52 {
53 QString executable = QDir::fromNativeSeparators(path.at(i)) + "/" + m_name;
54#if defined(Q_OS_WIN)
55 executable += ".exe";
56 QStringList ex = executable.split("\"", QString::SkipEmptyParts);
57 executable = ex.join("");
58#endif
59 if(QFileInfo(executable).isExecutable())
60 {
61 qDebug() << "found:" << executable;
62 exepath = QDir::toNativeSeparators(executable);
63 break;
64 }
65 }
66 }
67
68 ui.encoderpath->setText(exepath);
69
70 //show dialog
71 this->exec();
72
73}
74
75void EncExesGui::accept(void)
76{
77 //save settings in user config
78 settings->setSubValue(m_name, RbSettings::EncoderPath, ui.encoderpath->text());
79 settings->setSubValue(m_name, RbSettings::EncoderOptions, ui.encoderoptions->text());
80
81 // sync settings
82 settings->sync();
83 this->done(0);
84}
85
86void EncExesGui::reject(void)
87{
88 this->done(0);
89}
90
91void EncExesGui::reset()
92{
93 ui.encoderpath->setText("");
94 ui.encoderoptions->setText("");
95}
96
97void EncExesGui::browse()
98{
99 BrowseDirtree browser(this);
100 browser.setFilter(QDir::Dirs | QDir::Files | QDir::NoDotAndDotDot);
101
102 if(QFileInfo(ui.encoderpath->text()).isDir())
103 {
104 browser.setDir(ui.encoderpath->text());
105 }
106 if(browser.exec() == QDialog::Accepted)
107 {
108 qDebug() << browser.getSelected();
109 QString exe = browser.getSelected();
110 if(!QFileInfo(exe).isExecutable())
111 return;
112 ui.encoderpath->setText(exe);
113 }
114}
115
116
117EncRbSpeexGui::EncRbSpeexGui(QDialog* parent) : QDialog(parent)
118{
119 ui.setupUi(this);
120 this->hide();
121 connect(ui.reset,SIGNAL(clicked()),this,SLOT(reset()));
122
123}
124
125void EncRbSpeexGui::showCfg(float defQ,float defV,int defC, bool defB)
126{
127 defaultQuality =defQ;
128 defaultVolume = defV;
129 defaultComplexity = defC;
130 defaultBand =defB;
131
132 //fill in the usersettings
133 ui.volume->setValue(settings->subValue("rbspeex", RbSettings::EncoderVolume).toDouble());
134 ui.quality->setValue(settings->subValue("rbspeex", RbSettings::EncoderQuality).toDouble());
135 ui.complexity->setValue(settings->subValue("rbspeex", RbSettings::EncoderComplexity).toInt());
136
137 if(settings->subValue("rbspeex", RbSettings::EncoderNarrowBand).toBool())
138 ui.narrowband->setCheckState(Qt::Checked);
139 else
140 ui.narrowband->setCheckState(Qt::Unchecked);
141
142 //show dialog
143 this->exec();
144}
145
146void EncRbSpeexGui::accept(void)
147{
148 //save settings in user config
149 settings->setSubValue("rbspeex", RbSettings::EncoderVolume, ui.volume->value());
150 settings->setSubValue("rbspeex", RbSettings::EncoderQuality, ui.quality->value());
151 settings->setSubValue("rbspeex", RbSettings::EncoderComplexity, ui.complexity->value());
152 settings->setSubValue("rbspeex", RbSettings::EncoderNarrowBand, ui.narrowband->isChecked() ? true : false);
153
154 // sync settings
155 settings->sync();
156 this->done(0);
157}
158
159void EncRbSpeexGui::reject(void)
160{
161 this->done(0);
162}
163
164void EncRbSpeexGui::reset()
165{
166 ui.volume->setValue(defaultVolume);
167 ui.quality->setValue(defaultQuality);
168 ui.complexity->setValue(defaultComplexity);
169 ui.narrowband->setChecked(Qt::Unchecked);
170}
171