mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-11 07:18:08 +00:00
Started code reorganizing (Moved libtorrent specific files and webui files to subfolders)
This commit is contained in:
parent
593fdad426
commit
6e7309316c
@ -52,7 +52,7 @@
|
|||||||
#include "torrentadditiondlg.h"
|
#include "torrentadditiondlg.h"
|
||||||
#include "searchengine.h"
|
#include "searchengine.h"
|
||||||
#include "rss_imp.h"
|
#include "rss_imp.h"
|
||||||
#include "bittorrent.h"
|
#include "qbtsession.h"
|
||||||
#include "about_imp.h"
|
#include "about_imp.h"
|
||||||
#include "trackerlogin.h"
|
#include "trackerlogin.h"
|
||||||
#include "options_imp.h"
|
#include "options_imp.h"
|
||||||
|
@ -31,7 +31,7 @@
|
|||||||
#ifndef CONSOLE_H
|
#ifndef CONSOLE_H
|
||||||
#define CONSOLE_H
|
#define CONSOLE_H
|
||||||
|
|
||||||
#include "bittorrent.h"
|
#include "qbtsession.h"
|
||||||
#include "ui_console.h"
|
#include "ui_console.h"
|
||||||
|
|
||||||
using namespace libtorrent;
|
using namespace libtorrent;
|
||||||
|
@ -42,7 +42,7 @@
|
|||||||
#include <QDataStream>
|
#include <QDataStream>
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
|
|
||||||
#include "bittorrent.h"
|
#include "qbtsession.h"
|
||||||
#include "ui_feeddownloader.h"
|
#include "ui_feeddownloader.h"
|
||||||
#include "qinisettings.h"
|
#include "qinisettings.h"
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@
|
|||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
#include "preferences.h"
|
#include "preferences.h"
|
||||||
#include "bittorrent.h"
|
#include "qbtsession.h"
|
||||||
|
|
||||||
class HeadlessLoader: public QObject {
|
class HeadlessLoader: public QObject {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
@ -44,7 +44,7 @@
|
|||||||
#include "propertieswidget.h"
|
#include "propertieswidget.h"
|
||||||
#include "transferlistwidget.h"
|
#include "transferlistwidget.h"
|
||||||
#include "torrentpersistentdata.h"
|
#include "torrentpersistentdata.h"
|
||||||
#include "bittorrent.h"
|
#include "qbtsession.h"
|
||||||
#include "proplistdelegate.h"
|
#include "proplistdelegate.h"
|
||||||
#include "torrentfilesmodel.h"
|
#include "torrentfilesmodel.h"
|
||||||
#include "peerlistwidget.h"
|
#include "peerlistwidget.h"
|
||||||
|
@ -39,7 +39,7 @@
|
|||||||
|
|
||||||
#include "smtp.h"
|
#include "smtp.h"
|
||||||
#include "filesystemwatcher.h"
|
#include "filesystemwatcher.h"
|
||||||
#include "bittorrent.h"
|
#include "qbtsession.h"
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
#include "downloadthread.h"
|
#include "downloadthread.h"
|
||||||
#include "filterparserthread.h"
|
#include "filterparserthread.h"
|
7
src/qtlibtorrent/qtlibtorrent.pri
Normal file
7
src/qtlibtorrent/qtlibtorrent.pri
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
INCLUDEPATH += $$PWD
|
||||||
|
|
||||||
|
HEADERS += $$PWD/qbtsession.h \
|
||||||
|
$$PWD/qtorrenthandle.h
|
||||||
|
|
||||||
|
SOURCES += $$PWD/qbtsession.cpp \
|
||||||
|
$$PWD/qtorrenthandle.cpp
|
@ -45,7 +45,7 @@
|
|||||||
|
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
#include "feeddownloader.h"
|
#include "feeddownloader.h"
|
||||||
#include "bittorrent.h"
|
#include "qbtsession.h"
|
||||||
#include "downloadthread.h"
|
#include "downloadthread.h"
|
||||||
|
|
||||||
#if QT_VERSION >= 0x040500
|
#if QT_VERSION >= 0x040500
|
||||||
|
@ -40,7 +40,7 @@
|
|||||||
#include "rss_imp.h"
|
#include "rss_imp.h"
|
||||||
#include "feeddownloader.h"
|
#include "feeddownloader.h"
|
||||||
#include "feedList.h"
|
#include "feedList.h"
|
||||||
#include "bittorrent.h"
|
#include "qbtsession.h"
|
||||||
#include "cookiesdlg.h"
|
#include "cookiesdlg.h"
|
||||||
#include "preferences.h"
|
#include "preferences.h"
|
||||||
#include "rsssettings.h"
|
#include "rsssettings.h"
|
||||||
|
@ -48,7 +48,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "searchengine.h"
|
#include "searchengine.h"
|
||||||
#include "bittorrent.h"
|
#include "qbtsession.h"
|
||||||
#include "downloadthread.h"
|
#include "downloadthread.h"
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
#include "preferences.h"
|
#include "preferences.h"
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
#include <QList>
|
#include <QList>
|
||||||
#include "ui_bandwidth_limit.h"
|
#include "ui_bandwidth_limit.h"
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
#include "bittorrent.h"
|
#include "qbtsession.h"
|
||||||
|
|
||||||
using namespace libtorrent;
|
using namespace libtorrent;
|
||||||
|
|
||||||
|
23
src/src.pro
23
src/src.pro
@ -220,10 +220,9 @@ os2 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Resource files
|
# Resource files
|
||||||
RESOURCES = icons.qrc \
|
RESOURCES += icons.qrc \
|
||||||
lang.qrc \
|
lang.qrc \
|
||||||
search.qrc \
|
search.qrc \
|
||||||
webui.qrc \
|
|
||||||
about.qrc
|
about.qrc
|
||||||
|
|
||||||
# Add GeoIP resource file if the GeoIP database
|
# Add GeoIP resource file if the GeoIP database
|
||||||
@ -276,14 +275,6 @@ TRANSLATIONS = $$LANG_PATH/qbittorrent_fr.ts \
|
|||||||
# Source code
|
# Source code
|
||||||
HEADERS += misc.h \
|
HEADERS += misc.h \
|
||||||
downloadthread.h \
|
downloadthread.h \
|
||||||
bittorrent.h \
|
|
||||||
qtorrenthandle.h \
|
|
||||||
httpserver.h \
|
|
||||||
httpconnection.h \
|
|
||||||
httprequestparser.h \
|
|
||||||
httpresponsegenerator.h \
|
|
||||||
json.h \
|
|
||||||
eventmanager.h \
|
|
||||||
filterparserthread.h \
|
filterparserthread.h \
|
||||||
stacktrace.h \
|
stacktrace.h \
|
||||||
torrentpersistentdata.h \
|
torrentpersistentdata.h \
|
||||||
@ -367,6 +358,9 @@ contains(DEFINES, USE_SYSTEM_QTSINGLEAPPLICATION) {
|
|||||||
include(lineedit/lineedit.pri)
|
include(lineedit/lineedit.pri)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
include(qtlibtorrent/qtlibtorrent.pri)
|
||||||
|
include(webui/webui.pri)
|
||||||
|
|
||||||
!contains(DEFINES, DISABLE_GUI) {
|
!contains(DEFINES, DISABLE_GUI) {
|
||||||
FORMS += ui/mainwindow.ui \
|
FORMS += ui/mainwindow.ui \
|
||||||
ui/options.ui \
|
ui/options.ui \
|
||||||
@ -391,15 +385,8 @@ contains(DEFINES, USE_SYSTEM_QTSINGLEAPPLICATION) {
|
|||||||
ui/rsssettings.ui
|
ui/rsssettings.ui
|
||||||
}
|
}
|
||||||
|
|
||||||
SOURCES += main.cpp \
|
SOURCES += main.cpp \
|
||||||
bittorrent.cpp \
|
|
||||||
qtorrenthandle.cpp \
|
|
||||||
downloadthread.cpp \
|
downloadthread.cpp \
|
||||||
httpserver.cpp \
|
|
||||||
httpconnection.cpp \
|
|
||||||
httprequestparser.cpp \
|
|
||||||
httpresponsegenerator.cpp \
|
|
||||||
eventmanager.cpp \
|
|
||||||
scannedfoldersmodel.cpp \
|
scannedfoldersmodel.cpp \
|
||||||
misc.cpp \
|
misc.cpp \
|
||||||
smtp.cpp
|
smtp.cpp
|
||||||
|
@ -38,7 +38,7 @@
|
|||||||
#include <QGridLayout>
|
#include <QGridLayout>
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
#include <QHBoxLayout>
|
#include <QHBoxLayout>
|
||||||
#include "bittorrent.h"
|
#include "qbtsession.h"
|
||||||
#include "speedlimitdlg.h"
|
#include "speedlimitdlg.h"
|
||||||
#include "preferences.h"
|
#include "preferences.h"
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
|
@ -45,7 +45,7 @@
|
|||||||
#include <libtorrent/version.hpp>
|
#include <libtorrent/version.hpp>
|
||||||
#include <libtorrent/session.hpp>
|
#include <libtorrent/session.hpp>
|
||||||
#include <libtorrent/bencode.hpp>
|
#include <libtorrent/bencode.hpp>
|
||||||
#include "bittorrent.h"
|
#include "qbtsession.h"
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
#include "proplistdelegate.h"
|
#include "proplistdelegate.h"
|
||||||
#include "ui_torrentadditiondlg.h"
|
#include "ui_torrentadditiondlg.h"
|
||||||
|
@ -1,391 +1,391 @@
|
|||||||
/*
|
/*
|
||||||
* Bittorrent Client using Qt4 and libtorrent.
|
* Bittorrent Client using Qt4 and libtorrent.
|
||||||
* Copyright (C) 2006 Christophe Dumez
|
* Copyright (C) 2006 Christophe Dumez
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
* as published by the Free Software Foundation; either version 2
|
* as published by the Free Software Foundation; either version 2
|
||||||
* of the License, or (at your option) any later version.
|
* of the License, or (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
*
|
*
|
||||||
* In addition, as a special exception, the copyright holders give permission to
|
* In addition, as a special exception, the copyright holders give permission to
|
||||||
* link this program with the OpenSSL project's "OpenSSL" library (or with
|
* link this program with the OpenSSL project's "OpenSSL" library (or with
|
||||||
* modified versions of it that use the same license as the "OpenSSL" library),
|
* modified versions of it that use the same license as the "OpenSSL" library),
|
||||||
* and distribute the linked executables. You must obey the GNU General Public
|
* and distribute the linked executables. You must obey the GNU General Public
|
||||||
* License in all respects for all of the code used other than "OpenSSL". If you
|
* License in all respects for all of the code used other than "OpenSSL". If you
|
||||||
* modify file(s), you may extend this exception to your version of the file(s),
|
* modify file(s), you may extend this exception to your version of the file(s),
|
||||||
* but you are not obligated to do so. If you do not wish to do so, delete this
|
* but you are not obligated to do so. If you do not wish to do so, delete this
|
||||||
* exception statement from your version.
|
* exception statement from your version.
|
||||||
*
|
*
|
||||||
* Contact : chris@qbittorrent.org
|
* Contact : chris@qbittorrent.org
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <QTreeWidgetItem>
|
#include <QTreeWidgetItem>
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
#include <QHash>
|
#include <QHash>
|
||||||
#include <QAction>
|
#include <QAction>
|
||||||
#include <QColor>
|
#include <QColor>
|
||||||
#include <libtorrent/version.hpp>
|
#include <libtorrent/version.hpp>
|
||||||
|
|
||||||
#include "trackerlist.h"
|
#include "trackerlist.h"
|
||||||
#include "propertieswidget.h"
|
#include "propertieswidget.h"
|
||||||
#include "trackersadditiondlg.h"
|
#include "trackersadditiondlg.h"
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
#include "bittorrent.h"
|
#include "qbtsession.h"
|
||||||
#include "qinisettings.h"
|
#include "qinisettings.h"
|
||||||
|
|
||||||
TrackerList::TrackerList(PropertiesWidget *properties): QTreeWidget(), properties(properties) {
|
TrackerList::TrackerList(PropertiesWidget *properties): QTreeWidget(), properties(properties) {
|
||||||
// Graphical settings
|
// Graphical settings
|
||||||
setRootIsDecorated(false);
|
setRootIsDecorated(false);
|
||||||
setAllColumnsShowFocus(true);
|
setAllColumnsShowFocus(true);
|
||||||
setItemsExpandable(false);
|
setItemsExpandable(false);
|
||||||
setSelectionMode(QAbstractItemView::ExtendedSelection);
|
setSelectionMode(QAbstractItemView::ExtendedSelection);
|
||||||
// Context menu
|
// Context menu
|
||||||
setContextMenuPolicy(Qt::CustomContextMenu);
|
setContextMenuPolicy(Qt::CustomContextMenu);
|
||||||
connect(this, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(showTrackerListMenu(QPoint)));
|
connect(this, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(showTrackerListMenu(QPoint)));
|
||||||
// Set header
|
// Set header
|
||||||
QStringList header;
|
QStringList header;
|
||||||
header << tr("URL");
|
header << tr("URL");
|
||||||
header << tr("Status");
|
header << tr("Status");
|
||||||
header << tr("Peers");
|
header << tr("Peers");
|
||||||
header << tr("Message");
|
header << tr("Message");
|
||||||
setHeaderItem(new QTreeWidgetItem(header));
|
setHeaderItem(new QTreeWidgetItem(header));
|
||||||
dht_item = new QTreeWidgetItem(QStringList("** "+tr("[DHT]")+" **"));
|
dht_item = new QTreeWidgetItem(QStringList("** "+tr("[DHT]")+" **"));
|
||||||
insertTopLevelItem(0, dht_item);
|
insertTopLevelItem(0, dht_item);
|
||||||
setRowColor(0, QColor("grey"));
|
setRowColor(0, QColor("grey"));
|
||||||
pex_item = new QTreeWidgetItem(QStringList("** "+tr("[PeX]")+" **"));
|
pex_item = new QTreeWidgetItem(QStringList("** "+tr("[PeX]")+" **"));
|
||||||
insertTopLevelItem(1, pex_item);
|
insertTopLevelItem(1, pex_item);
|
||||||
setRowColor(1, QColor("grey"));
|
setRowColor(1, QColor("grey"));
|
||||||
lsd_item = new QTreeWidgetItem(QStringList("** "+tr("[LSD]")+" **"));
|
lsd_item = new QTreeWidgetItem(QStringList("** "+tr("[LSD]")+" **"));
|
||||||
insertTopLevelItem(2, lsd_item);
|
insertTopLevelItem(2, lsd_item);
|
||||||
setRowColor(2, QColor("grey"));
|
setRowColor(2, QColor("grey"));
|
||||||
loadSettings();
|
loadSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
TrackerList::~TrackerList() {
|
TrackerList::~TrackerList() {
|
||||||
saveSettings();
|
saveSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<QTreeWidgetItem*> TrackerList::getSelectedTrackerItems() const {
|
QList<QTreeWidgetItem*> TrackerList::getSelectedTrackerItems() const {
|
||||||
QList<QTreeWidgetItem*> selected_items = selectedItems();
|
QList<QTreeWidgetItem*> selected_items = selectedItems();
|
||||||
QList<QTreeWidgetItem*> selected_trackers;
|
QList<QTreeWidgetItem*> selected_trackers;
|
||||||
foreach(QTreeWidgetItem *item, selectedItems()) {
|
foreach(QTreeWidgetItem *item, selectedItems()) {
|
||||||
if(indexOfTopLevelItem(item) >= NB_STICKY_ITEM) { // Ignore STICKY ITEMS
|
if(indexOfTopLevelItem(item) >= NB_STICKY_ITEM) { // Ignore STICKY ITEMS
|
||||||
selected_trackers << item;
|
selected_trackers << item;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return selected_trackers;
|
return selected_trackers;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TrackerList::setRowColor(int row, QColor color) {
|
void TrackerList::setRowColor(int row, QColor color) {
|
||||||
unsigned int nbColumns = columnCount();
|
unsigned int nbColumns = columnCount();
|
||||||
QTreeWidgetItem *item = topLevelItem(row);
|
QTreeWidgetItem *item = topLevelItem(row);
|
||||||
for(unsigned int i=0; i<nbColumns; ++i) {
|
for(unsigned int i=0; i<nbColumns; ++i) {
|
||||||
item->setData(i, Qt::ForegroundRole, color);
|
item->setData(i, Qt::ForegroundRole, color);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TrackerList::moveSelectionUp() {
|
void TrackerList::moveSelectionUp() {
|
||||||
#if LIBTORRENT_VERSION_MINOR < 15
|
#if LIBTORRENT_VERSION_MINOR < 15
|
||||||
QTorrentHandle h = properties->getCurrentTorrent();
|
QTorrentHandle h = properties->getCurrentTorrent();
|
||||||
if(!h.is_valid()) {
|
if(!h.is_valid()) {
|
||||||
clear();
|
clear();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
QList<QTreeWidgetItem *> selected_items = getSelectedTrackerItems();
|
QList<QTreeWidgetItem *> selected_items = getSelectedTrackerItems();
|
||||||
if(selected_items.isEmpty()) return;
|
if(selected_items.isEmpty()) return;
|
||||||
bool change = false;
|
bool change = false;
|
||||||
foreach(QTreeWidgetItem *item, selected_items){
|
foreach(QTreeWidgetItem *item, selected_items){
|
||||||
int index = indexOfTopLevelItem(item);
|
int index = indexOfTopLevelItem(item);
|
||||||
if(index > NB_STICKY_ITEM) {
|
if(index > NB_STICKY_ITEM) {
|
||||||
insertTopLevelItem(index-1, takeTopLevelItem(index));
|
insertTopLevelItem(index-1, takeTopLevelItem(index));
|
||||||
change = true;
|
change = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!change) return;
|
if(!change) return;
|
||||||
// Restore selection
|
// Restore selection
|
||||||
QItemSelectionModel *selection = selectionModel();
|
QItemSelectionModel *selection = selectionModel();
|
||||||
foreach(QTreeWidgetItem *item, selected_items) {
|
foreach(QTreeWidgetItem *item, selected_items) {
|
||||||
selection->select(indexFromItem(item), QItemSelectionModel::Rows|QItemSelectionModel::Select);
|
selection->select(indexFromItem(item), QItemSelectionModel::Rows|QItemSelectionModel::Select);
|
||||||
}
|
}
|
||||||
setSelectionModel(selection);
|
setSelectionModel(selection);
|
||||||
// Update torrent trackers
|
// Update torrent trackers
|
||||||
std::vector<announce_entry> trackers;
|
std::vector<announce_entry> trackers;
|
||||||
for(int i=NB_STICKY_ITEM; i<topLevelItemCount(); ++i) {
|
for(int i=NB_STICKY_ITEM; i<topLevelItemCount(); ++i) {
|
||||||
QString tracker_url = topLevelItem(i)->data(COL_URL, Qt::DisplayRole).toString();
|
QString tracker_url = topLevelItem(i)->data(COL_URL, Qt::DisplayRole).toString();
|
||||||
announce_entry e(tracker_url.toStdString());
|
announce_entry e(tracker_url.toStdString());
|
||||||
e.tier = i-NB_STICKY_ITEM;
|
e.tier = i-NB_STICKY_ITEM;
|
||||||
trackers.push_back(e);
|
trackers.push_back(e);
|
||||||
}
|
}
|
||||||
h.replace_trackers(trackers);
|
h.replace_trackers(trackers);
|
||||||
// Reannounce
|
// Reannounce
|
||||||
h.force_reannounce();
|
h.force_reannounce();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void TrackerList::moveSelectionDown() {
|
void TrackerList::moveSelectionDown() {
|
||||||
#if LIBTORRENT_VERSION_MINOR < 15
|
#if LIBTORRENT_VERSION_MINOR < 15
|
||||||
QTorrentHandle h = properties->getCurrentTorrent();
|
QTorrentHandle h = properties->getCurrentTorrent();
|
||||||
if(!h.is_valid()) {
|
if(!h.is_valid()) {
|
||||||
clear();
|
clear();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
QList<QTreeWidgetItem *> selected_items = getSelectedTrackerItems();
|
QList<QTreeWidgetItem *> selected_items = getSelectedTrackerItems();
|
||||||
if(selected_items.isEmpty()) return;
|
if(selected_items.isEmpty()) return;
|
||||||
bool change = false;
|
bool change = false;
|
||||||
for(int i=selectedItems().size()-1; i>= 0; --i) {
|
for(int i=selectedItems().size()-1; i>= 0; --i) {
|
||||||
int index = indexOfTopLevelItem(selected_items.at(i));
|
int index = indexOfTopLevelItem(selected_items.at(i));
|
||||||
if(index < topLevelItemCount()-1) {
|
if(index < topLevelItemCount()-1) {
|
||||||
insertTopLevelItem(index+1, takeTopLevelItem(index));
|
insertTopLevelItem(index+1, takeTopLevelItem(index));
|
||||||
change = true;
|
change = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!change) return;
|
if(!change) return;
|
||||||
// Restore selection
|
// Restore selection
|
||||||
QItemSelectionModel *selection = selectionModel();
|
QItemSelectionModel *selection = selectionModel();
|
||||||
foreach(QTreeWidgetItem *item, selected_items) {
|
foreach(QTreeWidgetItem *item, selected_items) {
|
||||||
selection->select(indexFromItem(item), QItemSelectionModel::Rows|QItemSelectionModel::Select);
|
selection->select(indexFromItem(item), QItemSelectionModel::Rows|QItemSelectionModel::Select);
|
||||||
}
|
}
|
||||||
setSelectionModel(selection);
|
setSelectionModel(selection);
|
||||||
// Update torrent trackers
|
// Update torrent trackers
|
||||||
std::vector<announce_entry> trackers;
|
std::vector<announce_entry> trackers;
|
||||||
for(int i=NB_STICKY_ITEM; i<topLevelItemCount(); ++i) {
|
for(int i=NB_STICKY_ITEM; i<topLevelItemCount(); ++i) {
|
||||||
QString tracker_url = topLevelItem(i)->data(COL_URL, Qt::DisplayRole).toString();
|
QString tracker_url = topLevelItem(i)->data(COL_URL, Qt::DisplayRole).toString();
|
||||||
announce_entry e(tracker_url.toStdString());
|
announce_entry e(tracker_url.toStdString());
|
||||||
e.tier = i-NB_STICKY_ITEM;
|
e.tier = i-NB_STICKY_ITEM;
|
||||||
trackers.push_back(e);
|
trackers.push_back(e);
|
||||||
}
|
}
|
||||||
h.replace_trackers(trackers);
|
h.replace_trackers(trackers);
|
||||||
// Reannounce
|
// Reannounce
|
||||||
h.force_reannounce();
|
h.force_reannounce();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void TrackerList::clear() {
|
void TrackerList::clear() {
|
||||||
qDeleteAll(tracker_items.values());
|
qDeleteAll(tracker_items.values());
|
||||||
tracker_items.clear();
|
tracker_items.clear();
|
||||||
dht_item->setText(COL_PEERS, "");
|
dht_item->setText(COL_PEERS, "");
|
||||||
dht_item->setText(COL_STATUS, "");
|
dht_item->setText(COL_STATUS, "");
|
||||||
dht_item->setText(COL_MSG, "");
|
dht_item->setText(COL_MSG, "");
|
||||||
pex_item->setText(COL_PEERS, "");
|
pex_item->setText(COL_PEERS, "");
|
||||||
pex_item->setText(COL_STATUS, "");
|
pex_item->setText(COL_STATUS, "");
|
||||||
pex_item->setText(COL_MSG, "");
|
pex_item->setText(COL_MSG, "");
|
||||||
lsd_item->setText(COL_PEERS, "");
|
lsd_item->setText(COL_PEERS, "");
|
||||||
lsd_item->setText(COL_STATUS, "");
|
lsd_item->setText(COL_STATUS, "");
|
||||||
lsd_item->setText(COL_MSG, "");
|
lsd_item->setText(COL_MSG, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
void TrackerList::loadStickyItems(const QTorrentHandle &h) {
|
void TrackerList::loadStickyItems(const QTorrentHandle &h) {
|
||||||
// XXX: libtorrent should provide this info...
|
// XXX: libtorrent should provide this info...
|
||||||
// Count peers from DHT, LSD, PeX
|
// Count peers from DHT, LSD, PeX
|
||||||
uint nb_dht=0, nb_lsd=0, nb_pex=0;
|
uint nb_dht=0, nb_lsd=0, nb_pex=0;
|
||||||
std::vector<peer_info> peers;
|
std::vector<peer_info> peers;
|
||||||
h.get_peer_info(peers);
|
h.get_peer_info(peers);
|
||||||
std::vector<peer_info>::iterator it;
|
std::vector<peer_info>::iterator it;
|
||||||
for(it=peers.begin(); it!=peers.end(); it++) {
|
for(it=peers.begin(); it!=peers.end(); it++) {
|
||||||
if(it->source & peer_info::dht)
|
if(it->source & peer_info::dht)
|
||||||
++nb_dht;
|
++nb_dht;
|
||||||
if(it->source & peer_info::lsd)
|
if(it->source & peer_info::lsd)
|
||||||
++nb_lsd;
|
++nb_lsd;
|
||||||
if(it->source & peer_info::pex)
|
if(it->source & peer_info::pex)
|
||||||
++nb_pex;
|
++nb_pex;
|
||||||
}
|
}
|
||||||
// load DHT information
|
// load DHT information
|
||||||
if(properties->getBTSession()->isDHTEnabled() && h.has_metadata() && !h.priv()) {
|
if(properties->getBTSession()->isDHTEnabled() && h.has_metadata() && !h.priv()) {
|
||||||
dht_item->setText(COL_STATUS, tr("Working"));
|
dht_item->setText(COL_STATUS, tr("Working"));
|
||||||
} else {
|
} else {
|
||||||
dht_item->setText(COL_STATUS, tr("Disabled"));
|
dht_item->setText(COL_STATUS, tr("Disabled"));
|
||||||
}
|
}
|
||||||
dht_item->setText(COL_PEERS, QString::number(nb_dht));
|
dht_item->setText(COL_PEERS, QString::number(nb_dht));
|
||||||
if(h.has_metadata() && h.priv()) {
|
if(h.has_metadata() && h.priv()) {
|
||||||
dht_item->setText(COL_MSG, tr("This torrent is private"));
|
dht_item->setText(COL_MSG, tr("This torrent is private"));
|
||||||
}
|
}
|
||||||
// Load PeX Information
|
// Load PeX Information
|
||||||
if(properties->getBTSession()->isPexEnabled())
|
if(properties->getBTSession()->isPexEnabled())
|
||||||
pex_item->setText(COL_STATUS, tr("Working"));
|
pex_item->setText(COL_STATUS, tr("Working"));
|
||||||
else
|
else
|
||||||
pex_item->setText(COL_STATUS, tr("Disabled"));
|
pex_item->setText(COL_STATUS, tr("Disabled"));
|
||||||
pex_item->setText(COL_PEERS, QString::number(nb_pex));
|
pex_item->setText(COL_PEERS, QString::number(nb_pex));
|
||||||
// Load LSD Information
|
// Load LSD Information
|
||||||
if(properties->getBTSession()->isLSDEnabled())
|
if(properties->getBTSession()->isLSDEnabled())
|
||||||
lsd_item->setText(COL_STATUS, tr("Working"));
|
lsd_item->setText(COL_STATUS, tr("Working"));
|
||||||
else
|
else
|
||||||
lsd_item->setText(COL_STATUS, tr("Disabled"));
|
lsd_item->setText(COL_STATUS, tr("Disabled"));
|
||||||
lsd_item->setText(COL_PEERS, QString::number(nb_lsd));
|
lsd_item->setText(COL_PEERS, QString::number(nb_lsd));
|
||||||
}
|
}
|
||||||
|
|
||||||
void TrackerList::loadTrackers() {
|
void TrackerList::loadTrackers() {
|
||||||
// Load trackers from torrent handle
|
// Load trackers from torrent handle
|
||||||
QTorrentHandle h = properties->getCurrentTorrent();
|
QTorrentHandle h = properties->getCurrentTorrent();
|
||||||
if(!h.is_valid()) return;
|
if(!h.is_valid()) return;
|
||||||
loadStickyItems(h);
|
loadStickyItems(h);
|
||||||
// Load actual trackers information
|
// Load actual trackers information
|
||||||
QHash<QString, TrackerInfos> trackers_data = properties->getBTSession()->getTrackersInfo(h.hash());
|
QHash<QString, TrackerInfos> trackers_data = properties->getBTSession()->getTrackersInfo(h.hash());
|
||||||
QStringList old_trackers_urls = tracker_items.keys();
|
QStringList old_trackers_urls = tracker_items.keys();
|
||||||
const std::vector<announce_entry> trackers = h.trackers();
|
const std::vector<announce_entry> trackers = h.trackers();
|
||||||
for(std::vector<announce_entry>::const_iterator it = trackers.begin(); it != trackers.end(); it++) {
|
for(std::vector<announce_entry>::const_iterator it = trackers.begin(); it != trackers.end(); it++) {
|
||||||
QString tracker_url = misc::toQString(it->url);
|
QString tracker_url = misc::toQString(it->url);
|
||||||
QTreeWidgetItem *item = tracker_items.value(tracker_url, 0);
|
QTreeWidgetItem *item = tracker_items.value(tracker_url, 0);
|
||||||
if(!item) {
|
if(!item) {
|
||||||
item = new QTreeWidgetItem();
|
item = new QTreeWidgetItem();
|
||||||
item->setText(COL_URL, tracker_url);
|
item->setText(COL_URL, tracker_url);
|
||||||
addTopLevelItem(item);
|
addTopLevelItem(item);
|
||||||
tracker_items[tracker_url] = item;
|
tracker_items[tracker_url] = item;
|
||||||
} else {
|
} else {
|
||||||
old_trackers_urls.removeOne(tracker_url);
|
old_trackers_urls.removeOne(tracker_url);
|
||||||
}
|
}
|
||||||
TrackerInfos data = trackers_data.value(tracker_url, TrackerInfos(tracker_url));
|
TrackerInfos data = trackers_data.value(tracker_url, TrackerInfos(tracker_url));
|
||||||
QString error_message = data.last_message.trimmed();
|
QString error_message = data.last_message.trimmed();
|
||||||
#if LIBTORRENT_VERSION_MINOR > 14
|
#if LIBTORRENT_VERSION_MINOR > 14
|
||||||
if(it->verified) {
|
if(it->verified) {
|
||||||
item->setText(COL_STATUS, tr("Working"));
|
item->setText(COL_STATUS, tr("Working"));
|
||||||
item->setText(COL_MSG, "");
|
item->setText(COL_MSG, "");
|
||||||
} else {
|
} else {
|
||||||
if(it->updating && it->fails == 0) {
|
if(it->updating && it->fails == 0) {
|
||||||
item->setText(COL_STATUS, tr("Updating..."));
|
item->setText(COL_STATUS, tr("Updating..."));
|
||||||
item->setText(COL_MSG, "");
|
item->setText(COL_MSG, "");
|
||||||
} else {
|
} else {
|
||||||
if(it->fails > 0) {
|
if(it->fails > 0) {
|
||||||
item->setText(COL_STATUS, tr("Not working"));
|
item->setText(COL_STATUS, tr("Not working"));
|
||||||
item->setText(COL_MSG, error_message);
|
item->setText(COL_MSG, error_message);
|
||||||
} else {
|
} else {
|
||||||
item->setText(COL_STATUS, tr("Not contacted yet"));
|
item->setText(COL_STATUS, tr("Not contacted yet"));
|
||||||
item->setText(COL_MSG, "");
|
item->setText(COL_MSG, "");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
if(data.verified) {
|
if(data.verified) {
|
||||||
item->setText(COL_STATUS, tr("Working"));
|
item->setText(COL_STATUS, tr("Working"));
|
||||||
item->setText(COL_MSG, "");
|
item->setText(COL_MSG, "");
|
||||||
} else {
|
} else {
|
||||||
if(data.fail_count > 0) {
|
if(data.fail_count > 0) {
|
||||||
item->setText(COL_STATUS, tr("Not working"));
|
item->setText(COL_STATUS, tr("Not working"));
|
||||||
item->setText(COL_MSG, error_message);
|
item->setText(COL_MSG, error_message);
|
||||||
} else {
|
} else {
|
||||||
item->setText(COL_STATUS, tr("Not contacted yet"));
|
item->setText(COL_STATUS, tr("Not contacted yet"));
|
||||||
item->setText(COL_MSG, "");
|
item->setText(COL_MSG, "");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
item->setText(COL_PEERS, QString::number(trackers_data.value(tracker_url, TrackerInfos(tracker_url)).num_peers));
|
item->setText(COL_PEERS, QString::number(trackers_data.value(tracker_url, TrackerInfos(tracker_url)).num_peers));
|
||||||
}
|
}
|
||||||
// Remove old trackers
|
// Remove old trackers
|
||||||
foreach(const QString &tracker, old_trackers_urls) {
|
foreach(const QString &tracker, old_trackers_urls) {
|
||||||
delete tracker_items.take(tracker);
|
delete tracker_items.take(tracker);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ask the user for new trackers and add them to the torrent
|
// Ask the user for new trackers and add them to the torrent
|
||||||
void TrackerList::askForTrackers(){
|
void TrackerList::askForTrackers(){
|
||||||
QTorrentHandle h = properties->getCurrentTorrent();
|
QTorrentHandle h = properties->getCurrentTorrent();
|
||||||
if(!h.is_valid()) return;
|
if(!h.is_valid()) return;
|
||||||
QStringList trackers = TrackersAdditionDlg::askForTrackers(h);
|
QStringList trackers = TrackersAdditionDlg::askForTrackers(h);
|
||||||
if(!trackers.empty()) {
|
if(!trackers.empty()) {
|
||||||
foreach(const QString& tracker, trackers) {
|
foreach(const QString& tracker, trackers) {
|
||||||
announce_entry url(tracker.toStdString());
|
announce_entry url(tracker.toStdString());
|
||||||
url.tier = 0;
|
url.tier = 0;
|
||||||
h.add_tracker(url);
|
h.add_tracker(url);
|
||||||
}
|
}
|
||||||
// Reannounce to new trackers
|
// Reannounce to new trackers
|
||||||
h.force_reannounce();
|
h.force_reannounce();
|
||||||
// Reload tracker list
|
// Reload tracker list
|
||||||
loadTrackers();
|
loadTrackers();
|
||||||
// XXX: I don't think this is necessary now
|
// XXX: I don't think this is necessary now
|
||||||
//BTSession->saveTrackerFile(h.hash());
|
//BTSession->saveTrackerFile(h.hash());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TrackerList::deleteSelectedTrackers(){
|
void TrackerList::deleteSelectedTrackers(){
|
||||||
QTorrentHandle h = properties->getCurrentTorrent();
|
QTorrentHandle h = properties->getCurrentTorrent();
|
||||||
if(!h.is_valid()) {
|
if(!h.is_valid()) {
|
||||||
clear();
|
clear();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
QList<QTreeWidgetItem *> selected_items = getSelectedTrackerItems();
|
QList<QTreeWidgetItem *> selected_items = getSelectedTrackerItems();
|
||||||
if(selected_items.isEmpty()) return;
|
if(selected_items.isEmpty()) return;
|
||||||
QStringList urls_to_remove;
|
QStringList urls_to_remove;
|
||||||
foreach(QTreeWidgetItem *item, selected_items){
|
foreach(QTreeWidgetItem *item, selected_items){
|
||||||
QString tracker_url = item->data(COL_URL, Qt::DisplayRole).toString();
|
QString tracker_url = item->data(COL_URL, Qt::DisplayRole).toString();
|
||||||
urls_to_remove << tracker_url;
|
urls_to_remove << tracker_url;
|
||||||
tracker_items.remove(tracker_url);
|
tracker_items.remove(tracker_url);
|
||||||
delete item;
|
delete item;
|
||||||
}
|
}
|
||||||
// Iterate of trackers and remove selected ones
|
// Iterate of trackers and remove selected ones
|
||||||
std::vector<announce_entry> trackers = h.trackers();
|
std::vector<announce_entry> trackers = h.trackers();
|
||||||
std::vector<announce_entry>::iterator it = trackers.begin();
|
std::vector<announce_entry>::iterator it = trackers.begin();
|
||||||
while(it != trackers.end()) {
|
while(it != trackers.end()) {
|
||||||
int index = urls_to_remove.indexOf(misc::toQString((*it).url));
|
int index = urls_to_remove.indexOf(misc::toQString((*it).url));
|
||||||
if(index >= 0) {
|
if(index >= 0) {
|
||||||
trackers.erase(it);
|
trackers.erase(it);
|
||||||
urls_to_remove.removeAt(index);
|
urls_to_remove.removeAt(index);
|
||||||
} else {
|
} else {
|
||||||
it++;
|
it++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
h.replace_trackers(trackers);
|
h.replace_trackers(trackers);
|
||||||
h.force_reannounce();
|
h.force_reannounce();
|
||||||
// Reload Trackers
|
// Reload Trackers
|
||||||
loadTrackers();
|
loadTrackers();
|
||||||
//XXX: I don't think this is necessary
|
//XXX: I don't think this is necessary
|
||||||
//BTSession->saveTrackerFile(h.hash());
|
//BTSession->saveTrackerFile(h.hash());
|
||||||
}
|
}
|
||||||
|
|
||||||
void TrackerList::showTrackerListMenu(QPoint) {
|
void TrackerList::showTrackerListMenu(QPoint) {
|
||||||
QTorrentHandle h = properties->getCurrentTorrent();
|
QTorrentHandle h = properties->getCurrentTorrent();
|
||||||
if(!h.is_valid() || !h.has_metadata()) return;
|
if(!h.is_valid() || !h.has_metadata()) return;
|
||||||
//QList<QTreeWidgetItem*> selected_items = getSelectedTrackerItems();
|
//QList<QTreeWidgetItem*> selected_items = getSelectedTrackerItems();
|
||||||
QMenu menu;
|
QMenu menu;
|
||||||
// Add actions
|
// Add actions
|
||||||
QAction *addAct = menu.addAction(QIcon(":/Icons/oxygen/list-add.png"), tr("Add a new tracker..."));
|
QAction *addAct = menu.addAction(QIcon(":/Icons/oxygen/list-add.png"), tr("Add a new tracker..."));
|
||||||
QAction *delAct = 0;
|
QAction *delAct = 0;
|
||||||
if(!getSelectedTrackerItems().isEmpty()) {
|
if(!getSelectedTrackerItems().isEmpty()) {
|
||||||
delAct = menu.addAction(QIcon(":/Icons/oxygen/list-remove.png"), tr("Remove tracker"));
|
delAct = menu.addAction(QIcon(":/Icons/oxygen/list-remove.png"), tr("Remove tracker"));
|
||||||
}
|
}
|
||||||
menu.addSeparator();
|
menu.addSeparator();
|
||||||
QAction *reannounceAct = menu.addAction(QIcon(":/Icons/oxygen/run-build.png"), tr("Force reannounce"));
|
QAction *reannounceAct = menu.addAction(QIcon(":/Icons/oxygen/run-build.png"), tr("Force reannounce"));
|
||||||
QAction *act = menu.exec(QCursor::pos());
|
QAction *act = menu.exec(QCursor::pos());
|
||||||
if(act == 0) return;
|
if(act == 0) return;
|
||||||
if(act == addAct) {
|
if(act == addAct) {
|
||||||
askForTrackers();
|
askForTrackers();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(act == delAct) {
|
if(act == delAct) {
|
||||||
deleteSelectedTrackers();
|
deleteSelectedTrackers();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(act == reannounceAct) {
|
if(act == reannounceAct) {
|
||||||
properties->getCurrentTorrent().force_reannounce();
|
properties->getCurrentTorrent().force_reannounce();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TrackerList::loadSettings() {
|
void TrackerList::loadSettings() {
|
||||||
QIniSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
|
QIniSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
|
||||||
QList<int> contentColsWidths = misc::intListfromStringList(settings.value(QString::fromUtf8("TorrentProperties/Trackers/trackersColsWidth")).toStringList());
|
QList<int> contentColsWidths = misc::intListfromStringList(settings.value(QString::fromUtf8("TorrentProperties/Trackers/trackersColsWidth")).toStringList());
|
||||||
if(!contentColsWidths.empty()) {
|
if(!contentColsWidths.empty()) {
|
||||||
for(int i=0; i<contentColsWidths.size(); ++i) {
|
for(int i=0; i<contentColsWidths.size(); ++i) {
|
||||||
setColumnWidth(i, contentColsWidths.at(i));
|
setColumnWidth(i, contentColsWidths.at(i));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
setColumnWidth(0, 300);
|
setColumnWidth(0, 300);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TrackerList::saveSettings() const {
|
void TrackerList::saveSettings() const {
|
||||||
QIniSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
|
QIniSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
|
||||||
QStringList contentColsWidths;
|
QStringList contentColsWidths;
|
||||||
for(int i=0; i<columnCount(); ++i) {
|
for(int i=0; i<columnCount(); ++i) {
|
||||||
contentColsWidths << QString::number(columnWidth(i));
|
contentColsWidths << QString::number(columnWidth(i));
|
||||||
}
|
}
|
||||||
settings.setValue(QString::fromUtf8("TorrentProperties/Trackers/trackersColsWidth"), contentColsWidths);
|
settings.setValue(QString::fromUtf8("TorrentProperties/Trackers/trackersColsWidth"), contentColsWidths);
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "transferlistwidget.h"
|
#include "transferlistwidget.h"
|
||||||
#include "bittorrent.h"
|
#include "qbtsession.h"
|
||||||
#include "torrentpersistentdata.h"
|
#include "torrentpersistentdata.h"
|
||||||
#include "transferlistdelegate.h"
|
#include "transferlistdelegate.h"
|
||||||
#include "previewselect.h"
|
#include "previewselect.h"
|
||||||
|
@ -1,37 +0,0 @@
|
|||||||
<!DOCTYPE RCC><RCC version="1.0">
|
|
||||||
<qresource>
|
|
||||||
<file>webui/index.html</file>
|
|
||||||
<file>webui/download.html</file>
|
|
||||||
<file>webui/addtrackers.html</file>
|
|
||||||
<file>webui/upload.html</file>
|
|
||||||
<file>webui/uploadframe.html</file>
|
|
||||||
<file>webui/about.html</file>
|
|
||||||
<file>webui/filters.html</file>
|
|
||||||
<file>webui/transferlist.html</file>
|
|
||||||
<file>webui/prop-general.html</file>
|
|
||||||
<file>webui/prop-trackers.html</file>
|
|
||||||
<file>webui/prop-files.html</file>
|
|
||||||
<file>webui/properties.html</file>
|
|
||||||
<file>webui/uploadlimit.html</file>
|
|
||||||
<file>webui/downloadlimit.html</file>
|
|
||||||
<file>webui/preferences.html</file>
|
|
||||||
<file>webui/preferences_content.html</file>
|
|
||||||
<file>webui/css/Core.css</file>
|
|
||||||
<file>webui/css/Layout.css</file>
|
|
||||||
<file>webui/css/Window.css</file>
|
|
||||||
<file>webui/css/Tabs.css</file>
|
|
||||||
<file>webui/css/dynamicTable.css</file>
|
|
||||||
<file>webui/css/style.css</file>
|
|
||||||
<file>webui/scripts/excanvas-compressed.js</file>
|
|
||||||
<file>webui/scripts/mocha-yc.js</file>
|
|
||||||
<file>webui/scripts/mocha-init.js</file>
|
|
||||||
<file>webui/scripts/mootools-1.2-core-yc.js</file>
|
|
||||||
<file>webui/scripts/mootools-1.2-more.js</file>
|
|
||||||
<file>webui/scripts/dynamicTable.js</file>
|
|
||||||
<file>webui/scripts/client.js</file>
|
|
||||||
<file>webui/scripts/download.js</file>
|
|
||||||
<file>webui/scripts/progressbar.js</file>
|
|
||||||
<file>webui/scripts/contextmenu.js</file>
|
|
||||||
<file>webui/scripts/parametrics.js</file>
|
|
||||||
</qresource>
|
|
||||||
</RCC>
|
|
@ -31,7 +31,7 @@
|
|||||||
|
|
||||||
#include <libtorrent/version.hpp>
|
#include <libtorrent/version.hpp>
|
||||||
#include "eventmanager.h"
|
#include "eventmanager.h"
|
||||||
#include "bittorrent.h"
|
#include "qbtsession.h"
|
||||||
#include "scannedfoldersmodel.h"
|
#include "scannedfoldersmodel.h"
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
#include "preferences.h"
|
#include "preferences.h"
|
@ -34,7 +34,7 @@
|
|||||||
#include "eventmanager.h"
|
#include "eventmanager.h"
|
||||||
#include "preferences.h"
|
#include "preferences.h"
|
||||||
#include "json.h"
|
#include "json.h"
|
||||||
#include "bittorrent.h"
|
#include "qbtsession.h"
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
#include <QTcpSocket>
|
#include <QTcpSocket>
|
||||||
#include <QDateTime>
|
#include <QDateTime>
|
||||||
@ -47,7 +47,7 @@
|
|||||||
#include <QTemporaryFile>
|
#include <QTemporaryFile>
|
||||||
|
|
||||||
HttpConnection::HttpConnection(QTcpSocket *socket, Bittorrent *BTSession, HttpServer *parent)
|
HttpConnection::HttpConnection(QTcpSocket *socket, Bittorrent *BTSession, HttpServer *parent)
|
||||||
: QObject(parent), socket(socket), parent(parent), BTSession(BTSession)
|
: QObject(parent), socket(socket), parent(parent), BTSession(BTSession)
|
||||||
{
|
{
|
||||||
socket->setParent(this);
|
socket->setParent(this);
|
||||||
connect(socket, SIGNAL(readyRead()), this, SLOT(read()));
|
connect(socket, SIGNAL(readyRead()), this, SLOT(read()));
|
||||||
@ -231,10 +231,13 @@ void HttpConnection::respond() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (list[0] == "images")
|
if (list[0] == "images") {
|
||||||
list[0] = "Icons";
|
list[0] = "Icons";
|
||||||
else
|
} else {
|
||||||
|
if(list.last().endsWith(".html"))
|
||||||
|
list.prepend("html");
|
||||||
list.prepend("webui");
|
list.prepend("webui");
|
||||||
|
}
|
||||||
url = ":/" + list.join("/");
|
url = ":/" + list.join("/");
|
||||||
QFile file(url);
|
QFile file(url);
|
||||||
if(!file.open(QIODevice::ReadOnly))
|
if(!file.open(QIODevice::ReadOnly))
|
@ -32,7 +32,7 @@
|
|||||||
#include "httpserver.h"
|
#include "httpserver.h"
|
||||||
#include "httpconnection.h"
|
#include "httpconnection.h"
|
||||||
#include "eventmanager.h"
|
#include "eventmanager.h"
|
||||||
#include "bittorrent.h"
|
#include "qbtsession.h"
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <QCryptographicHash>
|
#include <QCryptographicHash>
|
||||||
#include <QTime>
|
#include <QTime>
|
16
src/webui/webui.pri
Normal file
16
src/webui/webui.pri
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
INCLUDEPATH += $$PWD
|
||||||
|
|
||||||
|
HEADERS += $$PWD/httpserver.h \
|
||||||
|
$$PWD/httpconnection.h \
|
||||||
|
$$PWD/httprequestparser.h \
|
||||||
|
$$PWD/httpresponsegenerator.h \
|
||||||
|
$$PWD/eventmanager.h \
|
||||||
|
$$PWD/json.h
|
||||||
|
|
||||||
|
SOURCES += $$PWD/httpserver.cpp \
|
||||||
|
$$PWD/httpconnection.cpp \
|
||||||
|
$$PWD/httprequestparser.cpp \
|
||||||
|
$$PWD/httpresponsegenerator.cpp \
|
||||||
|
$$PWD/eventmanager.cpp
|
||||||
|
|
||||||
|
RESOURCES += $$PWD/webui.qrc
|
37
src/webui/webui.qrc
Normal file
37
src/webui/webui.qrc
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
<!DOCTYPE RCC><RCC version="1.0">
|
||||||
|
<qresource prefix="webui/">
|
||||||
|
<file>html/index.html</file>
|
||||||
|
<file>html/download.html</file>
|
||||||
|
<file>html/addtrackers.html</file>
|
||||||
|
<file>html/upload.html</file>
|
||||||
|
<file>html/uploadframe.html</file>
|
||||||
|
<file>html/about.html</file>
|
||||||
|
<file>html/filters.html</file>
|
||||||
|
<file>html/transferlist.html</file>
|
||||||
|
<file>html/prop-general.html</file>
|
||||||
|
<file>html/prop-trackers.html</file>
|
||||||
|
<file>html/prop-files.html</file>
|
||||||
|
<file>html/properties.html</file>
|
||||||
|
<file>html/uploadlimit.html</file>
|
||||||
|
<file>html/downloadlimit.html</file>
|
||||||
|
<file>html/preferences.html</file>
|
||||||
|
<file>html/preferences_content.html</file>
|
||||||
|
<file>css/Core.css</file>
|
||||||
|
<file>css/Layout.css</file>
|
||||||
|
<file>css/Window.css</file>
|
||||||
|
<file>css/Tabs.css</file>
|
||||||
|
<file>css/dynamicTable.css</file>
|
||||||
|
<file>css/style.css</file>
|
||||||
|
<file>scripts/excanvas-compressed.js</file>
|
||||||
|
<file>scripts/mocha-yc.js</file>
|
||||||
|
<file>scripts/mocha-init.js</file>
|
||||||
|
<file>scripts/mootools-1.2-core-yc.js</file>
|
||||||
|
<file>scripts/mootools-1.2-more.js</file>
|
||||||
|
<file>scripts/dynamicTable.js</file>
|
||||||
|
<file>scripts/client.js</file>
|
||||||
|
<file>scripts/download.js</file>
|
||||||
|
<file>scripts/progressbar.js</file>
|
||||||
|
<file>scripts/contextmenu.js</file>
|
||||||
|
<file>scripts/parametrics.js</file>
|
||||||
|
</qresource>
|
||||||
|
</RCC>
|
Loading…
Reference in New Issue
Block a user