mirror of
https://port.numenaute.org/aleajactaest/khanat-code-old.git
synced 2024-11-27 17:26:16 +00:00
Changed: Update log plugin.
This commit is contained in:
parent
697b30f3b6
commit
76cf53b389
2 changed files with 22 additions and 35 deletions
|
@ -36,7 +36,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#include <nel/misc/debug.h>
|
#include <nel/misc/debug.h>
|
||||||
|
|
||||||
// Project includes
|
// Project includes
|
||||||
#include "../../extension_system/iplugin_spec.h"
|
#include "../core/icore.h"
|
||||||
|
#include "../core/core_constants.h"
|
||||||
|
#include "../core/imenu_manager.h"
|
||||||
#include "qt_displayer.h"
|
#include "qt_displayer.h"
|
||||||
|
|
||||||
using namespace Plugin;
|
using namespace Plugin;
|
||||||
|
@ -53,6 +55,9 @@ CLogPlugin::CLogPlugin(QWidget *parent): QDockWidget(parent)
|
||||||
|
|
||||||
CLogPlugin::~CLogPlugin()
|
CLogPlugin::~CLogPlugin()
|
||||||
{
|
{
|
||||||
|
_plugMan->removeObject(_logSettingsPage);
|
||||||
|
delete _logSettingsPage;
|
||||||
|
|
||||||
NLMISC::ErrorLog->removeDisplayer(_displayer);
|
NLMISC::ErrorLog->removeDisplayer(_displayer);
|
||||||
NLMISC::WarningLog->removeDisplayer(_displayer);
|
NLMISC::WarningLog->removeDisplayer(_displayer);
|
||||||
NLMISC::DebugLog->removeDisplayer(_displayer);
|
NLMISC::DebugLog->removeDisplayer(_displayer);
|
||||||
|
@ -65,31 +70,28 @@ bool CLogPlugin::initialize(ExtensionSystem::IPluginManager *pluginManager, QStr
|
||||||
{
|
{
|
||||||
Q_UNUSED(errorString);
|
Q_UNUSED(errorString);
|
||||||
_plugMan = pluginManager;
|
_plugMan = pluginManager;
|
||||||
QMainWindow *wnd = qobject_cast<QMainWindow *>(objectByName("CMainWindow"));
|
_logSettingsPage = new CLogSettingsPage(this);
|
||||||
if (!wnd)
|
_plugMan->addObject(_logSettingsPage);
|
||||||
{
|
|
||||||
*errorString = tr("Not found QMainWindow Object Viewer Qt.");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
_plugMan->addObject(new CLogSettingsPage(this));
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CLogPlugin::extensionsInitialized()
|
void CLogPlugin::extensionsInitialized()
|
||||||
{
|
{
|
||||||
QMenu *helpMenu = qobject_cast<QMenu *>(objectByName("ovqt.Menu.View"));
|
|
||||||
helpMenu->addSeparator();
|
|
||||||
|
|
||||||
NLMISC::ErrorLog->addDisplayer(_displayer);
|
NLMISC::ErrorLog->addDisplayer(_displayer);
|
||||||
NLMISC::WarningLog->addDisplayer(_displayer);
|
NLMISC::WarningLog->addDisplayer(_displayer);
|
||||||
NLMISC::DebugLog->addDisplayer(_displayer);
|
NLMISC::DebugLog->addDisplayer(_displayer);
|
||||||
NLMISC::AssertLog->addDisplayer(_displayer);
|
NLMISC::AssertLog->addDisplayer(_displayer);
|
||||||
NLMISC::InfoLog->addDisplayer(_displayer);
|
NLMISC::InfoLog->addDisplayer(_displayer);
|
||||||
|
|
||||||
QMainWindow *wnd = qobject_cast<QMainWindow *>(objectByName("CMainWindow"));
|
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);
|
wnd->addDockWidget(Qt::RightDockWidgetArea, this);
|
||||||
hide();
|
hide();
|
||||||
helpMenu->addAction(this->toggleViewAction());
|
|
||||||
|
viewMenu->addAction(this->toggleViewAction());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CLogPlugin::setNelContext(NLMISC::INelContext *nelContext)
|
void CLogPlugin::setNelContext(NLMISC::INelContext *nelContext)
|
||||||
|
@ -125,25 +127,11 @@ QString CLogPlugin::description() const
|
||||||
return "DockWidget to display all log messages from NeL.";
|
return "DockWidget to display all log messages from NeL.";
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<QString> CLogPlugin::dependencies() const
|
QStringList CLogPlugin::dependencies() const
|
||||||
{
|
{
|
||||||
return QList<QString>();
|
QStringList list;
|
||||||
}
|
list.append(Core::Constants::OVQT_CORE_PLUGIN);
|
||||||
|
return list;
|
||||||
QObject* CLogPlugin::objectByName(const QString &name) const
|
|
||||||
{
|
|
||||||
Q_FOREACH (QObject *qobj, _plugMan->allObjects())
|
|
||||||
if (qobj->objectName() == name)
|
|
||||||
return qobj;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
ExtensionSystem::IPluginSpec *CLogPlugin::pluginByName(const QString &name) const
|
|
||||||
{
|
|
||||||
Q_FOREACH (ExtensionSystem::IPluginSpec *spec, _plugMan->plugins())
|
|
||||||
if (spec->name() == name)
|
|
||||||
return spec;
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Q_EXPORT_PLUGIN(CLogPlugin)
|
Q_EXPORT_PLUGIN(CLogPlugin)
|
||||||
|
|
|
@ -47,6 +47,7 @@ namespace NLQT
|
||||||
|
|
||||||
namespace Plugin
|
namespace Plugin
|
||||||
{
|
{
|
||||||
|
class CLogSettingsPage;
|
||||||
|
|
||||||
class CLogPlugin : public QDockWidget, public ExtensionSystem::IPlugin
|
class CLogPlugin : public QDockWidget, public ExtensionSystem::IPlugin
|
||||||
{
|
{
|
||||||
|
@ -66,16 +67,14 @@ namespace Plugin
|
||||||
QString version() const;
|
QString version() const;
|
||||||
QString vendor() const;
|
QString vendor() const;
|
||||||
QString description() const;
|
QString description() const;
|
||||||
QList<QString> dependencies() const;
|
QStringList dependencies() const;
|
||||||
|
|
||||||
QObject *objectByName(const QString &name) const;
|
|
||||||
ExtensionSystem::IPluginSpec *pluginByName(const QString &name) const;
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
NLMISC::CLibraryContext *_LibContext;
|
NLMISC::CLibraryContext *_LibContext;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ExtensionSystem::IPluginManager *_plugMan;
|
ExtensionSystem::IPluginManager *_plugMan;
|
||||||
|
CLogSettingsPage *_logSettingsPage;
|
||||||
|
|
||||||
Ui::CLogPlugin _ui;
|
Ui::CLogPlugin _ui;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue