From 2b9017a69ca74a80eea30c7e4f020b1b73d6fd7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Sat, 29 Oct 2016 01:34:43 +0200 Subject: NOISSUE clean up some bad/dead code --- application/MultiMC.cpp | 10 +++++----- application/MultiMC.h | 26 ++++++++++---------------- application/main.cpp | 2 +- 3 files changed, 16 insertions(+), 22 deletions(-) (limited to 'application') diff --git a/application/MultiMC.cpp b/application/MultiMC.cpp index f4c5318f..927468b6 100644 --- a/application/MultiMC.cpp +++ b/application/MultiMC.cpp @@ -179,7 +179,7 @@ MultiMC::MultiMC(int &argc, char **argv) : QApplication(argc, argv) adjustedBy += "Fallback to binary path " + dataPath; } - launchId = args["launch"].toString(); + instanceIdToLaunch = args["launch"].toString(); if (!FS::ensureFolderPathExists(dataPath) || !QDir::setCurrent(dataPath)) { @@ -220,9 +220,9 @@ MultiMC::MultiMC(int &argc, char **argv) : QApplication(argc, argv) } qDebug() << "Binary path : " << binPath; qDebug() << "Application root path : " << rootPath; - if(!launchId.isEmpty()) + if(!instanceIdToLaunch.isEmpty()) { - qDebug() << "ID of instance to launch : " << launchId; + qDebug() << "ID of instance to launch : " << instanceIdToLaunch; } // load settings @@ -400,7 +400,7 @@ void MultiMC::initIcons() } -void moveFile(const QString &oldName, const QString &newName) +static void moveFile(const QString &oldName, const QString &newName) { QFile::remove(newName); QFile::copy(oldName, newName); @@ -439,7 +439,7 @@ void MultiMC::initLogger() qInstallMessageHandler(appDebugOutput); - logFile = std::make_shared(logBase.arg(0)); + logFile = std::unique_ptr(new QFile(logBase.arg(0))); logFile->open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Truncate); } diff --git a/application/MultiMC.h b/application/MultiMC.h index 06819d28..070447fc 100644 --- a/application/MultiMC.h +++ b/application/MultiMC.h @@ -87,50 +87,47 @@ public: std::shared_ptr javalist(); // APPLICATION ONLY - std::shared_ptr instances() + std::shared_ptr instances() const { return m_instances; } - FolderInstanceProvider * folderProvider() + FolderInstanceProvider * folderProvider() const { return m_instanceFolder; } - std::shared_ptr icons() + std::shared_ptr icons() const { return m_icons; } // APPLICATION ONLY - std::shared_ptr accounts() + std::shared_ptr accounts() const { return m_accounts; } // APPLICATION ONLY - Status status() + Status status() const { return m_status; } // APPLICATION ONLY - QMap> profilers() + const QMap> &profilers() const { return m_profilers; } // APPLICATION ONLY - QMap> tools() + const QMap> &tools() const { return m_tools; } // APPLICATION ONLY - QString getFinishCmd(); void installUpdates(const QString updateFilesDir, GoUpdate::OperationList operations); - void updateXP(const QString updateFilesDir, GoUpdate::OperationList operations); - void updateModern(const QString updateFilesDir, GoUpdate::OperationList operations); /*! * Opens a json file using either a system default editor, or, if note empty, the editor @@ -161,16 +158,13 @@ private: void initSSL(); private: - friend class UpdateCheckerTest; - friend class DownloadTaskTest; - QDateTime startTime; std::shared_ptr m_qt_translator; std::shared_ptr m_mmc_translator; std::shared_ptr m_settings; std::shared_ptr m_instances; - FolderInstanceProvider * m_instanceFolder; + FolderInstanceProvider * m_instanceFolder = nullptr; std::shared_ptr m_icons; std::shared_ptr m_updateChecker; std::shared_ptr m_accounts; @@ -192,6 +186,6 @@ private: bool consoleAttached = false; public: - QString launchId; - std::shared_ptr logFile; + QString instanceIdToLaunch; + std::unique_ptr logFile; }; diff --git a/application/main.cpp b/application/main.cpp index f22cd732..c6847c5d 100644 --- a/application/main.cpp +++ b/application/main.cpp @@ -31,7 +31,7 @@ int main_gui(MultiMC &app) app.setApplicationTheme(MMC->settings()->get("ApplicationTheme").toString()); // show main window - auto inst = app.instances()->getInstanceById(app.launchId); + auto inst = app.instances()->getInstanceById(app.instanceIdToLaunch); if(inst) { return launchInstance(app, inst); -- cgit v1.2.3