Fix line endings

This commit is contained in:
kaetemi 2013-09-27 00:08:49 +02:00
parent 6569d32125
commit 04c28d5f63
14 changed files with 1846 additions and 1846 deletions

View file

@ -15,35 +15,35 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef EXPANDABLE_HEADERVIEW_H
#define EXPANDABLE_HEADERVIEW_H
// Qt includes
#include <QHeaderView>
namespace GeorgesQt
{
class ExpandableHeaderView : public QHeaderView
{
Q_OBJECT
public:
ExpandableHeaderView(Qt::Orientation orientation, QWidget * parent = 0);
bool* expanded() { return &m_expanded; }
protected:
void paintSection(QPainter *painter, const QRect &rect, int logicalIndex) const;
bool isPointInDecoration(int section, QPoint pos)const;
void mousePressEvent(QMouseEvent *event);
void mouseMoveEvent(QMouseEvent *event);
private:
bool m_expanded;
bool m_inDecoration;
Q_SIGNALS:
void headerClicked(int);
};
} /* namespace NLQT */
#endif // EXPANDABLE_HEADERVIEW_H
#define EXPANDABLE_HEADERVIEW_H
// Qt includes
#include <QHeaderView>
namespace GeorgesQt
{
class ExpandableHeaderView : public QHeaderView
{
Q_OBJECT
public:
ExpandableHeaderView(Qt::Orientation orientation, QWidget * parent = 0);
bool* expanded() { return &m_expanded; }
protected:
void paintSection(QPainter *painter, const QRect &rect, int logicalIndex) const;
bool isPointInDecoration(int section, QPoint pos)const;
void mousePressEvent(QMouseEvent *event);
void mouseMoveEvent(QMouseEvent *event);
private:
bool m_expanded;
bool m_inDecoration;
Q_SIGNALS:
void headerClicked(int);
};
} /* namespace NLQT */
#endif // EXPANDABLE_HEADERVIEW_H

View file

@ -1,191 +1,191 @@
// Object Viewer Qt - Log Plugin - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// Copyright (C) 2011 Adrian Jaekel <aj at elane2k dot com>
//
// 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 "log_plugin.h"
#include "log_settings_page.h"
#include "qt_displayer.h"
#include "../core/icore.h"
#include "../core/core_constants.h"
#include "../core/menu_manager.h"
#include "../../extension_system/iplugin_spec.h"
// Qt includes
#include <QtCore/QObject>
#include <QtGui/QMessageBox>
#include <QtGui/QMainWindow>
#include <QtGui/QMenu>
#include <QtGui/QAction>
#include <QtGui/QMenuBar>
#include <QtGui/QWidget>
#include <QFile>
#include <QDateTime>
#include <QTextStream>
// NeL includes
#include <nel/misc/debug.h>
namespace Plugin
{
CLogPlugin::CLogPlugin(QWidget *parent): QDockWidget(parent)
{
m_ui.setupUi(this);
}
CLogPlugin::~CLogPlugin()
{
Q_FOREACH(QObject *obj, m_autoReleaseObjects)
{
m_plugMan->removeObject(obj);
}
qDeleteAll(m_autoReleaseObjects);
m_autoReleaseObjects.clear();
NLMISC::ErrorLog->removeDisplayer(m_displayer);
NLMISC::WarningLog->removeDisplayer(m_displayer);
NLMISC::DebugLog->removeDisplayer(m_displayer);
NLMISC::AssertLog->removeDisplayer(m_displayer);
NLMISC::InfoLog->removeDisplayer(m_displayer);
delete m_displayer;
}
bool CLogPlugin::initialize(ExtensionSystem::IPluginManager *pluginManager, QString *errorString)
{
Q_UNUSED(errorString);
m_plugMan = pluginManager;
m_logSettingsPage = new CLogSettingsPage(this, this);
addAutoReleasedObject(m_logSettingsPage);
return true;
}
void CLogPlugin::extensionsInitialized()
{
setDisplayers();
Core::ICore *core = Core::ICore::instance();
Core::MenuManager *menuManager = core->menuManager();
QMenu *viewMenu = menuManager->menu(Core::Constants::M_VIEW);
QMainWindow *wnd = Core::ICore::instance()->mainWindow();
wnd->addDockWidget(Qt::RightDockWidgetArea, this);
hide();
viewMenu->addAction(this->toggleViewAction());
}
void CLogPlugin::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 // fdef NL_OS_WINDOWS^M
m_libContext = new NLMISC::CLibraryContext(*nelContext);
m_displayer = new NLQT::CQtDisplayer(m_ui.plainTextEdit);
}
QString CLogPlugin::name() const
{
return "LogPlugin";
}
QString CLogPlugin::version() const
{
return "1.1";
}
QString CLogPlugin::vendor() const
{
return "aquiles";
}
QString CLogPlugin::description() const
{
return tr("DockWidget to display all log messages from NeL.");
}
QStringList CLogPlugin::dependencies() const
{
QStringList list;
list.append(Core::Constants::OVQT_CORE_PLUGIN);
return list;
}
void CLogPlugin::addAutoReleasedObject(QObject *obj)
{
m_plugMan->addObject(obj);
m_autoReleaseObjects.prepend(obj);
}
void CLogPlugin::setDisplayers()
{
QSettings *settings = Core::ICore::instance()->settings();
settings->beginGroup(Core::Constants::LOG_SECTION);
// Object Viewer Qt - Log Plugin - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// Copyright (C) 2011 Adrian Jaekel <aj at elane2k dot com>
//
// 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 "log_plugin.h"
#include "log_settings_page.h"
#include "qt_displayer.h"
#include "../core/icore.h"
#include "../core/core_constants.h"
#include "../core/menu_manager.h"
#include "../../extension_system/iplugin_spec.h"
// Qt includes
#include <QtCore/QObject>
#include <QtGui/QMessageBox>
#include <QtGui/QMainWindow>
#include <QtGui/QMenu>
#include <QtGui/QAction>
#include <QtGui/QMenuBar>
#include <QtGui/QWidget>
#include <QFile>
#include <QDateTime>
#include <QTextStream>
// NeL includes
#include <nel/misc/debug.h>
namespace Plugin
{
CLogPlugin::CLogPlugin(QWidget *parent): QDockWidget(parent)
{
m_ui.setupUi(this);
}
CLogPlugin::~CLogPlugin()
{
Q_FOREACH(QObject *obj, m_autoReleaseObjects)
{
m_plugMan->removeObject(obj);
}
qDeleteAll(m_autoReleaseObjects);
m_autoReleaseObjects.clear();
NLMISC::ErrorLog->removeDisplayer(m_displayer);
NLMISC::WarningLog->removeDisplayer(m_displayer);
NLMISC::DebugLog->removeDisplayer(m_displayer);
NLMISC::AssertLog->removeDisplayer(m_displayer);
NLMISC::InfoLog->removeDisplayer(m_displayer);
delete m_displayer;
}
bool CLogPlugin::initialize(ExtensionSystem::IPluginManager *pluginManager, QString *errorString)
{
Q_UNUSED(errorString);
m_plugMan = pluginManager;
m_logSettingsPage = new CLogSettingsPage(this, this);
addAutoReleasedObject(m_logSettingsPage);
return true;
}
void CLogPlugin::extensionsInitialized()
{
setDisplayers();
Core::ICore *core = Core::ICore::instance();
Core::MenuManager *menuManager = core->menuManager();
QMenu *viewMenu = menuManager->menu(Core::Constants::M_VIEW);
QMainWindow *wnd = Core::ICore::instance()->mainWindow();
wnd->addDockWidget(Qt::RightDockWidgetArea, this);
hide();
viewMenu->addAction(this->toggleViewAction());
}
void CLogPlugin::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 // fdef NL_OS_WINDOWS^M
m_libContext = new NLMISC::CLibraryContext(*nelContext);
m_displayer = new NLQT::CQtDisplayer(m_ui.plainTextEdit);
}
QString CLogPlugin::name() const
{
return "LogPlugin";
}
QString CLogPlugin::version() const
{
return "1.1";
}
QString CLogPlugin::vendor() const
{
return "aquiles";
}
QString CLogPlugin::description() const
{
return tr("DockWidget to display all log messages from NeL.");
}
QStringList CLogPlugin::dependencies() const
{
QStringList list;
list.append(Core::Constants::OVQT_CORE_PLUGIN);
return list;
}
void CLogPlugin::addAutoReleasedObject(QObject *obj)
{
m_plugMan->addObject(obj);
m_autoReleaseObjects.prepend(obj);
}
void CLogPlugin::setDisplayers()
{
QSettings *settings = Core::ICore::instance()->settings();
settings->beginGroup(Core::Constants::LOG_SECTION);
bool error = settings->value(Core::Constants::LOG_ERROR, true).toBool();
bool warning = settings->value(Core::Constants::LOG_WARNING, true).toBool();
bool debug = settings->value(Core::Constants::LOG_DEBUG, true).toBool();
bool assert = settings->value(Core::Constants::LOG_ASSERT, true).toBool();
bool info = settings->value(Core::Constants::LOG_INFO, true).toBool();
settings->endGroup();
if (error) {
if (!NLMISC::ErrorLog->attached(m_displayer))
NLMISC::ErrorLog->addDisplayer(m_displayer);
} else {
if (m_displayer) {
NLMISC::ErrorLog->removeDisplayer(m_displayer);
}
}
if (warning) {
if (!NLMISC::WarningLog->attached(m_displayer))
NLMISC::WarningLog->addDisplayer(m_displayer);
} else {
if (m_displayer) {
NLMISC::WarningLog->removeDisplayer(m_displayer);
}
}
if (debug) {
if (!NLMISC::DebugLog->attached(m_displayer))
NLMISC::DebugLog->addDisplayer(m_displayer);
} else {
if (m_displayer) {
NLMISC::DebugLog->removeDisplayer(m_displayer);
}
}
if (assert) {
if (!NLMISC::AssertLog->attached(m_displayer))
NLMISC::AssertLog->addDisplayer(m_displayer);
} else {
if (m_displayer) {
NLMISC::AssertLog->removeDisplayer(m_displayer);
}
}
if (info) {
if (!NLMISC::InfoLog->attached(m_displayer))
NLMISC::InfoLog->addDisplayer(m_displayer);
} else {
if (m_displayer) {
NLMISC::InfoLog->removeDisplayer(m_displayer);
}
}
}
}
Q_EXPORT_PLUGIN(Plugin::CLogPlugin)
bool info = settings->value(Core::Constants::LOG_INFO, true).toBool();
settings->endGroup();
if (error) {
if (!NLMISC::ErrorLog->attached(m_displayer))
NLMISC::ErrorLog->addDisplayer(m_displayer);
} else {
if (m_displayer) {
NLMISC::ErrorLog->removeDisplayer(m_displayer);
}
}
if (warning) {
if (!NLMISC::WarningLog->attached(m_displayer))
NLMISC::WarningLog->addDisplayer(m_displayer);
} else {
if (m_displayer) {
NLMISC::WarningLog->removeDisplayer(m_displayer);
}
}
if (debug) {
if (!NLMISC::DebugLog->attached(m_displayer))
NLMISC::DebugLog->addDisplayer(m_displayer);
} else {
if (m_displayer) {
NLMISC::DebugLog->removeDisplayer(m_displayer);
}
}
if (assert) {
if (!NLMISC::AssertLog->attached(m_displayer))
NLMISC::AssertLog->addDisplayer(m_displayer);
} else {
if (m_displayer) {
NLMISC::AssertLog->removeDisplayer(m_displayer);
}
}
if (info) {
if (!NLMISC::InfoLog->attached(m_displayer))
NLMISC::InfoLog->addDisplayer(m_displayer);
} else {
if (m_displayer) {
NLMISC::InfoLog->removeDisplayer(m_displayer);
}
}
}
}
Q_EXPORT_PLUGIN(Plugin::CLogPlugin)

View file

@ -1,33 +1,33 @@
/*
Log Plugin Qt
Copyright (C) 2011 Adrian Jaekel <aj at elane2k dot com>
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/>.
/*
Log Plugin Qt
Copyright (C) 2011 Adrian Jaekel <aj at elane2k dot com>
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 LOG_PLUGIN_H
#define LOG_PLUGIN_H
// Project includes
// Project includes
#include "ui_log_form.h"
#include "../../extension_system/iplugin.h"
// NeL includes
#include "nel/misc/app_context.h"
// Qt includes
// Qt includes
#include <QDockWidget>
namespace NLMISC
@ -54,7 +54,7 @@ namespace Plugin
Q_OBJECT
Q_INTERFACES(ExtensionSystem::IPlugin)
public:
CLogPlugin(QWidget *parent = 0);
CLogPlugin(QWidget *parent = 0);
~CLogPlugin();
bool initialize(ExtensionSystem::IPluginManager *pluginManager, QString *errorString);
@ -63,26 +63,26 @@ namespace Plugin
void setNelContext(NLMISC::INelContext *nelContext);
NLQT::CQtDisplayer* displayer() { return m_displayer; }
QString name() const;
QString version() const;
QString vendor() const;
QString name() const;
QString version() const;
QString vendor() const;
QString description() const;
QStringList dependencies() const;
void addAutoReleasedObject(QObject *obj);
void setDisplayers();
protected:
NLMISC::CLibraryContext *m_libContext;
QStringList dependencies() const;
void addAutoReleasedObject(QObject *obj);
void setDisplayers();
protected:
NLMISC::CLibraryContext *m_libContext;
private:
ExtensionSystem::IPluginManager *m_plugMan;
QList<QObject *> m_autoReleaseObjects;
CLogSettingsPage *m_logSettingsPage;
Ui::CLogPlugin m_ui;
Ui::CLogPlugin m_ui;
NLQT::CQtDisplayer *m_displayer;
};

View file

@ -1,133 +1,133 @@
// Object Viewer Qt - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
// Copyright (C) 2010 Winch Gate Property Limited
// Copyright (C) 2011 Adrian Jaekel <aj at elane2k dot com>
//
// 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 "log_settings_page.h"
#include "log_plugin.h"
#include "../core/core_constants.h"
#include "../core/icore.h"
#include "../../extension_system/plugin_manager.h"
// NeL includes
// Qt includes
#include <QtGui/QWidget>
#include <QtCore/QSettings>
// Object Viewer Qt - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
// Copyright (C) 2010 Winch Gate Property Limited
// Copyright (C) 2011 Adrian Jaekel <aj at elane2k dot com>
//
// 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 "log_settings_page.h"
#include "log_plugin.h"
#include "../core/core_constants.h"
#include "../core/icore.h"
#include "../../extension_system/plugin_manager.h"
// NeL includes
// Qt includes
#include <QtGui/QWidget>
#include <QtCore/QSettings>
namespace ExtensionSystem
{
class IPluginManager;
}
namespace Plugin
{
class CLogPlugin;
CLogSettingsPage::CLogSettingsPage(CLogPlugin *logPlugin, QObject *parent)
: IOptionsPage(parent),
m_logPlugin(logPlugin),
m_currentPage(NULL),
class IPluginManager;
}
namespace Plugin
{
class CLogPlugin;
CLogSettingsPage::CLogSettingsPage(CLogPlugin *logPlugin, QObject *parent)
: IOptionsPage(parent),
m_logPlugin(logPlugin),
m_currentPage(NULL),
m_error(true),
m_warning(true),
m_debug(true),
m_assert(true),
m_info(true)
{
}
QString CLogSettingsPage::id() const
{
return QLatin1String("log");
}
QString CLogSettingsPage::trName() const
{
return tr("Log");
}
QString CLogSettingsPage::category() const
{
return QLatin1String(Core::Constants::SETTINGS_CATEGORY_GENERAL);
}
QString CLogSettingsPage::trCategory() const
{
return tr(Core::Constants::SETTINGS_TR_CATEGORY_GENERAL);
}
QIcon CLogSettingsPage::categoryIcon() const
{
return QIcon();
}
QWidget *CLogSettingsPage::createPage(QWidget *parent)
{
m_currentPage = new QWidget(parent);
m_ui.setupUi(m_currentPage);
readSettings();
m_ui.errorCheck->setChecked(m_error);
m_ui.warningCheck->setChecked(m_warning);
m_ui.debugCheck->setChecked(m_debug);
m_ui.assertCheck->setChecked(m_assert);
m_ui.infoCheck->setChecked(m_info);
return m_currentPage;
}
void CLogSettingsPage::apply()
{
m_error = m_ui.errorCheck->isChecked();
m_warning = m_ui.warningCheck->isChecked();
m_debug = m_ui.debugCheck->isChecked();
m_assert = m_ui.assertCheck->isChecked();
m_info = m_ui.infoCheck->isChecked();
writeSettings();
m_logPlugin->setDisplayers();
}
void CLogSettingsPage::readSettings()
{
QSettings *settings = Core::ICore::instance()->settings();
settings->beginGroup(Core::Constants::LOG_SECTION);
m_info(true)
{
}
QString CLogSettingsPage::id() const
{
return QLatin1String("log");
}
QString CLogSettingsPage::trName() const
{
return tr("Log");
}
QString CLogSettingsPage::category() const
{
return QLatin1String(Core::Constants::SETTINGS_CATEGORY_GENERAL);
}
QString CLogSettingsPage::trCategory() const
{
return tr(Core::Constants::SETTINGS_TR_CATEGORY_GENERAL);
}
QIcon CLogSettingsPage::categoryIcon() const
{
return QIcon();
}
QWidget *CLogSettingsPage::createPage(QWidget *parent)
{
m_currentPage = new QWidget(parent);
m_ui.setupUi(m_currentPage);
readSettings();
m_ui.errorCheck->setChecked(m_error);
m_ui.warningCheck->setChecked(m_warning);
m_ui.debugCheck->setChecked(m_debug);
m_ui.assertCheck->setChecked(m_assert);
m_ui.infoCheck->setChecked(m_info);
return m_currentPage;
}
void CLogSettingsPage::apply()
{
m_error = m_ui.errorCheck->isChecked();
m_warning = m_ui.warningCheck->isChecked();
m_debug = m_ui.debugCheck->isChecked();
m_assert = m_ui.assertCheck->isChecked();
m_info = m_ui.infoCheck->isChecked();
writeSettings();
m_logPlugin->setDisplayers();
}
void CLogSettingsPage::readSettings()
{
QSettings *settings = Core::ICore::instance()->settings();
settings->beginGroup(Core::Constants::LOG_SECTION);
m_error = settings->value(Core::Constants::LOG_ERROR, true).toBool();
m_warning = settings->value(Core::Constants::LOG_WARNING, true).toBool();
m_debug = settings->value(Core::Constants::LOG_DEBUG, true).toBool();
m_assert = settings->value(Core::Constants::LOG_ASSERT, true).toBool();
m_info = settings->value(Core::Constants::LOG_INFO, true).toBool();
settings->endGroup();
}
void CLogSettingsPage::writeSettings()
{
QSettings *settings = Core::ICore::instance()->settings();
settings->beginGroup(Core::Constants::LOG_SECTION);
settings->setValue(Core::Constants::LOG_ERROR, m_error);
settings->setValue(Core::Constants::LOG_WARNING, m_warning);
settings->setValue(Core::Constants::LOG_DEBUG, m_debug);
settings->setValue(Core::Constants::LOG_ASSERT, m_assert);
settings->setValue(Core::Constants::LOG_INFO, m_info);
settings->endGroup();
settings->sync();
}
m_info = settings->value(Core::Constants::LOG_INFO, true).toBool();
settings->endGroup();
}
void CLogSettingsPage::writeSettings()
{
QSettings *settings = Core::ICore::instance()->settings();
settings->beginGroup(Core::Constants::LOG_SECTION);
settings->setValue(Core::Constants::LOG_ERROR, m_error);
settings->setValue(Core::Constants::LOG_WARNING, m_warning);
settings->setValue(Core::Constants::LOG_DEBUG, m_debug);
settings->setValue(Core::Constants::LOG_ASSERT, m_assert);
settings->setValue(Core::Constants::LOG_INFO, m_info);
settings->endGroup();
settings->sync();
}
} /* namespace Plugin */

View file

@ -1,56 +1,56 @@
#ifndef MISSION_COMPILER_MAIN_WINDOW_H
#define MISSION_COMPILER_MAIN_WINDOW_H
#include <QMainWindow>
#include <QTimer>
#include <QLabel>
#include <QAction>
#include <QtGui/QUndoStack>
#include <QStringListModel>
#include <QSortFilterProxyModel>
#include <QRegExp>
#include <nel/ligo/ligo_config.h>
#include <nel/ligo/primitive.h>
namespace Ui {
class MissionCompilerMainWindow;
}
struct CMission;
class MissionCompilerMainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MissionCompilerMainWindow(QWidget *parent = 0);
~MissionCompilerMainWindow();
void loadConfig();
void saveConfig();
QUndoStack *getUndoStack() { return m_undoStack; }
typedef std::map<std::string, CMission> TMissionContainer;
public Q_SLOTS:
void handleFilterChanged(const QString &text);
void handleValidation();
void handleCompile();
void handlePublish();
void handleAllDoubleClick(const QModelIndex &index);
void handleSelDoubleClick(const QModelIndex &index);
void handleMoveSelectedRight();
void handleMoveSelectedLeft();
void handleMoveAllRight();
void handleMoveAllLeft();
void handleDataDirButton();
void handleDataDirChanged(const QString &text);
void handleResetFiltersButton();
void handleChangedSettings();
private:
Ui::MissionCompilerMainWindow *ui;
#ifndef MISSION_COMPILER_MAIN_WINDOW_H
#define MISSION_COMPILER_MAIN_WINDOW_H
#include <QMainWindow>
#include <QTimer>
#include <QLabel>
#include <QAction>
#include <QtGui/QUndoStack>
#include <QStringListModel>
#include <QSortFilterProxyModel>
#include <QRegExp>
#include <nel/ligo/ligo_config.h>
#include <nel/ligo/primitive.h>
namespace Ui {
class MissionCompilerMainWindow;
}
struct CMission;
class MissionCompilerMainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MissionCompilerMainWindow(QWidget *parent = 0);
~MissionCompilerMainWindow();
void loadConfig();
void saveConfig();
QUndoStack *getUndoStack() { return m_undoStack; }
typedef std::map<std::string, CMission> TMissionContainer;
public Q_SLOTS:
void handleFilterChanged(const QString &text);
void handleValidation();
void handleCompile();
void handlePublish();
void handleAllDoubleClick(const QModelIndex &index);
void handleSelDoubleClick(const QModelIndex &index);
void handleMoveSelectedRight();
void handleMoveSelectedLeft();
void handleMoveAllRight();
void handleMoveAllLeft();
void handleDataDirButton();
void handleDataDirChanged(const QString &text);
void handleResetFiltersButton();
void handleChangedSettings();
private:
Ui::MissionCompilerMainWindow *ui;
void updateCompileLog();
void populateAllPrimitives(const QString &dataDir = QString());
@ -60,16 +60,16 @@ private:
void applyCheckboxes(const QStringList &servers);
QMenu *_toolModeMenu;
QUndoStack *m_undoStack;
QStringListModel *m_allPrimitivesModel;
QStringListModel *m_selectedPrimitivesModel;
QSortFilterProxyModel *m_filteredProxyModel;
QRegExp *m_regexpFilter;
QString m_compileLog;
QString m_lastDir;
NLLIGO::CLigoConfig m_ligoConfig;
};
#endif // MISSION_COMPILER_MAIN_WINDOW_H
QMenu *_toolModeMenu;
QUndoStack *m_undoStack;
QStringListModel *m_allPrimitivesModel;
QStringListModel *m_selectedPrimitivesModel;
QSortFilterProxyModel *m_filteredProxyModel;
QRegExp *m_regexpFilter;
QString m_compileLog;
QString m_lastDir;
NLLIGO::CLigoConfig m_ligoConfig;
};
#endif // MISSION_COMPILER_MAIN_WINDOW_H

View file

@ -1,63 +1,63 @@
// 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 "server_entry_dialog.h"
#include "ui_server_entry_dialog.h"
// NeL includes
// Qt includes
#include <QFileDialog>
namespace MissionCompiler
{
ServerEntryDialog::ServerEntryDialog(QWidget *parent)
: QDialog(parent),
m_ui(new Ui::ServerEntryDialog)
{
m_ui->setupUi(this);
connect(m_ui->serverTextPathButton, SIGNAL(clicked()), this, SLOT(lookupTextPath()));
connect(m_ui->serverPrimPathButton, SIGNAL(clicked()), this, SLOT(lookupPrimPath()));
}
ServerEntryDialog::~ServerEntryDialog()
{
delete m_ui;
}
// 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 "server_entry_dialog.h"
#include "ui_server_entry_dialog.h"
// NeL includes
// Qt includes
#include <QFileDialog>
namespace MissionCompiler
{
ServerEntryDialog::ServerEntryDialog(QWidget *parent)
: QDialog(parent),
m_ui(new Ui::ServerEntryDialog)
{
m_ui->setupUi(this);
connect(m_ui->serverTextPathButton, SIGNAL(clicked()), this, SLOT(lookupTextPath()));
connect(m_ui->serverPrimPathButton, SIGNAL(clicked()), this, SLOT(lookupPrimPath()));
}
ServerEntryDialog::~ServerEntryDialog()
{
delete m_ui;
}
QString ServerEntryDialog::getServerName()
{
return m_ui->serverNameEdit->text();
}
QString ServerEntryDialog::getTextPath()
{
return m_ui->serverTextPathEdit->text();
}
QString ServerEntryDialog::getPrimPath()
{
return m_ui->serverPrimPathEdit->text();
}
QString ServerEntryDialog::getTextPath()
{
return m_ui->serverTextPathEdit->text();
}
QString ServerEntryDialog::getPrimPath()
{
return m_ui->serverPrimPathEdit->text();
}
void ServerEntryDialog::setServerName(QString name)
{
m_ui->serverNameEdit->setText(name);
@ -68,22 +68,22 @@ void ServerEntryDialog::setTextPath(QString path)
m_ui->serverTextPathEdit->setText(path);
}
void ServerEntryDialog::setPrimPath(QString path)
{
m_ui->serverPrimPathEdit->setText(path);
}
void ServerEntryDialog::lookupTextPath()
{
QString curPath = m_ui->serverTextPathEdit->text();
QString path = QFileDialog::getExistingDirectory(this, "", curPath);
m_ui->serverTextPathEdit->setText(path);
}
void ServerEntryDialog::lookupPrimPath()
{
QString curPath = m_ui->serverPrimPathEdit->text();
QString path = QFileDialog::getExistingDirectory(this, "", curPath);
m_ui->serverPrimPathEdit->setText(path);
}
void ServerEntryDialog::setPrimPath(QString path)
{
m_ui->serverPrimPathEdit->setText(path);
}
void ServerEntryDialog::lookupTextPath()
{
QString curPath = m_ui->serverTextPathEdit->text();
QString path = QFileDialog::getExistingDirectory(this, "", curPath);
m_ui->serverTextPathEdit->setText(path);
}
void ServerEntryDialog::lookupPrimPath()
{
QString curPath = m_ui->serverPrimPathEdit->text();
QString path = QFileDialog::getExistingDirectory(this, "", curPath);
m_ui->serverPrimPathEdit->setText(path);
}
} /* namespace MissionCompiler */

View file

@ -21,8 +21,8 @@
#include <QDialog>
namespace Ui {
class ServerEntryDialog;
namespace Ui {
class ServerEntryDialog;
}
namespace MissionCompiler

View file

@ -1,155 +1,155 @@
#include "zone_painter_main_window.h"
#include "ui_zone_painter_main_window.h"
#include <QMenu>
#include <QSignalMapper>
#include <QColor>
#include <QColorDialog>
#include <QSettings>
#include "qnel_widget.h"
#include "painter_dock_widget.h"
#include "../core/icore.h"
#include "../core/menu_manager.h"
#include "../core/core_constants.h"
ZonePainterMainWindow::ZonePainterMainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::ZonePainterMainWindow)
{
ui->setupUi(this);
m_nelWidget = new NLQT::QNLWidget(this);
setCentralWidget(m_nelWidget);
// Load the settings.
loadConfig();
// Set up dock widget(s) and toolbar.
m_painterDockWidget = new PainterDockWidget(this);
addDockWidget(Qt::RightDockWidgetArea, m_painterDockWidget);
m_painterDockWidget->setVisible(true);
// Insert tool modes
_toolModeMenu = new QMenu(tr("Tool Mode"), ui->painterToolBar);
_toolModeMenu->setIcon(QIcon(":/painterTools/images/draw-brush.png"));
ui->painterToolBar->addAction(_toolModeMenu->menuAction());
//connect(_renderModeMenu->menuAction(), SIGNAL(triggered()), this, SLOT(setRenderMode()));
QSignalMapper *modeMapper = new QSignalMapper(this);
_toolPaintModeAction = _toolModeMenu->addAction(tr("Paint Mode"));
_toolPaintModeAction->setIcon(QIcon(":/painterTools/images/draw-brush.png"));
_toolPaintModeAction->setStatusTip(tr("Set paint mode"));
connect(_toolPaintModeAction, SIGNAL(triggered()), modeMapper, SLOT(map()));
modeMapper->setMapping(_toolPaintModeAction, 0);
_toolFillModeAction = _toolModeMenu->addAction(tr("Fill Mode"));
_toolFillModeAction->setStatusTip(tr("Set fill mode"));
_toolFillModeAction->setIcon(QIcon(":/painterTools/images/color-fill.png"));
connect(_toolFillModeAction, SIGNAL(triggered()), modeMapper, SLOT(map()));
modeMapper->setMapping(_toolFillModeAction, 1);
_toolSelectModeAction = _toolModeMenu->addAction(tr("Select mode"));
_toolSelectModeAction->setIcon(QIcon(":/painterTools/images/go-jump-4.png"));
_toolSelectModeAction->setStatusTip(tr("Set select mode"));
connect(_toolSelectModeAction, SIGNAL(triggered()), modeMapper, SLOT(map()));
modeMapper->setMapping(_toolSelectModeAction, 2);
_toolPickModeAction = _toolModeMenu->addAction(tr("Pick mode"));
_toolPickModeAction->setIcon(QIcon(":/painterTools/images/color-picker-black.png"));
_toolPickModeAction->setStatusTip(tr("Set color picking mode"));
connect(_toolPickModeAction, SIGNAL(triggered()), modeMapper, SLOT(map()));
modeMapper->setMapping(_toolPickModeAction, 2);
connect(modeMapper, SIGNAL(mapped(int)), this, SLOT(setToolMode(int)));
m_statusBarTimer = new QTimer(this);
connect(m_statusBarTimer, SIGNAL(timeout()), this, SLOT(updateStatusBar()));
m_statusInfo = new QLabel(this);
m_statusInfo->hide();
// Set Background Color Toolbar
connect(ui->actionBackground_Dlg, SIGNAL(triggered()), this, SLOT(setBackgroundColor()));
Core::ICore::instance()->mainWindow()->statusBar()->addPermanentWidget(m_statusInfo);
m_undoStack = new QUndoStack(this);
}
void ZonePainterMainWindow::showEvent(QShowEvent *showEvent)
{
QMainWindow::showEvent(showEvent);
m_statusBarTimer->start(1000);
m_statusInfo->show();
}
void ZonePainterMainWindow::hideEvent(QHideEvent *hideEvent)
{
m_statusBarTimer->stop();
m_statusInfo->hide();
QMainWindow::hideEvent(hideEvent);
}
void ZonePainterMainWindow::updateStatusBar()
{
m_statusInfo->setText(QString("Tool Mode: Paint Mode"));
}
void ZonePainterMainWindow::setToolMode(int value)
{
switch (value)
{
case 0:
//Modules::objView().getDriver()->setPolygonMode (NL3D::UDriver::Point);
break;
case 1:
//Modules::objView().getDriver()->setPolygonMode (NL3D::UDriver::Line);
break;
case 2:
//Modules::objView().getDriver()->setPolygonMode (NL3D::UDriver::Filled);
break;
}
}
void ZonePainterMainWindow::setToolMode()
{
//switch (Modules::objView().getDriver()->getPolygonMode())
//{
//case NL3D::UDriver::Filled:
// Modules::objView().getDriver()->setPolygonMode (NL3D::UDriver::Line);
// break;
//case NL3D::UDriver::Line:
// Modules::objView().getDriver()->setPolygonMode (NL3D::UDriver::Point);
// break;
//case NL3D::UDriver::Point:
// Modules::objView().getDriver()->setPolygonMode (NL3D::UDriver::Filled);
// break;
//}
}
void ZonePainterMainWindow::setBackgroundColor() {
QColor color = QColorDialog::getColor(QColor(m_nelWidget->backgroundColor().R,
m_nelWidget->backgroundColor().G,
m_nelWidget->backgroundColor().B));
if (color.isValid())
m_nelWidget->setBackgroundColor(NLMISC::CRGBA(color.red(), color.green(), color.blue()));
}
void ZonePainterMainWindow::loadConfig() {
#include "zone_painter_main_window.h"
#include "ui_zone_painter_main_window.h"
#include <QMenu>
#include <QSignalMapper>
#include <QColor>
#include <QColorDialog>
#include <QSettings>
#include "qnel_widget.h"
#include "painter_dock_widget.h"
#include "../core/icore.h"
#include "../core/menu_manager.h"
#include "../core/core_constants.h"
ZonePainterMainWindow::ZonePainterMainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::ZonePainterMainWindow)
{
ui->setupUi(this);
m_nelWidget = new NLQT::QNLWidget(this);
setCentralWidget(m_nelWidget);
// Load the settings.
loadConfig();
// Set up dock widget(s) and toolbar.
m_painterDockWidget = new PainterDockWidget(this);
addDockWidget(Qt::RightDockWidgetArea, m_painterDockWidget);
m_painterDockWidget->setVisible(true);
// Insert tool modes
_toolModeMenu = new QMenu(tr("Tool Mode"), ui->painterToolBar);
_toolModeMenu->setIcon(QIcon(":/painterTools/images/draw-brush.png"));
ui->painterToolBar->addAction(_toolModeMenu->menuAction());
//connect(_renderModeMenu->menuAction(), SIGNAL(triggered()), this, SLOT(setRenderMode()));
QSignalMapper *modeMapper = new QSignalMapper(this);
_toolPaintModeAction = _toolModeMenu->addAction(tr("Paint Mode"));
_toolPaintModeAction->setIcon(QIcon(":/painterTools/images/draw-brush.png"));
_toolPaintModeAction->setStatusTip(tr("Set paint mode"));
connect(_toolPaintModeAction, SIGNAL(triggered()), modeMapper, SLOT(map()));
modeMapper->setMapping(_toolPaintModeAction, 0);
_toolFillModeAction = _toolModeMenu->addAction(tr("Fill Mode"));
_toolFillModeAction->setStatusTip(tr("Set fill mode"));
_toolFillModeAction->setIcon(QIcon(":/painterTools/images/color-fill.png"));
connect(_toolFillModeAction, SIGNAL(triggered()), modeMapper, SLOT(map()));
modeMapper->setMapping(_toolFillModeAction, 1);
_toolSelectModeAction = _toolModeMenu->addAction(tr("Select mode"));
_toolSelectModeAction->setIcon(QIcon(":/painterTools/images/go-jump-4.png"));
_toolSelectModeAction->setStatusTip(tr("Set select mode"));
connect(_toolSelectModeAction, SIGNAL(triggered()), modeMapper, SLOT(map()));
modeMapper->setMapping(_toolSelectModeAction, 2);
_toolPickModeAction = _toolModeMenu->addAction(tr("Pick mode"));
_toolPickModeAction->setIcon(QIcon(":/painterTools/images/color-picker-black.png"));
_toolPickModeAction->setStatusTip(tr("Set color picking mode"));
connect(_toolPickModeAction, SIGNAL(triggered()), modeMapper, SLOT(map()));
modeMapper->setMapping(_toolPickModeAction, 2);
connect(modeMapper, SIGNAL(mapped(int)), this, SLOT(setToolMode(int)));
m_statusBarTimer = new QTimer(this);
connect(m_statusBarTimer, SIGNAL(timeout()), this, SLOT(updateStatusBar()));
m_statusInfo = new QLabel(this);
m_statusInfo->hide();
// Set Background Color Toolbar
connect(ui->actionBackground_Dlg, SIGNAL(triggered()), this, SLOT(setBackgroundColor()));
Core::ICore::instance()->mainWindow()->statusBar()->addPermanentWidget(m_statusInfo);
m_undoStack = new QUndoStack(this);
}
void ZonePainterMainWindow::showEvent(QShowEvent *showEvent)
{
QMainWindow::showEvent(showEvent);
m_statusBarTimer->start(1000);
m_statusInfo->show();
}
void ZonePainterMainWindow::hideEvent(QHideEvent *hideEvent)
{
m_statusBarTimer->stop();
m_statusInfo->hide();
QMainWindow::hideEvent(hideEvent);
}
void ZonePainterMainWindow::updateStatusBar()
{
m_statusInfo->setText(QString("Tool Mode: Paint Mode"));
}
void ZonePainterMainWindow::setToolMode(int value)
{
switch (value)
{
case 0:
//Modules::objView().getDriver()->setPolygonMode (NL3D::UDriver::Point);
break;
case 1:
//Modules::objView().getDriver()->setPolygonMode (NL3D::UDriver::Line);
break;
case 2:
//Modules::objView().getDriver()->setPolygonMode (NL3D::UDriver::Filled);
break;
}
}
void ZonePainterMainWindow::setToolMode()
{
//switch (Modules::objView().getDriver()->getPolygonMode())
//{
//case NL3D::UDriver::Filled:
// Modules::objView().getDriver()->setPolygonMode (NL3D::UDriver::Line);
// break;
//case NL3D::UDriver::Line:
// Modules::objView().getDriver()->setPolygonMode (NL3D::UDriver::Point);
// break;
//case NL3D::UDriver::Point:
// Modules::objView().getDriver()->setPolygonMode (NL3D::UDriver::Filled);
// break;
//}
}
void ZonePainterMainWindow::setBackgroundColor() {
QColor color = QColorDialog::getColor(QColor(m_nelWidget->backgroundColor().R,
m_nelWidget->backgroundColor().G,
m_nelWidget->backgroundColor().B));
if (color.isValid())
m_nelWidget->setBackgroundColor(NLMISC::CRGBA(color.red(), color.green(), color.blue()));
}
void ZonePainterMainWindow::loadConfig() {
QSettings *settings = Core::ICore::instance()->settings();
settings->beginGroup("ZonePainter");
QColor color;
color = settings->value("BackgroundColor", QColor(80, 80, 80)).value<QColor>();
settings->endGroup();
m_nelWidget->setBackgroundColor(NLMISC::CRGBA(color.red(), color.green(), color.blue(), color.alpha()));
}
void ZonePainterMainWindow::saveConfig() {
m_nelWidget->setBackgroundColor(NLMISC::CRGBA(color.red(), color.green(), color.blue(), color.alpha()));
}
void ZonePainterMainWindow::saveConfig() {
QSettings *settings = Core::ICore::instance()->settings();
settings->beginGroup("ZonePainter" );
@ -157,12 +157,12 @@ void ZonePainterMainWindow::saveConfig() {
settings->setValue("BackgroundColor", color);
settings->endGroup();
settings->sync();
}
ZonePainterMainWindow::~ZonePainterMainWindow()
{
delete ui;
delete m_nelWidget;
delete m_painterDockWidget;
}
settings->sync();
}
ZonePainterMainWindow::~ZonePainterMainWindow()
{
delete ui;
delete m_nelWidget;
delete m_painterDockWidget;
}

View file

@ -1,57 +1,57 @@
#ifndef ZONE_PAINTER_MAIN_WINDOW_H
#define ZONE_PAINTER_MAIN_WINDOW_H
#include <QMainWindow>
#include <QTimer>
#include <QLabel>
#include <QAction>
#include <QtGui/QUndoStack>
namespace NLQT {
class QNLWidget;
}
namespace Ui {
class ZonePainterMainWindow;
}
class PainterDockWidget;
class ZonePainterMainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit ZonePainterMainWindow(QWidget *parent = 0);
~ZonePainterMainWindow();
void loadConfig();
void saveConfig();
QUndoStack *getUndoStack() { return m_undoStack; }
public Q_SLOTS:
#ifndef ZONE_PAINTER_MAIN_WINDOW_H
#define ZONE_PAINTER_MAIN_WINDOW_H
#include <QMainWindow>
#include <QTimer>
#include <QLabel>
#include <QAction>
#include <QtGui/QUndoStack>
namespace NLQT {
class QNLWidget;
}
namespace Ui {
class ZonePainterMainWindow;
}
class PainterDockWidget;
class ZonePainterMainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit ZonePainterMainWindow(QWidget *parent = 0);
~ZonePainterMainWindow();
void loadConfig();
void saveConfig();
QUndoStack *getUndoStack() { return m_undoStack; }
public Q_SLOTS:
void setToolMode(int value);
void setToolMode();
void updateStatusBar();
void setBackgroundColor();
protected:
virtual void showEvent(QShowEvent *showEvent);
virtual void hideEvent(QHideEvent *hideEvent);
private:
Ui::ZonePainterMainWindow *ui;
NLQT::QNLWidget *m_nelWidget;
PainterDockWidget *m_painterDockWidget;
QTimer *m_statusBarTimer;
QLabel *m_statusInfo;
void setToolMode();
void updateStatusBar();
void setBackgroundColor();
protected:
virtual void showEvent(QShowEvent *showEvent);
virtual void hideEvent(QHideEvent *hideEvent);
private:
Ui::ZonePainterMainWindow *ui;
NLQT::QNLWidget *m_nelWidget;
PainterDockWidget *m_painterDockWidget;
QTimer *m_statusBarTimer;
QLabel *m_statusInfo;
QAction *_toolPaintModeAction;
QAction *_toolFillModeAction;
QAction *_toolSelectModeAction;
QAction *_toolPickModeAction;
QMenu *_toolModeMenu;
QUndoStack *m_undoStack;
//QAction *m_setBackColorAction;
};
#endif // ZONE_PAINTER_MAIN_WINDOW_H
QMenu *_toolModeMenu;
QUndoStack *m_undoStack;
//QAction *m_setBackColorAction;
};
#endif // ZONE_PAINTER_MAIN_WINDOW_H

View file

@ -1,229 +1,229 @@
/*
Object Viewer Qt Widget
Copyright (C) 2010 Adrian Jaekel <aj at elane2k dot com>
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 OBJECT_VIEWER_WIDGET_H
#define OBJECT_VIEWER_WIDGET_H
// STL includes
// Qt includes
#include <QtOpenGL/QGLWidget>
#include <QTimer>
// NeL includes
#include <nel/misc/rgba.h>
#include <nel/misc/aabbox.h>
// Project includes
#include "entity.h"
#include "interfaces.h"
namespace NL3D
{
class UDriver;
class UScene;
class ULight;
class UInstance;
class UCamera;
class USkeleton;
class UPlayListManager;
class U3dMouseListener;
}
class QIcon;
/**
namespace NLQT
@brief namespace NLQT
*/
namespace NLQT
{
class CObjectViewerWidget:
public QWidget,
public IObjectViewer
{
Q_OBJECT
Q_INTERFACES(NLQT::IObjectViewer)
public:
/// Default constructor.
CObjectViewerWidget(QWidget *parent = 0);
virtual ~CObjectViewerWidget();
virtual QPaintEngine* paintEngine() const { return NULL; }
virtual void showEvent ( QShowEvent * event );
void setNelContext(NLMISC::INelContext &nelContext);
static CObjectViewerWidget &objViewWid() { return *_objectViewerWidget; }
/// Init a driver and create scene.
void init();
/// Release class.
void release();
/// Update mouse and keyboard events. And update camera matrix.
void updateInput();
/// Render Driver (clear all buffers and set background color).
void renderDriver();
/// Render current scene.
void renderScene();
/// Render Debug 2D (stuff for dev).
void renderDebug2D();
/// Make a screenshot of the current scene and save.
void saveScreenshot(const std::string &nameFile, bool jpg, bool png, bool tga);
/// Load a mesh or particle system and add to current scene.
/// @param meshFileName - name loading shape or ps file.
/// @param skelFileName - name loading skeletin file.
/// @return true if file have been loaded, false if file have not been loaded.
bool loadMesh (const std::string &meshFileName, const std::string &skelFileName);
/// Reset current scene.
void resetScene();
/// Set the background color.
/// @param backgroundColor - background color.
void setBackgroundColor(NLMISC::CRGBA backgroundColor);
/// Set type driver.
/// @param Direct3D - type driver (true - Direct3D) or (false -OpenGL)
void setGraphicsDriver(bool Direct3D);
/// Set size viewport for correct set perspective
/// @param w - width window.
/// @param h - height window.
void setSizeViewport(uint16 w, uint16 h);
void setBloomEffect(bool enabled) { _BloomEffect = enabled; }
/// Select instance from the scene
/// @param name - name instance, "" if no instance edited
void setCurrentObject(const std::string &name);
/// Get current instance from the scene
/// @return name current instance, "" if no instance edited
const std::string& getCurrentObject() { return _CurrentInstance; }
/// Get entity from the scene
/// @return ref Entity
CEntity& getEntity(const std::string &name);
/// Get full list instances from the scene
/// @param listObj - ref of return list instances
void getListObjects(std::vector<std::string> &listObj);
/// Get value background color.
/// @return background color.
NLMISC::CRGBA getBackgroundColor() { return _BackgroundColor; }
/// Get type driver.
/// @return true if have used Direct3D driver, false OpenGL driver.
inline bool getDirect3D() { return _Direct3D; }
inline bool getBloomEffect() const { return _BloomEffect; }
/// Get a pointer to the driver.
/// @return pointer to the driver.
inline NL3D::UDriver *getDriver() { return _Driver; }
/// Get a pointer to the scene.
/// @return pointer to the scene.
inline NL3D::UScene *getScene() { return _Scene; }
/// Get a manager of playlist
/// @return pointer to the UPlayListManager
inline NL3D::UPlayListManager *getPlayListManager() { return _PlayListManager; }
void setCamera(NL3D::UScene *scene, NLMISC::CAABBox &bbox, NL3D::UTransform &entity, bool high_z=false);
bool setupLight(const NLMISC::CVector &position, const NLMISC::CVector &direction);
QIcon* saveOneImage(std::string shapename);
virtual void setVisible(bool visible);
QWidget* getWidget() {return this;}
virtual QString name() const {return ("ObjectViewerWidget");}
protected:
#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 Q_SLOTS:
void updateRender();
private:
/*
Object Viewer Qt Widget
Copyright (C) 2010 Adrian Jaekel <aj at elane2k dot com>
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 OBJECT_VIEWER_WIDGET_H
#define OBJECT_VIEWER_WIDGET_H
// STL includes
// Qt includes
#include <QtOpenGL/QGLWidget>
#include <QTimer>
// NeL includes
#include <nel/misc/rgba.h>
#include <nel/misc/aabbox.h>
// Project includes
#include "entity.h"
#include "interfaces.h"
namespace NL3D
{
class UDriver;
class UScene;
class ULight;
class UInstance;
class UCamera;
class USkeleton;
class UPlayListManager;
class U3dMouseListener;
}
class QIcon;
/**
namespace NLQT
@brief namespace NLQT
*/
namespace NLQT
{
class CObjectViewerWidget:
public QWidget,
public IObjectViewer
{
Q_OBJECT
Q_INTERFACES(NLQT::IObjectViewer)
public:
/// Default constructor.
CObjectViewerWidget(QWidget *parent = 0);
virtual ~CObjectViewerWidget();
virtual QPaintEngine* paintEngine() const { return NULL; }
virtual void showEvent ( QShowEvent * event );
void setNelContext(NLMISC::INelContext &nelContext);
static CObjectViewerWidget &objViewWid() { return *_objectViewerWidget; }
/// Init a driver and create scene.
void init();
/// Release class.
void release();
/// Update mouse and keyboard events. And update camera matrix.
void updateInput();
/// Render Driver (clear all buffers and set background color).
void renderDriver();
/// Render current scene.
void renderScene();
/// Render Debug 2D (stuff for dev).
void renderDebug2D();
/// Make a screenshot of the current scene and save.
void saveScreenshot(const std::string &nameFile, bool jpg, bool png, bool tga);
/// Load a mesh or particle system and add to current scene.
/// @param meshFileName - name loading shape or ps file.
/// @param skelFileName - name loading skeletin file.
/// @return true if file have been loaded, false if file have not been loaded.
bool loadMesh (const std::string &meshFileName, const std::string &skelFileName);
/// Reset current scene.
void resetScene();
/// Set the background color.
/// @param backgroundColor - background color.
void setBackgroundColor(NLMISC::CRGBA backgroundColor);
/// Set type driver.
/// @param Direct3D - type driver (true - Direct3D) or (false -OpenGL)
void setGraphicsDriver(bool Direct3D);
/// Set size viewport for correct set perspective
/// @param w - width window.
/// @param h - height window.
void setSizeViewport(uint16 w, uint16 h);
void setBloomEffect(bool enabled) { _BloomEffect = enabled; }
/// Select instance from the scene
/// @param name - name instance, "" if no instance edited
void setCurrentObject(const std::string &name);
/// Get current instance from the scene
/// @return name current instance, "" if no instance edited
const std::string& getCurrentObject() { return _CurrentInstance; }
/// Get entity from the scene
/// @return ref Entity
CEntity& getEntity(const std::string &name);
/// Get full list instances from the scene
/// @param listObj - ref of return list instances
void getListObjects(std::vector<std::string> &listObj);
/// Get value background color.
/// @return background color.
NLMISC::CRGBA getBackgroundColor() { return _BackgroundColor; }
/// Get type driver.
/// @return true if have used Direct3D driver, false OpenGL driver.
inline bool getDirect3D() { return _Direct3D; }
inline bool getBloomEffect() const { return _BloomEffect; }
/// Get a pointer to the driver.
/// @return pointer to the driver.
inline NL3D::UDriver *getDriver() { return _Driver; }
/// Get a pointer to the scene.
/// @return pointer to the scene.
inline NL3D::UScene *getScene() { return _Scene; }
/// Get a manager of playlist
/// @return pointer to the UPlayListManager
inline NL3D::UPlayListManager *getPlayListManager() { return _PlayListManager; }
void setCamera(NL3D::UScene *scene, NLMISC::CAABBox &bbox, NL3D::UTransform &entity, bool high_z=false);
bool setupLight(const NLMISC::CVector &position, const NLMISC::CVector &direction);
QIcon* saveOneImage(std::string shapename);
virtual void setVisible(bool visible);
QWidget* getWidget() {return this;}
virtual QString name() const {return ("ObjectViewerWidget");}
protected:
#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 Q_SLOTS:
void updateRender();
private:
/// Update the animation time for Particle System animation.
/// @param deltaTime - set the manual animation time.
void updateAnimatePS(uint64 deltaTime = 0);
static CObjectViewerWidget *_objectViewerWidget;
NLMISC::CLibraryContext *_LibContext;
// render stuff
QTimer *_mainTimer;
bool _isGraphicsInitialized, _isGraphicsEnabled;
void updateInitialization(bool visible);
void deleteEntity (CEntity &entity);
/// Delete all entities
void deleteEntities();
NLMISC::CRGBA _BackgroundColor;
NL3D::UDriver *_Driver;
NL3D::UScene *_Scene;
NL3D::UPlayListManager *_PlayListManager;
NL3D::ULight *_Light;
NL3D::UCamera *_Camera;
NL3D::U3dMouseListener *_MouseListener;
// The entities storage
CEntities _Entities;
/// Camera parameters.
float _phi, _psi, _dist;
float _CameraFocal;
bool _Direct3D;
bool _BloomEffect;
std::string _CurrentInstance;
// a temporary solution, and later remove
friend class CAnimationSetDialog;
};/* class CObjectViewerWidget */
} /* namespace NLQT */
#endif // OBJECT_VIEWER_WIDGET_H
void updateAnimatePS(uint64 deltaTime = 0);
static CObjectViewerWidget *_objectViewerWidget;
NLMISC::CLibraryContext *_LibContext;
// render stuff
QTimer *_mainTimer;
bool _isGraphicsInitialized, _isGraphicsEnabled;
void updateInitialization(bool visible);
void deleteEntity (CEntity &entity);
/// Delete all entities
void deleteEntities();
NLMISC::CRGBA _BackgroundColor;
NL3D::UDriver *_Driver;
NL3D::UScene *_Scene;
NL3D::UPlayListManager *_PlayListManager;
NL3D::ULight *_Light;
NL3D::UCamera *_Camera;
NL3D::U3dMouseListener *_MouseListener;
// The entities storage
CEntities _Entities;
/// Camera parameters.
float _phi, _psi, _dist;
float _CameraFocal;
bool _Direct3D;
bool _BloomEffect;
std::string _CurrentInstance;
// a temporary solution, and later remove
friend class CAnimationSetDialog;
};/* class CObjectViewerWidget */
} /* namespace NLQT */
#endif // OBJECT_VIEWER_WIDGET_H

View file

@ -1,5 +1,5 @@
/*
Object Viewer Qt Widget
Object Viewer Qt Widget
Copyright (C) 2010 Adrian Jaekel <aj at elane2k dot com>
This program is free software: you can redistribute it and/or modify

View file

@ -1,59 +1,59 @@
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef RYAI_SPAWN_COMMANDS_H
#define RYAI_SPAWN_COMMANDS_H
#include "nel/misc/types_nl.h"
#include "nel/misc/debug.h"
#include <string>
//class CAISpawnCtrl
//{
//public:
// static bool spawn (const std::string &name, int aiInstance=-1) { nlassert(_instance!=NULL); return _instance->_spawn(aiInstance, name); }
// static bool spawnMap (const std::string &name, int aiInstance=-1) { nlassert(_instance!=NULL); return _instance->_spawnMap(aiInstance, name); }
// static bool spawnMgr (const std::string &name, int aiInstance=-1) { nlassert(_instance!=NULL); return _instance->_spawnMgr(aiInstance, name); }
// static bool spawnGrp (const std::string &name, int aiInstance=-1) { nlassert(_instance!=NULL); return _instance->_spawnGrp(aiInstance, name); }
// static bool spawnAll (int aiInstance=-1) { nlassert(_instance!=NULL); return _instance->_spawnAll(aiInstance); }
//
// static bool despawn (const std::string &name, int aiInstance=-1) { nlassert(_instance!=NULL); return _instance->_despawn(aiInstance, name); }
// static bool despawnMap (const std::string &name, int aiInstance=-1) { nlassert(_instance!=NULL); return _instance->_despawnMap(aiInstance, name); }
// static bool despawnMgr (const std::string &name, int aiInstance=-1) { nlassert(_instance!=NULL); return _instance->_despawnMgr(aiInstance, name); }
// static bool despawnGrp (const std::string &name, int aiInstance=-1) { nlassert(_instance!=NULL); return _instance->_despawnGrp(aiInstance, name); }
// static bool despawnAll (int aiInstance=-1) { nlassert(_instance!=NULL); return _instance->_despawnAll(aiInstance); }
//
//protected:
// virtual bool _spawn (int aiInstance, const std::string &name)=0;
// virtual bool _spawnMap (int aiInstance, const std::string &name)=0;
// virtual bool _spawnMgr (int aiInstance, const std::string &name)=0;
// virtual bool _spawnGrp (int aiInstance, const std::string &name)=0;
// virtual bool _spawnAll (int aiInstance)=0;
//
// virtual bool _despawn (int aiInstance, const std::string &name)=0;
// virtual bool _despawnMap (int aiInstance, const std::string &name)=0;
// virtual bool _despawnMgr (int aiInstance, const std::string &name)=0;
// virtual bool _despawnGrp (int aiInstance, const std::string &name)=0;
// virtual bool _despawnAll (int aiInstance)=0;
//
// static CAISpawnCtrl *_instance;
//};
#endif
#include "nel/misc/types_nl.h"
#include "nel/misc/debug.h"
#include <string>
//class CAISpawnCtrl
//{
//public:
// static bool spawn (const std::string &name, int aiInstance=-1) { nlassert(_instance!=NULL); return _instance->_spawn(aiInstance, name); }
// static bool spawnMap (const std::string &name, int aiInstance=-1) { nlassert(_instance!=NULL); return _instance->_spawnMap(aiInstance, name); }
// static bool spawnMgr (const std::string &name, int aiInstance=-1) { nlassert(_instance!=NULL); return _instance->_spawnMgr(aiInstance, name); }
// static bool spawnGrp (const std::string &name, int aiInstance=-1) { nlassert(_instance!=NULL); return _instance->_spawnGrp(aiInstance, name); }
// static bool spawnAll (int aiInstance=-1) { nlassert(_instance!=NULL); return _instance->_spawnAll(aiInstance); }
//
// static bool despawn (const std::string &name, int aiInstance=-1) { nlassert(_instance!=NULL); return _instance->_despawn(aiInstance, name); }
// static bool despawnMap (const std::string &name, int aiInstance=-1) { nlassert(_instance!=NULL); return _instance->_despawnMap(aiInstance, name); }
// static bool despawnMgr (const std::string &name, int aiInstance=-1) { nlassert(_instance!=NULL); return _instance->_despawnMgr(aiInstance, name); }
// static bool despawnGrp (const std::string &name, int aiInstance=-1) { nlassert(_instance!=NULL); return _instance->_despawnGrp(aiInstance, name); }
// static bool despawnAll (int aiInstance=-1) { nlassert(_instance!=NULL); return _instance->_despawnAll(aiInstance); }
//
//protected:
// virtual bool _spawn (int aiInstance, const std::string &name)=0;
// virtual bool _spawnMap (int aiInstance, const std::string &name)=0;
// virtual bool _spawnMgr (int aiInstance, const std::string &name)=0;
// virtual bool _spawnGrp (int aiInstance, const std::string &name)=0;
// virtual bool _spawnAll (int aiInstance)=0;
//
// virtual bool _despawn (int aiInstance, const std::string &name)=0;
// virtual bool _despawnMap (int aiInstance, const std::string &name)=0;
// virtual bool _despawnMgr (int aiInstance, const std::string &name)=0;
// virtual bool _despawnGrp (int aiInstance, const std::string &name)=0;
// virtual bool _despawnAll (int aiInstance)=0;
//
// static CAISpawnCtrl *_instance;
//};
#endif

View file

@ -1,5 +1,5 @@
/*
Georges Editor Qt
Georges Editor Qt
Copyright (C) 2010 Adrian Jaekel <aj at elane2k dot com>
This program is free software: you can redistribute it and/or modify
@ -14,58 +14,58 @@ 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 FORMITEM_H
#define FORMITEM_H
// NeL includes
#include <nel/georges/u_form_elm.h>
// Qt includes
#include <QList>
#include <QVariant>
namespace NLQT
{
class CFormItem
{
public:
CFormItem(NLGEORGES::UFormElm *elm, const QList<QVariant> &data,
CFormItem *parent = 0,
NLGEORGES::UFormElm::TWhereIsValue = NLGEORGES::UFormElm::ValueForm,
NLGEORGES::UFormElm::TWhereIsNode = NLGEORGES::UFormElm::NodeForm);
~CFormItem();
void appendChild(CFormItem *child);
CFormItem *child(int row);
int childCount() const;
int columnCount() const;
QVariant data(int column) const;
int row() const;
CFormItem *parent();
bool setData(int column, const QVariant &value);
NLGEORGES::UFormElm* getFormElm() {return formElm;}
NLGEORGES::UFormElm::TWhereIsValue valueFrom()
{
return whereV;
}
NLGEORGES::UFormElm::TWhereIsNode nodeFrom()
{
return whereN;
}
private:
QList<CFormItem*> childItems;
QList<QVariant> itemData;
CFormItem *parentItem;
NLGEORGES::UFormElm* formElm;
NLGEORGES::UFormElm::TWhereIsValue whereV;
NLGEORGES::UFormElm::TWhereIsNode whereN;
}; // CFormItem
}
#endif // FORMITEM_H
*/
#ifndef FORMITEM_H
#define FORMITEM_H
// NeL includes
#include <nel/georges/u_form_elm.h>
// Qt includes
#include <QList>
#include <QVariant>
namespace NLQT
{
class CFormItem
{
public:
CFormItem(NLGEORGES::UFormElm *elm, const QList<QVariant> &data,
CFormItem *parent = 0,
NLGEORGES::UFormElm::TWhereIsValue = NLGEORGES::UFormElm::ValueForm,
NLGEORGES::UFormElm::TWhereIsNode = NLGEORGES::UFormElm::NodeForm);
~CFormItem();
void appendChild(CFormItem *child);
CFormItem *child(int row);
int childCount() const;
int columnCount() const;
QVariant data(int column) const;
int row() const;
CFormItem *parent();
bool setData(int column, const QVariant &value);
NLGEORGES::UFormElm* getFormElm() {return formElm;}
NLGEORGES::UFormElm::TWhereIsValue valueFrom()
{
return whereV;
}
NLGEORGES::UFormElm::TWhereIsNode nodeFrom()
{
return whereN;
}
private:
QList<CFormItem*> childItems;
QList<QVariant> itemData;
CFormItem *parentItem;
NLGEORGES::UFormElm* formElm;
NLGEORGES::UFormElm::TWhereIsValue whereV;
NLGEORGES::UFormElm::TWhereIsNode whereN;
}; // CFormItem
}
#endif // FORMITEM_H