settings_general_widget_general.cpp

Go to the documentation of this file.
00001 /*
00002     Copyright (C) 2008-2010  Lukas Sommer < SommerLuk at gmail dot com >
00003 
00004     This program is free software; you can redistribute it and/or
00005     modify it under the terms of the GNU General Public License as
00006     published by the Free Software Foundation; either version 2 of
00007     the License or (at your option) version 3 or any later version
00008     accepted by the membership of KDE e.V. (or its successor approved
00009     by the membership of KDE e.V.), which shall act as a proxy
00010     defined in Section 14 of version 3 of the license.
00011 
00012     This program is distributed in the hope that it will be useful,
00013     but WITHOUT ANY WARRANTY; without even the implied warranty of
00014     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015     GNU General Public License for more details.
00016 
00017     You should have received a copy of the GNU General Public License
00018     along with this program.  If not, see <http://www.gnu.org/licenses/>.
00019 */
00020 
00021 #include "settings_general_widget_general.h"
00022 #include "version.h"
00023 #include <QDebug>
00024 
00025 settings_general_widget_general::settings_general_widget_general(QWidget *parent)
00026   : QWidget(parent)
00027 {
00028   setupUi(this);
00029   connect(kcfg_streamripperCommand,
00030           SIGNAL(textChanged(const QString&)),
00031           &versionInfo,
00032           SLOT(setStreamripperCommand(const QString&)));
00033   connect(kcfg_streamripperCommand,
00034           SIGNAL(textChanged(const QString&)),
00035           info_usedStreamripperVersion,
00036           SLOT(clear()));
00037   connect(&versionInfo,
00038           SIGNAL(versionNumberDeterminated(const PropertyValue&)),
00039           this,
00040           SLOT(displayVersionNumber(const PropertyValue&)));
00041 #ifdef LIBPROXY_FOUND
00042   connect(kcfg_proxyConfiguration,
00043           SIGNAL(valueChanged(const int)),
00044           this,
00045           SLOT(initializeRadioButtons(const int)));
00046   connect(radioButton_automatic,
00047           SIGNAL(toggled(const bool)),
00048           this,
00049           SLOT(writeProxyConfig_automatic(const bool)));
00050 #else
00051   radioButton_manual->setChecked(true);
00052   radioButton_automatic->setEnabled(false);
00053 #endif
00054 }
00055 
00056 #ifdef LIBPROXY_FOUND
00057 void settings_general_widget_general::initializeRadioButtons(const int index)
00058 {
00059   qDebug() << "test";
00060   disconnect(kcfg_proxyConfiguration,
00061              SIGNAL(valueChanged(const int)),
00062              this,
00063              SLOT(initializeRadioButtons(const int)));
00064   if (index == 0) {
00065     radioButton_automatic->setChecked(true);
00066   } else {
00067     radioButton_manual->setChecked(true);
00068   };
00069 }
00070 #endif
00071 
00072 settings_general_widget_general::~settings_general_widget_general()
00073 {
00074 }
00075 
00076 void settings_general_widget_general::writeProxyConfig_automatic(const bool enabled)
00077 {
00078   if (enabled) { // configuration: automatic
00079     kcfg_proxyConfiguration->setValue(0);
00080   } else { // configuration: manual
00081     kcfg_proxyConfiguration->setValue(1);
00082   };
00083 }
00084 
00085 void settings_general_widget_general::displayVersionNumber(const PropertyValue & value)
00086 {
00087   if (value.type == PropertyValue::value) {
00088     info_usedStreamripperVersion->setText(value.formatedValue);
00089   } else {
00090     info_usedStreamripperVersion->setText("");
00091   };
00092 }

doxygen