From f18afd3d1e73cc0020bfa1189e0b8fefc0f14e61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Thu, 14 Dec 2017 00:29:00 +0100 Subject: NOISSUE fix a bunch of warnings thrown by Qt internals Badly connected signals/slots and similar things. --- api/logic/meta/VersionList.cpp | 4 ++++ api/logic/minecraft/ComponentList.cpp | 8 ++++---- api/logic/minecraft/ComponentList.h | 4 ++-- application/MainWindow.cpp | 13 ++++++++----- application/MainWindow.h | 6 +++--- application/pages/LogPage.cpp | 6 +++--- application/pages/LogPage.h | 2 +- application/themes/SystemTheme.cpp | 4 ++-- 8 files changed, 27 insertions(+), 20 deletions(-) diff --git a/api/logic/meta/VersionList.cpp b/api/logic/meta/VersionList.cpp index 8910c4d7..1387f282 100644 --- a/api/logic/meta/VersionList.cpp +++ b/api/logic/meta/VersionList.cpp @@ -205,6 +205,10 @@ void VersionList::merge(const BaseEntity::Ptr &other) // TODO: do not reset the whole model. maybe? beginResetModel(); m_versions.clear(); + if(list->m_versions.isEmpty()) + { + qWarning() << "Empty list loaded ..."; + } for (const VersionPtr &version : list->m_versions) { // we already have the version. merge the contents diff --git a/api/logic/minecraft/ComponentList.cpp b/api/logic/minecraft/ComponentList.cpp index 6547a851..dbf6ee08 100644 --- a/api/logic/minecraft/ComponentList.cpp +++ b/api/logic/minecraft/ComponentList.cpp @@ -744,23 +744,23 @@ bool ComponentList::revertToBase(int index) return true; } -ComponentPtr ComponentList::getComponent(const QString &id) +Component * ComponentList::getComponent(const QString &id) { auto iter = d->componentIndex.find(id); if (iter == d->componentIndex.end()) { return nullptr; } - return *iter; + return (*iter).get(); } -ComponentPtr ComponentList::getComponent(int index) +Component * ComponentList::getComponent(int index) { if(index < 0 || index >= d->components.size()) { return nullptr; } - return d->components[index]; + return d->components[index].get(); } bool ComponentList::isVanilla() diff --git a/api/logic/minecraft/ComponentList.h b/api/logic/minecraft/ComponentList.h index 8e89d640..b66b3417 100644 --- a/api/logic/minecraft/ComponentList.h +++ b/api/logic/minecraft/ComponentList.h @@ -110,10 +110,10 @@ public: public: /// get the profile component by id - ComponentPtr getComponent(const QString &id); + Component * getComponent(const QString &id); /// get the profile component by index - ComponentPtr getComponent(int index); + Component * getComponent(int index); private: void scheduleSave(); diff --git a/application/MainWindow.cpp b/application/MainWindow.cpp index 83e6b227..900609d3 100644 --- a/application/MainWindow.cpp +++ b/application/MainWindow.cpp @@ -779,6 +779,9 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new MainWindow { bool updatesAllowed = MMC->updatesAreAllowed(); updatesAllowedChanged(updatesAllowed); + + connect(ui->actionCheckUpdate, &QAction::triggered, this, &MainWindow::checkForUpdates); + // set up the updater object. auto updater = MMC->updateChecker(); connect(updater.get(), &UpdateChecker::updateAvailable, this, &MainWindow::updateAvailable); @@ -868,7 +871,7 @@ void MainWindow::showInstanceContextMenu(const QPoint &pos) QVariantMap data; data["group"] = group; actionDeleteGroup->setData(data); - connect(actionDeleteGroup, SIGNAL(triggered(bool)), SLOT(on_actionDeleteGroup_triggered())); + connect(actionDeleteGroup, SIGNAL(triggered(bool)), SLOT(deleteGroup())); actions.append(actionDeleteGroup); } } @@ -1080,7 +1083,7 @@ bool MainWindow::eventFilter(QObject *obj, QEvent *ev) on_actionDeleteInstance_triggered(); return true; case Qt::Key_F5: - on_actionRefresh_triggered(); + refreshInstances(); return true; case Qt::Key_F2: on_actionRenameInstance_triggered(); @@ -1450,7 +1453,7 @@ void MainWindow::on_actionChangeInstGroup_triggered() m_selectedInstance->setGroupPost(name); } -void MainWindow::on_actionDeleteGroup_triggered() +void MainWindow::deleteGroup() { QObject* obj = sender(); if(!obj) @@ -1474,7 +1477,7 @@ void MainWindow::on_actionViewInstanceFolder_triggered() DesktopServices::openDirectory(str); } -void MainWindow::on_actionRefresh_triggered() +void MainWindow::refreshInstances() { MMC->instances()->loadList(true); } @@ -1493,7 +1496,7 @@ void MainWindow::on_actionConfig_Folder_triggered() } } -void MainWindow::on_actionCheckUpdate_triggered() +void MainWindow::checkForUpdates() { if(BuildConfig.UPDATER_ENABLED) { diff --git a/application/MainWindow.h b/application/MainWindow.h index e22b96c0..b4c584eb 100644 --- a/application/MainWindow.h +++ b/application/MainWindow.h @@ -85,11 +85,11 @@ private slots: void on_actionViewSelectedInstFolder_triggered(); - void on_actionRefresh_triggered(); + void refreshInstances(); void on_actionViewCentralModsFolder_triggered(); - void on_actionCheckUpdate_triggered(); + void checkForUpdates(); void on_actionSettings_triggered(); @@ -113,7 +113,7 @@ private slots: void on_actionDeleteInstance_triggered(); - void on_actionDeleteGroup_triggered(); + void deleteGroup(); void on_actionExportInstance_triggered(); diff --git a/application/pages/LogPage.cpp b/application/pages/LogPage.cpp index 025d902b..009a9f55 100644 --- a/application/pages/LogPage.cpp +++ b/application/pages/LogPage.cpp @@ -141,9 +141,9 @@ LogPage::LogPage(InstancePtr instance, QWidget *parent) auto launchTask = m_instance->getLaunchTask(); if(launchTask) { - on_InstanceLaunchTask_changed(launchTask); + onInstanceLaunchTaskChanged(launchTask); } - connect(m_instance.get(), &BaseInstance::launchTaskChanged, this, &LogPage::on_InstanceLaunchTask_changed); + connect(m_instance.get(), &BaseInstance::launchTaskChanged, this, &LogPage::onInstanceLaunchTaskChanged); } ui->text->setWordWrap(true); @@ -162,7 +162,7 @@ LogPage::~LogPage() delete ui; } -void LogPage::on_InstanceLaunchTask_changed(std::shared_ptr proc) +void LogPage::onInstanceLaunchTaskChanged(std::shared_ptr proc) { m_process = proc; if(m_process) diff --git a/application/pages/LogPage.h b/application/pages/LogPage.h index 7346f93f..3ca47b8a 100644 --- a/application/pages/LogPage.h +++ b/application/pages/LogPage.h @@ -69,7 +69,7 @@ private slots: void findNextActivated(); void findPreviousActivated(); - void on_InstanceLaunchTask_changed(std::shared_ptr proc); + void onInstanceLaunchTaskChanged(std::shared_ptr proc); private: Ui::LogPage *ui; diff --git a/application/themes/SystemTheme.cpp b/application/themes/SystemTheme.cpp index 069b0b1b..a9ee853a 100644 --- a/application/themes/SystemTheme.cpp +++ b/application/themes/SystemTheme.cpp @@ -9,7 +9,7 @@ SystemTheme::SystemTheme() const auto & style = QApplication::style(); systemPalette = style->standardPalette(); QString lowerThemeName = style->objectName(); - qWarning() << systemTheme; + qDebug() << systemTheme; QStringList styles = QStyleFactory::keys(); for(auto &st: styles) { @@ -21,7 +21,7 @@ SystemTheme::SystemTheme() } // fall back to fusion if we can't find the current theme. systemTheme = "Fusion"; - qWarning() << "System theme not found, defaulted to Fusion"; + qDebug() << "System theme not found, defaulted to Fusion"; } void SystemTheme::apply(bool initial) -- cgit v1.2.3