From 27dc707a0248ab96384727be78ce96759d85a1e1 Mon Sep 17 00:00:00 2001 From: dnk-88 Date: Mon, 26 Sep 2011 01:25:10 +0300 Subject: [PATCH] Changed: #1193 Updated core plugin. Added the plugin-spec file. --- .../src/plugins/core/core.cpp | 3 +- .../object_viewer_qt/src/plugins/core/core.h | 2 +- .../src/plugins/core/core_constants.h | 144 +++++++++--------- .../src/plugins/core/core_plugin.cpp | 29 +--- .../src/plugins/core/core_plugin.h | 6 - .../plugins/core/general_settings_page.cpp | 22 +-- .../object_viewer_qt/src/plugins/core/icore.h | 4 +- .../src/plugins/core/imenu_manager.h | 62 -------- .../src/plugins/core/main_window.cpp | 7 +- .../src/plugins/core/main_window.h | 3 +- .../src/plugins/core/menu_manager.cpp | 48 +++--- .../src/plugins/core/menu_manager.h | 40 +++-- .../src/plugins/core/ovqt_plugin_core.xml | 7 + .../src/plugins/core/plugin_view_dialog.ui | 2 +- .../src/plugins/core/qtwin.cpp | 6 +- .../core/search_paths_settings_page.cpp | 36 ++--- .../plugins/core/search_paths_settings_page.h | 10 +- .../core/search_paths_settings_page.ui | 4 +- .../src/plugins/core/settings_dialog.cpp | 78 +++++----- .../src/plugins/core/settings_dialog.h | 24 +-- .../src/plugins/core/settings_dialog.ui | 8 +- 21 files changed, 233 insertions(+), 312 deletions(-) delete mode 100644 code/nel/tools/3d/object_viewer_qt/src/plugins/core/imenu_manager.h create mode 100644 code/nel/tools/3d/object_viewer_qt/src/plugins/core/ovqt_plugin_core.xml diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/core.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/core/core.cpp index fa61b5700..b21d934c8 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/core.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/core/core.cpp @@ -17,7 +17,6 @@ // along with this program. If not, see . #include "core.h" -#include "imenu_manager.h" #include "context_manager.h" #include "main_window.h" #include "../../extension_system/iplugin_manager.h" @@ -50,7 +49,7 @@ bool CoreImpl::showOptionsDialog(const QString &group, return m_mainWindow->showOptionsDialog(group, page, parent); } -IMenuManager *CoreImpl::menuManager() const +MenuManager *CoreImpl::menuManager() const { return m_mainWindow->menuManager(); } diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/core.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/core/core.h index 2613a06a5..c62fac593 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/core.h +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/core/core.h @@ -37,7 +37,7 @@ public: const QString &page = QString(), QWidget *parent = 0); - virtual IMenuManager *menuManager() const; + virtual MenuManager *menuManager() const; virtual ContextManager *contextManager() const; virtual QSettings *settings() const; 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 index 65327ae38..d1b4e902d 100644 --- 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 @@ -23,97 +23,97 @@ namespace Core namespace Constants { -const char * const OVQT_VERSION_LONG = "0.1"; -const char * const OVQT_VENDOR = "Ryzom Core"; -const char * const OVQT_YEAR = "2010, 2011"; -const char * const OVQT_CORE_PLUGIN = "Core"; +const char *const OVQT_VERSION_LONG = "0.8"; +const char *const OVQT_VENDOR = "Ryzom Core"; +const char *const OVQT_YEAR = "2010, 2011"; +const char *const OVQT_CORE_PLUGIN = "Core"; //mainwindow -const char * const MAIN_WINDOW = "ObjectViewerQt.MainWindow"; +const char *const MAIN_WINDOW = "ObjectViewerQt.MainWindow"; //menubar -const char * const MENU_BAR = "ObjectViewerQt.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_VIEW = "ObjectViewerQt.Menu.View"; -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"; +const char *const M_FILE = "ObjectViewerQt.Menu.File"; +const char *const M_EDIT = "ObjectViewerQt.Menu.Edit"; +const char *const M_VIEW = "ObjectViewerQt.Menu.View"; +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"; -const char * const M_FILE_RECENTFILES = "ObjectViewerQt.Menu.File.RecentFiles"; -const char * const M_SHEET = "ObjectViewerQt.Menu.Sheet"; +const char *const M_FILE_RECENTFILES = "ObjectViewerQt.Menu.File.RecentFiles"; +const char *const M_SHEET = "ObjectViewerQt.Menu.Sheet"; //actions -const char * const NEW = "ObjectViewerQt.New"; -const char * const OPEN = "ObjectViewerQt.Open"; -const char * const SAVE = "ObjectViewerQt.Save"; -const char * const SAVE_AS = "ObjectViewerQt.SaveAs"; -const char * const SAVE_ALL = "ObjectViewerQt.SaveAll"; -const char * const EXIT = "ObjectViewerQt.Exit"; +const char *const NEW = "ObjectViewerQt.New"; +const char *const OPEN = "ObjectViewerQt.Open"; +const char *const SAVE = "ObjectViewerQt.Save"; +const char *const SAVE_AS = "ObjectViewerQt.SaveAs"; +const char *const SAVE_ALL = "ObjectViewerQt.SaveAll"; +const char *const EXIT = "ObjectViewerQt.Exit"; -const char * const UNDO = "ObjectViewerQt.Undo"; -const char * const REDO = "ObjectViewerQt.Redo"; -const char * const CUT = "ObjectViewerQt.Cut"; -const char * const COPY = "ObjectViewerQt.Copy"; -const char * const PASTE = "ObjectViewerQt.Paste"; -const char * const DEL = "ObjectViewerQt.Del"; -const char * const FIND = "ObjectViewerQt.Find"; -const char * const SELECT_ALL = "ObjectViewerQt.SelectAll"; -const char * const GOTO_POS = "ObjectViewerQt.Goto"; +const char *const UNDO = "ObjectViewerQt.Undo"; +const char *const REDO = "ObjectViewerQt.Redo"; +const char *const CUT = "ObjectViewerQt.Cut"; +const char *const COPY = "ObjectViewerQt.Copy"; +const char *const PASTE = "ObjectViewerQt.Paste"; +const char *const DEL = "ObjectViewerQt.Del"; +const char *const FIND = "ObjectViewerQt.Find"; +const char *const SELECT_ALL = "ObjectViewerQt.SelectAll"; +const char *const GOTO_POS = "ObjectViewerQt.Goto"; -const char * const SETTINGS = "ObjectViewerQt.Settings"; -const char * const TOGGLE_FULLSCREEN = "ObjectViewerQt.ToggleFullScreen"; +const char *const SETTINGS = "ObjectViewerQt.Settings"; +const char *const TOGGLE_FULLSCREEN = "ObjectViewerQt.ToggleFullScreen"; -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 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"; //settings -const char * const SETTINGS_CATEGORY_GENERAL = "general"; -const char * const SETTINGS_CATEGORY_GENERAL_ICON = ":/icons/ic_nel_generic_settings.png"; -const char * const SETTINGS_TR_CATEGORY_GENERAL = QT_TR_NOOP("General"); +const char *const SETTINGS_CATEGORY_GENERAL = "general"; +const char *const SETTINGS_CATEGORY_GENERAL_ICON = ":/icons/ic_nel_generic_settings.png"; +const char *const SETTINGS_TR_CATEGORY_GENERAL = QT_TR_NOOP("General"); -const char * const MAIN_WINDOW_SECTION = "MainWindow"; -const char * const MAIN_WINDOW_STATE = "WindowState"; -const char * const MAIN_WINDOW_GEOMETRY = "WindowGeometry"; -const char * const QT_STYLE = "QtStyle"; -const char * const QT_PALETTE = "QtPalette"; +const char *const MAIN_WINDOW_SECTION = "MainWindow"; +const char *const MAIN_WINDOW_STATE = "WindowState"; +const char *const MAIN_WINDOW_GEOMETRY = "WindowGeometry"; +const char *const QT_STYLE = "QtStyle"; +const char *const QT_PALETTE = "QtPalette"; -const char * const LANGUAGE = "Language"; -const char * const PLUGINS_PATH = "PluginPath"; -const char * const DATA_PATH_SECTION = "DataPath"; -const char * const SEARCH_PATHS = "SearchPaths"; -const char * const RECURSIVE_SEARCH_PATHS = "RecursiveSearchPathes"; -const char * const LEVELDESIGN_PATH = "LevelDesignPath"; -const char * const ASSETS_PATH = "AssetsPath"; -const char * const PRIMITIVES_PATH = "PrimitivesPath"; -const char * const LIGOCONFIG_FILE = "LigoConfigFile"; -const char * const REMAP_EXTENSIONS = "RemapExtensions"; +const char *const LANGUAGE = "Language"; +const char *const PLUGINS_PATH = "PluginPath"; +const char *const DATA_PATH_SECTION = "DataPath"; +const char *const SEARCH_PATHS = "SearchPaths"; +const char *const RECURSIVE_SEARCH_PATHS = "RecursiveSearchPathes"; +const char *const LEVELDESIGN_PATH = "LevelDesignPath"; +const char *const ASSETS_PATH = "AssetsPath"; +const char *const PRIMITIVES_PATH = "PrimitivesPath"; +const char *const LIGOCONFIG_FILE = "LigoConfigFile"; +const char *const REMAP_EXTENSIONS = "RemapExtensions"; -const char * const LOG_SECTION = "LogSettings"; -const char * const LOG_ERROR = "LogError"; -const char * const LOG_WARNING = "LogWarning"; -const char * const LOG_DEBUG = "LogDebug"; -const char * const LOG_ASSERT = "LogAssert"; -const char * const LOG_INFO = "LogInfo"; +const char *const LOG_SECTION = "LogSettings"; +const char *const LOG_ERROR = "LogError"; +const char *const LOG_WARNING = "LogWarning"; +const char *const LOG_DEBUG = "LogDebug"; +const char *const LOG_ASSERT = "LogAssert"; +const char *const LOG_INFO = "LogInfo"; //resources -const char * const ICON_NEL = ":/core/images/nel.png"; -const char * const ICON_SETTINGS = ":/core/images/preferences.png"; -const char * const ICON_PILL = ":/core/icons/ic_nel_pill.png"; -const char * const ICON_OPEN = ":/core/icons/ic_nel_open.png"; -const char * const ICON_NEW = ":/core/icons/ic_nel_new.png"; -const char * const ICON_SAVE = ":/core/icons/ic_nel_save.png"; -const char * const ICON_SAVE_AS = ":/core/icons/ic_nel_save_as.png"; -const char * const ICON_CRASH = ":/core/icons/ic_nel_crash.png"; -const char * const ICON_UNDO = ":/core/icons/ic_nel_undo.png"; -const char * const ICON_REDO = ":/core/icons/ic_nel_redo.png"; +const char *const ICON_NEL = ":/core/images/nel.png"; +const char *const ICON_SETTINGS = ":/core/images/preferences.png"; +const char *const ICON_PILL = ":/core/icons/ic_nel_pill.png"; +const char *const ICON_OPEN = ":/core/icons/ic_nel_open.png"; +const char *const ICON_NEW = ":/core/icons/ic_nel_new.png"; +const char *const ICON_SAVE = ":/core/icons/ic_nel_save.png"; +const char *const ICON_SAVE_AS = ":/core/icons/ic_nel_save_as.png"; +const char *const ICON_CRASH = ":/core/icons/ic_nel_crash.png"; +const char *const ICON_UNDO = ":/core/icons/ic_nel_undo.png"; +const char *const ICON_REDO = ":/core/icons/ic_nel_redo.png"; } // namespace Constants } // namespace Core diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/core_plugin.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/core/core_plugin.cpp index 8aef51f2a..55633feaf 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/core_plugin.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/core/core_plugin.cpp @@ -64,8 +64,8 @@ bool CorePlugin::initialize(ExtensionSystem::IPluginManager *pluginManager, QStr bool success = m_mainWindow->initialize(errorString); GeneralSettingsPage *generalSettings = new GeneralSettingsPage(this); - CSearchPathsSettingsPage *searchPathPage = new CSearchPathsSettingsPage(false, this); - CSearchPathsSettingsPage *recureseSearchPathPage = new CSearchPathsSettingsPage(true, this); + SearchPathsSettingsPage *searchPathPage = new SearchPathsSettingsPage(false, this); + SearchPathsSettingsPage *recureseSearchPathPage = new SearchPathsSettingsPage(true, this); generalSettings->applyGeneralSettings(); searchPathPage->applySearchPaths(); @@ -95,31 +95,6 @@ void CorePlugin::setNelContext(NLMISC::INelContext *nelContext) m_libContext = new NLMISC::CLibraryContext(*nelContext); } -QString CorePlugin::name() const -{ - return QLatin1String(Constants::OVQT_CORE_PLUGIN); -} - -QString CorePlugin::version() const -{ - return Constants::OVQT_VERSION_LONG; -} - -QString CorePlugin::vendor() const -{ - return Constants::OVQT_VENDOR; -} - -QString CorePlugin::description() const -{ - return "Core plugin."; -} - -QStringList CorePlugin::dependencies() const -{ - return QStringList(); -} - void CorePlugin::addAutoReleasedObject(QObject *obj) { m_plugMan->addObject(obj); diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/core_plugin.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/core/core_plugin.h index 5c95d22c9..5062227e3 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/core_plugin.h +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/core/core_plugin.h @@ -53,12 +53,6 @@ public: void setNelContext(NLMISC::INelContext *nelContext); - QString name() const; - QString version() const; - QString vendor() const; - QString description() const; - QStringList dependencies() const; - void addAutoReleasedObject(QObject *obj); ExtensionSystem::IPluginManager *pluginManager() const diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/general_settings_page.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/core/general_settings_page.cpp index 88bd3a298..b1ef3b659 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/general_settings_page.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/core/general_settings_page.cpp @@ -148,25 +148,25 @@ void GeneralSettingsPage::setLevelDesignPath() } } -void GeneralSettingsPage::setPrimitivesPath() -{ +void GeneralSettingsPage::setPrimitivesPath() +{ QString newPath = QFileDialog::getExistingDirectory(0, tr("Set the primitives path"), m_ui.primitivesPathLineEdit->text()); if (!newPath.isEmpty()) { m_ui.primitivesPathLineEdit->setText(newPath); - } -} - -void GeneralSettingsPage::setLigoConfigFile() -{ - QString newFile = QFileDialog::getOpenFileName(0, tr("Set the ligo config file"), - m_ui.ligoConfigFileLineEdit->text()); + } +} + +void GeneralSettingsPage::setLigoConfigFile() +{ + QString newFile = QFileDialog::getOpenFileName(0, tr("Set the ligo config file"), + m_ui.ligoConfigFileLineEdit->text()); if (!newFile.isEmpty()) { m_ui.ligoConfigFileLineEdit->setText(newFile); - } -} + } +} void GeneralSettingsPage::setAssetsPath() diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/icore.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/core/icore.h index 13b22bfa5..4f1ee474f 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/icore.h +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/core/icore.h @@ -35,7 +35,7 @@ class IPluginManager; namespace Core { -class IMenuManager; +class MenuManager; class ContextManager; class CORE_EXPORT ICore : public QObject @@ -52,7 +52,7 @@ public: const QString &page = QString(), QWidget *parent = 0) = 0; - virtual IMenuManager *menuManager() const = 0; + virtual MenuManager *menuManager() const = 0; virtual ContextManager *contextManager() const = 0; virtual QSettings *settings() const = 0; diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/imenu_manager.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/core/imenu_manager.h deleted file mode 100644 index be80dbbc4..000000000 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/imenu_manager.h +++ /dev/null @@ -1,62 +0,0 @@ -// Object Viewer Qt - MMORPG Framework -// Copyright (C) 2010 Winch Gate Property Limited -// Copyright (C) 2011 Dzmitry Kamiahin -// -// 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 IMENU_MANAGER_H -#define IMENU_MANAGER_H - -#include "core_global.h" - -#include -#include - -QT_BEGIN_NAMESPACE -class QMenu; -class QAction; -class QString; -class QMenuBar; -QT_END_NAMESPACE - -namespace Core -{ -/* -@interface IMenuManager -@brief The IMenuManager is an interface for providing a registration of menus and menu item. -@details The IMenuManager provides centralized access to menus and menu items. -All menus and menu items should be registered in the IMenuManager. -*/ -class CORE_EXPORT IMenuManager : public QObject -{ - Q_OBJECT -public: - IMenuManager(QObject *parent = 0): QObject(parent) {} - virtual ~IMenuManager() {} - - virtual void registerMenu(QMenu *menu, const QString &id) = 0; - virtual void registerAction(QAction *action, const QString &id) = 0; - - virtual QMenu *menu(const QString &id) const = 0; - virtual QAction *action(const QString &id) const = 0; - - virtual void unregisterMenu(const QString &id) = 0; - virtual void unregisterAction(const QString &id) = 0; - - virtual QMenuBar *menuBar() const = 0; -}; - -} // namespace Core - -#endif // IMENU_MANAGER_H diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/main_window.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/core/main_window.cpp index 2105b8b1b..f00075b21 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/main_window.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/core/main_window.cpp @@ -65,8 +65,7 @@ MainWindow::MainWindow(ExtensionSystem::IPluginManager *pluginManager, QWidget * setMenuBar(m_menuBar); #endif - m_menuManager = new MenuManager(this); - m_menuManager->setMenuBar(m_menuBar); + m_menuManager = new MenuManager(m_menuBar, this); m_tabWidget = new QTabWidget(this); m_tabWidget->setTabPosition(QTabWidget::South); @@ -114,7 +113,7 @@ void MainWindow::extensionsInitialized() show(); } -IMenuManager *MainWindow::menuManager() const +MenuManager *MainWindow::menuManager() const { return m_menuManager; } @@ -205,7 +204,7 @@ bool MainWindow::showOptionsDialog(const QString &group, { if (!parent) parent = this; - CSettingsDialog settingsDialog(m_pluginManager, group, page, parent); + SettingsDialog settingsDialog(m_pluginManager, group, page, parent); settingsDialog.show(); bool ok = settingsDialog.execDialog(); if (ok) diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/main_window.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/core/main_window.h index 48ce93a15..ae0d0522c 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/main_window.h +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/core/main_window.h @@ -34,7 +34,6 @@ namespace Core class CSettingsDialog; class CorePlugin; class IContext; -class IMenuManager; class MenuManager; class ContextManager; class CoreImpl; @@ -50,7 +49,7 @@ public: bool initialize(QString *errorString); void extensionsInitialized(); - IMenuManager *menuManager() const; + MenuManager *menuManager() const; ContextManager *contextManager() const; QSettings *settings() const; diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/menu_manager.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/core/menu_manager.cpp index 4bd80a616..76a4d7d91 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/menu_manager.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/core/menu_manager.cpp @@ -21,74 +21,76 @@ // NeL includes #include -// Qt includes -#include -#include -#include - namespace Core { -MenuManager::MenuManager(QObject *parent) - : IMenuManager(parent), - _menuBar(0) +struct MenuManagerPrivate { + MenuManagerPrivate(): m_menuBar(0) {} + QMenuBar *m_menuBar; + typedef QHash IdMenuMap; + IdMenuMap m_menuMap; + typedef QHash IdActionMap; + IdActionMap m_actionMap; +}; + +MenuManager::MenuManager(QMenuBar *menuBar, QObject *parent) + : QObject(parent), + d(new MenuManagerPrivate()) +{ + d->m_menuBar = menuBar; } MenuManager::~MenuManager() { - _menuMap.clear(); + d->m_menuMap.clear(); + delete d; } void MenuManager::registerMenu(QMenu *menu, const QString &id) { menu->setObjectName(id); - _menuMap.insert(id, menu); + d->m_menuMap.insert(id, menu); } void MenuManager::registerAction(QAction *action, const QString &id) { action->setObjectName(id); - _actionMap.insert(id, action); + d->m_actionMap.insert(id, action); } QMenu *MenuManager::menu(const QString &id) const { QMenu *result = 0; - if (!_menuMap.contains(id)) + if (!d->m_menuMap.contains(id)) nlwarning("QMenu %s not found", id.toStdString().c_str()); else - result = _menuMap.value(id); + result = d->m_menuMap.value(id); return result; } QAction *MenuManager::action(const QString &id) const { QAction *result = 0; - if (!_actionMap.contains(id)) + if (!d->m_actionMap.contains(id)) nlwarning("QAction %s not found", id.toStdString().c_str()); else - result = _actionMap.value(id); + result = d->m_actionMap.value(id); return result; } void MenuManager::unregisterMenu(const QString &id) { - _menuMap.remove(id); + d->m_menuMap.remove(id); } void MenuManager::unregisterAction(const QString &id) { - _actionMap.remove(id); + d->m_actionMap.remove(id); } QMenuBar *MenuManager::menuBar() const { - return _menuBar; -} - -void MenuManager::setMenuBar(QMenuBar *menuBar) -{ - _menuBar = menuBar; + return d->m_menuBar; } } /* namespace Core */ \ No newline at end of file diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/menu_manager.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/core/menu_manager.h index aab603355..3a5e2c710 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/menu_manager.h +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/core/menu_manager.h @@ -19,39 +19,47 @@ #define MENU_MANAGER_H // Project includes -#include "imenu_manager.h" +#include "core_global.h" // Qt includes #include +#include +#include +#include +#include +#include namespace Core { +struct MenuManagerPrivate; -class MenuManager : public IMenuManager +/* +@interface MenuManager +@brief The MenuManager provide the interface for registration of menus and menu item. +@details The MenuManager provides centralized access to menus and menu items. +All menus and menu items should be registered in the MenuManager. +*/ +class CORE_EXPORT MenuManager: public QObject { Q_OBJECT public: - MenuManager(QObject *parent = 0); + explicit MenuManager(QMenuBar *menuBar, QObject *parent = 0); virtual ~MenuManager(); - virtual void registerMenu(QMenu *menu, const QString &id); - virtual void registerAction(QAction *action, const QString &id); + void registerMenu(QMenu *menu, const QString &id); + void registerAction(QAction *action, const QString &id); - virtual QMenu *menu(const QString &id) const; - virtual QAction *action(const QString &id) const; + QMenu *menu(const QString &id) const; + QAction *action(const QString &id) const; - virtual void unregisterMenu(const QString &id); - virtual void unregisterAction(const QString &id); + void unregisterMenu(const QString &id); + void unregisterAction(const QString &id); - virtual QMenuBar *menuBar() const; - void setMenuBar(QMenuBar *menuBar); + QMenuBar *menuBar() const; private: - QMenuBar *_menuBar; - typedef QHash IdMenuMap; - IdMenuMap _menuMap; - typedef QHash IdActionMap; - IdActionMap _actionMap; + + MenuManagerPrivate *d; }; } // namespace Core diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/ovqt_plugin_core.xml b/code/nel/tools/3d/object_viewer_qt/src/plugins/core/ovqt_plugin_core.xml new file mode 100644 index 000000000..c0d38aa75 --- /dev/null +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/core/ovqt_plugin_core.xml @@ -0,0 +1,7 @@ + + ovqt_plugin_core + Core + 0.8 + Ryzom Core + Core plugin. + \ No newline at end of file diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/plugin_view_dialog.ui b/code/nel/tools/3d/object_viewer_qt/src/plugins/core/plugin_view_dialog.ui index 60a9b9c46..9d7d395be 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/plugin_view_dialog.ui +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/core/plugin_view_dialog.ui @@ -112,7 +112,7 @@ - + diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/qtwin.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/core/qtwin.cpp index dc0fb6cf0..2ebb69134 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/qtwin.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/core/qtwin.cpp @@ -40,9 +40,9 @@ typedef struct _MARGINS int cyBottomHeight; } MARGINS, *PMARGINS; -typedef HRESULT (WINAPI *PtrDwmIsCompositionEnabled)(BOOL* pfEnabled); -typedef HRESULT (WINAPI *PtrDwmExtendFrameIntoClientArea)(HWND hWnd, const MARGINS* pMarInset); -typedef HRESULT (WINAPI *PtrDwmEnableBlurBehindWindow)(HWND hWnd, const DWM_BLURBEHIND* pBlurBehind); +typedef HRESULT (WINAPI *PtrDwmIsCompositionEnabled)(BOOL *pfEnabled); +typedef HRESULT (WINAPI *PtrDwmExtendFrameIntoClientArea)(HWND hWnd, const MARGINS *pMarInset); +typedef HRESULT (WINAPI *PtrDwmEnableBlurBehindWindow)(HWND hWnd, const DWM_BLURBEHIND *pBlurBehind); typedef HRESULT (WINAPI *PtrDwmGetColorizationColor)(DWORD *pcrColorization, BOOL *pfOpaqueBlend); static PtrDwmIsCompositionEnabled pDwmIsCompositionEnabled= 0; diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/search_paths_settings_page.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/core/search_paths_settings_page.cpp index 355a9c0e3..7fca0f252 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/search_paths_settings_page.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/core/search_paths_settings_page.cpp @@ -33,18 +33,18 @@ namespace Core QString lastDir = "."; -CSearchPathsSettingsPage::CSearchPathsSettingsPage(bool recurse, QObject *parent) +SearchPathsSettingsPage::SearchPathsSettingsPage(bool recurse, QObject *parent) : IOptionsPage(parent), m_recurse(recurse), m_page(0) { } -CSearchPathsSettingsPage::~CSearchPathsSettingsPage() +SearchPathsSettingsPage::~SearchPathsSettingsPage() { } -QString CSearchPathsSettingsPage::id() const +QString SearchPathsSettingsPage::id() const { if (m_recurse) return QLatin1String("search_recurse_paths"); @@ -52,7 +52,7 @@ QString CSearchPathsSettingsPage::id() const return QLatin1String("search_paths"); } -QString CSearchPathsSettingsPage::trName() const +QString SearchPathsSettingsPage::trName() const { if (m_recurse) return tr("Search Recurse Paths"); @@ -60,22 +60,22 @@ QString CSearchPathsSettingsPage::trName() const return tr("Search Paths"); } -QString CSearchPathsSettingsPage::category() const +QString SearchPathsSettingsPage::category() const { return QLatin1String(Constants::SETTINGS_CATEGORY_GENERAL); } -QString CSearchPathsSettingsPage::trCategory() const +QString SearchPathsSettingsPage::trCategory() const { return tr(Constants::SETTINGS_TR_CATEGORY_GENERAL); } -QIcon CSearchPathsSettingsPage::categoryIcon() const +QIcon SearchPathsSettingsPage::categoryIcon() const { return QIcon(); } -QWidget *CSearchPathsSettingsPage::createPage(QWidget *parent) +QWidget *SearchPathsSettingsPage::createPage(QWidget *parent) { m_page = new QWidget(parent); m_ui.setupUi(m_page); @@ -90,19 +90,19 @@ QWidget *CSearchPathsSettingsPage::createPage(QWidget *parent) return m_page; } -void CSearchPathsSettingsPage::apply() +void SearchPathsSettingsPage::apply() { writeSettings(); applySearchPaths(); } -void CSearchPathsSettingsPage::finish() +void SearchPathsSettingsPage::finish() { delete m_page; m_page = 0; } -void CSearchPathsSettingsPage::applySearchPaths() +void SearchPathsSettingsPage::applySearchPaths() { QStringList paths, remapExt; QSettings *settings = Core::ICore::instance()->settings(); @@ -124,7 +124,7 @@ void CSearchPathsSettingsPage::applySearchPaths() } } -void CSearchPathsSettingsPage::addPath() +void SearchPathsSettingsPage::addPath() { QString newPath = QFileDialog::getExistingDirectory(m_page, "", lastDir); if (!newPath.isEmpty()) @@ -139,7 +139,7 @@ void CSearchPathsSettingsPage::addPath() checkEnabledButton(); } -void CSearchPathsSettingsPage::delPath() +void SearchPathsSettingsPage::delPath() { QListWidgetItem *removeItem = m_ui.pathsListWidget->takeItem(m_ui.pathsListWidget->currentRow()); if (!removeItem) @@ -148,7 +148,7 @@ void CSearchPathsSettingsPage::delPath() checkEnabledButton(); } -void CSearchPathsSettingsPage::upPath() +void SearchPathsSettingsPage::upPath() { int currentRow = m_ui.pathsListWidget->currentRow(); if (!(currentRow == 0)) @@ -159,7 +159,7 @@ void CSearchPathsSettingsPage::upPath() } } -void CSearchPathsSettingsPage::downPath() +void SearchPathsSettingsPage::downPath() { int currentRow = m_ui.pathsListWidget->currentRow(); if (!(currentRow == m_ui.pathsListWidget->count()-1)) @@ -170,7 +170,7 @@ void CSearchPathsSettingsPage::downPath() } } -void CSearchPathsSettingsPage::readSettings() +void SearchPathsSettingsPage::readSettings() { QStringList paths; QSettings *settings = Core::ICore::instance()->settings(); @@ -189,7 +189,7 @@ void CSearchPathsSettingsPage::readSettings() } } -void CSearchPathsSettingsPage::writeSettings() +void SearchPathsSettingsPage::writeSettings() { QStringList paths; for (int i = 0; i < m_ui.pathsListWidget->count(); ++i) @@ -205,7 +205,7 @@ void CSearchPathsSettingsPage::writeSettings() settings->sync(); } -void CSearchPathsSettingsPage::checkEnabledButton() +void SearchPathsSettingsPage::checkEnabledButton() { bool bEnabled = true; if (m_ui.pathsListWidget->count() == 0) diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/search_paths_settings_page.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/core/search_paths_settings_page.h index c7d4c9734..c45b29571 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/search_paths_settings_page.h +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/core/search_paths_settings_page.h @@ -30,15 +30,15 @@ class QWidget; namespace Core { /** -@class CSearchPathsSettingsPage +@class SearchPathsSettingsPage */ -class CSearchPathsSettingsPage : public Core::IOptionsPage +class SearchPathsSettingsPage : public Core::IOptionsPage { Q_OBJECT public: - explicit CSearchPathsSettingsPage(bool recurse, QObject *parent = 0); - ~CSearchPathsSettingsPage(); + explicit SearchPathsSettingsPage(bool recurse, QObject *parent = 0); + ~SearchPathsSettingsPage(); QString id() const; QString trName() const; @@ -66,7 +66,7 @@ private: bool m_recurse; QWidget *m_page; - Ui::CSearchPathsSettingsPage m_ui; + Ui::SearchPathsSettingsPage m_ui; }; } // namespace Core diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/search_paths_settings_page.ui b/code/nel/tools/3d/object_viewer_qt/src/plugins/core/search_paths_settings_page.ui index 79a6b2141..cf47314b8 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/search_paths_settings_page.ui +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/core/search_paths_settings_page.ui @@ -1,7 +1,7 @@ - CSearchPathsSettingsPage - + SearchPathsSettingsPage + 0 diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/settings_dialog.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/core/settings_dialog.cpp index 30fd7835e..960644599 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/settings_dialog.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/core/settings_dialog.cpp @@ -35,33 +35,33 @@ Q_DECLARE_METATYPE(PageData); namespace Core { -CSettingsDialog::CSettingsDialog(ExtensionSystem::IPluginManager *pluginManager, - const QString &categoryId, - const QString &pageId, - QWidget *parent) +SettingsDialog::SettingsDialog(ExtensionSystem::IPluginManager *pluginManager, + const QString &categoryId, + const QString &pageId, + QWidget *parent) : QDialog(parent), - _applied(false) + m_applied(false) { - _ui.setupUi(this); + m_ui.setupUi(this); - _plugMan = pluginManager; + m_plugMan = pluginManager; QString initialCategory = categoryId; QString initialPage = pageId; - _ui.buttonBox->button(QDialogButtonBox::Ok)->setDefault(true); + m_ui.buttonBox->button(QDialogButtonBox::Ok)->setDefault(true); - connect(_ui.buttonBox->button(QDialogButtonBox::Apply), SIGNAL(clicked()), this, SLOT(apply())); + connect(m_ui.buttonBox->button(QDialogButtonBox::Apply), SIGNAL(clicked()), this, SLOT(apply())); - _ui.splitter->setCollapsible(1, false); - _ui.pageTree->header()->setVisible(false); + m_ui.splitter->setCollapsible(1, false); + m_ui.pageTree->header()->setVisible(false); - connect(_ui.pageTree, SIGNAL(currentItemChanged(QTreeWidgetItem *, QTreeWidgetItem *)), + connect(m_ui.pageTree, SIGNAL(currentItemChanged(QTreeWidgetItem *, QTreeWidgetItem *)), this, SLOT(pageSelected())); QMap categories; - QList pages = _plugMan->getObjects(); + QList pages = m_plugMan->getObjects(); int index = 0; Q_FOREACH(IOptionsPage *page, pages) @@ -82,7 +82,7 @@ CSettingsDialog::CSettingsDialog(ExtensionSystem::IPluginManager *pluginManager, QTreeWidgetItem *treeitem; if (!categories.contains(currentCategory)) { - treeitem = new QTreeWidgetItem(_ui.pageTree); + treeitem = new QTreeWidgetItem(m_ui.pageTree); treeitem->setText(0, trCategories.at(0)); treeitem->setData(0, Qt::UserRole, qVariantFromValue(pageData)); categories.insert(currentCategory, treeitem); @@ -108,13 +108,13 @@ CSettingsDialog::CSettingsDialog(ExtensionSystem::IPluginManager *pluginManager, categories.value(currentCategory)->addChild(item); - _pages.append(page); - _ui.stackedPages->addWidget(page->createPage(_ui.stackedPages)); + m_pages.append(page); + m_ui.stackedPages->addWidget(page->createPage(m_ui.stackedPages)); if (page->id() == initialPage && currentCategory == initialCategory) { - _ui.stackedPages->setCurrentIndex(_ui.stackedPages->count()); - _ui.pageTree->setCurrentItem(item); + m_ui.stackedPages->setCurrentIndex(m_ui.stackedPages->count()); + m_ui.pageTree->setCurrentItem(item); } index++; @@ -122,30 +122,30 @@ CSettingsDialog::CSettingsDialog(ExtensionSystem::IPluginManager *pluginManager, QList sizes; sizes << 150 << 300; - _ui.splitter->setSizes(sizes); + m_ui.splitter->setSizes(sizes); - _ui.splitter->setStretchFactor(_ui.splitter->indexOf(_ui.pageTree), 0); - _ui.splitter->setStretchFactor(_ui.splitter->indexOf(_ui.layoutWidget), 1); + m_ui.splitter->setStretchFactor(m_ui.splitter->indexOf(m_ui.pageTree), 0); + m_ui.splitter->setStretchFactor(m_ui.splitter->indexOf(m_ui.layoutWidget), 1); } -CSettingsDialog::~CSettingsDialog() +SettingsDialog::~SettingsDialog() { } -void CSettingsDialog::pageSelected() +void SettingsDialog::pageSelected() { - QTreeWidgetItem *item = _ui.pageTree->currentItem(); + QTreeWidgetItem *item = m_ui.pageTree->currentItem(); PageData data = item->data(0, Qt::UserRole).value(); int index = data.index; - _currentCategory = data.category; - _currentPage = data.id; - _ui.stackedPages->setCurrentIndex(index); + m_currentCategory = data.category; + m_currentPage = data.id; + m_ui.stackedPages->setCurrentIndex(index); } -void CSettingsDialog::accept() +void SettingsDialog::accept() { - _applied = true; - Q_FOREACH(IOptionsPage *page, _pages) + m_applied = true; + Q_FOREACH(IOptionsPage *page, m_pages) { page->apply(); page->finish(); @@ -153,28 +153,28 @@ void CSettingsDialog::accept() done(QDialog::Accepted); } -void CSettingsDialog::reject() +void SettingsDialog::reject() { - Q_FOREACH(IOptionsPage *page, _pages) + Q_FOREACH(IOptionsPage *page, m_pages) page->finish(); done(QDialog::Rejected); } -void CSettingsDialog::apply() +void SettingsDialog::apply() { - Q_FOREACH(IOptionsPage *page, _pages) + Q_FOREACH(IOptionsPage *page, m_pages) page->apply(); - _applied = true; + m_applied = true; } -bool CSettingsDialog::execDialog() +bool SettingsDialog::execDialog() { - _applied = false; + m_applied = false; exec(); - return _applied; + return m_applied; } -void CSettingsDialog::done(int val) +void SettingsDialog::done(int val) { QDialog::done(val); } diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/settings_dialog.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/core/settings_dialog.h index 07adc7fee..9e1c86444 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/settings_dialog.h +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/core/settings_dialog.h @@ -35,17 +35,17 @@ class IOptionsPage; @class CSettingsDialog @brief Settings dialog */ -class CSettingsDialog: public QDialog +class SettingsDialog: public QDialog { Q_OBJECT public: - CSettingsDialog(ExtensionSystem::IPluginManager *pluginManager, - const QString &initialCategory = QString(), - const QString &initialPage = QString(), - QWidget *parent = 0); + SettingsDialog(ExtensionSystem::IPluginManager *pluginManager, + const QString &initialCategory = QString(), + const QString &initialPage = QString(), + QWidget *parent = 0); - ~CSettingsDialog(); + ~SettingsDialog(); /// Run the dialog and return true if 'Ok' was choosen or 'Apply' was invoked at least once bool execDialog(); @@ -60,14 +60,14 @@ private Q_SLOTS: void apply(); private: - QList _pages; - bool _applied; - QString _currentCategory; - QString _currentPage; + QList m_pages; + bool m_applied; + QString m_currentCategory; + QString m_currentPage; - ExtensionSystem::IPluginManager *_plugMan; + ExtensionSystem::IPluginManager *m_plugMan; - Ui::CSettingsDialog _ui; + Ui::SettingsDialog m_ui; }; /* class CSettingsDialog */ } /* namespace Core */ diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/settings_dialog.ui b/code/nel/tools/3d/object_viewer_qt/src/plugins/core/settings_dialog.ui index e536f0dc2..8e9780c9a 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/settings_dialog.ui +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/core/settings_dialog.ui @@ -1,7 +1,7 @@ - CSettingsDialog - + SettingsDialog + 0 @@ -93,7 +93,7 @@ buttonBox accepted() - CSettingsDialog + SettingsDialog accept() @@ -109,7 +109,7 @@ buttonBox rejected() - CSettingsDialog + SettingsDialog reject()