renamed getInstance() -> instance() for singletons
This commit is contained in:
@@ -35,7 +35,7 @@ bool Paths::createFolder(const QString &folderPath)
|
||||
|
||||
bool Paths::isPortable()
|
||||
{
|
||||
return Modes::getInstance().isPortable;
|
||||
return Modes::instance().isPortable;
|
||||
}
|
||||
|
||||
QString Paths::cacheDirectory()
|
||||
|
||||
@@ -9,12 +9,12 @@
|
||||
|
||||
namespace chatterino {
|
||||
|
||||
Settings *Settings::instance = nullptr;
|
||||
Settings *Settings::instance_ = nullptr;
|
||||
|
||||
Settings::Settings(const QString &settingsDirectory)
|
||||
: ABSettings(settingsDirectory)
|
||||
{
|
||||
instance = this;
|
||||
instance_ = this;
|
||||
|
||||
#ifdef USEWINSDK
|
||||
this->autorun = isRegisteredForStartup();
|
||||
@@ -23,14 +23,14 @@ Settings::Settings(const QString &settingsDirectory)
|
||||
#endif
|
||||
}
|
||||
|
||||
Settings &Settings::getInstance()
|
||||
Settings &Settings::instance()
|
||||
{
|
||||
return *instance;
|
||||
return *instance_;
|
||||
}
|
||||
|
||||
Settings *getSettings()
|
||||
{
|
||||
return &Settings::getInstance();
|
||||
return &Settings::instance();
|
||||
}
|
||||
|
||||
} // namespace chatterino
|
||||
|
||||
@@ -13,12 +13,12 @@ namespace chatterino {
|
||||
|
||||
class Settings : public ABSettings
|
||||
{
|
||||
static Settings *instance;
|
||||
static Settings *instance_;
|
||||
|
||||
public:
|
||||
Settings(const QString &settingsDirectory);
|
||||
|
||||
static Settings &getInstance();
|
||||
static Settings &instance();
|
||||
|
||||
/// Appearance
|
||||
BoolSetting showTimestamps = {"/appearance/messages/showTimestamps", true};
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#include "widgets/TooltipWidget.hpp"
|
||||
|
||||
namespace chatterino {
|
||||
TooltipPreviewImage &TooltipPreviewImage::getInstance()
|
||||
TooltipPreviewImage &TooltipPreviewImage::instance()
|
||||
{
|
||||
static TooltipPreviewImage *instance = new TooltipPreviewImage();
|
||||
return *instance;
|
||||
@@ -14,7 +14,7 @@ TooltipPreviewImage &TooltipPreviewImage::getInstance()
|
||||
TooltipPreviewImage::TooltipPreviewImage()
|
||||
{
|
||||
connections_.push_back(getApp()->windows->gifRepaintRequested.connect([&] {
|
||||
auto tooltipWidget = TooltipWidget::getInstance();
|
||||
auto tooltipWidget = TooltipWidget::instance();
|
||||
if (this->image_ && !tooltipWidget->isHidden())
|
||||
{
|
||||
auto pixmap = this->image_->pixmapOrLoad();
|
||||
|
||||
@@ -6,7 +6,7 @@ namespace chatterino {
|
||||
class TooltipPreviewImage
|
||||
{
|
||||
public:
|
||||
static TooltipPreviewImage &getInstance();
|
||||
static TooltipPreviewImage &instance();
|
||||
void setImage(ImagePtr image);
|
||||
|
||||
TooltipPreviewImage(const TooltipPreviewImage &) = delete;
|
||||
|
||||
@@ -62,7 +62,7 @@ Updates::Updates()
|
||||
qDebug() << "init UpdateManager";
|
||||
}
|
||||
|
||||
Updates &Updates::getInstance()
|
||||
Updates &Updates::instance()
|
||||
{
|
||||
// fourtf: don't add this class to the application class
|
||||
static Updates instance;
|
||||
@@ -234,7 +234,7 @@ void Updates::checkForUpdates()
|
||||
{
|
||||
// Disable updates if on nightly and windows.
|
||||
#ifdef Q_OS_WIN
|
||||
if (Modes::getInstance().isNightly)
|
||||
if (Modes::instance().isNightly)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ public:
|
||||
};
|
||||
|
||||
// fourtf: don't add this class to the application class
|
||||
static Updates &getInstance();
|
||||
static Updates &instance();
|
||||
|
||||
void checkForUpdates();
|
||||
const QString &getCurrentVersion() const;
|
||||
|
||||
@@ -649,7 +649,7 @@ IndirectChannel WindowManager::decodeChannel(const QJsonObject &obj)
|
||||
}
|
||||
else if (type == "irc")
|
||||
{
|
||||
return Irc::getInstance().getOrAddChannel(
|
||||
return Irc::instance().getOrAddChannel(
|
||||
obj.value("server").toInt(-1), obj.value("channel").toString());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user