diff --git a/src/nostalgia/studio/mainwindow.cpp b/src/nostalgia/studio/mainwindow.cpp index d03e12e6..5a3fe395 100644 --- a/src/nostalgia/studio/mainwindow.cpp +++ b/src/nostalgia/studio/mainwindow.cpp @@ -36,12 +36,11 @@ const QString MainWindow::StateFilePath = "studio_state.json"; MainWindow::MainWindow(QString profilePath) { m_profilePath = profilePath; // load in profile file - NostalgiaStudioProfile profile; QFile file(profilePath); if (file.exists()) { file.open(QIODevice::ReadOnly); QTextStream in(&file); - readJson(in.readAll(), &profile); + readJson(in.readAll(), &m_profile); } auto screenSize = QApplication::desktop()->screenGeometry(); @@ -52,7 +51,7 @@ MainWindow::MainWindow(QString profilePath) { move(-x(), -y()); move(screenSize.width() * (1 - sizePct) / 2, screenSize.height() * (1 - sizePct) / 2); - setWindowTitle(profile.appName); + setWindowTitle(m_profile.appName); m_tabbar = new QTabBar(this); setCentralWidget(m_tabbar); @@ -61,7 +60,7 @@ MainWindow::MainWindow(QString profilePath) { setupProjectExplorer(); statusBar(); // setup status bar - loadPlugins(profile); + loadPlugins(); readState(); } @@ -73,8 +72,8 @@ MainWindow::~MainWindow() { } } -void MainWindow::loadPlugins(NostalgiaStudioProfile profile) { - for (auto p : profile.plugins) { +void MainWindow::loadPlugins() { + for (auto p : m_profile.plugins) { #if defined(Q_OS_WIN) auto libName = p.libName + ".dll"; #elif defined(Q_OS_MAC) @@ -198,7 +197,7 @@ QAction *MainWindow::addAction(QMenu *menu, QString text, QString toolTip, int MainWindow::readState(QString path) { int err = 0; - QSettings settings("Drinking Tea", "nostalgia-studio"); + QSettings settings(m_profile.orgName, m_profile.appName); settings.beginGroup("MainWindow"); restoreGeometry(settings.value("geometry").toByteArray()); restoreState(settings.value("windowState").toByteArray()); @@ -218,7 +217,7 @@ int MainWindow::writeState(QString path) { QString json; err |= writeJson(&json, &m_state); - QSettings settings("Drinking Tea", "nostalgia-studio"); + QSettings settings(m_profile.orgName, m_profile.appName); settings.beginGroup("MainWindow"); settings.setValue("geometry", saveGeometry()); settings.setValue("windowState", saveState()); diff --git a/src/nostalgia/studio/mainwindow.hpp b/src/nostalgia/studio/mainwindow.hpp index b97af15d..d68fbfd0 100644 --- a/src/nostalgia/studio/mainwindow.hpp +++ b/src/nostalgia/studio/mainwindow.hpp @@ -60,14 +60,16 @@ ox::Error ioOp(T *io, NostalgiaStudioPluginDef *obj) { struct NostalgiaStudioProfile { QString appName; + QString orgName; QVector plugins; }; template ox::Error ioOp(T *io, NostalgiaStudioProfile *obj) { ox::Error err = 0; - io->setFields(2); + io->setFields(3); err |= io->op("app_name", &obj->appName); + err |= io->op("org_name", &obj->orgName); err |= io->op("plugins", &obj->plugins); return err; } @@ -82,6 +84,7 @@ class MainWindow: public QMainWindow { private: QString m_profilePath; + NostalgiaStudioProfile m_profile; NostalgiaStudioState m_state; QAction *m_importAction = nullptr; Project *m_project = nullptr; @@ -99,7 +102,7 @@ class MainWindow: public QMainWindow { virtual ~MainWindow(); private: - void loadPlugins(NostalgiaStudioProfile profile); + void loadPlugins(); void setupDockWidgets(); diff --git a/src/nostalgia/studio/nostalgia-studio-dev.json b/src/nostalgia/studio/nostalgia-studio-dev.json index 2baefea1..96e2e1c2 100644 --- a/src/nostalgia/studio/nostalgia-studio-dev.json +++ b/src/nostalgia/studio/nostalgia-studio-dev.json @@ -1,5 +1,6 @@ { "app_name": "Nostalgia Studio", + "org_name": "Drinking Tea", "plugins": [ { "dir": "./", diff --git a/src/nostalgia/studio/nostalgia-studio.json b/src/nostalgia/studio/nostalgia-studio.json index 2d711219..c3f94f4a 100644 --- a/src/nostalgia/studio/nostalgia-studio.json +++ b/src/nostalgia/studio/nostalgia-studio.json @@ -1,5 +1,6 @@ { "app_name": "Nostalgia Studio", + "org_name": "Drinking Tea", "plugins": [ { "dir": "../lib/nostalgia",