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
+2 -2
View File
@@ -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: {
+10 -10
View File
@@ -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
+7 -7
View File
@@ -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;