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

View file

@ -1,191 +1,191 @@
// Object Viewer Qt - Log Plugin - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/> // Object Viewer Qt - Log Plugin - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// Copyright (C) 2011 Adrian Jaekel <aj at elane2k dot com> // Copyright (C) 2011 Adrian Jaekel <aj at elane2k dot com>
// //
// 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 Affero General Public License as // it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the // published by the Free Software Foundation, either version 3 of the
// License, or (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 Affero General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the GNU Affero 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/>.
// Project includes // Project includes
#include "log_plugin.h" #include "log_plugin.h"
#include "log_settings_page.h" #include "log_settings_page.h"
#include "qt_displayer.h" #include "qt_displayer.h"
#include "../core/icore.h" #include "../core/icore.h"
#include "../core/core_constants.h" #include "../core/core_constants.h"
#include "../core/menu_manager.h" #include "../core/menu_manager.h"
#include "../../extension_system/iplugin_spec.h" #include "../../extension_system/iplugin_spec.h"
// Qt includes // Qt includes
#include <QtCore/QObject> #include <QtCore/QObject>
#include <QtGui/QMessageBox> #include <QtGui/QMessageBox>
#include <QtGui/QMainWindow> #include <QtGui/QMainWindow>
#include <QtGui/QMenu> #include <QtGui/QMenu>
#include <QtGui/QAction> #include <QtGui/QAction>
#include <QtGui/QMenuBar> #include <QtGui/QMenuBar>
#include <QtGui/QWidget> #include <QtGui/QWidget>
#include <QFile> #include <QFile>
#include <QDateTime> #include <QDateTime>
#include <QTextStream> #include <QTextStream>
// NeL includes // NeL includes
#include <nel/misc/debug.h> #include <nel/misc/debug.h>
namespace Plugin namespace Plugin
{ {
CLogPlugin::CLogPlugin(QWidget *parent): QDockWidget(parent) CLogPlugin::CLogPlugin(QWidget *parent): QDockWidget(parent)
{ {
m_ui.setupUi(this); m_ui.setupUi(this);
} }
CLogPlugin::~CLogPlugin() CLogPlugin::~CLogPlugin()
{ {
Q_FOREACH(QObject *obj, m_autoReleaseObjects) Q_FOREACH(QObject *obj, m_autoReleaseObjects)
{ {
m_plugMan->removeObject(obj); m_plugMan->removeObject(obj);
} }
qDeleteAll(m_autoReleaseObjects); qDeleteAll(m_autoReleaseObjects);
m_autoReleaseObjects.clear(); m_autoReleaseObjects.clear();
NLMISC::ErrorLog->removeDisplayer(m_displayer); NLMISC::ErrorLog->removeDisplayer(m_displayer);
NLMISC::WarningLog->removeDisplayer(m_displayer); NLMISC::WarningLog->removeDisplayer(m_displayer);
NLMISC::DebugLog->removeDisplayer(m_displayer); NLMISC::DebugLog->removeDisplayer(m_displayer);
NLMISC::AssertLog->removeDisplayer(m_displayer); NLMISC::AssertLog->removeDisplayer(m_displayer);
NLMISC::InfoLog->removeDisplayer(m_displayer); NLMISC::InfoLog->removeDisplayer(m_displayer);
delete m_displayer; delete m_displayer;
} }
bool CLogPlugin::initialize(ExtensionSystem::IPluginManager *pluginManager, QString *errorString) bool CLogPlugin::initialize(ExtensionSystem::IPluginManager *pluginManager, QString *errorString)
{ {
Q_UNUSED(errorString); Q_UNUSED(errorString);
m_plugMan = pluginManager; m_plugMan = pluginManager;
m_logSettingsPage = new CLogSettingsPage(this, this); m_logSettingsPage = new CLogSettingsPage(this, this);
addAutoReleasedObject(m_logSettingsPage); addAutoReleasedObject(m_logSettingsPage);
return true; return true;
} }
void CLogPlugin::extensionsInitialized() void CLogPlugin::extensionsInitialized()
{ {
setDisplayers(); setDisplayers();
Core::ICore *core = Core::ICore::instance(); Core::ICore *core = Core::ICore::instance();
Core::MenuManager *menuManager = core->menuManager(); Core::MenuManager *menuManager = core->menuManager();
QMenu *viewMenu = menuManager->menu(Core::Constants::M_VIEW); QMenu *viewMenu = menuManager->menu(Core::Constants::M_VIEW);
QMainWindow *wnd = Core::ICore::instance()->mainWindow(); QMainWindow *wnd = Core::ICore::instance()->mainWindow();
wnd->addDockWidget(Qt::RightDockWidgetArea, this); wnd->addDockWidget(Qt::RightDockWidgetArea, this);
hide(); hide();
viewMenu->addAction(this->toggleViewAction()); viewMenu->addAction(this->toggleViewAction());
} }
void CLogPlugin::setNelContext(NLMISC::INelContext *nelContext) void CLogPlugin::setNelContext(NLMISC::INelContext *nelContext)
{ {
#ifdef NL_OS_WINDOWS #ifdef NL_OS_WINDOWS
// Ensure that a context doesn't exist yet. // Ensure that a context doesn't exist yet.
// This only applies to platforms without PIC, e.g. Windows. // This only applies to platforms without PIC, e.g. Windows.
nlassert(!NLMISC::INelContext::isContextInitialised()); nlassert(!NLMISC::INelContext::isContextInitialised());
#endif // fdef NL_OS_WINDOWS^M #endif // fdef NL_OS_WINDOWS^M
m_libContext = new NLMISC::CLibraryContext(*nelContext); m_libContext = new NLMISC::CLibraryContext(*nelContext);
m_displayer = new NLQT::CQtDisplayer(m_ui.plainTextEdit); m_displayer = new NLQT::CQtDisplayer(m_ui.plainTextEdit);
} }
QString CLogPlugin::name() const QString CLogPlugin::name() const
{ {
return "LogPlugin"; return "LogPlugin";
} }
QString CLogPlugin::version() const QString CLogPlugin::version() const
{ {
return "1.1"; return "1.1";
} }
QString CLogPlugin::vendor() const QString CLogPlugin::vendor() const
{ {
return "aquiles"; return "aquiles";
} }
QString CLogPlugin::description() const QString CLogPlugin::description() const
{ {
return tr("DockWidget to display all log messages from NeL."); return tr("DockWidget to display all log messages from NeL.");
} }
QStringList CLogPlugin::dependencies() const QStringList CLogPlugin::dependencies() const
{ {
QStringList list; QStringList list;
list.append(Core::Constants::OVQT_CORE_PLUGIN); list.append(Core::Constants::OVQT_CORE_PLUGIN);
return list; return list;
} }
void CLogPlugin::addAutoReleasedObject(QObject *obj) void CLogPlugin::addAutoReleasedObject(QObject *obj)
{ {
m_plugMan->addObject(obj); m_plugMan->addObject(obj);
m_autoReleaseObjects.prepend(obj); m_autoReleaseObjects.prepend(obj);
} }
void CLogPlugin::setDisplayers() void CLogPlugin::setDisplayers()
{ {
QSettings *settings = Core::ICore::instance()->settings(); QSettings *settings = Core::ICore::instance()->settings();
settings->beginGroup(Core::Constants::LOG_SECTION); settings->beginGroup(Core::Constants::LOG_SECTION);
bool error = settings->value(Core::Constants::LOG_ERROR, true).toBool(); bool error = settings->value(Core::Constants::LOG_ERROR, true).toBool();
bool warning = settings->value(Core::Constants::LOG_WARNING, true).toBool(); bool warning = settings->value(Core::Constants::LOG_WARNING, true).toBool();
bool debug = settings->value(Core::Constants::LOG_DEBUG, true).toBool(); bool debug = settings->value(Core::Constants::LOG_DEBUG, true).toBool();
bool assert = settings->value(Core::Constants::LOG_ASSERT, true).toBool(); bool assert = settings->value(Core::Constants::LOG_ASSERT, true).toBool();
bool info = settings->value(Core::Constants::LOG_INFO, true).toBool(); bool info = settings->value(Core::Constants::LOG_INFO, true).toBool();
settings->endGroup(); settings->endGroup();
if (error) { if (error) {
if (!NLMISC::ErrorLog->attached(m_displayer)) if (!NLMISC::ErrorLog->attached(m_displayer))
NLMISC::ErrorLog->addDisplayer(m_displayer); NLMISC::ErrorLog->addDisplayer(m_displayer);
} else { } else {
if (m_displayer) { if (m_displayer) {
NLMISC::ErrorLog->removeDisplayer(m_displayer); NLMISC::ErrorLog->removeDisplayer(m_displayer);
} }
} }
if (warning) { if (warning) {
if (!NLMISC::WarningLog->attached(m_displayer)) if (!NLMISC::WarningLog->attached(m_displayer))
NLMISC::WarningLog->addDisplayer(m_displayer); NLMISC::WarningLog->addDisplayer(m_displayer);
} else { } else {
if (m_displayer) { if (m_displayer) {
NLMISC::WarningLog->removeDisplayer(m_displayer); NLMISC::WarningLog->removeDisplayer(m_displayer);
} }
} }
if (debug) { if (debug) {
if (!NLMISC::DebugLog->attached(m_displayer)) if (!NLMISC::DebugLog->attached(m_displayer))
NLMISC::DebugLog->addDisplayer(m_displayer); NLMISC::DebugLog->addDisplayer(m_displayer);
} else { } else {
if (m_displayer) { if (m_displayer) {
NLMISC::DebugLog->removeDisplayer(m_displayer); NLMISC::DebugLog->removeDisplayer(m_displayer);
} }
} }
if (assert) { if (assert) {
if (!NLMISC::AssertLog->attached(m_displayer)) if (!NLMISC::AssertLog->attached(m_displayer))
NLMISC::AssertLog->addDisplayer(m_displayer); NLMISC::AssertLog->addDisplayer(m_displayer);
} else { } else {
if (m_displayer) { if (m_displayer) {
NLMISC::AssertLog->removeDisplayer(m_displayer); NLMISC::AssertLog->removeDisplayer(m_displayer);
} }
} }
if (info) { if (info) {
if (!NLMISC::InfoLog->attached(m_displayer)) if (!NLMISC::InfoLog->attached(m_displayer))
NLMISC::InfoLog->addDisplayer(m_displayer); NLMISC::InfoLog->addDisplayer(m_displayer);
} else { } else {
if (m_displayer) { if (m_displayer) {
NLMISC::InfoLog->removeDisplayer(m_displayer); NLMISC::InfoLog->removeDisplayer(m_displayer);
} }
} }
} }
} }
Q_EXPORT_PLUGIN(Plugin::CLogPlugin) Q_EXPORT_PLUGIN(Plugin::CLogPlugin)

View file

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

View file

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

View file

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

View file

@ -1,63 +1,63 @@
// Object Viewer Qt - MMORPG Framework <http://dev.ryzom.com/projects/nel/> // Object Viewer Qt - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
// Copyright (C) 2010 Winch Gate Property Limited // Copyright (C) 2010 Winch Gate Property Limited
// Copyright (C) 2011 Dzmitry Kamiahin <dnk-88@tut.by> // Copyright (C) 2011 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 Affero General Public License as // it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the // published by the Free Software Foundation, either version 3 of the
// License, or (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 Affero General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the GNU Affero 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/>.
// Project includes // Project includes
#include "server_entry_dialog.h" #include "server_entry_dialog.h"
#include "ui_server_entry_dialog.h" #include "ui_server_entry_dialog.h"
// NeL includes // NeL includes
// Qt includes // Qt includes
#include <QFileDialog> #include <QFileDialog>
namespace MissionCompiler namespace MissionCompiler
{ {
ServerEntryDialog::ServerEntryDialog(QWidget *parent) ServerEntryDialog::ServerEntryDialog(QWidget *parent)
: QDialog(parent), : QDialog(parent),
m_ui(new Ui::ServerEntryDialog) m_ui(new Ui::ServerEntryDialog)
{ {
m_ui->setupUi(this); m_ui->setupUi(this);
connect(m_ui->serverTextPathButton, SIGNAL(clicked()), this, SLOT(lookupTextPath())); connect(m_ui->serverTextPathButton, SIGNAL(clicked()), this, SLOT(lookupTextPath()));
connect(m_ui->serverPrimPathButton, SIGNAL(clicked()), this, SLOT(lookupPrimPath())); connect(m_ui->serverPrimPathButton, SIGNAL(clicked()), this, SLOT(lookupPrimPath()));
} }
ServerEntryDialog::~ServerEntryDialog() ServerEntryDialog::~ServerEntryDialog()
{ {
delete m_ui; delete m_ui;
} }
QString ServerEntryDialog::getServerName() QString ServerEntryDialog::getServerName()
{ {
return m_ui->serverNameEdit->text(); return m_ui->serverNameEdit->text();
} }
QString ServerEntryDialog::getTextPath() QString ServerEntryDialog::getTextPath()
{ {
return m_ui->serverTextPathEdit->text(); return m_ui->serverTextPathEdit->text();
} }
QString ServerEntryDialog::getPrimPath() QString ServerEntryDialog::getPrimPath()
{ {
return m_ui->serverPrimPathEdit->text(); return m_ui->serverPrimPathEdit->text();
} }
void ServerEntryDialog::setServerName(QString name) void ServerEntryDialog::setServerName(QString name)
{ {
m_ui->serverNameEdit->setText(name); m_ui->serverNameEdit->setText(name);
@ -68,22 +68,22 @@ void ServerEntryDialog::setTextPath(QString path)
m_ui->serverTextPathEdit->setText(path); m_ui->serverTextPathEdit->setText(path);
} }
void ServerEntryDialog::setPrimPath(QString path) void ServerEntryDialog::setPrimPath(QString path)
{ {
m_ui->serverPrimPathEdit->setText(path); m_ui->serverPrimPathEdit->setText(path);
} }
void ServerEntryDialog::lookupTextPath() void ServerEntryDialog::lookupTextPath()
{ {
QString curPath = m_ui->serverTextPathEdit->text(); QString curPath = m_ui->serverTextPathEdit->text();
QString path = QFileDialog::getExistingDirectory(this, "", curPath); QString path = QFileDialog::getExistingDirectory(this, "", curPath);
m_ui->serverTextPathEdit->setText(path); m_ui->serverTextPathEdit->setText(path);
} }
void ServerEntryDialog::lookupPrimPath() void ServerEntryDialog::lookupPrimPath()
{ {
QString curPath = m_ui->serverPrimPathEdit->text(); QString curPath = m_ui->serverPrimPathEdit->text();
QString path = QFileDialog::getExistingDirectory(this, "", curPath); QString path = QFileDialog::getExistingDirectory(this, "", curPath);
m_ui->serverPrimPathEdit->setText(path); m_ui->serverPrimPathEdit->setText(path);
} }
} /* namespace MissionCompiler */ } /* namespace MissionCompiler */

View file

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

View file

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

View file

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

View file

@ -1,229 +1,229 @@
/* /*
Object Viewer Qt Widget Object Viewer Qt Widget
Copyright (C) 2010 Adrian Jaekel <aj at elane2k dot com> Copyright (C) 2010 Adrian Jaekel <aj at elane2k dot com>
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 General Public License as published by
the Free Software Foundation, either version 3 of the License, or the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. (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 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 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 OBJECT_VIEWER_WIDGET_H #ifndef OBJECT_VIEWER_WIDGET_H
#define OBJECT_VIEWER_WIDGET_H #define OBJECT_VIEWER_WIDGET_H
// STL includes // STL includes
// Qt includes // Qt includes
#include <QtOpenGL/QGLWidget> #include <QtOpenGL/QGLWidget>
#include <QTimer> #include <QTimer>
// NeL includes // NeL includes
#include <nel/misc/rgba.h> #include <nel/misc/rgba.h>
#include <nel/misc/aabbox.h> #include <nel/misc/aabbox.h>
// Project includes // Project includes
#include "entity.h" #include "entity.h"
#include "interfaces.h" #include "interfaces.h"
namespace NL3D namespace NL3D
{ {
class UDriver; class UDriver;
class UScene; class UScene;
class ULight; class ULight;
class UInstance; class UInstance;
class UCamera; class UCamera;
class USkeleton; class USkeleton;
class UPlayListManager; class UPlayListManager;
class U3dMouseListener; class U3dMouseListener;
} }
class QIcon; class QIcon;
/** /**
namespace NLQT namespace NLQT
@brief namespace NLQT @brief namespace NLQT
*/ */
namespace NLQT namespace NLQT
{ {
class CObjectViewerWidget: class CObjectViewerWidget:
public QWidget, public QWidget,
public IObjectViewer public IObjectViewer
{ {
Q_OBJECT Q_OBJECT
Q_INTERFACES(NLQT::IObjectViewer) Q_INTERFACES(NLQT::IObjectViewer)
public: public:
/// Default constructor. /// Default constructor.
CObjectViewerWidget(QWidget *parent = 0); CObjectViewerWidget(QWidget *parent = 0);
virtual ~CObjectViewerWidget(); virtual ~CObjectViewerWidget();
virtual QPaintEngine* paintEngine() const { return NULL; } virtual QPaintEngine* paintEngine() const { return NULL; }
virtual void showEvent ( QShowEvent * event ); virtual void showEvent ( QShowEvent * event );
void setNelContext(NLMISC::INelContext &nelContext); void setNelContext(NLMISC::INelContext &nelContext);
static CObjectViewerWidget &objViewWid() { return *_objectViewerWidget; } static CObjectViewerWidget &objViewWid() { return *_objectViewerWidget; }
/// Init a driver and create scene. /// Init a driver and create scene.
void init(); void init();
/// Release class. /// Release class.
void release(); void release();
/// Update mouse and keyboard events. And update camera matrix. /// Update mouse and keyboard events. And update camera matrix.
void updateInput(); void updateInput();
/// Render Driver (clear all buffers and set background color). /// Render Driver (clear all buffers and set background color).
void renderDriver(); void renderDriver();
/// Render current scene. /// Render current scene.
void renderScene(); void renderScene();
/// Render Debug 2D (stuff for dev). /// Render Debug 2D (stuff for dev).
void renderDebug2D(); void renderDebug2D();
/// Make a screenshot of the current scene and save. /// Make a screenshot of the current scene and save.
void saveScreenshot(const std::string &nameFile, bool jpg, bool png, bool tga); void saveScreenshot(const std::string &nameFile, bool jpg, bool png, bool tga);
/// Load a mesh or particle system and add to current scene. /// Load a mesh or particle system and add to current scene.
/// @param meshFileName - name loading shape or ps file. /// @param meshFileName - name loading shape or ps file.
/// @param skelFileName - name loading skeletin file. /// @param skelFileName - name loading skeletin file.
/// @return true if file have been loaded, false if file have not been loaded. /// @return true if file have been loaded, false if file have not been loaded.
bool loadMesh (const std::string &meshFileName, const std::string &skelFileName); bool loadMesh (const std::string &meshFileName, const std::string &skelFileName);
/// Reset current scene. /// Reset current scene.
void resetScene(); void resetScene();
/// Set the background color. /// Set the background color.
/// @param backgroundColor - background color. /// @param backgroundColor - background color.
void setBackgroundColor(NLMISC::CRGBA backgroundColor); void setBackgroundColor(NLMISC::CRGBA backgroundColor);
/// Set type driver. /// Set type driver.
/// @param Direct3D - type driver (true - Direct3D) or (false -OpenGL) /// @param Direct3D - type driver (true - Direct3D) or (false -OpenGL)
void setGraphicsDriver(bool Direct3D); void setGraphicsDriver(bool Direct3D);
/// Set size viewport for correct set perspective /// Set size viewport for correct set perspective
/// @param w - width window. /// @param w - width window.
/// @param h - height window. /// @param h - height window.
void setSizeViewport(uint16 w, uint16 h); void setSizeViewport(uint16 w, uint16 h);
void setBloomEffect(bool enabled) { _BloomEffect = enabled; } void setBloomEffect(bool enabled) { _BloomEffect = enabled; }
/// Select instance from the scene /// Select instance from the scene
/// @param name - name instance, "" if no instance edited /// @param name - name instance, "" if no instance edited
void setCurrentObject(const std::string &name); void setCurrentObject(const std::string &name);
/// Get current instance from the scene /// Get current instance from the scene
/// @return name current instance, "" if no instance edited /// @return name current instance, "" if no instance edited
const std::string& getCurrentObject() { return _CurrentInstance; } const std::string& getCurrentObject() { return _CurrentInstance; }
/// Get entity from the scene /// Get entity from the scene
/// @return ref Entity /// @return ref Entity
CEntity& getEntity(const std::string &name); CEntity& getEntity(const std::string &name);
/// Get full list instances from the scene /// Get full list instances from the scene
/// @param listObj - ref of return list instances /// @param listObj - ref of return list instances
void getListObjects(std::vector<std::string> &listObj); void getListObjects(std::vector<std::string> &listObj);
/// Get value background color. /// Get value background color.
/// @return background color. /// @return background color.
NLMISC::CRGBA getBackgroundColor() { return _BackgroundColor; } NLMISC::CRGBA getBackgroundColor() { return _BackgroundColor; }
/// Get type driver. /// Get type driver.
/// @return true if have used Direct3D driver, false OpenGL driver. /// @return true if have used Direct3D driver, false OpenGL driver.
inline bool getDirect3D() { return _Direct3D; } inline bool getDirect3D() { return _Direct3D; }
inline bool getBloomEffect() const { return _BloomEffect; } inline bool getBloomEffect() const { return _BloomEffect; }
/// Get a pointer to the driver. /// Get a pointer to the driver.
/// @return pointer to the driver. /// @return pointer to the driver.
inline NL3D::UDriver *getDriver() { return _Driver; } inline NL3D::UDriver *getDriver() { return _Driver; }
/// Get a pointer to the scene. /// Get a pointer to the scene.
/// @return pointer to the scene. /// @return pointer to the scene.
inline NL3D::UScene *getScene() { return _Scene; } inline NL3D::UScene *getScene() { return _Scene; }
/// Get a manager of playlist /// Get a manager of playlist
/// @return pointer to the UPlayListManager /// @return pointer to the UPlayListManager
inline NL3D::UPlayListManager *getPlayListManager() { return _PlayListManager; } inline NL3D::UPlayListManager *getPlayListManager() { return _PlayListManager; }
void setCamera(NL3D::UScene *scene, NLMISC::CAABBox &bbox, NL3D::UTransform &entity, bool high_z=false); 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); bool setupLight(const NLMISC::CVector &position, const NLMISC::CVector &direction);
QIcon* saveOneImage(std::string shapename); QIcon* saveOneImage(std::string shapename);
virtual void setVisible(bool visible); virtual void setVisible(bool visible);
QWidget* getWidget() {return this;} QWidget* getWidget() {return this;}
virtual QString name() const {return ("ObjectViewerWidget");} virtual QString name() const {return ("ObjectViewerWidget");}
protected: protected:
#if defined(NL_OS_WINDOWS) #if defined(NL_OS_WINDOWS)
virtual bool winEvent(MSG * message, long * result); virtual bool winEvent(MSG * message, long * result);
#elif defined(NL_OS_MAC) #elif defined(NL_OS_MAC)
virtual bool macEvent(EventHandlerCallRef caller, EventRef event); virtual bool macEvent(EventHandlerCallRef caller, EventRef event);
#elif defined(NL_OS_UNIX) #elif defined(NL_OS_UNIX)
virtual bool x11Event(XEvent *event); virtual bool x11Event(XEvent *event);
#endif #endif
private Q_SLOTS: private Q_SLOTS:
void updateRender(); void updateRender();
private: private:
/// Update the animation time for Particle System animation. /// Update the animation time for Particle System animation.
/// @param deltaTime - set the manual animation time. /// @param deltaTime - set the manual animation time.
void updateAnimatePS(uint64 deltaTime = 0); void updateAnimatePS(uint64 deltaTime = 0);
static CObjectViewerWidget *_objectViewerWidget; static CObjectViewerWidget *_objectViewerWidget;
NLMISC::CLibraryContext *_LibContext; NLMISC::CLibraryContext *_LibContext;
// render stuff // render stuff
QTimer *_mainTimer; QTimer *_mainTimer;
bool _isGraphicsInitialized, _isGraphicsEnabled; bool _isGraphicsInitialized, _isGraphicsEnabled;
void updateInitialization(bool visible); void updateInitialization(bool visible);
void deleteEntity (CEntity &entity); void deleteEntity (CEntity &entity);
/// Delete all entities /// Delete all entities
void deleteEntities(); void deleteEntities();
NLMISC::CRGBA _BackgroundColor; NLMISC::CRGBA _BackgroundColor;
NL3D::UDriver *_Driver; NL3D::UDriver *_Driver;
NL3D::UScene *_Scene; NL3D::UScene *_Scene;
NL3D::UPlayListManager *_PlayListManager; NL3D::UPlayListManager *_PlayListManager;
NL3D::ULight *_Light; NL3D::ULight *_Light;
NL3D::UCamera *_Camera; NL3D::UCamera *_Camera;
NL3D::U3dMouseListener *_MouseListener; NL3D::U3dMouseListener *_MouseListener;
// The entities storage // The entities storage
CEntities _Entities; CEntities _Entities;
/// Camera parameters. /// Camera parameters.
float _phi, _psi, _dist; float _phi, _psi, _dist;
float _CameraFocal; float _CameraFocal;
bool _Direct3D; bool _Direct3D;
bool _BloomEffect; bool _BloomEffect;
std::string _CurrentInstance; std::string _CurrentInstance;
// a temporary solution, and later remove // a temporary solution, and later remove
friend class CAnimationSetDialog; friend class CAnimationSetDialog;
};/* class CObjectViewerWidget */ };/* class CObjectViewerWidget */
} /* namespace NLQT */ } /* namespace NLQT */
#endif // OBJECT_VIEWER_WIDGET_H #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> Copyright (C) 2010 Adrian Jaekel <aj at elane2k dot com>
This program is free software: you can redistribute it and/or modify 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/> // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// Copyright (C) 2010 Winch Gate Property Limited // Copyright (C) 2010 Winch Gate Property Limited
// //
// 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 Affero General Public License as // it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the // published by the Free Software Foundation, either version 3 of the
// License, or (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 Affero General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the GNU Affero 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 RYAI_SPAWN_COMMANDS_H #ifndef RYAI_SPAWN_COMMANDS_H
#define RYAI_SPAWN_COMMANDS_H #define RYAI_SPAWN_COMMANDS_H
#include "nel/misc/types_nl.h" #include "nel/misc/types_nl.h"
#include "nel/misc/debug.h" #include "nel/misc/debug.h"
#include <string> #include <string>
//class CAISpawnCtrl //class CAISpawnCtrl
//{ //{
//public: //public:
// static bool spawn (const std::string &name, int aiInstance=-1) { nlassert(_instance!=NULL); return _instance->_spawn(aiInstance, name); } // 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 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 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 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 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 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 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 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 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); } // static bool despawnAll (int aiInstance=-1) { nlassert(_instance!=NULL); return _instance->_despawnAll(aiInstance); }
// //
//protected: //protected:
// virtual bool _spawn (int aiInstance, const std::string &name)=0; // virtual bool _spawn (int aiInstance, const std::string &name)=0;
// virtual bool _spawnMap (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 _spawnMgr (int aiInstance, const std::string &name)=0;
// virtual bool _spawnGrp (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 _spawnAll (int aiInstance)=0;
// //
// virtual bool _despawn (int aiInstance, const std::string &name)=0; // virtual bool _despawn (int aiInstance, const std::string &name)=0;
// virtual bool _despawnMap (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 _despawnMgr (int aiInstance, const std::string &name)=0;
// virtual bool _despawnGrp (int aiInstance, const std::string &name)=0; // virtual bool _despawnGrp (int aiInstance, const std::string &name)=0;
// virtual bool _despawnAll (int aiInstance)=0; // virtual bool _despawnAll (int aiInstance)=0;
// //
// static CAISpawnCtrl *_instance; // static CAISpawnCtrl *_instance;
//}; //};
#endif #endif

View file

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