mirror of
https://port.numenaute.org/aleajactaest/khanat-code-old.git
synced 2024-12-26 18:40:54 +00:00
Changed: #1206 Update plugin system. Added experimental core plugin. Added new settings dialog.
This commit is contained in:
parent
26dde15438
commit
e67a0c5e87
45 changed files with 1808 additions and 296 deletions
|
@ -22,8 +22,7 @@ SET(OBJECT_VIEWER_HDR main_window.h graphics_viewport.h animation_dialog.h
|
||||||
vegetable_dialog.h global_wind_dialog.h day_night_dialog.h sun_color_dialog.h
|
vegetable_dialog.h global_wind_dialog.h day_night_dialog.h sun_color_dialog.h
|
||||||
vegetable_noise_value_widget.h vegetable_density_page.h vegetable_landscape_page.h
|
vegetable_noise_value_widget.h vegetable_density_page.h vegetable_landscape_page.h
|
||||||
vegetable_scale_page.h vegetable_appearance_page.h vegetable_rotate_page.h
|
vegetable_scale_page.h vegetable_appearance_page.h vegetable_rotate_page.h
|
||||||
extension_system/iplugin_manager.h extension_system/plugin_manager.h
|
extension_system/iplugin_manager.h extension_system/plugin_manager.h)
|
||||||
extension_system/plugin_view.h)
|
|
||||||
|
|
||||||
SET(OBJECT_VIEWER_UIS animation_form.ui animation_set_form.ui settings_form.ui
|
SET(OBJECT_VIEWER_UIS animation_form.ui animation_set_form.ui settings_form.ui
|
||||||
setup_fog_form.ui slot_form.ui particle_control_form.ui particle_workspace_form.ui
|
setup_fog_form.ui slot_form.ui particle_control_form.ui particle_workspace_form.ui
|
||||||
|
@ -36,8 +35,7 @@ SET(OBJECT_VIEWER_UIS animation_form.ui animation_set_form.ui settings_form.ui
|
||||||
particle_link_skeleton_form.ui water_pool_form.ui vegetable_dialog_form.ui
|
particle_link_skeleton_form.ui water_pool_form.ui vegetable_dialog_form.ui
|
||||||
vegetable_noise_value_form.ui global_wind_form.ui sun_color_form.ui day_night_form.ui
|
vegetable_noise_value_form.ui global_wind_form.ui sun_color_form.ui day_night_form.ui
|
||||||
vegetable_density_form.ui vegetable_apperance_form.ui vegetable_landscape_form.ui
|
vegetable_density_form.ui vegetable_apperance_form.ui vegetable_landscape_form.ui
|
||||||
vegetable_rotate_form.ui vegetable_scale_form.ui
|
vegetable_rotate_form.ui vegetable_scale_form.ui)
|
||||||
extension_system/plugin_view.ui)
|
|
||||||
|
|
||||||
SET(OBJECT_VIEWER_RCS object_viewer_qt.qrc)
|
SET(OBJECT_VIEWER_RCS object_viewer_qt.qrc)
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@ namespace NLMISC
|
||||||
class INelContext;
|
class INelContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace NLQT
|
namespace ExtensionSystem
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -56,10 +56,11 @@ public:
|
||||||
virtual QString version() const = 0;
|
virtual QString version() const = 0;
|
||||||
virtual QString vendor() const = 0;
|
virtual QString vendor() const = 0;
|
||||||
virtual QString description() const = 0;
|
virtual QString description() const = 0;
|
||||||
|
virtual QList<QString> dependencies() const = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
}; //namespace NLQT
|
}; //namespace ExtensionSystem
|
||||||
|
|
||||||
Q_DECLARE_INTERFACE(NLQT::IPlugin, "com.ryzom.dev.ObjectViewerQt.IPlugin/0.9")
|
Q_DECLARE_INTERFACE(ExtensionSystem::IPlugin, "dev.ryzom.com.ObjectViewerQt.IPlugin/0.9.1")
|
||||||
|
|
||||||
#endif // IPLUGIN_H
|
#endif // IPLUGIN_H
|
||||||
|
|
|
@ -24,11 +24,10 @@
|
||||||
#include <QtCore/QObject>
|
#include <QtCore/QObject>
|
||||||
#include <QtCore/QStringList>
|
#include <QtCore/QStringList>
|
||||||
|
|
||||||
namespace NLQT
|
namespace ExtensionSystem
|
||||||
{
|
{
|
||||||
class IPluginSpec;
|
class IPluginSpec;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@interface IPluginManager
|
@interface IPluginManager
|
||||||
@brief Interface for plugin system that manages the plugins, their life cycle and their registered objects.
|
@brief Interface for plugin system that manages the plugins, their life cycle and their registered objects.
|
||||||
|
@ -52,7 +51,7 @@ public:
|
||||||
virtual void loadPlugins() = 0;
|
virtual void loadPlugins() = 0;
|
||||||
virtual QStringList getPluginPaths() const = 0;
|
virtual QStringList getPluginPaths() const = 0;
|
||||||
virtual void setPluginPaths(const QStringList &paths) = 0;
|
virtual void setPluginPaths(const QStringList &paths) = 0;
|
||||||
virtual QList<NLQT::IPluginSpec *> plugins() const = 0;
|
virtual QList<ExtensionSystem::IPluginSpec *> plugins() const = 0;
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void objectAdded(QObject *obj);
|
void objectAdded(QObject *obj);
|
||||||
|
@ -61,6 +60,6 @@ Q_SIGNALS:
|
||||||
void pluginsChanged();
|
void pluginsChanged();
|
||||||
};
|
};
|
||||||
|
|
||||||
}; // namespace NLQT
|
}; // namespace ExtensionSystem
|
||||||
|
|
||||||
#endif // IPLUGINMANAGER_H
|
#endif // IPLUGINMANAGER_H
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
#include <QtCore/QString>
|
#include <QtCore/QString>
|
||||||
|
|
||||||
namespace NLQT
|
namespace ExtensionSystem
|
||||||
{
|
{
|
||||||
class IPlugin;
|
class IPlugin;
|
||||||
class IPluginManager;
|
class IPluginManager;
|
||||||
|
@ -76,7 +76,7 @@ public:
|
||||||
virtual QString errorString() const = 0;
|
virtual QString errorString() const = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace NLQT
|
} // namespace ExtensionSystem
|
||||||
|
|
||||||
#endif // IPLUGINSPEC_H
|
#endif // IPLUGINSPEC_H
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
|
|
||||||
#include "plugin_spec.h"
|
#include "plugin_spec.h"
|
||||||
|
|
||||||
namespace NLQT
|
namespace ExtensionSystem
|
||||||
{
|
{
|
||||||
|
|
||||||
CPluginManager::CPluginManager(QObject *parent):
|
CPluginManager::CPluginManager(QObject *parent):
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
// Project include
|
// Project include
|
||||||
#include "iplugin_manager.h"
|
#include "iplugin_manager.h"
|
||||||
|
|
||||||
namespace NLQT
|
namespace ExtensionSystem
|
||||||
{
|
{
|
||||||
|
|
||||||
class IPlugin;
|
class IPlugin;
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
#include "iplugin.h"
|
#include "iplugin.h"
|
||||||
#include "iplugin_manager.h"
|
#include "iplugin_manager.h"
|
||||||
|
|
||||||
namespace NLQT
|
namespace ExtensionSystem
|
||||||
{
|
{
|
||||||
|
|
||||||
CPluginSpec::CPluginSpec():
|
CPluginSpec::CPluginSpec():
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
#include "iplugin_spec.h"
|
#include "iplugin_spec.h"
|
||||||
|
|
||||||
namespace NLQT
|
namespace ExtensionSystem
|
||||||
{
|
{
|
||||||
|
|
||||||
class CPluginSpec: public IPluginSpec
|
class CPluginSpec: public IPluginSpec
|
||||||
|
|
|
@ -1,59 +0,0 @@
|
||||||
/*
|
|
||||||
Object Viewer Qt
|
|
||||||
Copyright (C) 2010 Dzmitry Kamiahin <dnk-88@tut.by>
|
|
||||||
|
|
||||||
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 <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef PLUGIN_VIEW_H
|
|
||||||
#define PLUGIN_VIEW_H
|
|
||||||
|
|
||||||
#include "ui_plugin_view.h"
|
|
||||||
|
|
||||||
|
|
||||||
// STL includes
|
|
||||||
|
|
||||||
// Qt includes
|
|
||||||
|
|
||||||
// NeL includes
|
|
||||||
|
|
||||||
// Project includes
|
|
||||||
|
|
||||||
|
|
||||||
namespace NLQT
|
|
||||||
{
|
|
||||||
|
|
||||||
class IPluginManager;
|
|
||||||
|
|
||||||
class CPluginView: public QDialog
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
CPluginView(IPluginManager *pluginManager, QWidget *parent = 0);
|
|
||||||
~CPluginView();
|
|
||||||
|
|
||||||
private Q_SLOTS:
|
|
||||||
void updateList();
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
IPluginManager *_pluginManager;
|
|
||||||
Ui::CPluginView _ui;
|
|
||||||
}; /* class CPluginView */
|
|
||||||
|
|
||||||
} /* namespace NLQT */
|
|
||||||
|
|
||||||
#endif // PLUGIN_VIEW_H
|
|
|
@ -1,75 +0,0 @@
|
||||||
/*
|
|
||||||
Object Viewer Qt
|
|
||||||
Copyright (C) 2010 Dzmitry Kamiahin <dnk-88@tut.by>
|
|
||||||
|
|
||||||
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 <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "plugin_view.h"
|
|
||||||
|
|
||||||
// Qt includes
|
|
||||||
#include <QtCore/QDir>
|
|
||||||
#include <QtCore/QString>
|
|
||||||
#include <QtCore/QStringList>
|
|
||||||
#include <QtGui/QIcon>
|
|
||||||
#include <QtGui/QStyle>
|
|
||||||
#include <QtGui/QTreeWidgetItem>
|
|
||||||
|
|
||||||
// Project includes
|
|
||||||
#include "iplugin_spec.h"
|
|
||||||
#include "iplugin_manager.h"
|
|
||||||
|
|
||||||
namespace NLQT
|
|
||||||
{
|
|
||||||
|
|
||||||
CPluginView::CPluginView(IPluginManager *pluginManager, QWidget *parent)
|
|
||||||
: QDialog(parent)
|
|
||||||
{
|
|
||||||
_ui.setupUi(this);
|
|
||||||
_pluginManager = pluginManager;
|
|
||||||
|
|
||||||
connect(_pluginManager, SIGNAL(pluginsChanged()), this, SLOT(updateList()));
|
|
||||||
|
|
||||||
updateList();
|
|
||||||
}
|
|
||||||
|
|
||||||
CPluginView::~CPluginView()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void CPluginView::updateList()
|
|
||||||
{
|
|
||||||
static QIcon okIcon = QApplication::style()->standardIcon(QStyle::SP_DialogApplyButton);
|
|
||||||
static QIcon errorIcon = QApplication::style()->standardIcon(QStyle::SP_DialogCancelButton);
|
|
||||||
|
|
||||||
QList<QTreeWidgetItem *> items;
|
|
||||||
Q_FOREACH (IPluginSpec *spec, _pluginManager->plugins())
|
|
||||||
{
|
|
||||||
QTreeWidgetItem *item = new QTreeWidgetItem(QStringList()
|
|
||||||
<< ""
|
|
||||||
<< spec->name()
|
|
||||||
<< QString("%1").arg(spec->version())
|
|
||||||
<< spec->vendor()
|
|
||||||
<< QDir::toNativeSeparators(spec->filePath()));
|
|
||||||
item->setIcon(0, spec->hasError() ? errorIcon : okIcon);
|
|
||||||
items.append(item);
|
|
||||||
}
|
|
||||||
|
|
||||||
_ui.pluginTreeWidget->clear();
|
|
||||||
if (!items.isEmpty())
|
|
||||||
_ui.pluginTreeWidget->addTopLevelItems(items);
|
|
||||||
}
|
|
||||||
|
|
||||||
} /* namespace NLQT */
|
|
|
@ -1,3 +0,0 @@
|
||||||
[Dolphin]
|
|
||||||
ShowPreview=true
|
|
||||||
Timestamp=2010,8,4,0,59,20
|
|
|
@ -1,3 +1,20 @@
|
||||||
|
// Object Viewer Qt - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
|
||||||
|
// Copyright (C) 2010 Winch Gate Property Limited
|
||||||
|
// Copyright (C) 2010 Dzmitry Kamiahin <dnk-88@tut.by>
|
||||||
|
//
|
||||||
|
// 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 <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
#include "stdpch.h"
|
#include "stdpch.h"
|
||||||
#include <nel/misc/types_nl.h>
|
#include <nel/misc/types_nl.h>
|
||||||
#include <nel/misc/app_context.h>
|
#include <nel/misc/app_context.h>
|
||||||
|
@ -119,7 +136,7 @@ sint main(int argc, char **argv)
|
||||||
Modules::plugMan().loadPlugins();
|
Modules::plugMan().loadPlugins();
|
||||||
|
|
||||||
QStringList errors;
|
QStringList errors;
|
||||||
Q_FOREACH (NLQT::IPluginSpec *spec, Modules::plugMan().plugins())
|
Q_FOREACH (ExtensionSystem::IPluginSpec *spec, Modules::plugMan().plugins())
|
||||||
if (spec->hasError())
|
if (spec->hasError())
|
||||||
errors.append(spec->fileName() + " : " + spec->errorString());
|
errors.append(spec->fileName() + " : " + spec->errorString());
|
||||||
|
|
||||||
|
|
|
@ -46,8 +46,6 @@
|
||||||
#include "day_night_dialog.h"
|
#include "day_night_dialog.h"
|
||||||
#include "sun_color_dialog.h"
|
#include "sun_color_dialog.h"
|
||||||
|
|
||||||
#include "extension_system/plugin_view.h"
|
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace NLMISC;
|
using namespace NLMISC;
|
||||||
|
|
||||||
|
@ -138,7 +136,6 @@ CMainWindow::~CMainWindow()
|
||||||
delete _ParticleControlDialog;
|
delete _ParticleControlDialog;
|
||||||
delete _ParticleWorkspaceDialog;
|
delete _ParticleWorkspaceDialog;
|
||||||
delete _GraphicsViewport;
|
delete _GraphicsViewport;
|
||||||
delete _PluginView;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMainWindow::setVisible(bool visible)
|
void CMainWindow::setVisible(bool visible)
|
||||||
|
@ -349,10 +346,6 @@ void CMainWindow::createActions()
|
||||||
_aboutQtAction = new QAction(tr("About &Qt"), this);
|
_aboutQtAction = new QAction(tr("About &Qt"), this);
|
||||||
_aboutQtAction->setStatusTip(tr("Show the Qt library's About box"));
|
_aboutQtAction->setStatusTip(tr("Show the Qt library's About box"));
|
||||||
connect(_aboutQtAction, SIGNAL(triggered()), qApp, SLOT(aboutQt()));
|
connect(_aboutQtAction, SIGNAL(triggered()), qApp, SLOT(aboutQt()));
|
||||||
|
|
||||||
_pluginViewAction = new QAction(tr("About &Plugins"), this);
|
|
||||||
_pluginViewAction->setStatusTip(tr("Show the plugin view dialog"));
|
|
||||||
connect(_pluginViewAction, SIGNAL(triggered()), _PluginView, SLOT(show()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMainWindow::createMenus()
|
void CMainWindow::createMenus()
|
||||||
|
@ -422,7 +415,6 @@ void CMainWindow::createMenus()
|
||||||
_helpMenu->setObjectName("ovqt.Menu.Help");
|
_helpMenu->setObjectName("ovqt.Menu.Help");
|
||||||
_helpMenu->addAction(_aboutAction);
|
_helpMenu->addAction(_aboutAction);
|
||||||
_helpMenu->addAction(_aboutQtAction);
|
_helpMenu->addAction(_aboutQtAction);
|
||||||
_helpMenu->addAction(_pluginViewAction);
|
|
||||||
|
|
||||||
Modules::plugMan().addObject(_fileMenu);
|
Modules::plugMan().addObject(_fileMenu);
|
||||||
Modules::plugMan().addObject(_viewMenu);
|
Modules::plugMan().addObject(_viewMenu);
|
||||||
|
@ -521,8 +513,6 @@ void CMainWindow::createDialogs()
|
||||||
addDockWidget(Qt::RightDockWidgetArea, _SetupFog);
|
addDockWidget(Qt::RightDockWidgetArea, _SetupFog);
|
||||||
_SetupFog->setVisible(false);
|
_SetupFog->setVisible(false);
|
||||||
|
|
||||||
_PluginView = new CPluginView(&Modules::plugMan(), this);
|
|
||||||
|
|
||||||
connect(_ParticleControlDialog, SIGNAL(changeState()), _ParticleWorkspaceDialog, SLOT(setNewState()));
|
connect(_ParticleControlDialog, SIGNAL(changeState()), _ParticleWorkspaceDialog, SLOT(setNewState()));
|
||||||
connect(_ParticleWorkspaceDialog, SIGNAL(changeActiveNode()), _ParticleControlDialog, SLOT(updateActiveNode()));
|
connect(_ParticleWorkspaceDialog, SIGNAL(changeActiveNode()), _ParticleControlDialog, SLOT(updateActiveNode()));
|
||||||
connect(_AnimationSetDialog->ui.setLengthPushButton, SIGNAL(clicked()), _AnimationDialog, SLOT(changeAnimLength()));
|
connect(_AnimationSetDialog->ui.setLengthPushButton, SIGNAL(clicked()), _AnimationDialog, SLOT(changeAnimLength()));
|
||||||
|
@ -629,6 +619,7 @@ void CMainWindow::updateRender()
|
||||||
if (_isGraphicsInitialized && !Modules::objView().getDriver()->isLost())
|
if (_isGraphicsInitialized && !Modules::objView().getDriver()->isLost())
|
||||||
{
|
{
|
||||||
// 01. Render Driver (background color)
|
// 01. Render Driver (background color)
|
||||||
|
Modules::objView().getDriver()->activate();
|
||||||
Modules::objView().renderDriver(); // clear all buffers
|
Modules::objView().renderDriver(); // clear all buffers
|
||||||
|
|
||||||
// 02. Render Sky (sky scene)
|
// 02. Render Sky (sky scene)
|
||||||
|
|
|
@ -53,8 +53,6 @@ class CGlobalWindDialog;
|
||||||
class CDayNightDialog;
|
class CDayNightDialog;
|
||||||
class CSunColorDialog;
|
class CSunColorDialog;
|
||||||
|
|
||||||
class CPluginView;
|
|
||||||
|
|
||||||
class CMainWindow : public QMainWindow
|
class CMainWindow : public QMainWindow
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
@ -115,8 +113,6 @@ private:
|
||||||
CDayNightDialog *_DayNightDialog;
|
CDayNightDialog *_DayNightDialog;
|
||||||
CSunColorDialog *_SunColorDialog;
|
CSunColorDialog *_SunColorDialog;
|
||||||
|
|
||||||
CPluginView *_PluginView;
|
|
||||||
|
|
||||||
CSkeletonTreeModel *_SkeletonTreeModel;
|
CSkeletonTreeModel *_SkeletonTreeModel;
|
||||||
|
|
||||||
QPalette _originalPalette;
|
QPalette _originalPalette;
|
||||||
|
@ -139,7 +135,6 @@ private:
|
||||||
QAction *_resetSceneAction;
|
QAction *_resetSceneAction;
|
||||||
QAction *_saveScreenshotAction;
|
QAction *_saveScreenshotAction;
|
||||||
QAction *_settingsAction;
|
QAction *_settingsAction;
|
||||||
QAction *_pluginViewAction;
|
|
||||||
QAction *_aboutAction;
|
QAction *_aboutAction;
|
||||||
QAction *_aboutQtAction;
|
QAction *_aboutQtAction;
|
||||||
};/* class CMainWindow */
|
};/* class CMainWindow */
|
||||||
|
|
|
@ -26,14 +26,14 @@ NLQT::CMainWindow *Modules::_mainWindow = NULL;
|
||||||
NLQT::CParticleEditor *Modules::_particleEditor = NULL;
|
NLQT::CParticleEditor *Modules::_particleEditor = NULL;
|
||||||
NLQT::CSoundSystem *Modules::_soundSystem = NULL;
|
NLQT::CSoundSystem *Modules::_soundSystem = NULL;
|
||||||
NLQT::CVegetableEditor *Modules::_vegetableEditor = NULL;
|
NLQT::CVegetableEditor *Modules::_vegetableEditor = NULL;
|
||||||
NLQT::CPluginManager *Modules::_pluginManager = NULL;
|
ExtensionSystem::CPluginManager *Modules::_pluginManager = NULL;
|
||||||
|
|
||||||
void Modules::init()
|
void Modules::init()
|
||||||
{
|
{
|
||||||
if (_configuration == NULL) _configuration = new NLQT::CConfiguration;
|
if (_configuration == NULL) _configuration = new NLQT::CConfiguration;
|
||||||
config().init();
|
config().init();
|
||||||
|
|
||||||
if (_pluginManager == NULL) _pluginManager = new NLQT::CPluginManager;
|
if (_pluginManager == NULL) _pluginManager = new ExtensionSystem::CPluginManager;
|
||||||
if (_objectViewer == NULL) _objectViewer = new NLQT::CObjectViewer;
|
if (_objectViewer == NULL) _objectViewer = new NLQT::CObjectViewer;
|
||||||
if (_soundSystem == NULL) _soundSystem = new NLQT::CSoundSystem;
|
if (_soundSystem == NULL) _soundSystem = new NLQT::CSoundSystem;
|
||||||
if (_particleEditor == NULL) _particleEditor = new NLQT::CParticleEditor;
|
if (_particleEditor == NULL) _particleEditor = new NLQT::CParticleEditor;
|
||||||
|
|
|
@ -62,7 +62,7 @@ public:
|
||||||
{
|
{
|
||||||
return *_vegetableEditor;
|
return *_vegetableEditor;
|
||||||
}
|
}
|
||||||
static NLQT::CPluginManager &plugMan()
|
static ExtensionSystem::CPluginManager &plugMan()
|
||||||
{
|
{
|
||||||
return *_pluginManager;
|
return *_pluginManager;
|
||||||
}
|
}
|
||||||
|
@ -74,7 +74,7 @@ private:
|
||||||
static NLQT::CParticleEditor *_particleEditor;
|
static NLQT::CParticleEditor *_particleEditor;
|
||||||
static NLQT::CSoundSystem *_soundSystem;
|
static NLQT::CSoundSystem *_soundSystem;
|
||||||
static NLQT::CVegetableEditor *_vegetableEditor;
|
static NLQT::CVegetableEditor *_vegetableEditor;
|
||||||
static NLQT::CPluginManager *_pluginManager;
|
static ExtensionSystem::CPluginManager *_pluginManager;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // MODULES_H
|
#endif // MODULES_H
|
||||||
|
|
|
@ -175,6 +175,24 @@ void CObjectViewer::updateInput()
|
||||||
{
|
{
|
||||||
_Driver->EventServer.pump();
|
_Driver->EventServer.pump();
|
||||||
|
|
||||||
|
// Test some keys
|
||||||
|
if (_Driver->AsyncListener.isKeyPushed(KeyQ))
|
||||||
|
{
|
||||||
|
// Change render mode
|
||||||
|
switch (_Driver->getPolygonMode())
|
||||||
|
{
|
||||||
|
case UDriver::Filled:
|
||||||
|
_Driver->setPolygonMode (UDriver::Line);
|
||||||
|
break;
|
||||||
|
case UDriver::Line:
|
||||||
|
_Driver->setPolygonMode (UDriver::Point);
|
||||||
|
break;
|
||||||
|
case UDriver::Point:
|
||||||
|
_Driver->setPolygonMode (UDriver::Filled);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// New matrix from camera
|
// New matrix from camera
|
||||||
_Scene->getCam().setTransformMode(NL3D::UTransformable::DirectMatrix);
|
_Scene->getCam().setTransformMode(NL3D::UTransformable::DirectMatrix);
|
||||||
_Scene->getCam().setMatrix (_MouseListener->getViewMatrix());
|
_Scene->getCam().setMatrix (_MouseListener->getViewMatrix());
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
ADD_SUBDIRECTORY(core)
|
||||||
ADD_SUBDIRECTORY(example)
|
ADD_SUBDIRECTORY(example)
|
||||||
ADD_SUBDIRECTORY(ovqt_sheet_builder)
|
ADD_SUBDIRECTORY(ovqt_sheet_builder)
|
||||||
ADD_SUBDIRECTORY(log)
|
ADD_SUBDIRECTORY(log)
|
|
@ -0,0 +1,54 @@
|
||||||
|
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_CORE_PLUGIN_HDR
|
||||||
|
ioptions_page.h
|
||||||
|
core_plugin.h
|
||||||
|
core_constants.h
|
||||||
|
main_window.h
|
||||||
|
settings_dialog.h
|
||||||
|
qnel_widget.h
|
||||||
|
search_paths_settings_page.h
|
||||||
|
plugin_view_dialog.h)
|
||||||
|
|
||||||
|
SET(OVQT_CORE_PLUGIN_UIS settings_dialog.ui
|
||||||
|
plugin_view_dialog.ui
|
||||||
|
search_paths_settings_page.ui)
|
||||||
|
|
||||||
|
SET(OVQT_CORE_PLUGIN_RCS core.qrc)
|
||||||
|
|
||||||
|
SET(QT_USE_QTGUI TRUE)
|
||||||
|
SET(QT_USE_QTOPENGL TRUE)
|
||||||
|
|
||||||
|
QT4_ADD_RESOURCES(OVQT_CORE_PLUGIN_RC_SRCS ${OVQT_CORE_PLUGIN_RCS})
|
||||||
|
QT4_WRAP_CPP(OVQT_CORE_PLUGIN_MOC_SRC ${OVQT_CORE_PLUGIN_HDR})
|
||||||
|
QT4_WRAP_UI(OVQT_CORE_PLUGIN_UI_HDRS ${OVQT_CORE_PLUGIN_UIS})
|
||||||
|
|
||||||
|
SOURCE_GROUP(QtResources FILES ${OVQT_CORE_PLUGIN_UIS} ${OVQT_CORE_PLUGIN_RCS})
|
||||||
|
SOURCE_GROUP(QtGeneratedUiHdr FILES ${OVQT_CORE_PLUGIN_UI_HDRS})
|
||||||
|
SOURCE_GROUP(QtGeneratedMocSrc FILES ${OVQT_CORE_PLUGIN_MOC_SRC})
|
||||||
|
SOURCE_GROUP("Core Plugin" FILES ${SRC})
|
||||||
|
SOURCE_GROUP("OVQT Extension System" FILES ${OVQT_EXT_SYS_SRC})
|
||||||
|
|
||||||
|
ADD_LIBRARY(ovqt_plugin_core MODULE ${SRC} ${OVQT_CORE_PLUGIN_MOC_SRC} ${OVQT_EXT_SYS_SRC} ${OVQT_CORE_PLUGIN_RC_SRCS} ${OVQT_CORE_PLUGIN_UI_HDRS})
|
||||||
|
|
||||||
|
TARGET_LINK_LIBRARIES(ovqt_plugin_core nelmisc nel3d ${QT_LIBRARIES})
|
||||||
|
|
||||||
|
IF(WITH_STLPORT)
|
||||||
|
TARGET_LINK_LIBRARIES(ovqt_plugin_core ${CMAKE_THREAD_LIBS_INIT})
|
||||||
|
ENDIF(WITH_STLPORT)
|
||||||
|
|
||||||
|
NL_DEFAULT_PROPS(ovqt_plugin_core "NeL, Tools, 3D: Object Viewer Qt Plugin: Core")
|
||||||
|
NL_ADD_RUNTIME_FLAGS(ovqt_plugin_core)
|
||||||
|
NL_ADD_LIB_SUFFIX(ovqt_plugin_core)
|
||||||
|
|
||||||
|
ADD_DEFINITIONS(${LIBXML2_DEFINITIONS} -DQT_PLUGIN -DQT_SHARED ${QT_DEFINITIONS})
|
||||||
|
|
||||||
|
INSTALL(TARGETS ovqt_plugin_core LIBRARY DESTINATION lib RUNTIME DESTINATION bin ARCHIVE DESTINATION lib COMPONENT tools3d)
|
|
@ -0,0 +1,6 @@
|
||||||
|
<RCC>
|
||||||
|
<qresource prefix="/core" >
|
||||||
|
<file>images/nel.png</file>
|
||||||
|
<file>images/preferences.png</file>
|
||||||
|
</qresource>
|
||||||
|
</RCC>
|
|
@ -1,106 +1,64 @@
|
||||||
/*
|
// Object Viewer Qt - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
|
||||||
Object Viewer Qt
|
// Copyright (C) 2010 Winch Gate Property Limited
|
||||||
Copyright (C) 2010 Dzmitry Kamiahin <dnk-88@tut.by>
|
// Copyright (C) 2010 Dzmitry Kamiahin <dnk-88@tut.by>
|
||||||
|
//
|
||||||
This program is free software: you can redistribute it and/or modify
|
// 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
|
// it under the terms of the GNU Affero General Public License as
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
// published by the Free Software Foundation, either version 3 of the
|
||||||
(at your option) any later version.
|
// License, or (at your option) any later version.
|
||||||
|
//
|
||||||
This program is distributed in the hope that it will be useful,
|
// This program is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
GNU General Public License for more details.
|
// GNU Affero General Public License for more details.
|
||||||
|
//
|
||||||
You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU Affero General Public License
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef CORE_CONSTANTS_H
|
#ifndef CORE_CONSTANTS_H
|
||||||
#define CORE_CONSTANTS_H
|
#define CORE_CONSTANTS_H
|
||||||
|
|
||||||
namespace Core {
|
namespace Core
|
||||||
namespace Constants {
|
{
|
||||||
|
namespace Constants
|
||||||
|
{
|
||||||
|
|
||||||
const char * const OVQT_VERSION_LONG = "0.0.1";
|
const char * const OVQT_VERSION_LONG = "0.0.1";
|
||||||
const char * const OVQT_VENDOR = "Dzmitry Kamiahin";
|
const char * const OVQT_VENDOR = "Dzmitry Kamiahin";
|
||||||
const char * const OVQT_YEAR = "2010";
|
const char * const OVQT_YEAR = "2010, 2011";
|
||||||
|
|
||||||
//mainwindow
|
//mainwindow
|
||||||
const char * const MAIN_WINDOW = "ObjectViewerQt.MainWindow";
|
const char * const MAIN_WINDOW = "ObjectViewerQt.MainWindow";
|
||||||
|
|
||||||
//menubar
|
//menubar
|
||||||
const char * const MENU_BAR = "ObjectViewerQt.MenuBar";
|
const char * const MENU_BAR = "ObjectViewerQt.MenuBar";
|
||||||
|
|
||||||
//menus
|
//menus
|
||||||
const char * const M_FILE = "ObjectViewerQt.Menu.File";
|
const char * const M_FILE = "ObjectViewerQt.Menu.File";
|
||||||
const char * const M_EDIT = "ObjectViewerQt.Menu.Edit";
|
const char * const M_EDIT = "ObjectViewerQt.Menu.Edit";
|
||||||
const char * const M_SCENE = "ObjectViewerQt.Menu.Scene";
|
const char * const M_VIEW = "ObjectViewerQt.Menu.View";
|
||||||
const char * const M_TOOLS = "ObjectViewerQt.Menu.Tools";
|
const char * const M_SCENE = "ObjectViewerQt.Menu.Scene";
|
||||||
const char * const M_WINDOW = "ObjectViewerQt.Menu.Window";
|
const char * const M_TOOLS = "ObjectViewerQt.Menu.Tools";
|
||||||
const char * const M_HELP = "ObjectViewerQt.Menu.Help";
|
const char * const M_WINDOW = "ObjectViewerQt.Menu.Window";
|
||||||
|
const char * const M_HELP = "ObjectViewerQt.Menu.Help";
|
||||||
|
|
||||||
//actions
|
//actions
|
||||||
const char * const UNDO = "ObjectViewerQt.Undo";
|
const char * const NEW = "ObjectViewerQt.New";
|
||||||
const char * const REDO = "ObjectViewerQt.Redo";
|
const char * const OPEN = "ObjectViewerQt.Open";
|
||||||
|
const char * const EXIT = "ObjectViewerQt.Exit";
|
||||||
|
|
||||||
const char * const NEW = "ObjectViewerQt.New";
|
const char * const SETTINGS = "ObjectViewerQt.Settings";
|
||||||
const char * const OPEN = "ObjectViewerQt.Open";
|
const char * const TOGGLE_FULLSCREEN = "ObjectViewerQt.ToggleFullScreen";
|
||||||
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 CLOSE = "ObjectViewerQt.Close";
|
||||||
const char * const TOGGLE_FULLSCREEN = "ObjectViewerQt.ToggleFullScreen";
|
const char * const CLOSEALL = "ObjectViewerQt.CloseAll";
|
||||||
|
const char * const CLOSEOTHERS = "ObjectViewerQt.CloseOthers";
|
||||||
const char * const MINIMIZE_WINDOW = "ObjectViewerQt.MinimizeWindow";
|
const char * const ABOUT = "ObjectViewerQt.About";
|
||||||
const char * const ZOOM_WINDOW = "ObjectViewerQt.ZoomWindow";
|
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";
|
|
||||||
|
|
||||||
const char * const ICON_NEL = ":/images/nel.png";
|
|
||||||
const char * const ICON_NEL_IDE = ":/images/nel_ide_load.png</file>
|
|
||||||
const char * const ICON_OPENFILE = ":/images/open-file.png";
|
|
||||||
const char * const ICON_GO_DOWN = ":/images/go-down.png</file>
|
|
||||||
const char * const ICON_GO_UP = ":/images/go-up.png</file>
|
|
||||||
const char * const ICON_LIST_ADD = ":/images/list-add.png</file>
|
|
||||||
const char * const ICON_LIST_REMOVE = ":/images/list-remove.png</file>
|
|
||||||
const char * const ICON_PLAY = ":/images/play.png</file>
|
|
||||||
const char * const ICON_PAUSE = ":/images/pause.png</file>
|
|
||||||
const char * const ICON_STOP = ":/images/stop.png</file>
|
|
||||||
const char * const ICON_SEEK_BACKWARD = ":/images/seek-backward.png</file>
|
|
||||||
const char * const ICON_SEEK_FORWARD = ":/images/seek-forward.png</file>
|
|
||||||
const char * const ICON_SKIP_BACKWARD = ":/images/skip-backward.png</file>
|
|
||||||
const char * const ICON_SKIP_FORWARD = ":/images/skip-forward.png</file>
|
|
||||||
const char * const ICON_SETTINGS = ":/images/preferences.png</file>
|
|
||||||
const char * const ICON_TIME = ":/images/time.png</file>
|
|
||||||
const char * const ICON_ANIM = ":/images/anim.png</file>
|
|
||||||
const char * const ICON_ANIMSET = ":/images/animset.png</file>
|
|
||||||
const char * const ICON_DAY_NIGHT = ":/images/dqynight.png</file>
|
|
||||||
const char * const ICON_MIXER = ":/images/mixer.png</file>
|
|
||||||
const char * const ICON_PARTICLES = ":/images/pqrticles.png</file>
|
|
||||||
const char * const ICON_SOUND = ":/images/sound.png</file>
|
|
||||||
const char * const ICON_VEGETABLE = ":/images/veget.png</file>
|
|
||||||
const char * const ICON_WATER = ":/images/water.png</file>
|
|
||||||
const char * const ICON_WIND = ":/images/wind.png</file>
|
|
||||||
const char * const ICON_BACKGROUNDCOLOR = ":/images/ico_bgcolor.png</file>
|
|
||||||
const char * const ICON_FRAMEDELAY = ":/images/ico_framedelay.png</file>
|
|
||||||
const char * const ICON_SKELSCALE = ":/images/ico_skelscale.png</file>
|
|
||||||
const char * const ICON_CLEAR = ":/images/clear.png</file>
|
|
||||||
const char * const ICON_INSERT = ":/images/insert.png</file>
|
|
||||||
const char * const ICON_NEW = ":/images/new.png</file>
|
|
||||||
const char * const ICON_REFRESH = ":/images/refresh.png</file>
|
|
||||||
const char * const ICON_SAVE_AS = ":/images/save-as.png</file>
|
|
||||||
const char * const ICON_SAVE = ":/images/save.png</file>
|
|
||||||
const char * const ICON_INSERT_HORIZONTAL = ":/images/insert-horizontal.png</file>
|
|
||||||
|
|
||||||
|
const char * const ICON_NEL = ":/core/images/nel.png";
|
||||||
|
const char * const ICON_SETTINGS = ":/core/images/preferences.png";
|
||||||
} // namespace Constants
|
} // namespace Constants
|
||||||
} // namespace Core
|
} // namespace Core
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,136 @@
|
||||||
|
// Object Viewer Qt - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
|
||||||
|
// Copyright (C) 2010 Winch Gate Property Limited
|
||||||
|
// Copyright (C) 2010 Dzmitry Kamiahin <dnk-88@tut.by>
|
||||||
|
//
|
||||||
|
// 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 <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
#include "core_plugin.h"
|
||||||
|
|
||||||
|
#include <QtCore/QObject>
|
||||||
|
#include <QtGui/QMessageBox>
|
||||||
|
#include <QtGui/QMainWindow>
|
||||||
|
#include <QtGui/QMenu>
|
||||||
|
#include <QtGui/QAction>
|
||||||
|
#include <QtGui/QMenuBar>
|
||||||
|
|
||||||
|
#include "../../extension_system/iplugin_spec.h"
|
||||||
|
|
||||||
|
#include "settings_dialog.h"
|
||||||
|
#include "core_constants.h"
|
||||||
|
#include "search_paths_settings_page.h"
|
||||||
|
#include "nel/misc/debug.h"
|
||||||
|
|
||||||
|
using namespace Core;
|
||||||
|
|
||||||
|
bool CorePlugin::initialize(ExtensionSystem::IPluginManager *pluginManager, QString *errorString)
|
||||||
|
{
|
||||||
|
Q_UNUSED(errorString);
|
||||||
|
_plugMan = pluginManager;
|
||||||
|
// for old ovqt
|
||||||
|
QMainWindow *wnd = qobject_cast<QMainWindow *>(objectByName("CMainWindow"));
|
||||||
|
if (!wnd)
|
||||||
|
{
|
||||||
|
*errorString = tr("Not found QMainWindow Object Viewer Qt.");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
//_mainWindow = new CMainWindow(_plugMan);
|
||||||
|
//_mainWindow->show();
|
||||||
|
//_plugMan->addObject(new CSearchPathsSettingsPage(_mainWindow));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CorePlugin::extensionsInitialized()
|
||||||
|
{
|
||||||
|
// for old ovqt
|
||||||
|
_pluginView = new ExtensionSystem::CPluginView(_plugMan);
|
||||||
|
|
||||||
|
QMenu *toolsMenu = qobject_cast<QMenu *>(objectByName("ovqt.Menu.Tools"));
|
||||||
|
QMenu *helpMenu = qobject_cast<QMenu *>(objectByName("ovqt.Menu.Help"));
|
||||||
|
nlassert(toolsMenu);
|
||||||
|
nlassert(helpMenu);
|
||||||
|
|
||||||
|
QAction *newAction = toolsMenu->addAction(tr("New settings"));
|
||||||
|
QAction *newAction2 = helpMenu->addAction(tr("About plugins"));
|
||||||
|
newAction->setIcon(QIcon(Constants::ICON_SETTINGS));
|
||||||
|
|
||||||
|
connect(newAction, SIGNAL(triggered()), this, SLOT(execSettings()));
|
||||||
|
connect(newAction2, SIGNAL(triggered()), _pluginView, SLOT(show()));
|
||||||
|
}
|
||||||
|
|
||||||
|
void CorePlugin::shutdown()
|
||||||
|
{
|
||||||
|
//delete _mainWindow;
|
||||||
|
delete _pluginView;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CorePlugin::execSettings()
|
||||||
|
{
|
||||||
|
CSettingsDialog settingsDialog(_plugMan);
|
||||||
|
settingsDialog.show();
|
||||||
|
settingsDialog.execDialog();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CorePlugin::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
|
||||||
|
_LibContext = new NLMISC::CLibraryContext(*nelContext);
|
||||||
|
}
|
||||||
|
|
||||||
|
QString CorePlugin::name() const
|
||||||
|
{
|
||||||
|
return QLatin1String("Core");
|
||||||
|
}
|
||||||
|
|
||||||
|
QString CorePlugin::version() const
|
||||||
|
{
|
||||||
|
return Constants::OVQT_VERSION_LONG;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString CorePlugin::vendor() const
|
||||||
|
{
|
||||||
|
return Constants::OVQT_VENDOR;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString CorePlugin::description() const
|
||||||
|
{
|
||||||
|
return "Core plugin.";
|
||||||
|
}
|
||||||
|
|
||||||
|
QList<QString> CorePlugin::dependencies() const
|
||||||
|
{
|
||||||
|
return QList<QString>();
|
||||||
|
}
|
||||||
|
|
||||||
|
QObject* CorePlugin::objectByName(const QString &name) const
|
||||||
|
{
|
||||||
|
Q_FOREACH (QObject *qobj, _plugMan->allObjects())
|
||||||
|
if (qobj->objectName() == name)
|
||||||
|
return qobj;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
ExtensionSystem::IPluginSpec *CorePlugin::pluginByName(const QString &name) const
|
||||||
|
{
|
||||||
|
Q_FOREACH (ExtensionSystem::IPluginSpec *spec, _plugMan->plugins())
|
||||||
|
if (spec->name() == name)
|
||||||
|
return spec;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
Q_EXPORT_PLUGIN(CorePlugin)
|
|
@ -0,0 +1,76 @@
|
||||||
|
// Object Viewer Qt - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
|
||||||
|
// Copyright (C) 2010 Winch Gate Property Limited
|
||||||
|
// Copyright (C) 2010 Dzmitry Kamiahin <dnk-88@tut.by>
|
||||||
|
//
|
||||||
|
// 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 <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
#ifndef CORE_PLUGIN_H
|
||||||
|
#define CORE_PLUGIN_H
|
||||||
|
|
||||||
|
#include "../../extension_system/iplugin.h"
|
||||||
|
#include "main_window.h"
|
||||||
|
|
||||||
|
#include "nel/misc/app_context.h"
|
||||||
|
|
||||||
|
#include <QtCore/QObject>
|
||||||
|
|
||||||
|
namespace NLMISC
|
||||||
|
{
|
||||||
|
class CLibraryContext;
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace ExtensionSystem
|
||||||
|
{
|
||||||
|
class IPluginSpec;
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace Core
|
||||||
|
{
|
||||||
|
|
||||||
|
class CorePlugin : public QObject, public ExtensionSystem::IPlugin
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
Q_INTERFACES(ExtensionSystem::IPlugin)
|
||||||
|
public:
|
||||||
|
|
||||||
|
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;
|
||||||
|
QList<QString> dependencies() const;
|
||||||
|
|
||||||
|
QObject *objectByName(const QString &name) const;
|
||||||
|
ExtensionSystem::IPluginSpec *pluginByName(const QString &name) const;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
NLMISC::CLibraryContext *_LibContext;
|
||||||
|
|
||||||
|
private Q_SLOTS:
|
||||||
|
void execSettings();
|
||||||
|
|
||||||
|
private:
|
||||||
|
ExtensionSystem::IPluginManager *_plugMan;
|
||||||
|
ExtensionSystem::CPluginView *_pluginView;
|
||||||
|
CMainWindow *_mainWindow;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace Core
|
||||||
|
|
||||||
|
#endif // CORE_PLUGIN_H
|
Binary file not shown.
After Width: | Height: | Size: 15 KiB |
Binary file not shown.
After Width: | Height: | Size: 10 KiB |
|
@ -0,0 +1,66 @@
|
||||||
|
// Object Viewer Qt - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
|
||||||
|
// Copyright (C) 2010 Winch Gate Property Limited
|
||||||
|
// Copyright (C) 2011 Dzmitry Kamiahin <dnk-88@tut.by>
|
||||||
|
// Parts by Nokia Corporation (qt-info@nokia.com) Copyright (C) 2009.
|
||||||
|
//
|
||||||
|
// 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 <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
#ifndef IOPTIONS_PAGE_H
|
||||||
|
#define IOPTIONS_PAGE_H
|
||||||
|
|
||||||
|
#include <QtCore/QObject>
|
||||||
|
|
||||||
|
class QWidget;
|
||||||
|
|
||||||
|
namespace Core
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
@interface IOptionsPage
|
||||||
|
@brief The IOptionsPage is an interface for providing options pages.
|
||||||
|
@details You need to subclass this interface and put an instance of your subclass
|
||||||
|
into the plugin manager object pool.
|
||||||
|
*/
|
||||||
|
class IOptionsPage : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
IOptionsPage(QObject *parent = 0) : QObject(parent) {}
|
||||||
|
virtual ~IOptionsPage() {}
|
||||||
|
|
||||||
|
/// id() is a unique identifier for referencing this page
|
||||||
|
virtual QString id() const = 0;
|
||||||
|
|
||||||
|
/// trName() is the (translated) name for display.
|
||||||
|
virtual QString trName() const = 0;
|
||||||
|
|
||||||
|
/// category() is the unique id for the category that the page should be displayed in
|
||||||
|
virtual QString category() const = 0;
|
||||||
|
|
||||||
|
/// trCategory() is the translated category
|
||||||
|
virtual QString trCategory() const = 0;
|
||||||
|
|
||||||
|
/// createPage() is called to retrieve the widget to show in the preferences dialog
|
||||||
|
/// The widget will be destroyed by the widget hierarchy when the dialog closes
|
||||||
|
virtual QWidget *createPage(QWidget *parent) = 0;
|
||||||
|
|
||||||
|
/// apply() is called to store the settings. It should detect if any changes have been made and store those.
|
||||||
|
virtual void apply() = 0;
|
||||||
|
|
||||||
|
/// finish() is called directly before the preferences dialog closes
|
||||||
|
virtual void finish() = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace Core
|
||||||
|
|
||||||
|
#endif // IOPTIONSPAGE_H
|
|
@ -0,0 +1,173 @@
|
||||||
|
// Object Viewer Qt - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
|
||||||
|
// Copyright (C) 2010 Winch Gate Property Limited
|
||||||
|
// Copyright (C) 2011 Dzmitry Kamiahin <dnk-88@tut.by>
|
||||||
|
//
|
||||||
|
// 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 <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
// Project includes
|
||||||
|
#include "main_window.h"
|
||||||
|
#include "core_constants.h"
|
||||||
|
#include "settings_dialog.h"
|
||||||
|
|
||||||
|
// Qt includes
|
||||||
|
#include <QtGui/QtGui>
|
||||||
|
|
||||||
|
namespace Core
|
||||||
|
{
|
||||||
|
|
||||||
|
CMainWindow::CMainWindow(ExtensionSystem::IPluginManager *pluginManager, QWidget *parent)
|
||||||
|
: QMainWindow(parent),
|
||||||
|
_lastDir(".")
|
||||||
|
{
|
||||||
|
_pluginManager = pluginManager;
|
||||||
|
|
||||||
|
setObjectName(Constants::MAIN_WINDOW);
|
||||||
|
|
||||||
|
_tabWidget = new QTabWidget(this);
|
||||||
|
setCentralWidget(_tabWidget);
|
||||||
|
|
||||||
|
QWidget *qwidg1 = new QWidget(_tabWidget);
|
||||||
|
QWidget *qwidg2 = new QWidget(_tabWidget);
|
||||||
|
|
||||||
|
_tabWidget->addTab(qwidg1, "tab1");
|
||||||
|
_tabWidget->addTab(qwidg2, "tab2");
|
||||||
|
|
||||||
|
|
||||||
|
QGridLayout *gridLayout = new QGridLayout(qwidg1);
|
||||||
|
gridLayout->setObjectName(QString::fromUtf8("gridLayout"));
|
||||||
|
NLQT::QNLWidget *_nelWidget = new NLQT::QNLWidget(qwidg1);
|
||||||
|
_nelWidget->setObjectName(QString::fromUtf8("NELWIdget1"));
|
||||||
|
gridLayout->addWidget(_nelWidget, 0, 0, 1, 1);
|
||||||
|
|
||||||
|
QGridLayout *gridLayout2 = new QGridLayout(qwidg2);
|
||||||
|
NLQT::QNLWidget *_nelWidget2 = new NLQT::QNLWidget(qwidg2);
|
||||||
|
_nelWidget2->setObjectName(QString::fromUtf8("NELWIdget2"));
|
||||||
|
gridLayout2->addWidget(_nelWidget2, 0, 0, 1, 1);
|
||||||
|
|
||||||
|
setDockNestingEnabled(true);
|
||||||
|
|
||||||
|
_originalPalette = QApplication::palette();
|
||||||
|
|
||||||
|
createDialogs();
|
||||||
|
createActions();
|
||||||
|
createMenus();
|
||||||
|
createStatusBar();
|
||||||
|
|
||||||
|
setWindowIcon(QIcon(Constants::ICON_NEL));
|
||||||
|
setWindowTitle(tr("Object Viewer Qt"));
|
||||||
|
}
|
||||||
|
|
||||||
|
CMainWindow::~CMainWindow()
|
||||||
|
{
|
||||||
|
delete _pluginView;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CMainWindow::showOptionsDialog(const QString &group,
|
||||||
|
const QString &page,
|
||||||
|
QWidget *parent)
|
||||||
|
{
|
||||||
|
if (!parent)
|
||||||
|
parent = this;
|
||||||
|
CSettingsDialog _settingsDialog(_pluginManager, group, page, parent);
|
||||||
|
_settingsDialog.show();
|
||||||
|
return _settingsDialog.execDialog();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CMainWindow::about()
|
||||||
|
{
|
||||||
|
QMessageBox::about(this, tr("About Object Viewer Qt"),
|
||||||
|
tr("<h2>Object Viewer Qt NG</h2>"
|
||||||
|
"<p> Author: dnk-88 <p>Compiled on %1 %2").arg(__DATE__).arg(__TIME__));
|
||||||
|
}
|
||||||
|
|
||||||
|
void CMainWindow::createActions()
|
||||||
|
{
|
||||||
|
_openAction = new QAction(tr("&Open..."), this);
|
||||||
|
_openAction->setIcon(QIcon(":/images/open-file.png"));
|
||||||
|
_openAction->setShortcut(QKeySequence::Open);
|
||||||
|
_openAction->setStatusTip(tr("Open an existing file"));
|
||||||
|
// connect(_openAction, SIGNAL(triggered()), this, SLOT(open()));
|
||||||
|
|
||||||
|
_exitAction = new QAction(tr("E&xit"), this);
|
||||||
|
_exitAction->setShortcut(tr("Ctrl+Q"));
|
||||||
|
_exitAction->setStatusTip(tr("Exit the application"));
|
||||||
|
connect(_exitAction, SIGNAL(triggered()), this, SLOT(close()));
|
||||||
|
|
||||||
|
_settingsAction = new QAction(tr("&Settings"), this);
|
||||||
|
_settingsAction->setIcon(QIcon(":/images/preferences.png"));
|
||||||
|
_settingsAction->setStatusTip(tr("Open the settings dialog"));
|
||||||
|
connect(_settingsAction, SIGNAL(triggered()), this, SLOT(showOptionsDialog()));
|
||||||
|
|
||||||
|
_aboutAction = new QAction(tr("&About"), this);
|
||||||
|
_aboutAction->setStatusTip(tr("Show the application's About box"));
|
||||||
|
connect(_aboutAction, SIGNAL(triggered()), this, SLOT(about()));
|
||||||
|
|
||||||
|
_aboutQtAction = new QAction(tr("About &Qt"), this);
|
||||||
|
_aboutQtAction->setStatusTip(tr("Show the Qt library's About box"));
|
||||||
|
connect(_aboutQtAction, SIGNAL(triggered()), qApp, SLOT(aboutQt()));
|
||||||
|
|
||||||
|
_pluginViewAction = new QAction(tr("About &Plugins"), this);
|
||||||
|
_pluginViewAction->setStatusTip(tr("Show the plugin view dialog"));
|
||||||
|
connect(_pluginViewAction, SIGNAL(triggered()), _pluginView, SLOT(show()));
|
||||||
|
}
|
||||||
|
|
||||||
|
void CMainWindow::createMenus()
|
||||||
|
{
|
||||||
|
_fileMenu = menuBar()->addMenu(tr("&File"));
|
||||||
|
_fileMenu->setObjectName(Constants::M_FILE);
|
||||||
|
_fileMenu->addSeparator();
|
||||||
|
_fileMenu->addAction(_exitAction);
|
||||||
|
|
||||||
|
_editMenu = menuBar()->addMenu(tr("&Edit"));
|
||||||
|
_editMenu->setObjectName(Constants::M_EDIT);
|
||||||
|
|
||||||
|
_viewMenu = menuBar()->addMenu(tr("&View"));
|
||||||
|
_viewMenu->setObjectName(Constants::M_VIEW);
|
||||||
|
|
||||||
|
_toolsMenu = menuBar()->addMenu(tr("&Tools"));
|
||||||
|
_toolsMenu->setObjectName(Constants::M_TOOLS);
|
||||||
|
|
||||||
|
|
||||||
|
_toolsMenu->addSeparator();
|
||||||
|
|
||||||
|
_toolsMenu->addAction(_settingsAction);
|
||||||
|
|
||||||
|
menuBar()->addSeparator();
|
||||||
|
|
||||||
|
_helpMenu = menuBar()->addMenu(tr("&Help"));
|
||||||
|
_helpMenu->setObjectName(Constants::M_HELP);
|
||||||
|
_helpMenu->addAction(_aboutAction);
|
||||||
|
_helpMenu->addAction(_aboutQtAction);
|
||||||
|
_helpMenu->addAction(_pluginViewAction);
|
||||||
|
|
||||||
|
_pluginManager->addObject(_fileMenu);
|
||||||
|
_pluginManager->addObject(_editMenu);
|
||||||
|
_pluginManager->addObject(_viewMenu);
|
||||||
|
_pluginManager->addObject(_toolsMenu);
|
||||||
|
_pluginManager->addObject(_helpMenu);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CMainWindow::createStatusBar()
|
||||||
|
{
|
||||||
|
statusBar()->showMessage(tr("StatusReady"));
|
||||||
|
}
|
||||||
|
|
||||||
|
void CMainWindow::createDialogs()
|
||||||
|
{
|
||||||
|
_pluginView = new ExtensionSystem::CPluginView(_pluginManager, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
} /* namespace Core */
|
||||||
|
|
||||||
|
/* end of file */
|
|
@ -0,0 +1,91 @@
|
||||||
|
// Object Viewer Qt - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
|
||||||
|
// Copyright (C) 2010 Winch Gate Property Limited
|
||||||
|
// Copyright (C) 2011 Dzmitry Kamiahin <dnk-88@tut.by>
|
||||||
|
//
|
||||||
|
// 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 <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
#ifndef MAIN_WINDOW_H
|
||||||
|
#define MAIN_WINDOW_H
|
||||||
|
|
||||||
|
// STL includes
|
||||||
|
|
||||||
|
// Qt includes
|
||||||
|
#include <QtGui/QMainWindow>
|
||||||
|
#include <QtCore/QSettings>
|
||||||
|
|
||||||
|
// Project includes
|
||||||
|
#include "qnel_widget.h"
|
||||||
|
#include "../../extension_system/iplugin.h"
|
||||||
|
#include "plugin_view_dialog.h"
|
||||||
|
|
||||||
|
namespace Core
|
||||||
|
{
|
||||||
|
class CSettingsDialog;
|
||||||
|
|
||||||
|
class CMainWindow : public QMainWindow
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
CMainWindow(ExtensionSystem::IPluginManager *pluginManager, QWidget *parent = 0);
|
||||||
|
~CMainWindow();
|
||||||
|
|
||||||
|
inline QSettings *settings() const
|
||||||
|
{
|
||||||
|
return _settings;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Q_SLOTS:
|
||||||
|
bool showOptionsDialog(const QString &group = QString(),
|
||||||
|
const QString &page = QString(),
|
||||||
|
QWidget *parent = 0);
|
||||||
|
void about();
|
||||||
|
|
||||||
|
private:
|
||||||
|
void createActions();
|
||||||
|
void createMenus();
|
||||||
|
void createStatusBar();
|
||||||
|
void createDialogs();
|
||||||
|
|
||||||
|
ExtensionSystem::IPluginManager *_pluginManager;
|
||||||
|
ExtensionSystem::CPluginView *_pluginView;
|
||||||
|
|
||||||
|
QPalette _originalPalette;
|
||||||
|
QString _lastDir;
|
||||||
|
|
||||||
|
QSettings *_settings;
|
||||||
|
|
||||||
|
QTimer *_mainTimer;
|
||||||
|
QTimer *_statusBarTimer;
|
||||||
|
|
||||||
|
QTabWidget *_tabWidget;
|
||||||
|
|
||||||
|
QMenu *_fileMenu;
|
||||||
|
QMenu *_editMenu;
|
||||||
|
QMenu *_viewMenu;
|
||||||
|
QMenu *_toolsMenu;
|
||||||
|
QMenu *_helpMenu;
|
||||||
|
|
||||||
|
QAction *_openAction;
|
||||||
|
QAction *_exitAction;
|
||||||
|
QAction *_settingsAction;
|
||||||
|
QAction *_pluginViewAction;
|
||||||
|
QAction *_aboutAction;
|
||||||
|
QAction *_aboutQtAction;
|
||||||
|
|
||||||
|
};/* class CMainWindow */
|
||||||
|
|
||||||
|
} /* namespace Core */
|
||||||
|
|
||||||
|
#endif // MAIN_WINDOW_H
|
|
@ -0,0 +1,73 @@
|
||||||
|
// Object Viewer Qt - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
|
||||||
|
// Copyright (C) 2010 Winch Gate Property Limited
|
||||||
|
// Copyright (C) 2011 Dzmitry Kamiahin <dnk-88@tut.by>
|
||||||
|
//
|
||||||
|
// 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 <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
#include "plugin_view_dialog.h"
|
||||||
|
|
||||||
|
// Qt includes
|
||||||
|
#include <QtCore/QDir>
|
||||||
|
#include <QtCore/QString>
|
||||||
|
#include <QtCore/QStringList>
|
||||||
|
#include <QtGui/QIcon>
|
||||||
|
#include <QtGui/QStyle>
|
||||||
|
#include <QtGui/QTreeWidgetItem>
|
||||||
|
|
||||||
|
// Project includes
|
||||||
|
#include "../../extension_system/iplugin_spec.h"
|
||||||
|
#include "../../extension_system/iplugin_manager.h"
|
||||||
|
|
||||||
|
namespace ExtensionSystem
|
||||||
|
{
|
||||||
|
|
||||||
|
CPluginView::CPluginView(IPluginManager *pluginManager, QWidget *parent)
|
||||||
|
: QDialog(parent)
|
||||||
|
{
|
||||||
|
_ui.setupUi(this);
|
||||||
|
_pluginManager = pluginManager;
|
||||||
|
|
||||||
|
connect(_pluginManager, SIGNAL(pluginsChanged()), this, SLOT(updateList()));
|
||||||
|
|
||||||
|
updateList();
|
||||||
|
}
|
||||||
|
|
||||||
|
CPluginView::~CPluginView()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void CPluginView::updateList()
|
||||||
|
{
|
||||||
|
static QIcon okIcon = QApplication::style()->standardIcon(QStyle::SP_DialogApplyButton);
|
||||||
|
static QIcon errorIcon = QApplication::style()->standardIcon(QStyle::SP_DialogCancelButton);
|
||||||
|
|
||||||
|
QList<QTreeWidgetItem *> items;
|
||||||
|
Q_FOREACH (IPluginSpec *spec, _pluginManager->plugins())
|
||||||
|
{
|
||||||
|
QTreeWidgetItem *item = new QTreeWidgetItem(QStringList()
|
||||||
|
<< ""
|
||||||
|
<< spec->name()
|
||||||
|
<< QString("%1").arg(spec->version())
|
||||||
|
<< spec->vendor()
|
||||||
|
<< QDir::toNativeSeparators(spec->filePath()));
|
||||||
|
item->setIcon(0, spec->hasError() ? errorIcon : okIcon);
|
||||||
|
items.append(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
_ui.pluginTreeWidget->clear();
|
||||||
|
if (!items.isEmpty())
|
||||||
|
_ui.pluginTreeWidget->addTopLevelItems(items);
|
||||||
|
}
|
||||||
|
|
||||||
|
} /* namespace NLQT */
|
|
@ -0,0 +1,47 @@
|
||||||
|
// Object Viewer Qt - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
|
||||||
|
// Copyright (C) 2010 Winch Gate Property Limited
|
||||||
|
// Copyright (C) 2011 Dzmitry Kamiahin <dnk-88@tut.by>
|
||||||
|
//
|
||||||
|
// 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 <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
#ifndef PLUGIN_VIEW_H
|
||||||
|
#define PLUGIN_VIEW_H
|
||||||
|
|
||||||
|
#include "ui_plugin_view_dialog.h"
|
||||||
|
|
||||||
|
namespace ExtensionSystem
|
||||||
|
{
|
||||||
|
|
||||||
|
class IPluginManager;
|
||||||
|
|
||||||
|
class CPluginView: public QDialog
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
CPluginView(IPluginManager *pluginManager, QWidget *parent = 0);
|
||||||
|
~CPluginView();
|
||||||
|
|
||||||
|
private Q_SLOTS:
|
||||||
|
void updateList();
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
IPluginManager *_pluginManager;
|
||||||
|
Ui::CPluginView _ui;
|
||||||
|
}; /* class CPluginView */
|
||||||
|
|
||||||
|
} /* namespace NLQT */
|
||||||
|
|
||||||
|
#endif // PLUGIN_VIEW_H
|
|
@ -17,7 +17,7 @@
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
<item row="0" column="0" colspan="4">
|
<item row="0" column="0" colspan="5">
|
||||||
<widget class="QTreeWidget" name="pluginTreeWidget">
|
<widget class="QTreeWidget" name="pluginTreeWidget">
|
||||||
<property name="alternatingRowColors">
|
<property name="alternatingRowColors">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
|
@ -37,6 +37,9 @@
|
||||||
<property name="sortingEnabled">
|
<property name="sortingEnabled">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
|
<attribute name="headerDefaultSectionSize">
|
||||||
|
<number>100</number>
|
||||||
|
</attribute>
|
||||||
<column>
|
<column>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>State</string>
|
<string>State</string>
|
||||||
|
@ -84,7 +87,7 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="2">
|
<item row="1" column="3">
|
||||||
<spacer name="horizontalSpacer">
|
<spacer name="horizontalSpacer">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
|
@ -97,13 +100,23 @@
|
||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="3">
|
<item row="1" column="4">
|
||||||
<widget class="QPushButton" name="closePushButton">
|
<widget class="QPushButton" name="closePushButton">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Close</string>
|
<string>Close</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="1" column="2">
|
||||||
|
<widget class="QPushButton" name="allObjectsPushButton">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>All objects list</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<resources>
|
<resources>
|
|
@ -0,0 +1,208 @@
|
||||||
|
// Object Viewer Qt - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
|
||||||
|
// Copyright (C) 2010 Winch Gate Property Limited
|
||||||
|
// Copyright (C) 2011 Dzmitry Kamiahin <dnk-88@tut.by>
|
||||||
|
//
|
||||||
|
// 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 <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
#include "qnel_widget.h"
|
||||||
|
|
||||||
|
// STL includes
|
||||||
|
|
||||||
|
// Qt includes
|
||||||
|
#include <QtCore/QTimer>
|
||||||
|
#include <QtGui/QResizeEvent>
|
||||||
|
|
||||||
|
// NeL includes
|
||||||
|
#include <nel/misc/event_server.h>
|
||||||
|
#include <nel/misc/debug.h>
|
||||||
|
#include <nel/3d/u_driver.h>
|
||||||
|
#include <nel/3d/driver_user.h>
|
||||||
|
|
||||||
|
namespace NLQT
|
||||||
|
{
|
||||||
|
|
||||||
|
QNLWidget::QNLWidget(QWidget *parent)
|
||||||
|
: QWidget(parent),
|
||||||
|
_driver(NULL),
|
||||||
|
_initialized(false),
|
||||||
|
_interval(25)
|
||||||
|
{
|
||||||
|
init();
|
||||||
|
_mainTimer = new QTimer(this);
|
||||||
|
connect(_mainTimer, SIGNAL(timeout()), this, SLOT(updateRender()));
|
||||||
|
}
|
||||||
|
|
||||||
|
QNLWidget::~QNLWidget()
|
||||||
|
{
|
||||||
|
release();
|
||||||
|
}
|
||||||
|
|
||||||
|
void QNLWidget::init()
|
||||||
|
{
|
||||||
|
// create the driver
|
||||||
|
_driver = NL3D::UDriver::createDriver(NULL, false, NULL);
|
||||||
|
nlassert(_driver);
|
||||||
|
|
||||||
|
// initialize the nel 3d viewport
|
||||||
|
_driver->setDisplay(winId(), NL3D::UDriver::CMode(width(), height(), 32));
|
||||||
|
|
||||||
|
// set the cache size for the font manager(in bytes)
|
||||||
|
_driver->setFontManagerMaxMemory(2097152);
|
||||||
|
|
||||||
|
_initialized = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void QNLWidget::release()
|
||||||
|
{
|
||||||
|
_mainTimer->stop();
|
||||||
|
delete _mainTimer;
|
||||||
|
if (_initialized)
|
||||||
|
{
|
||||||
|
_driver->release();
|
||||||
|
delete _driver;
|
||||||
|
_driver = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void QNLWidget::setInterval(int msec)
|
||||||
|
{
|
||||||
|
_interval = msec;
|
||||||
|
_mainTimer->setInterval(msec);
|
||||||
|
}
|
||||||
|
|
||||||
|
void QNLWidget::updateRender()
|
||||||
|
{
|
||||||
|
if (isVisible())
|
||||||
|
{
|
||||||
|
if (_initialized)
|
||||||
|
_driver->EventServer.pump();
|
||||||
|
if (_initialized && !_driver->isLost())
|
||||||
|
{
|
||||||
|
_driver->activate();
|
||||||
|
_driver->clearBuffers(NLMISC::CRGBA(125,12,58));
|
||||||
|
|
||||||
|
// swap 3d buffers
|
||||||
|
_driver->swapBuffers();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void QNLWidget::showEvent(QShowEvent *showEvent)
|
||||||
|
{
|
||||||
|
QWidget::showEvent(showEvent);
|
||||||
|
if (isVisible())
|
||||||
|
{
|
||||||
|
_driver->activate();
|
||||||
|
_mainTimer->start(_interval);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
_mainTimer->stop();
|
||||||
|
}
|
||||||
|
|
||||||
|
#if defined(NL_OS_WINDOWS) || defined(NL_OS_MAC)
|
||||||
|
// Qt does not provide wheel events through winEvent() and macEvent() (but it
|
||||||
|
// does through x11Event(), which is inconsistent...)
|
||||||
|
// Workaround is to handle wheel events like implemented below.
|
||||||
|
//
|
||||||
|
// TODO: this is not a clean solution, because all but wheel events are
|
||||||
|
// handled using winEvent(), x11Event(), macEvent(). But this seems to be a
|
||||||
|
// limitation of current (4.7.1) Qt versions. (see e.g. qapplication_mac.mm)
|
||||||
|
void QNLWidget::wheelEvent(QWheelEvent *event)
|
||||||
|
{
|
||||||
|
// Get relative positions.
|
||||||
|
float fX = 1.0f - (float)event->pos().x() / this->width();
|
||||||
|
float fY = 1.0f - (float)event->pos().y() / this->height();
|
||||||
|
|
||||||
|
// Get the buttons currently pressed.
|
||||||
|
uint32 buttons = NLMISC::noButton;
|
||||||
|
if(event->buttons() & Qt::LeftButton) buttons |= NLMISC::leftButton;
|
||||||
|
if(event->buttons() & Qt::RightButton) buttons |= NLMISC::rightButton;
|
||||||
|
if(event->buttons() & Qt::MidButton) buttons |= NLMISC::middleButton;
|
||||||
|
if(event->modifiers() & Qt::ControlModifier) buttons |= NLMISC::ctrlButton;
|
||||||
|
if(event->modifiers() & Qt::ShiftModifier) buttons |= NLMISC::shiftButton;
|
||||||
|
if(event->modifiers() & Qt::AltModifier) buttons |= NLMISC::altButton;
|
||||||
|
|
||||||
|
if(event->delta() > 0)
|
||||||
|
_driver->EventServer.postEvent(
|
||||||
|
new NLMISC::CEventMouseWheel(-fX, fY, (NLMISC::TMouseButton)buttons, true, NULL));
|
||||||
|
else
|
||||||
|
_driver->EventServer.postEvent(
|
||||||
|
new NLMISC::CEventMouseWheel(-fX, fY, (NLMISC::TMouseButton)buttons, false, NULL));
|
||||||
|
}
|
||||||
|
#endif // defined(NL_OS_WINDOWS) || defined(NL_OS_MAC)
|
||||||
|
|
||||||
|
|
||||||
|
#if defined(NL_OS_WINDOWS)
|
||||||
|
|
||||||
|
typedef bool (*winProc)(NL3D::IDriver *driver, HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
|
||||||
|
|
||||||
|
bool QNLWidget::winEvent(MSG *message, long *result)
|
||||||
|
{
|
||||||
|
if (_driver && _driver->isActive())
|
||||||
|
{
|
||||||
|
NL3D::IDriver *driver = dynamic_cast<NL3D::CDriverUser *>(_driver)->getDriver();
|
||||||
|
if (driver)
|
||||||
|
{
|
||||||
|
winProc proc = (winProc)driver->getWindowProc();
|
||||||
|
return proc(driver, message->hwnd, message->message, message->wParam, message->lParam);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
#elif defined(NL_OS_MAC)
|
||||||
|
|
||||||
|
typedef bool (*cocoaProc)(NL3D::IDriver *, const void *e);
|
||||||
|
|
||||||
|
bool QNLWidget::macEvent(EventHandlerCallRef caller, EventRef event)
|
||||||
|
{
|
||||||
|
if(caller)
|
||||||
|
nlerror("You are using QtCarbon! Only QtCocoa supported, please upgrade Qt");
|
||||||
|
|
||||||
|
if (_driver && _driver->isActive())
|
||||||
|
{
|
||||||
|
NL3D::IDriver *driver = dynamic_cast<NL3D::CDriverUser *>(_driver)->getDriver();
|
||||||
|
if (driver)
|
||||||
|
{
|
||||||
|
cocoaProc proc = (cocoaProc)driver->getWindowProc();
|
||||||
|
return proc(driver, event);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
#elif defined(NL_OS_UNIX)
|
||||||
|
|
||||||
|
typedef bool (*x11Proc)(NL3D::IDriver *drv, XEvent *e);
|
||||||
|
|
||||||
|
bool QNLWidget::x11Event(XEvent *event)
|
||||||
|
{
|
||||||
|
if (_driver && _driver->isActive())
|
||||||
|
{
|
||||||
|
NL3D::IDriver *driver = dynamic_cast<NL3D::CDriverUser *>(_driver)->getDriver();
|
||||||
|
if (driver)
|
||||||
|
{
|
||||||
|
x11Proc proc = (x11Proc)driver->getWindowProc();
|
||||||
|
return proc(driver, event);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
} /* namespace NLQT */
|
||||||
|
|
|
@ -0,0 +1,97 @@
|
||||||
|
// Object Viewer Qt - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
|
||||||
|
// Copyright (C) 2010 Winch Gate Property Limited
|
||||||
|
// Copyright (C) 2011 Dzmitry Kamiahin <dnk-88@tut.by>
|
||||||
|
//
|
||||||
|
// 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 <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
#ifndef QNEL_WIDGET_H
|
||||||
|
#define QNEL_WIDGET_H
|
||||||
|
|
||||||
|
// NeL includes
|
||||||
|
#include <nel/misc/types_nl.h>
|
||||||
|
#include <nel/misc/event_emitter.h>
|
||||||
|
|
||||||
|
// Qt includes
|
||||||
|
#include <QtOpenGL/QGLWidget>
|
||||||
|
#include <QtGui/QWidget>
|
||||||
|
|
||||||
|
class QAction;
|
||||||
|
|
||||||
|
namespace NL3D
|
||||||
|
{
|
||||||
|
class UDriver;
|
||||||
|
class UScene;
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace NLQT
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class QNLWidget
|
||||||
|
@brief Responsible for interaction between Qt and NeL.
|
||||||
|
@details Automatically begins to update the render if the widget is visible
|
||||||
|
or suspends the updating of render if the widget is hidden.
|
||||||
|
*/
|
||||||
|
class QNLWidget : public QWidget
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
QNLWidget(QWidget *parent);
|
||||||
|
virtual ~QNLWidget();
|
||||||
|
|
||||||
|
/// Set the update interval renderer
|
||||||
|
void setInterval(int msec);
|
||||||
|
|
||||||
|
virtual QPaintEngine* paintEngine() const
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Q_SLOTS:
|
||||||
|
void updateRender();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual void showEvent(QShowEvent *showEvent);
|
||||||
|
|
||||||
|
#if defined(NL_OS_WINDOWS) || defined(NL_OS_MAC)
|
||||||
|
virtual void wheelEvent(QWheelEvent *event);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(NL_OS_WINDOWS)
|
||||||
|
virtual bool winEvent(MSG *message, long *result);
|
||||||
|
#elif defined(NL_OS_MAC)
|
||||||
|
virtual bool macEvent(EventHandlerCallRef caller, EventRef event);
|
||||||
|
#elif defined(NL_OS_UNIX)
|
||||||
|
virtual bool x11Event(XEvent *event);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
private:
|
||||||
|
void init();
|
||||||
|
void release();
|
||||||
|
|
||||||
|
QNLWidget(const QNLWidget &);
|
||||||
|
QNLWidget &operator=(const QNLWidget &);
|
||||||
|
|
||||||
|
NL3D::UDriver *_driver;
|
||||||
|
QTimer *_mainTimer;
|
||||||
|
bool _initialized;
|
||||||
|
int _interval;
|
||||||
|
|
||||||
|
}; /* class QNLWidget */
|
||||||
|
|
||||||
|
} /* namespace NLQT */
|
||||||
|
|
||||||
|
|
||||||
|
#endif // QNEL_WIDGET_H
|
|
@ -0,0 +1,67 @@
|
||||||
|
// Object Viewer Qt - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
|
||||||
|
// Copyright (C) 2010 Winch Gate Property Limited
|
||||||
|
// Copyright (C) 2011 Dzmitry Kamiahin <dnk-88@tut.by>
|
||||||
|
//
|
||||||
|
// 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 <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
#include "search_paths_settings_page.h"
|
||||||
|
|
||||||
|
// Qt includes
|
||||||
|
#include <QtGui/QWidget>
|
||||||
|
|
||||||
|
// NeL includes
|
||||||
|
|
||||||
|
// Project includes
|
||||||
|
|
||||||
|
namespace Core
|
||||||
|
{
|
||||||
|
|
||||||
|
CSearchPathsSettingsPage::CSearchPathsSettingsPage(QObject *parent)
|
||||||
|
: IOptionsPage(parent),
|
||||||
|
_currentPage(NULL)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
QString CSearchPathsSettingsPage::id() const
|
||||||
|
{
|
||||||
|
return QLatin1String("SearchPaths");
|
||||||
|
}
|
||||||
|
|
||||||
|
QString CSearchPathsSettingsPage::trName() const
|
||||||
|
{
|
||||||
|
return tr("Search Paths");
|
||||||
|
}
|
||||||
|
|
||||||
|
QString CSearchPathsSettingsPage::category() const
|
||||||
|
{
|
||||||
|
return QLatin1String("General");
|
||||||
|
}
|
||||||
|
|
||||||
|
QString CSearchPathsSettingsPage::trCategory() const
|
||||||
|
{
|
||||||
|
return tr("General");
|
||||||
|
}
|
||||||
|
|
||||||
|
QWidget *CSearchPathsSettingsPage::createPage(QWidget *parent)
|
||||||
|
{
|
||||||
|
_currentPage = new QWidget(parent);
|
||||||
|
_ui.setupUi(_currentPage);
|
||||||
|
return _currentPage;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CSearchPathsSettingsPage::apply()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
} /* namespace Core */
|
|
@ -0,0 +1,58 @@
|
||||||
|
// Object Viewer Qt - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
|
||||||
|
// Copyright (C) 2010 Winch Gate Property Limited
|
||||||
|
// Copyright (C) 2011 Dzmitry Kamiahin <dnk-88@tut.by>
|
||||||
|
//
|
||||||
|
// 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 <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef SEARCH_PATHS_SETTINGS_PAGE_H
|
||||||
|
#define SEARCH_PATHS_SETTINGS_PAGE_H
|
||||||
|
|
||||||
|
#include <QtCore/QObject>
|
||||||
|
|
||||||
|
#include "ioptions_page.h"
|
||||||
|
|
||||||
|
#include "ui_search_paths_settings_page.h"
|
||||||
|
|
||||||
|
class QWidget;
|
||||||
|
|
||||||
|
namespace Core
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
@class CSearchPathsSettingsPage
|
||||||
|
*/
|
||||||
|
class CSearchPathsSettingsPage : public IOptionsPage
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
CSearchPathsSettingsPage(QObject *parent = 0);
|
||||||
|
virtual ~CSearchPathsSettingsPage() {}
|
||||||
|
|
||||||
|
virtual QString id() const;
|
||||||
|
virtual QString trName() const;
|
||||||
|
virtual QString category() const;
|
||||||
|
virtual QString trCategory() const;
|
||||||
|
virtual QWidget *createPage(QWidget *parent);
|
||||||
|
|
||||||
|
virtual void apply();
|
||||||
|
virtual void finish() {}
|
||||||
|
|
||||||
|
private:
|
||||||
|
QWidget *_currentPage;
|
||||||
|
Ui::CSearchPathsSettingsPage _ui;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace Core
|
||||||
|
|
||||||
|
#endif // SEARCH_PATHS_SETTINGS_H
|
|
@ -0,0 +1,108 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>CSearchPathsSettingsPage</class>
|
||||||
|
<widget class="QWidget" name="CSearchPathsSettingsPage">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>422</width>
|
||||||
|
<height>272</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Form</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QGroupBox" name="searchPathsGroupBox">
|
||||||
|
<property name="title">
|
||||||
|
<string>Search paths</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout_6">
|
||||||
|
<item row="0" column="0" rowspan="2">
|
||||||
|
<widget class="QListWidget" name="pathsListWidget"/>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
|
<item>
|
||||||
|
<widget class="QToolButton" name="addToolButton">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>...</string>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="../../object_viewer_qt.qrc">
|
||||||
|
<normaloff>:/images/list-add.png</normaloff>:/images/list-add.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="iconSize">
|
||||||
|
<size>
|
||||||
|
<width>16</width>
|
||||||
|
<height>16</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QToolButton" name="removeToolButton">
|
||||||
|
<property name="text">
|
||||||
|
<string>...</string>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="../../object_viewer_qt.qrc">
|
||||||
|
<normaloff>:/images/list-remove.png</normaloff>:/images/list-remove.png</iconset>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QToolButton" name="upToolButton">
|
||||||
|
<property name="text">
|
||||||
|
<string>...</string>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="../../object_viewer_qt.qrc">
|
||||||
|
<normaloff>:/images/go-up.png</normaloff>:/images/go-up.png</iconset>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QToolButton" name="downToolButton">
|
||||||
|
<property name="text">
|
||||||
|
<string>...</string>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="../../object_viewer_qt.qrc">
|
||||||
|
<normaloff>:/images/go-down.png</normaloff>:/images/go-down.png</iconset>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<spacer name="verticalSpacer_4">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>195</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<resources>
|
||||||
|
<include location="../../object_viewer_qt.qrc"/>
|
||||||
|
</resources>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
|
@ -0,0 +1,188 @@
|
||||||
|
// Object Viewer Qt - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
|
||||||
|
// Copyright (C) 2010 Winch Gate Property Limited
|
||||||
|
// Copyright (C) 2011 Dzmitry Kamiahin <dnk-88@tut.by>
|
||||||
|
// Parts by Nokia Corporation (qt-info@nokia.com) Copyright (C) 2009.
|
||||||
|
//
|
||||||
|
// 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 <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
#include "settings_dialog.h"
|
||||||
|
|
||||||
|
// Qt includes
|
||||||
|
#include <QtGui/QHeaderView>
|
||||||
|
#include <QtGui/QPushButton>
|
||||||
|
|
||||||
|
namespace Core
|
||||||
|
{
|
||||||
|
|
||||||
|
struct PageData
|
||||||
|
{
|
||||||
|
int index;
|
||||||
|
QString category;
|
||||||
|
QString id;
|
||||||
|
};
|
||||||
|
|
||||||
|
Q_DECLARE_METATYPE(PageData);
|
||||||
|
|
||||||
|
CSettingsDialog::CSettingsDialog(ExtensionSystem::IPluginManager *pluginManager,
|
||||||
|
const QString &categoryId,
|
||||||
|
const QString &pageId,
|
||||||
|
QWidget *parent)
|
||||||
|
: QDialog(parent),
|
||||||
|
_applied(false)
|
||||||
|
{
|
||||||
|
_ui.setupUi(this);
|
||||||
|
|
||||||
|
_plugMan = pluginManager;
|
||||||
|
|
||||||
|
QString initialCategory = categoryId;
|
||||||
|
QString initialPage = pageId;
|
||||||
|
|
||||||
|
_ui.buttonBox->button(QDialogButtonBox::Ok)->setDefault(true);
|
||||||
|
|
||||||
|
connect(_ui.buttonBox->button(QDialogButtonBox::Apply), SIGNAL(clicked()), this, SLOT(apply()));
|
||||||
|
|
||||||
|
_ui.splitter->setCollapsible(1, false);
|
||||||
|
_ui.pageTree->header()->setVisible(false);
|
||||||
|
|
||||||
|
connect(_ui.pageTree, SIGNAL(currentItemChanged(QTreeWidgetItem *, QTreeWidgetItem *)),
|
||||||
|
this, SLOT(pageSelected()));
|
||||||
|
|
||||||
|
QMap<QString, QTreeWidgetItem *> categories;
|
||||||
|
|
||||||
|
QList<IOptionsPage *> pages;
|
||||||
|
QList<QObject *> all = _plugMan->allObjects();
|
||||||
|
Q_FOREACH(QObject *obj, all)
|
||||||
|
{
|
||||||
|
IOptionsPage *page = qobject_cast<IOptionsPage *>(obj);
|
||||||
|
if (page)
|
||||||
|
pages.append(page);
|
||||||
|
}
|
||||||
|
|
||||||
|
int index = 0;
|
||||||
|
Q_FOREACH(IOptionsPage *page, pages)
|
||||||
|
{
|
||||||
|
PageData pageData;
|
||||||
|
pageData.index = index;
|
||||||
|
pageData.category = page->category();
|
||||||
|
pageData.id = page->id();
|
||||||
|
|
||||||
|
QTreeWidgetItem *item = new QTreeWidgetItem;
|
||||||
|
item->setText(0, page->trName());
|
||||||
|
item->setData(0, Qt::UserRole, qVariantFromValue(pageData));
|
||||||
|
|
||||||
|
QStringList categoriesId = page->category().split(QLatin1Char('|'));
|
||||||
|
QStringList trCategories = page->trCategory().split(QLatin1Char('|'));
|
||||||
|
QString currentCategory = categoriesId.at(0);
|
||||||
|
|
||||||
|
QTreeWidgetItem *treeitem;
|
||||||
|
if (!categories.contains(currentCategory))
|
||||||
|
{
|
||||||
|
treeitem = new QTreeWidgetItem(_ui.pageTree);
|
||||||
|
treeitem->setText(0, trCategories.at(0));
|
||||||
|
treeitem->setData(0, Qt::UserRole, qVariantFromValue(pageData));
|
||||||
|
categories.insert(currentCategory, treeitem);
|
||||||
|
}
|
||||||
|
|
||||||
|
int catCount = 1;
|
||||||
|
while (catCount < categoriesId.count())
|
||||||
|
{
|
||||||
|
if (!categories.contains(currentCategory + QLatin1Char('|') + categoriesId.at(catCount)))
|
||||||
|
{
|
||||||
|
treeitem = new QTreeWidgetItem(categories.value(currentCategory));
|
||||||
|
currentCategory += QLatin1Char('|') + categoriesId.at(catCount);
|
||||||
|
treeitem->setText(0, trCategories.at(catCount));
|
||||||
|
treeitem->setData(0, Qt::UserRole, qVariantFromValue(pageData));
|
||||||
|
categories.insert(currentCategory, treeitem);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
currentCategory += QLatin1Char('|') + categoriesId.at(catCount);
|
||||||
|
}
|
||||||
|
++catCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
categories.value(currentCategory)->addChild(item);
|
||||||
|
|
||||||
|
_pages.append(page);
|
||||||
|
_ui.stackedPages->addWidget(page->createPage(_ui.stackedPages));
|
||||||
|
|
||||||
|
if (page->id() == initialPage && currentCategory == initialCategory)
|
||||||
|
{
|
||||||
|
_ui.stackedPages->setCurrentIndex(_ui.stackedPages->count());
|
||||||
|
_ui.pageTree->setCurrentItem(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
index++;
|
||||||
|
}
|
||||||
|
|
||||||
|
QList<int> sizes;
|
||||||
|
sizes << 150 << 300;
|
||||||
|
_ui.splitter->setSizes(sizes);
|
||||||
|
|
||||||
|
_ui.splitter->setStretchFactor(_ui.splitter->indexOf(_ui.pageTree), 0);
|
||||||
|
_ui.splitter->setStretchFactor(_ui.splitter->indexOf(_ui.layoutWidget), 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
CSettingsDialog::~CSettingsDialog()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void CSettingsDialog::pageSelected()
|
||||||
|
{
|
||||||
|
QTreeWidgetItem *item = _ui.pageTree->currentItem();
|
||||||
|
PageData data = item->data(0, Qt::UserRole).value<PageData>();
|
||||||
|
int index = data.index;
|
||||||
|
_currentCategory = data.category;
|
||||||
|
_currentPage = data.id;
|
||||||
|
_ui.stackedPages->setCurrentIndex(index);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CSettingsDialog::accept()
|
||||||
|
{
|
||||||
|
_applied = true;
|
||||||
|
Q_FOREACH(IOptionsPage *page, _pages)
|
||||||
|
{
|
||||||
|
page->apply();
|
||||||
|
page->finish();
|
||||||
|
}
|
||||||
|
done(QDialog::Accepted);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CSettingsDialog::reject()
|
||||||
|
{
|
||||||
|
Q_FOREACH(IOptionsPage *page, _pages)
|
||||||
|
page->finish();
|
||||||
|
done(QDialog::Rejected);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CSettingsDialog::apply()
|
||||||
|
{
|
||||||
|
Q_FOREACH(IOptionsPage *page, _pages)
|
||||||
|
page->apply();
|
||||||
|
_applied = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CSettingsDialog::execDialog()
|
||||||
|
{
|
||||||
|
_applied = false;
|
||||||
|
exec();
|
||||||
|
return _applied;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CSettingsDialog::done(int val)
|
||||||
|
{
|
||||||
|
QDialog::done(val);
|
||||||
|
}
|
||||||
|
|
||||||
|
} /* namespace Core */
|
|
@ -0,0 +1,75 @@
|
||||||
|
// Object Viewer Qt - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
|
||||||
|
// Copyright (C) 2010 Winch Gate Property Limited
|
||||||
|
// Copyright (C) 2011 Dzmitry Kamiahin <dnk-88@tut.by>
|
||||||
|
// Parts by Nokia Corporation (qt-info@nokia.com) Copyright (C) 2009.
|
||||||
|
//
|
||||||
|
// 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 <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
#ifndef SETTINGS_DIALOG_H
|
||||||
|
#define SETTINGS_DIALOG_H
|
||||||
|
|
||||||
|
#include "ui_settings_dialog.h"
|
||||||
|
|
||||||
|
// Qt includes
|
||||||
|
#include <QtCore/QList>
|
||||||
|
|
||||||
|
// Project includes
|
||||||
|
#include "ioptions_page.h"
|
||||||
|
#include "../../extension_system/iplugin.h"
|
||||||
|
|
||||||
|
namespace Core
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class CSettingsDialog
|
||||||
|
@brief Settings dialog
|
||||||
|
*/
|
||||||
|
class CSettingsDialog: public QDialog
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
CSettingsDialog(ExtensionSystem::IPluginManager *pluginManager,
|
||||||
|
const QString &initialCategory = QString(),
|
||||||
|
const QString &initialPage = QString(),
|
||||||
|
QWidget *parent = 0);
|
||||||
|
|
||||||
|
~CSettingsDialog();
|
||||||
|
|
||||||
|
/// Run the dialog and return true if 'Ok' was choosen or 'Apply' was invoked at least once
|
||||||
|
bool execDialog();
|
||||||
|
|
||||||
|
public Q_SLOTS:
|
||||||
|
void done(int);
|
||||||
|
|
||||||
|
private Q_SLOTS:
|
||||||
|
void pageSelected();
|
||||||
|
void accept();
|
||||||
|
void reject();
|
||||||
|
void apply();
|
||||||
|
|
||||||
|
private:
|
||||||
|
QList<Core::IOptionsPage*> _pages;
|
||||||
|
bool _applied;
|
||||||
|
QString _currentCategory;
|
||||||
|
QString _currentPage;
|
||||||
|
|
||||||
|
ExtensionSystem::IPluginManager *_plugMan;
|
||||||
|
|
||||||
|
Ui::CSettingsDialog _ui;
|
||||||
|
}; /* class CSettingsDialog */
|
||||||
|
|
||||||
|
} /* namespace Core */
|
||||||
|
|
||||||
|
#endif // SETTINGS_DIALOG_H
|
|
@ -0,0 +1,126 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>CSettingsDialog</class>
|
||||||
|
<widget class="QDialog" name="CSettingsDialog">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>697</width>
|
||||||
|
<height>476</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Settings</string>
|
||||||
|
</property>
|
||||||
|
<property name="windowIcon">
|
||||||
|
<iconset resource="core.qrc">
|
||||||
|
<normaloff>:/core/images/preferences.png</normaloff>:/core/images/preferences.png</iconset>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout">
|
||||||
|
<property name="spacing">
|
||||||
|
<number>6</number>
|
||||||
|
</property>
|
||||||
|
<property name="margin">
|
||||||
|
<number>9</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="QSplitter" name="splitter">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<widget class="QTreeWidget" name="pageTree">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="columnCount">
|
||||||
|
<number>1</number>
|
||||||
|
</property>
|
||||||
|
<column>
|
||||||
|
<property name="text">
|
||||||
|
<string>0</string>
|
||||||
|
</property>
|
||||||
|
</column>
|
||||||
|
</widget>
|
||||||
|
<widget class="QWidget" name="layoutWidget">
|
||||||
|
<layout class="QVBoxLayout">
|
||||||
|
<property name="spacing">
|
||||||
|
<number>6</number>
|
||||||
|
</property>
|
||||||
|
<property name="margin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="QStackedWidget" name="stackedPages">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>350</width>
|
||||||
|
<height>250</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="Line" name="line">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QDialogButtonBox" name="buttonBox">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="standardButtons">
|
||||||
|
<set>QDialogButtonBox::Apply|QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<resources>
|
||||||
|
<include location="core.qrc"/>
|
||||||
|
</resources>
|
||||||
|
<connections>
|
||||||
|
<connection>
|
||||||
|
<sender>buttonBox</sender>
|
||||||
|
<signal>accepted()</signal>
|
||||||
|
<receiver>CSettingsDialog</receiver>
|
||||||
|
<slot>accept()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>297</x>
|
||||||
|
<y>361</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>297</x>
|
||||||
|
<y>193</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>buttonBox</sender>
|
||||||
|
<signal>rejected()</signal>
|
||||||
|
<receiver>CSettingsDialog</receiver>
|
||||||
|
<slot>reject()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>297</x>
|
||||||
|
<y>361</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>297</x>
|
||||||
|
<y>193</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
</connections>
|
||||||
|
</ui>
|
|
@ -13,15 +13,15 @@
|
||||||
|
|
||||||
using namespace Plugin;
|
using namespace Plugin;
|
||||||
|
|
||||||
bool MyPlugin::initialize(NLQT::IPluginManager *pluginManager, QString *errorString)
|
bool MyPlugin::initialize(ExtensionSystem::IPluginManager *pluginManager, QString *errorString)
|
||||||
{
|
{
|
||||||
Q_UNUSED(errorString);
|
Q_UNUSED(errorString);
|
||||||
_plugMan = pluginManager;
|
_plugMan = pluginManager;
|
||||||
QString str;
|
QString str;
|
||||||
|
|
||||||
QList<NLQT::IPluginSpec *> listPlug = pluginManager->plugins();
|
QList<ExtensionSystem::IPluginSpec *> listPlug = pluginManager->plugins();
|
||||||
|
|
||||||
Q_FOREACH (NLQT::IPluginSpec *plugSpec, listPlug)
|
Q_FOREACH (ExtensionSystem::IPluginSpec *plugSpec, listPlug)
|
||||||
str += plugSpec->name();
|
str += plugSpec->name();
|
||||||
|
|
||||||
nlinfo(str.toStdString().c_str());
|
nlinfo(str.toStdString().c_str());
|
||||||
|
@ -99,9 +99,9 @@ QObject* MyPlugin::objectByName(const QString &name) const
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
NLQT::IPluginSpec *MyPlugin::pluginByName(const QString &name) const
|
ExtensionSystem::IPluginSpec *MyPlugin::pluginByName(const QString &name) const
|
||||||
{
|
{
|
||||||
Q_FOREACH (NLQT::IPluginSpec *spec, _plugMan->plugins())
|
Q_FOREACH (ExtensionSystem::IPluginSpec *spec, _plugMan->plugins())
|
||||||
if (spec->name() == name)
|
if (spec->name() == name)
|
||||||
return spec;
|
return spec;
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -12,7 +12,7 @@ namespace NLMISC
|
||||||
class CLibraryContext;
|
class CLibraryContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace NLQT
|
namespace ExtensionSystem
|
||||||
{
|
{
|
||||||
class IPluginSpec;
|
class IPluginSpec;
|
||||||
}
|
}
|
||||||
|
@ -20,13 +20,13 @@ class IPluginSpec;
|
||||||
namespace Plugin
|
namespace Plugin
|
||||||
{
|
{
|
||||||
|
|
||||||
class MyPlugin : public QObject, public NLQT::IPlugin
|
class MyPlugin : public QObject, public ExtensionSystem::IPlugin
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_INTERFACES(NLQT::IPlugin)
|
Q_INTERFACES(ExtensionSystem::IPlugin)
|
||||||
public:
|
public:
|
||||||
|
|
||||||
bool initialize(NLQT::IPluginManager *pluginManager, QString *errorString);
|
bool initialize(ExtensionSystem::IPluginManager *pluginManager, QString *errorString);
|
||||||
void extensionsInitialized();
|
void extensionsInitialized();
|
||||||
|
|
||||||
void setNelContext(NLMISC::INelContext *nelContext);
|
void setNelContext(NLMISC::INelContext *nelContext);
|
||||||
|
@ -37,7 +37,7 @@ public:
|
||||||
QString description() const;
|
QString description() const;
|
||||||
|
|
||||||
QObject *objectByName(const QString &name) const;
|
QObject *objectByName(const QString &name) const;
|
||||||
NLQT::IPluginSpec *pluginByName(const QString &name) const;
|
ExtensionSystem::IPluginSpec *pluginByName(const QString &name) const;
|
||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void execMessageBox();
|
void execMessageBox();
|
||||||
|
@ -46,10 +46,10 @@ protected:
|
||||||
NLMISC::CLibraryContext *_LibContext;
|
NLMISC::CLibraryContext *_LibContext;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
NLQT::IPluginManager *_plugMan;
|
ExtensionSystem::IPluginManager *_plugMan;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Plugin1
|
} // namespace Plugin
|
||||||
|
|
||||||
#endif // PLUGIN1_H
|
#endif // PLUGIN1_H
|
||||||
|
|
|
@ -55,7 +55,7 @@ CLogPlugin::~CLogPlugin()
|
||||||
delete _displayer;
|
delete _displayer;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CLogPlugin::initialize(NLQT::IPluginManager *pluginManager, QString *errorString)
|
bool CLogPlugin::initialize(ExtensionSystem::IPluginManager *pluginManager, QString *errorString)
|
||||||
{
|
{
|
||||||
Q_UNUSED(errorString);
|
Q_UNUSED(errorString);
|
||||||
_plugMan = pluginManager;
|
_plugMan = pluginManager;
|
||||||
|
@ -120,9 +120,9 @@ QObject* CLogPlugin::objectByName(const QString &name) const
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
NLQT::IPluginSpec *CLogPlugin::pluginByName(const QString &name) const
|
ExtensionSystem::IPluginSpec *CLogPlugin::pluginByName(const QString &name) const
|
||||||
{
|
{
|
||||||
Q_FOREACH (NLQT::IPluginSpec *spec, _plugMan->plugins())
|
Q_FOREACH (ExtensionSystem::IPluginSpec *spec, _plugMan->plugins())
|
||||||
if (spec->name() == name)
|
if (spec->name() == name)
|
||||||
return spec;
|
return spec;
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -35,24 +35,28 @@ namespace NLMISC
|
||||||
class CLibraryContext;
|
class CLibraryContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace NLQT
|
namespace ExtensionSystem
|
||||||
{
|
{
|
||||||
class IPluginSpec;
|
class IPluginSpec;
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace NLQT
|
||||||
|
{
|
||||||
class CQtDisplayer;
|
class CQtDisplayer;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace Plugin
|
namespace Plugin
|
||||||
{
|
{
|
||||||
|
|
||||||
class CLogPlugin : public QDockWidget, public NLQT::IPlugin
|
class CLogPlugin : public QDockWidget, public ExtensionSystem::IPlugin
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_INTERFACES(NLQT::IPlugin)
|
Q_INTERFACES(ExtensionSystem::IPlugin)
|
||||||
public:
|
public:
|
||||||
CLogPlugin(QWidget *parent = 0);
|
CLogPlugin(QWidget *parent = 0);
|
||||||
~CLogPlugin();
|
~CLogPlugin();
|
||||||
|
|
||||||
bool initialize(NLQT::IPluginManager *pluginManager, QString *errorString);
|
bool initialize(ExtensionSystem::IPluginManager *pluginManager, QString *errorString);
|
||||||
void extensionsInitialized();
|
void extensionsInitialized();
|
||||||
|
|
||||||
void setNelContext(NLMISC::INelContext *nelContext);
|
void setNelContext(NLMISC::INelContext *nelContext);
|
||||||
|
@ -63,13 +67,13 @@ namespace Plugin
|
||||||
QString description() const;
|
QString description() const;
|
||||||
|
|
||||||
QObject *objectByName(const QString &name) const;
|
QObject *objectByName(const QString &name) const;
|
||||||
NLQT::IPluginSpec *pluginByName(const QString &name) const;
|
ExtensionSystem::IPluginSpec *pluginByName(const QString &name) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
NLMISC::CLibraryContext *_LibContext;
|
NLMISC::CLibraryContext *_LibContext;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
NLQT::IPluginManager *_plugMan;
|
ExtensionSystem::IPluginManager *_plugMan;
|
||||||
|
|
||||||
Ui::CLogPlugin _ui;
|
Ui::CLogPlugin _ui;
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
|
|
||||||
using namespace Plugin;
|
using namespace Plugin;
|
||||||
|
|
||||||
bool SheetBuilderPlugin::initialize(NLQT::IPluginManager *pluginManager, QString *errorString)
|
bool SheetBuilderPlugin::initialize(ExtensionSystem::IPluginManager *pluginManager, QString *errorString)
|
||||||
{
|
{
|
||||||
Q_UNUSED(errorString);
|
Q_UNUSED(errorString);
|
||||||
_plugMan = pluginManager;
|
_plugMan = pluginManager;
|
||||||
|
@ -100,6 +100,11 @@ QString SheetBuilderPlugin::description() const
|
||||||
return "make_sheet_id equivalent";
|
return "make_sheet_id equivalent";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QList<QString> SheetBuilderPlugin::dependencies() const
|
||||||
|
{
|
||||||
|
return QList<QString>();
|
||||||
|
}
|
||||||
|
|
||||||
QObject* SheetBuilderPlugin::objectByName(const QString &name) const
|
QObject* SheetBuilderPlugin::objectByName(const QString &name) const
|
||||||
{
|
{
|
||||||
Q_FOREACH (QObject *qobj, _plugMan->allObjects())
|
Q_FOREACH (QObject *qobj, _plugMan->allObjects())
|
||||||
|
@ -108,9 +113,9 @@ QObject* SheetBuilderPlugin::objectByName(const QString &name) const
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
NLQT::IPluginSpec *SheetBuilderPlugin::pluginByName(const QString &name) const
|
ExtensionSystem::IPluginSpec *SheetBuilderPlugin::pluginByName(const QString &name) const
|
||||||
{
|
{
|
||||||
Q_FOREACH (NLQT::IPluginSpec *spec, _plugMan->plugins())
|
Q_FOREACH (ExtensionSystem::IPluginSpec *spec, _plugMan->plugins())
|
||||||
if (spec->name() == name)
|
if (spec->name() == name)
|
||||||
return spec;
|
return spec;
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -28,7 +28,7 @@ namespace NLMISC
|
||||||
class CLibraryContext;
|
class CLibraryContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace NLQT
|
namespace ExtensionSystem
|
||||||
{
|
{
|
||||||
class IPluginSpec;
|
class IPluginSpec;
|
||||||
}
|
}
|
||||||
|
@ -36,12 +36,12 @@ namespace NLQT
|
||||||
namespace Plugin
|
namespace Plugin
|
||||||
{
|
{
|
||||||
|
|
||||||
class SheetBuilderPlugin : public QObject, public NLQT::IPlugin
|
class SheetBuilderPlugin : public QObject, public ExtensionSystem::IPlugin
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_INTERFACES(NLQT::IPlugin)
|
Q_INTERFACES(ExtensionSystem::IPlugin)
|
||||||
public:
|
public:
|
||||||
bool initialize(NLQT::IPluginManager *pluginManager, QString *errorString);
|
bool initialize(ExtensionSystem::IPluginManager *pluginManager, QString *errorString);
|
||||||
void extensionsInitialized();
|
void extensionsInitialized();
|
||||||
|
|
||||||
void setNelContext(NLMISC::INelContext *nelContext);
|
void setNelContext(NLMISC::INelContext *nelContext);
|
||||||
|
@ -50,9 +50,9 @@ namespace Plugin
|
||||||
QString version() const;
|
QString version() const;
|
||||||
QString vendor() const;
|
QString vendor() const;
|
||||||
QString description() const;
|
QString description() const;
|
||||||
|
QList<QString> dependencies() const;
|
||||||
QObject *objectByName(const QString &name) const;
|
QObject *objectByName(const QString &name) const;
|
||||||
NLQT::IPluginSpec *pluginByName(const QString &name) const;
|
ExtensionSystem::IPluginSpec *pluginByName(const QString &name) const;
|
||||||
|
|
||||||
void buildSheet(bool clean);
|
void buildSheet(bool clean);
|
||||||
|
|
||||||
|
@ -63,7 +63,7 @@ namespace Plugin
|
||||||
NLMISC::CLibraryContext *_LibContext;
|
NLMISC::CLibraryContext *_LibContext;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
NLQT::IPluginManager *_plugMan;
|
ExtensionSystem::IPluginManager *_plugMan;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue