Skip to content

Commit

Permalink
Follow project coding style. Issue qbittorrent#2192.
Browse files Browse the repository at this point in the history
  • Loading branch information
silverqx committed Sep 24, 2017
1 parent 2eb3ec1 commit ef63202
Showing 1 changed file with 17 additions and 9 deletions.
26 changes: 17 additions & 9 deletions src/base/preferences.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,11 @@
#include "logger.h"
#include "preferences.h"

Preferences* Preferences::m_instance = 0;
Preferences *Preferences::m_instance = 0;

Preferences::Preferences() {}
Preferences::Preferences()
{
}

Preferences *Preferences::instance()
{
Expand Down Expand Up @@ -193,6 +195,7 @@ void Preferences::setCloseToTray(bool b)
{
setValue("Preferences/General/CloseToTray", b);
}

#endif

bool Preferences::isToolbarDisplayed() const
Expand Down Expand Up @@ -264,6 +267,7 @@ void Preferences::setWinStartup(bool b)
settings.remove("qBittorrent");
}
}

#endif

// Downloads
Expand Down Expand Up @@ -740,6 +744,7 @@ void Preferences::useSystemIconTheme(bool enabled)
{
setValue("Preferences/Advanced/useSystemIconTheme", enabled);
}

#endif

bool Preferences::recursiveDownloadDisabled() const
Expand All @@ -753,7 +758,8 @@ void Preferences::disableRecursiveDownload(bool disable)
}

#ifdef Q_OS_WIN
namespace {
namespace
{
enum REG_SEARCH_TYPE
{
USER,
Expand Down Expand Up @@ -842,7 +848,7 @@ namespace {
versions.sort();

bool found = false;
while(!found && !versions.empty()) {
while (!found && !versions.empty()) {
const QString version = versions.takeLast() + "\\InstallPath";
LPWSTR lpSubkey = new WCHAR[version.size() + 1];
version.toWCharArray(lpSubkey);
Expand Down Expand Up @@ -872,7 +878,6 @@ namespace {

return path;
}

}

QString Preferences::getPythonPath()
Expand Down Expand Up @@ -978,6 +983,7 @@ void Preferences::setMagnetLinkAssoc(bool set)

SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST, 0, 0);
}

#endif

#ifdef Q_OS_MAC
Expand Down Expand Up @@ -1034,6 +1040,7 @@ void Preferences::setMagnetLinkAssoc()
CFStringRef myBundleId = CFBundleGetIdentifier(CFBundleGetMainBundle());
LSSetDefaultHandlerForURLScheme(magnetUrlScheme, myBundleId);
}

#endif

int Preferences::getTrackerPort() const
Expand All @@ -1056,6 +1063,7 @@ void Preferences::setUpdateCheckEnabled(bool enabled)
{
setValue("Preferences/Advanced/updateCheck", enabled);
}

#endif

bool Preferences::confirmTorrentDeletion() const
Expand Down Expand Up @@ -1098,6 +1106,7 @@ void Preferences::setTrayIconStyle(TrayIcon::Style style)
{
setValue("Preferences/Advanced/TrayIconStyle", style);
}

#endif

// Stuff that don't appear in the Options GUI but are saved
Expand Down Expand Up @@ -1163,7 +1172,7 @@ void Preferences::setMainLastDir(const QString &path)
setValue("MainWindowLastDir", path);
}

QSize Preferences::getPrefSize(const QSize& defaultSize) const
QSize Preferences::getPrefSize(const QSize &defaultSize) const
{
return value("Preferences/State/size", defaultSize).toSize();
}
Expand Down Expand Up @@ -1393,7 +1402,7 @@ void Preferences::setTransHeaderState(const QByteArray &state)
setValue("TransferList/qt5/HeaderState", state);
}

//From old RssSettings class
// From old RssSettings class
bool Preferences::isRSSWidgetEnabled() const
{
return value("GUI/RSSWidget/Enabled", false).toBool();
Expand Down Expand Up @@ -1459,10 +1468,9 @@ void Preferences::upgrade()
QStringList labels = value("TransferListFilters/customLabels").toStringList();
if (!labels.isEmpty()) {
QVariantMap categories = value("BitTorrent/Session/Categories").toMap();
foreach (const QString &label, labels) {
foreach (const QString &label, labels)
if (!categories.contains(label))
categories[label] = "";
}
setValue("BitTorrent/Session/Categories", categories);
SettingsStorage::instance()->removeValue("TransferListFilters/customLabels");
}
Expand Down

0 comments on commit ef63202

Please sign in to comment.