NOISSUE clean up some bad/dead code

This commit is contained in:
Petr Mrázek 2016-10-29 01:34:43 +02:00
parent 172ff47a65
commit 2b9017a69c
3 changed files with 16 additions and 22 deletions

View File

@ -179,7 +179,7 @@ MultiMC::MultiMC(int &argc, char **argv) : QApplication(argc, argv)
adjustedBy += "Fallback to binary path " + dataPath; adjustedBy += "Fallback to binary path " + dataPath;
} }
launchId = args["launch"].toString(); instanceIdToLaunch = args["launch"].toString();
if (!FS::ensureFolderPathExists(dataPath) || !QDir::setCurrent(dataPath)) 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() << "Binary path : " << binPath;
qDebug() << "Application root path : " << rootPath; 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 // 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::remove(newName);
QFile::copy(oldName, newName); QFile::copy(oldName, newName);
@ -439,7 +439,7 @@ void MultiMC::initLogger()
qInstallMessageHandler(appDebugOutput); qInstallMessageHandler(appDebugOutput);
logFile = std::make_shared<QFile>(logBase.arg(0)); logFile = std::unique_ptr<QFile>(new QFile(logBase.arg(0)));
logFile->open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Truncate); logFile->open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Truncate);
} }

View File

@ -87,50 +87,47 @@ public:
std::shared_ptr<JavaInstallList> javalist(); std::shared_ptr<JavaInstallList> javalist();
// APPLICATION ONLY // APPLICATION ONLY
std::shared_ptr<InstanceList> instances() std::shared_ptr<InstanceList> instances() const
{ {
return m_instances; return m_instances;
} }
FolderInstanceProvider * folderProvider() FolderInstanceProvider * folderProvider() const
{ {
return m_instanceFolder; return m_instanceFolder;
} }
std::shared_ptr<IconList> icons() std::shared_ptr<IconList> icons() const
{ {
return m_icons; return m_icons;
} }
// APPLICATION ONLY // APPLICATION ONLY
std::shared_ptr<MojangAccountList> accounts() std::shared_ptr<MojangAccountList> accounts() const
{ {
return m_accounts; return m_accounts;
} }
// APPLICATION ONLY // APPLICATION ONLY
Status status() Status status() const
{ {
return m_status; return m_status;
} }
// APPLICATION ONLY // APPLICATION ONLY
QMap<QString, std::shared_ptr<BaseProfilerFactory>> profilers() const QMap<QString, std::shared_ptr<BaseProfilerFactory>> &profilers() const
{ {
return m_profilers; return m_profilers;
} }
// APPLICATION ONLY // APPLICATION ONLY
QMap<QString, std::shared_ptr<BaseDetachedToolFactory>> tools() const QMap<QString, std::shared_ptr<BaseDetachedToolFactory>> &tools() const
{ {
return m_tools; return m_tools;
} }
// APPLICATION ONLY // APPLICATION ONLY
QString getFinishCmd();
void installUpdates(const QString updateFilesDir, GoUpdate::OperationList operations); 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 * Opens a json file using either a system default editor, or, if note empty, the editor
@ -161,16 +158,13 @@ private:
void initSSL(); void initSSL();
private: private:
friend class UpdateCheckerTest;
friend class DownloadTaskTest;
QDateTime startTime; QDateTime startTime;
std::shared_ptr<QTranslator> m_qt_translator; std::shared_ptr<QTranslator> m_qt_translator;
std::shared_ptr<QTranslator> m_mmc_translator; std::shared_ptr<QTranslator> m_mmc_translator;
std::shared_ptr<SettingsObject> m_settings; std::shared_ptr<SettingsObject> m_settings;
std::shared_ptr<InstanceList> m_instances; std::shared_ptr<InstanceList> m_instances;
FolderInstanceProvider * m_instanceFolder; FolderInstanceProvider * m_instanceFolder = nullptr;
std::shared_ptr<IconList> m_icons; std::shared_ptr<IconList> m_icons;
std::shared_ptr<UpdateChecker> m_updateChecker; std::shared_ptr<UpdateChecker> m_updateChecker;
std::shared_ptr<MojangAccountList> m_accounts; std::shared_ptr<MojangAccountList> m_accounts;
@ -192,6 +186,6 @@ private:
bool consoleAttached = false; bool consoleAttached = false;
public: public:
QString launchId; QString instanceIdToLaunch;
std::shared_ptr<QFile> logFile; std::unique_ptr<QFile> logFile;
}; };

View File

@ -31,7 +31,7 @@ int main_gui(MultiMC &app)
app.setApplicationTheme(MMC->settings()->get("ApplicationTheme").toString()); app.setApplicationTheme(MMC->settings()->get("ApplicationTheme").toString());
// show main window // show main window
auto inst = app.instances()->getInstanceById(app.launchId); auto inst = app.instances()->getInstanceById(app.instanceIdToLaunch);
if(inst) if(inst)
{ {
return launchInstance(app, inst); return launchInstance(app, inst);