[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [ktorrent] ktorrent/dialogs: Delete files, should have been in previous commit, but kdevelop messed
From: Joris Guisson <joris.guisson () gmail ! com>
Date: 2014-11-08 11:32:45
Message-ID: E1Xn4G5-0005CW-I8 () scm ! kde ! org
[Download RAW message or body]
Git commit 08935765fc5c0548e584789f90f910b895b10bbd by Joris Guisson.
Committed on 08/11/2014 at 11:32.
Pushed by guisson into branch 'master'.
Delete files, should have been in previous commit, but kdevelop messed up
D +0 -169 ktorrent/dialogs/torrentmigratordlg.cpp
D +0 -71 ktorrent/dialogs/torrentmigratordlg.h
D +0 -78 ktorrent/dialogs/torrentmigratordlg.ui
http://commits.kde.org/ktorrent/08935765fc5c0548e584789f90f910b895b10bbd
diff --git a/ktorrent/dialogs/torrentmigratordlg.cpp \
b/ktorrent/dialogs/torrentmigratordlg.cpp deleted file mode 100644
index bf0d7d1..0000000
--- a/ktorrent/dialogs/torrentmigratordlg.cpp
+++ /dev/null
@@ -1,169 +0,0 @@
-/***************************************************************************
- * Copyright (C) 2008 by Joris Guisson and Ivan Vasic *
- * joris.guisson@gmail.com *
- * ivasic@gmail.com *
- * *
- * 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 2 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, write to the *
- * Free Software Foundation, Inc., *
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
- ***************************************************************************/
-#include <QDir>
-#include <klocale.h>
-#include <kprogressdialog.h>
-#include <kio/copyjob.h>
-#include <kmessagebox.h>
-#include <kstandardguiitem.h>
-#include <interfaces/functions.h>
-#include <util/functions.h>
-#include <util/fileops.h>
-#include <util/log.h>
-#include <torrent/torrent.h>
-#include <torrent/queuemanager.h>
-#include "torrentmigratordlg.h"
-
-using namespace bt;
-
-namespace kt
-{
-
- TorrentMigratorDlg::TorrentMigratorDlg(QWidget* parent)
- : QDialog(parent)
- {
- setupUi(this);
- m_close_button->setGuiItem(KStandardGuiItem::close());
- connect(m_close_button, SIGNAL(clicked()), this, SLOT(accept()));
- }
-
-
- TorrentMigratorDlg::~TorrentMigratorDlg()
- {
- }
-
- bt::Uint32 TorrentMigratorDlg::findTorrentsToBeMigrated()
- {
- QDir h = QDir::home();
- if (!h.cd(".kde/share/apps/ktorrent/"))
- {
- Out(SYS_GEN | LOG_NOTICE) << "No torrents to migrate found" << endl;
- return 0;
- }
-
- QString path = h.absolutePath();
- if (!path.endsWith("/"))
- path += "/";
-
- if (kt::DataDir() == path)
- {
- Out(SYS_GEN | LOG_NOTICE) << "No torrents to migrate found " << endl;
- return 0;
- }
-
- h.setNameFilters(QStringList() << "tor*");
- h.setFilter(QDir::Dirs);
- QStringList sd = h.entryList();
- foreach (const QString& dir, sd)
- {
- bool ok = false;
- Uint32 n = dir.mid(3).toUInt(&ok);
- if (ok)
- {
- todo.insert(h.filePath(dir), n);
- Out(SYS_GEN | LOG_NOTICE) << "Found " << h.filePath(dir) << " to \
migrate " << n << endl;
- }
- }
-
- return todo.count();
- }
-
- void TorrentMigratorDlg::migrateFoundTorrents(QueueManager* qman)
- {
- if (todo.count() == 0)
- return;
-
- show();
- m_close_button->setEnabled(false);
-
- m_text_output->append(i18np("Importing 1 torrent ...", "Importing %1 \
torrents ...", todo.count()));
-
- m_progress_bar->setRange(0, todo.count());
- m_progress_bar->setValue(0);
-
- Uint32 idx = 0;
- for (QMap<QString, bt::Uint32>::iterator i = todo.begin(); i != todo.end(); \
i++)
- {
- m_text_output->append(i18n("Importing <b>%1</b> ...", i.key()));
- doTorrent(i.key(), i.value(), qman);
- m_progress_bar->setValue(++idx);
- }
-
- m_text_output->append(i18n("Finished import."));
- m_progress_bar->setRange(0, 100);
- m_progress_bar->setValue(100);
- m_close_button->setEnabled(true);
- exec();
- }
-
- void TorrentMigratorDlg::doTorrent(const QString& tor, bt::Uint32 idx, \
QueueManager* qman)
- {
- QString path;
-
- // make sure we don't copy over an existing directory
- do
- {
- path = kt::DataDir() + QString("tor%1").arg(idx);
- idx++;
- }
- while (bt::Exists(path));
-
- QString torrent_file = tor;
- if (!torrent_file.endsWith(bt::DirSeparator()))
- torrent_file += bt::DirSeparator();
- torrent_file += "torrent";
-
- // try to load the torrent
- try
- {
- bt::Torrent t;
- t.load(bt::LoadFile(torrent_file), false);
- // make sure we don't load any dupes
- const SHA1Hash& info_hash = t.getInfoHash();
- for (QueueManager::iterator i = qman->begin(); i != qman->end(); i++)
- {
- bt::TorrentInterface* ti = *i;
- if (info_hash == ti->getInfoHash())
- {
- m_text_output->append(i18n("Torrent <b>%1</b> already loaded.", \
tor));
- return;
- }
- }
- }
- catch (...)
- {
- m_text_output->append(i18n("Failed to load <b>%1</b>", torrent_file));
- return;
- }
-
- // everything OK, copy the torX dir
- KIO::Job* j = KIO::copy(KUrl(tor), KUrl(path), KIO::HideProgressInfo);
- if (!j->exec())
- {
- m_text_output->append(i18n("Failed to import <b>%1</b>: %2", tor, \
j->errorString()));
- }
- else
- {
- m_text_output->append(i18n("Imported <b>%1</b>", tor));
- success << path;
- }
- }
-}
diff --git a/ktorrent/dialogs/torrentmigratordlg.h \
b/ktorrent/dialogs/torrentmigratordlg.h deleted file mode 100644
index 5c567a4..0000000
--- a/ktorrent/dialogs/torrentmigratordlg.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/***************************************************************************
- * Copyright (C) 2008 by Joris Guisson and Ivan Vasic *
- * joris.guisson@gmail.com *
- * ivasic@gmail.com *
- * *
- * 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 2 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, write to the *
- * Free Software Foundation, Inc., *
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
- ***************************************************************************/
-#ifndef KTTORRENTMIGRATOR_H
-#define KTTORRENTMIGRATOR_H
-
-#include <QObject>
-#include <QMap>
-#include <QStringList>
-#include <ktcore_export.h>
-#include <util/constants.h>
-#include "ui_torrentmigratordlg.h"
-
-
-namespace kt
-{
- class QueueManager;
-
- /**
- Class to find old torrents and migrate them to the KDE4 version.
- */
- class TorrentMigratorDlg : public QDialog, public Ui_TorrentMigratorDlg
- {
- Q_OBJECT
- public:
- TorrentMigratorDlg(QWidget* parent);
- virtual ~TorrentMigratorDlg();
-
- /**
- * Find all the torrents which can be migrated.
- * @param qman The QueueManager
- * @return The number found
- */
- bt::Uint32 findTorrentsToBeMigrated();
-
- /**
- * Migrate the torrents found.This will show the dialog.
- * @param qman The QueueManager
- */
- void migrateFoundTorrents(QueueManager* qman);
-
- /// Get all successfully imported torrents (their new torX dir)
- const QStringList& getSuccessFullImports() const {return success;}
- private:
- void doTorrent(const QString& tor, bt::Uint32 idx, QueueManager* qman);
-
- private:
- QMap<QString, bt::Uint32> todo;
- QStringList success;
- };
-
-}
-
-#endif
diff --git a/ktorrent/dialogs/torrentmigratordlg.ui \
b/ktorrent/dialogs/torrentmigratordlg.ui deleted file mode 100644
index 3946e18..0000000
--- a/ktorrent/dialogs/torrentmigratordlg.ui
+++ /dev/null
@@ -1,78 +0,0 @@
-<ui version="4.0" >
- <class>TorrentMigratorDlg</class>
- <widget class="QDialog" name="TorrentMigratorDlg" >
- <property name="geometry" >
- <rect>
- <x>0</x>
- <y>0</y>
- <width>400</width>
- <height>300</height>
- </rect>
- </property>
- <property name="windowTitle" >
- <string>Importing ...</string>
- </property>
- <property name="modal" >
- <bool>true</bool>
- </property>
- <layout class="QVBoxLayout" >
- <item>
- <widget class="QLabel" name="label" >
- <property name="text" >
- <string>Importing torrents from KDE3 version:</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QTextBrowser" name="m_text_output" />
- </item>
- <item>
- <widget class="QProgressBar" name="m_progress_bar" >
- <property name="value" >
- <number>24</number>
- </property>
- </widget>
- </item>
- <item>
- <widget class="Line" name="line" >
- <property name="orientation" >
- <enum>Qt::Horizontal</enum>
- </property>
- </widget>
- </item>
- <item>
- <layout class="QHBoxLayout" >
- <item>
- <spacer>
- <property name="orientation" >
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" >
- <size>
- <width>40</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- <item>
- <widget class="KPushButton" name="m_close_button" >
- <property name="text" >
- <string>Close</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- </layout>
- </widget>
- <customwidgets>
- <customwidget>
- <class>KPushButton</class>
- <extends>QPushButton</extends>
- <header>kpushbutton.h</header>
- </customwidget>
- </customwidgets>
- <resources/>
- <connections/>
-</ui>
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic