mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-22 00:17:23 -06:00
Clean up usage of static keyword
They are either misused or redundant, so remove it.
This commit is contained in:
@@ -635,7 +635,7 @@ Path Session::downloadPath() const
|
||||
|
||||
bool Session::isValidCategoryName(const QString &name)
|
||||
{
|
||||
static const QRegularExpression re(uR"(^([^\\\/]|[^\\\/]([^\\\/]|\/(?=[^\/]))*[^\\\/])$)"_qs);
|
||||
const QRegularExpression re(uR"(^([^\\\/]|[^\\\/]([^\\\/]|\/(?=[^\/]))*[^\\\/])$)"_qs);
|
||||
if (!name.isEmpty() && (name.indexOf(re) != 0))
|
||||
{
|
||||
qDebug() << "Incorrect category name:" << name;
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
#include "base/bittorrent/sessionstatus.h"
|
||||
#include "base/profile.h"
|
||||
|
||||
static const qint64 SAVE_INTERVAL = 15 * 60 * 1000;
|
||||
const qint64 SAVE_INTERVAL = 15 * 60 * 1000;
|
||||
|
||||
using namespace BitTorrent;
|
||||
|
||||
|
||||
@@ -68,7 +68,7 @@ QString Item::name() const
|
||||
|
||||
bool Item::isValidPath(const QString &path)
|
||||
{
|
||||
static const QRegularExpression re(
|
||||
const QRegularExpression re(
|
||||
uR"(\A[^\%1]+(\%1[^\%1]+)*\z)"_qs.arg(Item::PathSeparator)
|
||||
, QRegularExpression::DontCaptureOption);
|
||||
|
||||
|
||||
@@ -31,6 +31,14 @@
|
||||
#include "settingvalue.h"
|
||||
#include "utils/fs.h"
|
||||
|
||||
namespace
|
||||
{
|
||||
SettingValue<TorrentFileGuard::AutoDeleteMode> autoDeleteModeSetting()
|
||||
{
|
||||
return SettingValue<TorrentFileGuard::AutoDeleteMode> {u"Core/AutoDeleteAddedTorrentFile"_qs};
|
||||
}
|
||||
}
|
||||
|
||||
FileGuard::FileGuard(const Path &path)
|
||||
: m_path {path}
|
||||
, m_remove {true}
|
||||
@@ -76,13 +84,7 @@ TorrentFileGuard::AutoDeleteMode TorrentFileGuard::autoDeleteMode()
|
||||
return autoDeleteModeSetting().get(AutoDeleteMode::Never);
|
||||
}
|
||||
|
||||
void TorrentFileGuard::setAutoDeleteMode(TorrentFileGuard::AutoDeleteMode mode)
|
||||
void TorrentFileGuard::setAutoDeleteMode(const TorrentFileGuard::AutoDeleteMode mode)
|
||||
{
|
||||
autoDeleteModeSetting() = mode;
|
||||
}
|
||||
|
||||
SettingValue<TorrentFileGuard::AutoDeleteMode> &TorrentFileGuard::autoDeleteModeSetting()
|
||||
{
|
||||
static SettingValue<AutoDeleteMode> setting {u"Core/AutoDeleteAddedTorrentFile"_qs};
|
||||
return setting;
|
||||
}
|
||||
|
||||
@@ -33,8 +33,6 @@
|
||||
|
||||
#include "base/path.h"
|
||||
|
||||
template <typename T> class SettingValue;
|
||||
|
||||
/// Utility class to defer file deletion
|
||||
class FileGuard
|
||||
{
|
||||
@@ -47,7 +45,7 @@ public:
|
||||
|
||||
private:
|
||||
Path m_path;
|
||||
bool m_remove;
|
||||
bool m_remove = false;
|
||||
};
|
||||
|
||||
/// Reads settings for .torrent files from preferences
|
||||
@@ -64,7 +62,7 @@ public:
|
||||
void markAsAddedToSession();
|
||||
using FileGuard::setAutoRemove;
|
||||
|
||||
enum AutoDeleteMode: int // do not change these names: they are stored in config file
|
||||
enum AutoDeleteMode : int // do not change these names: they are stored in config file
|
||||
{
|
||||
Never,
|
||||
IfAdded,
|
||||
@@ -77,9 +75,8 @@ public:
|
||||
|
||||
private:
|
||||
TorrentFileGuard(const Path &path, AutoDeleteMode mode);
|
||||
static SettingValue<AutoDeleteMode> &autoDeleteModeSetting();
|
||||
|
||||
Q_ENUM(AutoDeleteMode)
|
||||
AutoDeleteMode m_mode;
|
||||
bool m_wasAdded;
|
||||
bool m_wasAdded = false;
|
||||
};
|
||||
|
||||
@@ -457,7 +457,7 @@ QString Utils::Misc::parseHtmlLinks(const QString &rawText)
|
||||
result.replace(reURL, u"\\1<a href=\"\\2\">\\2</a>"_qs);
|
||||
|
||||
// Capture links without scheme
|
||||
static const QRegularExpression reNoScheme(u"<a\\s+href=\"(?!https?)([a-zA-Z0-9\\?%=&/_\\.-:#]+)\\s*\">"_qs);
|
||||
const QRegularExpression reNoScheme(u"<a\\s+href=\"(?!https?)([a-zA-Z0-9\\?%=&/_\\.-:#]+)\\s*\">"_qs);
|
||||
result.replace(reNoScheme, u"<a href=\"http://\\1\">"_qs);
|
||||
|
||||
// to preserve plain text formatting
|
||||
|
||||
Reference in New Issue
Block a user