• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdenetwork API Reference
  • KDE Home
  • Contact Us
 

kget

  • sources
  • kde-4.14
  • kdenetwork
  • kget
  • transfer-plugins
  • bittorrent
btsettingswidget.cpp
Go to the documentation of this file.
1 /* This file is part of the KDE project
2 
3  Copyright (C) 2007 Lukas Appelhans <l.appelhans@gmx.de>
4 
5  This program is free software; you can redistribute it and/or
6  modify it under the terms of the GNU General Public
7  License as published by the Free Software Foundation; either
8  version 2 of the License, or (at your option) any later version.
9 */
10 #include "btsettingswidget.h"
11 
12 #include "kget_export.h"
13 #include "bittorrentsettings.h"
14 
15 #include <kdebug.h>
16 #include <kfiledialog.h>
17 
18 KGET_EXPORT_PLUGIN_CONFIG(BTSettingsWidget)
19 
20 BTSettingsWidget::BTSettingsWidget(QWidget * parent, const QVariantList &args)
21  : KCModule(KGetFactory::componentData(), parent, args)
22 {
23  setupUi(this);
24 
25  connect(portBox, SIGNAL(valueChanged(int)), SLOT(changed()));
26  connect(uploadBox, SIGNAL(valueChanged(int)), SLOT(changed()));
27  connect(downloadBox, SIGNAL(valueChanged(int)), SLOT(changed()));
28  connect(torrentEdit, SIGNAL(textChanged(QString)), SLOT(changed()));
29  connect(tempEdit, SIGNAL(textChanged(QString)), SLOT(changed()));
30  connect(preallocBox, SIGNAL(stateChanged(int)), SLOT(changed()));
31  connect(utpBox, SIGNAL(stateChanged(int)), SLOT(changed()));
32 }
33 
34 void BTSettingsWidget::load()
35 {
36  torrentEdit->setMode(KFile::Directory);
37  torrentEdit->fileDialog()->setCaption(i18n("Select a default torrent folder"));
38  tempEdit->setMode(KFile::Directory);
39  tempEdit->fileDialog()->setCaption(i18n("Select a default temporary folder"));
40  defaults();
41 }
42 
43 void BTSettingsWidget::save()
44 {
45  kDebug(5001) << "Save Bittorrent-config";
46  BittorrentSettings::setPort(portBox->value());
47  BittorrentSettings::setUploadLimit(uploadBox->value());
48  BittorrentSettings::setDownloadLimit(downloadBox->value());
49  BittorrentSettings::setTorrentDir(torrentEdit->url().url());
50  BittorrentSettings::setTmpDir(tempEdit->url().url());
51  BittorrentSettings::setPreAlloc(preallocBox->isChecked());
52  BittorrentSettings::setEnableUTP(utpBox->isChecked());
53 
54  BittorrentSettings::self()->writeConfig();
55 }
56 
57 void BTSettingsWidget::defaults()
58 {
59  portBox->setValue(BittorrentSettings::port());
60  uploadBox->setValue(BittorrentSettings::uploadLimit());
61  downloadBox->setValue(BittorrentSettings::downloadLimit());
62  torrentEdit->setUrl(BittorrentSettings::torrentDir());
63  tempEdit->setUrl(BittorrentSettings::tmpDir());
64  preallocBox->setChecked(BittorrentSettings::preAlloc());
65  utpBox->setChecked(BittorrentSettings::enableUTP());
66 }
67 
68 #include "btsettingswidget.moc"
69 
QWidget
BittorrentSettings::setTmpDir
static void setTmpDir(const QString &v)
Set TmpDir.
Definition: bittorrentsettings.h:115
BTSettingsWidget::load
virtual void load()
Definition: btsettingswidget.cpp:34
BittorrentSettings::setPreAlloc
static void setPreAlloc(bool v)
Set PreAlloc.
Definition: bittorrentsettings.h:134
BittorrentSettings::uploadLimit
static int uploadLimit()
Get UploadLimit.
Definition: bittorrentsettings.h:30
BTSettingsWidget::save
virtual void save()
Definition: btsettingswidget.cpp:43
btsettingswidget.h
BittorrentSettings::port
static int port()
Get Port.
Definition: bittorrentsettings.h:68
BTSettingsWidget
Definition: btsettingswidget.h:18
BittorrentSettings::torrentDir
static QString torrentDir()
Get TorrentDir.
Definition: bittorrentsettings.h:106
BittorrentSettings::downloadLimit
static int downloadLimit()
Get DownloadLimit.
Definition: bittorrentsettings.h:49
BittorrentSettings::setDownloadLimit
static void setDownloadLimit(int v)
Set DownloadLimit.
Definition: bittorrentsettings.h:39
bittorrentsettings.h
kget_export.h
BittorrentSettings::setUploadLimit
static void setUploadLimit(int v)
Set UploadLimit.
Definition: bittorrentsettings.h:20
BittorrentSettings::self
static BittorrentSettings * self()
Definition: bittorrentsettings.cpp:17
QString
BittorrentSettings::tmpDir
static QString tmpDir()
Get TmpDir.
Definition: bittorrentsettings.h:125
BittorrentSettings::setPort
static void setPort(int v)
Set Port.
Definition: bittorrentsettings.h:58
BTSettingsWidget::defaults
virtual void defaults()
Definition: btsettingswidget.cpp:57
BittorrentSettings::enableUTP
static bool enableUTP()
Get EnableUTP.
Definition: bittorrentsettings.h:87
BittorrentSettings::setEnableUTP
static void setEnableUTP(bool v)
Set EnableUTP.
Definition: bittorrentsettings.h:77
BittorrentSettings::preAlloc
static bool preAlloc()
Get PreAlloc.
Definition: bittorrentsettings.h:144
BittorrentSettings::setTorrentDir
static void setTorrentDir(const QString &v)
Set TorrentDir.
Definition: bittorrentsettings.h:96
KCModule
KGET_EXPORT_PLUGIN_CONFIG
#define KGET_EXPORT_PLUGIN_CONFIG(classname)
Definition: kget_export.h:44
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:28:43 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kget

Skip menu "kget"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members

kdenetwork API Reference

Skip menu "kdenetwork API Reference"
  • kget
  • kopete
  •   kopete
  •   libkopete
  • krdc
  • krfb

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal