summaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp33
1 files changed, 17 insertions, 16 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 0253ad4a..cbf561ed 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -45,7 +45,7 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
#include <scopeguard.h>
#include <stdexcept>
#include "mainwindow.h"
-#include "report.h"
+#include <report.h>
#include "modlist.h"
#include "profile.h"
#include "gameinfo.h"
@@ -301,7 +301,7 @@ static bool HaveWriteAccess(const std::wstring &path)
}
-QString determineProfile(QStringList arguments, const QSettings &settings)
+QString determineProfile(QStringList &arguments, const QSettings &settings)
{
QString selectedProfileName = QString::fromUtf8(settings.value("selected_profile", "").toByteArray());
{ // see if there is a profile on the command line
@@ -347,11 +347,6 @@ int main(int argc, char *argv[])
);
application.setProperty("dataPath", dataPath);
-#if QT_VERSION >= 0x050000
- qDebug("ssl support: %d", QSslSocket::supportsSsl());
-#endif
-
- qDebug("data path: %s", qPrintable(dataPath));
if (!QDir(dataPath).exists()) {
if (!QDir().mkpath(dataPath)) {
qCritical("failed to create %s", qPrintable(dataPath));
@@ -378,6 +373,10 @@ int main(int argc, char *argv[])
LogBuffer::init(100, QtDebugMsg, qApp->property("dataPath").toString() + "/logs/mo_interface.log");
+#if QT_VERSION >= 0x050000
+ qDebug("ssl support: %d", QSslSocket::supportsSsl());
+#endif
+
qDebug("Working directory: %s", qPrintable(QDir::toNativeSeparators(QDir::currentPath())));
qDebug("MO at: %s", qPrintable(QDir::toNativeSeparators(application.applicationDirPath())));
QPixmap pixmap(":/MO/gui/splash");
@@ -399,12 +398,12 @@ int main(int argc, char *argv[])
::GetEnvironmentVariable(TEXT("PATH"), oldPath.get(), offset);
}
- std::tstring newPath(oldPath.get());
- newPath += TEXT(";");
+ std::wstring newPath(oldPath.get());
+ newPath += L";";
newPath += ToWString(QDir::toNativeSeparators(QCoreApplication::applicationDirPath())).c_str();
- newPath += TEXT("\\dlls");
+ newPath += L"\\dlls";
- ::SetEnvironmentVariable(TEXT("PATH"), newPath.c_str());
+ ::SetEnvironmentVariableW(L"PATH", newPath.c_str());
}
registerMetaTypes();
@@ -462,8 +461,10 @@ int main(int argc, char *argv[])
} else {
gamePath = QDir::cleanPath(selection.getChoiceData().toString());
if (gamePath.isEmpty()) {
- gamePath = QFileDialog::getExistingDirectory(nullptr, QObject::tr("Please select the game to manage"), QString(),
- QFileDialog::ShowDirsOnly);
+ gamePath = QFileDialog::getExistingDirectory(
+ nullptr, QObject::tr("Please select the game to manage"), QString(),
+ QFileDialog::ShowDirsOnly);
+ qDebug() << "manually selected path " << gamePath;
}
}
} else {
@@ -481,7 +482,7 @@ int main(int argc, char *argv[])
settings.setValue("gamePath", gamePath.toUtf8().constData());
}
- organizer.setManagedGame(ToQString(GameInfo::instance().getGameName()));
+ organizer.setManagedGame(ToQString(GameInfo::instance().getGameName()), gamePath);
organizer.createDefaultProfile();
@@ -510,7 +511,6 @@ int main(int argc, char *argv[])
organizer.updateExecutablesList(settings);
-
QString selectedProfileName = determineProfile(arguments, settings);
organizer.setCurrentProfile(selectedProfileName);
@@ -532,7 +532,8 @@ int main(int argc, char *argv[])
}
qDebug("initializing tutorials");
- TutorialManager::init(qApp->applicationDirPath() + "/" + QString::fromStdWString(AppConfig::tutorialsPath()) + "/");
+ TutorialManager::init(qApp->applicationDirPath() + "/" + QString::fromStdWString(AppConfig::tutorialsPath()) + "/",
+ &organizer);
if (!application.setStyleFile(settings.value("Settings/style", "").toString())) {
// disable invalid stylesheet