diff --git a/CMakeLists.txt b/CMakeLists.txt index c4574ce0..d7607e74 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -40,6 +40,7 @@ ELSEIF(MINGW) SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11 -Wall") ENDIF() +SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Werror=return-type") ################################ 3rd Party Libs ################################ # Find the required Qt parts diff --git a/gui/MainWindow.cpp b/gui/MainWindow.cpp index 65db066b..60b64cb9 100644 --- a/gui/MainWindow.cpp +++ b/gui/MainWindow.cpp @@ -757,7 +757,7 @@ void MainWindow::on_actionAddInstance_triggered() auto &loader = InstanceFactory::get(); auto error = loader.createInstance(newInstance, newInstDlg.selectedVersion(), instDir); - QString errorMsg = QString("Failed to create instance %1: ").arg(instDirName); + QString errorMsg = tr("Failed to create instance %1: ").arg(instDirName); switch (error) { case InstanceFactory::NoCreateError: @@ -768,21 +768,21 @@ void MainWindow::on_actionAddInstance_triggered() case InstanceFactory::InstExists: { - errorMsg += "An instance with the given directory name already exists."; + errorMsg += tr("An instance with the given directory name already exists."); CustomMessageBox::selectable(this, tr("Error"), errorMsg, QMessageBox::Warning)->show(); return; } case InstanceFactory::CantCreateDir: { - errorMsg += "Failed to create the instance directory."; + errorMsg += tr("Failed to create the instance directory."); CustomMessageBox::selectable(this, tr("Error"), errorMsg, QMessageBox::Warning)->show(); return; } default: { - errorMsg += QString("Unknown instance loader error %1").arg(error); + errorMsg += tr("Unknown instance loader error %1").arg(error); CustomMessageBox::selectable(this, tr("Error"), errorMsg, QMessageBox::Warning)->show(); return; } @@ -828,7 +828,7 @@ void MainWindow::on_actionCopyInstance_triggered() BaseInstance *newInstance = NULL; auto error = loader.copyInstance(newInstance, m_selectedInstance, instDir); - QString errorMsg = QString("Failed to create instance %1: ").arg(instDirName); + QString errorMsg = tr("Failed to create instance %1: ").arg(instDirName); switch (error) { case InstanceFactory::NoCreateError: @@ -839,21 +839,21 @@ void MainWindow::on_actionCopyInstance_triggered() case InstanceFactory::InstExists: { - errorMsg += "An instance with the given directory name already exists."; + errorMsg += tr("An instance with the given directory name already exists."); CustomMessageBox::selectable(this, tr("Error"), errorMsg, QMessageBox::Warning)->show(); break; } case InstanceFactory::CantCreateDir: { - errorMsg += "Failed to create the instance directory."; + errorMsg += tr("Failed to create the instance directory."); CustomMessageBox::selectable(this, tr("Error"), errorMsg, QMessageBox::Warning)->show(); break; } default: { - errorMsg += QString("Unknown instance loader error %1").arg(error); + errorMsg += tr("Unknown instance loader error %1").arg(error); CustomMessageBox::selectable(this, tr("Error"), errorMsg, QMessageBox::Warning)->show(); break; } diff --git a/logic/OneSixUpdate.cpp b/logic/OneSixUpdate.cpp index 65f30cda..cddd0def 100644 --- a/logic/OneSixUpdate.cpp +++ b/logic/OneSixUpdate.cpp @@ -96,7 +96,6 @@ void OneSixUpdate::versionFileStart() void OneSixUpdate::versionFileFinished() { NetActionPtr DlJob = specificVersionDownloadJob->first(); - OneSixInstance *inst = (OneSixInstance *)m_inst; QString version_id = targetVersion->descriptor(); QString inst_dir = m_inst->instanceRoot(); @@ -152,7 +151,7 @@ void OneSixUpdate::assetIndexStart() QString assetName = version->assets; QUrl indexUrl = "http://" + URLConstants::AWS_DOWNLOAD_INDEXES + assetName + ".json"; QString localPath = assetName + ".json"; - auto job = new NetJob("Asset index for " + inst->name()); + auto job = new NetJob(tr("Asset index for %1").arg(inst->name())); auto metacache = MMC->metacache(); auto entry = metacache->resolveEntry("asset_indexes", localPath); @@ -198,7 +197,7 @@ void OneSixUpdate::assetIndexFinished() if (dls.size()) { setStatus(tr("Getting the assets files from Mojang...")); - auto job = new NetJob("Assets for " + inst->name()); + auto job = new NetJob(tr("Assets for %1").arg(inst->name())); for (auto dl : dls) job->addNetAction(dl); jarlibDownloadJob.reset(job); @@ -255,7 +254,7 @@ void OneSixUpdate::jarlibStart() QString localPath = version_id + "/" + version_id + ".jar"; QString urlstr = "http://" + URLConstants::AWS_DOWNLOAD_VERSIONS + localPath; - auto job = new NetJob("Libraries for instance " + inst->name()); + auto job = new NetJob(tr("Libraries for instance %1").arg(inst->name())); auto metacache = MMC->metacache(); auto entry = metacache->resolveEntry("versions", localPath); diff --git a/logic/VersionFinal.cpp b/logic/VersionFinal.cpp index b465df68..ed90c148 100644 --- a/logic/VersionFinal.cpp +++ b/logic/VersionFinal.cpp @@ -38,7 +38,7 @@ VersionFinal::VersionFinal(OneSixInstance *instance, QObject *parent) clear(); } -bool VersionFinal::reload(const bool onlyVanilla, const QStringList &external) +void VersionFinal::reload(const bool onlyVanilla, const QStringList &external) { //FIXME: source of epic failure. beginResetModel(); diff --git a/logic/VersionFinal.h b/logic/VersionFinal.h index 4ddfe9f4..0bf95707 100644 --- a/logic/VersionFinal.h +++ b/logic/VersionFinal.h @@ -38,7 +38,7 @@ public: virtual int columnCount(const QModelIndex &parent) const; virtual Qt::ItemFlags flags(const QModelIndex &index) const; - bool reload(const bool onlyVanilla = false, const QStringList &external = QStringList()); + void reload(const bool onlyVanilla = false, const QStringList &external = QStringList()); void clear(); bool canRemove(const int index) const; diff --git a/logic/auth/YggdrasilTask.cpp b/logic/auth/YggdrasilTask.cpp index 277d7bfd..7679b11f 100644 --- a/logic/auth/YggdrasilTask.cpp +++ b/logic/auth/YggdrasilTask.cpp @@ -54,7 +54,7 @@ void YggdrasilTask::executeTask() counter.setSingleShot(false); counter.start(time_step); progress(0, timeout_max); - connect(&timeout_keeper, &QTimer::timeout, this, &YggdrasilTask::abort); + connect(&timeout_keeper, &QTimer::timeout, this, &YggdrasilTask::abortByTimeout); connect(&counter, &QTimer::timeout, this, &YggdrasilTask::heartbeat); } @@ -76,6 +76,12 @@ void YggdrasilTask::abort() m_netReply->abort(); } +void YggdrasilTask::abortByTimeout() +{ + progress(timeout_max, timeout_max); + m_netReply->abort(); +} + void YggdrasilTask::sslErrors(QList errors) { int i = 1; diff --git a/logic/auth/YggdrasilTask.h b/logic/auth/YggdrasilTask.h index 4a87067a..b24f909f 100644 --- a/logic/auth/YggdrasilTask.h +++ b/logic/auth/YggdrasilTask.h @@ -120,7 +120,7 @@ slots: public slots: virtual void abort() override; - + void abortByTimeout(); protected: // FIXME: segfault disaster waiting to happen MojangAccount *m_account = nullptr; diff --git a/logic/lists/InstanceList.cpp b/logic/lists/InstanceList.cpp index 9a61e2dd..34e6d87b 100644 --- a/logic/lists/InstanceList.cpp +++ b/logic/lists/InstanceList.cpp @@ -408,7 +408,7 @@ void InstanceList::loadFTBInstances(QMap &groupMap, QLOG_INFO() << "Loading existing " << record.name; BaseInstance *instPtr = NULL; auto error = InstanceFactory::get().loadInstance(instPtr, record.instanceDir); - if (!instPtr || error != InstanceFactory::NoCreateError) + if (!instPtr || error != InstanceFactory::NoLoadError) continue; instPtr->setGroupInitial("FTB"); instPtr->setName(record.name); diff --git a/logic/tasks/Task.cpp b/logic/tasks/Task.cpp index cb7a5443..c980d6b3 100644 --- a/logic/tasks/Task.cpp +++ b/logic/tasks/Task.cpp @@ -22,12 +22,12 @@ Task::Task(QObject *parent) : ProgressProvider(parent) QString Task::getStatus() const { - return m_status; + return m_statusString; } void Task::setStatus(const QString &new_status) { - m_status = new_status; + m_statusString = new_status; emit status(new_status); } diff --git a/logic/tasks/Task.h b/logic/tasks/Task.h index 80d5e38b..84775407 100644 --- a/logic/tasks/Task.h +++ b/logic/tasks/Task.h @@ -58,7 +58,7 @@ slots: void setProgress(int progress); protected: - QString m_status; + QString m_statusString; int m_progress = 0; bool m_running = false; bool m_succeeded = false;