mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-13 00:33:09 -07:00
Fix coding style
This commit is contained in:
parent
b107b745f2
commit
ac6426eab1
79 changed files with 717 additions and 772 deletions
|
@ -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,8 +24,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.
|
||||
*
|
||||
* Contact : chris@qbittorrent.org
|
||||
*/
|
||||
|
||||
#include "mainwindow.h"
|
||||
|
@ -59,10 +57,6 @@
|
|||
#include "notifications.h"
|
||||
#endif
|
||||
|
||||
#include "about_imp.h"
|
||||
#include "addnewtorrentdialog.h"
|
||||
#include "application.h"
|
||||
#include "autoexpandabledialog.h"
|
||||
#include "base/bittorrent/session.h"
|
||||
#include "base/bittorrent/sessionstatus.h"
|
||||
#include "base/bittorrent/torrenthandle.h"
|
||||
|
@ -74,6 +68,10 @@
|
|||
#include "base/settingsstorage.h"
|
||||
#include "base/utils/fs.h"
|
||||
#include "base/utils/misc.h"
|
||||
#include "about_imp.h"
|
||||
#include "addnewtorrentdialog.h"
|
||||
#include "application.h"
|
||||
#include "autoexpandabledialog.h"
|
||||
#include "cookiesdialog.h"
|
||||
#include "downloadfromurldialog.h"
|
||||
#include "executionlog.h"
|
||||
|
@ -267,7 +265,7 @@ MainWindow::MainWindow(QWidget *parent)
|
|||
connect(BitTorrent::Session::instance(), &BitTorrent::Session::trackersRemoved, m_transferListFiltersWidget, &TransferListFiltersWidget::removeTrackers);
|
||||
connect(BitTorrent::Session::instance(), &BitTorrent::Session::trackerlessStateChanged, m_transferListFiltersWidget, &TransferListFiltersWidget::changeTrackerless);
|
||||
|
||||
using Func = void (TransferListFiltersWidget::*)(BitTorrent::TorrentHandle * const, const QString &);
|
||||
using Func = void (TransferListFiltersWidget::*)(BitTorrent::TorrentHandle *const, const QString &);
|
||||
connect(BitTorrent::Session::instance(), &BitTorrent::Session::trackerSuccess, m_transferListFiltersWidget, static_cast<Func>(&TransferListFiltersWidget::trackerSuccess));
|
||||
connect(BitTorrent::Session::instance(), &BitTorrent::Session::trackerError, m_transferListFiltersWidget, static_cast<Func>(&TransferListFiltersWidget::trackerError));
|
||||
connect(BitTorrent::Session::instance(), &BitTorrent::Session::trackerWarning, m_transferListFiltersWidget, static_cast<Func>(&TransferListFiltersWidget::trackerWarning));
|
||||
|
@ -1059,7 +1057,7 @@ void MainWindow::notifyOfUpdate(QString)
|
|||
void MainWindow::toggleVisibility(const QSystemTrayIcon::ActivationReason reason)
|
||||
{
|
||||
switch (reason) {
|
||||
case QSystemTrayIcon::Trigger: {
|
||||
case QSystemTrayIcon::Trigger:
|
||||
if (isHidden()) {
|
||||
if (m_uiLocked && !unlockUI()) // Ask for UI lock password
|
||||
return;
|
||||
|
@ -1075,9 +1073,7 @@ void MainWindow::toggleVisibility(const QSystemTrayIcon::ActivationReason reason
|
|||
else {
|
||||
hide();
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
|
@ -1092,7 +1088,7 @@ void MainWindow::on_actionAbout_triggered()
|
|||
if (m_aboutDlg)
|
||||
m_aboutDlg->activateWindow();
|
||||
else
|
||||
m_aboutDlg = new about(this);
|
||||
m_aboutDlg = new AboutDialog(this);
|
||||
}
|
||||
|
||||
void MainWindow::on_actionStatistics_triggered()
|
||||
|
@ -1136,7 +1132,7 @@ void MainWindow::closeEvent(QCloseEvent *e)
|
|||
e->accept();
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
#endif // Q_OS_MAC
|
||||
|
||||
if (pref->confirmOnExit() && BitTorrent::Session::instance()->hasActiveTorrents()) {
|
||||
if (e->spontaneous() || m_forceExit) {
|
||||
|
@ -1144,7 +1140,7 @@ void MainWindow::closeEvent(QCloseEvent *e)
|
|||
show();
|
||||
QMessageBox confirmBox(QMessageBox::Question, tr("Exiting qBittorrent"),
|
||||
// Split it because the last sentence is used in the Web UI
|
||||
tr("Some files are currently transferring.") + "\n" + tr("Are you sure you want to quit qBittorrent?"),
|
||||
tr("Some files are currently transferring.") + '\n' + tr("Are you sure you want to quit qBittorrent?"),
|
||||
QMessageBox::NoButton, this);
|
||||
QPushButton *noBtn = confirmBox.addButton(tr("&No"), QMessageBox::NoRole);
|
||||
confirmBox.addButton(tr("&Yes"), QMessageBox::YesRole);
|
||||
|
@ -1355,9 +1351,9 @@ void MainWindow::on_actionOpen_triggered()
|
|||
}
|
||||
|
||||
// Save last dir to remember it
|
||||
QStringList topDir = Utils::Fs::fromNativePath(pathsList.at(0)).split("/");
|
||||
QStringList topDir = Utils::Fs::fromNativePath(pathsList.at(0)).split('/');
|
||||
topDir.removeLast();
|
||||
pref->setMainLastDir(Utils::Fs::fromNativePath(topDir.join("/")));
|
||||
pref->setMainLastDir(Utils::Fs::fromNativePath(topDir.join('/')));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1538,7 +1534,7 @@ void MainWindow::updateGUI()
|
|||
#else
|
||||
// OSes such as Windows do not support html here
|
||||
QString html = tr("DL speed: %1", "e.g: Download speed: 10 KiB/s").arg(Utils::Misc::friendlyUnit(status.payloadDownloadRate, true));
|
||||
html += "\n";
|
||||
html += '\n';
|
||||
html += tr("UP speed: %1", "e.g: Upload speed: 10 KiB/s").arg(Utils::Misc::friendlyUnit(status.payloadUploadRate, true));
|
||||
#endif // Q_OS_UNIX
|
||||
m_systrayIcon->setToolTip(html); // tray icon
|
||||
|
@ -1660,7 +1656,7 @@ void MainWindow::createTrayIcon()
|
|||
connect(m_systrayIcon.data(), &QSystemTrayIcon::activated, this, &MainWindow::toggleVisibility);
|
||||
m_systrayIcon->show();
|
||||
}
|
||||
#endif
|
||||
#endif // Q_OS_MAC
|
||||
|
||||
QMenu *MainWindow::trayIconMenu()
|
||||
{
|
||||
|
@ -2006,7 +2002,7 @@ QIcon MainWindow::getSystrayIcon() const
|
|||
// As a failsafe in case the enum is invalid
|
||||
return QIcon(QLatin1String(":/icons/skin/qbittorrent-tray.svg"));
|
||||
}
|
||||
#endif
|
||||
#endif // Q_OS_MAC
|
||||
|
||||
#if defined(Q_OS_WIN) || defined(Q_OS_MAC)
|
||||
void MainWindow::checkProgramUpdate()
|
||||
|
@ -2102,4 +2098,4 @@ void MainWindow::pythonDownloadFailure(const QString &url, const QString &error)
|
|||
QMessageBox::warning(this, tr("Download error"), tr("Python setup could not be downloaded, reason: %1.\nPlease install it manually.").arg(error));
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif // Q_OS_WIN
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue