kuassel: remove leftover logger code

This commit is contained in:
Ivailo Monev 2015-01-27 20:56:12 +00:00
parent 90934716e1
commit aa6de11a6c
10 changed files with 2 additions and 246 deletions

View file

@ -108,8 +108,7 @@ Client::Client(QObject *parent)
_messageProcessor(0), _messageProcessor(0),
_coreAccountModel(new CoreAccountModel(this)), _coreAccountModel(new CoreAccountModel(this)),
_coreConnection(new CoreConnection(this)), _coreConnection(new CoreConnection(this)),
_connected(false), _connected(false)
_debugLog(&_debugLogBuffer)
{ {
_signalProxy->synchronize(_ircListHelper); _signalProxy->synchronize(_ircListHelper);
} }
@ -644,48 +643,3 @@ void Client::markBufferAsRead(BufferId id)
if (bufferSyncer() && id.isValid()) if (bufferSyncer() && id.isValid())
bufferSyncer()->requestMarkBufferAsRead(id); bufferSyncer()->requestMarkBufferAsRead(id);
} }
#if QT_VERSION < 0x050000
void Client::logMessage(QtMsgType type, const char *msg)
{
fprintf(stderr, "%s\n", msg);
fflush(stderr);
if (type == QtFatalMsg) {
Quassel::logFatalMessage(msg);
}
else {
QString msgString = QString("%1\n").arg(msg);
//Check to see if there is an instance around, else we risk recursions
//when calling instance() and creating new ones.
if (!instanceExists())
return;
instance()->_debugLog << msgString;
emit instance()->logUpdated(msgString);
}
}
#else
void Client::logMessage(QtMsgType type, const QMessageLogContext &context, const QString &msg)
{
Q_UNUSED(context);
fprintf(stderr, "%s\n", msg.toLocal8Bit().constData());
fflush(stderr);
if (type == QtFatalMsg) {
Quassel::logFatalMessage(msg.toLocal8Bit().constData());
}
else {
QString msgString = QString("%1\n").arg(msg);
//Check to see if there is an instance around, else we risk recursions
//when calling instance() and creating new ones.
if (!instanceExists())
return;
instance()->_debugLog << msgString;
emit instance()->logUpdated(msgString);
}
}
#endif

View file

@ -142,13 +142,6 @@ public:
static void mergeBuffersPermanently(BufferId bufferId1, BufferId bufferId2); static void mergeBuffersPermanently(BufferId bufferId1, BufferId bufferId2);
static void purgeKnownBufferIds(); static void purgeKnownBufferIds();
#if QT_VERSION < 0x050000
static void logMessage(QtMsgType type, const char *msg);
#else
static void logMessage(QtMsgType, const QMessageLogContext&, const QString&);
#endif
static inline const QString &debugLog() { return instance()->_debugLogBuffer; }
signals: signals:
void requestNetworkStates(); void requestNetworkStates();
@ -257,9 +250,6 @@ private:
bool _connected; bool _connected;
static Quassel::Features _coreFeatures; static Quassel::Features _coreFeatures;
QString _debugLogBuffer;
QTextStream _debugLog;
QList<QPair<BufferInfo, QString> > _userInputBuffer; QList<QPair<BufferInfo, QString> > _userInputBuffer;
friend class CoreConnection; friend class CoreConnection;

View file

@ -105,8 +105,6 @@ Storage::State AbstractSqlStorage::init(const QVariantMap &settings)
{ {
setConnectionProperties(settings); setConnectionProperties(settings);
_debug = Quassel::isOptionSet("debug");
QSqlDatabase db = logDb(); QSqlDatabase db = logDb();
if (!db.isValid() || !db.isOpen()) if (!db.isValid() || !db.isOpen())
return NotAvailable; return NotAvailable;
@ -252,7 +250,7 @@ int AbstractSqlStorage::schemaVersion()
bool AbstractSqlStorage::watchQuery(QSqlQuery &query) bool AbstractSqlStorage::watchQuery(QSqlQuery &query)
{ {
bool queryError = query.lastError().isValid(); bool queryError = query.lastError().isValid();
if (queryError || _debug) { if (queryError) {
if (queryError) if (queryError)
qCritical() << "unhandled Error in QSqlQuery!"; qCritical() << "unhandled Error in QSqlQuery!";
qCritical() << " last Query:\n" << qPrintable(query.lastQuery()); qCritical() << " last Query:\n" << qPrintable(query.lastQuery());

View file

@ -23,7 +23,6 @@ set(SOURCES
coreinfodlg.cpp coreinfodlg.cpp
debugbufferviewoverlay.cpp debugbufferviewoverlay.cpp
debugconsole.cpp debugconsole.cpp
debuglogwidget.cpp
debugmessagemodelfilter.cpp debugmessagemodelfilter.cpp
inputwidget.cpp inputwidget.cpp
ircconnectionwizard.cpp ircconnectionwizard.cpp
@ -64,7 +63,6 @@ set(FORMS
coreinfodlg.ui coreinfodlg.ui
debugbufferviewoverlay.ui debugbufferviewoverlay.ui
debugconsole.ui debugconsole.ui
debuglogwidget.ui
inputwidget.ui inputwidget.ui
msgprocessorstatuswidget.ui msgprocessorstatuswidget.ui
nicklistwidget.ui nicklistwidget.ui

View file

@ -1,41 +0,0 @@
/***************************************************************************
* Copyright (C) 2005-2014 by the Quassel Project *
* devel@quassel-irc.org *
* *
* 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) version 3. *
* *
* 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 "debuglogwidget.h"
#include "client.h"
DebugLogWidget::DebugLogWidget(QWidget *parent)
: QWidget(parent)
{
ui.setupUi(this);
setAttribute(Qt::WA_DeleteOnClose, true);
ui.textEdit->setPlainText(Client::debugLog());
connect(Client::instance(), SIGNAL(logUpdated(const QString &)), this, SLOT(logUpdated(const QString &)));
ui.textEdit->setReadOnly(true);
}
void DebugLogWidget::logUpdated(const QString &msg)
{
ui.textEdit->moveCursor(QTextCursor::End);
ui.textEdit->insertPlainText(msg);
ui.textEdit->moveCursor(QTextCursor::End);
}

View file

@ -1,41 +0,0 @@
/***************************************************************************
* Copyright (C) 2005-2014 by the Quassel Project *
* devel@quassel-irc.org *
* *
* 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) version 3. *
* *
* 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 DEBUGLOGWIDGET_H
#define DEBUGLOGWIDGET_H
#include "ui_debuglogwidget.h"
class DebugLogWidget : public QWidget
{
Q_OBJECT
public:
DebugLogWidget(QWidget *parent = 0);
private slots:
void logUpdated(const QString &msg);
private:
Ui::DebugLogWidget ui;
};
#endif //DEBUGLOGWIDGET_H

View file

@ -71,7 +71,6 @@
#include "coreinfodlg.h" #include "coreinfodlg.h"
#include "contextmenuactionprovider.h" #include "contextmenuactionprovider.h"
#include "debugbufferviewoverlay.h" #include "debugbufferviewoverlay.h"
#include "debuglogwidget.h"
#include "debugmessagemodelfilter.h" #include "debugmessagemodelfilter.h"
#include "flatproxymodel.h" #include "flatproxymodel.h"
#include "inputwidget.h" #include "inputwidget.h"
@ -332,11 +331,8 @@ void MainWin::setupActions()
this, SLOT(on_actionDebugMessageModel_triggered()))); this, SLOT(on_actionDebugMessageModel_triggered())));
coll->addAction("DebugHotList", new Action(KIcon("tools-report-bug"), i18n("Debug &HotList"), coll, coll->addAction("DebugHotList", new Action(KIcon("tools-report-bug"), i18n("Debug &HotList"), coll,
this, SLOT(on_actionDebugHotList_triggered()))); this, SLOT(on_actionDebugHotList_triggered())));
coll->addAction("DebugLog", new Action(KIcon("tools-report-bug"), i18n("Debug &Log"), coll,
this, SLOT(on_actionDebugLog_triggered())));
coll->addAction("ReloadStyle", new Action(KIcon("view-refresh"), i18n("Reload Stylesheet"), coll, coll->addAction("ReloadStyle", new Action(KIcon("view-refresh"), i18n("Reload Stylesheet"), coll,
QtUi::style(), SLOT(reload()), QKeySequence::Refresh)); QtUi::style(), SLOT(reload()), QKeySequence::Refresh));
coll->addAction("HideCurrentBuffer", new Action(i18n("Hide Current Buffer"), coll, coll->addAction("HideCurrentBuffer", new Action(i18n("Hide Current Buffer"), coll,
this, SLOT(hideCurrentBuffer()), QKeySequence::Close)); this, SLOT(hideCurrentBuffer()), QKeySequence::Close));
@ -460,7 +456,6 @@ void MainWin::setupMenus()
_helpDebugMenu->addAction(coll->action("DebugBufferViewOverlay")); _helpDebugMenu->addAction(coll->action("DebugBufferViewOverlay"));
_helpDebugMenu->addAction(coll->action("DebugMessageModel")); _helpDebugMenu->addAction(coll->action("DebugMessageModel"));
_helpDebugMenu->addAction(coll->action("DebugHotList")); _helpDebugMenu->addAction(coll->action("DebugHotList"));
_helpDebugMenu->addAction(coll->action("DebugLog"));
_helpDebugMenu->addSeparator(); _helpDebugMenu->addSeparator();
_helpDebugMenu->addAction(coll->action("ReloadStyle")); _helpDebugMenu->addAction(coll->action("ReloadStyle"));
@ -1563,13 +1558,6 @@ void MainWin::on_actionDebugMessageModel_triggered()
} }
void MainWin::on_actionDebugLog_triggered()
{
DebugLogWidget *logWidget = new DebugLogWidget(0);
logWidget->show();
}
void MainWin::showStatusBarMessage(const QString &message) void MainWin::showStatusBarMessage(const QString &message)
{ {
statusBar()->showMessage(message, 10000); statusBar()->showMessage(message, 10000);

View file

@ -133,7 +133,6 @@ private slots:
void on_actionDebugBufferViewOverlay_triggered(); void on_actionDebugBufferViewOverlay_triggered();
void on_actionDebugMessageModel_triggered(); void on_actionDebugMessageModel_triggered();
void on_actionDebugHotList_triggered(); void on_actionDebugHotList_triggered();
void on_actionDebugLog_triggered();
void bindJumpKey(); void bindJumpKey();
void onJumpKey(); void onJumpKey();

View file

@ -47,12 +47,6 @@ QtUiApplication::QtUiApplication(int &argc, char **argv)
disableCrashhandler(); disableCrashhandler();
setRunMode(Quassel::ClientOnly); setRunMode(Quassel::ClientOnly);
#if QT_VERSION < 0x050000
qInstallMsgHandler(Client::logMessage);
#else
qInstallMessageHandler(Client::logMessage);
#endif
} }

View file

@ -1,83 +0,0 @@
<ui version="4.0" >
<class>DebugLogWidget</class>
<widget class="QWidget" name="DebugLogWidget" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
</rect>
</property>
<property name="windowTitle" >
<string>Debug Log</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout" >
<property name="spacing" >
<number>0</number>
</property>
<property name="margin" >
<number>0</number>
</property>
<item>
<widget class="QTextEdit" name="textEdit" />
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout" >
<item>
<spacer name="horizontalSpacer" >
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0" >
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="pushButton" >
<property name="text" >
<string>Close</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2" >
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0" >
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>pushButton</sender>
<signal>clicked()</signal>
<receiver>DebugLogWidget</receiver>
<slot>close()</slot>
<hints>
<hint type="sourcelabel" >
<x>217</x>
<y>284</y>
</hint>
<hint type="destinationlabel" >
<x>179</x>
<y>-16</y>
</hint>
</hints>
</connection>
</connections>
</ui>