summaryrefslogtreecommitdiffstats
path: root/plugins/logviewer
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/logviewer')
-rw-r--r--plugins/logviewer/Makefile.am33
-rw-r--r--plugins/logviewer/ktlogviewerplugin.desktop26
-rw-r--r--plugins/logviewer/ktlogviewerplugin.kcfg71
-rw-r--r--plugins/logviewer/logflags.cpp170
-rw-r--r--plugins/logviewer/logflags.h91
-rw-r--r--plugins/logviewer/logprefpage.cpp63
-rw-r--r--plugins/logviewer/logprefpage.h51
-rw-r--r--plugins/logviewer/logprefwidget.cpp123
-rw-r--r--plugins/logviewer/logprefwidget.h39
-rw-r--r--plugins/logviewer/logprefwidgetbase.ui648
-rw-r--r--plugins/logviewer/logviewer.cpp110
-rw-r--r--plugins/logviewer/logviewer.h50
-rw-r--r--plugins/logviewer/logviewerplugin.cpp84
-rw-r--r--plugins/logviewer/logviewerplugin.h52
-rw-r--r--plugins/logviewer/logviewerpluginsettings.kcfgc7
15 files changed, 1618 insertions, 0 deletions
diff --git a/plugins/logviewer/Makefile.am b/plugins/logviewer/Makefile.am
new file mode 100644
index 0000000..c925a12
--- /dev/null
+++ b/plugins/logviewer/Makefile.am
@@ -0,0 +1,33 @@
+INCLUDES = -I$(srcdir)/../../libktorrent $(all_includes)
+
+METASOURCES = AUTO
+kde_module_LTLIBRARIES = ktlogviewerplugin.la
+
+
+# Libs needed by the plugin
+ktlogviewerplugin_la_LIBADD = $(LIB_KHTML) $(LIB_KPARTS) \
+ ../../libktorrent/libktorrent.la $(LIB_QT) \
+ $(LIB_KDECORE) $(LIB_KDEUI) $(LIB_KFILE)
+
+
+
+# LD flags for the plugin
+# -module says: this is a module, i.e. something you're going to dlopen
+# so e.g. it has no version number like a normal shared lib would have.
+ktlogviewerplugin_la_LDFLAGS = -module $(KDE_PLUGIN) $(all_libraries)
+
+# rc file containing the GUI for the plugin
+# pluginsdir = $(kde_datadir)/ktsearchplugin
+# plugins_DATA = ktsearchpluginui.rc
+
+# Install the desktop file needed to detect the plugin
+kde_services_DATA = ktlogviewerplugin.desktop
+
+kde_kcfg_DATA = ktlogviewerplugin.kcfg
+
+noinst_HEADERS = logviewerplugin.h logviewer.h logprefpage.h logprefwidget.h \
+ logflags.h
+ktlogviewerplugin_la_SOURCES = logviewerplugin.cpp logviewer.cpp \
+ logprefpage.cpp logprefwidgetbase.ui logprefwidget.cpp logviewerpluginsettings.kcfgc \
+ logflags.cpp
+KDE_CXXFLAGS = $(USE_EXCEPTIONS) $(USE_RTTI)
diff --git a/plugins/logviewer/ktlogviewerplugin.desktop b/plugins/logviewer/ktlogviewerplugin.desktop
new file mode 100644
index 0000000..ba2e625
--- /dev/null
+++ b/plugins/logviewer/ktlogviewerplugin.desktop
@@ -0,0 +1,26 @@
+[Desktop Entry]
+Name=LogViewerPlugin
+Name[bg]=Приставка за преглед на журнални файлове
+Name[de]=Modul zur Anzeige von Protokolldateien
+Name[el]=Πρόσθετο προβολής καταγραφής
+Name[es]=Visualizador del registro
+Name[et]=Loginäitaja plugin
+Name[it]=Plugin visore registro
+Name[nb]=Logvisningsmodul
+Name[nds]=Logbookkieker-Moduul
+Name[nl]=Logweergaveplugin
+Name[pl]=Wtyczka wyświetlania dziennika
+Name[pt]=Visualizador do Registo
+Name[pt_BR]=Plugin de Vizualização de Log
+Name[sk]=LogViewer Plugin
+Name[sr]=Прикључак приказа дневника
+Name[sr@Latn]=Priključak prikaza dnevnika
+Name[sv]=Loggvisningsinsticksprogram
+Name[tr]=Kayıt Görüntü Eklentisi
+Name[uk]=Втулок перегляду журналу
+Name[xx]=xxLogViewerPluginxx
+Name[zh_CN]=日志查看器插件
+Name[zh_TW]=紀錄檢視器外掛程式
+ServiceTypes=KTorrent/Plugin
+Type=Service
+X-KDE-Library=ktlogviewerplugin
diff --git a/plugins/logviewer/ktlogviewerplugin.kcfg b/plugins/logviewer/ktlogviewerplugin.kcfg
new file mode 100644
index 0000000..c6e4a25
--- /dev/null
+++ b/plugins/logviewer/ktlogviewerplugin.kcfg
@@ -0,0 +1,71 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<kcfg xmlns="http://www.kde.org/standards/kcfg/1.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0
+ http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" >
+
+ <group name="general">
+
+ <entry name = "useRichText" type ="Bool">
+ <label>Use rich log text</label>
+ <default>false</default>
+ </entry>
+
+ <entry name="sysGEN" type="UInt">
+ <label>General info messages flag</label>
+ <default>0</default>
+ </entry>
+ <entry name="sysCON" type="UInt">
+ <label>Connections messages flag</label>
+ <default>0</default>
+ </entry>
+ <entry name="sysDHT" type="UInt">
+ <label>DHT messages flag</label>
+ <default>0</default>
+ </entry>
+ <entry name="sysTRK" type="UInt">
+ <label>Tracker info messages flag</label>
+ <default>0</default>
+ </entry>
+ <entry name="sysDIO" type="UInt">
+ <label>Disk IO info messages flag</label>
+ <default>0</default>
+ </entry>
+ <entry name="sysIPF" type="UInt">
+ <label>IPFilter plugin messages flag</label>
+ <default>0</default>
+ </entry>
+ <entry name="sysSRC" type="UInt">
+ <label>Search plugin messages flag</label>
+ <default>0</default>
+ </entry>
+ <entry name="sysPFI" type="UInt">
+ <label>PartFileImport plugin messages flag</label>
+ <default>0</default>
+ </entry>
+ <entry name="sysINW" type="UInt">
+ <label>InfoWidget plugin messages flag</label>
+ <default>0</default>
+ </entry>
+ <entry name="sysPNP" type="UInt">
+ <label>UPnP plugin messages flag</label>
+ <default>0</default>
+ </entry>
+ <entry name="sysSNF" type="UInt">
+ <label>ScanFolder plugin messages flag</label>
+ <default>0</default>
+ </entry>
+ <entry name="sysSCD" type="UInt">
+ <label>Scheduler plugin messages flag</label>
+ <default>0</default>
+ </entry>
+ <entry name="sysRSS" type="UInt">
+ <label>RSS plugin messages flag</label>
+ <default>0</default>
+ </entry>
+ <entry name="sysWEB" type="UInt">
+ <label>WebInterface plugin messages flag</label>
+ <default>0</default>
+ </entry>
+ </group>
+</kcfg>
diff --git a/plugins/logviewer/logflags.cpp b/plugins/logviewer/logflags.cpp
new file mode 100644
index 0000000..ef1ba69
--- /dev/null
+++ b/plugins/logviewer/logflags.cpp
@@ -0,0 +1,170 @@
+/***************************************************************************
+ * Copyright (C) 2006 by Ivan Vasić *
+ * ivasic@gmail.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 2 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, write to the *
+ * Free Software Foundation, Inc., *
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
+ ***************************************************************************/
+#include "logflags.h"
+#include "logviewer.h"
+#include "logviewerpluginsettings.h"
+
+#include <util/log.h>
+#include <torrent/globals.h>
+
+#include <qstring.h>
+
+using namespace bt;
+
+namespace kt
+{
+
+ LogFlags* LogFlags::self = 0;
+ LogViewer* LogFlags::m_log = 0;
+
+ LogFlags::LogFlags()
+ {
+ updateFlags();
+ }
+
+ LogFlags::~LogFlags()
+ {}
+
+ LogFlags& LogFlags::instance()
+ {
+ if (!self)
+ self = new LogFlags();
+ return *self;
+ }
+
+ bool LogFlags::checkFlags(unsigned int arg)
+ {
+ if(arg & SYS_GEN)
+ return m_flags.SYSGEN & arg;
+
+ if(arg & SYS_CON)
+ return (arg & m_flags.SYSCON) && ((arg & 0x0000000F) <= m_flags.SYSCON);
+
+ if(arg & SYS_DHT)
+ return (arg & m_flags.SYSDHT) && ((arg & 0x0000000F) <= m_flags.SYSDHT);
+
+ if(arg & SYS_TRK)
+ return (arg & m_flags.SYSTRK) && ((arg & 0x0000000F) <= m_flags.SYSTRK);
+
+ if(arg & SYS_DIO)
+ return (arg & m_flags.SYSDIO) && ((arg & 0x0000000F) <= m_flags.SYSDIO);
+
+ if(arg & SYS_INW)
+ return (arg & m_flags.SYSINW) && ((arg & 0x0000000F) <= m_flags.SYSINW);
+
+ if(arg & SYS_IPF)
+ return (arg & m_flags.SYSIPF) && ((arg & 0x0000000F) <= m_flags.SYSIPF);
+
+ if(arg & SYS_PFI)
+ return (arg & m_flags.SYSPFI) && ((arg & 0x0000000F) <= m_flags.SYSPFI);
+
+ if(arg & SYS_PNP)
+ return (arg & m_flags.SYSPNP) && ((arg & 0x0000000F) <= m_flags.SYSPNP);
+
+ if(arg & SYS_SCD)
+ return (arg & m_flags.SYSSCD) && ((arg & 0x0000000F) <= m_flags.SYSSCD);
+
+ if(arg & SYS_SNF)
+ return (arg & m_flags.SYSSNF) && ((arg & 0x0000000F) <= m_flags.SYSSNF);
+
+ if(arg & SYS_SRC)
+ return (arg & m_flags.SYSSRC) && ((arg & 0x0000000F) <= m_flags.SYSSRC);
+
+ if(arg & SYS_RSS)
+ return (arg & m_flags.SYSRSS) && ((arg & 0x0000000F) <= m_flags.SYSRSS);
+
+ if(arg & SYS_WEB)
+ return (arg & m_flags.SYSWEB) && ((arg & 0x0000000F) <= m_flags.SYSWEB);
+
+ return true;
+ }
+
+ void LogFlags::updateFlags()
+ {
+ m_flags.SYSGEN = LogViewerPluginSettings::sysGEN();
+ m_flags.SYSCON = LogViewerPluginSettings::sysCON();
+ m_flags.SYSDHT = LogViewerPluginSettings::sysDHT();
+ m_flags.SYSTRK = LogViewerPluginSettings::sysTRK();
+ m_flags.SYSDIO = LogViewerPluginSettings::sysDIO();
+
+ m_flags.SYSINW = LogViewerPluginSettings::sysINW();
+ m_flags.SYSIPF = LogViewerPluginSettings::sysIPF();
+ m_flags.SYSPFI = LogViewerPluginSettings::sysPFI();
+ m_flags.SYSPNP = LogViewerPluginSettings::sysPNP();
+ m_flags.SYSSCD = LogViewerPluginSettings::sysSCD();
+ m_flags.SYSSNF = LogViewerPluginSettings::sysSNF();
+ m_flags.SYSSRC = LogViewerPluginSettings::sysSRC();
+ m_flags.SYSRSS = LogViewerPluginSettings::sysRSS();
+ m_flags.SYSWEB = LogViewerPluginSettings::sysWEB();
+
+ m_useRichText = LogViewerPluginSettings::useRichText();
+
+ if(m_log)
+ m_log->setRichText(m_useRichText);
+ }
+
+ void LogFlags::finalize()
+ {
+ delete self;
+ self = 0;
+ m_log = 0;
+ }
+
+ bool LogFlags::useRichText()
+ {
+ return m_useRichText;
+ }
+
+ void LogFlags::setLog(LogViewer* log)
+ {
+ m_log = log;
+ }
+
+ QString& LogFlags::getFormattedMessage(unsigned int arg, QString& line)
+ {
+ if( (arg & LOG_ALL) == LOG_ALL)
+ {
+ return line;
+ }
+
+ if(arg & 0x04)
+ {
+ line.prepend("<font color=\"#646464\">");
+ line.append("</font>");
+ return line;
+ }
+
+ if(arg & 0x02)
+ {
+ line.prepend("<font color=\"#000000\">");
+ line.append("</font>");
+ return line;
+ }
+
+ if(arg & 0x01)
+ {
+ line.prepend("<font color=\"#460000\">");
+ line.append("</font>");
+ return line;
+ }
+
+ return line;
+ }
+}
diff --git a/plugins/logviewer/logflags.h b/plugins/logviewer/logflags.h
new file mode 100644
index 0000000..9d7245a
--- /dev/null
+++ b/plugins/logviewer/logflags.h
@@ -0,0 +1,91 @@
+/***************************************************************************
+ * Copyright (C) 2006 by Ivan Vasić *
+ * ivasic@gmail.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 2 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, write to the *
+ * Free Software Foundation, Inc., *
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
+ ***************************************************************************/
+#ifndef KTLOGFLAGS_H
+#define KTLOGFLAGS_H
+
+class QString;
+
+namespace kt
+{
+ struct _logFlags
+ {
+ unsigned int SYSCON;
+ unsigned int SYSTRK;
+ unsigned int SYSDHT;
+ unsigned int SYSGEN;
+ unsigned int SYSDIO;
+
+ unsigned int SYSIPF;
+ unsigned int SYSSRC;
+ unsigned int SYSPNP;
+ unsigned int SYSINW;
+ unsigned int SYSSNF;
+ unsigned int SYSPFI;
+ unsigned int SYSSCD;
+ unsigned int SYSRSS;
+ unsigned int SYSWEB;
+ };
+
+ class LogViewer;
+
+ /**
+ * Class to read/save logging messages flags.
+ * @author Ivan Vasic <ivasic@gmail.com>
+ */
+ class LogFlags
+ {
+ public:
+ virtual ~LogFlags();
+
+ static LogFlags& instance();
+
+ ///Checks current flags with arg. Return true if message should be shown
+ bool checkFlags(unsigned int arg);
+
+ ///Updates flags from Settings::
+ void updateFlags();
+
+ ///Destroys this object
+ static void finalize();
+
+ ///Checks if LogViewer should print rich text format.
+ bool useRichText();
+
+ ///Sets a pointer to LogViewer
+ void setLog(LogViewer* log);
+
+ ///Makes line rich text according to arg level.
+ QString& getFormattedMessage(unsigned int arg, QString& line);
+
+ private:
+ LogFlags();
+
+ struct _logFlags m_flags;
+
+ static LogFlags* self;
+
+ static LogViewer* m_log;
+
+ bool m_useRichText;
+ };
+
+}
+
+#endif
diff --git a/plugins/logviewer/logprefpage.cpp b/plugins/logviewer/logprefpage.cpp
new file mode 100644
index 0000000..cc89a68
--- /dev/null
+++ b/plugins/logviewer/logprefpage.cpp
@@ -0,0 +1,63 @@
+/***************************************************************************
+ * Copyright (C) 2006 by Ivan Vasic *
+ * ivasic@gmail.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 2 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, write to the *
+ * Free Software Foundation, Inc., *
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
+ ***************************************************************************/
+#include "logprefpage.h"
+#include "logprefwidget.h"
+
+#include <klocale.h>
+#include <kglobal.h>
+#include <kiconloader.h>
+
+namespace kt
+{
+
+ LogPrefPage::LogPrefPage()
+ : PrefPageInterface(i18n("LogViewer"), i18n("LogViewer Options"),
+ KGlobal::iconLoader()->loadIcon("toggle_log",KIcon::NoGroup))
+ {
+ m_widget = 0;
+ }
+
+
+ LogPrefPage::~LogPrefPage()
+ {}
+
+ bool LogPrefPage::apply()
+ {
+ if(m_widget)
+ return m_widget->apply();
+
+ return true;
+ }
+
+ void LogPrefPage::createWidget(QWidget* parent)
+ {
+ m_widget = new LogPrefWidget(parent);
+ }
+
+ void LogPrefPage::updateData()
+ {
+ }
+
+ void LogPrefPage::deleteWidget()
+ {
+ if(m_widget)
+ delete m_widget;
+ }
+}
diff --git a/plugins/logviewer/logprefpage.h b/plugins/logviewer/logprefpage.h
new file mode 100644
index 0000000..3aed61b
--- /dev/null
+++ b/plugins/logviewer/logprefpage.h
@@ -0,0 +1,51 @@
+/***************************************************************************
+ * Copyright (C) 2006 by Ivan Vasic *
+ * ivasic@gmail.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 2 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, write to the *
+ * Free Software Foundation, Inc., *
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
+ ***************************************************************************/
+#ifndef KTLOGPREFPAGE_H
+#define KTLOGPREFPAGE_H
+
+#include <interfaces/prefpageinterface.h>
+
+#include "logprefwidget.h"
+
+namespace kt
+{
+
+ /**
+ * LogViewer plugin preferences page
+ * @author Ivan Vasic <ivasic@gmail.com>
+ */
+ class LogPrefPage : public PrefPageInterface
+ {
+ public:
+ LogPrefPage();
+ virtual ~LogPrefPage();
+
+ virtual bool apply();
+ virtual void createWidget(QWidget* parent);
+ virtual void updateData();
+ virtual void deleteWidget();
+
+ private:
+ LogPrefWidget* m_widget;
+ };
+
+}
+
+#endif
diff --git a/plugins/logviewer/logprefwidget.cpp b/plugins/logviewer/logprefwidget.cpp
new file mode 100644
index 0000000..6bf99bd
--- /dev/null
+++ b/plugins/logviewer/logprefwidget.cpp
@@ -0,0 +1,123 @@
+/***************************************************************************
+ * Copyright (C) 2006 by Ivan Vasic *
+ * ivasic@gmail.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 2 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, write to the *
+ * Free Software Foundation, Inc., *
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
+ ***************************************************************************/
+#include "logprefwidget.h"
+#include "logviewerpluginsettings.h"
+#include "logflags.h"
+
+#include <kglobal.h>
+#include <klocale.h>
+
+#include <qwidget.h>
+#include <qstring.h>
+#include <qcheckbox.h>
+#include <qcombobox.h>
+
+namespace kt
+{
+ LogPrefWidget::LogPrefWidget(QWidget *parent, const char *name)
+ :LogPrefWidgetBase(parent, name)
+ {
+ m_sysgen->setCurrentItem(getLevel(LogViewerPluginSettings::sysGEN()));
+ m_syscon->setCurrentItem(getLevel(LogViewerPluginSettings::sysCON()));
+ m_sysdht->setCurrentItem(getLevel(LogViewerPluginSettings::sysDHT()));
+ m_systrk->setCurrentItem(getLevel(LogViewerPluginSettings::sysTRK()));
+ m_sysdio->setCurrentItem(getLevel(LogViewerPluginSettings::sysDIO()));
+
+ m_sysipf->setCurrentItem(getLevel(LogViewerPluginSettings::sysIPF()));
+ m_syspfi->setCurrentItem(getLevel(LogViewerPluginSettings::sysPFI()));
+ m_sysinw->setCurrentItem(getLevel(LogViewerPluginSettings::sysINW()));
+ m_syspnp->setCurrentItem(getLevel(LogViewerPluginSettings::sysPNP()));
+ m_syssrc->setCurrentItem(getLevel(LogViewerPluginSettings::sysSRC()));
+ m_sysscd->setCurrentItem(getLevel(LogViewerPluginSettings::sysSCD()));
+ m_syssnf->setCurrentItem(getLevel(LogViewerPluginSettings::sysSNF()));
+ m_sysrss->setCurrentItem(getLevel(LogViewerPluginSettings::sysRSS()));
+ m_sysweb->setCurrentItem(getLevel(LogViewerPluginSettings::sysWEB()));
+
+ m_useRich->setChecked(LogViewerPluginSettings::useRichText());
+ }
+
+ bool LogPrefWidget::apply()
+ {
+ LogViewerPluginSettings::setSysGEN(getArg(m_sysgen->currentItem()));
+ LogViewerPluginSettings::setSysCON(getArg(m_syscon->currentItem()));
+ LogViewerPluginSettings::setSysDHT(getArg(m_sysdht->currentItem()));
+ LogViewerPluginSettings::setSysTRK(getArg(m_systrk->currentItem()));
+ LogViewerPluginSettings::setSysDIO(getArg(m_sysdio->currentItem()));
+
+ LogViewerPluginSettings::setSysIPF(getArg(m_sysipf->currentItem()));
+ LogViewerPluginSettings::setSysPFI(getArg(m_syspfi->currentItem()));
+ LogViewerPluginSettings::setSysINW(getArg(m_sysinw->currentItem()));
+ LogViewerPluginSettings::setSysPNP(getArg(m_syspnp->currentItem()));
+ LogViewerPluginSettings::setSysSRC(getArg(m_syssrc->currentItem()));
+ LogViewerPluginSettings::setSysSCD(getArg(m_sysscd->currentItem()));
+ LogViewerPluginSettings::setSysSNF(getArg(m_syssnf->currentItem()));
+ LogViewerPluginSettings::setSysRSS(getArg(m_sysrss->currentItem()));
+ LogViewerPluginSettings::setSysWEB(getArg(m_sysweb->currentItem()));
+
+ LogViewerPluginSettings::setUseRichText(m_useRich->isChecked());
+
+
+ LogViewerPluginSettings::writeConfig();
+
+ LogFlags::instance().updateFlags();
+
+ return true;
+ }
+
+ int LogPrefWidget::getLevel(unsigned int arg)
+ {
+ switch(arg)
+ {
+ case 0x0F:
+ return 0;
+ case 0x07:
+ return 1;
+ case 0x03:
+ return 2;
+ case 0x01:
+ return 3;
+ case 0x00:
+ return 4;
+ default:
+ return 0;
+ }
+ }
+
+ unsigned int LogPrefWidget::getArg(int level)
+ {
+ switch(level)
+ {
+ case 0:
+ return 0x0F;
+ case 1:
+ return 0x07;
+ case 2:
+ return 0x03;
+ case 3:
+ return 0x01;
+ case 4:
+ return 0x00;
+ default:
+ return 0;
+ }
+ }
+}
+
+#include "logprefwidget.moc"
diff --git a/plugins/logviewer/logprefwidget.h b/plugins/logviewer/logprefwidget.h
new file mode 100644
index 0000000..35a6c06
--- /dev/null
+++ b/plugins/logviewer/logprefwidget.h
@@ -0,0 +1,39 @@
+/***************************************************************************
+ * Copyright (C) 2006 by Ivan Vasic *
+ * ivasic@gmail.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 2 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, write to the *
+ * Free Software Foundation, Inc., *
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
+ ***************************************************************************/
+#ifndef LOGPREFWIDGET_H
+#define LOGPREFWIDGET_H
+
+#include "logprefwidgetbase.h"
+
+namespace kt
+{
+ class LogPrefWidget: public LogPrefWidgetBase
+ {
+ Q_OBJECT
+ public:
+ LogPrefWidget(QWidget *parent = 0, const char *name = 0);
+ bool apply();
+
+ private:
+ int getLevel(unsigned int arg);
+ unsigned int getArg(int level);
+ };
+}
+#endif
diff --git a/plugins/logviewer/logprefwidgetbase.ui b/plugins/logviewer/logprefwidgetbase.ui
new file mode 100644
index 0000000..76e7124
--- /dev/null
+++ b/plugins/logviewer/logprefwidgetbase.ui
@@ -0,0 +1,648 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>LogPrefWidgetBase</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>LogPrefWidgetBase</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>600</width>
+ <height>480</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>LogViewer Options</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <spacer row="2" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>spacer1</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>110</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QButtonGroup" row="0" column="1">
+ <property name="name">
+ <cstring>buttonGroup2</cstring>
+ </property>
+ <property name="title">
+ <string>Plugins</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QComboBox" row="0" column="1">
+ <item>
+ <property name="text">
+ <string>All</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Debug</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Notice</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Important</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>None</string>
+ </property>
+ </item>
+ <property name="name">
+ <cstring>m_sysipf</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>textLabel2</cstring>
+ </property>
+ <property name="text">
+ <string>IPFilter:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>comboBox1_5</cstring>
+ </property>
+ </widget>
+ <widget class="QComboBox" row="1" column="1">
+ <item>
+ <property name="text">
+ <string>All</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Debug</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Notice</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Important</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>None</string>
+ </property>
+ </item>
+ <property name="name">
+ <cstring>m_syssrc</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>textLabel2_2</cstring>
+ </property>
+ <property name="text">
+ <string>Search:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>comboBox1_6</cstring>
+ </property>
+ </widget>
+ <widget class="QComboBox" row="2" column="1">
+ <item>
+ <property name="text">
+ <string>All</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Debug</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Notice</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Important</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>None</string>
+ </property>
+ </item>
+ <property name="name">
+ <cstring>m_syspnp</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="0">
+ <property name="name">
+ <cstring>textLabel2_3</cstring>
+ </property>
+ <property name="text">
+ <string>UPnP:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>comboBox1_7</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="3" column="0">
+ <property name="name">
+ <cstring>textLabel2_4</cstring>
+ </property>
+ <property name="text">
+ <string>ScanFolder:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>comboBox1_8</cstring>
+ </property>
+ </widget>
+ <widget class="QComboBox" row="3" column="1">
+ <item>
+ <property name="text">
+ <string>All</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Debug</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Notice</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Important</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>None</string>
+ </property>
+ </item>
+ <property name="name">
+ <cstring>m_syssnf</cstring>
+ </property>
+ </widget>
+ <widget class="QComboBox" row="4" column="1">
+ <item>
+ <property name="text">
+ <string>All</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Debug</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Notice</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Important</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>None</string>
+ </property>
+ </item>
+ <property name="name">
+ <cstring>m_sysscd</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="4" column="0">
+ <property name="name">
+ <cstring>textLabel2_5</cstring>
+ </property>
+ <property name="text">
+ <string>Scheduler:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>comboBox1_9</cstring>
+ </property>
+ </widget>
+ <widget class="QComboBox" row="5" column="1">
+ <item>
+ <property name="text">
+ <string>All</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Debug</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Notice</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Important</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>None</string>
+ </property>
+ </item>
+ <property name="name">
+ <cstring>m_syspfi</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="5" column="0">
+ <property name="name">
+ <cstring>textLabel2_6</cstring>
+ </property>
+ <property name="text">
+ <string>PartFileImport:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>comboBox1_10</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="6" column="0">
+ <property name="name">
+ <cstring>textLabel2_7</cstring>
+ </property>
+ <property name="text">
+ <string>InfoWidget:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>comboBox1_11</cstring>
+ </property>
+ </widget>
+ <widget class="QComboBox" row="6" column="1">
+ <item>
+ <property name="text">
+ <string>All</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Debug</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Notice</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Important</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>None</string>
+ </property>
+ </item>
+ <property name="name">
+ <cstring>m_sysinw</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="7" column="0">
+ <property name="name">
+ <cstring>textLabel2_7_2</cstring>
+ </property>
+ <property name="text">
+ <string>RSS plugin:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>comboBox1_11</cstring>
+ </property>
+ </widget>
+ <widget class="QComboBox" row="7" column="1">
+ <item>
+ <property name="text">
+ <string>All</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Debug</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Notice</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Important</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>None</string>
+ </property>
+ </item>
+ <property name="name">
+ <cstring>m_sysrss</cstring>
+ </property>
+ </widget>
+ <widget class="QComboBox" row="8" column="1">
+ <item>
+ <property name="text">
+ <string>All</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Debug</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Notice</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Important</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>None</string>
+ </property>
+ </item>
+ <property name="name">
+ <cstring>m_sysweb</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="8" column="0">
+ <property name="name">
+ <cstring>textLabel2_7_2_2</cstring>
+ </property>
+ <property name="text">
+ <string>WebInterface plugin:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>comboBox1_11</cstring>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QButtonGroup" row="0" column="0">
+ <property name="name">
+ <cstring>buttonGroup3</cstring>
+ </property>
+ <property name="title">
+ <string>System</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>General:</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>textLabel2_8</cstring>
+ </property>
+ <property name="text">
+ <string>Connections:</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="0">
+ <property name="name">
+ <cstring>textLabel2_9</cstring>
+ </property>
+ <property name="text">
+ <string>DHT:</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="3" column="0">
+ <property name="name">
+ <cstring>textLabel2_10</cstring>
+ </property>
+ <property name="text">
+ <string>Tracker:</string>
+ </property>
+ </widget>
+ <widget class="QComboBox" row="0" column="1">
+ <item>
+ <property name="text">
+ <string>All</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Debug</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Notice</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Important</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>None</string>
+ </property>
+ </item>
+ <property name="name">
+ <cstring>m_sysgen</cstring>
+ </property>
+ </widget>
+ <widget class="QComboBox" row="1" column="1">
+ <item>
+ <property name="text">
+ <string>All</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Debug</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Notice</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Important</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>None</string>
+ </property>
+ </item>
+ <property name="name">
+ <cstring>m_syscon</cstring>
+ </property>
+ </widget>
+ <widget class="QComboBox" row="2" column="1">
+ <item>
+ <property name="text">
+ <string>All</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Debug</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Notice</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Important</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>None</string>
+ </property>
+ </item>
+ <property name="name">
+ <cstring>m_sysdht</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="4" column="0">
+ <property name="name">
+ <cstring>textLabel1_2</cstring>
+ </property>
+ <property name="text">
+ <string>Disk I/O:</string>
+ </property>
+ </widget>
+ <widget class="QComboBox" row="3" column="1">
+ <item>
+ <property name="text">
+ <string>All</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Debug</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Notice</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Important</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>None</string>
+ </property>
+ </item>
+ <property name="name">
+ <cstring>m_systrk</cstring>
+ </property>
+ </widget>
+ <widget class="QComboBox" row="4" column="1">
+ <item>
+ <property name="text">
+ <string>All</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Debug</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Notice</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Important</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>None</string>
+ </property>
+ </item>
+ <property name="name">
+ <cstring>m_sysdio</cstring>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QButtonGroup" row="1" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>buttonGroup3_2</cstring>
+ </property>
+ <property name="title">
+ <string>Options</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QCheckBox" row="0" column="0">
+ <property name="name">
+ <cstring>m_useRich</cstring>
+ </property>
+ <property name="text">
+ <string>Use rich te&amp;xt for log</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ </grid>
+</widget>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/plugins/logviewer/logviewer.cpp b/plugins/logviewer/logviewer.cpp
new file mode 100644
index 0000000..5e6b16c
--- /dev/null
+++ b/plugins/logviewer/logviewer.cpp
@@ -0,0 +1,110 @@
+/***************************************************************************
+ * Copyright (C) 2005 by Joris Guisson *
+ * joris.guisson@gmail.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 2 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, write to the *
+ * Free Software Foundation, Inc., *
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
+ ***************************************************************************/
+#include <kglobal.h>
+#include <kconfig.h>
+#include <qapplication.h>
+#include "logviewer.h"
+#include "logflags.h"
+#include "logviewerpluginsettings.h"
+
+namespace kt
+{
+ const int LOG_EVENT_TYPE = 65432;
+
+ class LogEvent : public QCustomEvent
+ {
+ QString str;
+ public:
+ LogEvent(const QString & str) : QCustomEvent(LOG_EVENT_TYPE),str(str)
+ {}
+
+ virtual ~LogEvent()
+ {}
+
+ const QString & msg() const {return str;}
+ };
+
+ LogViewer::LogViewer(QWidget *parent, const char *name)
+ : KTextBrowser(parent, name), LogMonitorInterface()
+ {
+ /*
+ IMPORTANT: use LogText mode, so that setMaxLogLines will work, if not everything will be kept in memory.
+ */
+ setTextFormat(Qt::LogText);
+ setMaxLogLines(200);
+ setMinimumSize(QSize(0,50));
+ setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding);
+ KGlobal::config()->setGroup("LogViewer");
+ if (KGlobal::config()->hasKey("LogViewerWidgetSize"))
+ {
+ QSize s = KGlobal::config()->readSizeEntry("LogViewerWidgetSize",0);
+ resize(s);
+ }
+
+ LogFlags::instance().setLog(this);
+ }
+
+
+ LogViewer::~LogViewer()
+ {
+ KGlobal::config()->setGroup("LogViewer");
+ KGlobal::config()->writeEntry("LogViewerWidgetSize",size());
+ LogFlags::instance().setLog(0);
+ }
+
+
+ void LogViewer::message(const QString& line, unsigned int arg)
+ {
+ /*
+ IMPORTANT: because QTextBrowser is not thread safe, we must use the Qt event mechanism
+ to add strings to it, this will ensure that strings will only be added in the main application
+ thread.
+ */
+ if(arg==0x00 || LogFlags::instance().checkFlags(arg))
+ {
+ if(m_useRichText)
+ {
+ QString tmp = line;
+ LogEvent* le = new LogEvent(LogFlags::instance().getFormattedMessage(arg, tmp));
+ QApplication::postEvent(this,le);
+ }
+ else
+ {
+ LogEvent* le = new LogEvent(line);
+ QApplication::postEvent(this,le);
+ }
+ }
+ }
+
+ void LogViewer::customEvent(QCustomEvent* ev)
+ {
+ if (ev->type() == LOG_EVENT_TYPE)
+ {
+ LogEvent* le = (LogEvent*)ev;
+ append(le->msg());
+ }
+ }
+
+ void LogViewer::setRichText(bool val)
+ {
+ m_useRichText = val;
+ }
+}
+#include "logviewer.moc"
diff --git a/plugins/logviewer/logviewer.h b/plugins/logviewer/logviewer.h
new file mode 100644
index 0000000..4198215
--- /dev/null
+++ b/plugins/logviewer/logviewer.h
@@ -0,0 +1,50 @@
+/***************************************************************************
+ * Copyright (C) 2005 by Joris Guisson *
+ * joris.guisson@gmail.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 2 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, write to the *
+ * Free Software Foundation, Inc., *
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
+ ***************************************************************************/
+#ifndef KTLOGVIEWER_H
+#define KTLOGVIEWER_H
+
+#include <ktextbrowser.h>
+#include <interfaces/logmonitorinterface.h>
+#include "logflags.h"
+
+namespace kt
+{
+ /**
+ * @author Joris Guisson
+ */
+ class LogViewer : public KTextBrowser, public LogMonitorInterface
+ {
+ Q_OBJECT
+ public:
+ LogViewer(QWidget *parent = 0, const char *name = 0);
+ virtual ~LogViewer();
+
+ virtual void message(const QString& line, unsigned int arg);
+ virtual void customEvent(QCustomEvent* ev);
+
+ void setRichText(bool val);
+
+ private:
+ bool m_useRichText;
+ };
+
+}
+
+#endif
diff --git a/plugins/logviewer/logviewerplugin.cpp b/plugins/logviewer/logviewerplugin.cpp
new file mode 100644
index 0000000..aa35d2f
--- /dev/null
+++ b/plugins/logviewer/logviewerplugin.cpp
@@ -0,0 +1,84 @@
+/***************************************************************************
+ * Copyright (C) 2005 by Joris Guisson *
+ * joris.guisson@gmail.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 2 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, write to the *
+ * Free Software Foundation, Inc., *
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
+ ***************************************************************************/
+#include <kgenericfactory.h>
+#include <kglobal.h>
+#include <klocale.h>
+#include <kiconloader.h>
+#include <util/log.h>
+#include <torrent/globals.h>
+#include <interfaces/guiinterface.h>
+#include "logviewerplugin.h"
+#include "logviewer.h"
+#include "logprefpage.h"
+#include "logflags.h"
+
+#define NAME "Log Viewer"
+#define AUTHOR "Joris Guisson"
+#define EMAIL "joris.guisson@gmail.com"
+
+using namespace bt;
+
+K_EXPORT_COMPONENT_FACTORY(ktlogviewerplugin,KGenericFactory<kt::LogViewerPlugin>("ktlogviewerplugin"))
+
+namespace kt
+{
+
+ LogViewerPlugin::LogViewerPlugin(QObject* parent, const char* qt_name, const QStringList& args)
+ : Plugin(parent, qt_name, args, NAME,i18n("Log Viewer"), AUTHOR, EMAIL,
+ i18n("Displays ktorrent logging output"),"log")
+ {
+ lv = 0;
+ }
+
+
+ LogViewerPlugin::~LogViewerPlugin()
+ {}
+
+
+ void LogViewerPlugin::load()
+ {
+ lv = new LogViewer();
+ this->getGUI()->addToolWidget(lv,"log",i18n("Log Viewer"),GUIInterface::DOCK_BOTTOM);
+ bt::Log & lg = Globals::instance().getLog(0);
+ lg.addMonitor(lv);
+ pref = new LogPrefPage();
+ this->getGUI()->addPrefPage(pref);
+ }
+
+ void LogViewerPlugin::unload()
+ {
+ this->getGUI()->removeToolWidget(lv);
+ bt::Log & lg = Globals::instance().getLog(0);
+ lg.removeMonitor(lv);
+ delete lv;
+ lv = 0;
+ this->getGUI()->removePrefPage(pref);
+ delete pref;
+ pref = 0;
+ LogFlags::finalize();
+ }
+
+ bool LogViewerPlugin::versionCheck(const QString & version) const
+ {
+ return version == KT_VERSION_MACRO;
+ }
+
+}
+#include "logviewerplugin.moc"
diff --git a/plugins/logviewer/logviewerplugin.h b/plugins/logviewer/logviewerplugin.h
new file mode 100644
index 0000000..9cd5af8
--- /dev/null
+++ b/plugins/logviewer/logviewerplugin.h
@@ -0,0 +1,52 @@
+/***************************************************************************
+ * Copyright (C) 2005 by Joris Guisson *
+ * joris.guisson@gmail.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 2 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, write to the *
+ * Free Software Foundation, Inc., *
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
+ ***************************************************************************/
+#ifndef KTLOGVIEWERPLUGIN_H
+#define KTLOGVIEWERPLUGIN_H
+
+#include <interfaces/plugin.h>
+
+
+
+namespace kt
+{
+ class LogViewer;
+ class LogPrefPage;
+
+ /**
+ * @author Joris Guisson
+ */
+ class LogViewerPlugin : public Plugin
+ {
+ Q_OBJECT
+ public:
+ LogViewerPlugin(QObject* parent, const char* qt_name, const QStringList& args);
+ virtual ~LogViewerPlugin();
+
+ virtual void load();
+ virtual void unload();
+ virtual bool versionCheck(const QString& version) const;
+ private:
+ LogViewer* lv;
+ LogPrefPage* pref;
+ };
+
+}
+
+#endif
diff --git a/plugins/logviewer/logviewerpluginsettings.kcfgc b/plugins/logviewer/logviewerpluginsettings.kcfgc
new file mode 100644
index 0000000..c10fa1c
--- /dev/null
+++ b/plugins/logviewer/logviewerpluginsettings.kcfgc
@@ -0,0 +1,7 @@
+# Code generation options for kconfig_compiler
+File=ktlogviewerplugin.kcfg
+ClassName=LogViewerPluginSettings
+Namespace=kt
+Singleton=true
+Mutators=true
+# will create the necessary code for setting those variables \ No newline at end of file