mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-10 23:07:59 +00:00
Merge msvc fixes from stable branch
This commit is contained in:
parent
682377ff66
commit
8ec1621334
@ -288,13 +288,13 @@ void Bittorrent::configureSession() {
|
|||||||
startTorrentsInPause(Preferences::addTorrentsInPause());
|
startTorrentsInPause(Preferences::addTorrentsInPause());
|
||||||
// * Scan dirs
|
// * Scan dirs
|
||||||
const QStringList &scan_dirs = Preferences::getScanDirs();
|
const QStringList &scan_dirs = Preferences::getScanDirs();
|
||||||
QVariantList downloadInDirList = Preferences::getDownloadInScanDirs();
|
QList<bool> downloadInDirList = Preferences::getDownloadInScanDirs();
|
||||||
while(scan_dirs.size() > downloadInDirList.size()) {
|
while(scan_dirs.size() > downloadInDirList.size()) {
|
||||||
downloadInDirList << QVariant(false);
|
downloadInDirList << false;
|
||||||
}
|
}
|
||||||
int i = 0;
|
int i = 0;
|
||||||
foreach (const QString &dir, scan_dirs) {
|
foreach (const QString &dir, scan_dirs) {
|
||||||
m_scanFolders->addPath(dir, downloadInDirList.at(i).toBool());
|
m_scanFolders->addPath(dir, downloadInDirList.at(i));
|
||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
// * Export Dir
|
// * Export Dir
|
||||||
|
@ -133,7 +133,11 @@ void EventManager::setGlobalPreferences(QVariantMap m) const {
|
|||||||
if(m.contains("temp_path"))
|
if(m.contains("temp_path"))
|
||||||
Preferences::setTempPath(m["temp_path"].toString());
|
Preferences::setTempPath(m["temp_path"].toString());
|
||||||
if(m.contains("scan_dirs") && m.contains("download_in_scan_dirs")) {
|
if(m.contains("scan_dirs") && m.contains("download_in_scan_dirs")) {
|
||||||
QVariantList download_at_path = m["download_in_scan_dirs"].toList();
|
QVariantList download_at_path_tmp = m["download_in_scan_dirs"].toList();
|
||||||
|
QList<bool> download_at_path;
|
||||||
|
foreach(QVariant var, download_at_path_tmp) {
|
||||||
|
download_at_path << var.toBool();
|
||||||
|
}
|
||||||
QStringList old_folders = Preferences::getScanDirs();
|
QStringList old_folders = Preferences::getScanDirs();
|
||||||
QStringList new_folders = m["scan_dirs"].toStringList();
|
QStringList new_folders = m["scan_dirs"].toStringList();
|
||||||
if(download_at_path.size() == new_folders.size()) {
|
if(download_at_path.size() == new_folders.size()) {
|
||||||
@ -149,7 +153,7 @@ void EventManager::setGlobalPreferences(QVariantMap m) const {
|
|||||||
foreach(const QString &new_folder, new_folders) {
|
foreach(const QString &new_folder, new_folders) {
|
||||||
// Update new folders
|
// Update new folders
|
||||||
if(!old_folders.contains(new_folder)) {
|
if(!old_folders.contains(new_folder)) {
|
||||||
BTSession->getScanFoldersModel()->addPath(new_folder, download_at_path.at(i).toBool());
|
BTSession->getScanFoldersModel()->addPath(new_folder, download_at_path.at(i));
|
||||||
}
|
}
|
||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
@ -258,7 +262,11 @@ QVariantMap EventManager::getGlobalPreferences() const {
|
|||||||
data["temp_path_enabled"] = Preferences::isTempPathEnabled();
|
data["temp_path_enabled"] = Preferences::isTempPathEnabled();
|
||||||
data["temp_path"] = Preferences::getTempPath();
|
data["temp_path"] = Preferences::getTempPath();
|
||||||
data["scan_dirs"] = Preferences::getScanDirs();
|
data["scan_dirs"] = Preferences::getScanDirs();
|
||||||
data["download_in_scan_dirs"] = Preferences::getDownloadInScanDirs();
|
QVariantList var_list;
|
||||||
|
foreach(bool b, Preferences::getDownloadInScanDirs()) {
|
||||||
|
var_list << b;
|
||||||
|
}
|
||||||
|
data["download_in_scan_dirs"] = var_list;
|
||||||
data["export_dir_enabled"] = Preferences::isTorrentExportEnabled();
|
data["export_dir_enabled"] = Preferences::isTorrentExportEnabled();
|
||||||
data["export_dir"] = Preferences::getExportDir();
|
data["export_dir"] = Preferences::getExportDir();
|
||||||
data["preallocate_all"] = Preferences::preAllocateAllFiles();
|
data["preallocate_all"] = Preferences::preAllocateAllFiles();
|
||||||
|
32
src/misc.cpp
32
src/misc.cpp
@ -75,7 +75,7 @@ QString misc::QDesktopServicesDataLocation() {
|
|||||||
if (!QCoreApplication::applicationName().isEmpty())
|
if (!QCoreApplication::applicationName().isEmpty())
|
||||||
result = result + QLatin1String("\\") + qApp->applicationName();
|
result = result + QLatin1String("\\") + qApp->applicationName();
|
||||||
if(!result.endsWith("\\"))
|
if(!result.endsWith("\\"))
|
||||||
result += "\\";
|
result += "\\";
|
||||||
return result;
|
return result;
|
||||||
#else
|
#else
|
||||||
#ifdef Q_WS_MAC
|
#ifdef Q_WS_MAC
|
||||||
@ -544,3 +544,33 @@ QString misc::userFriendlyDuration(qlonglong seconds) {
|
|||||||
}
|
}
|
||||||
return QString::fromUtf8("∞");
|
return QString::fromUtf8("∞");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QStringList misc::toStringList(const QList<bool> &l) {
|
||||||
|
QStringList ret;
|
||||||
|
foreach(const bool &b, l) {
|
||||||
|
if(b)
|
||||||
|
ret << "1";
|
||||||
|
else
|
||||||
|
ret << "0";
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
QList<int> misc::intListfromStringList(const QStringList &l) {
|
||||||
|
QList<int> ret;
|
||||||
|
foreach(const QString &s, l) {
|
||||||
|
ret << s.toInt();
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
QList<bool> misc::boolListfromStringList(const QStringList &l) {
|
||||||
|
QList<bool> ret;
|
||||||
|
foreach(const QString &s, l) {
|
||||||
|
if(s == "1")
|
||||||
|
ret << true;
|
||||||
|
else
|
||||||
|
ret << false;
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
@ -121,6 +121,11 @@ public:
|
|||||||
// Take a number of seconds and return an user-friendly
|
// Take a number of seconds and return an user-friendly
|
||||||
// time duration like "1d 2h 10m".
|
// time duration like "1d 2h 10m".
|
||||||
static QString userFriendlyDuration(qlonglong seconds);
|
static QString userFriendlyDuration(qlonglong seconds);
|
||||||
|
|
||||||
|
// Convert functions
|
||||||
|
static QStringList toStringList(const QList<bool> &l);
|
||||||
|
static QList<int> intListfromStringList(const QStringList &l);
|
||||||
|
static QList<bool> boolListfromStringList(const QStringList &l);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Trick to get a portable sleep() function
|
// Trick to get a portable sleep() function
|
||||||
|
@ -44,8 +44,6 @@
|
|||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
Q_DECLARE_METATYPE(QList<int>)
|
|
||||||
|
|
||||||
PeerListWidget::PeerListWidget(PropertiesWidget *parent): properties(parent), display_flags(false) {
|
PeerListWidget::PeerListWidget(PropertiesWidget *parent): properties(parent), display_flags(false) {
|
||||||
// Visual settings
|
// Visual settings
|
||||||
setRootIsDecorated(false);
|
setRootIsDecorated(false);
|
||||||
@ -246,7 +244,7 @@ void PeerListWidget::clear() {
|
|||||||
|
|
||||||
void PeerListWidget::loadSettings() {
|
void PeerListWidget::loadSettings() {
|
||||||
QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
|
QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
|
||||||
QList<int> contentColsWidths = settings.value(QString::fromUtf8("TorrentProperties/Peers/peersColsWidth"), QVariantList()).value<QList<int> >();
|
QList<int> contentColsWidths = misc::intListfromStringList(settings.value(QString::fromUtf8("TorrentProperties/Peers/peersColsWidth")).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));
|
||||||
@ -268,11 +266,11 @@ void PeerListWidget::loadSettings() {
|
|||||||
|
|
||||||
void PeerListWidget::saveSettings() const {
|
void PeerListWidget::saveSettings() const {
|
||||||
QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
|
QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
|
||||||
QList<int> contentColsWidths;
|
QStringList contentColsWidths;
|
||||||
for(int i=0; i<listModel->columnCount(); ++i) {
|
for(int i=0; i<listModel->columnCount(); ++i) {
|
||||||
contentColsWidths.append(columnWidth(i));
|
contentColsWidths << QString::number(columnWidth(i));
|
||||||
}
|
}
|
||||||
settings.setValue(QString::fromUtf8("TorrentProperties/Peers/peersColsWidth"), QVariant::fromValue<QList<int> >(contentColsWidths));
|
settings.setValue(QString::fromUtf8("TorrentProperties/Peers/peersColsWidth"), contentColsWidths);
|
||||||
// Save sorted column
|
// Save sorted column
|
||||||
Qt::SortOrder sortOrder = header()->sortIndicatorOrder();
|
Qt::SortOrder sortOrder = header()->sortIndicatorOrder();
|
||||||
QString sortOrderLetter;
|
QString sortOrderLetter;
|
||||||
|
@ -36,6 +36,7 @@
|
|||||||
#include <QPair>
|
#include <QPair>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QTime>
|
#include <QTime>
|
||||||
|
#include <QList>
|
||||||
|
|
||||||
#ifndef DISABLE_GUI
|
#ifndef DISABLE_GUI
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
@ -47,6 +48,8 @@
|
|||||||
#include <QDesktopServices>
|
#include <QDesktopServices>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "misc.h"
|
||||||
|
|
||||||
#define QBT_REALM "Web UI Access"
|
#define QBT_REALM "Web UI Access"
|
||||||
enum scheduler_days { EVERY_DAY, WEEK_DAYS, WEEK_ENDS, MON, TUE, WED, THU, FRI, SAT, SUN };
|
enum scheduler_days { EVERY_DAY, WEEK_DAYS, WEEK_ENDS, MON, TUE, WED, THU, FRI, SAT, SUN };
|
||||||
|
|
||||||
@ -223,14 +226,14 @@ public:
|
|||||||
settings.setValue(QString::fromUtf8("Preferences/Downloads/ScanDirs"), dirs);
|
settings.setValue(QString::fromUtf8("Preferences/Downloads/ScanDirs"), dirs);
|
||||||
}
|
}
|
||||||
|
|
||||||
static QVariantList getDownloadInScanDirs() {
|
static QList<bool> getDownloadInScanDirs() {
|
||||||
QSettings settings("qBittorrent", "qBittorrent");
|
QSettings settings("qBittorrent", "qBittorrent");
|
||||||
return settings.value(QString::fromUtf8("Preferences/Downloads/DownloadInScanDirs"), QVariantList()).toList();
|
return misc::boolListfromStringList(settings.value(QString::fromUtf8("Preferences/Downloads/DownloadInScanDirs")).toStringList());
|
||||||
}
|
}
|
||||||
|
|
||||||
static void setDownloadInScanDirs(const QVariantList &list) {
|
static void setDownloadInScanDirs(const QList<bool> &list) {
|
||||||
QSettings settings("qBittorrent", "qBittorrent");
|
QSettings settings("qBittorrent", "qBittorrent");
|
||||||
settings.setValue(QString::fromUtf8("Preferences/Downloads/DownloadInScanDirs"), list);
|
settings.setValue(QString::fromUtf8("Preferences/Downloads/DownloadInScanDirs"), misc::toStringList(list));
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool isTorrentExportEnabled() {
|
static bool isTorrentExportEnabled() {
|
||||||
|
@ -52,8 +52,6 @@
|
|||||||
#include "downloadedpiecesbar.h"
|
#include "downloadedpiecesbar.h"
|
||||||
#include "pieceavailabilitybar.h"
|
#include "pieceavailabilitybar.h"
|
||||||
|
|
||||||
Q_DECLARE_METATYPE(QList<int>)
|
|
||||||
|
|
||||||
#ifdef Q_WS_MAC
|
#ifdef Q_WS_MAC
|
||||||
#define DEFAULT_BUTTON_CSS "QPushButton {border: 1px solid rgb(85, 81, 91);border-radius: 3px;padding: 2px; margin-left: 8px; margin-right: 8px;}"
|
#define DEFAULT_BUTTON_CSS "QPushButton {border: 1px solid rgb(85, 81, 91);border-radius: 3px;padding: 2px; margin-left: 8px; margin-right: 8px;}"
|
||||||
#define SELECTED_BUTTON_CSS "QPushButton {border: 1px solid rgb(85, 81, 91);border-radius: 3px;padding: 2px;background-color: rgb(255, 208, 105); margin-left: 8px; margin-right: 8px;}"
|
#define SELECTED_BUTTON_CSS "QPushButton {border: 1px solid rgb(85, 81, 91);border-radius: 3px;padding: 2px;background-color: rgb(255, 208, 105); margin-left: 8px; margin-right: 8px;}"
|
||||||
@ -267,7 +265,7 @@ void PropertiesWidget::loadTorrentInfos(QTorrentHandle &_h) {
|
|||||||
|
|
||||||
void PropertiesWidget::readSettings() {
|
void PropertiesWidget::readSettings() {
|
||||||
QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
|
QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
|
||||||
QList<int> contentColsWidths = settings.value(QString::fromUtf8("TorrentProperties/filesColsWidth"), QVariantList()).value<QList<int> >();
|
QList<int> contentColsWidths = misc::intListfromStringList(settings.value(QString::fromUtf8("TorrentProperties/filesColsWidth")).toStringList());
|
||||||
if(contentColsWidths.empty()) {
|
if(contentColsWidths.empty()) {
|
||||||
filesList->header()->resizeSection(0, 300);
|
filesList->header()->resizeSection(0, 300);
|
||||||
} else {
|
} else {
|
||||||
@ -294,11 +292,11 @@ void PropertiesWidget::readSettings() {
|
|||||||
void PropertiesWidget::saveSettings() {
|
void PropertiesWidget::saveSettings() {
|
||||||
QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
|
QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
|
||||||
settings.setValue("TorrentProperties/Visible", state==VISIBLE);
|
settings.setValue("TorrentProperties/Visible", state==VISIBLE);
|
||||||
QList<int> contentColsWidths;
|
QStringList contentColsWidths;
|
||||||
for(int i=0; i<PropListModel->columnCount(); ++i) {
|
for(int i=0; i<PropListModel->columnCount(); ++i) {
|
||||||
contentColsWidths.append(filesList->columnWidth(i));
|
contentColsWidths << QString::number(filesList->columnWidth(i));
|
||||||
}
|
}
|
||||||
settings.setValue(QString::fromUtf8("TorrentProperties/filesColsWidth"), QVariant::fromValue<QList<int> >(contentColsWidths));
|
settings.setValue(QString::fromUtf8("TorrentProperties/filesColsWidth"), contentColsWidths);
|
||||||
// Splitter sizes
|
// Splitter sizes
|
||||||
QSplitter *hSplitter = static_cast<QSplitter*>(parentWidget());
|
QSplitter *hSplitter = static_cast<QSplitter*>(parentWidget());
|
||||||
QList<int> sizes;
|
QList<int> sizes;
|
||||||
|
@ -345,7 +345,7 @@ public:
|
|||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
static RssItem* fromHash(RssStream* parent, QHash<QString, QVariant> h) {
|
static RssItem* fromHash(RssStream* parent, const QHash<QString, QVariant> &h) {
|
||||||
return new RssItem(parent, h.value("id", "").toString(), h["title"].toString(), h["torrent_url"].toString(), h["news_link"].toString(),
|
return new RssItem(parent, h.value("id", "").toString(), h["title"].toString(), h["torrent_url"].toString(), h["news_link"].toString(),
|
||||||
h["description"].toString(), h["date"].toDateTime(), h["author"].toString(), h["read"].toBool());
|
h["description"].toString(), h["date"].toDateTime(), h["author"].toString(), h["read"].toBool());
|
||||||
}
|
}
|
||||||
|
@ -251,13 +251,12 @@ void RSSImp::deleteSelectedItems() {
|
|||||||
void RSSImp::loadFoldersOpenState() {
|
void RSSImp::loadFoldersOpenState() {
|
||||||
QSettings settings("qBittorrent", "qBittorrent");
|
QSettings settings("qBittorrent", "qBittorrent");
|
||||||
settings.beginGroup("Rss");
|
settings.beginGroup("Rss");
|
||||||
QVariantList open_folders = settings.value("open_folders", QVariantList()).toList();
|
QStringList open_folders = settings.value("open_folders", QStringList()).toStringList();
|
||||||
settings.endGroup();
|
settings.endGroup();
|
||||||
foreach(QVariant var_path, open_folders) {
|
foreach(QString var_path, open_folders) {
|
||||||
QStringList path = var_path.toString().split("\\");
|
QStringList path = var_path.split("\\");
|
||||||
QTreeWidgetItem *parent = 0;
|
QTreeWidgetItem *parent = 0;
|
||||||
foreach(QString name, path) {
|
foreach(QString name, path) {
|
||||||
QList<QTreeWidgetItem*> children;
|
|
||||||
int nbChildren = 0;
|
int nbChildren = 0;
|
||||||
if(parent)
|
if(parent)
|
||||||
nbChildren = parent->childCount();
|
nbChildren = parent->childCount();
|
||||||
@ -281,7 +280,7 @@ void RSSImp::loadFoldersOpenState() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void RSSImp::saveFoldersOpenState() {
|
void RSSImp::saveFoldersOpenState() {
|
||||||
QVariantList open_folders;
|
QStringList open_folders;
|
||||||
QList<QTreeWidgetItem*> items = listStreams->getAllOpenFolders();
|
QList<QTreeWidgetItem*> items = listStreams->getAllOpenFolders();
|
||||||
foreach(QTreeWidgetItem* item, items) {
|
foreach(QTreeWidgetItem* item, items) {
|
||||||
QString path = listStreams->getItemPath(item).join("\\");
|
QString path = listStreams->getItemPath(item).join("\\");
|
||||||
|
@ -56,7 +56,6 @@
|
|||||||
#include "transferlistwidget.h"
|
#include "transferlistwidget.h"
|
||||||
|
|
||||||
using namespace libtorrent;
|
using namespace libtorrent;
|
||||||
Q_DECLARE_METATYPE(QList<int>)
|
|
||||||
|
|
||||||
class torrentAdditionDialog : public QDialog, private Ui_addTorrentDialog{
|
class torrentAdditionDialog : public QDialog, private Ui_addTorrentDialog{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@ -126,7 +125,7 @@ public:
|
|||||||
resize(settings.value(QString::fromUtf8("TorrentAdditionDlg/size"), size()).toSize());
|
resize(settings.value(QString::fromUtf8("TorrentAdditionDlg/size"), size()).toSize());
|
||||||
move(settings.value(QString::fromUtf8("TorrentAdditionDlg/pos"), misc::screenCenter(this)).toPoint());
|
move(settings.value(QString::fromUtf8("TorrentAdditionDlg/pos"), misc::screenCenter(this)).toPoint());
|
||||||
// Restore column width
|
// Restore column width
|
||||||
const QList<int> &contentColsWidths = settings.value(QString::fromUtf8("TorrentAdditionDlg/filesColsWidth")).value<QList<int> >();
|
const QList<int> &contentColsWidths = misc::intListfromStringList(settings.value(QString::fromUtf8("TorrentAdditionDlg/filesColsWidth")).toStringList());
|
||||||
if(contentColsWidths.empty()) {
|
if(contentColsWidths.empty()) {
|
||||||
torrentContentList->header()->resizeSection(0, 200);
|
torrentContentList->header()->resizeSection(0, 200);
|
||||||
} else {
|
} else {
|
||||||
@ -139,12 +138,12 @@ public:
|
|||||||
void saveSettings() {
|
void saveSettings() {
|
||||||
if(is_magnet) return;
|
if(is_magnet) return;
|
||||||
QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
|
QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
|
||||||
QList<int> contentColsWidths;
|
QStringList contentColsWidths;
|
||||||
// -1 because we hid PROGRESS column
|
// -1 because we hid PROGRESS column
|
||||||
for(int i=0; i<PropListModel->columnCount()-1; ++i) {
|
for(int i=0; i<PropListModel->columnCount()-1; ++i) {
|
||||||
contentColsWidths.append(torrentContentList->columnWidth(i));
|
contentColsWidths << QString::number(torrentContentList->columnWidth(i));
|
||||||
}
|
}
|
||||||
settings.setValue(QString::fromUtf8("TorrentAdditionDlg/filesColsWidth"), QVariant::fromValue<QList<int> >(contentColsWidths));
|
settings.setValue(QString::fromUtf8("TorrentAdditionDlg/filesColsWidth"), contentColsWidths);
|
||||||
settings.setValue("TorrentAdditionDlg/size", size());
|
settings.setValue("TorrentAdditionDlg/size", size());
|
||||||
settings.setValue("TorrentAdditionDlg/pos", pos());
|
settings.setValue("TorrentAdditionDlg/pos", pos());
|
||||||
}
|
}
|
||||||
|
@ -69,9 +69,9 @@ public:
|
|||||||
QHash<QString, QVariant> all_data = settings.value("torrents-tmp", QHash<QString, QVariant>()).toHash();
|
QHash<QString, QVariant> all_data = settings.value("torrents-tmp", QHash<QString, QVariant>()).toHash();
|
||||||
QHash<QString, QVariant> data = all_data[hash].toHash();
|
QHash<QString, QVariant> data = all_data[hash].toHash();
|
||||||
std::vector<int>::const_iterator pp_it = pp.begin();
|
std::vector<int>::const_iterator pp_it = pp.begin();
|
||||||
QVariantList pieces_priority;
|
QStringList pieces_priority;
|
||||||
while(pp_it != pp.end()) {
|
while(pp_it != pp.end()) {
|
||||||
pieces_priority << *pp_it;
|
pieces_priority << QString::number(*pp_it);
|
||||||
pp_it++;
|
pp_it++;
|
||||||
}
|
}
|
||||||
data["files_priority"] = pieces_priority;
|
data["files_priority"] = pieces_priority;
|
||||||
@ -179,9 +179,9 @@ public:
|
|||||||
QHash<QString, QVariant> data = all_data[hash].toHash();
|
QHash<QString, QVariant> data = all_data[hash].toHash();
|
||||||
std::vector<int> fp;
|
std::vector<int> fp;
|
||||||
if(data.contains("files_priority")) {
|
if(data.contains("files_priority")) {
|
||||||
QVariantList list_var = data["files_priority"].toList();
|
QList<int> list_var = misc::intListfromStringList(data["files_priority"].toStringList());
|
||||||
foreach(const QVariant& var, list_var) {
|
foreach(int var, list_var) {
|
||||||
fp.push_back(var.toInt());
|
fp.push_back(var);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return fp;
|
return fp;
|
||||||
|
@ -42,8 +42,6 @@
|
|||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
#include "bittorrent.h"
|
#include "bittorrent.h"
|
||||||
|
|
||||||
Q_DECLARE_METATYPE(QList<int>)
|
|
||||||
|
|
||||||
TrackerList::TrackerList(PropertiesWidget *properties): QTreeWidget(), properties(properties) {
|
TrackerList::TrackerList(PropertiesWidget *properties): QTreeWidget(), properties(properties) {
|
||||||
// Graphical settings
|
// Graphical settings
|
||||||
setRootIsDecorated(false);
|
setRootIsDecorated(false);
|
||||||
@ -363,7 +361,7 @@ void TrackerList::showTrackerListMenu(QPoint) {
|
|||||||
|
|
||||||
void TrackerList::loadSettings() {
|
void TrackerList::loadSettings() {
|
||||||
QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
|
QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
|
||||||
QList<int> contentColsWidths = settings.value(QString::fromUtf8("TorrentProperties/Trackers/trackersColsWidth")).value<QList<int> >();
|
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));
|
||||||
@ -375,9 +373,9 @@ void TrackerList::loadSettings() {
|
|||||||
|
|
||||||
void TrackerList::saveSettings() const {
|
void TrackerList::saveSettings() const {
|
||||||
QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
|
QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
|
||||||
QList<int> contentColsWidths;
|
QStringList contentColsWidths;
|
||||||
for(int i=0; i<columnCount(); ++i) {
|
for(int i=0; i<columnCount(); ++i) {
|
||||||
contentColsWidths.append(columnWidth(i));
|
contentColsWidths << QString::number(columnWidth(i));
|
||||||
}
|
}
|
||||||
settings.setValue(QString::fromUtf8("TorrentProperties/Trackers/trackersColsWidth"), QVariant::fromValue<QList<int> >(contentColsWidths));
|
settings.setValue(QString::fromUtf8("TorrentProperties/Trackers/trackersColsWidth"), contentColsWidths);
|
||||||
}
|
}
|
||||||
|
@ -52,8 +52,6 @@
|
|||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
Q_DECLARE_METATYPE(QList<int>)
|
|
||||||
|
|
||||||
TransferListWidget::TransferListWidget(QWidget *parent, GUI *main_window, Bittorrent *_BTSession):
|
TransferListWidget::TransferListWidget(QWidget *parent, GUI *main_window, Bittorrent *_BTSession):
|
||||||
QTreeView(parent), BTSession(_BTSession), main_window(main_window) {
|
QTreeView(parent), BTSession(_BTSession), main_window(main_window) {
|
||||||
QSettings settings("qBittorrent", "qBittorrent");
|
QSettings settings("qBittorrent", "qBittorrent");
|
||||||
@ -1263,11 +1261,11 @@ void TransferListWidget::saveColWidthList() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
settings.setValue(QString::fromUtf8("TransferListColsWidth"), new_width_list.join(QString::fromUtf8(" ")));
|
settings.setValue(QString::fromUtf8("TransferListColsWidth"), new_width_list.join(QString::fromUtf8(" ")));
|
||||||
QList<int> visualIndexes;
|
QStringList visualIndexes;
|
||||||
for(int i=0; i<nbColumns; ++i) {
|
for(int i=0; i<nbColumns; ++i) {
|
||||||
visualIndexes.append(header()->visualIndex(i));
|
visualIndexes << QString::number(header()->visualIndex(i));
|
||||||
}
|
}
|
||||||
settings.setValue(QString::fromUtf8("TransferListVisualIndexes"), QVariant::fromValue< QList<int> >(visualIndexes));
|
settings.setValue(QString::fromUtf8("TransferListVisualIndexes"), visualIndexes);
|
||||||
qDebug("Download list columns width saved");
|
qDebug("Download list columns width saved");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1287,7 +1285,7 @@ bool TransferListWidget::loadColWidthList() {
|
|||||||
for(unsigned int i=0; i<listSize; ++i) {
|
for(unsigned int i=0; i<listSize; ++i) {
|
||||||
header()->resizeSection(i, width_list.at(i).toInt());
|
header()->resizeSection(i, width_list.at(i).toInt());
|
||||||
}
|
}
|
||||||
const QList<int> visualIndexes = settings.value(QString::fromUtf8("TransferListVisualIndexes")).value<QList<int> >();
|
const QList<int> visualIndexes = misc::intListfromStringList(settings.value(QString::fromUtf8("TransferListVisualIndexes")).toStringList());
|
||||||
if(visualIndexes.size() != listModel->columnCount()-1) {
|
if(visualIndexes.size() != listModel->columnCount()-1) {
|
||||||
qDebug("Corrupted values for transfer list columns indexes");
|
qDebug("Corrupted values for transfer list columns indexes");
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
Reference in New Issue
Block a user