@ -0,0 +1,83 @@
|
|||||||
|
# - Try to find Iconv on Mac OS X
|
||||||
|
# Once done this will define
|
||||||
|
#
|
||||||
|
# ICONV_FOUND - system has Iconv
|
||||||
|
# ICONV_INCLUDE_DIR - the Iconv include directory
|
||||||
|
# ICONV_LIBRARIES - Link these to use Iconv
|
||||||
|
# ICONV_SECOND_ARGUMENT_IS_CONST - the second argument for iconv() is const
|
||||||
|
#
|
||||||
|
|
||||||
|
IF(APPLE)
|
||||||
|
include(CheckCCompilerFlag)
|
||||||
|
include(CheckCSourceCompiles)
|
||||||
|
|
||||||
|
IF (ICONV_INCLUDE_DIR AND ICONV_LIBRARIES)
|
||||||
|
# Already in cache, be silent
|
||||||
|
SET(ICONV_FIND_QUIETLY TRUE)
|
||||||
|
ENDIF (ICONV_INCLUDE_DIR AND ICONV_LIBRARIES)
|
||||||
|
|
||||||
|
IF(APPLE)
|
||||||
|
FIND_PATH(ICONV_INCLUDE_DIR iconv.h
|
||||||
|
PATHS
|
||||||
|
/opt/local/include/
|
||||||
|
NO_CMAKE_SYSTEM_PATH
|
||||||
|
)
|
||||||
|
|
||||||
|
FIND_LIBRARY(ICONV_LIBRARIES NAMES iconv libiconv c
|
||||||
|
PATHS
|
||||||
|
/opt/local/lib/
|
||||||
|
NO_CMAKE_SYSTEM_PATH
|
||||||
|
)
|
||||||
|
ENDIF(APPLE)
|
||||||
|
|
||||||
|
FIND_PATH(ICONV_INCLUDE_DIR iconv.h PATHS /opt/local/include /sw/include)
|
||||||
|
|
||||||
|
string(REGEX REPLACE "(.*)/include/?" "\\1" ICONV_INCLUDE_BASE_DIR "${ICONV_INCLUDE_DIR}")
|
||||||
|
|
||||||
|
FIND_LIBRARY(ICONV_LIBRARIES NAMES iconv libiconv c HINTS "${ICONV_INCLUDE_BASE_DIR}/lib" PATHS /opt/local/lib)
|
||||||
|
|
||||||
|
IF(ICONV_INCLUDE_DIR AND ICONV_LIBRARIES)
|
||||||
|
SET(ICONV_FOUND TRUE)
|
||||||
|
ENDIF(ICONV_INCLUDE_DIR AND ICONV_LIBRARIES)
|
||||||
|
|
||||||
|
set(CMAKE_REQUIRED_INCLUDES ${ICONV_INCLUDE_DIR})
|
||||||
|
set(CMAKE_REQUIRED_LIBRARIES ${ICONV_LIBRARIES})
|
||||||
|
IF(ICONV_FOUND)
|
||||||
|
check_c_compiler_flag("-Werror" ICONV_HAVE_WERROR)
|
||||||
|
set (CMAKE_C_FLAGS_BACKUP "${CMAKE_C_FLAGS}")
|
||||||
|
if(ICONV_HAVE_WERROR)
|
||||||
|
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror")
|
||||||
|
endif(ICONV_HAVE_WERROR)
|
||||||
|
check_c_source_compiles("
|
||||||
|
#include <iconv.h>
|
||||||
|
int main(){
|
||||||
|
iconv_t conv = 0;
|
||||||
|
const char* in = 0;
|
||||||
|
size_t ilen = 0;
|
||||||
|
char* out = 0;
|
||||||
|
size_t olen = 0;
|
||||||
|
iconv(conv, &in, &ilen, &out, &olen);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
" ICONV_SECOND_ARGUMENT_IS_CONST )
|
||||||
|
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS_BACKUP}")
|
||||||
|
ENDIF(ICONV_FOUND)
|
||||||
|
set(CMAKE_REQUIRED_INCLUDES)
|
||||||
|
set(CMAKE_REQUIRED_LIBRARIES)
|
||||||
|
|
||||||
|
IF(ICONV_FOUND)
|
||||||
|
IF(NOT ICONV_FIND_QUIETLY)
|
||||||
|
MESSAGE(STATUS "Found Iconv: ${ICONV_LIBRARIES}")
|
||||||
|
ENDIF(NOT ICONV_FIND_QUIETLY)
|
||||||
|
ELSE(ICONV_FOUND)
|
||||||
|
IF(Iconv_FIND_REQUIRED)
|
||||||
|
MESSAGE(FATAL_ERROR "Could not find Iconv")
|
||||||
|
ENDIF(Iconv_FIND_REQUIRED)
|
||||||
|
ENDIF(ICONV_FOUND)
|
||||||
|
|
||||||
|
MARK_AS_ADVANCED(
|
||||||
|
ICONV_INCLUDE_DIR
|
||||||
|
ICONV_LIBRARIES
|
||||||
|
ICONV_SECOND_ARGUMENT_IS_CONST
|
||||||
|
)
|
||||||
|
ENDIF(APPLE)
|
@ -1,39 +0,0 @@
|
|||||||
# - Find zlib
|
|
||||||
# Find the native ZLIB includes and library
|
|
||||||
#
|
|
||||||
# ZLIB_INCLUDE_DIRS - where to find zlib.h, etc.
|
|
||||||
# ZLIB_LIBRARIES - List of libraries when using zlib.
|
|
||||||
# ZLIB_FOUND - True if zlib found.
|
|
||||||
|
|
||||||
#=============================================================================
|
|
||||||
# Copyright 2001-2009 Kitware, Inc.
|
|
||||||
#
|
|
||||||
# Distributed under the OSI-approved BSD License (the "License");
|
|
||||||
# see accompanying file Copyright.txt for details.
|
|
||||||
#
|
|
||||||
# This software is distributed WITHOUT ANY WARRANTY; without even the
|
|
||||||
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
||||||
# See the License for more information.
|
|
||||||
#=============================================================================
|
|
||||||
# (To distributed this file outside of CMake, substitute the full
|
|
||||||
# License text for the above reference.)
|
|
||||||
|
|
||||||
IF (ZLIB_INCLUDE_DIR)
|
|
||||||
# Already in cache, be silent
|
|
||||||
SET(ZLIB_FIND_QUIETLY TRUE)
|
|
||||||
ENDIF (ZLIB_INCLUDE_DIR)
|
|
||||||
|
|
||||||
FIND_PATH(ZLIB_INCLUDE_DIR zlib.h)
|
|
||||||
|
|
||||||
SET(ZLIB_NAMES z zlib zdll)
|
|
||||||
FIND_LIBRARY(ZLIB_LIBRARY NAMES ${ZLIB_NAMES} )
|
|
||||||
MARK_AS_ADVANCED( ZLIB_LIBRARY ZLIB_INCLUDE_DIR )
|
|
||||||
|
|
||||||
# Per-recommendation
|
|
||||||
SET(ZLIB_INCLUDE_DIRS "${ZLIB_INCLUDE_DIR}")
|
|
||||||
SET(ZLIB_LIBRARIES "${ZLIB_LIBRARY}")
|
|
||||||
|
|
||||||
# handle the QUIETLY and REQUIRED arguments and set ZLIB_FOUND to TRUE if
|
|
||||||
# all listed variables are TRUE
|
|
||||||
INCLUDE(FindPackageHandleStandardArgs)
|
|
||||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(ZLIB DEFAULT_MSG ZLIB_LIBRARIES ZLIB_INCLUDE_DIRS)
|
|
@ -1,7 +1,9 @@
|
|||||||
ADD_SUBDIRECTORY(core)
|
ADD_SUBDIRECTORY(core)
|
||||||
ADD_SUBDIRECTORY(example)
|
ADD_SUBDIRECTORY(example)
|
||||||
ADD_SUBDIRECTORY(ovqt_sheet_builder)
|
ADD_SUBDIRECTORY(ovqt_sheet_builder)
|
||||||
|
ADD_SUBDIRECTORY(landscape_editor)
|
||||||
ADD_SUBDIRECTORY(log)
|
ADD_SUBDIRECTORY(log)
|
||||||
ADD_SUBDIRECTORY(disp_sheet_id)
|
ADD_SUBDIRECTORY(disp_sheet_id)
|
||||||
ADD_SUBDIRECTORY(object_viewer)
|
ADD_SUBDIRECTORY(object_viewer)
|
||||||
ADD_SUBDIRECTORY(zone_painter)
|
ADD_SUBDIRECTORY(zone_painter)
|
||||||
|
ADD_SUBDIRECTORY(georges_editor)
|
||||||
|
@ -0,0 +1,150 @@
|
|||||||
|
// Object Viewer Qt - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
||||||
|
// 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 "context_manager.h"
|
||||||
|
#include "icontext.h"
|
||||||
|
#include "main_window.h"
|
||||||
|
|
||||||
|
// NeL includes
|
||||||
|
#include <nel/misc/debug.h>
|
||||||
|
|
||||||
|
// Qt includes
|
||||||
|
#include <QtGui/QTabWidget>
|
||||||
|
#include <QtGui/QGridLayout>
|
||||||
|
|
||||||
|
namespace Core
|
||||||
|
{
|
||||||
|
|
||||||
|
struct ContextManagerPrivate
|
||||||
|
{
|
||||||
|
explicit ContextManagerPrivate(Core::MainWindow *mainWindow, QTabWidget *tabWidget);
|
||||||
|
Core::MainWindow *m_mainWindow;
|
||||||
|
QTabWidget *m_tabWidget;
|
||||||
|
QVector<IContext *> m_contexts;
|
||||||
|
int m_oldCurrent;
|
||||||
|
};
|
||||||
|
|
||||||
|
ContextManagerPrivate::ContextManagerPrivate(Core::MainWindow *mainWindow, QTabWidget *tabWidget)
|
||||||
|
: m_mainWindow(mainWindow),
|
||||||
|
m_tabWidget(tabWidget),
|
||||||
|
m_oldCurrent(-1)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
ContextManager::ContextManager(Core::MainWindow *mainWindow, QTabWidget *tabWidget)
|
||||||
|
: d(new ContextManagerPrivate(mainWindow, tabWidget))
|
||||||
|
{
|
||||||
|
QObject::connect(d->m_mainWindow->pluginManager(), SIGNAL(objectAdded(QObject *)),
|
||||||
|
this, SLOT(objectAdded(QObject *)));
|
||||||
|
QObject::connect(d->m_mainWindow->pluginManager(), SIGNAL(aboutToRemoveObject(QObject *)),
|
||||||
|
this, SLOT(aboutToRemoveObject(QObject *)));
|
||||||
|
|
||||||
|
QObject::connect(d->m_tabWidget, SIGNAL(currentChanged(int)), this, SLOT(currentTabChanged(int)));
|
||||||
|
}
|
||||||
|
|
||||||
|
ContextManager::~ContextManager()
|
||||||
|
{
|
||||||
|
delete d;
|
||||||
|
}
|
||||||
|
|
||||||
|
Core::IContext *ContextManager::currentContext() const
|
||||||
|
{
|
||||||
|
int currentIndex = d->m_tabWidget->currentIndex();
|
||||||
|
if (currentIndex < 0)
|
||||||
|
return 0;
|
||||||
|
return d->m_contexts.at(currentIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
Core::IContext *ContextManager::context(const QString &id) const
|
||||||
|
{
|
||||||
|
const int index = indexOf(id);
|
||||||
|
if (index >= 0)
|
||||||
|
return d->m_contexts.at(index);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ContextManager::activateContext(const QString &id)
|
||||||
|
{
|
||||||
|
const int index = indexOf(id);
|
||||||
|
if (index >= 0)
|
||||||
|
d->m_tabWidget->setCurrentIndex(index);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ContextManager::objectAdded(QObject *obj)
|
||||||
|
{
|
||||||
|
IContext *context = qobject_cast<IContext *>(obj);
|
||||||
|
if (context)
|
||||||
|
addContextObject(context);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ContextManager::aboutToRemoveObject(QObject *obj)
|
||||||
|
{
|
||||||
|
IContext *context = qobject_cast<IContext *>(obj);
|
||||||
|
if (context)
|
||||||
|
removeContextObject(context);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ContextManager::addContextObject(IContext *context)
|
||||||
|
{
|
||||||
|
d->m_contexts.push_back(context);
|
||||||
|
d->m_mainWindow->addContextObject(context);
|
||||||
|
|
||||||
|
QWidget *tabWidget = new QWidget(d->m_tabWidget);
|
||||||
|
d->m_tabWidget->addTab(tabWidget, context->icon(), context->trName());
|
||||||
|
QGridLayout *gridLayout = new QGridLayout(tabWidget);
|
||||||
|
gridLayout->setObjectName(QString::fromUtf8("gridLayout_") + context->id());
|
||||||
|
gridLayout->setContentsMargins(0, 0, 0, 0);
|
||||||
|
gridLayout->addWidget(context->widget(), 0, 0, 1, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ContextManager::removeContextObject(IContext *context)
|
||||||
|
{
|
||||||
|
d->m_mainWindow->removeContextObject(context);
|
||||||
|
|
||||||
|
const int index = indexOf(context->id());
|
||||||
|
QWidget *widget = d->m_tabWidget->widget(index);
|
||||||
|
d->m_tabWidget->removeTab(index);
|
||||||
|
d->m_contexts.remove(index);
|
||||||
|
delete widget;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ContextManager::currentTabChanged(int index)
|
||||||
|
{
|
||||||
|
if (index >= 0)
|
||||||
|
{
|
||||||
|
IContext *context = d->m_contexts.at(index);
|
||||||
|
IContext *oldContext = 0;
|
||||||
|
if (d->m_oldCurrent >= 0)
|
||||||
|
oldContext = d->m_contexts.at(d->m_oldCurrent);
|
||||||
|
d->m_oldCurrent = index;
|
||||||
|
Q_EMIT currentContextChanged(context, oldContext);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int ContextManager::indexOf(const QString &id) const
|
||||||
|
{
|
||||||
|
for (int i = 0; i < d->m_contexts.count(); ++i)
|
||||||
|
{
|
||||||
|
if (d->m_contexts.at(i)->id() == id)
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
nlwarning(QString("Warning, no such context: %1").arg(id).toStdString().c_str());
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
} /* namespace Core */
|
@ -0,0 +1,70 @@
|
|||||||
|
// Object Viewer Qt - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
||||||
|
// Copyright (C) 2010 Winch Gate Property Limited
|
||||||
|
// Copyright (C) 2011 Dzmitry Kamiahin <dnk-88@tut.by>
|
||||||
|
//
|
||||||
|
// This program is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU Affero General Public License as
|
||||||
|
// published by the Free Software Foundation, either version 3 of the
|
||||||
|
// License, or (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This program is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU Affero General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU Affero General Public License
|
||||||
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
#ifndef CONTEXT_MANAGER_H
|
||||||
|
#define CONTEXT_MANAGER_H
|
||||||
|
|
||||||
|
// Project includes
|
||||||
|
#include "core_global.h"
|
||||||
|
|
||||||
|
// Qt includes
|
||||||
|
#include <QtCore/QObject>
|
||||||
|
|
||||||
|
QT_BEGIN_NAMESPACE
|
||||||
|
class QTabWidget;
|
||||||
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
|
namespace Core
|
||||||
|
{
|
||||||
|
class IContext;
|
||||||
|
class MainWindow;
|
||||||
|
struct ContextManagerPrivate;
|
||||||
|
|
||||||
|
class CORE_EXPORT ContextManager : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit ContextManager(Core::MainWindow *mainWindow, QTabWidget *tabWidget);
|
||||||
|
virtual ~ContextManager();
|
||||||
|
|
||||||
|
Core::IContext *currentContext() const;
|
||||||
|
Core::IContext *context(const QString &id) const;
|
||||||
|
|
||||||
|
Q_SIGNALS:
|
||||||
|
// the default argument '=0' is important for connects without the oldContext argument.
|
||||||
|
void currentContextChanged(Core::IContext *context, Core::IContext *oldContext = 0);
|
||||||
|
|
||||||
|
public Q_SLOTS:
|
||||||
|
void activateContext(const QString &id);
|
||||||
|
|
||||||
|
private Q_SLOTS:
|
||||||
|
void objectAdded(QObject *obj);
|
||||||
|
void aboutToRemoveObject(QObject *obj);
|
||||||
|
void addContextObject(IContext *context);
|
||||||
|
void removeContextObject(IContext *context);
|
||||||
|
void currentTabChanged(int index);
|
||||||
|
|
||||||
|
private:
|
||||||
|
int indexOf(const QString &id) const;
|
||||||
|
|
||||||
|
ContextManagerPrivate *d;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace Core
|
||||||
|
|
||||||
|
#endif // CONTEXT_MANAGER_H
|
@ -0,0 +1,192 @@
|
|||||||
|
// 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 "general_settings_page.h"
|
||||||
|
#include "core_constants.h"
|
||||||
|
#include "icore.h"
|
||||||
|
|
||||||
|
// NeL includes
|
||||||
|
#include <nel/misc/path.h>
|
||||||
|
|
||||||
|
// Qt includes
|
||||||
|
#include <QtCore/QSettings>
|
||||||
|
#include <QtGui/QWidget>
|
||||||
|
#include <QtGui/QMessageBox>
|
||||||
|
#include <QtGui/QFileDialog>
|
||||||
|
#include <QtGui/QStyleFactory>
|
||||||
|
#include <QtGui/QStyle>
|
||||||
|
|
||||||
|
namespace Core
|
||||||
|
{
|
||||||
|
|
||||||
|
GeneralSettingsPage::GeneralSettingsPage(QObject *parent)
|
||||||
|
: IOptionsPage(parent),
|
||||||
|
m_page(0)
|
||||||
|
{
|
||||||
|
m_originalPalette = QApplication::palette();
|
||||||
|
}
|
||||||
|
|
||||||
|
GeneralSettingsPage::~GeneralSettingsPage()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
QString GeneralSettingsPage::id() const
|
||||||
|
{
|
||||||
|
return QLatin1String("general_settings");
|
||||||
|
}
|
||||||
|
|
||||||
|
QString GeneralSettingsPage::trName() const
|
||||||
|
{
|
||||||
|
return tr("General");
|
||||||
|
}
|
||||||
|
|
||||||
|
QString GeneralSettingsPage::category() const
|
||||||
|
{
|
||||||
|
return QLatin1String(Constants::SETTINGS_CATEGORY_GENERAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
QString GeneralSettingsPage::trCategory() const
|
||||||
|
{
|
||||||
|
return tr(Constants::SETTINGS_TR_CATEGORY_GENERAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
QIcon GeneralSettingsPage::categoryIcon() const
|
||||||
|
{
|
||||||
|
return QIcon();
|
||||||
|
}
|
||||||
|
|
||||||
|
void GeneralSettingsPage::applyGeneralSettings()
|
||||||
|
{
|
||||||
|
QSettings *settings = Core::ICore::instance()->settings();
|
||||||
|
|
||||||
|
settings->beginGroup(Constants::MAIN_WINDOW_SECTION);
|
||||||
|
QApplication::setStyle(QStyleFactory::create(settings->value(Constants::QT_STYLE, "").toString()));
|
||||||
|
|
||||||
|
if (settings->value(Constants::QT_PALETTE, true).toBool())
|
||||||
|
QApplication::setPalette(QApplication::style()->standardPalette());
|
||||||
|
else
|
||||||
|
QApplication::setPalette(m_originalPalette);
|
||||||
|
settings->endGroup();
|
||||||
|
}
|
||||||
|
|
||||||
|
QWidget *GeneralSettingsPage::createPage(QWidget *parent)
|
||||||
|
{
|
||||||
|
m_page = new QWidget(parent);
|
||||||
|
m_ui.setupUi(m_page);
|
||||||
|
|
||||||
|
readSettings();
|
||||||
|
connect(m_ui.languageComboBox, SIGNAL(currentIndexChanged(QString)), this, SLOT(changeLanguage(QString)));
|
||||||
|
connect(m_ui.pluginsPathButton, SIGNAL(clicked()), this, SLOT(setPluginsPath()));
|
||||||
|
connect(m_ui.leveldesignPathButton, SIGNAL(clicked()), this, SLOT(setLevelDesignPath()));
|
||||||
|
connect(m_ui.assetsPathButton, SIGNAL(clicked()), this, SLOT(setAssetsPath()));
|
||||||
|
return m_page;
|
||||||
|
}
|
||||||
|
|
||||||
|
void GeneralSettingsPage::apply()
|
||||||
|
{
|
||||||
|
writeSettings();
|
||||||
|
applyGeneralSettings();
|
||||||
|
}
|
||||||
|
|
||||||
|
void GeneralSettingsPage::finish()
|
||||||
|
{
|
||||||
|
delete m_page;
|
||||||
|
m_page = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void GeneralSettingsPage::changeLanguage(const QString &lang)
|
||||||
|
{
|
||||||
|
QMessageBox::information(0, tr("Restart required"),
|
||||||
|
tr("The language change will take effect after a restart of Object Viewer Qt."));
|
||||||
|
}
|
||||||
|
|
||||||
|
void GeneralSettingsPage::setPluginsPath()
|
||||||
|
{
|
||||||
|
QString newPath = QFileDialog::getExistingDirectory(0, tr("Set the plugins path"),
|
||||||
|
m_ui.pluginsPathLineEdit->text());
|
||||||
|
if (!newPath.isEmpty())
|
||||||
|
{
|
||||||
|
m_ui.pluginsPathLineEdit->setText(newPath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void GeneralSettingsPage::setLevelDesignPath()
|
||||||
|
{
|
||||||
|
QString newPath = QFileDialog::getExistingDirectory(0, tr("Set the level design path"),
|
||||||
|
m_ui.leveldesignPathLineEdit->text());
|
||||||
|
if (!newPath.isEmpty())
|
||||||
|
{
|
||||||
|
m_ui.leveldesignPathLineEdit->setText(newPath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void GeneralSettingsPage::setAssetsPath()
|
||||||
|
{
|
||||||
|
QString newPath = QFileDialog::getExistingDirectory(0, tr("Set the assets path"),
|
||||||
|
m_ui.assetsPathLineEdit->text());
|
||||||
|
if (!newPath.isEmpty())
|
||||||
|
{
|
||||||
|
m_ui.assetsPathLineEdit->setText(newPath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void GeneralSettingsPage::readSettings()
|
||||||
|
{
|
||||||
|
QSettings *settings = Core::ICore::instance()->settings();
|
||||||
|
|
||||||
|
m_ui.pluginsPathLineEdit->setText(settings->value(Core::Constants::PLUGINS_PATH, "./plugins").toString());
|
||||||
|
|
||||||
|
settings->beginGroup(Constants::MAIN_WINDOW_SECTION);
|
||||||
|
m_ui.styleComboBox->addItems(QStyleFactory::keys());
|
||||||
|
QString style = settings->value(Constants::QT_STYLE, "").toString();
|
||||||
|
if (style == "")
|
||||||
|
m_ui.styleComboBox->setCurrentIndex(0);
|
||||||
|
else
|
||||||
|
m_ui.styleComboBox->setCurrentIndex(m_ui.styleComboBox->findText(style));
|
||||||
|
m_ui.paletteCheckBox->setChecked(settings->value(Constants::QT_PALETTE, true).toBool());
|
||||||
|
settings->endGroup();
|
||||||
|
|
||||||
|
QStringList paths;
|
||||||
|
settings->beginGroup(Core::Constants::DATA_PATH_SECTION);
|
||||||
|
m_ui.leveldesignPathLineEdit->setText(settings->value(Core::Constants::LEVELDESIGN_PATH, "l:/leveldesign").toString());
|
||||||
|
m_ui.assetsPathLineEdit->setText(settings->value(Core::Constants::ASSETS_PATH, "w:/database").toString());
|
||||||
|
settings->endGroup();
|
||||||
|
}
|
||||||
|
|
||||||
|
void GeneralSettingsPage::writeSettings()
|
||||||
|
{
|
||||||
|
QSettings *settings = Core::ICore::instance()->settings();
|
||||||
|
|
||||||
|
settings->setValue(Core::Constants::PLUGINS_PATH, m_ui.pluginsPathLineEdit->text());
|
||||||
|
|
||||||
|
settings->beginGroup(Constants::MAIN_WINDOW_SECTION);
|
||||||
|
if (m_ui.styleComboBox->currentIndex() == 0)
|
||||||
|
settings->setValue(Constants::QT_STYLE, "");
|
||||||
|
else
|
||||||
|
settings->setValue(Constants::QT_STYLE, m_ui.styleComboBox->currentText());
|
||||||
|
settings->setValue(Constants::QT_PALETTE, m_ui.paletteCheckBox->isChecked());
|
||||||
|
settings->endGroup();
|
||||||
|
|
||||||
|
settings->beginGroup(Core::Constants::DATA_PATH_SECTION);
|
||||||
|
settings->setValue(Core::Constants::LEVELDESIGN_PATH, m_ui.leveldesignPathLineEdit->text());
|
||||||
|
settings->setValue(Core::Constants::ASSETS_PATH, m_ui.assetsPathLineEdit->text());
|
||||||
|
settings->endGroup();
|
||||||
|
settings->sync();
|
||||||
|
}
|
||||||
|
|
||||||
|
} /* namespace Core */
|
@ -0,0 +1,72 @@
|
|||||||
|
// Object Viewer Qt - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
|
||||||
|
// Copyright (C) 2010 Winch Gate Property Limited
|
||||||
|
// Copyright (C) 2011 Dzmitry Kamiahin <dnk-88@tut.by>
|
||||||
|
//
|
||||||
|
// This program is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU Affero General Public License as
|
||||||
|
// published by the Free Software Foundation, either version 3 of the
|
||||||
|
// License, or (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This program is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU Affero General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU Affero General Public License
|
||||||
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef GENERAL_SETTINGS_PAGE_H
|
||||||
|
#define GENERAL_SETTINGS_PAGE_H
|
||||||
|
|
||||||
|
#include <QtCore/QObject>
|
||||||
|
|
||||||
|
#include "ioptions_page.h"
|
||||||
|
|
||||||
|
#include "ui_general_settings_page.h"
|
||||||
|
|
||||||
|
class QWidget;
|
||||||
|
|
||||||
|
namespace Core
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
@class GeneralSettingsPage
|
||||||
|
*/
|
||||||
|
class GeneralSettingsPage : public Core::IOptionsPage
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
GeneralSettingsPage(QObject *parent = 0);
|
||||||
|
~GeneralSettingsPage();
|
||||||
|
|
||||||
|
QString id() const;
|
||||||
|
QString trName() const;
|
||||||
|
QString category() const;
|
||||||
|
QString trCategory() const;
|
||||||
|
QIcon categoryIcon() const;
|
||||||
|
QWidget *createPage(QWidget *parent);
|
||||||
|
|
||||||
|
void apply();
|
||||||
|
void finish();
|
||||||
|
|
||||||
|
void applyGeneralSettings();
|
||||||
|
|
||||||
|
private Q_SLOTS:
|
||||||
|
void changeLanguage(const QString &lang);
|
||||||
|
void setPluginsPath();
|
||||||
|
void setLevelDesignPath();
|
||||||
|
void setAssetsPath();
|
||||||
|
|
||||||
|
private:
|
||||||
|
void readSettings();
|
||||||
|
void writeSettings();
|
||||||
|
|
||||||
|
QPalette m_originalPalette;
|
||||||
|
QWidget *m_page;
|
||||||
|
Ui::GeneralSettingsPage m_ui;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace Core
|
||||||
|
|
||||||
|
#endif // GENERAL_SETTINGS_H
|
@ -0,0 +1,199 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>GeneralSettingsPage</class>
|
||||||
|
<widget class="QWidget" name="GeneralSettingsPage">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>267</width>
|
||||||
|
<height>282</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Form</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout_2">
|
||||||
|
<property name="margin">
|
||||||
|
<number>6</number>
|
||||||
|
</property>
|
||||||
|
<property name="spacing">
|
||||||
|
<number>3</number>
|
||||||
|
</property>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QGroupBox" name="qtStyleGroupBox">
|
||||||
|
<property name="title">
|
||||||
|
<string>Qt Style</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<property name="spacing">
|
||||||
|
<number>6</number>
|
||||||
|
</property>
|
||||||
|
<property name="margin">
|
||||||
|
<number>6</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="QComboBox" name="styleComboBox">
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>default</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="paletteCheckBox">
|
||||||
|
<property name="text">
|
||||||
|
<string>Use style's standard palette</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QGroupBox" name="languageGroupBox">
|
||||||
|
<property name="title">
|
||||||
|
<string>Language</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
|
<property name="margin">
|
||||||
|
<number>6</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="QComboBox" name="languageComboBox">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>English</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>German</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>French</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Russian</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="0">
|
||||||
|
<widget class="QGroupBox" name="pathsGroupBox">
|
||||||
|
<property name="title">
|
||||||
|
<string>Paths</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
|
<property name="margin">
|
||||||
|
<number>6</number>
|
||||||
|
</property>
|
||||||
|
<property name="spacing">
|
||||||
|
<number>6</number>
|
||||||
|
</property>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="pluginsPathLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string>Plugins path:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QLineEdit" name="pluginsPathLineEdit">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="2">
|
||||||
|
<widget class="QToolButton" name="pluginsPathButton">
|
||||||
|
<property name="text">
|
||||||
|
<string>...</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QLabel" name="leveldesignPathLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string>Level design path:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<widget class="QLineEdit" name="leveldesignPathLineEdit">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="2">
|
||||||
|
<widget class="QToolButton" name="leveldesignPathButton">
|
||||||
|
<property name="text">
|
||||||
|
<string>...</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="0">
|
||||||
|
<widget class="QLabel" name="assetsPathLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string>Assets path:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="1">
|
||||||
|
<widget class="QLineEdit" name="assetsPathLineEdit">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="2">
|
||||||
|
<widget class="QToolButton" name="assetsPathButton">
|
||||||
|
<property name="text">
|
||||||
|
<string>...</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="0">
|
||||||
|
<spacer name="verticalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>40</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<resources>
|
||||||
|
<include location="core.qrc"/>
|
||||||
|
</resources>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
After Width: | Height: | Size: 21 KiB |
After Width: | Height: | Size: 43 KiB |
After Width: | Height: | Size: 52 KiB |
@ -0,0 +1,43 @@
|
|||||||
|
INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_BINARY_DIR}
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
|
${LIBXML2_INCLUDE_DIR}
|
||||||
|
${QT_INCLUDES})
|
||||||
|
|
||||||
|
FILE(GLOB SRC *.cpp *.h)
|
||||||
|
SET(OVQT_EXT_SYS_SRC ${CMAKE_CURRENT_SOURCE_DIR}/../../extension_system/iplugin.h
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/../../extension_system/iplugin_manager.h
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/../../extension_system/iplugin_spec.h)
|
||||||
|
|
||||||
|
SET(OVQT_PLUG_GEORGES_EDITOR_HDR georges_editor_plugin.h
|
||||||
|
georges_editor_form.h
|
||||||
|
georges_dirtree_dialog.h)
|
||||||
|
|
||||||
|
SET(OVQT_PLUG_GEORGES_EDITOR_UIS georges_editor_form.ui
|
||||||
|
georges_dirtree_form.ui)
|
||||||
|
|
||||||
|
SET(OVQT_PLUGIN_GEORGES_EDITOR_RCS georges_editor.qrc)
|
||||||
|
|
||||||
|
SET(QT_USE_QTGUI TRUE)
|
||||||
|
SET(QT_USE_QTOPENGL TRUE)
|
||||||
|
|
||||||
|
QT4_ADD_RESOURCES(OVQT_PLUGIN_GEORGES_EDITOR_RC_SRCS ${OVQT_PLUGIN_GEORGES_EDITOR_RCS})
|
||||||
|
QT4_WRAP_CPP(OVQT_PLUG_GEORGES_EDITOR_MOC_SRC ${OVQT_PLUG_GEORGES_EDITOR_HDR})
|
||||||
|
QT4_WRAP_UI( OVQT_PLUG_GEORGES_EDITOR_UI_HDRS ${OVQT_PLUG_GEORGES_EDITOR_UIS} )
|
||||||
|
|
||||||
|
SOURCE_GROUP(QtResources FILES ${OVQT_PLUG_GEORGES_EDITOR_UIS} ${OVQT_PLUGIN_GEORGES_EDITOR_RCS})
|
||||||
|
SOURCE_GROUP(QtGeneratedUiHdr FILES ${OVQT_PLUG_GEORGES_EDITOR_UI_HDRS})
|
||||||
|
SOURCE_GROUP(QtGeneratedMocSrc FILES ${OVQT_PLUG_GEORGES_EDITOR_MOC_SRC})
|
||||||
|
SOURCE_GROUP("Georges Editor Plugin" FILES ${SRC})
|
||||||
|
SOURCE_GROUP("OVQT Extension System" FILES ${OVQT_EXT_SYS_SRC})
|
||||||
|
|
||||||
|
ADD_LIBRARY(ovqt_plugin_georges_editor MODULE ${SRC} ${OVQT_PLUG_GEORGES_EDITOR_MOC_SRC} ${OVQT_EXT_SYS_SRC} ${OVQT_PLUG_GEORGES_EDITOR_UI_HDRS} ${OVQT_PLUGIN_GEORGES_EDITOR_RC_SRCS})
|
||||||
|
|
||||||
|
TARGET_LINK_LIBRARIES(ovqt_plugin_georges_editor ovqt_plugin_core nelmisc ${QT_LIBRARIES})
|
||||||
|
|
||||||
|
NL_DEFAULT_PROPS(ovqt_plugin_georges_editor "NeL, Tools, 3D: Object Viewer Qt Plugin: Georges Editor")
|
||||||
|
NL_ADD_RUNTIME_FLAGS(ovqt_plugin_georges_editor)
|
||||||
|
NL_ADD_LIB_SUFFIX(ovqt_plugin_georges_editor)
|
||||||
|
|
||||||
|
ADD_DEFINITIONS(${LIBXML2_DEFINITIONS} -DQT_PLUGIN -DQT_SHARED ${QT_DEFINITIONS})
|
||||||
|
|
||||||
|
INSTALL(TARGETS ovqt_plugin_georges_editor LIBRARY DESTINATION lib RUNTIME DESTINATION bin ARCHIVE DESTINATION lib COMPONENT tools3d)
|
@ -0,0 +1,99 @@
|
|||||||
|
// Object Viewer Qt - Georges Editor 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 "georges_dirtree_dialog.h"
|
||||||
|
|
||||||
|
// Qt includes
|
||||||
|
#include <QtGui/QWidget>
|
||||||
|
#include <QSettings>
|
||||||
|
|
||||||
|
// NeL includes
|
||||||
|
|
||||||
|
//using namespace NLMISC;
|
||||||
|
|
||||||
|
namespace Plugin
|
||||||
|
{
|
||||||
|
|
||||||
|
CGeorgesDirTreeDialog::CGeorgesDirTreeDialog(QString ldPath, QWidget *parent)
|
||||||
|
:QDockWidget(parent), m_ldPath(ldPath)
|
||||||
|
{
|
||||||
|
|
||||||
|
m_ui.setupUi(this);
|
||||||
|
|
||||||
|
m_dirModel = new CGeorgesFileSystemModel(m_ldPath);
|
||||||
|
m_ui.dirTree->setModel(m_dirModel);
|
||||||
|
|
||||||
|
if (m_dirModel->isCorrectLDPath())
|
||||||
|
{
|
||||||
|
m_dirModel->setRootPath(m_ldPath);
|
||||||
|
m_ui.dirTree->setRootIndex(m_dirModel->index(m_ldPath));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_dirModel->setRootPath(QDir::currentPath());
|
||||||
|
}
|
||||||
|
|
||||||
|
m_ui.dirTree->setAnimated(false);
|
||||||
|
m_ui.dirTree->setIndentation(20);
|
||||||
|
|
||||||
|
connect(m_ui.dirTree, SIGNAL(activated(QModelIndex)),
|
||||||
|
this, SLOT(fileSelected(QModelIndex)));
|
||||||
|
}
|
||||||
|
|
||||||
|
CGeorgesDirTreeDialog::~CGeorgesDirTreeDialog()
|
||||||
|
{
|
||||||
|
delete m_dirModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CGeorgesDirTreeDialog::fileSelected(QModelIndex index)
|
||||||
|
{
|
||||||
|
QString name;
|
||||||
|
if (index.isValid() && !m_dirModel->isDir(index))
|
||||||
|
{
|
||||||
|
Q_EMIT selectedForm(m_dirModel->fileName(index));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CGeorgesDirTreeDialog::changeFile(QString file)
|
||||||
|
{
|
||||||
|
QModelIndex index = m_dirModel->index(file);
|
||||||
|
m_ui.dirTree->selectionModel()->select(index,QItemSelectionModel::ClearAndSelect);
|
||||||
|
m_ui.dirTree->scrollTo(index,QAbstractItemView::PositionAtCenter);
|
||||||
|
fileSelected(index);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CGeorgesDirTreeDialog::ldPathChanged(QString path)
|
||||||
|
{
|
||||||
|
m_ldPath = path;
|
||||||
|
|
||||||
|
delete m_dirModel;
|
||||||
|
|
||||||
|
m_dirModel = new CGeorgesFileSystemModel(m_ldPath);
|
||||||
|
m_ui.dirTree->setModel(m_dirModel);
|
||||||
|
|
||||||
|
if (m_dirModel->isCorrectLDPath())
|
||||||
|
{
|
||||||
|
m_dirModel->setRootPath(m_ldPath);
|
||||||
|
m_ui.dirTree->setRootIndex(m_dirModel->index(m_ldPath));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_dirModel->setRootPath(QDir::currentPath());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} /* namespace NLQT */
|
@ -0,0 +1,62 @@
|
|||||||
|
// Object Viewer Qt - Georges Editor 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/>.
|
||||||
|
|
||||||
|
#ifndef GEORGES_DIRTREE_DIALOG_H
|
||||||
|
#define GEORGES_DIRTREE_DIALOG_H
|
||||||
|
|
||||||
|
// Qt includes
|
||||||
|
#include <QtGui/QWidget>
|
||||||
|
|
||||||
|
// STL includes
|
||||||
|
|
||||||
|
// NeL includes
|
||||||
|
|
||||||
|
// Project includes
|
||||||
|
#include "ui_georges_dirtree_form.h"
|
||||||
|
#include "georges_filesystem_model.h"
|
||||||
|
|
||||||
|
namespace Plugin
|
||||||
|
{
|
||||||
|
|
||||||
|
class CGeorgesDirTreeDialog: public QDockWidget
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
CGeorgesDirTreeDialog(QString ldPath, QWidget *parent = 0);
|
||||||
|
~CGeorgesDirTreeDialog();
|
||||||
|
|
||||||
|
void ldPathChanged(QString);
|
||||||
|
|
||||||
|
private:
|
||||||
|
Ui::CGeorgesDirTreeDialog m_ui;
|
||||||
|
|
||||||
|
CGeorgesFileSystemModel *m_dirModel;
|
||||||
|
QString m_ldPath;
|
||||||
|
|
||||||
|
Q_SIGNALS:
|
||||||
|
void selectedForm(const QString);
|
||||||
|
|
||||||
|
private Q_SLOTS:
|
||||||
|
void fileSelected(QModelIndex index);
|
||||||
|
void changeFile(QString file);
|
||||||
|
|
||||||
|
friend class CMainWindow;
|
||||||
|
}; /* CGEorgesDirTreeDialog */
|
||||||
|
|
||||||
|
} /* namespace NLQT */
|
||||||
|
|
||||||
|
#endif // GEORGES_DIRTREE_DIALOG_H
|
@ -0,0 +1,54 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>CGeorgesDirTreeDialog</class>
|
||||||
|
<widget class="QDockWidget" name="CGeorgesDirTreeDialog">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>400</width>
|
||||||
|
<height>300</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>200</width>
|
||||||
|
<height>111</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="features">
|
||||||
|
<set>QDockWidget::DockWidgetFloatable|QDockWidget::DockWidgetMovable</set>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Leveldesign Path</string>
|
||||||
|
</property>
|
||||||
|
<widget class="QWidget" name="dockWidgetContents">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>50</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QTreeView" name="dirTree">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
@ -0,0 +1,5 @@
|
|||||||
|
<RCC>
|
||||||
|
<qresource>
|
||||||
|
<file>images/ic_nel_georges_editor.png</file>
|
||||||
|
</qresource>
|
||||||
|
</RCC>
|
@ -0,0 +1,31 @@
|
|||||||
|
// Object Viewer Qt - Georges Editor 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/>.
|
||||||
|
|
||||||
|
#ifndef GEORGES_EDITOR_CONSTANTS_H
|
||||||
|
#define GEORGES_EDITOR_CONSTANTS_H
|
||||||
|
|
||||||
|
namespace Plugin
|
||||||
|
{
|
||||||
|
namespace Constants
|
||||||
|
{
|
||||||
|
//settings
|
||||||
|
const char * const GEORGES_EDITOR_SECTION = "GeorgesEditor";
|
||||||
|
|
||||||
|
|
||||||
|
} // namespace Constants
|
||||||
|
} // namespace Plugin
|
||||||
|
|
||||||
|
#endif // GEORGES_EDITOR_CONSTANTS_H
|
@ -0,0 +1,139 @@
|
|||||||
|
// Object Viewer Qt - Georges Editor 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 "georges_editor_form.h"
|
||||||
|
#include "georges_editor_constants.h"
|
||||||
|
#include "georges_dirtree_dialog.h"
|
||||||
|
|
||||||
|
#include "../core/icore.h"
|
||||||
|
#include "../core/imenu_manager.h"
|
||||||
|
#include "../core/core_constants.h"
|
||||||
|
|
||||||
|
// NeL includes
|
||||||
|
#include <nel/misc/debug.h>
|
||||||
|
|
||||||
|
// Qt includes
|
||||||
|
#include <QSettings>
|
||||||
|
#include <QFileDialog>
|
||||||
|
#include <QToolBar>
|
||||||
|
|
||||||
|
namespace Plugin
|
||||||
|
{
|
||||||
|
|
||||||
|
GeorgesEditorForm::GeorgesEditorForm(QWidget *parent)
|
||||||
|
: QMainWindow(parent),
|
||||||
|
m_georgesDirTreeDialog(0)
|
||||||
|
{
|
||||||
|
m_ui.setupUi(this);
|
||||||
|
|
||||||
|
m_undoStack = new QUndoStack(this);
|
||||||
|
|
||||||
|
_openAction = new QAction(tr("&Open..."), this);
|
||||||
|
_openAction->setIcon(QIcon(Core::Constants::ICON_OPEN));
|
||||||
|
_openAction->setShortcut(QKeySequence::Open);
|
||||||
|
_openAction->setStatusTip(tr("Open an existing file"));
|
||||||
|
connect(_openAction, SIGNAL(triggered()), this, SLOT(open()));
|
||||||
|
|
||||||
|
_newAction = new QAction(tr("&New..."), this);
|
||||||
|
_newAction->setIcon(QIcon(Core::Constants::ICON_NEW));
|
||||||
|
_newAction->setShortcut(QKeySequence::New);
|
||||||
|
_newAction->setStatusTip(tr("Create a new file"));
|
||||||
|
connect(_newAction, SIGNAL(triggered()), this, SLOT(newFile()));
|
||||||
|
|
||||||
|
_saveAction = new QAction(tr("&Save..."), this);
|
||||||
|
_saveAction->setIcon(QIcon(Core::Constants::ICON_SAVE));
|
||||||
|
_saveAction->setShortcut(QKeySequence::Save);
|
||||||
|
_saveAction->setStatusTip(tr("Save the current file"));
|
||||||
|
connect(_saveAction, SIGNAL(triggered()), this, SLOT(save()));
|
||||||
|
|
||||||
|
_fileToolBar = addToolBar(tr("&File"));
|
||||||
|
_fileToolBar->addAction(_openAction);
|
||||||
|
_fileToolBar->addAction(_newAction);
|
||||||
|
_fileToolBar->addAction(_saveAction);
|
||||||
|
|
||||||
|
readSettings();
|
||||||
|
|
||||||
|
// create leveldesign directory tree dockwidget
|
||||||
|
m_georgesDirTreeDialog = new CGeorgesDirTreeDialog(m_leveldesignPath, this);
|
||||||
|
addDockWidget(Qt::LeftDockWidgetArea, m_georgesDirTreeDialog);
|
||||||
|
//m_georgesDirTreeDialog->setVisible(false);
|
||||||
|
connect(Core::ICore::instance(), SIGNAL(changeSettings()),
|
||||||
|
this, SLOT(settingsChanged()));
|
||||||
|
}
|
||||||
|
|
||||||
|
GeorgesEditorForm::~GeorgesEditorForm()
|
||||||
|
{
|
||||||
|
writeSettings();
|
||||||
|
}
|
||||||
|
|
||||||
|
QUndoStack *GeorgesEditorForm::undoStack() const
|
||||||
|
{
|
||||||
|
return m_undoStack;
|
||||||
|
}
|
||||||
|
|
||||||
|
void GeorgesEditorForm::open()
|
||||||
|
{
|
||||||
|
// TODO: FileDialog & loadFile();
|
||||||
|
//QString fileName = QFileDialog::getOpenFileName();
|
||||||
|
//loadFile(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
void GeorgesEditorForm::newFile()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void GeorgesEditorForm::save()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void GeorgesEditorForm::readSettings()
|
||||||
|
{
|
||||||
|
QSettings *settings = Core::ICore::instance()->settings();
|
||||||
|
settings->beginGroup(Constants::GEORGES_EDITOR_SECTION);
|
||||||
|
settings->endGroup();
|
||||||
|
|
||||||
|
settings->beginGroup(Core::Constants::DATA_PATH_SECTION);
|
||||||
|
m_leveldesignPath = settings->value(Core::Constants::LEVELDESIGN_PATH, "l:/leveldesign").toString();
|
||||||
|
settings->endGroup();
|
||||||
|
}
|
||||||
|
|
||||||
|
void GeorgesEditorForm::writeSettings()
|
||||||
|
{
|
||||||
|
QSettings *settings = Core::ICore::instance()->settings();
|
||||||
|
settings->beginGroup(Constants::GEORGES_EDITOR_SECTION);
|
||||||
|
settings->endGroup();
|
||||||
|
settings->sync();
|
||||||
|
}
|
||||||
|
|
||||||
|
void GeorgesEditorForm::settingsChanged()
|
||||||
|
{
|
||||||
|
QSettings *settings = Core::ICore::instance()->settings();
|
||||||
|
|
||||||
|
settings->beginGroup(Core::Constants::DATA_PATH_SECTION);
|
||||||
|
QString oldLDPath = m_leveldesignPath;
|
||||||
|
m_leveldesignPath = settings->value(Core::Constants::LEVELDESIGN_PATH, "l:/leveldesign").toString();
|
||||||
|
settings->endGroup();
|
||||||
|
|
||||||
|
if (oldLDPath != m_leveldesignPath)
|
||||||
|
{
|
||||||
|
m_georgesDirTreeDialog->ldPathChanged(m_leveldesignPath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} /* namespace Plugin */
|
@ -0,0 +1,64 @@
|
|||||||
|
// Object Viewer Qt - Georges Editor 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/>.
|
||||||
|
|
||||||
|
#ifndef GEORGES_EDITOR_FORM_H
|
||||||
|
#define GEORGES_EDITOR_FORM_H
|
||||||
|
|
||||||
|
// Project includes
|
||||||
|
#include "ui_georges_editor_form.h"
|
||||||
|
|
||||||
|
// Qt includes
|
||||||
|
#include <QtGui/QUndoStack>
|
||||||
|
|
||||||
|
namespace Plugin
|
||||||
|
{
|
||||||
|
|
||||||
|
class CGeorgesDirTreeDialog;
|
||||||
|
class GeorgesEditorForm: public QMainWindow
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
GeorgesEditorForm(QWidget *parent = 0);
|
||||||
|
~GeorgesEditorForm();
|
||||||
|
|
||||||
|
QUndoStack *undoStack() const;
|
||||||
|
|
||||||
|
public Q_SLOTS:
|
||||||
|
void open();
|
||||||
|
void newFile();
|
||||||
|
void save();
|
||||||
|
void settingsChanged();
|
||||||
|
|
||||||
|
private:
|
||||||
|
void readSettings();
|
||||||
|
void writeSettings();
|
||||||
|
|
||||||
|
QUndoStack *m_undoStack;
|
||||||
|
Ui::GeorgesEditorForm m_ui;
|
||||||
|
|
||||||
|
CGeorgesDirTreeDialog *m_georgesDirTreeDialog;
|
||||||
|
QToolBar *_fileToolBar;
|
||||||
|
QAction *_openAction;
|
||||||
|
QAction *_newAction;
|
||||||
|
QAction *_saveAction;
|
||||||
|
|
||||||
|
QString m_leveldesignPath;
|
||||||
|
}; /* class GeorgesEditorForm */
|
||||||
|
|
||||||
|
} /* namespace Plugin */
|
||||||
|
|
||||||
|
#endif // GEORGES_EDITOR_FORM_H
|
@ -0,0 +1,28 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>GeorgesEditorForm</class>
|
||||||
|
<widget class="QMainWindow" name="GeorgesEditorForm">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>800</width>
|
||||||
|
<height>600</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Georges Editor</string>
|
||||||
|
</property>
|
||||||
|
<widget class="QWidget" name="centralwidget">
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true">QWidget#centralwidget {
|
||||||
|
image: url(:/images/ic_nel_georges_editor.png);
|
||||||
|
}</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
<resources>
|
||||||
|
<include location="georges_editor.qrc"/>
|
||||||
|
</resources>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
@ -0,0 +1,128 @@
|
|||||||
|
// Object Viewer Qt - Georges Editor 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 "georges_editor_plugin.h"
|
||||||
|
#include "georges_editor_form.h"
|
||||||
|
|
||||||
|
#include "../core/icore.h"
|
||||||
|
#include "../core/core_constants.h"
|
||||||
|
|
||||||
|
// NeL includes
|
||||||
|
#include "nel/misc/debug.h"
|
||||||
|
|
||||||
|
// Qt includes
|
||||||
|
#include <QtCore/QObject>
|
||||||
|
|
||||||
|
namespace Plugin
|
||||||
|
{
|
||||||
|
|
||||||
|
GeorgesEditorPlugin::~GeorgesEditorPlugin()
|
||||||
|
{
|
||||||
|
Q_FOREACH(QObject *obj, m_autoReleaseObjects)
|
||||||
|
{
|
||||||
|
m_plugMan->removeObject(obj);
|
||||||
|
}
|
||||||
|
qDeleteAll(m_autoReleaseObjects);
|
||||||
|
m_autoReleaseObjects.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool GeorgesEditorPlugin::initialize(ExtensionSystem::IPluginManager *pluginManager, QString *errorString)
|
||||||
|
{
|
||||||
|
Q_UNUSED(errorString);
|
||||||
|
m_plugMan = pluginManager;
|
||||||
|
|
||||||
|
addAutoReleasedObject(new GeorgesEditorContext(this));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void GeorgesEditorPlugin::extensionsInitialized()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void GeorgesEditorPlugin::shutdown()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void GeorgesEditorPlugin::setNelContext(NLMISC::INelContext *nelContext)
|
||||||
|
{
|
||||||
|
#ifdef NL_OS_WINDOWS
|
||||||
|
// Ensure that a context doesn't exist yet.
|
||||||
|
// This only applies to platforms without PIC, e.g. Windows.
|
||||||
|
nlassert(!NLMISC::INelContext::isContextInitialised());
|
||||||
|
#endif // NL_OS_WINDOWS
|
||||||
|
m_libContext = new NLMISC::CLibraryContext(*nelContext);
|
||||||
|
}
|
||||||
|
|
||||||
|
QString GeorgesEditorPlugin::name() const
|
||||||
|
{
|
||||||
|
return tr("Georges Editor");
|
||||||
|
}
|
||||||
|
|
||||||
|
QString GeorgesEditorPlugin::version() const
|
||||||
|
{
|
||||||
|
return "0.2";
|
||||||
|
}
|
||||||
|
|
||||||
|
QString GeorgesEditorPlugin::vendor() const
|
||||||
|
{
|
||||||
|
return "aquiles";
|
||||||
|
}
|
||||||
|
|
||||||
|
QString GeorgesEditorPlugin::description() const
|
||||||
|
{
|
||||||
|
return tr("Tool to create & edit sheets or forms.");
|
||||||
|
}
|
||||||
|
|
||||||
|
QStringList GeorgesEditorPlugin::dependencies() const
|
||||||
|
{
|
||||||
|
QStringList list;
|
||||||
|
list.append(Core::Constants::OVQT_CORE_PLUGIN);
|
||||||
|
list.append("ObjectViewer"); // TODO
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
void GeorgesEditorPlugin::addAutoReleasedObject(QObject *obj)
|
||||||
|
{
|
||||||
|
m_plugMan->addObject(obj);
|
||||||
|
m_autoReleaseObjects.prepend(obj);
|
||||||
|
}
|
||||||
|
|
||||||
|
GeorgesEditorContext::GeorgesEditorContext(QObject *parent)
|
||||||
|
: IContext(parent),
|
||||||
|
m_georgesEditorForm(0)
|
||||||
|
{
|
||||||
|
m_georgesEditorForm = new GeorgesEditorForm();
|
||||||
|
}
|
||||||
|
|
||||||
|
QUndoStack *GeorgesEditorContext::undoStack()
|
||||||
|
{
|
||||||
|
return m_georgesEditorForm->undoStack();
|
||||||
|
}
|
||||||
|
|
||||||
|
void GeorgesEditorContext::open()
|
||||||
|
{
|
||||||
|
m_georgesEditorForm->open();
|
||||||
|
}
|
||||||
|
|
||||||
|
QWidget *GeorgesEditorContext::widget()
|
||||||
|
{
|
||||||
|
return m_georgesEditorForm;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Q_EXPORT_PLUGIN(Plugin::GeorgesEditorPlugin)
|
@ -0,0 +1,105 @@
|
|||||||
|
// Object Viewer Qt - Georges Editor 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/>.
|
||||||
|
|
||||||
|
#ifndef GEORGES_EDITOR_PLUGIN_H
|
||||||
|
#define GEORGES_EDITOR_PLUGIN_H
|
||||||
|
|
||||||
|
// Project includes
|
||||||
|
#include "../../extension_system/iplugin.h"
|
||||||
|
#include "../core/icontext.h"
|
||||||
|
|
||||||
|
// NeL includes
|
||||||
|
#include "nel/misc/app_context.h"
|
||||||
|
|
||||||
|
// Qt includes
|
||||||
|
#include <QtCore/QObject>
|
||||||
|
#include <QtGui/QIcon>
|
||||||
|
|
||||||
|
namespace NLMISC
|
||||||
|
{
|
||||||
|
class CLibraryContext;
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace ExtensionSystem
|
||||||
|
{
|
||||||
|
class IPluginSpec;
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace Plugin
|
||||||
|
{
|
||||||
|
class GeorgesEditorForm;
|
||||||
|
class GeorgesEditorPlugin : public QObject, public ExtensionSystem::IPlugin
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
Q_INTERFACES(ExtensionSystem::IPlugin)
|
||||||
|
public:
|
||||||
|
|
||||||
|
virtual ~GeorgesEditorPlugin();
|
||||||
|
|
||||||
|
bool initialize(ExtensionSystem::IPluginManager *pluginManager, QString *errorString);
|
||||||
|
void extensionsInitialized();
|
||||||
|
void shutdown();
|
||||||
|
|
||||||
|
void setNelContext(NLMISC::INelContext *nelContext);
|
||||||
|
|
||||||
|
QString name() const;
|
||||||
|
QString version() const;
|
||||||
|
QString vendor() const;
|
||||||
|
QString description() const;
|
||||||
|
QStringList dependencies() const;
|
||||||
|
|
||||||
|
void addAutoReleasedObject(QObject *obj);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
NLMISC::CLibraryContext *m_libContext;
|
||||||
|
|
||||||
|
private:
|
||||||
|
ExtensionSystem::IPluginManager *m_plugMan;
|
||||||
|
QList<QObject *> m_autoReleaseObjects;
|
||||||
|
};
|
||||||
|
|
||||||
|
class GeorgesEditorContext: public Core::IContext
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
GeorgesEditorContext(QObject *parent = 0);
|
||||||
|
virtual ~GeorgesEditorContext() {}
|
||||||
|
|
||||||
|
virtual QString id() const
|
||||||
|
{
|
||||||
|
return QLatin1String("GeorgesEditorContext");
|
||||||
|
}
|
||||||
|
virtual QString trName() const
|
||||||
|
{
|
||||||
|
return tr("Georges Editor");
|
||||||
|
}
|
||||||
|
virtual QIcon icon() const
|
||||||
|
{
|
||||||
|
return QIcon(":/images/ic_nel_georges_editor.png");
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void open();
|
||||||
|
|
||||||
|
virtual QUndoStack *undoStack();
|
||||||
|
|
||||||
|
virtual QWidget *widget();
|
||||||
|
|
||||||
|
GeorgesEditorForm *m_georgesEditorForm;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace Plugin
|
||||||
|
|
||||||
|
#endif // LANDSCAPE_EDITOR_PLUGIN_H
|
@ -0,0 +1,95 @@
|
|||||||
|
// Object Viewer Qt - Georges Editor 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/>.
|
||||||
|
|
||||||
|
#include "georges_filesystem_model.h"
|
||||||
|
|
||||||
|
#include <QApplication>
|
||||||
|
#include <QStyle>
|
||||||
|
|
||||||
|
namespace Plugin
|
||||||
|
{
|
||||||
|
|
||||||
|
CGeorgesFileSystemModel::CGeorgesFileSystemModel(QString ldPath, QObject *parent)
|
||||||
|
: QFileSystemModel(parent),
|
||||||
|
m_ldPath(ldPath),
|
||||||
|
m_correct(false)
|
||||||
|
{
|
||||||
|
checkLDPath();
|
||||||
|
}
|
||||||
|
|
||||||
|
CGeorgesFileSystemModel::~CGeorgesFileSystemModel()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
QVariant CGeorgesFileSystemModel::data(const QModelIndex& index, int role) const
|
||||||
|
{
|
||||||
|
|
||||||
|
if (role == Qt::DecorationRole)
|
||||||
|
{
|
||||||
|
if (!m_correct)
|
||||||
|
return QVariant();
|
||||||
|
if (isDir(index))
|
||||||
|
return QApplication::style()->standardIcon(QStyle::SP_DirIcon);
|
||||||
|
}
|
||||||
|
if (!m_correct && role == Qt::DisplayRole)
|
||||||
|
{
|
||||||
|
if (index.parent().isValid())
|
||||||
|
return QVariant();
|
||||||
|
return tr("Set a correct leveldesign path ...");
|
||||||
|
}
|
||||||
|
return QFileSystemModel::data(index, role);
|
||||||
|
}
|
||||||
|
|
||||||
|
int CGeorgesFileSystemModel::columnCount(const QModelIndex &/*parent*/) const
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int CGeorgesFileSystemModel::rowCount(const QModelIndex &parent) const
|
||||||
|
{
|
||||||
|
|
||||||
|
if (!m_correct)
|
||||||
|
{
|
||||||
|
if(parent.isValid())
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return qMin(QFileSystemModel::rowCount(parent),1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return QFileSystemModel::rowCount(parent);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CGeorgesFileSystemModel::checkLDPath()
|
||||||
|
{
|
||||||
|
QFileInfo check1(QString("%1/game_element").arg(m_ldPath));
|
||||||
|
QFileInfo check2(QString("%1/DFN").arg(m_ldPath));
|
||||||
|
|
||||||
|
if (check1.exists() && check2.exists())
|
||||||
|
{
|
||||||
|
m_correct = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_correct = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} /* namespace NLQT */
|
||||||
|
|
||||||
|
/* end of file */
|
@ -0,0 +1,50 @@
|
|||||||
|
// Object Viewer Qt - Georges Editor 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/>.
|
||||||
|
|
||||||
|
#ifndef GEORGES_FILESYSTEM_MODEL_H
|
||||||
|
#define GEORGES_FILESYSTEM_MODEL_H
|
||||||
|
|
||||||
|
#include <QtGui/QFileSystemModel>
|
||||||
|
|
||||||
|
namespace Plugin
|
||||||
|
{
|
||||||
|
|
||||||
|
class CGeorgesFileSystemModel : public QFileSystemModel
|
||||||
|
{
|
||||||
|
QString m_ldPath;
|
||||||
|
|
||||||
|
public:
|
||||||
|
CGeorgesFileSystemModel(QString ldPath, QObject *parent = 0);
|
||||||
|
~CGeorgesFileSystemModel();
|
||||||
|
|
||||||
|
int columnCount(const QModelIndex &/*parent*/) const;
|
||||||
|
int rowCount(const QModelIndex &/*parent*/) const;
|
||||||
|
|
||||||
|
QVariant data(const QModelIndex& index, int role) const ;
|
||||||
|
|
||||||
|
bool isCorrectLDPath()
|
||||||
|
{
|
||||||
|
return m_correct;
|
||||||
|
}
|
||||||
|
void checkLDPath();
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool m_correct;
|
||||||
|
};/* class CGeorgesFileSystemModel */
|
||||||
|
|
||||||
|
} /* namespace NLQT */
|
||||||
|
|
||||||
|
#endif // GEORGES_FILESYSTEM_MODEL_H
|
After Width: | Height: | Size: 36 KiB |
@ -0,0 +1,48 @@
|
|||||||
|
INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_BINARY_DIR}
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
|
${LIBXML2_INCLUDE_DIR}
|
||||||
|
${QT_INCLUDES})
|
||||||
|
|
||||||
|
FILE(GLOB SRC *.cpp *.h)
|
||||||
|
|
||||||
|
SET(OVQT_EXT_SYS_SRC ${CMAKE_CURRENT_SOURCE_DIR}/../../extension_system/iplugin.h
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/../../extension_system/iplugin_manager.h
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/../../extension_system/iplugin_spec.h)
|
||||||
|
|
||||||
|
SET(OVQT_PLUGIN_LANDSCAPE_EDITOR_HDR landscape_editor_plugin.h
|
||||||
|
landscape_editor_window.h
|
||||||
|
)
|
||||||
|
|
||||||
|
SET(OVQT_PLUGIN_LANDSCAPE_EDITOR_UIS landscape_editor_window.ui
|
||||||
|
)
|
||||||
|
|
||||||
|
SET(OVQT_PLUGIN_LANDSCAPE_EDITOR_RCS landscape_editor.qrc)
|
||||||
|
|
||||||
|
SET(QT_USE_QTGUI TRUE)
|
||||||
|
SET(QT_USE_QTOPENGL TRUE)
|
||||||
|
|
||||||
|
QT4_ADD_RESOURCES(OVQT_PLUGIN_LANDSCAPE_EDITOR_RC_SRCS ${OVQT_PLUGIN_LANDSCAPE_EDITOR_RCS})
|
||||||
|
QT4_WRAP_CPP(OVQT_PLUGIN_LANDSCAPE_EDITOR_MOC_SRC ${OVQT_PLUGIN_LANDSCAPE_EDITOR_HDR})
|
||||||
|
QT4_WRAP_UI(OVQT_PLUGIN_LANDSCAPE_EDITOR_UI_HDRS ${OVQT_PLUGIN_LANDSCAPE_EDITOR_UIS})
|
||||||
|
|
||||||
|
SOURCE_GROUP(QtResources FILES ${OVQT_PLUGIN_LANDSCAPE_EDITOR_UIS})
|
||||||
|
SOURCE_GROUP(QtGeneratedUiHdr FILES ${OVQT_PLUGIN_LANDSCAPE_EDITOR_UI_HDRS})
|
||||||
|
SOURCE_GROUP(QtGeneratedMocQrcSrc FILES ${OVQT_PLUGIN_LANDSCAPE_EDITOR_MOC_SRC} OVQT_PLUGIN_LANDSCAPE_EDITOR_RC_SRCS)
|
||||||
|
SOURCE_GROUP("Landscape Editor Plugin" FILES ${SRC})
|
||||||
|
SOURCE_GROUP("OVQT Extension System" FILES ${OVQT_EXT_SYS_SRC})
|
||||||
|
|
||||||
|
ADD_LIBRARY(ovqt_plugin_landscape_editor MODULE ${SRC}
|
||||||
|
${OVQT_PLUGIN_LANDSCAPE_EDITOR_MOC_SRC}
|
||||||
|
${OVQT_EXT_SYS_SRC}
|
||||||
|
${OVQT_PLUGIN_LANDSCAPE_EDITOR_UI_HDRS}
|
||||||
|
${OVQT_PLUGIN_LANDSCAPE_EDITOR_RC_SRCS})
|
||||||
|
|
||||||
|
TARGET_LINK_LIBRARIES(ovqt_plugin_landscape_editor ovqt_plugin_core nelmisc nel3d ${QT_LIBRARIES} ${QT_QTOPENGL_LIBRARY})
|
||||||
|
|
||||||
|
NL_DEFAULT_PROPS(ovqt_plugin_landscape_editor "NeL, Tools, 3D: Object Viewer Qt Plugin: Landscape Editor")
|
||||||
|
NL_ADD_RUNTIME_FLAGS(ovqt_plugin_landscape_editor)
|
||||||
|
NL_ADD_LIB_SUFFIX(ovqt_plugin_landscape_editor)
|
||||||
|
|
||||||
|
ADD_DEFINITIONS(-DLANDSCAPE_EDITOR_LIBRARY ${LIBXML2_DEFINITIONS} -DQT_PLUGIN -DQT_SHARED ${QT_DEFINITIONS})
|
||||||
|
|
||||||
|
INSTALL(TARGETS ovqt_plugin_landscape_editor LIBRARY DESTINATION lib RUNTIME DESTINATION bin ARCHIVE DESTINATION lib COMPONENT tools3d)
|
After Width: | Height: | Size: 56 KiB |
After Width: | Height: | Size: 30 KiB |
After Width: | Height: | Size: 43 KiB |
After Width: | Height: | Size: 46 KiB |
After Width: | Height: | Size: 56 KiB |
@ -0,0 +1,9 @@
|
|||||||
|
<RCC>
|
||||||
|
<qresource prefix="/">
|
||||||
|
<file>icons/ic_nel_landscape_item.png</file>
|
||||||
|
<file>icons/ic_nel_landscape_settings.png</file>
|
||||||
|
<file>icons/ic_nel_world_editor.png</file>
|
||||||
|
<file>icons/ic_nel_zone.png</file>
|
||||||
|
<file>icons/ic_nel_zonel.png</file>
|
||||||
|
</qresource>
|
||||||
|
</RCC>
|
@ -0,0 +1,37 @@
|
|||||||
|
// Object Viewer Qt - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
||||||
|
// Copyright (C) 2010 Winch Gate Property Limited
|
||||||
|
// Copyright (C) 2011 Dzmitry Kamiahin <dnk-88@tut.by>
|
||||||
|
//
|
||||||
|
// This program is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU Affero General Public License as
|
||||||
|
// published by the Free Software Foundation, either version 3 of the
|
||||||
|
// License, or (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This program is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU Affero General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU Affero General Public License
|
||||||
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
#ifndef LANDSCAPE_EDITOR_CONSTANTS_H
|
||||||
|
#define LANDSCAPE_EDITOR_CONSTANTS_H
|
||||||
|
|
||||||
|
namespace LandscapeEditor
|
||||||
|
{
|
||||||
|
namespace Constants
|
||||||
|
{
|
||||||
|
const char * const LANDSCAPE_EDITOR_PLUGIN = "LandscapeEditor";
|
||||||
|
|
||||||
|
//settings
|
||||||
|
const char * const LANDSCAPE_EDITOR_SECTION = "LandscapeEditor";
|
||||||
|
|
||||||
|
//resources
|
||||||
|
const char * const ICON_LANDSCAPE_ITEM = ":/icons/ic_nel_landscape_item.png";
|
||||||
|
|
||||||
|
|
||||||
|
} // namespace Constants
|
||||||
|
} // namespace LandscapeEditor
|
||||||
|
|
||||||
|
#endif // LANDSCAPE_EDITOR_CONSTANTS_H
|