summaryrefslogtreecommitdiffstats
path: root/MultiMC.cpp
diff options
context:
space:
mode:
authorJan Dalheimer <jan@dalheimer.de>2013-12-02 11:09:56 +0100
committerJan Dalheimer <jan@dalheimer.de>2013-12-02 11:09:56 +0100
commit0a6399b52cc72980b4847510cc183b54c75d1821 (patch)
treecc3087d7fce7fbbe39836f49d5eed1da86cea048 /MultiMC.cpp
parent613699b3626aea750093ab7eaaeccaa28c0e87c6 (diff)
downloadMultiMC-0a6399b52cc72980b4847510cc183b54c75d1821.tar
MultiMC-0a6399b52cc72980b4847510cc183b54c75d1821.tar.gz
MultiMC-0a6399b52cc72980b4847510cc183b54c75d1821.tar.lz
MultiMC-0a6399b52cc72980b4847510cc183b54c75d1821.tar.xz
MultiMC-0a6399b52cc72980b4847510cc183b54c75d1821.zip
Unit testing
Diffstat (limited to 'MultiMC.cpp')
-rw-r--r--MultiMC.cpp34
1 files changed, 4 insertions, 30 deletions
diff --git a/MultiMC.cpp b/MultiMC.cpp
index e10292ab..1792f587 100644
--- a/MultiMC.cpp
+++ b/MultiMC.cpp
@@ -7,7 +7,6 @@
#include <QLibraryInfo>
#include <QMessageBox>
-#include "gui/MainWindow.h"
#include "gui/dialogs/VersionSelectDialog.h"
#include "logic/lists/InstanceList.h"
#include "logic/lists/MojangAccountList.h"
@@ -31,7 +30,7 @@
#include "config.h"
using namespace Util::Commandline;
-MultiMC::MultiMC(int &argc, char **argv) : QApplication(argc, argv),
+MultiMC::MultiMC(int &argc, char **argv, const QString &root) : QApplication(argc, argv),
m_version{VERSION_MAJOR, VERSION_MINOR, VERSION_BUILD, VERSION_BUILD_TYPE}
{
setOrganizationName("MultiMC");
@@ -130,7 +129,9 @@ MultiMC::MultiMC(int &argc, char **argv) : QApplication(argc, argv),
}
// change directory
- QDir::setCurrent(args["dir"].toString());
+ QDir::setCurrent(args["dir"].toString().isEmpty() ?
+ (root.isEmpty() ? QDir::currentPath() : QDir::current().absoluteFilePath(root))
+ : args["dir"].toString());
// init the logger
initLogger();
@@ -404,31 +405,4 @@ std::shared_ptr<JavaVersionList> MultiMC::javalist()
return m_javalist;
}
-int main_gui(MultiMC &app)
-{
- // show main window
- MainWindow mainWin;
- mainWin.restoreState(QByteArray::fromBase64(MMC->settings()->get("MainWindowState").toByteArray()));
- mainWin.restoreGeometry(QByteArray::fromBase64(MMC->settings()->get("MainWindowGeometry").toByteArray()));
- mainWin.show();
- mainWin.checkSetDefaultJava();
- return app.exec();
-}
-
-int main(int argc, char *argv[])
-{
- // initialize Qt
- MultiMC app(argc, argv);
-
- switch (app.status())
- {
- case MultiMC::Initialized:
- return main_gui(app);
- case MultiMC::Failed:
- return 1;
- case MultiMC::Succeeded:
- return 0;
- }
-}
-
#include "MultiMC.moc"