diff --git a/src/nostalgia/common/bounds.cpp b/src/nostalgia/common/bounds.cpp index ba0aefc4..2f9b61e4 100644 --- a/src/nostalgia/common/bounds.cpp +++ b/src/nostalgia/common/bounds.cpp @@ -7,8 +7,7 @@ */ #include "bounds.hpp" -namespace nostalgia { -namespace common { +namespace nostalgia::common { Bounds::Bounds(int x, int y, int w, int h) { this->x = x; @@ -42,4 +41,3 @@ Point Bounds::pt2() { } } -} diff --git a/src/nostalgia/common/bounds.hpp b/src/nostalgia/common/bounds.hpp index e8e81d90..62dce658 100644 --- a/src/nostalgia/common/bounds.hpp +++ b/src/nostalgia/common/bounds.hpp @@ -9,8 +9,7 @@ #include "point.hpp" -namespace nostalgia { -namespace common { +namespace nostalgia::common { class Bounds { public: @@ -48,4 +47,3 @@ ox::Error model(T *io, Bounds *obj) { } } -} diff --git a/src/nostalgia/common/point.cpp b/src/nostalgia/common/point.cpp index c0cdc5f2..a339b8a9 100644 --- a/src/nostalgia/common/point.cpp +++ b/src/nostalgia/common/point.cpp @@ -7,8 +7,7 @@ */ #include "point.hpp" -namespace nostalgia { -namespace common { +namespace nostalgia::common { Point::Point() { } @@ -122,4 +121,3 @@ Point Point::operator/=(int i) { } } -} diff --git a/src/nostalgia/common/point.hpp b/src/nostalgia/common/point.hpp index 5f0ee73e..3d968cdc 100644 --- a/src/nostalgia/common/point.hpp +++ b/src/nostalgia/common/point.hpp @@ -10,8 +10,7 @@ #include -namespace nostalgia { -namespace common { +namespace nostalgia::common { class Point { public: @@ -68,4 +67,3 @@ ox::Error model(T *io, Point *obj) { } } -} diff --git a/src/nostalgia/studio/lib/json_err.hpp b/src/nostalgia/studio/lib/json_err.hpp index 067636fa..21c5cea2 100644 --- a/src/nostalgia/studio/lib/json_err.hpp +++ b/src/nostalgia/studio/lib/json_err.hpp @@ -8,8 +8,7 @@ #pragma once -namespace nostalgia { -namespace studio { +namespace nostalgia::studio { enum { JSON_ERR_FIELD_MISSING = 1, @@ -17,4 +16,3 @@ enum { }; } -} diff --git a/src/nostalgia/studio/lib/json_read.cpp b/src/nostalgia/studio/lib/json_read.cpp index 2561f035..7b4dd776 100644 --- a/src/nostalgia/studio/lib/json_read.cpp +++ b/src/nostalgia/studio/lib/json_read.cpp @@ -8,8 +8,7 @@ #include "json_read.hpp" -namespace nostalgia { -namespace studio { +namespace nostalgia::studio { JsonReader::JsonReader(QJsonObject &obj): m_src(obj) { } @@ -86,4 +85,3 @@ ox::Error JsonReader::field(QJsonValueRef src, QString *dest) { } -} diff --git a/src/nostalgia/studio/lib/oxfstreeview.hpp b/src/nostalgia/studio/lib/oxfstreeview.hpp index fd55e54e..05da5c35 100644 --- a/src/nostalgia/studio/lib/oxfstreeview.hpp +++ b/src/nostalgia/studio/lib/oxfstreeview.hpp @@ -14,8 +14,7 @@ #include -namespace nostalgia { -namespace studio { +namespace nostalgia::studio { class OxFSFile { private: @@ -82,4 +81,3 @@ class OxFSModel: public QAbstractItemModel { }; } -} diff --git a/src/nostalgia/studio/lib/plugin.cpp b/src/nostalgia/studio/lib/plugin.cpp index d495dffb..6fd75211 100644 --- a/src/nostalgia/studio/lib/plugin.cpp +++ b/src/nostalgia/studio/lib/plugin.cpp @@ -8,8 +8,7 @@ #include "plugin.hpp" -namespace nostalgia { -namespace studio { +namespace nostalgia::studio { QVector Plugin::newWizards(const Context*) { return {}; @@ -24,4 +23,3 @@ QWidget *Plugin::makeEditor(QString, const Context*) { } } -} diff --git a/src/nostalgia/studio/lib/plugin.hpp b/src/nostalgia/studio/lib/plugin.hpp index 717933bc..a8e19d67 100644 --- a/src/nostalgia/studio/lib/plugin.hpp +++ b/src/nostalgia/studio/lib/plugin.hpp @@ -19,8 +19,7 @@ #include "project.hpp" #include "wizard.hpp" -namespace nostalgia { -namespace studio { +namespace nostalgia::studio { struct Context { QWidget *tabParent = nullptr; @@ -46,7 +45,6 @@ class Plugin { }; -} } #define PluginInterface_iid "net.drinkingtea.nostalgia.studio.Plugin" diff --git a/src/nostalgia/studio/lib/project.hpp b/src/nostalgia/studio/lib/project.hpp index be27d2da..bc658401 100644 --- a/src/nostalgia/studio/lib/project.hpp +++ b/src/nostalgia/studio/lib/project.hpp @@ -15,8 +15,7 @@ #include #include -namespace nostalgia { -namespace studio { +namespace nostalgia::studio { class Project: public QObject { Q_OBJECT @@ -75,4 +74,3 @@ ox::Error Project::writeObj(QString path, T *obj) const { } } -} diff --git a/src/nostalgia/studio/lib/wizard.cpp b/src/nostalgia/studio/lib/wizard.cpp index c008de3b..b9779643 100644 --- a/src/nostalgia/studio/lib/wizard.cpp +++ b/src/nostalgia/studio/lib/wizard.cpp @@ -18,8 +18,7 @@ #include "plugin.hpp" #include "wizard.hpp" -namespace nostalgia { -namespace studio { +namespace nostalgia::studio { using std::function; @@ -343,4 +342,3 @@ void Wizard::accept() { } } -} diff --git a/src/nostalgia/studio/lib/wizard.hpp b/src/nostalgia/studio/lib/wizard.hpp index b7b73a3b..ae1f2b09 100644 --- a/src/nostalgia/studio/lib/wizard.hpp +++ b/src/nostalgia/studio/lib/wizard.hpp @@ -19,8 +19,7 @@ #include #include -namespace nostalgia { -namespace studio { +namespace nostalgia::studio { struct WizardMaker { QString name; @@ -132,4 +131,3 @@ class Wizard: public QWizard { }; } -} diff --git a/src/nostalgia/studio/mainwindow.cpp b/src/nostalgia/studio/mainwindow.cpp index ea6eceef..22f8e34c 100644 --- a/src/nostalgia/studio/mainwindow.cpp +++ b/src/nostalgia/studio/mainwindow.cpp @@ -29,8 +29,7 @@ #include "mainwindow.hpp" -namespace nostalgia { -namespace studio { +namespace nostalgia::studio { const QString MainWindow::StateFilePath = "studio_state.json"; @@ -375,4 +374,3 @@ void MainWindow::refreshProjectExplorer(QString path) { } } -} diff --git a/src/nostalgia/studio/mainwindow.hpp b/src/nostalgia/studio/mainwindow.hpp index b60e4572..08cb9f8b 100644 --- a/src/nostalgia/studio/mainwindow.hpp +++ b/src/nostalgia/studio/mainwindow.hpp @@ -27,8 +27,7 @@ #include "lib/plugin.hpp" #include "lib/project.hpp" -namespace nostalgia { -namespace studio { +namespace nostalgia::studio { struct NostalgiaStudioState { QString projectPath; @@ -145,4 +144,3 @@ class MainWindow: public QMainWindow { }; } -} diff --git a/src/nostalgia/world/studio/consts.cpp b/src/nostalgia/world/studio/consts.cpp index 2362f6b7..24c60ab7 100644 --- a/src/nostalgia/world/studio/consts.cpp +++ b/src/nostalgia/world/studio/consts.cpp @@ -8,10 +8,8 @@ #include "consts.hpp" -namespace nostalgia { -namespace world { +namespace nostalgia::world { QString PATH_ZONES = "/World/Zones/"; } -} diff --git a/src/nostalgia/world/studio/consts.hpp b/src/nostalgia/world/studio/consts.hpp index ed2b8637..6ff5232a 100644 --- a/src/nostalgia/world/studio/consts.hpp +++ b/src/nostalgia/world/studio/consts.hpp @@ -10,10 +10,8 @@ #include -namespace nostalgia { -namespace world { +namespace nostalgia::world { extern QString PATH_ZONES; } -} diff --git a/src/nostalgia/world/studio/newworldwizard.cpp b/src/nostalgia/world/studio/newworldwizard.cpp index e35e014a..e6402001 100644 --- a/src/nostalgia/world/studio/newworldwizard.cpp +++ b/src/nostalgia/world/studio/newworldwizard.cpp @@ -11,8 +11,7 @@ #include "consts.hpp" #include "newworldwizard.hpp" -namespace nostalgia { -namespace world { +namespace nostalgia::world { using namespace studio; @@ -21,15 +20,14 @@ const QString NewWorldWizard::FIELD_WORLD_PATH = "World.WorldPath"; NewWorldWizard::NewWorldWizard(const Context *ctx) { addLineEdit(tr("&Name:"), FIELD_WORLD_PATH, "", [this, ctx](QString worldName) { worldName = PATH_ZONES + worldName; - if (ctx->project->stat(worldName).inode == 0) { - return 0; - } else { + auto [stat, err] = ctx->project->stat(worldName); + if (err) { this->showValidationError(tr("World already exists: %1").arg(worldName)); return 1; } + return 0; } ); } } -} diff --git a/src/nostalgia/world/studio/newworldwizard.hpp b/src/nostalgia/world/studio/newworldwizard.hpp index a2286501..07f9a1ce 100644 --- a/src/nostalgia/world/studio/newworldwizard.hpp +++ b/src/nostalgia/world/studio/newworldwizard.hpp @@ -12,8 +12,7 @@ #include -namespace nostalgia { -namespace world { +namespace nostalgia::world { struct NewWorldWizard: public studio::WizardFormPage { @@ -24,4 +23,3 @@ struct NewWorldWizard: public studio::WizardFormPage { }; } -} diff --git a/src/nostalgia/world/studio/worldeditor.hpp b/src/nostalgia/world/studio/worldeditor.hpp index 7de40447..1871665c 100644 --- a/src/nostalgia/world/studio/worldeditor.hpp +++ b/src/nostalgia/world/studio/worldeditor.hpp @@ -10,8 +10,7 @@ #include -namespace nostalgia { -namespace world { +namespace nostalgia::world { class WorldEditor: public QWidget { @@ -21,4 +20,3 @@ class WorldEditor: public QWidget { }; } -} diff --git a/src/nostalgia/world/studio/worldstudioplugin.cpp b/src/nostalgia/world/studio/worldstudioplugin.cpp index 4c0b14b9..7e2c9940 100644 --- a/src/nostalgia/world/studio/worldstudioplugin.cpp +++ b/src/nostalgia/world/studio/worldstudioplugin.cpp @@ -16,8 +16,7 @@ #include "worldstudioplugin.hpp" -namespace nostalgia { -namespace world { +namespace nostalgia::world { using namespace studio; @@ -32,11 +31,10 @@ QVector WorldEditorPlugin::newWizards(const Context *ctx) { qDebug() << "creating Region"; auto path = PATH_ZONES + w->field(NewWorldWizard::FIELD_WORLD_PATH).toString(); Region rgn; - auto err = ctx->project->mkdir(PATH_ZONES); + oxReturnError(ctx->project->mkdir(PATH_ZONES)); ctx->project->saveRomFs(); - qDebug() << "err:" << err; - err |= ctx->project->writeObj(path, &rgn); - return err; + oxReturnError(ctx->project->writeObj(path, &rgn)); + return OxError(0); } } }; @@ -51,4 +49,3 @@ QWidget *WorldEditorPlugin::makeEditor(QString path, const Context *ctx) { } } -} diff --git a/src/nostalgia/world/studio/worldstudioplugin.hpp b/src/nostalgia/world/studio/worldstudioplugin.hpp index 26ce9154..40cfd53f 100644 --- a/src/nostalgia/world/studio/worldstudioplugin.hpp +++ b/src/nostalgia/world/studio/worldstudioplugin.hpp @@ -12,8 +12,7 @@ #include -namespace nostalgia { -namespace world { +namespace nostalgia::world { class WorldEditorPlugin: public QObject, public studio::Plugin { Q_OBJECT @@ -28,4 +27,3 @@ class WorldEditorPlugin: public QObject, public studio::Plugin { }; } -}