diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-02-22 18:23:26 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-02-22 18:23:26 +0000 |
commit | ae364d9bed0589bf1a22cd5f530c563462379e3e (patch) | |
tree | e32727e2664e7ce68d0d30270afa040320ae35a1 /kradio3/plugins/gui-error-log | |
download | tderadio-ae364d9bed0589bf1a22cd5f530c563462379e3e.tar.gz tderadio-ae364d9bed0589bf1a22cd5f530c563462379e3e.zip |
Added old KDE3 version of kradio
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/kradio@1094417 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kradio3/plugins/gui-error-log')
-rw-r--r-- | kradio3/plugins/gui-error-log/Makefile.am | 17 | ||||
-rw-r--r-- | kradio3/plugins/gui-error-log/errorlog.cpp | 263 | ||||
-rw-r--r-- | kradio3/plugins/gui-error-log/errorlog.h | 89 | ||||
-rw-r--r-- | kradio3/plugins/gui-error-log/po/Makefile.am | 2 | ||||
-rw-r--r-- | kradio3/plugins/gui-error-log/po/de.po | 69 | ||||
-rw-r--r-- | kradio3/plugins/gui-error-log/po/ru.po | 71 |
6 files changed, 511 insertions, 0 deletions
diff --git a/kradio3/plugins/gui-error-log/Makefile.am b/kradio3/plugins/gui-error-log/Makefile.am new file mode 100644 index 0000000..1ac0e60 --- /dev/null +++ b/kradio3/plugins/gui-error-log/Makefile.am @@ -0,0 +1,17 @@ +SUBDIRS = po . + +INCLUDES = $(all_includes) +METASOURCES = AUTO + +libkradio_LTLIBRARIES = liberror-log.la +liberror_log_la_SOURCES = errorlog.cpp +liberror_log_la_LDFLAGS = -module -avoid-version $(KDE_RPATH) $(all_libraries) + +noinst_HEADERS = errorlog.h + +#messages: rc.cpp +# $(XGETTEXT) *.cpp *.h -o po/kradio-gui-error-log.pot + +messages: rc.cpp + $(EXTRACTRC) *.rc *.ui >> rc.cpp + $(XGETTEXT) rc.cpp *.h *.cpp -o po/kradio-gui-error-log.pot diff --git a/kradio3/plugins/gui-error-log/errorlog.cpp b/kradio3/plugins/gui-error-log/errorlog.cpp new file mode 100644 index 0000000..2eb58ad --- /dev/null +++ b/kradio3/plugins/gui-error-log/errorlog.cpp @@ -0,0 +1,263 @@ +/*************************************************************************** + errorlog.cpp - description + ------------------- + begin : Sa Sep 13 2003 + copyright : (C) 2003 by Martin Witte + email : [email protected] + ***************************************************************************/ + +/*************************************************************************** + * * + * 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. * + * * + ***************************************************************************/ + +#include "errorlog.h" + +#include <qframe.h> +#include <qdatetime.h> +#include <qlayout.h> + +#include <klocale.h> +#include <kiconloader.h> +#include <qtextedit.h> +#include <kfiledialog.h> +#include <kurl.h> +#include <ktempfile.h> +#include <kio/netaccess.h> + +#define PAGE_ID_INFO 0 +#define PAGE_ID_WARN 1 +#define PAGE_ID_ERROR 2 +#define PAGE_ID_DEBUG 3 + +/////////////////////////////////////////////////////////////////////// + +PLUGIN_LIBRARY_FUNCTIONS(ErrorLog, "kradio-gui-error-log", i18n("Error Logging Window for KRadio")); + +///////////////////////////////////////////////////////////////////////////// + +ErrorLog::ErrorLog(const QString &name) + : KDialogBase(KDialogBase::IconList, + "", + KDialogBase::Close|KDialogBase::User1, + KDialogBase::Close, + NULL, + name.ascii(), + false, + false, + KGuiItem(i18n("Save &as"), "filesaveas") + ), + WidgetPluginBase(name, i18n("Error Logger")), + init_done(false) +{ + QWidget::setCaption(i18n("KRadio Logger")); + QFrame *info = addPage(i18n("Information"), i18n("Information"), + KGlobal::instance()->iconLoader()->loadIcon( + "messagebox_info", KIcon::NoGroup, KIcon::SizeMedium + ) + ); + + QGridLayout *linfo = new QGridLayout(info); + linfo->setSpacing( 5 ); + linfo->setMargin ( 0 ); + m_teInfos = new QTextEdit(info); + linfo->addWidget(m_teInfos, 0, 0); + m_teInfos->setReadOnly(true); + logInfo(i18n("logging started")); + + + QFrame *warn = addPage(i18n("Warnings"), i18n("Warnings"), + KGlobal::instance()->iconLoader()->loadIcon( + "messagebox_warning", KIcon::NoGroup, KIcon::SizeMedium + ) + ); + QGridLayout *lwarn = new QGridLayout(warn); + lwarn->setSpacing( 5 ); + lwarn->setMargin ( 0 ); + m_teWarnings = new QTextEdit(warn); + lwarn->addWidget(m_teWarnings, 0, 0); + m_teWarnings->setReadOnly(true); + logWarning(i18n("logging started")); + + + + QFrame *err = addPage(i18n("Errors"), i18n("Errors"), + KGlobal::instance()->iconLoader()->loadIcon( + "messagebox_critical", KIcon::NoGroup, KIcon::SizeMedium + ) + ); + QGridLayout *lerr = new QGridLayout(err); + lerr->setSpacing( 5 ); + lerr->setMargin ( 0 ); + m_teErrors = new QTextEdit(err); + lerr->addWidget(m_teErrors, 0, 0); + m_teErrors->setReadOnly(true); + logError(i18n("logging started")); + + QFrame *debug = addPage(i18n("Debugging"), i18n("Debugging"), + KGlobal::instance()->iconLoader()->loadIcon( + "find", KIcon::NoGroup, KIcon::SizeMedium + ) + ); + + QGridLayout *ldebug = new QGridLayout(debug); + ldebug->setSpacing( 5 ); + ldebug->setMargin ( 0 ); + m_teDebug = new QTextEdit(debug); + ldebug->addWidget(m_teDebug, 0, 0); + m_teDebug->setReadOnly(true); + logDebug(i18n("logging started")); + + init_done = true; +} + + +ErrorLog::~ErrorLog() +{ +} + +bool ErrorLog::connectI (Interface *i) +{ + bool a = IErrorLog::connectI(i); + bool b = PluginBase::connectI(i); + return a || b; +} + +bool ErrorLog::disconnectI (Interface *i) +{ + bool a = IErrorLog::disconnectI(i); + bool b = PluginBase::disconnectI(i); + return a || b; +} + +void ErrorLog::restoreState (KConfig *config) +{ + config->setGroup(QString("errorlog-") + WidgetPluginBase::name()); + WidgetPluginBase::restoreState(config, false); +} + + +void ErrorLog::saveState (KConfig *config) const +{ + config->setGroup(QString("errorlog-") + WidgetPluginBase::name()); + WidgetPluginBase::saveState(config); +} + + +void ErrorLog::show() +{ + WidgetPluginBase::pShow(); + KDialogBase::show(); +} + +void ErrorLog::showOnOrgDesktop() +{ + WidgetPluginBase::pShowOnOrgDesktop(); + //KDialogBase::show(); +} + +void ErrorLog::hide() +{ + logDebug(QString("%1, ErrorLog::hide: all: %2, desktop: %3, visible:%4, anywherevisible:%5, cachevalid: %6").arg(name()).arg(m_saveSticky).arg(m_saveDesktop).arg(isReallyVisible()).arg(isAnywhereVisible()).arg(m_geoCacheValid)); + WidgetPluginBase::pHide(); + KDialogBase::hide(); +} + +void ErrorLog::showEvent(QShowEvent *e) +{ + KDialogBase::showEvent(e); + WidgetPluginBase::pShowEvent(e); +} + +void ErrorLog::hideEvent(QHideEvent *e) +{ + KDialogBase::hideEvent(e); + WidgetPluginBase::pHideEvent(e); +} + +// IErrorLog + +bool ErrorLog::logError (const QString &s) +{ + m_teErrors->append("<i>" + QDateTime::currentDateTime().toString(Qt::ISODate) + "</i> " + s + "\n"); + if (init_done) { + showPage(PAGE_ID_ERROR); + show(); + } + return true; +} + +bool ErrorLog::logWarning(const QString &s) +{ + m_teWarnings->append("<i>" + QDateTime::currentDateTime().toString(Qt::ISODate) + "</i> " + s + "\n"); + return true; +} + +bool ErrorLog::logInfo (const QString &s) +{ + m_teInfos->append("<i>" + QDateTime::currentDateTime().toString(Qt::ISODate) + "</i> " + s + "\n"); + return true; +} + +bool ErrorLog::logDebug (const QString &s) +{ + m_teDebug->append("<i>" + QDateTime::currentDateTime().toString(Qt::ISODate) + "</i> " + s + "\n"); + return true; +} + +// KDialogBase + + +// store Log Data +void ErrorLog::slotUser1() +{ + KFileDialog fd("", + ("*.log|" + i18n("Log Files") + "( *.log )").ascii(), + this, + i18n("Select Log File").ascii(), + true); + fd.setMode(KFile::File); + fd.setOperationMode(KFileDialog::Saving); + fd.setCaption (i18n("Save KRadio Logging Data as ...")); + + if (fd.exec() == QDialog::Accepted) { + KURL url = fd.selectedURL(); + + KTempFile tmpFile; + tmpFile.setAutoDelete(true); + QFile *outf = tmpFile.file(); + + QTextStream outs(outf); + outs.setEncoding(QTextStream::UnicodeUTF8); + + switch (activePageIndex()) { + case PAGE_ID_INFO: outs << m_teInfos->text(); break; + case PAGE_ID_WARN: outs << m_teWarnings->text(); break; + case PAGE_ID_ERROR: outs << m_teErrors->text(); break; + case PAGE_ID_DEBUG: outs << m_teDebug->text(); break; + default: break; + } + + if (outf->status() != IO_Ok) { + logError("ErrorLogger: " + + i18n("error writing to tempfile %1").arg(tmpFile.name())); + return; + } + + // close hopefully flushes buffers ;) + outf->close(); + + if (!KIO::NetAccess::upload(tmpFile.name(), url, this)) { + logError("ErrorLogger: " + + i18n("error uploading preset file %1").arg(url.url())); + } + } + setIconListAllVisible(true); +} + + +#include "errorlog.moc" diff --git a/kradio3/plugins/gui-error-log/errorlog.h b/kradio3/plugins/gui-error-log/errorlog.h new file mode 100644 index 0000000..d558037 --- /dev/null +++ b/kradio3/plugins/gui-error-log/errorlog.h @@ -0,0 +1,89 @@ +/*************************************************************************** + errorlog.h - description + ------------------- + begin : Sa Sep 13 2003 + copyright : (C) 2003 by Martin Witte + email : [email protected] + ***************************************************************************/ + +/*************************************************************************** + * * + * 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. * + * * + ***************************************************************************/ + +#ifndef KRADIO_ERRORLOG_H +#define KRADIO_ERRORLOG_H + +#include <kdialogbase.h> + +#include "../../src/include/errorlog-interfaces.h" +#include "../../src/include/widgetplugins.h" + + +class QTextEdit; +class ErrorLog : public KDialogBase, + public WidgetPluginBase, + public IErrorLog +{ +Q_OBJECT +public: + ErrorLog(const QString &name = QString::null); + ~ErrorLog(); + + virtual QString pluginClassName() const { return "ErrorLog"; } + virtual const QString &name() const { return PluginBase::name(); } + virtual QString &name() { return PluginBase::name(); } + + virtual bool connectI (Interface *); + virtual bool disconnectI (Interface *); + +// WidgetPluginBase + + virtual void saveState (KConfig *) const; + virtual void restoreState (KConfig *); + +public slots: + virtual void showOnOrgDesktop(); + virtual void show(); + virtual void hide(); + virtual void toggleShown () { WidgetPluginBase::pToggleShown(); } + +protected: + QWidget *getWidget() { return this; } + const QWidget *getWidget() const { return this; } + + virtual void showEvent(QShowEvent *); + virtual void hideEvent(QHideEvent *); + + virtual ConfigPageInfo createConfigurationPage () { return ConfigPageInfo(); } + virtual AboutPageInfo createAboutPage () { return AboutPageInfo(); } + +// IErrorLog + +RECEIVERS: + bool logError (const QString &); + bool logWarning(const QString &); + bool logInfo (const QString &); + bool logDebug (const QString &); + +// KDialogBase + +protected slots: + + void slotUser1(); + +protected: + + QTextEdit *m_teDebug, + *m_teInfos, + *m_teWarnings, + *m_teErrors; + + bool init_done; +}; + +#endif diff --git a/kradio3/plugins/gui-error-log/po/Makefile.am b/kradio3/plugins/gui-error-log/po/Makefile.am new file mode 100644 index 0000000..c3b26b7 --- /dev/null +++ b/kradio3/plugins/gui-error-log/po/Makefile.am @@ -0,0 +1,2 @@ +PACKAGE = kradio-gui-error-log +POFILES = AUTO diff --git a/kradio3/plugins/gui-error-log/po/de.po b/kradio3/plugins/gui-error-log/po/de.po new file mode 100644 index 0000000..0f357c7 --- /dev/null +++ b/kradio3/plugins/gui-error-log/po/de.po @@ -0,0 +1,69 @@ +# translation of de.po to +# translation of kradio-gui-error-log.po to +# This file is put in the public domain. +# +# Ernst Martin Witte <[email protected]>, 2006. +msgid "" +msgstr "" +"Project-Id-Version: de\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2006-11-10 23:20+0100\n" +"PO-Revision-Date: 2006-11-06 01:15+0100\n" +"Last-Translator: Ernst Martin Witte <[email protected]>\n" +"Language-Team: <[email protected]>\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: KBabel 1.11.4\n" + +#: errorlog.cpp:39 +msgid "Error Logging Window for KRadio" +msgstr "Fehlerprotokollierungsfenster für KRadio" + +#: errorlog.cpp:52 +msgid "Save &as" +msgstr "Sichern &unter" + +#: errorlog.cpp:54 +msgid "Error Logger" +msgstr "Fehlerprotokoll" + +#: errorlog.cpp:57 +msgid "KRadio Logger" +msgstr "KRadio Fehlerprotokoll" + +#: errorlog.cpp:70 errorlog.cpp:84 errorlog.cpp:99 errorlog.cpp:113 +msgid "logging started" +msgstr "Beginn des Protokollierung" + +#: errorlog.cpp:73 +msgid "Warnings" +msgstr "Warnungen" + +#: errorlog.cpp:88 +msgid "Errors" +msgstr "Fehler" + +#: errorlog.cpp:101 +msgid "Debugging" +msgstr "Debugging" + +#: errorlog.cpp:219 +msgid "Log Files" +msgstr "Protokoll-Dateien" + +#: errorlog.cpp:221 +msgid "Select Log File" +msgstr "Auswahl der Protokolldatei" + +#: errorlog.cpp:225 +msgid "Save KRadio Logging Data as ..." +msgstr "KRadio-Fehlerprotokoll sichern untern ..." + +#: errorlog.cpp:247 +msgid "error writing to tempfile %1" +msgstr "Fehler beim schreiben in die temporäre Datei %1" + +#: errorlog.cpp:256 +msgid "error uploading preset file %1" +msgstr "Fehler beim Upload der Senderdatei %1" diff --git a/kradio3/plugins/gui-error-log/po/ru.po b/kradio3/plugins/gui-error-log/po/ru.po new file mode 100644 index 0000000..0bac8e7 --- /dev/null +++ b/kradio3/plugins/gui-error-log/po/ru.po @@ -0,0 +1,71 @@ +# translation of ru.po to +# translation of kradio-gui-error-log.po to +# This file is put in the public domain. +# Алексей Кузнецов <[email protected]>, 2006. +# +msgid "" +msgstr "" +"Project-Id-Version: ru\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2006-11-11 02:11+0100\n" +"PO-Revision-Date: 2006-11-08 12:56+0300\n" +"Last-Translator: Алексей Кузнецов <[email protected]>\n" +"Language-Team: <[email protected]>\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: KBabel 1.10\n" + +#: errorlog.cpp:39 +msgid "Error Logging Window for KRadio" +msgstr "Окно ведения журнала ошибок KRadio" + +#: errorlog.cpp:52 +msgid "Save &as" +msgstr "Сохранить &как" + +#: errorlog.cpp:54 +msgid "Error Logger" +msgstr "Журнал ошибок" + +#: errorlog.cpp:57 +msgid "KRadio Logger" +msgstr "Журнал KRadio" + +#: errorlog.cpp:70 errorlog.cpp:84 errorlog.cpp:99 errorlog.cpp:113 +msgid "logging started" +msgstr "Журналирование включено" + +#: errorlog.cpp:73 +msgid "Warnings" +msgstr "Предупреждения" + +#: errorlog.cpp:88 +msgid "Errors" +msgstr "Ошибки" + +#: errorlog.cpp:101 +msgid "Debugging" +msgstr "" +"Отладочные\n" +"сообщения" + +#: errorlog.cpp:219 +msgid "Log Files" +msgstr "Файлы журнала" + +#: errorlog.cpp:221 +msgid "Select Log File" +msgstr "Выберите файлы журнала" + +#: errorlog.cpp:225 +msgid "Save KRadio Logging Data as ..." +msgstr "Сохранить данные журнала KRadio как..." + +#: errorlog.cpp:247 +msgid "error writing to tempfile %1" +msgstr "Ошибка записи во временный файл %1" + +#: errorlog.cpp:256 +msgid "error uploading preset file %1" +msgstr "Ошибка выгрузки файла настроек %1" |