diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/CMakeLists.txt b/code/nel/tools/3d/object_viewer_qt/src/plugins/CMakeLists.txt index 467b00876..945e0825f 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/CMakeLists.txt +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/CMakeLists.txt @@ -6,6 +6,7 @@ ADD_SUBDIRECTORY(log) ADD_SUBDIRECTORY(disp_sheet_id) ADD_SUBDIRECTORY(object_viewer) ADD_SUBDIRECTORY(georges_editor) +ADD_SUBDIRECTORY(gui_editor) ADD_SUBDIRECTORY(translation_manager) ADD_SUBDIRECTORY(bnp_manager) # Note: Temporarily disabled until development continues. diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/CMakeLists.txt b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/CMakeLists.txt new file mode 100644 index 000000000..769561d34 --- /dev/null +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/CMakeLists.txt @@ -0,0 +1,43 @@ +INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_CURRENT_SOURCE_DIR} + ${LIBXML2_INCLUDE_DIR} + ${QT_INCLUDES}) + +FILE(GLOB SRC *.cpp *.h) + +SET(OVQT_EXT_SYS_SRC ${CMAKE_CURRENT_SOURCE_DIR}/../../extension_system/iplugin.h + ${CMAKE_CURRENT_SOURCE_DIR}/../../extension_system/iplugin_manager.h + ${CMAKE_CURRENT_SOURCE_DIR}/../../extension_system/iplugin_spec.h) + +SET(OVQT_PLUGIN_GUI_EDITOR_HDR gui_editor_plugin.h gui_editor_window.h gui_editor_context.h ) +SET(OVQT_PLUGIN_GUI_EDITOR_UIS gui_editor_window.ui ) + +SET(QT_USE_QTGUI TRUE) +SET(QT_USE_QTOPENGL TRUE) + +QT4_ADD_RESOURCES(OVQT_PLUGIN_GUI_EDITOR_RC_SRCS ${OVQT_PLUGIN_GUI_EDITOR_RCS}) +QT4_WRAP_CPP(OVQT_PLUGIN_GUI_EDITOR_MOC_SRC ${OVQT_PLUGIN_GUI_EDITOR_HDR}) +QT4_WRAP_UI(OVQT_PLUGIN_GUI_EDITOR_UI_HDRS ${OVQT_PLUGIN_GUI_EDITOR_UIS}) + +SOURCE_GROUP(QtResources FILES ${OVQT_PLUGIN_GUI_EDITOR_UIS}) +SOURCE_GROUP(QtGeneratedUiHdr FILES ${OVQT_PLUGIN_GUI_EDITOR_UI_HDRS}) +SOURCE_GROUP(QtGeneratedMocQrcSrc FILES ${OVQT_PLUGIN_GUI_EDITOR_MOC_SRC} OVQT_PLUGIN_GUI_EDITOR_RC_SRCS) +SOURCE_GROUP("GUI Editor Plugin" FILES ${SRC}) +SOURCE_GROUP("OVQT Extension System" FILES ${OVQT_EXT_SYS_SRC}) + +ADD_LIBRARY(ovqt_plugin_gui_editor MODULE ${SRC} + ${OVQT_PLUGIN_GUI_EDITOR_MOC_SRC} + ${OVQT_EXT_SYS_SRC} + ${OVQT_PLUGIN_GUI_EDITOR_UI_HDRS} + ${OVQT_PLUGIN_GUI_EDITOR_RC_SRCS} + ) + +TARGET_LINK_LIBRARIES(ovqt_plugin_gui_editor ovqt_plugin_core nelmisc nel3d ${QT_LIBRARIES} ${QT_QTOPENGL_LIBRARY}) + +NL_DEFAULT_PROPS(ovqt_plugin_gui_editor "NeL, Tools, 3D: Object Viewer Qt Plugin: GUI Editor") +NL_ADD_RUNTIME_FLAGS(ovqt_plugin_gui_editor) +NL_ADD_LIB_SUFFIX(ovqt_plugin_gui_editor) + +ADD_DEFINITIONS(-DGUI_EDITOR_LIBRARY ${LIBXML2_DEFINITIONS} -DQT_PLUGIN -DQT_SHARED ${QT_DEFINITIONS}) + +INSTALL(TARGETS ovqt_plugin_gui_editor LIBRARY DESTINATION lib RUNTIME DESTINATION bin ARCHIVE DESTINATION lib COMPONENT tools3d) diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/gui_editor_constants.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/gui_editor_constants.h new file mode 100644 index 000000000..2c50d9453 --- /dev/null +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/gui_editor_constants.h @@ -0,0 +1,33 @@ +// Object Viewer Qt GUI Editor plugin +// Copyright (C) 2010 Winch Gate Property Limited +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + +#ifndef GUI_EDITOR_CONSTANTS_H +#define GUI_EDITOR_CONSTANTS_H + +namespace GUIEditor +{ + namespace Constants + { + + const char * const GUI_EDITOR_PLUGIN = "GUIEditor"; + const char * const GUI_EDITOR_SECTION = "GUIEditor"; + + } + +} + +#endif + diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/gui_editor_context.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/gui_editor_context.cpp new file mode 100644 index 000000000..32dba0e25 --- /dev/null +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/gui_editor_context.cpp @@ -0,0 +1,46 @@ +// Object Viewer Qt GUI Editor plugin +// Copyright (C) 2010 Winch Gate Property Limited +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + + +#include "gui_editor_context.h" +#include "gui_editor_window.h" + +namespace GUIEditor +{ + GUIEditorContext::GUIEditorContext(QObject *parent) : + IContext(parent), + m_guiEditorWindow(0) + { + m_guiEditorWindow = new GUIEditorWindow(); + } + + QUndoStack *GUIEditorContext::undoStack() + { + return m_guiEditorWindow->undoStack(); + } + + void GUIEditorContext::open() + { + m_guiEditorWindow->open(); + } + + QWidget *GUIEditorContext::widget() + { + return m_guiEditorWindow; + } + +} + diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/gui_editor_context.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/gui_editor_context.h new file mode 100644 index 000000000..39c521cdf --- /dev/null +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/gui_editor_context.h @@ -0,0 +1,56 @@ +// Object Viewer Qt GUI Editor plugin +// Copyright (C) 2010 Winch Gate Property Limited +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + + +#ifndef GUI_EDITOR_CONTEXT_H +#define GUI_EDITOR_CONTEXT_H + +#include "../core/icontext.h" + +#include "nel/misc/app_context.h" + +#include +#include + +namespace GUIEditor +{ + class GUIEditorWindow; + + class GUIEditorContext: public Core::IContext + { + Q_OBJECT + public: + GUIEditorContext(QObject *parent = 0); + virtual ~GUIEditorContext() {} + + virtual QString id() const{ return QLatin1String("GUIEditorContext"); } + + virtual QString trName() const{ return tr("GUI Editor"); } + + virtual QIcon icon() const{ return QIcon(); } + + virtual void open(); + + virtual QUndoStack *undoStack(); + + virtual QWidget *widget(); + + GUIEditorWindow *m_guiEditorWindow; + }; + +} + +#endif diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/gui_editor_global.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/gui_editor_global.h new file mode 100644 index 000000000..82ca563a6 --- /dev/null +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/gui_editor_global.h @@ -0,0 +1,30 @@ +// Object Viewer Qt GUI Editor plugin +// Copyright (C) 2010 Winch Gate Property Limited +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + + +#ifndef GUI_EDITOR_GLOBAL_H +#define GUI_EDITOR_GLOBAL_H + +#include + +#if defined( GUI_EDITOR_LIBRARY ) +# define GUI_EDITOR_EXPORT Q_DECL_EXPORT +#else +# define GUI_EDITOR_EXPORT Q_DECL_IMPORT +#endif + +#endif + diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/gui_editor_plugin.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/gui_editor_plugin.cpp new file mode 100644 index 000000000..04088f046 --- /dev/null +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/gui_editor_plugin.cpp @@ -0,0 +1,103 @@ +// Object Viewer Qt GUI Editor plugin +// Copyright (C) 2010 Winch Gate Property Limited +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + +#include "gui_editor_plugin.h" +#include "gui_editor_window.h" +#include "gui_editor_context.h" + +#include "../core/icore.h" +#include "../core/core_constants.h" + +#include "nel/misc/debug.h" + +#include + +namespace GUIEditor +{ + GUIEditorPlugin::~GUIEditorPlugin() + { + Q_FOREACH(QObject *obj, m_autoReleaseObjects) + { + m_plugMan->removeObject(obj); + } + + qDeleteAll(m_autoReleaseObjects); + m_autoReleaseObjects.clear(); + } + + bool GUIEditorPlugin::initialize(ExtensionSystem::IPluginManager *pluginManager, QString *errorString) + { + Q_UNUSED(errorString); + m_plugMan = pluginManager; + addAutoReleasedObject(new GUIEditorContext(this)); + return true; + } + + void GUIEditorPlugin::extensionsInitialized() + { + } + + void GUIEditorPlugin::shutdown() + { + } + + void GUIEditorPlugin::setNelContext(NLMISC::INelContext *nelContext) + { + +#ifdef NL_OS_WINDOWS + // Ensure that a context doesn't exist yet. + // This only applies to platforms without PIC, e.g. Windows. + nlassert(!NLMISC::INelContext::isContextInitialised()); +#endif // NL_OS_WINDOWS + m_libContext = new NLMISC::CLibraryContext(*nelContext); + } + + QString GUIEditorPlugin::name() const + { + return tr("GUIEditor"); + } + + QString GUIEditorPlugin::version() const + { + return "0.0.1"; + } + + QString GUIEditorPlugin::vendor() const + { + return "Ryzom Core"; + } + + QString GUIEditorPlugin::description() const + { + return "GUI Editor ovqt plugin."; + } + + QStringList GUIEditorPlugin::dependencies() const + { + QStringList list; + list.append(Core::Constants::OVQT_CORE_PLUGIN); + return list; + } + + void GUIEditorPlugin::addAutoReleasedObject(QObject *obj) + { + m_plugMan->addObject(obj); + m_autoReleaseObjects.prepend(obj); + } + +} + +Q_EXPORT_PLUGIN(GUIEditor::GUIEditorPlugin) \ No newline at end of file diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/gui_editor_plugin.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/gui_editor_plugin.h new file mode 100644 index 000000000..20ec0a96e --- /dev/null +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/gui_editor_plugin.h @@ -0,0 +1,79 @@ +// Object Viewer Qt GUI Editor plugin +// Copyright (C) 2010 Winch Gate Property Limited +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + +#ifndef GUI_EDITOR_PLUGIN_H +#define GUI_EDITOR_PLUGIN_H + +#include "gui_editor_constants.h" +#include "../../extension_system/iplugin.h" +#include "../core/icontext.h" + +#include "nel/misc/app_context.h" + +#include +#include + +namespace NLMISC +{ + class CLibraryContext; +} + +namespace ExtensionSystem +{ + class IPluginSpec; +} + +namespace GUIEditor +{ + class GUIEditorWindow; + + class GUIEditorPlugin : public QObject, public ExtensionSystem::IPlugin + { + Q_OBJECT + Q_INTERFACES(ExtensionSystem::IPlugin) + public: + virtual ~GUIEditorPlugin(); + + bool initialize(ExtensionSystem::IPluginManager *pluginManager, QString *errorString); + + void extensionsInitialized(); + + void shutdown(); + + void setNelContext(NLMISC::INelContext *nelContext); + + QString name() const; + + QString version() const; + + QString vendor() const; + + QString description() const; + + QStringList dependencies() const; + + void addAutoReleasedObject(QObject *obj); + + protected: + NLMISC::CLibraryContext *m_libContext; + + private: + ExtensionSystem::IPluginManager *m_plugMan; + QList m_autoReleaseObjects; + }; +} + +#endif diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/gui_editor_window.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/gui_editor_window.cpp new file mode 100644 index 000000000..bd0b97d14 --- /dev/null +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/gui_editor_window.cpp @@ -0,0 +1,86 @@ +// Object Viewer Qt GUI Editor plugin +// Copyright (C) 2010 Winch Gate Property Limited +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + +#include "gui_editor_window.h" +#include "gui_editor_constants.h" + +#include "../core/icore.h" +#include "../core/core_constants.h" + +#include + +#include +#include + +namespace GUIEditor +{ + QString _lastDir; + + GUIEditorWindow::GUIEditorWindow(QWidget *parent) : + QMainWindow(parent) + { + m_ui.setupUi(this); + m_undoStack = new QUndoStack(this); + createMenus(); + readSettings(); + } + + GUIEditorWindow::~GUIEditorWindow() + { + writeSettings(); + } + + QUndoStack *GUIEditorWindow::undoStack() const + { + return m_undoStack; + } + + void GUIEditorWindow::open() + { + QStringList fileNames = QFileDialog::getOpenFileNames(this, + tr("Open GUI XML files"), + _lastDir, + tr("All XML files (*.xml)")); + + setCursor(Qt::WaitCursor); + if(!fileNames.isEmpty()) + { + QStringList list = fileNames; + _lastDir = QFileInfo(list.front()).absolutePath(); + } + setCursor(Qt::ArrowCursor); + } + + void GUIEditorWindow::createMenus() + { + } + + void GUIEditorWindow::readSettings() + { + QSettings *settings = Core::ICore::instance()->settings(); + settings->beginGroup(Constants::GUI_EDITOR_SECTION); + settings->endGroup(); + } + + void GUIEditorWindow::writeSettings() + { + QSettings *settings = Core::ICore::instance()->settings(); + settings->beginGroup(Constants::GUI_EDITOR_SECTION); + settings->endGroup(); + settings->sync(); + } + +} diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/gui_editor_window.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/gui_editor_window.h new file mode 100644 index 000000000..943a21655 --- /dev/null +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/gui_editor_window.h @@ -0,0 +1,57 @@ +// Object Viewer Qt GUI Editor plugin +// Copyright (C) 2010 Winch Gate Property Limited +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + +#ifndef GUI_EDITOR_WINDOW_H +#define GUI_EDITOR_WINDOW_H + +#include "ui_gui_editor_window.h" + +#include + +namespace GUIEditor +{ + class GUIEditorWindow: public QMainWindow + { + Q_OBJECT +public: + GUIEditorWindow(QWidget *parent = 0); + + ~GUIEditorWindow(); + + QUndoStack *undoStack() const; + + Q_SIGNALS: + +public Q_SLOTS: + void open(); + +private Q_SLOTS: + +private: + void createMenus(); + + void readSettings(); + + void writeSettings(); + + QUndoStack *m_undoStack; + + Ui::GUIEditorWindow m_ui; + }; + +} + +#endif diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/gui_editor_window.ui b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/gui_editor_window.ui new file mode 100644 index 000000000..baf1f01f4 --- /dev/null +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/gui_editor_window.ui @@ -0,0 +1,36 @@ + + + GUIEditorWindow + + + + 0 + 0 + 800 + 600 + + + + MainWindow + + + + + + + + + + + toolBar + + + TopToolBarArea + + + false + + + + + diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/ovqt_plugin_gui_editor.xml b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/ovqt_plugin_gui_editor.xml new file mode 100644 index 000000000..9b4efca08 --- /dev/null +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/ovqt_plugin_gui_editor.xml @@ -0,0 +1,7 @@ + + ovqt_plugin_gui_editor + GUI Editor + 0.0.1 + Ryzom Core + GUI Editor plugin. + \ No newline at end of file