mirror of
https://bitbucket.org/smil3y/kde-extraapps.git
synced 2025-02-23 18:32:53 +00:00
kget: drop mmsthreads transfer plugin
see 702d9b67aaa6ee2d79934c1ab3de2d8d7718c89c in kdelibs Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
ceaacbb460
commit
80fa18c5e3
19 changed files with 0 additions and 1197 deletions
|
@ -18,13 +18,6 @@ include(CheckTypeSize)
|
|||
|
||||
include_directories(${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR})
|
||||
|
||||
kde4_optional_find_package(LibMms)
|
||||
set_package_properties(LibMms PROPERTIES
|
||||
DESCRIPTION "Library to read mms streams"
|
||||
URL "http://libmms.sourceforge.net"
|
||||
PURPOSE "Needed to build KGet mms support"
|
||||
)
|
||||
|
||||
kde4_optional_find_package(LibTorrent)
|
||||
set_package_properties(LibTorrent PROPERTIES
|
||||
DESCRIPTION "Feature complete C++ bittorrent implementation focusing on efficiency and scalability"
|
||||
|
|
|
@ -114,7 +114,6 @@ int main(int argc, char *argv[])
|
|||
aboutData.addAuthor(ki18n("Matthias Fuchs"), ki18n("Core Developer"), "mat69@gmx.net");
|
||||
aboutData.addAuthor(ki18n("Javier Goday"), ki18n("Developer"), "jgoday@gmail.com");
|
||||
aboutData.addAuthor(ki18n("Aish Raj Dahal"), ki18n("Google Summer of Code Student"));
|
||||
aboutData.addAuthor(ki18n("Ernesto Rodriguez Ortiz"), ki18n("Mms Plugin Author"), "eortiz@uci.cu");
|
||||
aboutData.addAuthor(ki18n("Patrick Charbonnier"), ki18n("Former Developer"), "pch@freeshell.org");
|
||||
aboutData.addAuthor(ki18n("Carsten Pfeiffer"), ki18n("Former Developer"), "pfeiffer@kde.org");
|
||||
aboutData.addAuthor(ki18n("Matej Koss"), ki18n("Former Developer"));
|
||||
|
|
|
@ -1,7 +1,4 @@
|
|||
add_subdirectory(kio)
|
||||
if (LIBMMS_FOUND)
|
||||
add_subdirectory(mmsthreads)
|
||||
endif (LIBMMS_FOUND)
|
||||
if (LIBTORRENT_FOUND)
|
||||
add_subdirectory(torrent)
|
||||
endif (LIBTORRENT_FOUND)
|
||||
|
|
|
@ -1,31 +0,0 @@
|
|||
include_directories(
|
||||
../../
|
||||
${LIBMMS_INCLUDE_DIR}
|
||||
)
|
||||
|
||||
set(kget_mmsfactory_PART_SRCS
|
||||
mmsdownload.cpp
|
||||
mmstransfer.cpp
|
||||
mmstransferfactory.cpp
|
||||
mmsthread.cpp
|
||||
)
|
||||
|
||||
kde4_add_kcfg_files(kget_mmsfactory_PART_SRCS mmssettings.kcfgc)
|
||||
kde4_add_plugin(kget_mmsfactory ${kget_mmsfactory_PART_SRCS})
|
||||
|
||||
target_link_libraries(kget_mmsfactory KDE4::kio kgetcore ${LIBMMS_LIBRARIES})
|
||||
|
||||
install(TARGETS kget_mmsfactory DESTINATION ${KDE4_PLUGIN_INSTALL_DIR})
|
||||
install(FILES kget_mmsfactory.desktop DESTINATION ${KDE4_SERVICES_INSTALL_DIR})
|
||||
|
||||
###Build KCM-Module
|
||||
set(kcm_kget_mmsfactory_PART_SRCS
|
||||
dlgmms.cpp
|
||||
dlgmms.ui
|
||||
)
|
||||
kde4_add_kcfg_files(kcm_kget_mmsfactory_PART_SRCS mmssettings.kcfgc)
|
||||
kde4_add_plugin(kcm_kget_mmsfactory ${kcm_kget_mmsfactory_PART_SRCS})
|
||||
target_link_libraries(kcm_kget_mmsfactory KDE4::kdeui KDE4::kio)
|
||||
install(TARGETS kcm_kget_mmsfactory DESTINATION ${KDE4_PLUGIN_INSTALL_DIR})
|
||||
|
||||
install(FILES kget_mmsfactory_config.desktop DESTINATION ${KDE4_SERVICES_INSTALL_DIR})
|
|
@ -1,46 +0,0 @@
|
|||
/*
|
||||
This file is part of the KDE project
|
||||
Copyright (C) 2011 Ernesto Rodriguez Ortiz <eortiz@uci.cu>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
#include "dlgmms.h"
|
||||
#include "mmssettings.h"
|
||||
#include "kget_export.h"
|
||||
|
||||
KGET_EXPORT_PLUGIN_CONFIG(DlgMmsSettings)
|
||||
|
||||
DlgMmsSettings::DlgMmsSettings(QWidget *parent, const QVariantList &args)
|
||||
: KCModule(KGetFactory::componentData(), parent, args)
|
||||
{
|
||||
ui.setupUi(this);
|
||||
connect(ui.numThreadSpinBox, SIGNAL(valueChanged(int)), SLOT(changed()));
|
||||
}
|
||||
|
||||
void DlgMmsSettings::load()
|
||||
{
|
||||
ui.numThreadSpinBox->setValue(MmsSettings::threads());
|
||||
}
|
||||
|
||||
void DlgMmsSettings::save()
|
||||
{
|
||||
qDebug() << "Saving Multithreaded config";
|
||||
MmsSettings::setThreads(ui.numThreadSpinBox->value());
|
||||
MmsSettings::self()->writeConfig();
|
||||
}
|
||||
|
||||
#include "moc_dlgmms.cpp"
|
||||
|
|
@ -1,40 +0,0 @@
|
|||
/*
|
||||
This file is part of the KDE project
|
||||
Copyright (C) 2011 Ernesto Rodriguez Ortiz <eortiz@uci.cu>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef DLGMMSTHREAD_H
|
||||
#define DLGMMSTHREAD_H
|
||||
#include <KCModule>
|
||||
|
||||
#include "ui_dlgmms.h"
|
||||
|
||||
class DlgMmsSettings : public KCModule
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit DlgMmsSettings(QWidget * parent = 0, const QVariantList &args = QVariantList());
|
||||
|
||||
public slots:
|
||||
virtual void save();
|
||||
virtual void load();
|
||||
|
||||
private:
|
||||
Ui::DlgMms ui;
|
||||
};
|
||||
|
||||
#endif // DLGMMSTHREAD_H
|
|
@ -1,57 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>DlgMms</class>
|
||||
<widget class="QWidget" name="DlgMms">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>270</width>
|
||||
<height>49</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<property name="fieldGrowthPolicy">
|
||||
<enum>QFormLayout::ExpandingFieldsGrow</enum>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Number of connections per URL:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QSpinBox" name="numThreadSpinBox">
|
||||
<property name="minimum">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>100</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>5</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="spacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>39</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<connections/>
|
||||
</ui>
|
|
@ -1,138 +0,0 @@
|
|||
[Desktop Entry]
|
||||
# service definition
|
||||
Type=Service
|
||||
X-KDE-ServiceTypes=KGet/Plugin
|
||||
Icon=kget
|
||||
|
||||
# standard fields
|
||||
Name=MMS
|
||||
Name[ar]=MMS
|
||||
Name[ast]=MMS
|
||||
Name[bg]=MMS
|
||||
Name[bs]=MMS
|
||||
Name[ca]=MMS
|
||||
Name[ca@valencia]=MMS
|
||||
Name[cs]=MMS
|
||||
Name[da]=MMS
|
||||
Name[de]=MMS
|
||||
Name[el]=MMS
|
||||
Name[en_GB]=MMS
|
||||
Name[eo]=MMS
|
||||
Name[es]=MMS
|
||||
Name[et]=MMS
|
||||
Name[eu]=MMS
|
||||
Name[fi]=Multimediaviesti
|
||||
Name[fr]=MMS
|
||||
Name[ga]=MMS
|
||||
Name[gl]=MMS
|
||||
Name[hne]=एमएमएस
|
||||
Name[hr]=MMS
|
||||
Name[hu]=MMS
|
||||
Name[ia]=MMS
|
||||
Name[is]=MMS
|
||||
Name[it]=MMS
|
||||
Name[ja]=MMS
|
||||
Name[kk]=MMS
|
||||
Name[km]=MMS
|
||||
Name[ko]=MMS
|
||||
Name[lt]=MMS
|
||||
Name[lv]=MMS
|
||||
Name[mai]=MMS
|
||||
Name[ml]=എംഎംഎസ്
|
||||
Name[nb]=MMS
|
||||
Name[nds]=MMS
|
||||
Name[nl]=MMS
|
||||
Name[nn]=MMS
|
||||
Name[pa]=MMS
|
||||
Name[pl]=MMS
|
||||
Name[pt]=MMS
|
||||
Name[pt_BR]=MMS
|
||||
Name[ro]=MMS
|
||||
Name[ru]=MMS
|
||||
Name[si]=MMS
|
||||
Name[sk]=MMS
|
||||
Name[sl]=MMS
|
||||
Name[sq]=MMS
|
||||
Name[sr]=ММС
|
||||
Name[sr@ijekavian]=ММС
|
||||
Name[sr@ijekavianlatin]=MMS
|
||||
Name[sr@latin]=MMS
|
||||
Name[sv]=MMS
|
||||
Name[tr]=MMS
|
||||
Name[ug]=MMS
|
||||
Name[uk]=MMS
|
||||
Name[wa]=MMS
|
||||
Name[x-test]=xxMMSxx
|
||||
Name[zh_CN]=MMS
|
||||
Name[zh_TW]=MMS
|
||||
Comment=MMS-Transfer plugin for KGet
|
||||
Comment[ar]=ملحق محول MMS لـ KGet
|
||||
Comment[ast]=Complementu de tresferencia de MMS pa KGet
|
||||
Comment[bg]=Приставка за пренос MMS в KGet
|
||||
Comment[bs]=MMS-Dodatak za prijenos KGet
|
||||
Comment[ca]=Connector de transferències d'MMS per al KGet
|
||||
Comment[ca@valencia]=Connector de transferències d'MMS per al KGet
|
||||
Comment[cs]=MMS-Transfer modul pro KGet
|
||||
Comment[da]=Plugin til MMS-overførsel til KGet
|
||||
Comment[de]=MMS-Übertragungsmodul für KGet
|
||||
Comment[el]=Πρόσθετο μεταφοράς MMS για το KGet
|
||||
Comment[en_GB]=MMS-Transfer plugin for KGet
|
||||
Comment[es]=Complemento de transferencia de MMS para KGet
|
||||
Comment[et]=KGeti MMS ülekandeplugin
|
||||
Comment[eu]=MMS transferentziaren plugina KGet-entzako
|
||||
Comment[fi]=KGetin multimediaviestiliitännäinen
|
||||
Comment[fr]=Module externe de transfert « MMS » pour KGet
|
||||
Comment[ga]=Breiseán aistrithe MMS le haghaidh KGet
|
||||
Comment[gl]=Engadido de transferencias MMS para KGet
|
||||
Comment[hne]=केगेट बर एमएमएस-ट्रांसफर प्लगइन
|
||||
Comment[hr]=Priključak za KGet za MMS-Prijenos
|
||||
Comment[hu]=KGet MMS-alapú letöltőmodul
|
||||
Comment[ia]=Plugin de transferentia-MMS per KGet
|
||||
Comment[is]=MMS-flutningsíforrit fyrir KGet
|
||||
Comment[it]=Estensione per MMS-Transfer di KGet
|
||||
Comment[ja]=KGet の MMS 転送プラグイン
|
||||
Comment[kk]=KGet-тің MMS-берілім плагині
|
||||
Comment[km]=MMS-កម្មវិធីជំនួយការផ្ទេរសម្រាប់ KGet
|
||||
Comment[ko]=KGet MMS 전송 플러그인
|
||||
Comment[lt]=KGet MMS persiuntimo priedas
|
||||
Comment[lv]=MMS KGet pārsūtīšanas spraudnis
|
||||
Comment[ml]=കെഗെറ്റിന്റെ എംഎംഎസ്-സ്ഥാനമാറ്റ സംയോജകം
|
||||
Comment[nb]=KGet programtillegg for MMS-overføringer
|
||||
Comment[nds]=MMS-Överdreegmoduul för KGet
|
||||
Comment[nl]=KGet-plugin voor MMS-overdracht
|
||||
Comment[nn]=Programtillegg til KGet for MMS-overføring
|
||||
Comment[pa]=ਕੇ-ਗੈੱਟ ਲਈ MMS-ਟਰਾਂਸਫਰ ਪਲੱਗਇਨ
|
||||
Comment[pl]=Wtyczka transferów MMS dla KGet
|
||||
Comment[pt]='Plugin' de transferência de MMS para o KGet
|
||||
Comment[pt_BR]=Plugin de transferências do MMS para o KGet
|
||||
Comment[ro]=Modul de transfer MMS pentru KGet
|
||||
Comment[ru]=Модуль MMS для KGet
|
||||
Comment[si]=KGet MMS-හුවමාරු ප්ලගිනය
|
||||
Comment[sk]=MMS-Transfer modul pre KGet
|
||||
Comment[sl]=Vstavek za prenose MMS za KGet
|
||||
Comment[sq]=MMS-Transfer plugin për KGet
|
||||
Comment[sr]=Прикључак ММС преноса за К‑гет
|
||||
Comment[sr@ijekavian]=Прикључак ММС преноса за К‑гет
|
||||
Comment[sr@ijekavianlatin]=Priključak MMS prenosa za KGet
|
||||
Comment[sr@latin]=Priključak MMS prenosa za KGet
|
||||
Comment[sv]=MMS-överföringsinsticksprogram för Kget
|
||||
Comment[tr]=MMS- KGet için aktarım eklentisi
|
||||
Comment[ug]=KGet نىڭ MMS يوللاش قىستۇرمىسى
|
||||
Comment[uk]=Додаток перенесення MMS для KGet
|
||||
Comment[x-test]=xxMMS-Transfer plugin for KGetxx
|
||||
Comment[zh_CN]=MMS-KGet 传输插件
|
||||
Comment[zh_TW]=KGet 的 MMS 傳輸外掛程式
|
||||
|
||||
# options for library loader
|
||||
X-KDE-Library=kget_mmsfactory
|
||||
X-KDE-KGet-plugintype=TransferFactory
|
||||
X-KDE-KGet-rank=80
|
||||
X-KDE-KGet-framework-version=1
|
||||
|
||||
X-KDE-PluginInfo-Author=Ernesto Rodriguez Ortiz
|
||||
X-KDE-PluginInfo-Email=eortiz@uci.cu
|
||||
X-KDE-PluginInfo-Version=1.0
|
||||
X-KDE-PluginInfo-Category=Service
|
||||
X-KDE-PluginInfo-License=GPL
|
||||
X-KDE-PluginInfo-EnabledByDefault=true
|
||||
X-KDE-PluginInfo-Name=kget_mms_plugin
|
|
@ -1,13 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<kcfg xmlns="http://www.kde.org/standards/kcfg/1.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0
|
||||
http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" >
|
||||
<include>kdemacros.h</include>
|
||||
<kcfgfile name="kget_mmsfactory.rc"/>
|
||||
<group name="Threads">
|
||||
<entry name="Threads" type="Int">
|
||||
<default>50</default>
|
||||
</entry>
|
||||
</group>
|
||||
</kcfg>
|
|
@ -1,67 +0,0 @@
|
|||
[Desktop Entry]
|
||||
Type=Service
|
||||
X-KDE-ServiceTypes=KCModule
|
||||
|
||||
X-KDE-Library=kcm_kget_mmsfactory
|
||||
X-KDE-ParentComponents=kget_mms_plugin
|
||||
|
||||
Name=MMS
|
||||
Name[ar]=MMS
|
||||
Name[ast]=MMS
|
||||
Name[bg]=MMS
|
||||
Name[bs]=MMS
|
||||
Name[ca]=MMS
|
||||
Name[ca@valencia]=MMS
|
||||
Name[cs]=MMS
|
||||
Name[da]=MMS
|
||||
Name[de]=MMS
|
||||
Name[el]=MMS
|
||||
Name[en_GB]=MMS
|
||||
Name[eo]=MMS
|
||||
Name[es]=MMS
|
||||
Name[et]=MMS
|
||||
Name[eu]=MMS
|
||||
Name[fi]=Multimediaviesti
|
||||
Name[fr]=MMS
|
||||
Name[ga]=MMS
|
||||
Name[gl]=MMS
|
||||
Name[hne]=एमएमएस
|
||||
Name[hr]=MMS
|
||||
Name[hu]=MMS
|
||||
Name[ia]=MMS
|
||||
Name[is]=MMS
|
||||
Name[it]=MMS
|
||||
Name[ja]=MMS
|
||||
Name[kk]=MMS
|
||||
Name[km]=MMS
|
||||
Name[ko]=MMS
|
||||
Name[lt]=MMS
|
||||
Name[lv]=MMS
|
||||
Name[mai]=MMS
|
||||
Name[ml]=എംഎംഎസ്
|
||||
Name[nb]=MMS
|
||||
Name[nds]=MMS
|
||||
Name[nl]=MMS
|
||||
Name[nn]=MMS
|
||||
Name[pa]=MMS
|
||||
Name[pl]=MMS
|
||||
Name[pt]=MMS
|
||||
Name[pt_BR]=MMS
|
||||
Name[ro]=MMS
|
||||
Name[ru]=MMS
|
||||
Name[si]=MMS
|
||||
Name[sk]=MMS
|
||||
Name[sl]=MMS
|
||||
Name[sq]=MMS
|
||||
Name[sr]=ММС
|
||||
Name[sr@ijekavian]=ММС
|
||||
Name[sr@ijekavianlatin]=MMS
|
||||
Name[sr@latin]=MMS
|
||||
Name[sv]=MMS
|
||||
Name[tr]=MMS
|
||||
Name[ug]=MMS
|
||||
Name[uk]=MMS
|
||||
Name[wa]=MMS
|
||||
Name[x-test]=xxMMSxx
|
||||
Name[zh_CN]=MMS
|
||||
Name[zh_TW]=MMS
|
|
@ -1,223 +0,0 @@
|
|||
/*
|
||||
This file is part of the KDE project
|
||||
Copyright (C) 2011 Ernesto Rodriguez Ortiz <eortiz@uci.cu>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
#include "mmsdownload.h"
|
||||
|
||||
const int SPEEDTIMER = 1000;//1 second...
|
||||
|
||||
MmsDownload::MmsDownload(const QString &url, const QString &name, const QString &temp,
|
||||
int amountsThread)
|
||||
: QThread(),
|
||||
m_sourceUrl(url),
|
||||
m_fileName(name),
|
||||
m_fileTemp(temp),
|
||||
m_amountThreads(amountsThread),
|
||||
m_connectionsFails(0),
|
||||
m_connectionsSuccefully(0),
|
||||
m_downloadedSize(0),
|
||||
m_mms(NULL)
|
||||
{
|
||||
m_speedTimer = new QTimer(this);
|
||||
m_speedTimer->setInterval(SPEEDTIMER);
|
||||
connect(m_speedTimer, SIGNAL(timeout()), this, SLOT(slotSpeedChanged()));
|
||||
}
|
||||
|
||||
MmsDownload::~MmsDownload()
|
||||
{
|
||||
if (m_mms) {
|
||||
mmsx_close(m_mms);
|
||||
}
|
||||
m_speedTimer->stop();
|
||||
m_speedTimer->deleteLater();
|
||||
}
|
||||
|
||||
void MmsDownload::run()
|
||||
{
|
||||
if (isWorkingUrl()) {
|
||||
splitTransfer();
|
||||
startTransfer();
|
||||
} else {
|
||||
emit signBrokenUrl();
|
||||
quit();
|
||||
}
|
||||
exec();
|
||||
}
|
||||
|
||||
|
||||
bool MmsDownload::isWorkingUrl()
|
||||
{
|
||||
/** Check if the URL is working, if it can't connect then not start the download.*/
|
||||
m_mms = mmsx_connect(NULL, NULL, qstrdup(m_sourceUrl.toAscii()), 1e9);
|
||||
return m_mms;
|
||||
}
|
||||
|
||||
void MmsDownload::splitTransfer()
|
||||
{
|
||||
/** We split the download in similar and each part is asigned to a thread and this is saved in
|
||||
* a map named m_mapEndIni. If we resume the download, then the temporal file will exist
|
||||
* and we dont have to split the download only use it.
|
||||
*/
|
||||
m_amountThreads = mmsx_get_seekable(m_mms) ? m_amountThreads : 0;
|
||||
if (m_amountThreads == 0) {
|
||||
m_amountThreads = 1;
|
||||
emit signNotAllowMultiDownload();
|
||||
QFile::remove(m_fileTemp);
|
||||
}
|
||||
|
||||
const qulonglong total = mmsx_get_length(m_mms);
|
||||
emit signTotalSize(total);
|
||||
|
||||
if (QFile::exists(m_fileTemp)) {
|
||||
unSerialization();
|
||||
} else {
|
||||
int part = mmsx_get_length(m_mms) / m_amountThreads;
|
||||
int ini = 0;
|
||||
int end = 0;
|
||||
for (int i = 0; i < m_amountThreads; i++) {
|
||||
if (i + 1 == m_amountThreads) {
|
||||
part = total - ini;
|
||||
}
|
||||
end = ini + part;
|
||||
m_mapEndIni.insert(end, ini);
|
||||
ini += part;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MmsDownload::startTransfer()
|
||||
{
|
||||
m_speedTimer->start();
|
||||
QMap<int, int>::const_iterator iterator = m_mapEndIni.constBegin();
|
||||
while (iterator != m_mapEndIni.constEnd()) {
|
||||
MmsThread* thread = new MmsThread(m_sourceUrl, m_fileName,
|
||||
iterator.value(), iterator.key());
|
||||
m_threadList.append(thread);
|
||||
connect(thread, SIGNAL(finished()), this, SLOT(slotThreadFinish()));
|
||||
connect(thread, SIGNAL(signIsConnected(bool)), this, SLOT(slotIsThreadConnected(bool)));
|
||||
connect(thread, SIGNAL(signReading(int,int,int)), this, SLOT(slotRead(int,int,int)));
|
||||
thread->start();
|
||||
++iterator;
|
||||
}
|
||||
}
|
||||
|
||||
void MmsDownload::slotSpeedChanged()
|
||||
{
|
||||
/** use all downloaded data of the last 10 secs) */
|
||||
qulonglong speed;
|
||||
if (m_prevDownloadedSizes.size()) {
|
||||
speed = (m_downloadedSize - m_prevDownloadedSizes.first()) / (SPEEDTIMER *
|
||||
m_prevDownloadedSizes.size() / 1000);//downloaded in 1 second
|
||||
} else {
|
||||
speed = 0;
|
||||
}
|
||||
|
||||
m_prevDownloadedSizes.append(m_downloadedSize);
|
||||
if(m_prevDownloadedSizes.size() > 10)
|
||||
m_prevDownloadedSizes.removeFirst();
|
||||
|
||||
emit signSpeed(speed);
|
||||
serialization();
|
||||
}
|
||||
|
||||
|
||||
void MmsDownload::stopTransfer()
|
||||
{
|
||||
/** Here only is called thread->stop() because when the thread finish it emit a signal
|
||||
* and slotThreadFinish(); is called where the thread is delete calling deleteLater(); and
|
||||
* m_threadList is cleaning using removeAll().
|
||||
*/
|
||||
foreach (MmsThread* thread, m_threadList) {
|
||||
thread->stop();
|
||||
thread->quit();
|
||||
}
|
||||
}
|
||||
|
||||
int MmsDownload::threadsAlive()
|
||||
{
|
||||
return m_threadList.size();
|
||||
}
|
||||
|
||||
|
||||
void MmsDownload::slotThreadFinish()
|
||||
{
|
||||
MmsThread* thread = qobject_cast<MmsThread*>(QObject::sender());
|
||||
m_threadList.removeAll(thread);
|
||||
thread->deleteLater();
|
||||
|
||||
if (m_threadList.isEmpty()) {
|
||||
serialization();
|
||||
quit();
|
||||
}
|
||||
}
|
||||
|
||||
void MmsDownload::slotRead(int reading, int thread_end, int thread_in)
|
||||
{
|
||||
/** We update the status of the thread in the map and emit a signal for update the download
|
||||
* speed.
|
||||
*/
|
||||
if (thread_in == thread_end) {
|
||||
m_mapEndIni.remove(thread_end);
|
||||
} else {
|
||||
m_mapEndIni[thread_end] = thread_in;
|
||||
}
|
||||
m_downloadedSize += reading;
|
||||
emit signDownloaded(m_downloadedSize);
|
||||
}
|
||||
|
||||
void MmsDownload::slotIsThreadConnected(bool connected)
|
||||
{
|
||||
/** All thread emit a signal connected with this slot, if they get connected succefully
|
||||
* the value of "connected" will be true, and will be false if they can't connected. When all
|
||||
* the thread emited the signal the amount of m_connectionsSuccefully and m_connectionsFails
|
||||
* will be equal to m_amountThreads and we emit a signal to restart the download in
|
||||
* mmstransfer using the amount of connections succefully connected.
|
||||
*/
|
||||
if (connected) {
|
||||
m_connectionsSuccefully++;
|
||||
} else {
|
||||
m_connectionsFails++;
|
||||
}
|
||||
if ((m_connectionsFails != 0) &&
|
||||
(m_connectionsFails + m_connectionsSuccefully == m_amountThreads)) {
|
||||
emit signRestartDownload(m_connectionsSuccefully);
|
||||
}
|
||||
}
|
||||
|
||||
void MmsDownload::serialization()
|
||||
{
|
||||
/** Here we save the status of the download to the temporal file for resume the download
|
||||
* if we stop it.
|
||||
*/
|
||||
QFile file(m_fileTemp);
|
||||
file.open(QIODevice::WriteOnly);
|
||||
QDataStream out(&file);
|
||||
out << m_mapEndIni << m_downloadedSize << m_prevDownloadedSizes;
|
||||
file.close();
|
||||
}
|
||||
|
||||
void MmsDownload::unSerialization()
|
||||
{
|
||||
/** Here we read the status of the download to the temporal file for resume the download
|
||||
*/
|
||||
QFile file(m_fileTemp);
|
||||
file.open(QIODevice::ReadOnly);
|
||||
QDataStream in(&file);
|
||||
in >> m_mapEndIni >> m_downloadedSize >> m_prevDownloadedSizes;
|
||||
file.close();
|
||||
}
|
|
@ -1,81 +0,0 @@
|
|||
/*
|
||||
This file is part of the KDE project
|
||||
Copyright (C) 2011 Ernesto Rodriguez Ortiz <eortiz@uci.cu>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef MMSDOWNLOAD_H
|
||||
#define MMSDOWNLOAD_H
|
||||
|
||||
#include <libmms/mmsx.h>
|
||||
#include <QString>
|
||||
#include <QTimer>
|
||||
#include <QMap>
|
||||
#include <QFile>
|
||||
#include <QDataStream>
|
||||
#include <kstandarddirs.h>
|
||||
|
||||
#include "mmsthread.h"
|
||||
|
||||
|
||||
class MmsDownload : public QThread
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
MmsDownload(const QString& url, const QString& name, const QString& temp,
|
||||
int amountsThread);
|
||||
~MmsDownload();
|
||||
void run();
|
||||
void stopTransfer();
|
||||
int threadsAlive();
|
||||
|
||||
public slots:
|
||||
void slotThreadFinish();
|
||||
void slotRead(int reading, int thread_end, int thead_ini);
|
||||
void slotSpeedChanged();
|
||||
void slotIsThreadConnected(bool connected);
|
||||
|
||||
signals:
|
||||
void signBrokenUrl();
|
||||
void signNotAllowMultiDownload();
|
||||
void signThreadFinish();
|
||||
qulonglong signDownloaded(qulonglong reading);
|
||||
qulonglong signTotalSize(qulonglong size);
|
||||
unsigned long signSpeed(unsigned long bytes_per_second);
|
||||
void signRestartDownload(int connections);
|
||||
|
||||
private:
|
||||
bool isWorkingUrl();
|
||||
void splitTransfer();
|
||||
void startTransfer();
|
||||
void unSerialization();
|
||||
void serialization();
|
||||
|
||||
QString m_sourceUrl;
|
||||
QString m_fileName;
|
||||
QString m_fileTemp;
|
||||
int m_amountThreads;
|
||||
int m_connectionsFails;
|
||||
int m_connectionsSuccefully;
|
||||
qulonglong m_downloadedSize;
|
||||
QList<qulonglong> m_prevDownloadedSizes;
|
||||
mmsx_t* m_mms;
|
||||
QTimer* m_speedTimer;
|
||||
QList<MmsThread*> m_threadList;
|
||||
QMap<int, int> m_mapEndIni;
|
||||
};
|
||||
|
||||
#endif // MMSDOWNLOAD_H
|
|
@ -1,5 +0,0 @@
|
|||
ClassName=MmsSettings
|
||||
File=kget_mmsfactory.kcfg
|
||||
Mutators=true
|
||||
Singleton=true
|
||||
Visibility=KDE_EXPORT
|
|
@ -1,89 +0,0 @@
|
|||
/*
|
||||
This file is part of the KDE project
|
||||
Copyright (C) 2011 Ernesto Rodriguez Ortiz <eortiz@uci.cu>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
#include "mmsthread.h"
|
||||
|
||||
MmsThread::MmsThread(const QString& url, const QString& name, int begin, int end)
|
||||
: QThread(),
|
||||
m_sourceUrl(url),
|
||||
m_fileName(name),
|
||||
m_begin(begin),
|
||||
m_end(end),
|
||||
m_download(true)
|
||||
{}
|
||||
|
||||
void MmsThread::run()
|
||||
{
|
||||
/** Seems that some times mmsx_read not read well.*/
|
||||
int readed;
|
||||
mmsx_t* mms;
|
||||
QFile file(m_fileName);
|
||||
/** Opening the file for write the information.*/
|
||||
file.open(QIODevice::ReadWrite);
|
||||
file.seek(m_begin);
|
||||
|
||||
/** Connecting to the url*/
|
||||
mms = mmsx_connect(NULL, NULL, qstrdup(m_sourceUrl.toAscii()) , 1e6);
|
||||
if (mms) {
|
||||
m_locker.lock();
|
||||
emit signIsConnected(true);
|
||||
m_locker.unlock();
|
||||
/** If the connections result succefull it start the download.*/
|
||||
mmsx_seek(0, mms, m_begin, 0);
|
||||
while ((m_begin < m_end) && m_download) {
|
||||
if ((m_begin + 1024) > m_end) {
|
||||
const int var = m_end - m_begin;
|
||||
char data[var];
|
||||
readed = mmsx_read(0, mms, data, var);
|
||||
m_locker.lock();
|
||||
emit signReading(var, m_end, m_begin = m_end);
|
||||
/** Writing the readed to the file */
|
||||
if (readed) {
|
||||
file.write(data, readed);
|
||||
}
|
||||
m_locker.unlock();
|
||||
} else {
|
||||
char data[1024];
|
||||
readed = mmsx_read(0, mms, data, 1024);
|
||||
m_locker.lock();
|
||||
emit signReading(1024, m_end, m_begin += 1024);
|
||||
/** Writing the readed to the file */
|
||||
if (readed) {
|
||||
file.write(data, readed);
|
||||
}
|
||||
m_locker.unlock();
|
||||
}
|
||||
}
|
||||
file.close();
|
||||
mmsx_close(mms);
|
||||
quit(); // NOTE: Keep "quit()" here, if not then the thread never emit the signal finish.
|
||||
} else {
|
||||
/** If the connections not result succefully then stop all the download*/
|
||||
m_locker.lock();
|
||||
emit signIsConnected(false);
|
||||
m_locker.unlock();
|
||||
quit(); // NOTE: Keep "quit()" here, if not then the thread never emit the signal finish.
|
||||
}
|
||||
exec();
|
||||
}
|
||||
|
||||
void MmsThread::stop()
|
||||
{
|
||||
m_download = false;
|
||||
}
|
|
@ -1,50 +0,0 @@
|
|||
/*
|
||||
This file is part of the KDE project
|
||||
Copyright (C) 2011 Ernesto Rodriguez Ortiz <eortiz@uci.cu>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef MMSTHREAD_HPP
|
||||
#define MMSTHREAD_HPP
|
||||
#include <libmms/mmsx.h>
|
||||
#include <QtCore/QThread>
|
||||
#include <QtCore/QFile>
|
||||
#include <QtCore/QMutex>
|
||||
|
||||
using namespace std;
|
||||
|
||||
class MmsThread : public QThread
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
MmsThread(const QString& url, const QString& name, int begin, int end);
|
||||
void run();
|
||||
void stop();
|
||||
|
||||
private:
|
||||
QString m_sourceUrl;
|
||||
QString m_fileName;
|
||||
int m_begin;
|
||||
int m_end;
|
||||
QMutex m_locker;
|
||||
bool m_download;
|
||||
|
||||
signals:
|
||||
void signReading(int data, int m_end, int m_begin);
|
||||
void signIsConnected(bool connected);
|
||||
};
|
||||
|
||||
#endif // MMSTHREAD_HPP
|
|
@ -1,186 +0,0 @@
|
|||
/*
|
||||
This file is part of the KDE project
|
||||
Copyright (C) 2011 Ernesto Rodriguez Ortiz <eortiz@uci.cu>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
#include "mmstransfer.h"
|
||||
|
||||
MmsTransfer::MmsTransfer(TransferGroup * parent, TransferFactory * factory,
|
||||
Scheduler * scheduler, const KUrl & source, const
|
||||
KUrl &dest)
|
||||
: Transfer(parent, factory, scheduler, source, dest),
|
||||
m_mmsdownload(NULL),
|
||||
m_amountThreads(MmsSettings::threads()),
|
||||
m_retryDownload(false)
|
||||
{
|
||||
m_fileTemp = KStandardDirs::locateLocal("appdata", m_dest.fileName());
|
||||
kDebug() << "Mms transfer initialized: " + m_source.prettyUrl();
|
||||
}
|
||||
|
||||
MmsTransfer::~MmsTransfer()
|
||||
{
|
||||
/** If m_mmsdownload is not deleted we delete it before end.*/
|
||||
if (m_mmsdownload) {
|
||||
m_mmsdownload->quit();
|
||||
m_mmsdownload->deleteLater();
|
||||
}
|
||||
}
|
||||
|
||||
void MmsTransfer::start()
|
||||
{
|
||||
/** Starting the download, is created the thread m_mmsdownload and is started the download*/
|
||||
if (m_mmsdownload || status() == Finished) {
|
||||
return;
|
||||
}
|
||||
|
||||
setStatus(Job::Running, i18nc("transfer state: running", "Running...."),
|
||||
SmallIcon("media-playback-start"));
|
||||
m_mmsdownload = new MmsDownload(m_source.prettyUrl(), m_dest.pathOrUrl(),
|
||||
m_fileTemp, m_amountThreads);
|
||||
connect(m_mmsdownload, SIGNAL(finished()), this, SLOT(slotResult()));
|
||||
connect(m_mmsdownload, SIGNAL(signBrokenUrl()), this, SLOT(slotBrokenUrl()));
|
||||
connect(m_mmsdownload, SIGNAL(signNotAllowMultiDownload()), this,
|
||||
SLOT(slotNotAllowMultiDownload()));
|
||||
connect(m_mmsdownload, SIGNAL(signTotalSize(qulonglong)), this,
|
||||
SLOT(slotTotalSize(qulonglong)));
|
||||
connect(m_mmsdownload, SIGNAL(signDownloaded(qulonglong)), this,
|
||||
SLOT(slotProcessedSizeAndPercent(qulonglong)));
|
||||
connect(m_mmsdownload, SIGNAL(signSpeed(ulong)), this,
|
||||
SLOT(slotSpeed(ulong)));
|
||||
connect(m_mmsdownload, SIGNAL(signRestartDownload(int)), this,
|
||||
SLOT(slotConnectionsErrors(int)));
|
||||
m_mmsdownload->start();
|
||||
setTransferChange(Tc_Status, true);
|
||||
}
|
||||
|
||||
void MmsTransfer::stop()
|
||||
{
|
||||
/** The download is stopped, we call m_mmsdownload->stopTransfer() and when all threads
|
||||
* are finish m_mmsdownload will be deleted in MmsTransfer::slotResult().
|
||||
*/
|
||||
if ((status() == Stopped) || (status() == Finished)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_mmsdownload) {
|
||||
if (m_mmsdownload->threadsAlive() > 0) {
|
||||
m_mmsdownload->stopTransfer();
|
||||
}
|
||||
}
|
||||
|
||||
setStatus(Job::Stopped, i18nc("transfer state: stopped", "Stopped"),
|
||||
SmallIcon("process-stop"));
|
||||
m_downloadSpeed = 0;
|
||||
setTransferChange(Tc_Status | Tc_DownloadSpeed, true);
|
||||
}
|
||||
|
||||
void MmsTransfer::deinit(Transfer::DeleteOptions options)
|
||||
{
|
||||
/** Deleting the temporary file and the unfinish file*/
|
||||
if (options & Transfer::DeleteFiles) {
|
||||
KIO::Job *del = KIO::del(m_fileTemp, KIO::HideProgressInfo);
|
||||
KIO::NetAccess::synchronousRun(del, 0);
|
||||
del = KIO::del(m_dest.path(), KIO::HideProgressInfo);
|
||||
KIO::NetAccess::synchronousRun(del, 0);
|
||||
}
|
||||
}
|
||||
|
||||
void MmsTransfer::slotResult()
|
||||
{
|
||||
/** This slot is connected with the signal finish of m_mmsdownload*/
|
||||
/** Deleting m_mmsdownload.*/
|
||||
m_mmsdownload->deleteLater();
|
||||
m_mmsdownload = NULL;
|
||||
|
||||
/** If the download end without problems is changed the status to Finished and is deleted
|
||||
* the temporary file where is saved the status of all threads that download the file.
|
||||
*/
|
||||
if (m_downloadedSize == m_totalSize && m_totalSize != 0) {
|
||||
setStatus(Job::Finished, i18nc("Transfer State:Finished","Finished"),
|
||||
SmallIcon("dialog-ok"));
|
||||
m_percent = 100;
|
||||
m_downloadSpeed = 0;
|
||||
setTransferChange(Tc_Status | Tc_Percent | Tc_DownloadSpeed, true);
|
||||
KIO::Job *del = KIO::del(m_fileTemp, KIO::HideProgressInfo);
|
||||
KIO::NetAccess::synchronousRun(del, 0);
|
||||
}
|
||||
|
||||
/** If m_retryDownload == true then some threads has fail to connect, so the download was
|
||||
* stopped in MmsTransfer::slotConnectionsErrors() and here when all the connected thread
|
||||
* are finished we delete the temporary file and we start again the download using the amount
|
||||
* of threads defined in MmsTransfer::slotConnectionsErrors().
|
||||
*/
|
||||
if (m_retryDownload) {
|
||||
m_retryDownload = false;
|
||||
KIO::Job *del = KIO::del(m_fileTemp, KIO::HideProgressInfo);
|
||||
KIO::NetAccess::synchronousRun(del, 0);
|
||||
start();
|
||||
}
|
||||
}
|
||||
|
||||
void MmsTransfer::slotTotalSize(qulonglong size)
|
||||
{
|
||||
m_totalSize = size;
|
||||
setTransferChange(Tc_TotalSize, true);
|
||||
}
|
||||
|
||||
void MmsTransfer::slotSpeed(ulong speed)
|
||||
{
|
||||
m_downloadSpeed = (status() == Running) ? speed : 0;
|
||||
setTransferChange(Tc_DownloadSpeed, true);
|
||||
}
|
||||
|
||||
void MmsTransfer::slotProcessedSizeAndPercent(qulonglong size)
|
||||
{
|
||||
m_downloadedSize = size;
|
||||
m_percent = (m_downloadedSize * 100) / m_totalSize;
|
||||
setTransferChange(Tc_DownloadedSize | Tc_Percent, true);
|
||||
}
|
||||
|
||||
void MmsTransfer::slotBrokenUrl()
|
||||
{
|
||||
setError(i18n("Download failed, could not access this URL."), SmallIcon("dialog-cancel"),
|
||||
Job::NotSolveable);
|
||||
setTransferChange(Tc_Status, true);
|
||||
}
|
||||
|
||||
void MmsTransfer::slotNotAllowMultiDownload()
|
||||
{
|
||||
/** Some stream not allow seek in to a position, so we can't use more than one thread to
|
||||
* download the file, this is notify to the user because the download will take longer.
|
||||
*/
|
||||
KGet::showNotification(0, "notification", i18n("This URL does not allow multiple connections,\n"
|
||||
"the download will take longer."));
|
||||
}
|
||||
|
||||
void MmsTransfer::slotConnectionsErrors(int connections)
|
||||
{
|
||||
/** Here is called stop() for stop the download, set a new amount of thread
|
||||
* and set m_retryDownload = true for restart the download when mmsdownload is finish and
|
||||
* emit a singal connected with MmsTransfer::slotResult(), see in MmsTransfer::slotResult()
|
||||
* for understand when its started again the download.
|
||||
*/
|
||||
stop();
|
||||
m_retryDownload = true;
|
||||
if (connections) {
|
||||
m_amountThreads = connections;
|
||||
} else {
|
||||
m_amountThreads--;
|
||||
}
|
||||
}
|
||||
|
||||
#include "moc_mmstransfer.cpp"
|
|
@ -1,61 +0,0 @@
|
|||
/*
|
||||
This file is part of the KDE project
|
||||
Copyright (C) 2011 Ernesto Rodriguez Ortiz <eortiz@uci.cu>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef MMSTRANSFER_H
|
||||
#define MMSTRANSFER_H
|
||||
|
||||
|
||||
#include <QtCore/qdatetime.h>
|
||||
#include <kio/deletejob.h>
|
||||
#include "core/kget.h"
|
||||
#include "mmsdownload.h"
|
||||
#include "mmssettings.h"
|
||||
#include "core/transfer.h"
|
||||
|
||||
class MmsTransfer : public Transfer
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
MmsTransfer(TransferGroup * parent, TransferFactory * factory,
|
||||
Scheduler * scheduler, const KUrl & src, const KUrl & dest);
|
||||
~MmsTransfer();
|
||||
|
||||
public slots:
|
||||
void start();
|
||||
void stop();
|
||||
void deinit(Transfer::DeleteOptions options);
|
||||
|
||||
private slots:
|
||||
void slotResult();
|
||||
void slotTotalSize(qulonglong size);
|
||||
void slotProcessedSizeAndPercent(qulonglong size);
|
||||
void slotSpeed(ulong bytes_per_sec);
|
||||
void slotNotAllowMultiDownload();
|
||||
void slotBrokenUrl();
|
||||
void slotConnectionsErrors(int connections);
|
||||
|
||||
private:
|
||||
MmsDownload* m_mmsdownload;
|
||||
int m_amountThreads;
|
||||
bool m_retryDownload;
|
||||
QString m_fileTemp;
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,56 +0,0 @@
|
|||
/*
|
||||
This file is part of the KDE project
|
||||
Copyright (C) 2011 Ernesto Rodriguez Ortiz <eortiz@uci.cu>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
#include "mmstransferfactory.h"
|
||||
#include "mmssettings.h"
|
||||
#include "mmstransfer.h"
|
||||
|
||||
#include <kdebug.h>
|
||||
|
||||
KGET_EXPORT_PLUGIN( MmsTransferFactory )
|
||||
|
||||
MmsTransferFactory::MmsTransferFactory(QObject *parent, const QVariantList &args)
|
||||
: TransferFactory(parent, args)
|
||||
{
|
||||
}
|
||||
|
||||
MmsTransferFactory::~MmsTransferFactory()
|
||||
{
|
||||
}
|
||||
|
||||
Transfer * MmsTransferFactory::createTransfer( const KUrl &srcUrl, const KUrl &destUrl,
|
||||
TransferGroup * parent,
|
||||
Scheduler * scheduler)
|
||||
{
|
||||
kDebug() << "MmsTransferFactory::createTransfer";
|
||||
|
||||
QString prot = srcUrl.protocol();
|
||||
kDebug() << "Protocol = " << prot;
|
||||
if (prot == "mms" || prot == "mmsh") {
|
||||
return new MmsTransfer(parent, this, scheduler, srcUrl, destUrl);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool MmsTransferFactory::isSupported(const KUrl &url) const
|
||||
{
|
||||
QString prot = url.protocol();
|
||||
kDebug() << "Protocol = " << prot;
|
||||
return (prot == "mms" || prot == "mmsh");
|
||||
}
|
|
@ -1,43 +0,0 @@
|
|||
/*
|
||||
This file is part of the KDE project
|
||||
Copyright (C) 2011 Ernesto Rodriguez Ortiz <eortiz@uci.cu>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef MMSTRANSFERFACTORY_H
|
||||
#define MMSTRANSFERFACTORY_H
|
||||
|
||||
#include "core/plugin/transferfactory.h"
|
||||
#include "core/transferhandler.h"
|
||||
|
||||
class Transfer;
|
||||
class TransferGroup;
|
||||
class Scheduler;
|
||||
|
||||
class MmsTransferFactory : public TransferFactory
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
MmsTransferFactory(QObject *parent, const QVariantList &args);
|
||||
~MmsTransferFactory();
|
||||
|
||||
Transfer * createTransfer( const KUrl &srcUrl, const KUrl &destUrl,
|
||||
TransferGroup * parent, Scheduler * scheduler);
|
||||
|
||||
bool isSupported(const KUrl &url) const;
|
||||
};
|
||||
|
||||
#endif
|
Loading…
Add table
Reference in a new issue