mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-12-16 06:18:43 +00:00
Changed: #1206 log plugin saves changes now and loads/unloads displayer on the fly
This commit is contained in:
parent
be4f9c91cc
commit
8359297f76
7 changed files with 403 additions and 271 deletions
|
@ -80,6 +80,13 @@ const char * const LEVELDESIGN_PATH = "LevelDesignPath";
|
||||||
const char * const ASSETS_PATH = "AssetsPath";
|
const char * const ASSETS_PATH = "AssetsPath";
|
||||||
const char * const REMAP_EXTENSIONS = "RemapExtensions";
|
const char * const REMAP_EXTENSIONS = "RemapExtensions";
|
||||||
|
|
||||||
|
const char * const LOG_SECTION = "LogSettings";
|
||||||
|
const char * const LOG_ERROR = "LogError";
|
||||||
|
const char * const LOG_WARNING = "LogWarning";
|
||||||
|
const char * const LOG_DEBUG = "LogDebug";
|
||||||
|
const char * const LOG_ASSERT = "LogAssert";
|
||||||
|
const char * const LOG_INFO = "LogInfo";
|
||||||
|
|
||||||
//resources
|
//resources
|
||||||
const char * const ICON_NEL = ":/core/images/nel.png";
|
const char * const ICON_NEL = ":/core/images/nel.png";
|
||||||
const char * const ICON_SETTINGS = ":/core/images/preferences.png";
|
const char * const ICON_SETTINGS = ":/core/images/preferences.png";
|
||||||
|
|
|
@ -1,24 +1,29 @@
|
||||||
/*
|
// Object Viewer Qt - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
|
||||||
Log Plugin Qt
|
// Copyright (C) 2010 Winch Gate Property Limited
|
||||||
Copyright (C) 2010 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 Affero General Public License as
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
// published by the Free Software Foundation, either version 3 of the
|
||||||
(at your option) any later version.
|
// License, or (at your option) any later version.
|
||||||
|
//
|
||||||
This program is distributed in the hope that it will be useful,
|
// This program is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
GNU General Public License for more details.
|
// GNU Affero General Public License for more details.
|
||||||
|
//
|
||||||
You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU Affero General Public License
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
// 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 "../core/icore.h"
|
||||||
|
#include "../core/core_constants.h"
|
||||||
|
#include "../core/imenu_manager.h"
|
||||||
|
#include "../../extension_system/iplugin_spec.h"
|
||||||
|
|
||||||
// Qt includes
|
// Qt includes
|
||||||
#include <QtCore/QObject>
|
#include <QtCore/QObject>
|
||||||
|
@ -35,53 +40,43 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
// NeL includes
|
// NeL includes
|
||||||
#include <nel/misc/debug.h>
|
#include <nel/misc/debug.h>
|
||||||
|
|
||||||
// Project includes
|
namespace Plugin
|
||||||
#include "../core/icore.h"
|
|
||||||
#include "../core/core_constants.h"
|
|
||||||
#include "../core/imenu_manager.h"
|
|
||||||
#include "qt_displayer.h"
|
|
||||||
|
|
||||||
using namespace Plugin;
|
|
||||||
|
|
||||||
namespace ExtensionSystem
|
|
||||||
{
|
{
|
||||||
class IPluginSpec;
|
|
||||||
}
|
|
||||||
|
|
||||||
CLogPlugin::CLogPlugin(QWidget *parent): QDockWidget(parent)
|
CLogPlugin::CLogPlugin(QWidget *parent): QDockWidget(parent)
|
||||||
{
|
{
|
||||||
_ui.setupUi(this);
|
m_ui.setupUi(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
CLogPlugin::~CLogPlugin()
|
CLogPlugin::~CLogPlugin()
|
||||||
{
|
{
|
||||||
//_plugMan->removeObject(_logSettingsPage);
|
Q_FOREACH(QObject *obj, m_autoReleaseObjects)
|
||||||
delete _logSettingsPage;
|
{
|
||||||
|
m_plugMan->removeObject(obj);
|
||||||
|
}
|
||||||
|
qDeleteAll(m_autoReleaseObjects);
|
||||||
|
m_autoReleaseObjects.clear();
|
||||||
|
|
||||||
NLMISC::ErrorLog->removeDisplayer(_displayer);
|
NLMISC::ErrorLog->removeDisplayer(m_displayer);
|
||||||
NLMISC::WarningLog->removeDisplayer(_displayer);
|
NLMISC::WarningLog->removeDisplayer(m_displayer);
|
||||||
NLMISC::DebugLog->removeDisplayer(_displayer);
|
NLMISC::DebugLog->removeDisplayer(m_displayer);
|
||||||
NLMISC::AssertLog->removeDisplayer(_displayer);
|
NLMISC::AssertLog->removeDisplayer(m_displayer);
|
||||||
NLMISC::InfoLog->removeDisplayer(_displayer);
|
NLMISC::InfoLog->removeDisplayer(m_displayer);
|
||||||
delete _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);
|
||||||
_plugMan = pluginManager;
|
m_plugMan = pluginManager;
|
||||||
_logSettingsPage = new CLogSettingsPage(this);
|
m_logSettingsPage = new CLogSettingsPage(this);
|
||||||
//_plugMan->addObject(_logSettingsPage);
|
addAutoReleasedObject(m_logSettingsPage);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CLogPlugin::extensionsInitialized()
|
void CLogPlugin::extensionsInitialized()
|
||||||
{
|
{
|
||||||
NLMISC::ErrorLog->addDisplayer(_displayer);
|
setDisplayers();
|
||||||
NLMISC::WarningLog->addDisplayer(_displayer);
|
|
||||||
NLMISC::DebugLog->addDisplayer(_displayer);
|
|
||||||
NLMISC::AssertLog->addDisplayer(_displayer);
|
|
||||||
NLMISC::InfoLog->addDisplayer(_displayer);
|
|
||||||
|
|
||||||
Core::ICore *core = Core::ICore::instance();
|
Core::ICore *core = Core::ICore::instance();
|
||||||
Core::IMenuManager *menuManager = core->menuManager();
|
Core::IMenuManager *menuManager = core->menuManager();
|
||||||
|
@ -92,46 +87,106 @@ void CLogPlugin::extensionsInitialized()
|
||||||
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
|
||||||
_LibContext = new NLMISC::CLibraryContext(*nelContext);
|
m_libContext = new NLMISC::CLibraryContext(*nelContext);
|
||||||
|
|
||||||
_displayer = new NLQT::CQtDisplayer(_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.0";
|
return "1.1";
|
||||||
}
|
}
|
||||||
|
|
||||||
QString CLogPlugin::vendor() const
|
QString CLogPlugin::vendor() const
|
||||||
{
|
{
|
||||||
return "aquiles";
|
return "aquiles";
|
||||||
}
|
}
|
||||||
|
|
||||||
QString CLogPlugin::description() const
|
QString CLogPlugin::description() const
|
||||||
{
|
{
|
||||||
return "DockWidget to display all log messages from NeL.";
|
return "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;
|
||||||
}
|
}
|
||||||
|
|
||||||
Q_EXPORT_PLUGIN(CLogPlugin)
|
void CLogPlugin::addAutoReleasedObject(QObject *obj)
|
||||||
|
{
|
||||||
|
m_plugMan->addObject(obj);
|
||||||
|
m_autoReleaseObjects.prepend(obj);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CLogPlugin::setDisplayers()
|
||||||
|
{
|
||||||
|
QSettings *settings = Core::ICore::instance()->settings();
|
||||||
|
|
||||||
|
settings->beginGroup(Core::Constants::LOG_SECTION);
|
||||||
|
bool error = settings->value(Core::Constants::LOG_ERROR, true).toBool();
|
||||||
|
bool warning = settings->value(Core::Constants::LOG_WARNING, true).toBool();
|
||||||
|
bool debug = settings->value(Core::Constants::LOG_DEBUG, true).toBool();
|
||||||
|
bool assert = settings->value(Core::Constants::LOG_ASSERT, true).toBool();
|
||||||
|
bool info = settings->value(Core::Constants::LOG_INFO, true).toBool();
|
||||||
|
settings->endGroup();
|
||||||
|
|
||||||
|
if (error) {
|
||||||
|
if (!NLMISC::ErrorLog->attached(m_displayer))
|
||||||
|
NLMISC::ErrorLog->addDisplayer(m_displayer);
|
||||||
|
} else {
|
||||||
|
if (m_displayer) {
|
||||||
|
NLMISC::ErrorLog->removeDisplayer(m_displayer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (warning) {
|
||||||
|
if (!NLMISC::WarningLog->attached(m_displayer))
|
||||||
|
NLMISC::WarningLog->addDisplayer(m_displayer);
|
||||||
|
} else {
|
||||||
|
if (m_displayer) {
|
||||||
|
NLMISC::WarningLog->removeDisplayer(m_displayer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (debug) {
|
||||||
|
if (!NLMISC::DebugLog->attached(m_displayer))
|
||||||
|
NLMISC::DebugLog->addDisplayer(m_displayer);
|
||||||
|
} else {
|
||||||
|
if (m_displayer) {
|
||||||
|
NLMISC::DebugLog->removeDisplayer(m_displayer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (assert) {
|
||||||
|
if (!NLMISC::AssertLog->attached(m_displayer))
|
||||||
|
NLMISC::AssertLog->addDisplayer(m_displayer);
|
||||||
|
} else {
|
||||||
|
if (m_displayer) {
|
||||||
|
NLMISC::AssertLog->removeDisplayer(m_displayer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (info) {
|
||||||
|
if (!NLMISC::InfoLog->attached(m_displayer))
|
||||||
|
NLMISC::InfoLog->addDisplayer(m_displayer);
|
||||||
|
} else {
|
||||||
|
if (m_displayer) {
|
||||||
|
NLMISC::InfoLog->removeDisplayer(m_displayer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Q_EXPORT_PLUGIN(Plugin::CLogPlugin)
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
Log Plugin Qt
|
Log Plugin Qt
|
||||||
Copyright (C) 2010 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
|
||||||
|
@ -20,16 +20,16 @@ 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
|
||||||
|
#include "ui_log_form.h"
|
||||||
#include "../../extension_system/iplugin.h"
|
#include "../../extension_system/iplugin.h"
|
||||||
|
|
||||||
|
// NeL includes
|
||||||
#include "nel/misc/app_context.h"
|
#include "nel/misc/app_context.h"
|
||||||
|
|
||||||
// Qt includes
|
// Qt includes
|
||||||
#include <QDockWidget>
|
#include <QDockWidget>
|
||||||
|
|
||||||
// Project includes
|
|
||||||
#include "ui_log_form.h"
|
|
||||||
|
|
||||||
namespace NLMISC
|
namespace NLMISC
|
||||||
{
|
{
|
||||||
class CLibraryContext;
|
class CLibraryContext;
|
||||||
|
@ -61,7 +61,7 @@ namespace Plugin
|
||||||
void extensionsInitialized();
|
void extensionsInitialized();
|
||||||
|
|
||||||
void setNelContext(NLMISC::INelContext *nelContext);
|
void setNelContext(NLMISC::INelContext *nelContext);
|
||||||
NLQT::CQtDisplayer* displayer() { return _displayer; }
|
NLQT::CQtDisplayer* displayer() { return m_displayer; }
|
||||||
|
|
||||||
QString name() const;
|
QString name() const;
|
||||||
QString version() const;
|
QString version() const;
|
||||||
|
@ -69,16 +69,21 @@ namespace Plugin
|
||||||
QString description() const;
|
QString description() const;
|
||||||
QStringList dependencies() const;
|
QStringList dependencies() const;
|
||||||
|
|
||||||
|
void addAutoReleasedObject(QObject *obj);
|
||||||
|
|
||||||
|
void setDisplayers();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
NLMISC::CLibraryContext *_LibContext;
|
NLMISC::CLibraryContext *m_libContext;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ExtensionSystem::IPluginManager *_plugMan;
|
ExtensionSystem::IPluginManager *m_plugMan;
|
||||||
CLogSettingsPage *_logSettingsPage;
|
QList<QObject *> m_autoReleaseObjects;
|
||||||
|
CLogSettingsPage *m_logSettingsPage;
|
||||||
|
|
||||||
Ui::CLogPlugin _ui;
|
Ui::CLogPlugin m_ui;
|
||||||
|
|
||||||
NLQT::CQtDisplayer *_displayer;
|
NLQT::CQtDisplayer *m_displayer;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// 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 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
|
||||||
|
@ -15,14 +15,19 @@
|
||||||
// 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
|
||||||
#include "log_settings_page.h"
|
#include "log_settings_page.h"
|
||||||
|
#include "log_plugin.h"
|
||||||
// Qt includes
|
#include "../core/core_constants.h"
|
||||||
#include <QtGui/QWidget>
|
#include "../core/icore.h"
|
||||||
|
#include "../../extension_system/plugin_manager.h"
|
||||||
|
|
||||||
// NeL includes
|
// NeL includes
|
||||||
|
|
||||||
// Project includes
|
// Qt includes
|
||||||
|
#include <QtGui/QWidget>
|
||||||
|
#include <QtCore/QSettings>
|
||||||
|
|
||||||
namespace ExtensionSystem
|
namespace ExtensionSystem
|
||||||
{
|
{
|
||||||
class IPluginManager;
|
class IPluginManager;
|
||||||
|
@ -31,15 +36,22 @@ namespace ExtensionSystem
|
||||||
namespace Plugin
|
namespace Plugin
|
||||||
{
|
{
|
||||||
|
|
||||||
|
class CLogPlugin;
|
||||||
|
|
||||||
CLogSettingsPage::CLogSettingsPage(QObject *parent)
|
CLogSettingsPage::CLogSettingsPage(QObject *parent)
|
||||||
: IOptionsPage(parent),
|
: IOptionsPage(parent),
|
||||||
_currentPage(NULL)
|
m_currentPage(NULL),
|
||||||
|
m_error(true),
|
||||||
|
m_warning(true),
|
||||||
|
m_debug(true),
|
||||||
|
m_assert(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
|
||||||
|
@ -49,32 +61,78 @@ namespace Plugin
|
||||||
|
|
||||||
QString CLogSettingsPage::category() const
|
QString CLogSettingsPage::category() const
|
||||||
{
|
{
|
||||||
return QLatin1String("General");
|
return QLatin1String(Core::Constants::SETTINGS_CATEGORY_GENERAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString CLogSettingsPage::trCategory() const
|
QString CLogSettingsPage::trCategory() const
|
||||||
{
|
{
|
||||||
return tr("General");
|
return tr(Core::Constants::SETTINGS_TR_CATEGORY_GENERAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
QIcon CLogSettingsPage::categoryIcon() const
|
||||||
|
{
|
||||||
|
return QIcon();
|
||||||
}
|
}
|
||||||
|
|
||||||
QWidget *CLogSettingsPage::createPage(QWidget *parent)
|
QWidget *CLogSettingsPage::createPage(QWidget *parent)
|
||||||
{
|
{
|
||||||
_currentPage = new QWidget(parent);
|
m_currentPage = new QWidget(parent);
|
||||||
_ui.setupUi(_currentPage);
|
m_ui.setupUi(m_currentPage);
|
||||||
return _currentPage;
|
|
||||||
|
readSettings();
|
||||||
|
m_ui.errorCheck->setChecked(m_error);
|
||||||
|
m_ui.warningCheck->setChecked(m_warning);
|
||||||
|
m_ui.debugCheck->setChecked(m_debug);
|
||||||
|
m_ui.assertCheck->setChecked(m_assert);
|
||||||
|
m_ui.infoCheck->setChecked(m_info);
|
||||||
|
|
||||||
|
return m_currentPage;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CLogSettingsPage::apply()
|
void CLogSettingsPage::apply()
|
||||||
{
|
{
|
||||||
//ExtensionSystem::IPluginSpec *spec, _plugMan->plugins()
|
m_error = m_ui.errorCheck->isChecked();
|
||||||
//ExtensionSystem::IPluginManager;
|
m_warning = m_ui.warningCheck->isChecked();
|
||||||
//if (_ui.errorCheck->isChecked()) {
|
m_debug = m_ui.debugCheck->isChecked();
|
||||||
//displayer();
|
m_assert = m_ui.assertCheck->isChecked();
|
||||||
//}
|
m_info = m_ui.infoCheck->isChecked();
|
||||||
//if (_ui.warningCheck->isChecked());
|
|
||||||
//if (_ui.debugCheck->isChecked());
|
writeSettings();
|
||||||
//if (_ui.assertCheck->isChecked());
|
ExtensionSystem::IPluginManager *p = Core::ICore::instance()->pluginManager();
|
||||||
//if (_ui.infoCheck->isChecked());
|
ExtensionSystem::IPlugin *plugin = p->pluginByName("LogPlugin")->plugin();
|
||||||
|
CLogPlugin* lp = dynamic_cast<CLogPlugin*>(plugin);
|
||||||
|
if (lp)
|
||||||
|
{
|
||||||
|
lp->setDisplayers();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CLogSettingsPage::readSettings()
|
||||||
|
{
|
||||||
|
QSettings *settings = Core::ICore::instance()->settings();
|
||||||
|
|
||||||
|
settings->beginGroup(Core::Constants::LOG_SECTION);
|
||||||
|
m_error = settings->value(Core::Constants::LOG_ERROR, true).toBool();
|
||||||
|
m_warning = settings->value(Core::Constants::LOG_WARNING, true).toBool();
|
||||||
|
m_debug = settings->value(Core::Constants::LOG_DEBUG, true).toBool();
|
||||||
|
m_assert = settings->value(Core::Constants::LOG_ASSERT, true).toBool();
|
||||||
|
m_info = settings->value(Core::Constants::LOG_INFO, true).toBool();
|
||||||
|
settings->endGroup();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CLogSettingsPage::writeSettings()
|
||||||
|
{
|
||||||
|
QSettings *settings = Core::ICore::instance()->settings();
|
||||||
|
|
||||||
|
settings->beginGroup(Core::Constants::LOG_SECTION);
|
||||||
|
settings->setValue(Core::Constants::LOG_ERROR, m_error);
|
||||||
|
settings->setValue(Core::Constants::LOG_WARNING, m_warning);
|
||||||
|
settings->setValue(Core::Constants::LOG_DEBUG, m_debug);
|
||||||
|
settings->setValue(Core::Constants::LOG_ASSERT, m_assert);
|
||||||
|
settings->setValue(Core::Constants::LOG_INFO, m_info);
|
||||||
|
settings->endGroup();
|
||||||
|
|
||||||
|
settings->sync();
|
||||||
}
|
}
|
||||||
|
|
||||||
} /* namespace Plugin */
|
} /* namespace Plugin */
|
|
@ -29,13 +29,13 @@ class QWidget;
|
||||||
|
|
||||||
namespace Plugin
|
namespace Plugin
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
@class CLogSettingsPage
|
@class CLogSettingsPage
|
||||||
*/
|
*/
|
||||||
class CLogSettingsPage : public Core::IOptionsPage
|
class CLogSettingsPage : public Core::IOptionsPage
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
CLogSettingsPage(QObject *parent = 0);
|
CLogSettingsPage(QObject *parent = 0);
|
||||||
virtual ~CLogSettingsPage() {}
|
virtual ~CLogSettingsPage() {}
|
||||||
|
|
||||||
|
@ -43,15 +43,25 @@ public:
|
||||||
virtual QString trName() const;
|
virtual QString trName() const;
|
||||||
virtual QString category() const;
|
virtual QString category() const;
|
||||||
virtual QString trCategory() const;
|
virtual QString trCategory() const;
|
||||||
|
QIcon categoryIcon() const;
|
||||||
virtual QWidget *createPage(QWidget *parent);
|
virtual QWidget *createPage(QWidget *parent);
|
||||||
|
|
||||||
virtual void apply();
|
virtual void apply();
|
||||||
virtual void finish() {}
|
virtual void finish() {}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QWidget *_currentPage;
|
void readSettings();
|
||||||
Ui::CLogSettingsPage _ui;
|
void writeSettings();
|
||||||
};
|
|
||||||
|
QWidget *m_currentPage;
|
||||||
|
Ui::CLogSettingsPage m_ui;
|
||||||
|
|
||||||
|
bool m_error;
|
||||||
|
bool m_warning;
|
||||||
|
bool m_debug;
|
||||||
|
bool m_assert;
|
||||||
|
bool m_info;
|
||||||
|
};
|
||||||
|
|
||||||
} // namespace Core
|
} // namespace Core
|
||||||
|
|
||||||
|
|
|
@ -1,24 +1,21 @@
|
||||||
/*
|
// Object Viewer Qt - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
|
||||||
Georges Editor Qt
|
// Copyright (C) 2010 Winch Gate Property Limited
|
||||||
Copyright (C) 2010 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 Affero General Public License as
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
// published by the Free Software Foundation, either version 3 of the
|
||||||
(at your option) any later version.
|
// License, or (at your option) any later version.
|
||||||
|
//
|
||||||
This program is distributed in the hope that it will be useful,
|
// This program is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
GNU General Public License for more details.
|
// GNU Affero General Public License for more details.
|
||||||
|
//
|
||||||
You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU Affero General Public License
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Nel includes
|
// Nel includes
|
||||||
|
|
||||||
#include "qt_displayer.h"
|
#include "qt_displayer.h"
|
||||||
#include <nel/misc/common.h>
|
#include <nel/misc/common.h>
|
||||||
#include <nel/misc/file.h>
|
#include <nel/misc/file.h>
|
||||||
|
|
Loading…
Reference in a new issue