renamed getInstance() -> instance() for singletons

This commit is contained in:
fourtf 2019-10-07 22:42:34 +02:00
parent aeab038bc8
commit 6f710823ed
37 changed files with 77 additions and 77 deletions

View file

@ -82,7 +82,7 @@ void Application::initialize(Settings &settings, Paths &paths)
if (getSettings()->enableExperimentalIrc) if (getSettings()->enableExperimentalIrc)
{ {
Irc::getInstance().load(); Irc::instance().load();
} }
for (auto &singleton : this->singletons_) for (auto &singleton : this->singletons_)
@ -130,7 +130,7 @@ int Application::run(QApplication &qtApp)
this->windows->getMainWindow().show(); this->windows->getMainWindow().show();
getSettings()->betaUpdates.connect( getSettings()->betaUpdates.connect(
[] { Updates::getInstance().checkForUpdates(); }, false); [] { Updates::instance().checkForUpdates(); }, false);
return qtApp.exec(); return qtApp.exec();
} }

View file

@ -194,7 +194,7 @@ void runGui(QApplication &a, Paths &paths, Settings &settings)
}); });
chatterino::NetworkManager::init(); chatterino::NetworkManager::init();
chatterino::Updates::getInstance().checkForUpdates(); chatterino::Updates::instance().checkForUpdates();
#ifdef C_USE_BREAKPAD #ifdef C_USE_BREAKPAD
QBreakpadInstance.setDumpPath(getPaths()->settingsFolderPath + "/Crashes"); QBreakpadInstance.setDumpPath(getPaths()->settingsFolderPath + "/Crashes");

View file

@ -178,7 +178,7 @@ void Channel::addOrReplaceTimeout(MessagePtr message)
} }
// XXX: Might need the following line // XXX: Might need the following line
// WindowManager::getInstance().repaintVisibleChatWidgets(this); // WindowManager::instance().repaintVisibleChatWidgets(this);
} }
void Channel::disableAllMessages() void Channel::disableAllMessages()

View file

@ -143,7 +143,7 @@ namespace {
} }
} // namespace } // namespace
Credentials &Credentials::getInstance() Credentials &Credentials::instance()
{ {
static Credentials creds; static Credentials creds;
return creds; return creds;

View file

@ -8,7 +8,7 @@ namespace chatterino {
class Credentials class Credentials
{ {
public: public:
static Credentials &getInstance(); static Credentials &instance();
void get(const QString &provider, const QString &name, QObject *receiver, void get(const QString &provider, const QString &name, QObject *receiver,
std::function<void(const QString &)> &&onLoaded); std::function<void(const QString &)> &&onLoaded);

View file

@ -27,7 +27,7 @@ Modes::Modes()
} }
} }
const Modes &Modes::getInstance() const Modes &Modes::instance()
{ {
static Modes instance; static Modes instance;
return instance; return instance;

View file

@ -7,7 +7,7 @@ class Modes
public: public:
Modes(); Modes();
static const Modes &getInstance(); static const Modes &instance();
bool isNightly{}; bool isNightly{};
bool isPortable{}; bool isPortable{};

View file

@ -26,7 +26,7 @@ Version::Version()
// "Full" version string, as displayed in window title // "Full" version string, as displayed in window title
this->fullVersion_ = "Chatterino "; this->fullVersion_ = "Chatterino ";
if (Modes::getInstance().isNightly) if (Modes::instance().isNightly)
{ {
this->fullVersion_ += "Nightly "; this->fullVersion_ += "Nightly ";
} }
@ -34,7 +34,7 @@ Version::Version()
this->fullVersion_ += this->version_; this->fullVersion_ += this->version_;
} }
const Version &Version::getInstance() const Version &Version::instance()
{ {
static Version instance; static Version instance;
return instance; return instance;

View file

@ -20,7 +20,7 @@ namespace chatterino {
class Version class Version
{ {
public: public:
static const Version &getInstance(); static const Version &instance();
const QString &version() const; const QString &version() const;
const QString &commitHash() const; const QString &commitHash() const;

View file

@ -32,7 +32,7 @@ int main(int argc, char **argv)
} }
else if (getArgs().printVersion) else if (getArgs().printVersion)
{ {
qInfo().noquote() << Version::getInstance().fullVersion(); qInfo().noquote() << Version::instance().fullVersion();
} }
else else
{ {
@ -45,7 +45,7 @@ int main(int argc, char **argv)
catch (std::runtime_error &error) catch (std::runtime_error &error)
{ {
QMessageBox box; QMessageBox box;
if (Modes::getInstance().isPortable) if (Modes::instance().isPortable)
{ {
box.setText( box.setText(
error.what() + error.what() +

View file

@ -73,13 +73,13 @@ inline QString getCredentialName(const IrcServerData &data)
void IrcServerData::getPassword( void IrcServerData::getPassword(
QObject *receiver, std::function<void(const QString &)> &&onLoaded) const QObject *receiver, std::function<void(const QString &)> &&onLoaded) const
{ {
Credentials::getInstance().get("irc", getCredentialName(*this), receiver, Credentials::instance().get("irc", getCredentialName(*this), receiver,
std::move(onLoaded)); std::move(onLoaded));
} }
void IrcServerData::setPassword(const QString &password) void IrcServerData::setPassword(const QString &password)
{ {
Credentials::getInstance().set("irc", getCredentialName(*this), password); Credentials::instance().set("irc", getCredentialName(*this), password);
} }
Irc::Irc() Irc::Irc()
@ -133,7 +133,7 @@ Irc::Irc()
if (args.caller != Irc::noEraseCredentialCaller) if (args.caller != Irc::noEraseCredentialCaller)
{ {
Credentials::getInstance().erase("irc", Credentials::instance().erase("irc",
getCredentialName(args.item)); getCredentialName(args.item));
} }
}); });
@ -164,7 +164,7 @@ ChannelPtr Irc::getOrAddChannel(int id, QString name)
} }
} }
Irc &Irc::getInstance() Irc &Irc::instance()
{ {
static Irc irc; static Irc irc;
return irc; return irc;

View file

@ -36,7 +36,7 @@ class Irc
public: public:
Irc(); Irc();
static Irc &getInstance(); static Irc &instance();
static inline void *const noEraseCredentialCaller = static inline void *const noEraseCredentialCaller =
reinterpret_cast<void *>(1); reinterpret_cast<void *>(1);

View file

@ -40,7 +40,7 @@ static QMap<QString, QString> parseBadges(QString badgesString)
return badges; return badges;
} }
IrcMessageHandler &IrcMessageHandler::getInstance() IrcMessageHandler &IrcMessageHandler::instance()
{ {
static IrcMessageHandler instance; static IrcMessageHandler instance;
return instance; return instance;

View file

@ -13,7 +13,7 @@ class IrcMessageHandler
IrcMessageHandler() = default; IrcMessageHandler() = default;
public: public:
static IrcMessageHandler &getInstance(); static IrcMessageHandler &instance();
// parseMessage parses a single IRC message into 0+ Chatterino messages // parseMessage parses a single IRC message into 0+ Chatterino messages
std::vector<MessagePtr> parseMessage(Channel *channel, std::vector<MessagePtr> parseMessage(Channel *channel,

View file

@ -566,7 +566,7 @@ void TwitchChannel::loadRecentMessages()
auto messages = parseRecentMessages(result.parseJson(), shared); auto messages = parseRecentMessages(result.parseJson(), shared);
auto &handler = IrcMessageHandler::getInstance(); auto &handler = IrcMessageHandler::instance();
std::vector<MessagePtr> allBuiltMessages; std::vector<MessagePtr> allBuiltMessages;

View file

@ -125,7 +125,7 @@ std::shared_ptr<Channel> TwitchIrcServer::createChannel(
void TwitchIrcServer::privateMessageReceived( void TwitchIrcServer::privateMessageReceived(
Communi::IrcPrivateMessage *message) Communi::IrcPrivateMessage *message)
{ {
IrcMessageHandler::getInstance().handlePrivMessage(message, *this); IrcMessageHandler::instance().handlePrivMessage(message, *this);
} }
void TwitchIrcServer::readConnectionMessageReceived( void TwitchIrcServer::readConnectionMessageReceived(
@ -141,7 +141,7 @@ void TwitchIrcServer::readConnectionMessageReceived(
const QString &command = message->command(); const QString &command = message->command();
auto &handler = IrcMessageHandler::getInstance(); auto &handler = IrcMessageHandler::instance();
// Below commands enabled through the twitch.tv/membership CAP REQ // Below commands enabled through the twitch.tv/membership CAP REQ
if (command == "MODE") if (command == "MODE")
@ -194,7 +194,7 @@ void TwitchIrcServer::writeConnectionMessageReceived(
{ {
const QString &command = message->command(); const QString &command = message->command();
auto &handler = IrcMessageHandler::getInstance(); auto &handler = IrcMessageHandler::instance();
// Below commands enabled through the twitch.tv/commands CAP REQ // Below commands enabled through the twitch.tv/commands CAP REQ
if (command == "USERSTATE") if (command == "USERSTATE")
{ {

View file

@ -652,7 +652,7 @@ void TwitchMessageBuilder::appendUsername()
{ {
// TODO(pajlada): Re-implement // TODO(pajlada): Re-implement
// userDisplayString += // userDisplayString +=
// IrcManager::getInstance().getUser().getUserName(); // IrcManager::instance().getUser().getUserName();
} }
else if (this->args.isReceivedWhisper) else if (this->args.isReceivedWhisper)
{ {

View file

@ -35,7 +35,7 @@ bool Paths::createFolder(const QString &folderPath)
bool Paths::isPortable() bool Paths::isPortable()
{ {
return Modes::getInstance().isPortable; return Modes::instance().isPortable;
} }
QString Paths::cacheDirectory() QString Paths::cacheDirectory()

View file

@ -9,12 +9,12 @@
namespace chatterino { namespace chatterino {
Settings *Settings::instance = nullptr; Settings *Settings::instance_ = nullptr;
Settings::Settings(const QString &settingsDirectory) Settings::Settings(const QString &settingsDirectory)
: ABSettings(settingsDirectory) : ABSettings(settingsDirectory)
{ {
instance = this; instance_ = this;
#ifdef USEWINSDK #ifdef USEWINSDK
this->autorun = isRegisteredForStartup(); this->autorun = isRegisteredForStartup();
@ -23,14 +23,14 @@ Settings::Settings(const QString &settingsDirectory)
#endif #endif
} }
Settings &Settings::getInstance() Settings &Settings::instance()
{ {
return *instance; return *instance_;
} }
Settings *getSettings() Settings *getSettings()
{ {
return &Settings::getInstance(); return &Settings::instance();
} }
} // namespace chatterino } // namespace chatterino

View file

@ -13,12 +13,12 @@ namespace chatterino {
class Settings : public ABSettings class Settings : public ABSettings
{ {
static Settings *instance; static Settings *instance_;
public: public:
Settings(const QString &settingsDirectory); Settings(const QString &settingsDirectory);
static Settings &getInstance(); static Settings &instance();
/// Appearance /// Appearance
BoolSetting showTimestamps = {"/appearance/messages/showTimestamps", true}; BoolSetting showTimestamps = {"/appearance/messages/showTimestamps", true};

View file

@ -5,7 +5,7 @@
#include "widgets/TooltipWidget.hpp" #include "widgets/TooltipWidget.hpp"
namespace chatterino { namespace chatterino {
TooltipPreviewImage &TooltipPreviewImage::getInstance() TooltipPreviewImage &TooltipPreviewImage::instance()
{ {
static TooltipPreviewImage *instance = new TooltipPreviewImage(); static TooltipPreviewImage *instance = new TooltipPreviewImage();
return *instance; return *instance;
@ -14,7 +14,7 @@ TooltipPreviewImage &TooltipPreviewImage::getInstance()
TooltipPreviewImage::TooltipPreviewImage() TooltipPreviewImage::TooltipPreviewImage()
{ {
connections_.push_back(getApp()->windows->gifRepaintRequested.connect([&] { connections_.push_back(getApp()->windows->gifRepaintRequested.connect([&] {
auto tooltipWidget = TooltipWidget::getInstance(); auto tooltipWidget = TooltipWidget::instance();
if (this->image_ && !tooltipWidget->isHidden()) if (this->image_ && !tooltipWidget->isHidden())
{ {
auto pixmap = this->image_->pixmapOrLoad(); auto pixmap = this->image_->pixmapOrLoad();

View file

@ -6,7 +6,7 @@ namespace chatterino {
class TooltipPreviewImage class TooltipPreviewImage
{ {
public: public:
static TooltipPreviewImage &getInstance(); static TooltipPreviewImage &instance();
void setImage(ImagePtr image); void setImage(ImagePtr image);
TooltipPreviewImage(const TooltipPreviewImage &) = delete; TooltipPreviewImage(const TooltipPreviewImage &) = delete;

View file

@ -62,7 +62,7 @@ Updates::Updates()
qDebug() << "init UpdateManager"; qDebug() << "init UpdateManager";
} }
Updates &Updates::getInstance() Updates &Updates::instance()
{ {
// fourtf: don't add this class to the application class // fourtf: don't add this class to the application class
static Updates instance; static Updates instance;
@ -234,7 +234,7 @@ void Updates::checkForUpdates()
{ {
// Disable updates if on nightly and windows. // Disable updates if on nightly and windows.
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
if (Modes::getInstance().isNightly) if (Modes::instance().isNightly)
{ {
return; return;
} }

View file

@ -22,7 +22,7 @@ public:
}; };
// fourtf: don't add this class to the application class // fourtf: don't add this class to the application class
static Updates &getInstance(); static Updates &instance();
void checkForUpdates(); void checkForUpdates();
const QString &getCurrentVersion() const; const QString &getCurrentVersion() const;

View file

@ -649,7 +649,7 @@ IndirectChannel WindowManager::decodeChannel(const QJsonObject &obj)
} }
else if (type == "irc") else if (type == "irc")
{ {
return Irc::getInstance().getOrAddChannel( return Irc::instance().getOrAddChannel(
obj.value("server").toInt(-1), obj.value("channel").toString()); obj.value("server").toInt(-1), obj.value("channel").toString());
} }

View file

@ -27,7 +27,7 @@ void initUpdateButton(Button &button,
} }
break; break;
case UpdateDialog::Install: { case UpdateDialog::Install: {
Updates::getInstance().installUpdates(); Updates::instance().installUpdates();
} }
break; break;
} }
@ -39,18 +39,18 @@ void initUpdateButton(Button &button,
// update image when state changes // update image when state changes
auto updateChange = [&button](auto) { auto updateChange = [&button](auto) {
button.setVisible(Updates::getInstance().shouldShowUpdateButton()); button.setVisible(Updates::instance().shouldShowUpdateButton());
auto imageUrl = Updates::getInstance().isError() auto imageUrl = Updates::instance().isError()
? ":/buttons/updateError.png" ? ":/buttons/updateError.png"
: ":/buttons/update.png"; : ":/buttons/update.png";
button.setPixmap(QPixmap(imageUrl)); button.setPixmap(QPixmap(imageUrl));
}; };
updateChange(Updates::getInstance().getStatus()); updateChange(Updates::instance().getStatus());
signalHolder.managedConnect( signalHolder.managedConnect(
Updates::getInstance().statusUpdated, Updates::instance().statusUpdated,
[updateChange](auto status) { updateChange(status); }); [updateChange](auto status) { updateChange(status); });
} }

View file

@ -464,7 +464,7 @@ void BaseWindow::changeEvent(QEvent *)
{ {
if (this->isVisible()) if (this->isVisible())
{ {
TooltipWidget::getInstance()->hide(); TooltipWidget::instance()->hide();
} }
#ifdef USEWINSDK #ifdef USEWINSDK
@ -494,7 +494,7 @@ void BaseWindow::changeEvent(QEvent *)
void BaseWindow::leaveEvent(QEvent *) void BaseWindow::leaveEvent(QEvent *)
{ {
TooltipWidget::getInstance()->hide(); TooltipWidget::instance()->hide();
} }
void BaseWindow::moveTo(QWidget *parent, QPoint point, bool offset) void BaseWindow::moveTo(QWidget *parent, QPoint point, bool offset)

View file

@ -14,7 +14,7 @@
namespace chatterino { namespace chatterino {
TooltipWidget *TooltipWidget::getInstance() TooltipWidget *TooltipWidget::instance()
{ {
static TooltipWidget *tooltipWidget = new TooltipWidget(); static TooltipWidget *tooltipWidget = new TooltipWidget();
return tooltipWidget; return tooltipWidget;

View file

@ -13,7 +13,7 @@ class TooltipWidget : public BaseWindow
Q_OBJECT Q_OBJECT
public: public:
static TooltipWidget *getInstance(); static TooltipWidget *instance();
TooltipWidget(BaseWidget *parent = nullptr); TooltipWidget(BaseWidget *parent = nullptr);
~TooltipWidget() override; ~TooltipWidget() override;

View file

@ -367,7 +367,7 @@ void Window::onAccountSelected()
auto user = getApp()->accounts->twitch.getCurrent(); auto user = getApp()->accounts->twitch.getCurrent();
// update title // update title
this->setWindowTitle(Version::getInstance().fullVersion()); this->setWindowTitle(Version::instance().fullVersion());
// update user // update user
if (user->isAnon()) if (user->isAnon())

View file

@ -31,7 +31,7 @@ LastRunCrashDialog::LastRunCrashDialog()
// QDialogButtonBox::NoRole); installUpdateButton->setEnabled(false); // QDialogButtonBox::NoRole); installUpdateButton->setEnabled(false);
// QObject::connect(installUpdateButton, &QPushButton::clicked, [this, // QObject::connect(installUpdateButton, &QPushButton::clicked, [this,
// update]() mutable { // update]() mutable {
// auto &updateManager = UpdateManager::getInstance(); // auto &updateManager = UpdateManager::instance();
// updateManager.installUpdates(); // updateManager.installUpdates();
// this->setEnabled(false); // this->setEnabled(false);
@ -45,7 +45,7 @@ LastRunCrashDialog::LastRunCrashDialog()
// Updates // Updates
// auto updateUpdateLabel = [update]() mutable { // auto updateUpdateLabel = [update]() mutable {
// auto &updateManager = UpdateManager::getInstance(); // auto &updateManager = UpdateManager::instance();
// switch (updateManager.getStatus()) { // switch (updateManager.getStatus()) {
// case UpdateManager::None: { // case UpdateManager::None: {

View file

@ -134,7 +134,7 @@ SelectChannelDialog::SelectChannelDialog(QWidget *parent)
{ {
auto view = this->ui_.irc.servers = new EditableModelView( auto view = this->ui_.irc.servers = new EditableModelView(
Irc::getInstance().newConnectionModel(this)); Irc::instance().newConnectionModel(this));
view->setTitles({"host", "port", "ssl", "user", "nick", "real", view->setTitles({"host", "port", "ssl", "user", "nick", "real",
"password", "login command"}); "password", "login command"});
@ -147,12 +147,12 @@ SelectChannelDialog::SelectChannelDialog(QWidget *parent)
view->addButtonPressed.connect([] { view->addButtonPressed.connect([] {
auto unique = IrcServerData{}; auto unique = IrcServerData{};
unique.id = Irc::getInstance().uniqueId(); unique.id = Irc::instance().uniqueId();
auto editor = new IrcConnectionEditor(unique); auto editor = new IrcConnectionEditor(unique);
if (editor->exec() == QDialog::Accepted) if (editor->exec() == QDialog::Accepted)
{ {
Irc::getInstance().connections.appendItem(editor->data()); Irc::instance().connections.appendItem(editor->data());
} }
}); });
@ -160,22 +160,22 @@ SelectChannelDialog::SelectChannelDialog(QWidget *parent)
view->getTableView(), &QTableView::doubleClicked, view->getTableView(), &QTableView::doubleClicked,
[](const QModelIndex &index) { [](const QModelIndex &index) {
auto editor = new IrcConnectionEditor( auto editor = new IrcConnectionEditor(
Irc::getInstance() Irc::instance()
.connections.getVector()[size_t(index.row())]); .connections.getVector()[size_t(index.row())]);
if (editor->exec() == QDialog::Accepted) if (editor->exec() == QDialog::Accepted)
{ {
auto data = editor->data(); auto data = editor->data();
auto &&conns = auto &&conns =
Irc::getInstance().connections.getVector(); Irc::instance().connections.getVector();
int i = 0; int i = 0;
for (auto &&conn : conns) for (auto &&conn : conns)
{ {
if (conn.id == data.id) if (conn.id == data.id)
{ {
Irc::getInstance().connections.removeItem( Irc::instance().connections.removeItem(
i, Irc::noEraseCredentialCaller); i, Irc::noEraseCredentialCaller);
Irc::getInstance().connections.insertItem(data, Irc::instance().connections.insertItem(data,
i); i);
} }
i++; i++;
@ -289,7 +289,7 @@ void SelectChannelDialog::setSelectedChannel(IndirectChannel _channel)
if (auto server = ircChannel->server()) if (auto server = ircChannel->server())
{ {
int i = 0; int i = 0;
for (auto &&conn : Irc::getInstance().connections) for (auto &&conn : Irc::instance().connections)
{ {
if (conn.id == server->id()) if (conn.id == server->id())
{ {
@ -350,11 +350,11 @@ IndirectChannel SelectChannelDialog::getSelectedChannel() const
->currentIndex() ->currentIndex()
.row(); .row();
auto &&vector = Irc::getInstance().connections.getVector(); auto &&vector = Irc::instance().connections.getVector();
if (row >= 0 && row < int(vector.size())) if (row >= 0 && row < int(vector.size()))
{ {
return Irc::getInstance().getOrAddChannel( return Irc::instance().getOrAddChannel(
vector[size_t(row)].id, this->ui_.irc.channel->text()); vector[size_t(row)].id, this->ui_.irc.channel->text());
} }
else else

View file

@ -26,7 +26,7 @@ UpdateDialog::UpdateDialog()
auto dismiss = buttons->addButton("Dismiss", QDialogButtonBox::RejectRole); auto dismiss = buttons->addButton("Dismiss", QDialogButtonBox::RejectRole);
QObject::connect(install, &QPushButton::clicked, this, [this] { QObject::connect(install, &QPushButton::clicked, this, [this] {
Updates::getInstance().installUpdates(); Updates::instance().installUpdates();
this->close(); this->close();
}); });
QObject::connect(dismiss, &QPushButton::clicked, this, [this] { QObject::connect(dismiss, &QPushButton::clicked, this, [this] {
@ -34,9 +34,9 @@ UpdateDialog::UpdateDialog()
this->close(); this->close();
}); });
this->updateStatusChanged(Updates::getInstance().getStatus()); this->updateStatusChanged(Updates::instance().getStatus());
this->connections_.managedConnect( this->connections_.managedConnect(
Updates::getInstance().statusUpdated, Updates::instance().statusUpdated,
[this](auto status) { this->updateStatusChanged(status); }); [this](auto status) { this->updateStatusChanged(status); });
this->setScaleIndependantHeight(150); this->setScaleIndependantHeight(150);
@ -50,17 +50,17 @@ void UpdateDialog::updateStatusChanged(Updates::Status status)
{ {
case Updates::UpdateAvailable: { case Updates::UpdateAvailable: {
this->ui_.label->setText( this->ui_.label->setText(
(Updates::getInstance().isDowngrade() (Updates::instance().isDowngrade()
? QString( ? QString(
"The version online (%1) seems to be lower than the " "The version online (%1) seems to be lower than the "
"current (%2).\nEither a version was reverted or " "current (%2).\nEither a version was reverted or "
"you are running a newer build.\n\nDo you want to " "you are running a newer build.\n\nDo you want to "
"download and install it?") "download and install it?")
.arg(Updates::getInstance().getOnlineVersion(), .arg(Updates::instance().getOnlineVersion(),
Updates::getInstance().getCurrentVersion()) Updates::instance().getCurrentVersion())
: QString("An update (%1) is available.\n\nDo you want to " : QString("An update (%1) is available.\n\nDo you want to "
"download and install it?") "download and install it?")
.arg(Updates::getInstance().getOnlineVersion()))); .arg(Updates::instance().getOnlineVersion())));
this->updateGeometry(); this->updateGeometry();
} }
break; break;

View file

@ -1049,7 +1049,7 @@ void ChannelView::mouseMoveEvent(QMouseEvent *event)
this->pause(PauseReason::Mouse); this->pause(PauseReason::Mouse);
} }
auto tooltipWidget = TooltipWidget::getInstance(); auto tooltipWidget = TooltipWidget::instance();
std::shared_ptr<MessageLayout> layout; std::shared_ptr<MessageLayout> layout;
QPoint relativePos; QPoint relativePos;
int messageIndex; int messageIndex;
@ -1242,7 +1242,7 @@ void ChannelView::mouseMoveEvent(QMouseEvent *event)
} }
else else
{ {
auto &tooltipPreviewImage = TooltipPreviewImage::getInstance(); auto &tooltipPreviewImage = TooltipPreviewImage::instance();
auto emoteElement = dynamic_cast<const EmoteElement *>( auto emoteElement = dynamic_cast<const EmoteElement *>(
&hoverLayoutElement->getCreator()); &hoverLayoutElement->getCreator());
auto badgeElement = dynamic_cast<const BadgeElement *>( auto badgeElement = dynamic_cast<const BadgeElement *>(

View file

@ -75,7 +75,7 @@ AboutPage::AboutPage()
auto versionInfo = layout.emplace<QGroupBox>("Version"); auto versionInfo = layout.emplace<QGroupBox>("Version");
{ {
auto version = Version::getInstance(); auto version = Version::instance();
QString text = QString("%1 (commit %2%3)") QString text = QString("%1 (commit %2%3)")
.arg(version.fullVersion()) .arg(version.fullVersion())
.arg("<a " .arg("<a "
@ -83,7 +83,7 @@ AboutPage::AboutPage()
"chatterino2/commit/" + "chatterino2/commit/" +
version.commitHash() + "\">" + version.commitHash() + "\">" +
version.commitHash() + "</a>") version.commitHash() + "</a>")
.arg(Modes::getInstance().isNightly .arg(Modes::instance().isNightly
? ", " + version.dateOfBuild() ? ", " + version.dateOfBuild()
: ""); : "");

View file

@ -412,7 +412,7 @@ void Split::leaveEvent(QEvent *event)
this->overlay_->hide(); this->overlay_->hide();
TooltipWidget::getInstance()->hide(); TooltipWidget::instance()->hide();
this->handleModifiers(QGuiApplication::queryKeyboardModifiers()); this->handleModifiers(QGuiApplication::queryKeyboardModifiers());
} }

View file

@ -670,9 +670,9 @@ void SplitHeader::enterEvent(QEvent *event)
{ {
if (!this->tooltipText_.isEmpty()) if (!this->tooltipText_.isEmpty())
{ {
TooltipPreviewImage::getInstance().setImage(nullptr); TooltipPreviewImage::instance().setImage(nullptr);
auto tooltip = TooltipWidget::getInstance(); auto tooltip = TooltipWidget::instance();
tooltip->moveTo(this, this->mapToGlobal(this->rect().bottomLeft()), tooltip->moveTo(this, this->mapToGlobal(this->rect().bottomLeft()),
false); false);
tooltip->setText(this->tooltipText_); tooltip->setText(this->tooltipText_);
@ -687,7 +687,7 @@ void SplitHeader::enterEvent(QEvent *event)
void SplitHeader::leaveEvent(QEvent *event) void SplitHeader::leaveEvent(QEvent *event)
{ {
TooltipWidget::getInstance()->hide(); TooltipWidget::instance()->hide();
BaseWidget::leaveEvent(event); BaseWidget::leaveEvent(event);
} }