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

2
src/base/bittorrent/infohash.h

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

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

@ -407,24 +407,24 @@ int FilterParserThread::parseP2PFilterFile() @@ -407,24 +407,24 @@ int FilterParserThread::parseP2PFilterFile()
int FilterParserThread::getlineInStream(QDataStream &stream, std::string &name, char delim)
{
char c;
int total_read = 0;
int totalRead = 0;
int read;
do {
read = stream.readRawData(&c, 1);
total_read += read;
totalRead += read;
if (read > 0) {
if (c != delim) {
name += c;
}
else {
// 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
@ -455,7 +455,7 @@ int FilterParserThread::parseP2BFilterFile() @@ -455,7 +455,7 @@ int FilterParserThread::parseP2BFilterFile()
unsigned int start, end;
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))
|| !stream.readRawData(reinterpret_cast<char*>(&end), sizeof(end))) {
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: @@ -28,7 +28,6 @@ private:
void save() const;
void load();
private:
BitTorrent::Session *m_session;
// Will overflow at 15.9 EiB
quint64 m_alltimeUL;

3
src/base/bittorrent/trackerentry.cpp

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

3
src/base/iconprovider.cpp

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

32
src/base/preferences.cpp

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

2
src/base/preferences.h

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

1
src/base/private/profile_p.cpp

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

1
src/base/profile.h

@ -25,7 +25,6 @@ @@ -25,7 +25,6 @@
* 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
* exception statement from your version.
*
*/
#ifndef QBT_PROFILE_H

1
src/base/scanfoldersmodel.h

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

3
src/base/torrentfilter.cpp

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

1
src/base/utils/bytearray.cpp

@ -27,6 +27,7 @@ @@ -27,6 +27,7 @@
*/
#include "bytearray.h"
#include <QList>
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) @@ -210,7 +210,7 @@ bool Utils::Fs::sameFiles(const QString &path1, const QString &path2)
if (!f2.open(QIODevice::ReadOnly)) return false;
const int readSize = 1024 * 1024; // 1 MiB
while(!f1.atEnd() && !f2.atEnd()) {
while (!f1.atEnd() && !f2.atEnd()) {
if (f1.read(readSize) != f2.read(readSize))
return false;
}

93
src/base/utils/misc.cpp

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

14
src/gui/advancedsettings.cpp

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

2
src/gui/advancedsettings.h

@ -55,7 +55,7 @@ private slots: @@ -55,7 +55,7 @@ private slots:
private:
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;
QSpinBox spinBoxCache, spinBoxSaveResumeDataInterval, spinBoxOutgoingPortsMin, spinBoxOutgoingPortsMax, spinBoxListRefresh, spinBoxMaxHalfOpen,

2
src/gui/deletionconfirmationdialog.h

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

3
src/gui/guiiconprovider.cpp

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

18
src/gui/mainwindow.h

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

21
src/gui/optionsdialog.cpp

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

12
src/gui/properties/propertieswidget.cpp

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

8
src/gui/properties/propertieswidget.h

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

6
src/gui/search/pluginselectdialog.cpp

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

4
src/gui/search/pluginselectdialog.h

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

7
src/gui/search/searchlistdelegate.cpp

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
/*
* 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
* modify it under the terms of the GNU General Public License
@ -24,10 +24,10 @@ @@ -24,10 +24,10 @@
* 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
* exception statement from your version.
*
* Contact : chris@qbittorrent.org
*/
#include "searchlistdelegate.h"
#include <QCoreApplication>
#include <QModelIndex>
#include <QPainter>
@ -35,7 +35,6 @@ @@ -35,7 +35,6 @@
#include <QStyleOptionViewItem>
#include "base/utils/misc.h"
#include "searchlistdelegate.h"
#include "searchsortmodel.h"
namespace

3
src/gui/torrentcontentmodel.cpp

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

40
src/gui/trackerlogindialog.cpp

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

14
src/gui/trackerlogindialog.h

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

1
src/gui/transferlistfilterswidget.h

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

12
src/gui/transferlistwidget.cpp

@ -527,20 +527,20 @@ void TransferListWidget::bottomPrioSelectedTorrents() @@ -527,20 +527,20 @@ void TransferListWidget::bottomPrioSelectedTorrents()
void TransferListWidget::copySelectedMagnetURIs() const
{
QStringList magnet_uris;
QStringList magnetUris;
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
{
QStringList torrent_names;
QStringList torrentNames;
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

Loading…
Cancel
Save