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

kget

btsettingswidget.cpp

Go to the documentation of this file.
00001 /* This file is part of the KDE project
00002 
00003    Copyright (C) 2007 Lukas Appelhans <l.appelhans@gmx.de>
00004 
00005    This program is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU General Public
00007    License as published by the Free Software Foundation; either
00008    version 2 of the License, or (at your option) any later version.
00009 */
00010 #include "btsettingswidget.h"
00011 
00012 #include "kget_export.h"
00013 #include "bittorrentsettings.h"
00014 
00015 #include <kdebug.h>
00016 #include <kfiledialog.h>
00017 
00018 KGET_EXPORT_PLUGIN_CONFIG(BTSettingsWidget)
00019 
00020 BTSettingsWidget::BTSettingsWidget(QWidget * parent = 0, const QVariantList &args = QVariantList())
00021   : KCModule(KGetFactory::componentData(), parent, args)
00022 {
00023     setupUi(this);
00024 
00025     connect(portBox, SIGNAL(valueChanged(int)), SLOT(changed()));
00026     connect(uploadBox, SIGNAL(valueChanged(int)), SLOT(changed()));
00027     connect(downloadBox, SIGNAL(valueChanged(int)), SLOT(changed()));
00028     connect(torrentEdit, SIGNAL(textChanged(const QString &)), SLOT(changed()));
00029     connect(tempEdit, SIGNAL(textChanged(const QString &)), SLOT(changed()));
00030     connect(preallocBox, SIGNAL(stateChanged(int)), SLOT(changed()));
00031     connect(shareRatioSpin, SIGNAL(valueChanged(int)), SLOT(changed()));
00032 }
00033 
00034 void BTSettingsWidget::load()
00035 {
00036     torrentEdit->setMode(KFile::Directory);
00037     torrentEdit->fileDialog()->setCaption(i18n("Select a default Torrent-Folder"));
00038     tempEdit->setMode(KFile::Directory);
00039     tempEdit->fileDialog()->setCaption(i18n("Select a default Temporary-Folder"));
00040     defaults();
00041 }
00042 
00043 void BTSettingsWidget::save()
00044 {
00045     kDebug(5001) << "Save Bittorrent-config";
00046     BittorrentSettings::setPort(portBox->value());
00047     BittorrentSettings::setUploadLimit(uploadBox->value());
00048     BittorrentSettings::setDownloadLimit(downloadBox->value());
00049     BittorrentSettings::setTorrentDir(torrentEdit->url().url());
00050     BittorrentSettings::setTmpDir(tempEdit->url().url());
00051     BittorrentSettings::setPreAlloc(preallocBox->isChecked());
00052     BittorrentSettings::setMaxShareRatio(shareRatioSpin->value());
00053 
00054     BittorrentSettings::self()->writeConfig();
00055 }
00056 
00057 void BTSettingsWidget::defaults()
00058 {
00059     portBox->setValue(BittorrentSettings::port());
00060     uploadBox->setValue(BittorrentSettings::uploadLimit());
00061     downloadBox->setValue(BittorrentSettings::downloadLimit());
00062     shareRatioSpin->setValue(BittorrentSettings::maxShareRatio());
00063     torrentEdit->setUrl(BittorrentSettings::torrentDir());
00064     tempEdit->setUrl(BittorrentSettings::tmpDir());
00065     preallocBox->setChecked(BittorrentSettings::preAlloc());
00066 }
00067 
00068 #include "btsettingswidget.moc"
00069  

kget

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

kdenetwork

Skip menu "kdenetwork"
  • kget
  • kopete
  •   kopete
  •   libkopete
  •       libpapillon
  • krfb
Generated for kdenetwork by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal