Browse Source

Fix coding style

adaptive-webui-19844
thalieht 7 years ago
parent
commit
eb508d67ef
  1. 3
      src/base/bittorrent/infohash.cpp
  2. 2
      src/base/bittorrent/infohash.h
  3. 12
      src/base/bittorrent/private/filterparserthread.cpp
  4. 1
      src/base/bittorrent/private/statistics.h
  5. 3
      src/base/bittorrent/trackerentry.cpp
  6. 3
      src/base/iconprovider.cpp
  7. 32
      src/base/preferences.cpp
  8. 2
      src/base/preferences.h
  9. 1
      src/base/private/profile_p.cpp
  10. 1
      src/base/profile.h
  11. 1
      src/base/scanfoldersmodel.h
  12. 3
      src/base/torrentfilter.cpp
  13. 1
      src/base/utils/bytearray.cpp
  14. 2
      src/base/utils/fs.cpp
  15. 93
      src/base/utils/misc.cpp
  16. 14
      src/gui/advancedsettings.cpp
  17. 2
      src/gui/advancedsettings.h
  18. 2
      src/gui/deletionconfirmationdialog.h
  19. 3
      src/gui/guiiconprovider.cpp
  20. 18
      src/gui/mainwindow.h
  21. 21
      src/gui/optionsdialog.cpp
  22. 12
      src/gui/properties/propertieswidget.cpp
  23. 8
      src/gui/properties/propertieswidget.h
  24. 6
      src/gui/search/pluginselectdialog.cpp
  25. 4
      src/gui/search/pluginselectdialog.h
  26. 7
      src/gui/search/searchlistdelegate.cpp
  27. 3
      src/gui/torrentcontentmodel.cpp
  28. 40
      src/gui/trackerlogindialog.cpp
  29. 14
      src/gui/trackerlogindialog.h
  30. 1
      src/gui/transferlistfilterswidget.h
  31. 12
      src/gui/transferlistwidget.cpp

3
src/base/bittorrent/infohash.cpp

@ -26,9 +26,10 @@
* exception statement from your version. * exception statement from your version.
*/ */
#include <QHash>
#include "infohash.h" #include "infohash.h"
#include <QHash>
using namespace BitTorrent; using namespace BitTorrent;
InfoHash::InfoHash() InfoHash::InfoHash()

2
src/base/bittorrent/infohash.h

@ -29,8 +29,8 @@
#ifndef BITTORRENT_INFOHASH_H #ifndef BITTORRENT_INFOHASH_H
#define BITTORRENT_INFOHASH_H #define BITTORRENT_INFOHASH_H
#include <QString>
#include <libtorrent/sha1_hash.hpp> #include <libtorrent/sha1_hash.hpp>
#include <QString>
namespace BitTorrent namespace BitTorrent
{ {

12
src/base/bittorrent/private/filterparserthread.cpp

@ -407,24 +407,24 @@ int FilterParserThread::parseP2PFilterFile()
int FilterParserThread::getlineInStream(QDataStream &stream, std::string &name, char delim) int FilterParserThread::getlineInStream(QDataStream &stream, std::string &name, char delim)
{ {
char c; char c;
int total_read = 0; int totalRead = 0;
int read; int read;
do { do {
read = stream.readRawData(&c, 1); read = stream.readRawData(&c, 1);
total_read += read; totalRead += read;
if (read > 0) { if (read > 0) {
if (c != delim) { if (c != delim) {
name += c; name += c;
} }
else { else {
// Delim found // Delim found
return total_read; return totalRead;
} }
} }
} }
while(read > 0); while (read > 0);
return total_read; return totalRead;
} }
// Parser for PeerGuardian ip filter in p2p format // Parser for PeerGuardian ip filter in p2p format
@ -455,7 +455,7 @@ int FilterParserThread::parseP2BFilterFile()
unsigned int start, end; unsigned int start, end;
std::string name; std::string name;
while(getlineInStream(stream, name, '\0') && !m_abort) { while (getlineInStream(stream, name, '\0') && !m_abort) {
if (!stream.readRawData(reinterpret_cast<char*>(&start), sizeof(start)) if (!stream.readRawData(reinterpret_cast<char*>(&start), sizeof(start))
|| !stream.readRawData(reinterpret_cast<char*>(&end), sizeof(end))) { || !stream.readRawData(reinterpret_cast<char*>(&end), sizeof(end))) {
LogMsg(tr("Parsing Error: The filter file is not a valid PeerGuardian P2B file."), Log::CRITICAL); LogMsg(tr("Parsing Error: The filter file is not a valid PeerGuardian P2B file."), Log::CRITICAL);

1
src/base/bittorrent/private/statistics.h

@ -28,7 +28,6 @@ private:
void save() const; void save() const;
void load(); void load();
private:
BitTorrent::Session *m_session; BitTorrent::Session *m_session;
// Will overflow at 15.9 EiB // Will overflow at 15.9 EiB
quint64 m_alltimeUL; quint64 m_alltimeUL;

3
src/base/bittorrent/trackerentry.cpp

@ -26,11 +26,12 @@
* exception statement from your version. * exception statement from your version.
*/ */
#include "trackerentry.h"
#include <QString> #include <QString>
#include "base/utils/misc.h" #include "base/utils/misc.h"
#include "base/utils/string.h" #include "base/utils/string.h"
#include "trackerentry.h"
using namespace BitTorrent; using namespace BitTorrent;

3
src/base/iconprovider.cpp

@ -27,9 +27,10 @@
* exception statement from your version. * exception statement from your version.
*/ */
#include <QString>
#include "iconprovider.h" #include "iconprovider.h"
#include <QString>
IconProvider::IconProvider(QObject *parent) IconProvider::IconProvider(QObject *parent)
: QObject(parent) : QObject(parent)
{ {

32
src/base/preferences.cpp

@ -257,8 +257,8 @@ void Preferences::setWinStartup(bool b)
{ {
QSettings settings("HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Run", QSettings::NativeFormat); QSettings settings("HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Run", QSettings::NativeFormat);
if (b) { if (b) {
const QString bin_path = "\"" + Utils::Fs::toNativePath(qApp->applicationFilePath()) + "\""; const QString binPath = "\"" + Utils::Fs::toNativePath(qApp->applicationFilePath()) + "\"";
settings.setValue("qBittorrent", bin_path); settings.setValue("qBittorrent", binPath);
} }
else { else {
settings.remove("qBittorrent"); settings.remove("qBittorrent");
@ -555,24 +555,24 @@ void Preferences::setWebUiUsername(const QString &username)
QString Preferences::getWebUiPassword() const QString Preferences::getWebUiPassword() const
{ {
QString pass_ha1 = value("Preferences/WebUI/Password_ha1").toString(); QString passHa1 = value("Preferences/WebUI/Password_ha1").toString();
if (pass_ha1.isEmpty()) { if (passHa1.isEmpty()) {
QCryptographicHash md5(QCryptographicHash::Md5); QCryptographicHash md5(QCryptographicHash::Md5);
md5.addData("adminadmin"); md5.addData("adminadmin");
pass_ha1 = md5.result().toHex(); passHa1 = md5.result().toHex();
} }
return pass_ha1; return passHa1;
} }
void Preferences::setWebUiPassword(const QString &new_password) void Preferences::setWebUiPassword(const QString &newPassword)
{ {
// Do not overwrite current password with its hash // Do not overwrite current password with its hash
if (new_password == getWebUiPassword()) if (newPassword == getWebUiPassword())
return; return;
// Encode to md5 and save // Encode to md5 and save
QCryptographicHash md5(QCryptographicHash::Md5); QCryptographicHash md5(QCryptographicHash::Md5);
md5.addData(new_password.toLocal8Bit()); md5.addData(newPassword.toLocal8Bit());
setValue("Preferences/WebUI/Password_ha1", md5.result().toHex()); setValue("Preferences/WebUI/Password_ha1", md5.result().toHex());
} }
@ -1041,9 +1041,9 @@ void Preferences::setTorrentFileAssoc(bool set)
// .Torrent association // .Torrent association
if (set) { if (set) {
QString old_progid = settings.value(".torrent/Default").toString(); QString oldProgId = settings.value(".torrent/Default").toString();
if (!old_progid.isEmpty() && (old_progid != "qBittorrent")) if (!oldProgId.isEmpty() && (oldProgId != "qBittorrent"))
settings.setValue(".torrent/OpenWithProgids/" + old_progid, ""); settings.setValue(".torrent/OpenWithProgids/" + oldProgId, "");
settings.setValue(".torrent/Default", "qBittorrent"); settings.setValue(".torrent/Default", "qBittorrent");
} }
else if (isTorrentFileAssocSet()) { else if (isTorrentFileAssocSet()) {
@ -1059,15 +1059,15 @@ void Preferences::setMagnetLinkAssoc(bool set)
// Magnet association // Magnet association
if (set) { if (set) {
const QString command_str = "\"" + qApp->applicationFilePath() + "\" \"%1\""; const QString commandStr = "\"" + qApp->applicationFilePath() + "\" \"%1\"";
const QString icon_str = "\"" + qApp->applicationFilePath() + "\",1"; const QString iconStr = "\"" + qApp->applicationFilePath() + "\",1";
settings.setValue("magnet/Default", "URL:Magnet link"); settings.setValue("magnet/Default", "URL:Magnet link");
settings.setValue("magnet/Content Type", "application/x-magnet"); settings.setValue("magnet/Content Type", "application/x-magnet");
settings.setValue("magnet/URL Protocol", ""); settings.setValue("magnet/URL Protocol", "");
settings.setValue("magnet/DefaultIcon/Default", Utils::Fs::toNativePath(icon_str)); settings.setValue("magnet/DefaultIcon/Default", Utils::Fs::toNativePath(iconStr));
settings.setValue("magnet/shell/Default", "open"); settings.setValue("magnet/shell/Default", "open");
settings.setValue("magnet/shell/open/command/Default", Utils::Fs::toNativePath(command_str)); settings.setValue("magnet/shell/open/command/Default", Utils::Fs::toNativePath(commandStr));
} }
else if (isMagnetLinkAssocSet()) { else if (isMagnetLinkAssocSet()) {
settings.remove("magnet"); settings.remove("magnet");

2
src/base/preferences.h

@ -192,7 +192,7 @@ public:
QString getWebUiUsername() const; QString getWebUiUsername() const;
void setWebUiUsername(const QString &username); void setWebUiUsername(const QString &username);
QString getWebUiPassword() const; QString getWebUiPassword() const;
void setWebUiPassword(const QString &new_password); void setWebUiPassword(const QString &newPassword);
// WebUI security // WebUI security
bool isWebUiClickjackingProtectionEnabled() const; bool isWebUiClickjackingProtectionEnabled() const;

1
src/base/private/profile_p.cpp

@ -25,7 +25,6 @@
* 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.
*
*/ */
#include "profile_p.h" #include "profile_p.h"

1
src/base/profile.h

@ -25,7 +25,6 @@
* 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.
*
*/ */
#ifndef QBT_PROFILE_H #ifndef QBT_PROFILE_H

1
src/base/scanfoldersmodel.h

@ -104,7 +104,6 @@ private:
QString downloadPathTorrentFolder(const QString &filePath) const; QString downloadPathTorrentFolder(const QString &filePath) const;
int findPathData(const QString &path) const; int findPathData(const QString &path) const;
private:
static ScanFoldersModel *m_instance; static ScanFoldersModel *m_instance;
struct PathData; struct PathData;

3
src/base/torrentfilter.cpp

@ -26,9 +26,10 @@
* exception statement from your version. * exception statement from your version.
*/ */
#include "bittorrent/torrenthandle.h"
#include "torrentfilter.h" #include "torrentfilter.h"
#include "bittorrent/torrenthandle.h"
const QString TorrentFilter::AnyCategory; const QString TorrentFilter::AnyCategory;
const QStringSet TorrentFilter::AnyHash = (QStringSet() << QString()); const QStringSet TorrentFilter::AnyHash = (QStringSet() << QString());
const QString TorrentFilter::AnyTag; const QString TorrentFilter::AnyTag;

1
src/base/utils/bytearray.cpp

@ -27,6 +27,7 @@
*/ */
#include "bytearray.h" #include "bytearray.h"
#include <QList> #include <QList>
QList<QByteArray> Utils::ByteArray::splitToViews(const QByteArray &in, const QByteArray &sep, const QString::SplitBehavior behavior) QList<QByteArray> Utils::ByteArray::splitToViews(const QByteArray &in, const QByteArray &sep, const QString::SplitBehavior behavior)

2
src/base/utils/fs.cpp

@ -210,7 +210,7 @@ bool Utils::Fs::sameFiles(const QString &path1, const QString &path2)
if (!f2.open(QIODevice::ReadOnly)) return false; if (!f2.open(QIODevice::ReadOnly)) return false;
const int readSize = 1024 * 1024; // 1 MiB const int readSize = 1024 * 1024; // 1 MiB
while(!f1.atEnd() && !f2.atEnd()) { while (!f1.atEnd() && !f2.atEnd()) {
if (f1.read(readSize) != f2.read(readSize)) if (f1.read(readSize) != f2.read(readSize))
return false; return false;
} }

93
src/base/utils/misc.cpp

@ -299,55 +299,50 @@ qlonglong Utils::Misc::sizeInBytes(qreal size, Utils::Misc::SizeUnit unit)
bool Utils::Misc::isPreviewable(const QString &extension) bool Utils::Misc::isPreviewable(const QString &extension)
{ {
static QSet<QString> multimedia_extensions; static const QSet<QString> multimediaExtensions = {
if (multimedia_extensions.empty()) { "3GP",
multimedia_extensions.insert("3GP"); "AAC",
multimedia_extensions.insert("AAC"); "AC3",
multimedia_extensions.insert("AC3"); "AIF",
multimedia_extensions.insert("AIF"); "AIFC",
multimedia_extensions.insert("AIFC"); "AIFF",
multimedia_extensions.insert("AIFF"); "ASF",
multimedia_extensions.insert("ASF"); "AU",
multimedia_extensions.insert("AU"); "AVI",
multimedia_extensions.insert("AVI"); "FLAC",
multimedia_extensions.insert("FLAC"); "FLV",
multimedia_extensions.insert("FLV"); "M3U",
multimedia_extensions.insert("M3U"); "M4A",
multimedia_extensions.insert("M4A"); "M4P",
multimedia_extensions.insert("M4P"); "M4V",
multimedia_extensions.insert("M4V"); "MID",
multimedia_extensions.insert("MID"); "MKV",
multimedia_extensions.insert("MKV"); "MOV",
multimedia_extensions.insert("MOV"); "MP2",
multimedia_extensions.insert("MP2"); "MP3",
multimedia_extensions.insert("MP3"); "MP4",
multimedia_extensions.insert("MP4"); "MPC",
multimedia_extensions.insert("MPC"); "MPE",
multimedia_extensions.insert("MPE"); "MPEG",
multimedia_extensions.insert("MPEG"); "MPG",
multimedia_extensions.insert("MPG"); "MPP",
multimedia_extensions.insert("MPP"); "OGG",
multimedia_extensions.insert("OGG"); "OGM",
multimedia_extensions.insert("OGM"); "OGV",
multimedia_extensions.insert("OGV"); "QT",
multimedia_extensions.insert("QT"); "RA",
multimedia_extensions.insert("RA"); "RAM",
multimedia_extensions.insert("RAM"); "RM",
multimedia_extensions.insert("RM"); "RMV",
multimedia_extensions.insert("RMV"); "RMVB",
multimedia_extensions.insert("RMVB"); "SWA",
multimedia_extensions.insert("SWA"); "SWF",
multimedia_extensions.insert("SWF"); "VOB",
multimedia_extensions.insert("VOB"); "WAV",
multimedia_extensions.insert("WAV"); "WMA",
multimedia_extensions.insert("WMA"); "WMV"
multimedia_extensions.insert("WMV"); };
} return multimediaExtensions.contains(extension.toUpper());
if (extension.isEmpty())
return false;
return multimedia_extensions.contains(extension.toUpper());
} }
// Take a number of seconds and return an user-friendly // Take a number of seconds and return an user-friendly

14
src/gui/advancedsettings.cpp

@ -393,8 +393,8 @@ void AdvancedSettings::loadAdvancedSettings()
addRow(SUPER_SEEDING, tr("Strict super seeding"), &checkBoxSuperSeeding); addRow(SUPER_SEEDING, tr("Strict super seeding"), &checkBoxSuperSeeding);
// Network interface // Network interface
comboBoxInterface.addItem(tr("Any interface", "i.e. Any network interface")); comboBoxInterface.addItem(tr("Any interface", "i.e. Any network interface"));
const QString current_iface = session->networkInterface(); const QString currentInterface = session->networkInterface();
bool interface_exists = current_iface.isEmpty(); bool interfaceExists = currentInterface.isEmpty();
int i = 1; int i = 1;
foreach (const QNetworkInterface& iface, QNetworkInterface::allInterfaces()) { foreach (const QNetworkInterface& iface, QNetworkInterface::allInterfaces()) {
// This line fixes a Qt bug => https://bugreports.qt.io/browse/QTBUG-52633 // This line fixes a Qt bug => https://bugreports.qt.io/browse/QTBUG-52633
@ -404,15 +404,15 @@ void AdvancedSettings::loadAdvancedSettings()
if (iface.addressEntries().isEmpty()) continue; if (iface.addressEntries().isEmpty()) continue;
comboBoxInterface.addItem(iface.humanReadableName(), iface.name()); comboBoxInterface.addItem(iface.humanReadableName(), iface.name());
if (!current_iface.isEmpty() && (iface.name() == current_iface)) { if (!currentInterface.isEmpty() && (iface.name() == currentInterface)) {
comboBoxInterface.setCurrentIndex(i); comboBoxInterface.setCurrentIndex(i);
interface_exists = true; interfaceExists = true;
} }
++i; ++i;
} }
// Saved interface does not exist, show it anyway // Saved interface does not exist, show it anyway
if (!interface_exists) { if (!interfaceExists) {
comboBoxInterface.addItem(session->networkInterfaceName(), current_iface); comboBoxInterface.addItem(session->networkInterfaceName(), currentInterface);
comboBoxInterface.setCurrentIndex(i); comboBoxInterface.setCurrentIndex(i);
} }
addRow(NETWORK_IFACE, tr("Network Interface (requires restart)"), &comboBoxInterface); addRow(NETWORK_IFACE, tr("Network Interface (requires restart)"), &comboBoxInterface);
@ -427,7 +427,7 @@ void AdvancedSettings::loadAdvancedSettings()
addRow(ANNOUNCE_IP, tr("IP Address to report to trackers (requires restart)"), &lineEditAnnounceIP); addRow(ANNOUNCE_IP, tr("IP Address to report to trackers (requires restart)"), &lineEditAnnounceIP);
// Program notifications // Program notifications
const MainWindow * const mainWindow = static_cast<Application*>(QCoreApplication::instance())->mainWindow(); const MainWindow *const mainWindow = static_cast<Application*>(QCoreApplication::instance())->mainWindow();
checkBoxProgramNotifications.setChecked(mainWindow->isNotificationsEnabled()); checkBoxProgramNotifications.setChecked(mainWindow->isNotificationsEnabled());
addRow(PROGRAM_NOTIFICATIONS, tr("Display notifications"), &checkBoxProgramNotifications); addRow(PROGRAM_NOTIFICATIONS, tr("Display notifications"), &checkBoxProgramNotifications);
// Torrent added notifications // Torrent added notifications

2
src/gui/advancedsettings.h

@ -55,7 +55,7 @@ private slots:
private: private:
void loadAdvancedSettings(); void loadAdvancedSettings();
template <typename T> void addRow(int row, const QString &rowText, T* widget); template <typename T> void addRow(int row, const QString &rowText, T *widget);
QLabel labelQbtLink, labelLibtorrentLink; QLabel labelQbtLink, labelLibtorrentLink;
QSpinBox spinBoxCache, spinBoxSaveResumeDataInterval, spinBoxOutgoingPortsMin, spinBoxOutgoingPortsMax, spinBoxListRefresh, spinBoxMaxHalfOpen, QSpinBox spinBoxCache, spinBoxSaveResumeDataInterval, spinBoxOutgoingPortsMin, spinBoxOutgoingPortsMax, spinBoxListRefresh, spinBoxMaxHalfOpen,

2
src/gui/deletionconfirmationdialog.h

@ -1,5 +1,5 @@
/* /*
* Bittorrent Client using Qt4 and libtorrent. * Bittorrent Client using Qt and libtorrent.
* Copyright (C) 2006 Christophe Dumez <chris@qbittorrent.org> * Copyright (C) 2006 Christophe Dumez <chris@qbittorrent.org>
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or

3
src/gui/guiiconprovider.cpp

@ -28,7 +28,6 @@
*/ */
#include "guiiconprovider.h" #include "guiiconprovider.h"
#include "base/preferences.h"
#include <QIcon> #include <QIcon>
#if (defined(Q_OS_UNIX) && !defined(Q_OS_MAC)) #if (defined(Q_OS_UNIX) && !defined(Q_OS_MAC))
@ -36,6 +35,8 @@
#include <QFile> #include <QFile>
#endif #endif
#include "base/preferences.h"
GuiIconProvider::GuiIconProvider(QObject *parent) GuiIconProvider::GuiIconProvider(QObject *parent)
: IconProvider(parent) : IconProvider(parent)
{ {

18
src/gui/mainwindow.h

@ -43,20 +43,20 @@ class QSplitter;
class QTabWidget; class QTabWidget;
class QTimer; class QTimer;
class DownloadFromURLDialog;
class SearchWidget;
class RSSWidget;
class AboutDialog; class AboutDialog;
class DownloadFromURLDialog;
class ExecutionLogWidget;
class LineEdit;
class OptionsDialog; class OptionsDialog;
class TransferListWidget; class PowerManagement;
class TransferListFiltersWidget;
class PropertiesWidget; class PropertiesWidget;
class RSSWidget;
class SearchWidget;
class StatsDialog;
class StatusBar; class StatusBar;
class TorrentCreatorDialog; class TorrentCreatorDialog;
class LineEdit; class TransferListFiltersWidget;
class ExecutionLogWidget; class TransferListWidget;
class PowerManagement;
class StatsDialog;
namespace BitTorrent namespace BitTorrent
{ {

21
src/gui/optionsdialog.cpp

@ -518,10 +518,11 @@ void OptionsDialog::saveWindowState() const
pref->setPrefSize(size()); pref->setPrefSize(size());
// Splitter size // Splitter size
QStringList sizes_str; const QStringList sizesStr = {
sizes_str << QString::number(m_ui->hsplitter->sizes().first()); QString::number(m_ui->hsplitter->sizes().first()),
sizes_str << QString::number(m_ui->hsplitter->sizes().last()); QString::number(m_ui->hsplitter->sizes().last())
pref->setPrefHSplitterSizes(sizes_str); };
pref->setPrefHSplitterSizes(sizesStr);
} }
void OptionsDialog::saveOptions() void OptionsDialog::saveOptions()
@ -637,15 +638,15 @@ void OptionsDialog::saveOptions()
session->setPort(getPort()); session->setPort(getPort());
session->setUseRandomPort(m_ui->checkRandomPort->isChecked()); session->setUseRandomPort(m_ui->checkRandomPort->isChecked());
Net::PortForwarder::instance()->setEnabled(isUPnPEnabled()); Net::PortForwarder::instance()->setEnabled(isUPnPEnabled());
const QPair<int, int> down_up_limit = getGlobalBandwidthLimits(); const QPair<int, int> downUpLimit = getGlobalBandwidthLimits();
session->setGlobalDownloadSpeedLimit(down_up_limit.first); session->setGlobalDownloadSpeedLimit(downUpLimit.first);
session->setGlobalUploadSpeedLimit(down_up_limit.second); session->setGlobalUploadSpeedLimit(downUpLimit.second);
session->setUTPRateLimited(m_ui->checkLimituTPConnections->isChecked()); session->setUTPRateLimited(m_ui->checkLimituTPConnections->isChecked());
session->setIncludeOverheadInLimits(m_ui->checkLimitTransportOverhead->isChecked()); session->setIncludeOverheadInLimits(m_ui->checkLimitTransportOverhead->isChecked());
session->setIgnoreLimitsOnLAN(!m_ui->checkLimitLocalPeerRate->isChecked()); session->setIgnoreLimitsOnLAN(!m_ui->checkLimitLocalPeerRate->isChecked());
const QPair<int, int> alt_down_up_limit = getAltGlobalBandwidthLimits(); const QPair<int, int> altDownUpLimit = getAltGlobalBandwidthLimits();
session->setAltGlobalDownloadSpeedLimit(alt_down_up_limit.first); session->setAltGlobalDownloadSpeedLimit(altDownUpLimit.first);
session->setAltGlobalUploadSpeedLimit(alt_down_up_limit.second); session->setAltGlobalUploadSpeedLimit(altDownUpLimit.second);
pref->setSchedulerStartTime(m_ui->timeEditScheduleFrom->time()); pref->setSchedulerStartTime(m_ui->timeEditScheduleFrom->time());
pref->setSchedulerEndTime(m_ui->timeEditScheduleTo->time()); pref->setSchedulerEndTime(m_ui->timeEditScheduleTo->time());
pref->setSchedulerDays(static_cast<SchedulerDays>(m_ui->comboBoxScheduleDays->currentIndex())); pref->setSchedulerDays(static_cast<SchedulerDays>(m_ui->comboBoxScheduleDays->currentIndex()));

12
src/gui/properties/propertieswidget.cpp

@ -364,10 +364,10 @@ void PropertiesWidget::readSettings()
QSplitter *hSplitter = static_cast<QSplitter *>(parentWidget()); QSplitter *hSplitter = static_cast<QSplitter *>(parentWidget());
hSplitter->setSizes(m_slideSizes); hSplitter->setSizes(m_slideSizes);
} }
const int current_tab = pref->getPropCurTab(); const int currentTab = pref->getPropCurTab();
const bool visible = pref->getPropVisible(); const bool visible = pref->getPropVisible();
m_ui->filesList->header()->restoreState(pref->getPropFileListState()); m_ui->filesList->header()->restoreState(pref->getPropFileListState());
m_tabBar->setCurrentIndex(current_tab); m_tabBar->setCurrentIndex(currentTab);
if (!visible) if (!visible)
setVisibility(false); setVisibility(false);
} }
@ -807,19 +807,19 @@ void PropertiesWidget::askWebSeed()
{ {
bool ok; bool ok;
// Ask user for a new url seed // Ask user for a new url seed
const QString url_seed = AutoExpandableDialog::getText(this, tr("New URL seed", "New HTTP source"), const QString urlSeed = AutoExpandableDialog::getText(this, tr("New URL seed", "New HTTP source"),
tr("New URL seed:"), QLineEdit::Normal, tr("New URL seed:"), QLineEdit::Normal,
QLatin1String("http://www."), &ok); QLatin1String("http://www."), &ok);
if (!ok) return; if (!ok) return;
qDebug("Adding %s web seed", qUtf8Printable(url_seed)); qDebug("Adding %s web seed", qUtf8Printable(urlSeed));
if (!m_ui->listWebSeeds->findItems(url_seed, Qt::MatchFixedString).empty()) { if (!m_ui->listWebSeeds->findItems(urlSeed, Qt::MatchFixedString).empty()) {
QMessageBox::warning(this, "qBittorrent", QMessageBox::warning(this, "qBittorrent",
tr("This URL seed is already in the list."), tr("This URL seed is already in the list."),
QMessageBox::Ok); QMessageBox::Ok);
return; return;
} }
if (m_torrent) if (m_torrent)
m_torrent->addUrlSeeds(QList<QUrl>() << url_seed); m_torrent->addUrlSeeds(QList<QUrl>() << urlSeed);
// Refresh the seeds list // Refresh the seeds list
loadUrlSeeds(); loadUrlSeeds();
} }

8
src/gui/properties/propertieswidget.h

@ -107,6 +107,10 @@ protected slots:
void renameSelectedFile(); void renameSelectedFile();
void openSelectedFile(); void openSelectedFile();
private slots:
void filterText(const QString &filter);
void updateSavePath(BitTorrent::TorrentHandle *const torrent);
private: private:
void openFile(const QModelIndex &index); void openFile(const QModelIndex &index);
void openFolder(const QModelIndex &index, bool containingFolder); void openFolder(const QModelIndex &index, bool containingFolder);
@ -131,10 +135,6 @@ private:
QShortcut *m_editHotkeyWeb; QShortcut *m_editHotkeyWeb;
QShortcut *m_deleteHotkeyWeb; QShortcut *m_deleteHotkeyWeb;
QShortcut *m_openHotkeyFile; QShortcut *m_openHotkeyFile;
private slots:
void filterText(const QString &filter);
void updateSavePath(BitTorrent::TorrentHandle *const torrent);
}; };
#endif // PROPERTIESWIDGET_H #endif // PROPERTIESWIDGET_H

6
src/gui/search/pluginselectdialog.cpp

@ -172,8 +172,8 @@ void PluginSelectDialog::displayContextMenu(const QPoint&)
QList<QTreeWidgetItem *> items = m_ui->pluginsTree->selectedItems(); QList<QTreeWidgetItem *> items = m_ui->pluginsTree->selectedItems();
if (items.isEmpty()) return; if (items.isEmpty()) return;
QString first_id = items.first()->text(PLUGIN_ID); QString firstID = items.first()->text(PLUGIN_ID);
m_ui->actionEnable->setChecked(m_pluginManager->pluginInfo(first_id)->enabled); m_ui->actionEnable->setChecked(m_pluginManager->pluginInfo(firstID)->enabled);
myContextMenu.addAction(m_ui->actionEnable); myContextMenu.addAction(m_ui->actionEnable);
myContextMenu.addSeparator(); myContextMenu.addSeparator();
myContextMenu.addAction(m_ui->actionUninstall); myContextMenu.addAction(m_ui->actionUninstall);
@ -318,7 +318,7 @@ void PluginSelectDialog::finishAsyncOp()
void PluginSelectDialog::finishPluginUpdate() void PluginSelectDialog::finishPluginUpdate()
{ {
--m_pendingUpdates; --m_pendingUpdates;
if (m_pendingUpdates == 0 && !m_updatedPlugins.isEmpty()) { if ((m_pendingUpdates == 0) && !m_updatedPlugins.isEmpty()) {
m_updatedPlugins.sort(Qt::CaseInsensitive); m_updatedPlugins.sort(Qt::CaseInsensitive);
QMessageBox::information(this, tr("Search plugin update"), tr("Plugins installed or updated: %1").arg(m_updatedPlugins.join(", "))); QMessageBox::information(this, tr("Search plugin update"), tr("Plugins installed or updated: %1").arg(m_updatedPlugins.join(", ")));
m_updatedPlugins.clear(); m_updatedPlugins.clear();

4
src/gui/search/pluginselectdialog.h

@ -55,8 +55,8 @@ public:
QTreeWidgetItem *findItemWithID(QString id); QTreeWidgetItem *findItemWithID(QString id);
protected: protected:
void dropEvent(QDropEvent *event); void dropEvent(QDropEvent *event) override;
void dragEnterEvent(QDragEnterEvent *event); void dragEnterEvent(QDragEnterEvent *event) override;
private slots: private slots:
void on_actionUninstall_triggered(); void on_actionUninstall_triggered();

7
src/gui/search/searchlistdelegate.cpp

@ -1,6 +1,6 @@
/* /*
* Bittorrent Client using Qt and libtorrent. * Bittorrent Client using Qt and libtorrent.
* Copyright (C) 2006 Christophe Dumez * Copyright (C) 2006 Christophe Dumez <chris@qbittorrent.org>
* *
* 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
@ -24,10 +24,10 @@
* 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
*/ */
#include "searchlistdelegate.h"
#include <QCoreApplication> #include <QCoreApplication>
#include <QModelIndex> #include <QModelIndex>
#include <QPainter> #include <QPainter>
@ -35,7 +35,6 @@
#include <QStyleOptionViewItem> #include <QStyleOptionViewItem>
#include "base/utils/misc.h" #include "base/utils/misc.h"
#include "searchlistdelegate.h"
#include "searchsortmodel.h" #include "searchsortmodel.h"
namespace namespace

3
src/gui/torrentcontentmodel.cpp

@ -26,6 +26,8 @@
* exception statement from your version. * exception statement from your version.
*/ */
#include "torrentcontentmodel.h"
#include <QDir> #include <QDir>
#include <QFileIconProvider> #include <QFileIconProvider>
#include <QFileInfo> #include <QFileInfo>
@ -49,7 +51,6 @@
#include "base/utils/misc.h" #include "base/utils/misc.h"
#include "base/utils/fs.h" #include "base/utils/fs.h"
#include "guiiconprovider.h" #include "guiiconprovider.h"
#include "torrentcontentmodel.h"
#include "torrentcontentmodelfile.h" #include "torrentcontentmodelfile.h"
#include "torrentcontentmodelfolder.h" #include "torrentcontentmodelfolder.h"
#include "torrentcontentmodelitem.h" #include "torrentcontentmodelitem.h"

40
src/gui/trackerlogindialog.cpp

@ -36,42 +36,42 @@
#include "utils.h" #include "utils.h"
TrackerLoginDialog::TrackerLoginDialog(QWidget *parent, BitTorrent::TorrentHandle *const torrent) TrackerLoginDialog::TrackerLoginDialog(QWidget *parent, BitTorrent::TorrentHandle *const torrent)
: QDialog(parent) : QDialog(parent)
, m_torrent(torrent) , m_torrent(torrent)
{ {
setupUi(this); setupUi(this);
setAttribute(Qt::WA_DeleteOnClose); setAttribute(Qt::WA_DeleteOnClose);
buttonBox->button(QDialogButtonBox::Ok)->setText(tr("Log in")); buttonBox->button(QDialogButtonBox::Ok)->setText(tr("Log in"));
labelLoginLogo->setPixmap(QPixmap(QLatin1String(":/icons/qbt-theme/encrypted.png"))); labelLoginLogo->setPixmap(QPixmap(QLatin1String(":/icons/qbt-theme/encrypted.png")));
labelTrackerURL->setText(torrent->currentTracker()); labelTrackerURL->setText(torrent->currentTracker());
connect(buttonBox, &QDialogButtonBox::accepted, this, &TrackerLoginDialog::loginButtonClicked); connect(buttonBox, &QDialogButtonBox::accepted, this, &TrackerLoginDialog::loginButtonClicked);
connect(buttonBox, &QDialogButtonBox::rejected, this, &TrackerLoginDialog::cancelButtonClicked); connect(buttonBox, &QDialogButtonBox::rejected, this, &TrackerLoginDialog::cancelButtonClicked);
connect(linePasswd, &QLineEdit::returnPressed, this, &TrackerLoginDialog::loginButtonClicked); connect(linePasswd, &QLineEdit::returnPressed, this, &TrackerLoginDialog::loginButtonClicked);
connect(this, SIGNAL(trackerLoginCancelled(QPair<BitTorrent::TorrentHandle*, QString>)), // TODO: use Qt5 connect syntax connect(this, SIGNAL(trackerLoginCancelled(QPair<BitTorrent::TorrentHandle*, QString>)), // TODO: use Qt5 connect syntax
parent, SLOT(addUnauthenticatedTracker(QPair<BitTorrent::TorrentHandle*, QString>))); parent, SLOT(addUnauthenticatedTracker(QPair<BitTorrent::TorrentHandle*, QString>)));
Utils::Gui::resize(this); Utils::Gui::resize(this);
show(); show();
} }
TrackerLoginDialog::~TrackerLoginDialog() {} TrackerLoginDialog::~TrackerLoginDialog() {}
void TrackerLoginDialog::loginButtonClicked() void TrackerLoginDialog::loginButtonClicked()
{ {
// login // login
#if LIBTORRENT_VERSION_NUM < 10100 #if LIBTORRENT_VERSION_NUM < 10100
m_torrent->setTrackerLogin(lineUsername->text(), linePasswd->text()); m_torrent->setTrackerLogin(lineUsername->text(), linePasswd->text());
#endif #endif
accept(); accept();
} }
void TrackerLoginDialog::cancelButtonClicked() void TrackerLoginDialog::cancelButtonClicked()
{ {
// Emit a signal to GUI to stop asking for authentication // Emit a signal to GUI to stop asking for authentication
emit trackerLoginCancelled(qMakePair(m_torrent, m_torrent->currentTracker())); emit trackerLoginCancelled(qMakePair(m_torrent, m_torrent->currentTracker()));
reject(); reject();
} }

14
src/gui/trackerlogindialog.h

@ -40,21 +40,21 @@ namespace BitTorrent
class TrackerLoginDialog : public QDialog, private Ui::TrackerLoginDialog class TrackerLoginDialog : public QDialog, private Ui::TrackerLoginDialog
{ {
Q_OBJECT Q_OBJECT
private: public:
BitTorrent::TorrentHandle *const m_torrent;
public:
TrackerLoginDialog(QWidget *parent, BitTorrent::TorrentHandle *const torrent); TrackerLoginDialog(QWidget *parent, BitTorrent::TorrentHandle *const torrent);
~TrackerLoginDialog(); ~TrackerLoginDialog();
signals: signals:
void trackerLoginCancelled(QPair<BitTorrent::TorrentHandle*, QString> tracker); void trackerLoginCancelled(QPair<BitTorrent::TorrentHandle*, QString> tracker);
private slots: private slots:
void loginButtonClicked(); void loginButtonClicked();
void cancelButtonClicked(); void cancelButtonClicked();
private:
BitTorrent::TorrentHandle *const m_torrent;
}; };
#endif // TRACKERLOGINDIALOG_H #endif // TRACKERLOGINDIALOG_H

1
src/gui/transferlistfilterswidget.h

@ -121,7 +121,6 @@ private:
QStringList getHashes(int row); QStringList getHashes(int row);
void downloadFavicon(const QString &url); void downloadFavicon(const QString &url);
private:
QHash<QString, QStringList> m_trackers; QHash<QString, QStringList> m_trackers;
QHash<QString, QStringList> m_errors; QHash<QString, QStringList> m_errors;
QHash<QString, QStringList> m_warnings; QHash<QString, QStringList> m_warnings;

12
src/gui/transferlistwidget.cpp

@ -527,20 +527,20 @@ void TransferListWidget::bottomPrioSelectedTorrents()
void TransferListWidget::copySelectedMagnetURIs() const void TransferListWidget::copySelectedMagnetURIs() const
{ {
QStringList magnet_uris; QStringList magnetUris;
foreach (BitTorrent::TorrentHandle *const torrent, getSelectedTorrents()) foreach (BitTorrent::TorrentHandle *const torrent, getSelectedTorrents())
magnet_uris << torrent->toMagnetUri(); magnetUris << torrent->toMagnetUri();
qApp->clipboard()->setText(magnet_uris.join('\n')); qApp->clipboard()->setText(magnetUris.join('\n'));
} }
void TransferListWidget::copySelectedNames() const void TransferListWidget::copySelectedNames() const
{ {
QStringList torrent_names; QStringList torrentNames;
foreach (BitTorrent::TorrentHandle *const torrent, getSelectedTorrents()) foreach (BitTorrent::TorrentHandle *const torrent, getSelectedTorrents())
torrent_names << torrent->name(); torrentNames << torrent->name();
qApp->clipboard()->setText(torrent_names.join('\n')); qApp->clipboard()->setText(torrentNames.join('\n'));
} }
void TransferListWidget::copySelectedHashes() const void TransferListWidget::copySelectedHashes() const

Loading…
Cancel
Save