Changed: #1206 log plugin saves changes now and loads/unloads displayer on the fly

This commit is contained in:
aquiles 2011-05-28 22:06:01 +02:00
parent 56cf892b9c
commit 2d12ef943d
7 changed files with 403 additions and 271 deletions

View file

@ -1,93 +1,100 @@
// Object Viewer Qt - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
// Copyright (C) 2010 Winch Gate Property Limited
// Copyright (C) 2010 Dzmitry Kamiahin <dnk-88@tut.by>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef CORE_CONSTANTS_H
#define CORE_CONSTANTS_H
namespace Core
{
namespace Constants
{
const char * const OVQT_VERSION_LONG = "0.0.1";
const char * const OVQT_VENDOR = "Ryzom Core";
const char * const OVQT_YEAR = "2010, 2011";
const char * const OVQT_CORE_PLUGIN = "Core";
//mainwindow
const char * const MAIN_WINDOW = "ObjectViewerQt.MainWindow";
//menubar
const char * const MENU_BAR = "ObjectViewerQt.MenuBar";
//menus
const char * const M_FILE = "ObjectViewerQt.Menu.File";
const char * const M_EDIT = "ObjectViewerQt.Menu.Edit";
const char * const M_VIEW = "ObjectViewerQt.Menu.View";
const char * const M_SCENE = "ObjectViewerQt.Menu.Scene";
const char * const M_TOOLS = "ObjectViewerQt.Menu.Tools";
const char * const M_WINDOW = "ObjectViewerQt.Menu.Window";
const char * const M_HELP = "ObjectViewerQt.Menu.Help";
const char * const M_SHEET = "ObjectViewerQt.Menu.Sheet";
//actions
const char * const NEW = "ObjectViewerQt.New";
const char * const OPEN = "ObjectViewerQt.Open";
const char * const EXIT = "ObjectViewerQt.Exit";
const char * const SETTINGS = "ObjectViewerQt.Settings";
const char * const TOGGLE_FULLSCREEN = "ObjectViewerQt.ToggleFullScreen";
const char * const CLOSE = "ObjectViewerQt.Close";
const char * const CLOSEALL = "ObjectViewerQt.CloseAll";
const char * const CLOSEOTHERS = "ObjectViewerQt.CloseOthers";
const char * const ABOUT = "ObjectViewerQt.About";
const char * const ABOUT_PLUGINS = "ObjectViewerQt.AboutPlugins";
const char * const ABOUT_QT = "ObjectViewerQt.AboutQt";
//settings
const char * const SETTINGS_CATEGORY_GENERAL = "general";
const char * const SETTINGS_CATEGORY_GENERAL_ICON = ":/icons/ic_nel_generic_settings.png";
const char * const SETTINGS_TR_CATEGORY_GENERAL = QT_TR_NOOP("General");
const char * const MAIN_WINDOW_SECTION = "MainWindow";
const char * const MAIN_WINDOW_STATE = "WindowState";
const char * const MAIN_WINDOW_GEOMETRY = "WindowGeometry";
const char * const QT_STYLE = "QtStyle";
const char * const QT_PALETTE = "QtPalette";
const char * const LANGUAGE = "Language";
const char * const PLUGINS_PATH = "PluginPath";
const char * const DATA_PATH_SECTION = "DataPath";
const char * const SEARCH_PATHS = "SearchPaths";
const char * const RECURSIVE_SEARCH_PATHS = "RecursiveSearchPathes";
const char * const LEVELDESIGN_PATH = "LevelDesignPath";
const char * const ASSETS_PATH = "AssetsPath";
const char * const REMAP_EXTENSIONS = "RemapExtensions";
//resources
const char * const ICON_NEL = ":/core/images/nel.png";
const char * const ICON_SETTINGS = ":/core/images/preferences.png";
const char * const ICON_PILL = ":/core/icons/ic_nel_pill.png";
const char * const ICON_OPEN = ":/core/icons/ic_nel_open.png";
const char * const ICON_CRASH = ":/core/icons/ic_nel_crash.png";
} // namespace Constants
} // namespace Core
#endif // CORE_CONSTANTS_H
// Object Viewer Qt - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
// Copyright (C) 2010 Winch Gate Property Limited
// Copyright (C) 2010 Dzmitry Kamiahin <dnk-88@tut.by>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef CORE_CONSTANTS_H
#define CORE_CONSTANTS_H
namespace Core
{
namespace Constants
{
const char * const OVQT_VERSION_LONG = "0.0.1";
const char * const OVQT_VENDOR = "Ryzom Core";
const char * const OVQT_YEAR = "2010, 2011";
const char * const OVQT_CORE_PLUGIN = "Core";
//mainwindow
const char * const MAIN_WINDOW = "ObjectViewerQt.MainWindow";
//menubar
const char * const MENU_BAR = "ObjectViewerQt.MenuBar";
//menus
const char * const M_FILE = "ObjectViewerQt.Menu.File";
const char * const M_EDIT = "ObjectViewerQt.Menu.Edit";
const char * const M_VIEW = "ObjectViewerQt.Menu.View";
const char * const M_SCENE = "ObjectViewerQt.Menu.Scene";
const char * const M_TOOLS = "ObjectViewerQt.Menu.Tools";
const char * const M_WINDOW = "ObjectViewerQt.Menu.Window";
const char * const M_HELP = "ObjectViewerQt.Menu.Help";
const char * const M_SHEET = "ObjectViewerQt.Menu.Sheet";
//actions
const char * const NEW = "ObjectViewerQt.New";
const char * const OPEN = "ObjectViewerQt.Open";
const char * const EXIT = "ObjectViewerQt.Exit";
const char * const SETTINGS = "ObjectViewerQt.Settings";
const char * const TOGGLE_FULLSCREEN = "ObjectViewerQt.ToggleFullScreen";
const char * const CLOSE = "ObjectViewerQt.Close";
const char * const CLOSEALL = "ObjectViewerQt.CloseAll";
const char * const CLOSEOTHERS = "ObjectViewerQt.CloseOthers";
const char * const ABOUT = "ObjectViewerQt.About";
const char * const ABOUT_PLUGINS = "ObjectViewerQt.AboutPlugins";
const char * const ABOUT_QT = "ObjectViewerQt.AboutQt";
//settings
const char * const SETTINGS_CATEGORY_GENERAL = "general";
const char * const SETTINGS_CATEGORY_GENERAL_ICON = ":/icons/ic_nel_generic_settings.png";
const char * const SETTINGS_TR_CATEGORY_GENERAL = QT_TR_NOOP("General");
const char * const MAIN_WINDOW_SECTION = "MainWindow";
const char * const MAIN_WINDOW_STATE = "WindowState";
const char * const MAIN_WINDOW_GEOMETRY = "WindowGeometry";
const char * const QT_STYLE = "QtStyle";
const char * const QT_PALETTE = "QtPalette";
const char * const LANGUAGE = "Language";
const char * const PLUGINS_PATH = "PluginPath";
const char * const DATA_PATH_SECTION = "DataPath";
const char * const SEARCH_PATHS = "SearchPaths";
const char * const RECURSIVE_SEARCH_PATHS = "RecursiveSearchPathes";
const char * const LEVELDESIGN_PATH = "LevelDesignPath";
const char * const ASSETS_PATH = "AssetsPath";
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
const char * const ICON_NEL = ":/core/images/nel.png";
const char * const ICON_SETTINGS = ":/core/images/preferences.png";
const char * const ICON_PILL = ":/core/icons/ic_nel_pill.png";
const char * const ICON_OPEN = ":/core/icons/ic_nel_open.png";
const char * const ICON_CRASH = ":/core/icons/ic_nel_crash.png";
} // namespace Constants
} // namespace Core
#endif // CORE_CONSTANTS_H

View file

@ -1,7 +1,7 @@
INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}
${LIBXML2_INCLUDE_DIR}
${QT_INCLUDES})
${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

View file

@ -1,24 +1,29 @@
/*
Log Plugin Qt
Copyright (C) 2010 Adrian Jaekel <aj at elane2k dot com>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
// Object Viewer Qt - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
// Copyright (C) 2010 Winch Gate Property Limited
// Copyright (C) 2011 Adrian Jaekel <aj at elane2k dot com>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
// Project includes
#include "log_plugin.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
#include <QtCore/QObject>
@ -35,103 +40,153 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
// NeL includes
#include <nel/misc/debug.h>
// Project includes
#include "../core/icore.h"
#include "../core/core_constants.h"
#include "../core/imenu_manager.h"
#include "qt_displayer.h"
using namespace Plugin;
namespace ExtensionSystem
namespace Plugin
{
class IPluginSpec;
}
CLogPlugin::CLogPlugin(QWidget *parent): QDockWidget(parent)
{
_ui.setupUi(this);
}
CLogPlugin::CLogPlugin(QWidget *parent): QDockWidget(parent)
{
m_ui.setupUi(this);
}
CLogPlugin::~CLogPlugin()
{
//_plugMan->removeObject(_logSettingsPage);
delete _logSettingsPage;
CLogPlugin::~CLogPlugin()
{
Q_FOREACH(QObject *obj, m_autoReleaseObjects)
{
m_plugMan->removeObject(obj);
}
qDeleteAll(m_autoReleaseObjects);
m_autoReleaseObjects.clear();
NLMISC::ErrorLog->removeDisplayer(_displayer);
NLMISC::WarningLog->removeDisplayer(_displayer);
NLMISC::DebugLog->removeDisplayer(_displayer);
NLMISC::AssertLog->removeDisplayer(_displayer);
NLMISC::InfoLog->removeDisplayer(_displayer);
delete _displayer;
}
NLMISC::ErrorLog->removeDisplayer(m_displayer);
NLMISC::WarningLog->removeDisplayer(m_displayer);
NLMISC::DebugLog->removeDisplayer(m_displayer);
NLMISC::AssertLog->removeDisplayer(m_displayer);
NLMISC::InfoLog->removeDisplayer(m_displayer);
delete m_displayer;
}
bool CLogPlugin::initialize(ExtensionSystem::IPluginManager *pluginManager, QString *errorString)
{
Q_UNUSED(errorString);
_plugMan = pluginManager;
_logSettingsPage = new CLogSettingsPage(this);
//_plugMan->addObject(_logSettingsPage);
return true;
}
bool CLogPlugin::initialize(ExtensionSystem::IPluginManager *pluginManager, QString *errorString)
{
Q_UNUSED(errorString);
m_plugMan = pluginManager;
m_logSettingsPage = new CLogSettingsPage(this);
addAutoReleasedObject(m_logSettingsPage);
return true;
}
void CLogPlugin::extensionsInitialized()
{
NLMISC::ErrorLog->addDisplayer(_displayer);
NLMISC::WarningLog->addDisplayer(_displayer);
NLMISC::DebugLog->addDisplayer(_displayer);
NLMISC::AssertLog->addDisplayer(_displayer);
NLMISC::InfoLog->addDisplayer(_displayer);
void CLogPlugin::extensionsInitialized()
{
setDisplayers();
Core::ICore *core = Core::ICore::instance();
Core::IMenuManager *menuManager = core->menuManager();
QMenu *viewMenu = menuManager->menu(Core::Constants::M_VIEW);
Core::ICore *core = Core::ICore::instance();
Core::IMenuManager *menuManager = core->menuManager();
QMenu *viewMenu = menuManager->menu(Core::Constants::M_VIEW);
QMainWindow *wnd = Core::ICore::instance()->mainWindow();
wnd->addDockWidget(Qt::RightDockWidgetArea, this);
hide();
QMainWindow *wnd = Core::ICore::instance()->mainWindow();
wnd->addDockWidget(Qt::RightDockWidgetArea, this);
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
// Ensure that a context doesn't exist yet.
// This only applies to platforms without PIC, e.g. Windows.
nlassert(!NLMISC::INelContext::isContextInitialised());
// Ensure that a context doesn't exist yet.
// This only applies to platforms without PIC, e.g. Windows.
nlassert(!NLMISC::INelContext::isContextInitialised());
#endif // fdef NL_OS_WINDOWS^M
_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
{
return "LogPlugin";
}
QString CLogPlugin::version() const
{
return "1.1";
}
QString CLogPlugin::vendor() const
{
return "aquiles";
}
QString CLogPlugin::description() const
{
return "DockWidget to display all log messages from NeL.";
}
QStringList CLogPlugin::dependencies() const
{
QStringList list;
list.append(Core::Constants::OVQT_CORE_PLUGIN);
return list;
}
void CLogPlugin::addAutoReleasedObject(QObject *obj)
{
m_plugMan->addObject(obj);
m_autoReleaseObjects.prepend(obj);
}
void CLogPlugin::setDisplayers()
{
QSettings *settings = Core::ICore::instance()->settings();
settings->beginGroup(Core::Constants::LOG_SECTION);
bool error = settings->value(Core::Constants::LOG_ERROR, true).toBool();
bool warning = settings->value(Core::Constants::LOG_WARNING, true).toBool();
bool debug = settings->value(Core::Constants::LOG_DEBUG, true).toBool();
bool assert = settings->value(Core::Constants::LOG_ASSERT, true).toBool();
bool info = settings->value(Core::Constants::LOG_INFO, true).toBool();
settings->endGroup();
if (error) {
if (!NLMISC::ErrorLog->attached(m_displayer))
NLMISC::ErrorLog->addDisplayer(m_displayer);
} else {
if (m_displayer) {
NLMISC::ErrorLog->removeDisplayer(m_displayer);
}
}
if (warning) {
if (!NLMISC::WarningLog->attached(m_displayer))
NLMISC::WarningLog->addDisplayer(m_displayer);
} else {
if (m_displayer) {
NLMISC::WarningLog->removeDisplayer(m_displayer);
}
}
if (debug) {
if (!NLMISC::DebugLog->attached(m_displayer))
NLMISC::DebugLog->addDisplayer(m_displayer);
} else {
if (m_displayer) {
NLMISC::DebugLog->removeDisplayer(m_displayer);
}
}
if (assert) {
if (!NLMISC::AssertLog->attached(m_displayer))
NLMISC::AssertLog->addDisplayer(m_displayer);
} else {
if (m_displayer) {
NLMISC::AssertLog->removeDisplayer(m_displayer);
}
}
if (info) {
if (!NLMISC::InfoLog->attached(m_displayer))
NLMISC::InfoLog->addDisplayer(m_displayer);
} else {
if (m_displayer) {
NLMISC::InfoLog->removeDisplayer(m_displayer);
}
}
}
}
QString CLogPlugin::name() const
{
return "LogPlugin";
}
QString CLogPlugin::version() const
{
return "1.0";
}
QString CLogPlugin::vendor() const
{
return "aquiles";
}
QString CLogPlugin::description() const
{
return "DockWidget to display all log messages from NeL.";
}
QStringList CLogPlugin::dependencies() const
{
QStringList list;
list.append(Core::Constants::OVQT_CORE_PLUGIN);
return list;
}
Q_EXPORT_PLUGIN(CLogPlugin)
Q_EXPORT_PLUGIN(Plugin::CLogPlugin)

View file

@ -1,6 +1,6 @@
/*
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
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
#define LOG_PLUGIN_H
// Project includes
#include "ui_log_form.h"
#include "../../extension_system/iplugin.h"
// NeL includes
#include "nel/misc/app_context.h"
// Qt includes
#include <QDockWidget>
// Project includes
#include "ui_log_form.h"
namespace NLMISC
{
class CLibraryContext;
@ -52,7 +52,7 @@ namespace Plugin
class CLogPlugin : public QDockWidget, public ExtensionSystem::IPlugin
{
Q_OBJECT
Q_INTERFACES(ExtensionSystem::IPlugin)
Q_INTERFACES(ExtensionSystem::IPlugin)
public:
CLogPlugin(QWidget *parent = 0);
~CLogPlugin();
@ -61,7 +61,7 @@ namespace Plugin
void extensionsInitialized();
void setNelContext(NLMISC::INelContext *nelContext);
NLQT::CQtDisplayer* displayer() { return _displayer; }
NLQT::CQtDisplayer* displayer() { return m_displayer; }
QString name() const;
QString version() const;
@ -69,16 +69,21 @@ namespace Plugin
QString description() const;
QStringList dependencies() const;
void addAutoReleasedObject(QObject *obj);
void setDisplayers();
protected:
NLMISC::CLibraryContext *_LibContext;
NLMISC::CLibraryContext *m_libContext;
private:
ExtensionSystem::IPluginManager *_plugMan;
CLogSettingsPage *_logSettingsPage;
ExtensionSystem::IPluginManager *m_plugMan;
QList<QObject *> m_autoReleaseObjects;
CLogSettingsPage *m_logSettingsPage;
Ui::CLogPlugin _ui;
Ui::CLogPlugin m_ui;
NLQT::CQtDisplayer *_displayer;
NLQT::CQtDisplayer *m_displayer;
};

View file

@ -1,6 +1,6 @@
// 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>
// 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
@ -15,31 +15,43 @@
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
// Project includes
#include "log_settings_page.h"
// Qt includes
#include <QtGui/QWidget>
#include "log_plugin.h"
#include "../core/core_constants.h"
#include "../core/icore.h"
#include "../../extension_system/plugin_manager.h"
// NeL includes
// Project includes
// Qt includes
#include <QtGui/QWidget>
#include <QtCore/QSettings>
namespace ExtensionSystem
{
class IPluginManager;
class IPluginManager;
}
namespace Plugin
{
class CLogPlugin;
CLogSettingsPage::CLogSettingsPage(QObject *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
{
return QLatin1String("Log");
return QLatin1String("log");
}
QString CLogSettingsPage::trName() const
@ -49,32 +61,78 @@ namespace Plugin
QString CLogSettingsPage::category() const
{
return QLatin1String("General");
return QLatin1String(Core::Constants::SETTINGS_CATEGORY_GENERAL);
}
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)
{
_currentPage = new QWidget(parent);
_ui.setupUi(_currentPage);
return _currentPage;
m_currentPage = new QWidget(parent);
m_ui.setupUi(m_currentPage);
readSettings();
m_ui.errorCheck->setChecked(m_error);
m_ui.warningCheck->setChecked(m_warning);
m_ui.debugCheck->setChecked(m_debug);
m_ui.assertCheck->setChecked(m_assert);
m_ui.infoCheck->setChecked(m_info);
return m_currentPage;
}
void CLogSettingsPage::apply()
{
//ExtensionSystem::IPluginSpec *spec, _plugMan->plugins()
//ExtensionSystem::IPluginManager;
//if (_ui.errorCheck->isChecked()) {
//displayer();
//}
//if (_ui.warningCheck->isChecked());
//if (_ui.debugCheck->isChecked());
//if (_ui.assertCheck->isChecked());
//if (_ui.infoCheck->isChecked());
m_error = m_ui.errorCheck->isChecked();
m_warning = m_ui.warningCheck->isChecked();
m_debug = m_ui.debugCheck->isChecked();
m_assert = m_ui.assertCheck->isChecked();
m_info = m_ui.infoCheck->isChecked();
writeSettings();
ExtensionSystem::IPluginManager *p = Core::ICore::instance()->pluginManager();
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 */

View file

@ -29,29 +29,39 @@ class QWidget;
namespace Plugin
{
/**
@class CLogSettingsPage
*/
class CLogSettingsPage : public Core::IOptionsPage
{
Q_OBJECT
public:
CLogSettingsPage(QObject *parent = 0);
virtual ~CLogSettingsPage() {}
/**
@class CLogSettingsPage
*/
class CLogSettingsPage : public Core::IOptionsPage
{
Q_OBJECT
public:
CLogSettingsPage(QObject *parent = 0);
virtual ~CLogSettingsPage() {}
virtual QString id() const;
virtual QString trName() const;
virtual QString category() const;
virtual QString trCategory() const;
virtual QWidget *createPage(QWidget *parent);
virtual QString id() const;
virtual QString trName() const;
virtual QString category() const;
virtual QString trCategory() const;
QIcon categoryIcon() const;
virtual QWidget *createPage(QWidget *parent);
virtual void apply();
virtual void finish() {}
virtual void apply();
virtual void finish() {}
private:
QWidget *_currentPage;
Ui::CLogSettingsPage _ui;
};
private:
void readSettings();
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

View file

@ -1,24 +1,21 @@
/*
Georges Editor Qt
Copyright (C) 2010 Adrian Jaekel <aj at elane2k dot com>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
// Object Viewer Qt - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
// Copyright (C) 2010 Winch Gate Property Limited
// Copyright (C) 2011 Adrian Jaekel <aj at elane2k dot com>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
// Nel includes
#include "qt_displayer.h"
#include <nel/misc/common.h>
#include <nel/misc/file.h>