aboutsummaryrefslogtreecommitdiffstats
path: root/src/modules/torrent/KTorrentDbusInterface.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules/torrent/KTorrentDbusInterface.cpp')
-rw-r--r--src/modules/torrent/KTorrentDbusInterface.cpp302
1 files changed, 0 insertions, 302 deletions
diff --git a/src/modules/torrent/KTorrentDbusInterface.cpp b/src/modules/torrent/KTorrentDbusInterface.cpp
index 26c5a2766..32118095f 100644
--- a/src/modules/torrent/KTorrentDbusInterface.cpp
+++ b/src/modules/torrent/KTorrentDbusInterface.cpp
@@ -43,12 +43,6 @@ TORR_IMPLEMENT_DESCRIPTOR(
KTorrentDbusInterface::KTorrentDbusInterface()
{
- // printf("KTorrentDbusInterface\n");
-
- // QTimer *timer = new QTimer(this);
- // connect(timer, SIGNAL(timeout()), this, SLOT(slotTimer()));
- // timer->start(250, false);
-
// make sure we have a list of files,
// otherwise functions dealing would
// fail if called the first time
@@ -57,7 +51,6 @@ KTorrentDbusInterface::KTorrentDbusInterface()
KTorrentDbusInterface::~KTorrentDbusInterface()
{
- // printf("~KTorrentDbusInterface\n");
}
bool KTorrentDbusInterface::findRunningApp()
@@ -110,192 +103,48 @@ bool KTorrentDbusInterface::stopAll()
return true;
}
-/*
- void KTorrentDbusInterface::slotTimer()
- {
- if (!findRunningApp())
- return;
-
- m_ti.clear();
-
- QList<int> ret;
- if (!qvalueListIntRetIntDCOPCall("KTorrent", "getTorrentNumbers(int)", ret, 0))
- ERROR_RET_VOID
-
- for (int i=0; i<ret.size(); i++)
- {
- KviQCStringList info;
- if (!qcstringListRetIntDCOPCall("KTorrent", "getTorrentInfo(int)", info, ret[i]))
- ERROR_RET_VOID
-
- if (info.size() == 0)
- continue;
-
- TorrentInfo item;
- if (!makeTorrentInfo(item, info))
- return;
-
- item.num = ret[i];
- m_ti.append(item);
- }
-
- qHeapSort(m_ti);
- }
-
- bool makeSize(float &sz, const QString &s, const QString &u)
- {
- bool ok;
- sz = s.toFloat(&ok);
- if (!ok)
- return false;
-
- if (u == "B")
- ;
- else
- if (u == "KiB")
- sz = sz * 1024.0;
- else
- if (u == "MiB")
- sz = sz * 1024.0 * 1024.0;
- else
- if (u == "GiB")
- sz = sz * 1024.0 * 1024.0 * 1024.0;
- else
- return false;
-
- return true;
- }
-*/
bool KTorrentDbusInterface::start(int)
{
- /*
- CHECK_RANGE_BOOL(i, m_ti.size())
-
- qDebug("starting %s [%d]", (const char*)m_ti[i].name, m_ti[i].num);
- if (!voidRetIntDCOPCall("KTorrent", "start(int)", m_ti[i].num))
- ERROR_RET_BOOL
-*/
return true;
}
bool KTorrentDbusInterface::stop(int)
{
- /*
- CHECK_RANGE_BOOL(i, m_ti.size())
-
- qDebug("stopping %s [%d]", (const char*)m_ti[i].name, m_ti[i].num);
- if (!voidRetIntBoolDCOPCall("KTorrent", "stop(int, bool)", m_ti[i].num, true))
- ERROR_RET_BOOL
-*/
return true;
}
bool KTorrentDbusInterface::announce(int)
{
- /*
- CHECK_RANGE_BOOL(i, m_ti.size())
-
- qDebug("announcing %s [%d]", (const char*)m_ti[i].name, m_ti[i].num);
- if (!voidRetIntDCOPCall("KTorrent", "announce(int)", m_ti[i].num))
- ERROR_RET_BOOL
-*/
return true;
}
QString KTorrentDbusInterface::state(int)
{
- /*
- CHECK_RANGE_STRING(i, m_ti.size())
-
- return m_ti[i].state;
-*/
return QString();
}
QString KTorrentDbusInterface::name(int)
{
- /*
- CHECK_RANGE_STRING(i, m_ti.size())
-
- return m_ti[i].name;
- */
return QString();
}
int KTorrentDbusInterface::fileCount(int)
{
- /*
- CHECK_RANGE_INT(i, m_ti.size())
-
- int ret;
- if (!intRetIntDCOPCall("KTorrent", "getFileCount(int)", ret, m_ti[i].num))
- ERROR_RET_NUM
-
- return ret;
- */
return 0;
}
QString KTorrentDbusInterface::fileName(int, int)
{
- /*
- CHECK_RANGE_STRING(i, m_ti.size())
-
- QCStringList ret;
- if (!qcstringListRetIntDCOPCall("KTorrent", "getFileNames(int)", ret, m_ti[i].num))
- ERROR_RET_STRING
-
- CHECK_RANGE_STRING(file, ret.size())
-
- return ret[file];
- */
return QString();
}
QString KTorrentDbusInterface::filePriority(int, int)
{
- /*
- CHECK_RANGE_STRING(i, m_ti.size())
-
- QValueList<int> ret;
- if (!qvalueListIntRetIntDCOPCall("KTorrent", "getFilePriorities(int)",ret, m_ti[i].num))
- ERROR_RET_STRING
-
- CHECK_RANGE_STRING(file, ret.size())
-
- qDebug("prio: %d", ret[file]);
- switch (ret[file])
- {
- case 1: return "low";
- case 2: return "normal";
- case 3: return "high";
- }
-
- ERROR_RET_STRING
- */
return QString();
}
bool KTorrentDbusInterface::setFilePriority(int, int, const QString &)
{
- /*
- CHECK_RANGE_BOOL(i, m_ti.size())
-
- int prion;
- if (prio == "low")
- prion = 1;
- else
- if (prio == "normal")
- prion = 2;
- else
- if (prio == "high")
- prion = 1;
- else
- ERROR_RET_BOOL
-
- if (!voidRetIntIntIntDCOPCall("KTorrent", "setFilePriority(int,int,int)", m_ti[i].num, file, prion))
- ERROR_RET_BOOL
-*/
return true;
}
@@ -307,192 +156,41 @@ int KTorrentDbusInterface::count()
float KTorrentDbusInterface::speedUp()
{
- /*
- KviQCStringList ret;
- if (!qcstringListRetVoidDCOPCall("KTorrent", "getInfo()", ret))
- ERROR_RET_NUM
-
- QStringList tmp = QStringList::split(" ", ret[2]);
- if (tmp.size() != 8)
- ERROR_RET_NUM
-
- bool ok;
- float f = tmp[6].toFloat(&ok);
- if (!ok)
- ERROR_RET_NUM
-
- return f;
- */
return 0.0;
}
float KTorrentDbusInterface::speedDown()
{
- /*
- KviQCStringList ret;
- if (!qcstringListRetVoidDCOPCall("KTorrent", "getInfo()", ret))
- ERROR_RET_NUM
-
- QStringList tmp = QStringList::split(" ", ret[2]);
- if (tmp.size() != 8)
- ERROR_RET_NUM
-
- bool ok;
- float f = tmp[2].toFloat(&ok);
- if (!ok)
- ERROR_RET_NUM
-
- return f;
- */
return 0.0;
}
float KTorrentDbusInterface::trafficUp()
{
- /*
- KviQCStringList ret;
- if (!qcstringListRetVoidDCOPCall("KTorrent", "getInfo()", ret))
- ERROR_RET_NUM
-
- QStringList tmp = QStringList::split(" ", ret[1]);
- if (tmp.size() != 8)
- ERROR_RET_NUM
-
- float f;
- if (!makeSize(f, tmp[6], tmp[7]))
- ERROR_RET_NUM
-
- return f;
- */
return 0.0;
}
float KTorrentDbusInterface::trafficDown()
{
- /*
- KviQCStringList ret;
- if (!qcstringListRetVoidDCOPCall("KTorrent", "getInfo()", ret))
- ERROR_RET_NUM
-
- QStringList tmp = QStringList::split(" ", ret[1]);
- if (tmp.size() != 8)
- ERROR_RET_NUM
-
- float f;
- if (!makeSize(f, tmp[2], tmp[3]))
- ERROR_RET_NUM
-
- return f;
- */
return 0.0;
}
-/*
- bool KTorrentDbusInterface::makeTorrentInfo(TorrentInfo &ti, const KviQCStringList &ret)
- {
- if (ret.size() != 10)
- ERROR_RET_BOOL
-
- ti.name = ret[0];
- if (ret[1] == "Seeding")
- ti.state = "Seeding";
- else
- if (ret[1] == "Stalled")
- ti.state = "Stalled";
- else
- if (ret[1] == "Downloading")
- ti.state = "Downloading";
- else
- ti.state = "Stopped";
-
-
- QStringList tmp;
- tmp = QStringList::split(" ", ret[2]);
- if (tmp.size()!=2 || !makeSize(ti.trafficDown, tmp[0], tmp[1]))
- ERROR_RET_BOOL
-
- tmp = QStringList::split(" ", ret[3]);
- if (tmp.size()!=2 || !makeSize(ti.size, tmp[0], tmp[1]))
- ERROR_RET_BOOL
-
- tmp = QStringList::split(" ", ret[4]);
- if (tmp.size()!=2 || !makeSize(ti.trafficUp, tmp[0], tmp[1]))
- ERROR_RET_BOOL
-
-
- bool ok;
- tmp = QStringList::split(" ", ret[5]);
- if (tmp.size()!=2)
- ERROR_RET_BOOL
- ti.speedDown = tmp[0].toFloat(&ok);
- if (!ok)
- ERROR_RET_BOOL
-
- tmp = QStringList::split(" ", ret[6]);
- if (tmp.size()!=2)
- ERROR_RET_BOOL
- ti.speedUp = tmp[0].toFloat(&ok);
- if (!ok)
- ERROR_RET_BOOL
-
-
- // torrent name, status, downloaded, size, uploaded, down spd, up spd, none, peers, % complete
- ti.peers = ret[8].toInt(&ok);
- if (!ok)
- ERROR_RET_BOOL
-
- tmp = QStringList::split(" ", ret[9]);
- if (tmp.size()!=2)
- ERROR_RET_BOOL
- ti.percent = tmp[0].toFloat(&ok);
- if (!ok)
- ERROR_RET_BOOL
- return true;
- }
-*/
int KTorrentDbusInterface::maxUploadSpeed()
{
- /*
- int ret;
- if (!intRetVoidDCOPCall("KTorrent", "maxUploadRate()", ret))
- {
- ERROR_MSG
- return -1;
- }
- return ret;
- */
return -1;
}
int KTorrentDbusInterface::maxDownloadSpeed()
{
- /*
- int ret;
- if (!intRetVoidDCOPCall("KTorrent", "maxDownloadRate()", ret))
- {
- ERROR_MSG
- return -1;
- }
- return ret;
- */
return -1;
}
bool KTorrentDbusInterface::setMaxUploadSpeed(int)
{
- /*
- if (!voidRetIntDCOPCall("KTorrent", "setMaxUploadSpeed(int)", kbytes_per_sec))
- ERROR_RET_BOOL
- */
return true;
}
bool KTorrentDbusInterface::setMaxDownloadSpeed(int)
{
- /*
- if (!voidRetIntDCOPCall("KTorrent", "setMaxDownloadSpeed(int)", kbytes_per_sec))
- ERROR_RET_BOOL
- */
return true;
}