[nostalgia] Rename Studio Plugins to Modules, add support for builtin Studio modules, make existing modules builtin
This commit is contained in:
		@@ -108,7 +108,7 @@ else()
 | 
				
			|||||||
	set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
 | 
						set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
 | 
				
			||||||
	set(NOSTALGIA_DIST_BIN       bin)
 | 
						set(NOSTALGIA_DIST_BIN       bin)
 | 
				
			||||||
	set(NOSTALGIA_DIST_LIB       lib)
 | 
						set(NOSTALGIA_DIST_LIB       lib)
 | 
				
			||||||
	set(NOSTALGIA_DIST_PLUGIN    lib/nostalgia/plugins)
 | 
						set(NOSTALGIA_DIST_PLUGIN    lib/nostalgia/modules)
 | 
				
			||||||
	set(NOSTALGIA_DIST_RESOURCES share)
 | 
						set(NOSTALGIA_DIST_RESOURCES share)
 | 
				
			||||||
endif()
 | 
					endif()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -3,13 +3,13 @@ set(CMAKE_AUTOMOC ON)
 | 
				
			|||||||
set(CMAKE_AUTORCC ON)
 | 
					set(CMAKE_AUTORCC ON)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
add_library(
 | 
					add_library(
 | 
				
			||||||
	NostalgiaCore-Studio SHARED
 | 
						NostalgiaCore-Studio OBJECT
 | 
				
			||||||
		imgconv.cpp
 | 
							imgconv.cpp
 | 
				
			||||||
		import_tilesheet_wizard.cpp
 | 
							import_tilesheet_wizard.cpp
 | 
				
			||||||
 | 
							module.cpp
 | 
				
			||||||
		new_tilesheet_wizard.cpp
 | 
							new_tilesheet_wizard.cpp
 | 
				
			||||||
		newpalettewizard.cpp
 | 
							newpalettewizard.cpp
 | 
				
			||||||
		paletteeditor.cpp
 | 
							paletteeditor.cpp
 | 
				
			||||||
		plugin.cpp
 | 
					 | 
				
			||||||
		tilesheeteditor.cpp
 | 
							tilesheeteditor.cpp
 | 
				
			||||||
		util.cpp
 | 
							util.cpp
 | 
				
			||||||
		rsrc.qrc
 | 
							rsrc.qrc
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,5 +1,5 @@
 | 
				
			|||||||
/*
 | 
					/*
 | 
				
			||||||
 * Copyright 2016 - 2019 gtalent2@gmail.com
 | 
					 * Copyright 2016 - 2020 gary@drinkingtea.net
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * This Source Code Form is subject to the terms of the Mozilla Public
 | 
					 * This Source Code Form is subject to the terms of the Mozilla Public
 | 
				
			||||||
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 | 
					 * License, v. 2.0. If a copy of the MPL was not distributed with this
 | 
				
			||||||
@@ -12,11 +12,11 @@
 | 
				
			|||||||
#include "paletteeditor.hpp"
 | 
					#include "paletteeditor.hpp"
 | 
				
			||||||
#include "tilesheeteditor.hpp"
 | 
					#include "tilesheeteditor.hpp"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "plugin.hpp"
 | 
					#include "module.hpp"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace nostalgia::core {
 | 
					namespace nostalgia::core {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
QVector<studio::WizardMaker> Plugin::newWizards(const studio::Context *ctx) {
 | 
					QVector<studio::WizardMaker> Module::newWizards(const studio::Context *ctx) {
 | 
				
			||||||
	return {
 | 
						return {
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			tr("Palette"),
 | 
								tr("Palette"),
 | 
				
			||||||
@@ -37,7 +37,7 @@ QVector<studio::WizardMaker> Plugin::newWizards(const studio::Context *ctx) {
 | 
				
			|||||||
	};
 | 
						};
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
QVector<studio::WizardMaker> Plugin::importWizards(const studio::Context *ctx) {
 | 
					QVector<studio::WizardMaker> Module::importWizards(const studio::Context *ctx) {
 | 
				
			||||||
	return {
 | 
						return {
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			tr("Tile Sheet"),
 | 
								tr("Tile Sheet"),
 | 
				
			||||||
@@ -51,7 +51,7 @@ QVector<studio::WizardMaker> Plugin::importWizards(const studio::Context *ctx) {
 | 
				
			|||||||
	};
 | 
						};
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
QVector<studio::EditorMaker> Plugin::editors(const studio::Context *ctx) {
 | 
					QVector<studio::EditorMaker> Module::editors(const studio::Context *ctx) {
 | 
				
			||||||
	return {
 | 
						return {
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			{"ng"},
 | 
								{"ng"},
 | 
				
			||||||
@@ -14,10 +14,10 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
namespace nostalgia::core {
 | 
					namespace nostalgia::core {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class Plugin: public QObject, studio::Plugin {
 | 
					class Module: public QObject, public studio::Module {
 | 
				
			||||||
	Q_OBJECT
 | 
						Q_OBJECT
 | 
				
			||||||
	Q_PLUGIN_METADATA(IID "net.drinkingtea.nostalgia.core.studio.Plugin" FILE "core-studio.json")
 | 
						Q_PLUGIN_METADATA(IID "net.drinkingtea.nostalgia.core.studio.Module" FILE "core-studio.json")
 | 
				
			||||||
	Q_INTERFACES(nostalgia::studio::Plugin)
 | 
						Q_INTERFACES(nostalgia::studio::Module)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	public:
 | 
						public:
 | 
				
			||||||
		QVector<studio::WizardMaker> newWizards(const studio::Context *ctx) override;
 | 
							QVector<studio::WizardMaker> newWizards(const studio::Context *ctx) override;
 | 
				
			||||||
@@ -15,6 +15,7 @@ add_executable(
 | 
				
			|||||||
target_link_libraries(
 | 
					target_link_libraries(
 | 
				
			||||||
	nostalgia-studio
 | 
						nostalgia-studio
 | 
				
			||||||
		QDarkStyle
 | 
							QDarkStyle
 | 
				
			||||||
 | 
							NostalgiaCore-Studio
 | 
				
			||||||
		NostalgiaStudio
 | 
							NostalgiaStudio
 | 
				
			||||||
		NostalgiaPack
 | 
							NostalgiaPack
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										22
									
								
								src/nostalgia/studio/builtinmodules.hpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								src/nostalgia/studio/builtinmodules.hpp
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,22 @@
 | 
				
			|||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * Copyright 2016 - 2020 gary@drinkingtea.net
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * This Source Code Form is subject to the terms of the Mozilla Public
 | 
				
			||||||
 | 
					 * License, v. 2.0. If a copy of the MPL was not distributed with this
 | 
				
			||||||
 | 
					 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#pragma once
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <nostalgia/core/studio/module.hpp>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					namespace nostalgia::studio {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					[[maybe_unused]] // GCC warns about the existence of this "unused" constexpr list in a header file...
 | 
				
			||||||
 | 
					constexpr auto BuiltinModules = {
 | 
				
			||||||
 | 
						[] {
 | 
				
			||||||
 | 
							return new core::Module();
 | 
				
			||||||
 | 
						},
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@@ -5,7 +5,7 @@ add_library(
 | 
				
			|||||||
	NostalgiaStudio SHARED
 | 
						NostalgiaStudio SHARED
 | 
				
			||||||
		editor.cpp
 | 
							editor.cpp
 | 
				
			||||||
		wizard.cpp
 | 
							wizard.cpp
 | 
				
			||||||
		plugin.cpp
 | 
							module.cpp
 | 
				
			||||||
		project.cpp
 | 
							project.cpp
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -26,7 +26,7 @@ install(
 | 
				
			|||||||
	FILES
 | 
						FILES
 | 
				
			||||||
		editor.hpp
 | 
							editor.hpp
 | 
				
			||||||
		wizard.hpp
 | 
							wizard.hpp
 | 
				
			||||||
		plugin.hpp
 | 
							module.hpp
 | 
				
			||||||
		project.hpp
 | 
							project.hpp
 | 
				
			||||||
		${CMAKE_CURRENT_BINARY_DIR}/nostalgiastudio_export.h
 | 
							${CMAKE_CURRENT_BINARY_DIR}/nostalgiastudio_export.h
 | 
				
			||||||
	DESTINATION
 | 
						DESTINATION
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,5 +1,5 @@
 | 
				
			|||||||
/*
 | 
					/*
 | 
				
			||||||
 * Copyright 2016 - 2019 gtalent2@gmail.com
 | 
					 * Copyright 2016 - 2020 gary@drinkingtea.net
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * This Source Code Form is subject to the terms of the Mozilla Public
 | 
					 * This Source Code Form is subject to the terms of the Mozilla Public
 | 
				
			||||||
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 | 
					 * License, v. 2.0. If a copy of the MPL was not distributed with this
 | 
				
			||||||
@@ -7,23 +7,23 @@
 | 
				
			|||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "context.hpp"
 | 
					#include "context.hpp"
 | 
				
			||||||
#include "plugin.hpp"
 | 
					#include "module.hpp"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace nostalgia::studio {
 | 
					namespace nostalgia::studio {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
QVector<WizardMaker> Plugin::newWizards(const Context*) {
 | 
					QVector<WizardMaker> Module::newWizards(const Context*) {
 | 
				
			||||||
	return {};
 | 
						return {};
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
QVector<WizardMaker> Plugin::importWizards(const Context*) {
 | 
					QVector<WizardMaker> Module::importWizards(const Context*) {
 | 
				
			||||||
	return {};
 | 
						return {};
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
QWidget *Plugin::makeEditor(QString, const Context*) {
 | 
					QWidget *Module::makeEditor(QString, const Context*) {
 | 
				
			||||||
	return nullptr;
 | 
						return nullptr;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
QVector<EditorMaker> Plugin::editors(const Context*) {
 | 
					QVector<EditorMaker> Module::editors(const Context*) {
 | 
				
			||||||
	return {};
 | 
						return {};
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -1,5 +1,5 @@
 | 
				
			|||||||
/*
 | 
					/*
 | 
				
			||||||
 * Copyright 2016 - 2019 gtalent2@gmail.com
 | 
					 * Copyright 2016 - 2020 gary@drinkingtea.net
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * This Source Code Form is subject to the terms of the Mozilla Public
 | 
					 * This Source Code Form is subject to the terms of the Mozilla Public
 | 
				
			||||||
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 | 
					 * License, v. 2.0. If a copy of the MPL was not distributed with this
 | 
				
			||||||
@@ -22,10 +22,10 @@ struct EditorMaker {
 | 
				
			|||||||
	std::function<class Editor*(QString)> make;
 | 
						std::function<class Editor*(QString)> make;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class Plugin {
 | 
					class Module {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	public:
 | 
						public:
 | 
				
			||||||
		virtual ~Plugin() = default;
 | 
							virtual ~Module() = default;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		virtual QVector<WizardMaker> newWizards(const class Context *ctx);
 | 
							virtual QVector<WizardMaker> newWizards(const class Context *ctx);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -39,6 +39,6 @@ class Plugin {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define PluginInterface_iid "net.drinkingtea.nostalgia.studio.Plugin"
 | 
					#define PluginInterface_iid "net.drinkingtea.nostalgia.studio.Module"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Q_DECLARE_INTERFACE(nostalgia::studio::Plugin, PluginInterface_iid)
 | 
					Q_DECLARE_INTERFACE(nostalgia::studio::Module, PluginInterface_iid)
 | 
				
			||||||
@@ -1,5 +1,5 @@
 | 
				
			|||||||
/*
 | 
					/*
 | 
				
			||||||
 * Copyright 2016 - 2019 gtalent2@gmail.com
 | 
					 * Copyright 2016 - 2020 gary@drinkingtea.net
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * This Source Code Form is subject to the terms of the Mozilla Public
 | 
					 * This Source Code Form is subject to the terms of the Mozilla Public
 | 
				
			||||||
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 | 
					 * License, v. 2.0. If a copy of the MPL was not distributed with this
 | 
				
			||||||
@@ -17,7 +17,7 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
#include "context.hpp"
 | 
					#include "context.hpp"
 | 
				
			||||||
#include "project.hpp"
 | 
					#include "project.hpp"
 | 
				
			||||||
#include "plugin.hpp"
 | 
					#include "module.hpp"
 | 
				
			||||||
#include "wizard.hpp"
 | 
					#include "wizard.hpp"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace nostalgia::studio {
 | 
					namespace nostalgia::studio {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,5 +1,5 @@
 | 
				
			|||||||
/*
 | 
					/*
 | 
				
			||||||
 * Copyright 2016 - 2019 gtalent2@gmail.com
 | 
					 * Copyright 2016 - 2020 gary@drinkingtea.net
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * This Source Code Form is subject to the terms of the Mozilla Public
 | 
					 * This Source Code Form is subject to the terms of the Mozilla Public
 | 
				
			||||||
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 | 
					 * License, v. 2.0. If a copy of the MPL was not distributed with this
 | 
				
			||||||
@@ -70,7 +70,7 @@ MainWindow::MainWindow(QString profilePath) {
 | 
				
			|||||||
	setupProjectExplorer();
 | 
						setupProjectExplorer();
 | 
				
			||||||
	statusBar(); // setup status bar
 | 
						statusBar(); // setup status bar
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	loadPlugins();
 | 
						loadModules();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	readState();
 | 
						readState();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@@ -79,41 +79,48 @@ MainWindow::~MainWindow() {
 | 
				
			|||||||
	closeProject();
 | 
						closeProject();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void MainWindow::loadPlugins() {
 | 
					void MainWindow::loadModules() {
 | 
				
			||||||
	for (auto dir : m_profile.pluginsPath) {
 | 
						for (auto p : BuiltinModules) {
 | 
				
			||||||
 | 
							loadModule(p());
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						for (auto dir : m_profile.modulesPath) {
 | 
				
			||||||
		QFileInfo dirInfo(m_profilePath);
 | 
							QFileInfo dirInfo(m_profilePath);
 | 
				
			||||||
		dir = dirInfo.absolutePath() + "/" + dir;
 | 
							dir = dirInfo.absolutePath() + "/" + dir;
 | 
				
			||||||
		if (dirInfo.exists()) {
 | 
							if (dirInfo.exists()) {
 | 
				
			||||||
			qDebug() << "Checking plugin directory:" << dir;
 | 
								qDebug() << "Checking module directory:" << dir;
 | 
				
			||||||
			loadPluginDir(dir);
 | 
								loadModuleDir(dir);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void MainWindow::loadPluginDir(QString dir) {
 | 
					void MainWindow::loadModuleDir(QString dir) {
 | 
				
			||||||
	for (auto pluginPath : QDir(dir).entryList()) {
 | 
						for (auto modulePath : QDir(dir).entryList()) {
 | 
				
			||||||
		pluginPath = dir + '/' + pluginPath;
 | 
							modulePath = dir + '/' + modulePath;
 | 
				
			||||||
		if (QLibrary::isLibrary(pluginPath)) {
 | 
							if (QLibrary::isLibrary(modulePath)) {
 | 
				
			||||||
			loadPlugin(pluginPath);
 | 
								loadModule(modulePath);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void MainWindow::loadPlugin(QString pluginPath) {
 | 
					void MainWindow::loadModule(QString modulePath) {
 | 
				
			||||||
	qDebug() << "Loading plugin:" << pluginPath;
 | 
						qDebug() << "Loading module:" << modulePath;
 | 
				
			||||||
	QPluginLoader loader(pluginPath);
 | 
						QPluginLoader loader(modulePath);
 | 
				
			||||||
	auto plugin = qobject_cast<Plugin*>(loader.instance());
 | 
						auto module = qobject_cast<Module*>(loader.instance());
 | 
				
			||||||
	if (plugin) {
 | 
						if (module) {
 | 
				
			||||||
		m_plugins.push_back(plugin);
 | 
							loadModule(module);
 | 
				
			||||||
		auto editorMakers = plugin->editors(&m_ctx);
 | 
						} else {
 | 
				
			||||||
 | 
							qInfo() << loader.errorString();
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void MainWindow::loadModule(Module *module) {
 | 
				
			||||||
 | 
						m_modules.push_back(module);
 | 
				
			||||||
 | 
						auto editorMakers = module->editors(&m_ctx);
 | 
				
			||||||
	for (const auto &em : editorMakers) {
 | 
						for (const auto &em : editorMakers) {
 | 
				
			||||||
		for (const auto &ext : em.fileTypes) {
 | 
							for (const auto &ext : em.fileTypes) {
 | 
				
			||||||
			m_editorMakers[ext] = em;
 | 
								m_editorMakers[ext] = em;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	} else {
 | 
					 | 
				
			||||||
		qInfo() << loader.errorString();
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void MainWindow::setupMenu() {
 | 
					void MainWindow::setupMenu() {
 | 
				
			||||||
@@ -492,8 +499,8 @@ void MainWindow::showNewWizard() {
 | 
				
			|||||||
		}
 | 
							}
 | 
				
			||||||
	);
 | 
						);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// add plugin options
 | 
						// add module options
 | 
				
			||||||
	for (auto p : m_plugins) {
 | 
						for (auto p : m_modules) {
 | 
				
			||||||
		for (auto w : p->newWizards(&m_ctx)) {
 | 
							for (auto w : p->newWizards(&m_ctx)) {
 | 
				
			||||||
			ws->addOption(w);
 | 
								ws->addOption(w);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
@@ -590,7 +597,7 @@ void MainWindow::showImportWizard() {
 | 
				
			|||||||
	auto ws = new WizardSelect();
 | 
						auto ws = new WizardSelect();
 | 
				
			||||||
	wizard.addPage(ws);
 | 
						wizard.addPage(ws);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for (auto p : m_plugins) {
 | 
						for (auto p : m_modules) {
 | 
				
			||||||
		for (auto w : p->importWizards(&m_ctx)) {
 | 
							for (auto w : p->importWizards(&m_ctx)) {
 | 
				
			||||||
			ws->addOption(w);
 | 
								ws->addOption(w);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,5 +1,5 @@
 | 
				
			|||||||
/*
 | 
					/*
 | 
				
			||||||
 * Copyright 2016 - 2019 gtalent2@gmail.com
 | 
					 * Copyright 2016 - 2020 gary@drinkingtea.net
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * This Source Code Form is subject to the terms of the Mozilla Public
 | 
					 * This Source Code Form is subject to the terms of the Mozilla Public
 | 
				
			||||||
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 | 
					 * License, v. 2.0. If a copy of the MPL was not distributed with this
 | 
				
			||||||
@@ -25,9 +25,10 @@
 | 
				
			|||||||
#include <ox/std/types.hpp>
 | 
					#include <ox/std/types.hpp>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "lib/context.hpp"
 | 
					#include "lib/context.hpp"
 | 
				
			||||||
#include "lib/plugin.hpp"
 | 
					#include "lib/module.hpp"
 | 
				
			||||||
#include "lib/project.hpp"
 | 
					#include "lib/project.hpp"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include "builtinmodules.hpp"
 | 
				
			||||||
#include "oxfstreeview.hpp"
 | 
					#include "oxfstreeview.hpp"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace nostalgia::studio {
 | 
					namespace nostalgia::studio {
 | 
				
			||||||
@@ -47,7 +48,7 @@ ox::Error model(T *io, NostalgiaStudioState *obj) {
 | 
				
			|||||||
struct NostalgiaStudioProfile {
 | 
					struct NostalgiaStudioProfile {
 | 
				
			||||||
	QString appName;
 | 
						QString appName;
 | 
				
			||||||
	QString orgName;
 | 
						QString orgName;
 | 
				
			||||||
	QVector<QString> pluginsPath;
 | 
						QVector<QString> modulesPath;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
template<typename T>
 | 
					template<typename T>
 | 
				
			||||||
@@ -56,7 +57,7 @@ ox::Error model(T *io, NostalgiaStudioProfile *obj) {
 | 
				
			|||||||
	oxReturnError(io->setTypeInfo("NostalgiaStudioProfile", 3));
 | 
						oxReturnError(io->setTypeInfo("NostalgiaStudioProfile", 3));
 | 
				
			||||||
	oxReturnError(io->field("app_name", &obj->appName));
 | 
						oxReturnError(io->field("app_name", &obj->appName));
 | 
				
			||||||
	oxReturnError(io->field("org_name", &obj->orgName));
 | 
						oxReturnError(io->field("org_name", &obj->orgName));
 | 
				
			||||||
	oxReturnError(io->field("plugins_path", &obj->pluginsPath));
 | 
						oxReturnError(io->field("modules_path", &obj->modulesPath));
 | 
				
			||||||
	return err;
 | 
						return err;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -82,7 +83,7 @@ class MainWindow: public QMainWindow {
 | 
				
			|||||||
		QPointer<QMenu> m_viewMenu;
 | 
							QPointer<QMenu> m_viewMenu;
 | 
				
			||||||
		QVector<QPointer<QDockWidget>> m_dockWidgets;
 | 
							QVector<QPointer<QDockWidget>> m_dockWidgets;
 | 
				
			||||||
		QTreeView *m_projectExplorer = nullptr;
 | 
							QTreeView *m_projectExplorer = nullptr;
 | 
				
			||||||
		QVector<Plugin*> m_plugins;
 | 
							QVector<Module*> m_modules;
 | 
				
			||||||
		QHash<QString, EditorMaker> m_editorMakers;
 | 
							QHash<QString, EditorMaker> m_editorMakers;
 | 
				
			||||||
		QPointer<OxFSModel> m_oxfsView = nullptr;
 | 
							QPointer<OxFSModel> m_oxfsView = nullptr;
 | 
				
			||||||
		QTabWidget *m_tabs = nullptr;
 | 
							QTabWidget *m_tabs = nullptr;
 | 
				
			||||||
@@ -95,11 +96,13 @@ class MainWindow: public QMainWindow {
 | 
				
			|||||||
		virtual ~MainWindow();
 | 
							virtual ~MainWindow();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	private:
 | 
						private:
 | 
				
			||||||
		void loadPlugins();
 | 
							void loadModules();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		void loadPluginDir(QString path);
 | 
							void loadModuleDir(QString path);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		void loadPlugin(QString path);
 | 
							void loadModule(QString path);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							void loadModule(Module *module);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		void setupMenu();
 | 
							void setupMenu();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,8 +1,8 @@
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
	"app_name": "Nostalgia Studio",
 | 
						"app_name": "Nostalgia Studio",
 | 
				
			||||||
	"org_name": "Drinking Tea",
 | 
						"org_name": "Drinking Tea",
 | 
				
			||||||
	"plugins_path": [
 | 
						"modules_path": [
 | 
				
			||||||
		"../lib/nostalgia/plugins",
 | 
							"../lib/nostalgia/modules",
 | 
				
			||||||
		"../Plugins",
 | 
							"../Plugins",
 | 
				
			||||||
		"../../../out/build/x64-Debug",
 | 
							"../../../out/build/x64-Debug",
 | 
				
			||||||
		"../../../out/build/x64-Release"
 | 
							"../../../out/build/x64-Release"
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,8 +1,8 @@
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
	"app_name": "Nostalgia Studio",
 | 
						"app_name": "Nostalgia Studio",
 | 
				
			||||||
	"org_name": "Drinking Tea",
 | 
						"org_name": "Drinking Tea",
 | 
				
			||||||
	"plugins_path": [
 | 
						"modules_path": [
 | 
				
			||||||
		"../lib/nostalgia/plugins",
 | 
							"../lib/nostalgia/modules",
 | 
				
			||||||
		"../Plugins"
 | 
							"../Plugins"
 | 
				
			||||||
	]
 | 
						]
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,5 +1,5 @@
 | 
				
			|||||||
/*
 | 
					/*
 | 
				
			||||||
 * Copyright 2016 - 2019 gtalent2@gmail.com
 | 
					 * Copyright 2016 - 2020 gary@drinkingtea.net
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * This Source Code Form is subject to the terms of the Mozilla Public
 | 
					 * This Source Code Form is subject to the terms of the Mozilla Public
 | 
				
			||||||
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 | 
					 * License, v. 2.0. If a copy of the MPL was not distributed with this
 | 
				
			||||||
@@ -10,6 +10,6 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
#include "lib/context.hpp"
 | 
					#include "lib/context.hpp"
 | 
				
			||||||
#include "lib/editor.hpp"
 | 
					#include "lib/editor.hpp"
 | 
				
			||||||
#include "lib/plugin.hpp"
 | 
					#include "lib/module.hpp"
 | 
				
			||||||
#include "lib/project.hpp"
 | 
					#include "lib/project.hpp"
 | 
				
			||||||
#include "lib/wizard.hpp"
 | 
					#include "lib/wizard.hpp"
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,6 +1,6 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
add_library(
 | 
					add_library(
 | 
				
			||||||
	NostalgiaWorld-Studio SHARED
 | 
						NostalgiaWorld-Studio OBJECT
 | 
				
			||||||
		consts.cpp
 | 
							consts.cpp
 | 
				
			||||||
		newworldwizard.cpp
 | 
							newworldwizard.cpp
 | 
				
			||||||
		worldstudioplugin.cpp
 | 
							worldstudioplugin.cpp
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,5 +1,5 @@
 | 
				
			|||||||
/*
 | 
					/*
 | 
				
			||||||
 * Copyright 2016 - 2019 gtalent2@gmail.com
 | 
					 * Copyright 2016 - 2020 gary@drinkingtea.net
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * This Source Code Form is subject to the terms of the Mozilla Public
 | 
					 * This Source Code Form is subject to the terms of the Mozilla Public
 | 
				
			||||||
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 | 
					 * License, v. 2.0. If a copy of the MPL was not distributed with this
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,5 +1,5 @@
 | 
				
			|||||||
/*
 | 
					/*
 | 
				
			||||||
 * Copyright 2016 - 2020 gtalent2@gmail.com
 | 
					 * Copyright 2016 - 2020 gary@drinkingtea.net
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * This Source Code Form is subject to the terms of the Mozilla Public
 | 
					 * This Source Code Form is subject to the terms of the Mozilla Public
 | 
				
			||||||
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 | 
					 * License, v. 2.0. If a copy of the MPL was not distributed with this
 | 
				
			||||||
@@ -14,10 +14,10 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
namespace nostalgia::world {
 | 
					namespace nostalgia::world {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class WorldEditorPlugin: public QObject, public studio::Plugin {
 | 
					class WorldEditorPlugin: public QObject, public studio::Module {
 | 
				
			||||||
	Q_OBJECT
 | 
						Q_OBJECT
 | 
				
			||||||
	Q_PLUGIN_METADATA(IID "net.drinkingtea.nostalgia.world.studio.Plugin" FILE "world-studio.json")
 | 
						Q_PLUGIN_METADATA(IID "net.drinkingtea.nostalgia.world.studio.Module" FILE "world-studio.json")
 | 
				
			||||||
	Q_INTERFACES(nostalgia::studio::Plugin)
 | 
						Q_INTERFACES(nostalgia::studio::Module)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	public:
 | 
						public:
 | 
				
			||||||
		QVector<studio::WizardMaker> newWizards(const studio::Context *ctx) override;
 | 
							QVector<studio::WizardMaker> newWizards(const studio::Context *ctx) override;
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user