mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-31 20:58:07 -06:00
Fix coding style
This commit is contained in:
committed by
sledgehammer999
parent
976e2450ec
commit
c99ac99a99
@@ -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()
|
||||
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()
|
||||
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
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 @@
|
||||
#include <QFile>
|
||||
#endif
|
||||
|
||||
#include "base/preferences.h"
|
||||
|
||||
GuiIconProvider::GuiIconProvider(QObject *parent)
|
||||
: IconProvider(parent)
|
||||
{
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
@@ -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()
|
||||
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()));
|
||||
|
||||
@@ -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()
|
||||
{
|
||||
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();
|
||||
}
|
||||
|
||||
@@ -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:
|
||||
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
|
||||
|
||||
@@ -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()
|
||||
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();
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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 @@
|
||||
* 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 @@
|
||||
#include <QStyleOptionViewItem>
|
||||
|
||||
#include "base/utils/misc.h"
|
||||
#include "searchlistdelegate.h"
|
||||
#include "searchsortmodel.h"
|
||||
|
||||
namespace
|
||||
|
||||
@@ -26,6 +26,8 @@
|
||||
* exception statement from your version.
|
||||
*/
|
||||
|
||||
#include "torrentcontentmodel.h"
|
||||
|
||||
#include <QDir>
|
||||
#include <QFileIconProvider>
|
||||
#include <QFileInfo>
|
||||
@@ -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"
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user