~ubuntu-branches/ubuntu/lucid/ktorrent/lucid

« back to all changes in this revision

Viewing changes to ktorrent/btpref.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Alessandro Ghersi
  • Date: 2009-12-08 19:17:41 UTC
  • mfrom: (1.2.1 upstream) (0.7.12 sid)
  • Revision ID: james.westby@ubuntu.com-20091208191741-lqlq0xvnlv8ki19u
Tags: 3.3.1+dfsg.1-1ubuntu1
* Merge with Debian Testing remaining changes:
  - Build-depend directly on libboost-serialization1.40-dev since
    libboost-serialization-dev from boost-defaults is not in Main
  - Add in rules: include /usr/lib/kubuntu-desktop-i18n/debhelper/kubuntu.mk
  - Don't use dpkg-source 3.0 format
  - Add quilt to build-depends

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/***************************************************************************
 
2
 *   Copyright (C) 2009 by Joris Guisson                                   *
 
3
 *   joris.guisson@gmail.com                                               *
 
4
 *                                                                         *
 
5
 *   This program is free software; you can redistribute it and/or modify  *
 
6
 *   it under the terms of the GNU General Public License as published by  *
 
7
 *   the Free Software Foundation; either version 2 of the License, or     *
 
8
 *   (at your option) any later version.                                   *
 
9
 *                                                                         *
 
10
 *   This program is distributed in the hope that it will be useful,       *
 
11
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 
12
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 
13
 *   GNU General Public License for more details.                          *
 
14
 *                                                                         *
 
15
 *   You should have received a copy of the GNU General Public License     *
 
16
 *   along with this program; if not, write to the                         *
 
17
 *   Free Software Foundation, Inc.,                                       *
 
18
 *   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.          *
 
19
 ***************************************************************************/
 
20
#include <kdeversion.h>
 
21
#include <klocale.h>
 
22
#include "btpref.h"
 
23
#include "settings.h"
 
24
 
 
25
namespace kt
 
26
{
 
27
        BTPref::BTPref(QWidget* parent): PrefPageInterface(Settings::self(),i18n("BitTorrent"),"application-x-bittorrent",parent)
 
28
        {
 
29
                setupUi(this);
 
30
#if KDE_IS_VERSION(4, 2, 80)
 
31
                kcfg_maxCorruptedBeforeRecheck->setSuffix(ki18np(" corrupted chunk", " corrupted chunks"));
 
32
#else
 
33
                kcfg_maxCorruptedBeforeRecheck->setSuffix(i18n(" corrupted chunks"));
 
34
#endif
 
35
                connect(kcfg_doUploadDataCheck,SIGNAL(toggled(bool)),this,SLOT(onUploadDataCheckToggled(bool)));
 
36
        }
 
37
        
 
38
        BTPref::~BTPref() 
 
39
        {
 
40
        }
 
41
 
 
42
        void BTPref::loadSettings()
 
43
        {
 
44
                kcfg_allowUnencryptedConnections->setEnabled(Settings::useEncryption());
 
45
                #ifdef ENABLE_DHT_SUPPORT
 
46
                kcfg_dhtPort->setEnabled(Settings::dhtSupport());
 
47
                #else
 
48
                kcfg_dhtPort->setEnabled(false);
 
49
                kcfg_dhtSupport->setEnabled(false);
 
50
                #endif
 
51
                kcfg_customIP->setEnabled(Settings::useCustomIP());
 
52
                
 
53
                kcfg_maxCorruptedBeforeRecheck->setEnabled(Settings::autoRecheck());
 
54
                kcfg_useMaxSizeForUploadDataCheck->setEnabled(Settings::doUploadDataCheck());
 
55
                kcfg_maxSizeForUploadDataCheck->setEnabled(Settings::doUploadDataCheck() && Settings::useMaxSizeForUploadDataCheck());
 
56
        }
 
57
        void BTPref::onUploadDataCheckToggled(bool on)
 
58
        {
 
59
                kcfg_useMaxSizeForUploadDataCheck->setEnabled(on);
 
60
                kcfg_maxSizeForUploadDataCheck->setEnabled(on&&kcfg_useMaxSizeForUploadDataCheck->isChecked());
 
61
        }
 
62
}