From a8f015a84bc0fa7d81e73f1aaf783f7e7241df7a Mon Sep 17 00:00:00 2001 From: dnk-88 Date: Sat, 18 Dec 2010 15:19:26 +0200 Subject: [PATCH] Changed: #1206 update plugin system. --- .../src/plugins/core/core_constants.h | 107 ++++++++++++++++++ .../src/plugins/example/plugin1.cpp | 13 ++- .../src/plugins/log/log_plugin.cpp | 13 +-- .../ovqt_sheet_builder/ovqt_sheet_builder.cpp | 12 ++ 4 files changed, 133 insertions(+), 12 deletions(-) create mode 100644 code/nel/tools/3d/object_viewer_qt/src/plugins/core/core_constants.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/core_constants.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/core/core_constants.h new file mode 100644 index 000000000..fe859a26b --- /dev/null +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/core/core_constants.h @@ -0,0 +1,107 @@ +/* + Object Viewer Qt + Copyright (C) 2010 Dzmitry Kamiahin + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +*/ + +#ifndef CORE_CONSTANTS_H +#define CORE_CONSTANTS_H + +namespace Core { +namespace Constants { + +const char * const OVQT_VERSION_LONG = "0.0.1"; +const char * const OVQT_VENDOR = "Dzmitry Kamiahin"; +const char * const OVQT_YEAR = "2010"; + +//mainwindow +const char * const MAIN_WINDOW = "ObjectViewerQt.MainWindow"; + +//menubar +const char * const MENU_BAR = "ObjectViewerQt.MenuBar"; + +//menus +const char * const M_FILE = "ObjectViewerQt.Menu.File"; +const char * const M_EDIT = "ObjectViewerQt.Menu.Edit"; +const char * const M_SCENE = "ObjectViewerQt.Menu.Scene"; +const char * const M_TOOLS = "ObjectViewerQt.Menu.Tools"; +const char * const M_WINDOW = "ObjectViewerQt.Menu.Window"; +const char * const M_HELP = "ObjectViewerQt.Menu.Help"; + +//actions +const char * const UNDO = "ObjectViewerQt.Undo"; +const char * const REDO = "ObjectViewerQt.Redo"; + +const char * const NEW = "ObjectViewerQt.New"; +const char * const OPEN = "ObjectViewerQt.Open"; +const char * const SAVE = "ObjectViewerQt.Save"; +const char * const SAVEAS = "ObjectViewerQt.SaveAs"; +const char * const SAVEALL = "ObjectViewerQt.SaveAll"; +const char * const EXIT = "ObjectViewerQt.Exit"; + +const char * const SETTINGS = "ObjectViewerQt.Settings"; +const char * const TOGGLE_FULLSCREEN = "ObjectViewerQt.ToggleFullScreen"; + +const char * const MINIMIZE_WINDOW = "ObjectViewerQt.MinimizeWindow"; +const char * const ZOOM_WINDOW = "ObjectViewerQt.ZoomWindow"; + +const char * const CLOSE = "ObjectViewerQt.Close"; +const char * const CLOSEALL = "ObjectViewerQt.CloseAll"; +const char * const CLOSEOTHERS = "ObjectViewerQt.CloseOthers"; +const char * const ABOUT = "ObjectViewerQt.About"; +const char * const ABOUT_PLUGINS = "ObjectViewerQt.AboutPlugins"; +const char * const ABOUT_QT = "ObjectViewerQt.AboutQt"; + +const char * const ICON_NEL = ":/images/nel.png"; +const char * const ICON_NEL_IDE = ":/images/nel_ide_load.png +const char * const ICON_OPENFILE = ":/images/open-file.png"; +const char * const ICON_GO_DOWN = ":/images/go-down.png +const char * const ICON_GO_UP = ":/images/go-up.png +const char * const ICON_LIST_ADD = ":/images/list-add.png +const char * const ICON_LIST_REMOVE = ":/images/list-remove.png +const char * const ICON_PLAY = ":/images/play.png +const char * const ICON_PAUSE = ":/images/pause.png +const char * const ICON_STOP = ":/images/stop.png +const char * const ICON_SEEK_BACKWARD = ":/images/seek-backward.png +const char * const ICON_SEEK_FORWARD = ":/images/seek-forward.png +const char * const ICON_SKIP_BACKWARD = ":/images/skip-backward.png +const char * const ICON_SKIP_FORWARD = ":/images/skip-forward.png +const char * const ICON_SETTINGS = ":/images/preferences.png +const char * const ICON_TIME = ":/images/time.png +const char * const ICON_ANIM = ":/images/anim.png +const char * const ICON_ANIMSET = ":/images/animset.png +const char * const ICON_DAY_NIGHT = ":/images/dqynight.png +const char * const ICON_MIXER = ":/images/mixer.png +const char * const ICON_PARTICLES = ":/images/pqrticles.png +const char * const ICON_SOUND = ":/images/sound.png +const char * const ICON_VEGETABLE = ":/images/veget.png +const char * const ICON_WATER = ":/images/water.png +const char * const ICON_WIND = ":/images/wind.png +const char * const ICON_BACKGROUNDCOLOR = ":/images/ico_bgcolor.png +const char * const ICON_FRAMEDELAY = ":/images/ico_framedelay.png +const char * const ICON_SKELSCALE = ":/images/ico_skelscale.png +const char * const ICON_CLEAR = ":/images/clear.png +const char * const ICON_INSERT = ":/images/insert.png +const char * const ICON_NEW = ":/images/new.png +const char * const ICON_REFRESH = ":/images/refresh.png +const char * const ICON_SAVE_AS = ":/images/save-as.png +const char * const ICON_SAVE = ":/images/save.png +const char * const ICON_INSERT_HORIZONTAL = ":/images/insert-horizontal.png + +} // namespace Constants +} // namespace Core + +#endif // CORE_CONSTANTS_H diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/example/plugin1.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/example/plugin1.cpp index 3abb29ca5..3c5c3864e 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/example/plugin1.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/example/plugin1.cpp @@ -25,7 +25,18 @@ bool MyPlugin::initialize(NLQT::IPluginManager *pluginManager, QString *errorStr str += plugSpec->name(); nlinfo(str.toStdString().c_str()); - + QMainWindow *wnd = qobject_cast(objectByName("CMainWindow")); + if (!wnd) + { + *errorString = tr("Not found QMainWindow Object Viewer Qt."); + return false; + } + QMenu *helpMenu = qobject_cast(objectByName("ovqt.Menu.Tools")); + if (!helpMenu) + { + *errorString = tr("Not found QMenu Help."); + return false; + } return true; } diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/log/log_plugin.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/log/log_plugin.cpp index d44124465..82f65a85a 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/log/log_plugin.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/log/log_plugin.cpp @@ -49,8 +49,8 @@ CLogPlugin::~CLogPlugin() { NLMISC::ErrorLog->removeDisplayer(_displayer); NLMISC::WarningLog->removeDisplayer(_displayer); - NLMISC::DebugLog->removeDisplayer(_displayer); - NLMISC::AssertLog->removeDisplayer(_displayer); + NLMISC::DebugLog->removeDisplayer(_displayer); + NLMISC::AssertLog->removeDisplayer(_displayer); NLMISC::InfoLog->removeDisplayer(_displayer); delete _displayer; } @@ -59,15 +59,6 @@ bool CLogPlugin::initialize(NLQT::IPluginManager *pluginManager, QString *errorS { Q_UNUSED(errorString); _plugMan = pluginManager; - QString str; - - QList listPlug = pluginManager->plugins(); - - Q_FOREACH (NLQT::IPluginSpec *plugSpec, listPlug) - str += plugSpec->name(); - - nlinfo(str.toStdString().c_str()); - return true; } diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/ovqt_sheet_builder/ovqt_sheet_builder.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/ovqt_sheet_builder/ovqt_sheet_builder.cpp index d557c6001..13ae954e6 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/ovqt_sheet_builder/ovqt_sheet_builder.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/ovqt_sheet_builder/ovqt_sheet_builder.cpp @@ -35,6 +35,18 @@ bool SheetBuilderPlugin::initialize(NLQT::IPluginManager *pluginManager, QString { Q_UNUSED(errorString); _plugMan = pluginManager; + QMainWindow *wnd = qobject_cast(objectByName("CMainWindow")); + if (!wnd) + { + *errorString = tr("Not found MainWindow Object Viewer Qt."); + return false; + } + QMenu *toolsMenu = qobject_cast(objectByName("ovqt.Menu.Tools")); + if (!toolsMenu) + { + *errorString = tr("Not found QMenu Tools."); + return false; + } return true; }