[nostalgia/studio] Get Studio running with MSVC
This commit is contained in:
parent
74e6a4cbff
commit
debb3eb981
@ -91,7 +91,12 @@ ox::Error JsonReader::field(QJsonValueRef src, T *dest) {
|
||||
|
||||
template<typename T>
|
||||
ox::Error readJson(QString json, T *dest) {
|
||||
auto obj = QJsonDocument::fromJson(json.toUtf8()).object();
|
||||
QJsonParseError err;
|
||||
auto obj = QJsonDocument::fromJson(json.toUtf8(), &err).object();
|
||||
qDebug() << "JSON parsing error:" << err.errorString();
|
||||
if (err.error) {
|
||||
return OxError(1);
|
||||
}
|
||||
JsonReader rdr(obj);
|
||||
return model(&rdr, dest);
|
||||
}
|
||||
|
@ -7,6 +7,7 @@
|
||||
*/
|
||||
|
||||
#include <QApplication>
|
||||
#include <QDebug>
|
||||
#include <ox/clargs/clargs.hpp>
|
||||
#include "mainwindow.hpp"
|
||||
|
||||
@ -16,15 +17,19 @@ int main(int argc, char **args) {
|
||||
ox::ClArgs clargs(argc, const_cast<const char**>(args));
|
||||
QString argProfilePath = clargs.getString("profile").c_str();
|
||||
|
||||
NostalgiaStudioProfile config;
|
||||
|
||||
for (int i = 0; i < argc; i++) {
|
||||
qDebug() << args[i];
|
||||
}
|
||||
QApplication app(argc, args);
|
||||
app.setAttribute(Qt::AA_UseHighDpiPixmaps);
|
||||
|
||||
MainWindow w(argProfilePath);
|
||||
app.setApplicationName(w.windowTitle());
|
||||
w.show();
|
||||
QObject::connect(&app, &QApplication::aboutToQuit, &w, &MainWindow::onExit);
|
||||
|
||||
return app.exec();
|
||||
try {
|
||||
MainWindow w(argProfilePath);
|
||||
app.setApplicationName(w.windowTitle());
|
||||
w.show();
|
||||
QObject::connect(&app, &QApplication::aboutToQuit, &w, &MainWindow::onExit);
|
||||
return app.exec();
|
||||
} catch (ox::Error err) {
|
||||
oxPanic(err, "Unhandled ox::Error");
|
||||
}
|
||||
}
|
||||
|
@ -40,7 +40,8 @@ MainWindow::MainWindow(QString profilePath) {
|
||||
if (file.exists()) {
|
||||
file.open(QIODevice::ReadOnly);
|
||||
QTextStream in(&file);
|
||||
readJson(in.readAll(), &m_profile);
|
||||
oxThrowError(readJson(in.readAll(), &m_profile));
|
||||
qDebug() << m_profile.appName;
|
||||
}
|
||||
|
||||
auto screenSize = QApplication::screens().first()->geometry();
|
||||
|
@ -1,10 +1,10 @@
|
||||
{
|
||||
"app_name": "Nostalgia Studio",
|
||||
"org_name": "Drinking Tea",
|
||||
"plugins": [
|
||||
{
|
||||
"dir": "./",
|
||||
"lib_name": "NostalgiaCore-Studio"
|
||||
}
|
||||
"plugins_path": [
|
||||
"../lib/nostalgia/plugins",
|
||||
"../Plugins",
|
||||
"../../../out/build/x64-Debug",
|
||||
"../../../out/build/x64-Release"
|
||||
]
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user