renamed getInstance() -> instance() for singletons
This commit is contained in:
@@ -464,7 +464,7 @@ void BaseWindow::changeEvent(QEvent *)
|
||||
{
|
||||
if (this->isVisible())
|
||||
{
|
||||
TooltipWidget::getInstance()->hide();
|
||||
TooltipWidget::instance()->hide();
|
||||
}
|
||||
|
||||
#ifdef USEWINSDK
|
||||
@@ -494,7 +494,7 @@ void BaseWindow::changeEvent(QEvent *)
|
||||
|
||||
void BaseWindow::leaveEvent(QEvent *)
|
||||
{
|
||||
TooltipWidget::getInstance()->hide();
|
||||
TooltipWidget::instance()->hide();
|
||||
}
|
||||
|
||||
void BaseWindow::moveTo(QWidget *parent, QPoint point, bool offset)
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
namespace chatterino {
|
||||
|
||||
TooltipWidget *TooltipWidget::getInstance()
|
||||
TooltipWidget *TooltipWidget::instance()
|
||||
{
|
||||
static TooltipWidget *tooltipWidget = new TooltipWidget();
|
||||
return tooltipWidget;
|
||||
|
||||
@@ -13,7 +13,7 @@ class TooltipWidget : public BaseWindow
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
static TooltipWidget *getInstance();
|
||||
static TooltipWidget *instance();
|
||||
|
||||
TooltipWidget(BaseWidget *parent = nullptr);
|
||||
~TooltipWidget() override;
|
||||
|
||||
@@ -367,7 +367,7 @@ void Window::onAccountSelected()
|
||||
auto user = getApp()->accounts->twitch.getCurrent();
|
||||
|
||||
// update title
|
||||
this->setWindowTitle(Version::getInstance().fullVersion());
|
||||
this->setWindowTitle(Version::instance().fullVersion());
|
||||
|
||||
// update user
|
||||
if (user->isAnon())
|
||||
|
||||
@@ -31,7 +31,7 @@ LastRunCrashDialog::LastRunCrashDialog()
|
||||
// QDialogButtonBox::NoRole); installUpdateButton->setEnabled(false);
|
||||
// QObject::connect(installUpdateButton, &QPushButton::clicked, [this,
|
||||
// update]() mutable {
|
||||
// auto &updateManager = UpdateManager::getInstance();
|
||||
// auto &updateManager = UpdateManager::instance();
|
||||
|
||||
// updateManager.installUpdates();
|
||||
// this->setEnabled(false);
|
||||
@@ -45,7 +45,7 @@ LastRunCrashDialog::LastRunCrashDialog()
|
||||
|
||||
// Updates
|
||||
// auto updateUpdateLabel = [update]() mutable {
|
||||
// auto &updateManager = UpdateManager::getInstance();
|
||||
// auto &updateManager = UpdateManager::instance();
|
||||
|
||||
// switch (updateManager.getStatus()) {
|
||||
// case UpdateManager::None: {
|
||||
|
||||
@@ -134,7 +134,7 @@ SelectChannelDialog::SelectChannelDialog(QWidget *parent)
|
||||
|
||||
{
|
||||
auto view = this->ui_.irc.servers = new EditableModelView(
|
||||
Irc::getInstance().newConnectionModel(this));
|
||||
Irc::instance().newConnectionModel(this));
|
||||
|
||||
view->setTitles({"host", "port", "ssl", "user", "nick", "real",
|
||||
"password", "login command"});
|
||||
@@ -147,12 +147,12 @@ SelectChannelDialog::SelectChannelDialog(QWidget *parent)
|
||||
|
||||
view->addButtonPressed.connect([] {
|
||||
auto unique = IrcServerData{};
|
||||
unique.id = Irc::getInstance().uniqueId();
|
||||
unique.id = Irc::instance().uniqueId();
|
||||
|
||||
auto editor = new IrcConnectionEditor(unique);
|
||||
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,
|
||||
[](const QModelIndex &index) {
|
||||
auto editor = new IrcConnectionEditor(
|
||||
Irc::getInstance()
|
||||
Irc::instance()
|
||||
.connections.getVector()[size_t(index.row())]);
|
||||
|
||||
if (editor->exec() == QDialog::Accepted)
|
||||
{
|
||||
auto data = editor->data();
|
||||
auto &&conns =
|
||||
Irc::getInstance().connections.getVector();
|
||||
Irc::instance().connections.getVector();
|
||||
int i = 0;
|
||||
for (auto &&conn : conns)
|
||||
{
|
||||
if (conn.id == data.id)
|
||||
{
|
||||
Irc::getInstance().connections.removeItem(
|
||||
Irc::instance().connections.removeItem(
|
||||
i, Irc::noEraseCredentialCaller);
|
||||
Irc::getInstance().connections.insertItem(data,
|
||||
Irc::instance().connections.insertItem(data,
|
||||
i);
|
||||
}
|
||||
i++;
|
||||
@@ -289,7 +289,7 @@ void SelectChannelDialog::setSelectedChannel(IndirectChannel _channel)
|
||||
if (auto server = ircChannel->server())
|
||||
{
|
||||
int i = 0;
|
||||
for (auto &&conn : Irc::getInstance().connections)
|
||||
for (auto &&conn : Irc::instance().connections)
|
||||
{
|
||||
if (conn.id == server->id())
|
||||
{
|
||||
@@ -350,11 +350,11 @@ IndirectChannel SelectChannelDialog::getSelectedChannel() const
|
||||
->currentIndex()
|
||||
.row();
|
||||
|
||||
auto &&vector = Irc::getInstance().connections.getVector();
|
||||
auto &&vector = Irc::instance().connections.getVector();
|
||||
|
||||
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());
|
||||
}
|
||||
else
|
||||
|
||||
@@ -26,7 +26,7 @@ UpdateDialog::UpdateDialog()
|
||||
auto dismiss = buttons->addButton("Dismiss", QDialogButtonBox::RejectRole);
|
||||
|
||||
QObject::connect(install, &QPushButton::clicked, this, [this] {
|
||||
Updates::getInstance().installUpdates();
|
||||
Updates::instance().installUpdates();
|
||||
this->close();
|
||||
});
|
||||
QObject::connect(dismiss, &QPushButton::clicked, this, [this] {
|
||||
@@ -34,9 +34,9 @@ UpdateDialog::UpdateDialog()
|
||||
this->close();
|
||||
});
|
||||
|
||||
this->updateStatusChanged(Updates::getInstance().getStatus());
|
||||
this->updateStatusChanged(Updates::instance().getStatus());
|
||||
this->connections_.managedConnect(
|
||||
Updates::getInstance().statusUpdated,
|
||||
Updates::instance().statusUpdated,
|
||||
[this](auto status) { this->updateStatusChanged(status); });
|
||||
|
||||
this->setScaleIndependantHeight(150);
|
||||
@@ -50,17 +50,17 @@ void UpdateDialog::updateStatusChanged(Updates::Status status)
|
||||
{
|
||||
case Updates::UpdateAvailable: {
|
||||
this->ui_.label->setText(
|
||||
(Updates::getInstance().isDowngrade()
|
||||
(Updates::instance().isDowngrade()
|
||||
? QString(
|
||||
"The version online (%1) seems to be lower than the "
|
||||
"current (%2).\nEither a version was reverted or "
|
||||
"you are running a newer build.\n\nDo you want to "
|
||||
"download and install it?")
|
||||
.arg(Updates::getInstance().getOnlineVersion(),
|
||||
Updates::getInstance().getCurrentVersion())
|
||||
.arg(Updates::instance().getOnlineVersion(),
|
||||
Updates::instance().getCurrentVersion())
|
||||
: QString("An update (%1) is available.\n\nDo you want to "
|
||||
"download and install it?")
|
||||
.arg(Updates::getInstance().getOnlineVersion())));
|
||||
.arg(Updates::instance().getOnlineVersion())));
|
||||
this->updateGeometry();
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -1049,7 +1049,7 @@ void ChannelView::mouseMoveEvent(QMouseEvent *event)
|
||||
this->pause(PauseReason::Mouse);
|
||||
}
|
||||
|
||||
auto tooltipWidget = TooltipWidget::getInstance();
|
||||
auto tooltipWidget = TooltipWidget::instance();
|
||||
std::shared_ptr<MessageLayout> layout;
|
||||
QPoint relativePos;
|
||||
int messageIndex;
|
||||
@@ -1242,7 +1242,7 @@ void ChannelView::mouseMoveEvent(QMouseEvent *event)
|
||||
}
|
||||
else
|
||||
{
|
||||
auto &tooltipPreviewImage = TooltipPreviewImage::getInstance();
|
||||
auto &tooltipPreviewImage = TooltipPreviewImage::instance();
|
||||
auto emoteElement = dynamic_cast<const EmoteElement *>(
|
||||
&hoverLayoutElement->getCreator());
|
||||
auto badgeElement = dynamic_cast<const BadgeElement *>(
|
||||
|
||||
@@ -75,7 +75,7 @@ AboutPage::AboutPage()
|
||||
|
||||
auto versionInfo = layout.emplace<QGroupBox>("Version");
|
||||
{
|
||||
auto version = Version::getInstance();
|
||||
auto version = Version::instance();
|
||||
QString text = QString("%1 (commit %2%3)")
|
||||
.arg(version.fullVersion())
|
||||
.arg("<a "
|
||||
@@ -83,7 +83,7 @@ AboutPage::AboutPage()
|
||||
"chatterino2/commit/" +
|
||||
version.commitHash() + "\">" +
|
||||
version.commitHash() + "</a>")
|
||||
.arg(Modes::getInstance().isNightly
|
||||
.arg(Modes::instance().isNightly
|
||||
? ", " + version.dateOfBuild()
|
||||
: "");
|
||||
|
||||
|
||||
@@ -412,7 +412,7 @@ void Split::leaveEvent(QEvent *event)
|
||||
|
||||
this->overlay_->hide();
|
||||
|
||||
TooltipWidget::getInstance()->hide();
|
||||
TooltipWidget::instance()->hide();
|
||||
|
||||
this->handleModifiers(QGuiApplication::queryKeyboardModifiers());
|
||||
}
|
||||
|
||||
@@ -670,9 +670,9 @@ void SplitHeader::enterEvent(QEvent *event)
|
||||
{
|
||||
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()),
|
||||
false);
|
||||
tooltip->setText(this->tooltipText_);
|
||||
@@ -687,7 +687,7 @@ void SplitHeader::enterEvent(QEvent *event)
|
||||
|
||||
void SplitHeader::leaveEvent(QEvent *event)
|
||||
{
|
||||
TooltipWidget::getInstance()->hide();
|
||||
TooltipWidget::instance()->hide();
|
||||
|
||||
BaseWidget::leaveEvent(event);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user