Improved debuging:
authorMarcus Eggenberger <egs@quassel-irc.org>
Thu, 30 Oct 2008 13:17:23 +0000 (14:17 +0100)
committerMarcus Eggenberger <egs@quassel-irc.org>
Thu, 30 Oct 2008 13:17:23 +0000 (14:17 +0100)
 - client debug messages are accessible via menu: help -> debug -> debug log
 - the crash log contains now build information and output of asserts

21 files changed:
src/client/client.cpp
src/client/client.h
src/common/logger.cpp
src/common/logger.h
src/common/quassel.cpp
src/common/quassel.h
src/core/abstractsqlstorage.cpp
src/core/basichandler.cpp
src/core/core.cpp
src/core/coreapplication.cpp
src/core/corenetwork.cpp
src/core/coresession.cpp
src/core/ircserverhandler.cpp
src/core/networkconnection.cpp
src/core/sqlitestorage.cpp
src/core/sslserver.cpp
src/qtui/CMakeLists.txt
src/qtui/mainwin.cpp
src/qtui/mainwin.h
src/qtui/qtuiapplication.cpp
src/qtui/qtuiapplication.h

index b0be2a3..f981040 100644 (file)
@@ -35,6 +35,7 @@
 #include "messagemodel.h"
 #include "network.h"
 #include "networkmodel.h"
 #include "messagemodel.h"
 #include "network.h"
 #include "networkmodel.h"
+#include "quassel.h"
 #include "quasselui.h"
 #include "signalproxy.h"
 #include "util.h"
 #include "quasselui.h"
 #include "signalproxy.h"
 #include "util.h"
@@ -76,7 +77,8 @@ Client::Client(QObject *parent)
     _messageModel(0),
     _messageProcessor(0),
     _connectedToCore(false),
     _messageModel(0),
     _messageProcessor(0),
     _connectedToCore(false),
-    _syncedToCore(false)
+    _syncedToCore(false),
+    _debugLog(&_debugLogBuffer)
 {
   _signalProxy->synchronize(_ircListHelper);
 }
 {
   _signalProxy->synchronize(_ircListHelper);
 }
@@ -362,9 +364,9 @@ void Client::recvStatusMsg(QString /*net*/, QString /*msg*/) {
   //recvMessage(net, Message::server("", QString("[STATUS] %1").arg(msg)));
 }
 
   //recvMessage(net, Message::server("", QString("[STATUS] %1").arg(msg)));
 }
 
-void Client::recvMessage(const Message &msg_) {
-  Message msg = msg_;
-  messageProcessor()->process(msg);
+void Client::recvMessage(const Message &msg) {
+  Message msg_ = msg;
+  messageProcessor()->process(msg_);
 }
 
 void Client::setBufferLastSeenMsg(BufferId id, const MsgId &msgId) {
 }
 
 void Client::setBufferLastSeenMsg(BufferId id, const MsgId &msgId) {
@@ -402,3 +404,24 @@ void Client::bufferRenamed(BufferId bufferId, const QString &newName) {
     networkModel()->setData(bufferIndex, newName, Qt::DisplayRole);
   }
 }
     networkModel()->setData(bufferIndex, newName, Qt::DisplayRole);
   }
 }
+
+void Client::logMessage(QtMsgType type, const char *msg) {
+  QString prefix;
+  switch (type) {
+  case QtDebugMsg:
+    prefix = "Debug";
+    break;
+  case QtWarningMsg:
+    prefix = "Warning";
+    break;
+  case QtCriticalMsg:
+    prefix = "Critical";
+    break;
+  case QtFatalMsg:
+    Quassel::logFatalMessage(msg);
+    return;
+  }
+  instance()->_debugLog << prefix << ": " << msg << "\n";
+  emit instance()->logUpdated();
+}
+
index b8faf9f..52133b6 100644 (file)
@@ -112,6 +112,9 @@ public:
   static void setBufferLastSeenMsg(BufferId id, const MsgId &msgId); // this is synced to core and other clients
   static void removeBuffer(BufferId id);
 
   static void setBufferLastSeenMsg(BufferId id, const MsgId &msgId); // this is synced to core and other clients
   static void removeBuffer(BufferId id);
 
+  static void logMessage(QtMsgType type, const char *msg);
+  static inline const QString &debugLog() { return instance()->_debugLogBuffer; }
+
 signals:
   void sendInput(BufferInfo, QString message);
   void requestNetworkStates();
 signals:
   void sendInput(BufferInfo, QString message);
   void requestNetworkStates();
@@ -149,6 +152,8 @@ signals:
 
   void newClientSyncer(ClientSyncer *);
 
 
   void newClientSyncer(ClientSyncer *);
 
+  void logUpdated();
+
 public slots:
   //void selectBuffer(Buffer *);
 
 public slots:
   //void selectBuffer(Buffer *);
 
@@ -207,6 +212,9 @@ private:
 
   static AccountId _currentCoreAccount;
 
 
   static AccountId _currentCoreAccount;
 
+  QString _debugLogBuffer;
+  QTextStream _debugLog;
+
   friend class ClientSyncer;
 };
 
   friend class ClientSyncer;
 };
 
index fbee724..17c473b 100644 (file)
@@ -58,3 +58,22 @@ void Logger::log() {
   out << _buffer << endl;
   if(file.isOpen()) file.close();
 }
   out << _buffer << endl;
   if(file.isOpen()) file.close();
 }
+
+
+void Logger::logMessage(QtMsgType type, const char *msg) {
+  switch (type) {
+  case QtDebugMsg:
+    Logger(Logger::DebugLevel) << msg;
+    break;
+  case QtWarningMsg:
+    Logger(Logger::WarningLevel) << msg;
+    break;
+  case QtCriticalMsg:
+    Logger(Logger::ErrorLevel) << msg;
+    break;
+  case QtFatalMsg:
+    Logger(Logger::ErrorLevel) << msg;
+    Quassel::logFatalMessage(msg);
+    return;
+  }
+}
index f5a6ff5..d9b51a6 100644 (file)
 #include <QTextStream>
 
 class Logger {
 #include <QTextStream>
 
 class Logger {
-  public:
-    enum LogLevel {
-      DebugLevel,
-      InfoLevel,
-      WarningLevel,
-      ErrorLevel
-    };
-
-    inline Logger(LogLevel level) : _stream(&_buffer, QIODevice::WriteOnly), _logLevel(level) {}
-    ~Logger();
-
-    template<typename T>
-    inline Logger &operator<<(const T &value) { _stream << value << " "; return *this; }
-    inline Logger &operator<<(const QStringList & t) { _stream << t.join(" ") << " "; return *this; }
-    inline Logger &operator<<(bool t) { _stream << (t ? "true" : "false") << " "; return *this; }
-
-  private:
-    void log();
-    QTextStream _stream;
-    QString _buffer;
-    LogLevel _logLevel;
-};
-
-class quDebug : public Logger {
-  public:
-    inline quDebug() : Logger(Logger::DebugLevel) {}
+public:
+  enum LogLevel {
+    DebugLevel,
+    InfoLevel,
+    WarningLevel,
+    ErrorLevel
+  };
+
+  inline Logger(LogLevel level) : _stream(&_buffer, QIODevice::WriteOnly), _logLevel(level) {}
+  ~Logger();
+
+  static void logMessage(QtMsgType type, const char *msg);
+
+  template<typename T>
+  inline Logger &operator<<(const T &value) { _stream << value << " "; return *this; }
+  inline Logger &operator<<(const QStringList & t) { _stream << t.join(" ") << " "; return *this; }
+  inline Logger &operator<<(bool t) { _stream << (t ? "true" : "false") << " "; return *this; }
+
+private:
+  void log();
+  QTextStream _stream;
+  QString _buffer;
+  LogLevel _logLevel;
 };
 
 class quInfo : public Logger {
 };
 
 class quInfo : public Logger {
-  public:
-    inline quInfo() : Logger(Logger::InfoLevel) {}
-};
-
-class quWarning : public Logger {
-  public:
-    inline quWarning() : Logger(Logger::WarningLevel) {}
+public:
+  inline quInfo() : Logger(Logger::InfoLevel) {}
 };
 
 };
 
-class quError : public Logger {
-  public:
-    inline quError() : Logger(Logger::ErrorLevel) {}
-};
 #endif
 #endif
index dd6c5e7..e54d894 100644 (file)
@@ -46,6 +46,7 @@ CliParser *Quassel::_cliParser = 0;
 Quassel::RunMode Quassel::_runMode;
 bool Quassel::_initialized = false;
 bool Quassel::DEBUG = false;
 Quassel::RunMode Quassel::_runMode;
 bool Quassel::_initialized = false;
 bool Quassel::DEBUG = false;
+QString Quassel::_coreDumpFileName;
 
 Quassel::Quassel() {
   Q_INIT_RESOURCE(i18n);
 
 Quassel::Quassel() {
   Q_INIT_RESOURCE(i18n);
@@ -224,15 +225,33 @@ void Quassel::handleSignal(int sig) {
   }
 }
 
   }
 }
 
+void Quassel::logFatalMessage(const char *msg) {
+#ifndef Q_OS_MAC
+  QFile dumpFile(coreDumpFileName());
+  dumpFile.open(QIODevice::WriteOnly);
+  QTextStream dumpStream(&dumpFile);
+#else
+  QTextStream dumpStream(stderr);
+#endif
+  
+  dumpStream << "Fatal: " << msg << '\n';
+  dumpStream.flush();
+
+  qInstallMsgHandler(0);
+  abort();
+}
+
 void Quassel::handleCrash() {
 #ifdef BUILD_CRASHHANDLER
   void* callstack[128];
   int i, frames = backtrace(callstack, 128);
 
 void Quassel::handleCrash() {
 #ifdef BUILD_CRASHHANDLER
   void* callstack[128];
   int i, frames = backtrace(callstack, 128);
 
-  QFile dumpFile(QString("Quassel-Crash-%1").arg(QDateTime::currentDateTime().toString("yyyyMMdd-hhmm.log")));
-  dumpFile.open(QIODevice::WriteOnly);
+  QFile dumpFile(coreDumpFileName());
+  dumpFile.open(QIODevice::Append);
   QTextStream dumpStream(&dumpFile);
 
   QTextStream dumpStream(&dumpFile);
 
+  dumpStream << "Quassel IRC: " << _buildInfo.baseVersion << ' ' << _buildInfo.commitHash << '\n';
+    
   for (i = 0; i < frames; ++i) {
     Dl_info info;
     dladdr (callstack[i], &info);
   for (i = 0; i < frames; ++i) {
     Dl_info info;
     dladdr (callstack[i], &info);
@@ -287,3 +306,10 @@ void Quassel::handleCrash() {
   exit(27);
 #endif /* BUILD_CRASHHANDLER */
 }
   exit(27);
 #endif /* BUILD_CRASHHANDLER */
 }
+
+const QString &Quassel::coreDumpFileName() {
+  if(_coreDumpFileName.isEmpty())
+    _coreDumpFileName = QString("Quassel-Crash-%1.log").arg(QDateTime::currentDateTime().toString("yyyyMMdd-hhmm"));
+
+  return _coreDumpFileName;
+}
index bed6eac..a9fe53c 100644 (file)
 class Quassel {
   Q_DECLARE_TR_FUNCTIONS(Quassel)
 
 class Quassel {
   Q_DECLARE_TR_FUNCTIONS(Quassel)
 
-  public:
-    enum RunMode {
-      Monolithic,
-      ClientOnly,
-      CoreOnly
-    };
+public:
+  enum RunMode {
+    Monolithic,
+    ClientOnly,
+    CoreOnly
+  };
 
 
-    struct BuildInfo {
-      QString fancyVersionString; // clickable rev
-      QString plainVersionString; // no <a> tag
+  struct BuildInfo {
+    QString fancyVersionString; // clickable rev
+    QString plainVersionString; // no <a> tag
 
 
-      QString baseVersion;
-      QString generatedVersion;
-      QString commitHash;
-      uint commitDate;
-      QString buildDate;
-      bool isSourceDirty;
-      uint protocolVersion;
-      uint clientNeedsProtocol;
-      uint coreNeedsProtocol;
+    QString baseVersion;
+    QString generatedVersion;
+    QString commitHash;
+    uint commitDate;
+    QString buildDate;
+    bool isSourceDirty;
+    uint protocolVersion;
+    uint clientNeedsProtocol;
+    uint coreNeedsProtocol;
 
 
-      QString applicationName;
-      QString coreApplicationName;
-      QString clientApplicationName;
-      QString organizationName;
-      QString organizationDomain;
-    };
+    QString applicationName;
+    QString coreApplicationName;
+    QString clientApplicationName;
+    QString organizationName;
+    QString organizationDomain;
+  };
 
 
-    void setupBuildInfo(const QString &generated);
+  void setupBuildInfo(const QString &generated);
 
 
-    virtual ~Quassel();
+  virtual ~Quassel();
 
 
-    static inline const BuildInfo & buildInfo();
-    static inline RunMode runMode();
+  static inline const BuildInfo & buildInfo();
+  static inline RunMode runMode();
 
 
-    static inline CliParser *cliParser();
-    static inline QString optionValue(const QString &option);
-    static inline bool isOptionSet(const QString &option);
+  static inline CliParser *cliParser();
+  static inline QString optionValue(const QString &option);
+  static inline bool isOptionSet(const QString &option);
 
 
-    static bool DEBUG;
+  static const QString &coreDumpFileName();
 
 
-  protected:
-    Quassel();
-    virtual bool init();
+  static bool DEBUG;
 
 
-    inline void setRunMode(RunMode mode);
+  static void logFatalMessage(const char *msg);
 
 
+protected:
+  Quassel();
+  virtual bool init();
 
 
-  private:
-    void setupTranslations();
-    void registerMetaTypes();
+  inline void setRunMode(RunMode mode);
 
 
-    static void handleSignal(int signal);
-    static void handleCrash();
+private:
+  void setupTranslations();
+  void registerMetaTypes();
 
 
-    static BuildInfo _buildInfo;
-    static CliParser *_cliParser;
-    static RunMode _runMode;
-    static bool _initialized;
+  static void handleSignal(int signal);
+  static void handleCrash();
+
+  static BuildInfo _buildInfo;
+  static CliParser *_cliParser;
+  static RunMode _runMode;
+  static bool _initialized;
+
+  static QString _coreDumpFileName;
 };
 
 const Quassel::BuildInfo & Quassel::buildInfo() { return _buildInfo; }
 };
 
 const Quassel::BuildInfo & Quassel::buildInfo() { return _buildInfo; }
index 3919825..c6eeeec 100644 (file)
@@ -52,8 +52,8 @@ QSqlDatabase AbstractSqlStorage::logDb() {
     return db;
 
   if(!openDb()) {
     return db;
 
   if(!openDb()) {
-    quWarning() << "Unable to Open Database" << displayName();
-    quWarning() << "-" << db.lastError().text();
+    qWarning() << "Unable to Open Database" << displayName();
+    qWarning() << "-" << db.lastError().text();
   }
 
   return QSqlDatabase::database("quassel_connection");
   }
 
   return QSqlDatabase::database("quassel_connection");
@@ -85,17 +85,17 @@ bool AbstractSqlStorage::init(const QVariantMap &settings) {
     return false;
 
   if(installedSchemaVersion() == -1) {
     return false;
 
   if(installedSchemaVersion() == -1) {
-    quError() << "Storage Schema is missing!";
+    qCritical() << "Storage Schema is missing!";
     return false;
   }
 
   if(installedSchemaVersion() > schemaVersion()) {
     return false;
   }
 
   if(installedSchemaVersion() > schemaVersion()) {
-    quError() << "Installed Schema is newer then any known Version.";
+    qCritical() << "Installed Schema is newer then any known Version.";
     return false;
   }
   
   if(installedSchemaVersion() < schemaVersion()) {
     return false;
   }
   
   if(installedSchemaVersion() < schemaVersion()) {
-    quWarning() << "Installed Schema is not up to date. Upgrading...";
+    qWarning() << "Installed Schema is not up to date. Upgrading...";
     if(!upgradeDb())
       return false;
   }
     if(!upgradeDb())
       return false;
   }
@@ -120,7 +120,7 @@ QString AbstractSqlStorage::queryString(const QString &queryName, int version) {
     
   QFileInfo queryInfo(QString(":/SQL/%1/%2/%3.sql").arg(displayName()).arg(version).arg(queryName));
   if(!queryInfo.exists() || !queryInfo.isFile() || !queryInfo.isReadable()) {
     
   QFileInfo queryInfo(QString(":/SQL/%1/%2/%3.sql").arg(displayName()).arg(version).arg(queryName));
   if(!queryInfo.exists() || !queryInfo.isFile() || !queryInfo.isReadable()) {
-    quError() << "Unable to read SQL-Query" << queryName << "for engine" << displayName();
+    qCritical() << "Unable to read SQL-Query" << queryName << "for engine" << displayName();
     return QString();
   }
 
     return QString();
   }
 
@@ -164,14 +164,14 @@ bool AbstractSqlStorage::setup(const QVariantMap &settings) {
   Q_UNUSED(settings)
   QSqlDatabase db = logDb();
   if(!db.isOpen()) {
   Q_UNUSED(settings)
   QSqlDatabase db = logDb();
   if(!db.isOpen()) {
-    quError() << "Unable to setup Logging Backend!";
+    qCritical() << "Unable to setup Logging Backend!";
     return false;
   }
 
   foreach(QString queryString, setupQueries()) {
     QSqlQuery query = db.exec(queryString);
     if(!watchQuery(&query)) {
     return false;
   }
 
   foreach(QString queryString, setupQueries()) {
     QSqlQuery query = db.exec(queryString);
     if(!watchQuery(&query)) {
-      quError() << "Unable to setup Logging Backend!";
+      qCritical() << "Unable to setup Logging Backend!";
       return false;
     }
   }
       return false;
     }
   }
@@ -197,7 +197,7 @@ bool AbstractSqlStorage::upgradeDb() {
     foreach(QString queryString, upgradeQueries(ver)) {
       QSqlQuery query = db.exec(queryString);
       if(!watchQuery(&query)) {
     foreach(QString queryString, upgradeQueries(ver)) {
       QSqlQuery query = db.exec(queryString);
       if(!watchQuery(&query)) {
-       quError() << "Unable to upgrade Logging Backend!";
+       qCritical() << "Unable to upgrade Logging Backend!";
        return false;
       }
     }
        return false;
       }
     }
@@ -231,17 +231,17 @@ int AbstractSqlStorage::schemaVersion() {
 
 bool AbstractSqlStorage::watchQuery(QSqlQuery *query) {
   if(query->lastError().isValid()) {
 
 bool AbstractSqlStorage::watchQuery(QSqlQuery *query) {
   if(query->lastError().isValid()) {
-    quError() << "unhandled Error in QSqlQuery!";
-    quError() << "                  last Query:\n" << query->lastQuery();
-    quError() << "              executed Query:\n" << query->executedQuery();
-    quError() << "                bound Values:";
+    qCritical() << "unhandled Error in QSqlQuery!";
+    qCritical() << "                  last Query:\n" << query->lastQuery();
+    qCritical() << "              executed Query:\n" << query->executedQuery();
+    qCritical() << "                bound Values:";
     QList<QVariant> list = query->boundValues().values();
     for (int i = 0; i < list.size(); ++i)
     QList<QVariant> list = query->boundValues().values();
     for (int i = 0; i < list.size(); ++i)
-      quError() << i << ": " << list.at(i).toString().toAscii().data();
-    quError() << "                Error Number:"   << query->lastError().number();
-    quError() << "               Error Message:"   << query->lastError().text();
-    quError() << "              Driver Message:"   << query->lastError().driverText();
-    quError() << "                  DB Message:"   << query->lastError().databaseText();
+      qCritical() << i << ": " << list.at(i).toString().toAscii().data();
+    qCritical() << "                Error Number:"   << query->lastError().number();
+    qCritical() << "               Error Message:"   << query->lastError().text();
+    qCritical() << "              Driver Message:"   << query->lastError().driverText();
+    qCritical() << "                  DB Message:"   << query->lastError().databaseText();
     
     return false;
   }
     
     return false;
   }
index 8b9fd03..c7d0efb 100644 (file)
@@ -78,7 +78,7 @@ void BasicHandler::handle(const QString &member, QGenericArgument val0,
 
   if(!handlerHash().contains(handler)) {
     if(defaultHandler == -1) {
 
   if(!handlerHash().contains(handler)) {
     if(defaultHandler == -1) {
-      quWarning() << QString("No such Handler: %1::handle%2").arg(metaObject()->className(), handler);
+      qWarning() << QString("No such Handler: %1::handle%2").arg(metaObject()->className(), handler);
       return;
     } else {
       void *param[] = {0, Q_ARG(QString, member).data(), val0.data(), val1.data(), val2.data(), val3.data(), val4.data(),
       return;
     } else {
       void *param[] = {0, Q_ARG(QString, member).data(), val0.data(), val1.data(), val2.data(), val3.data(), val4.data(),
index 6506061..383526a 100644 (file)
@@ -56,8 +56,8 @@ Core::Core() : storage(0) {
   registerStorageBackend(new SqliteStorage(this));
 
   if(!_storageBackends.count()) {
   registerStorageBackend(new SqliteStorage(this));
 
   if(!_storageBackends.count()) {
-    quWarning() << qPrintable(tr("Could not initialize any storage backend! Exiting..."));
-    quWarning() << qPrintable(tr("Currently, Quassel only supports SQLite3. You need to build your\n"
+    qWarning() << qPrintable(tr("Could not initialize any storage backend! Exiting..."));
+    qWarning() << qPrintable(tr("Currently, Quassel only supports SQLite3. You need to build your\n"
                                 "Qt library with the sqlite plugin enabled in order for quasselcore\n"
                                 "to work."));
     exit(1); // TODO make this less brutal (especially for mono client -> popup)
                                 "Qt library with the sqlite plugin enabled in order for quasselcore\n"
                                 "to work."));
     exit(1); // TODO make this less brutal (especially for mono client -> popup)
@@ -72,7 +72,7 @@ void Core::init() {
   CoreSettings cs;
 
   if(!(configured = initStorage(cs.storageSettings().toMap()))) {
   CoreSettings cs;
 
   if(!(configured = initStorage(cs.storageSettings().toMap()))) {
-    quWarning() << "Core is currently not configured! Please connect with a Quassel Client for basic setup.";
+    qWarning() << "Core is currently not configured! Please connect with a Quassel Client for basic setup.";
 
     // try to migrate old settings
     QVariantMap old = cs.oldDbSettings().toMap();
 
     // try to migrate old settings
     QVariantMap old = cs.oldDbSettings().toMap();
@@ -80,7 +80,7 @@ void Core::init() {
       QVariantMap newSettings;
       newSettings["Backend"] = "SQLite";
       if((configured = initStorage(newSettings))) {
       QVariantMap newSettings;
       newSettings["Backend"] = "SQLite";
       if((configured = initStorage(newSettings))) {
-        quWarning() << "...but thankfully I found some old settings to migrate!";
+        qWarning() << "...but thankfully I found some old settings to migrate!";
         cs.setStorageSettings(newSettings);
       }
     }
         cs.setStorageSettings(newSettings);
       }
     }
@@ -117,7 +117,7 @@ void Core::restoreState() {
     return;
   }
   if(instance()->sessions.count()) {
     return;
   }
   if(instance()->sessions.count()) {
-    quWarning() << qPrintable(tr("Calling restoreState() even though active sessions exist!"));
+    qWarning() << qPrintable(tr("Calling restoreState() even though active sessions exist!"));
     return;
   }
   CoreSettings s;
     return;
   }
   CoreSettings s;
@@ -202,12 +202,12 @@ bool Core::initStorage(QVariantMap dbSettings, bool setup) {
   if(_storageBackends.contains(backend)) {
     storage = _storageBackends[backend];
   } else {
   if(_storageBackends.contains(backend)) {
     storage = _storageBackends[backend];
   } else {
-    quError() << "Selected storage backend is not available:" << backend;
+    qCritical() << "Selected storage backend is not available:" << backend;
     return configured = false;
   }
   if(!storage->init(dbSettings)) {
     if(!setup || !(storage->setup(dbSettings) && storage->init(dbSettings))) {
     return configured = false;
   }
   if(!storage->init(dbSettings)) {
     if(!setup || !(storage->setup(dbSettings) && storage->init(dbSettings))) {
-      quError() << "Could not init storage!";
+      qCritical() << "Could not init storage!";
       storage = 0;
       return configured = false;
     }
       storage = 0;
       return configured = false;
     }
@@ -375,7 +375,7 @@ bool Core::startListening() {
   }
 
   if(!success) {
   }
 
   if(!success) {
-    quError() << qPrintable(QString("Could not open GUI client port %1: %2").arg(port).arg(_server.errorString()));
+    qCritical() << qPrintable(QString("Could not open GUI client port %1: %2").arg(port).arg(_server.errorString()));
   }
 
   return success;
   }
 
   return success;
@@ -432,7 +432,7 @@ void Core::clientHasData() {
 void Core::processClientMessage(QTcpSocket *socket, const QVariantMap &msg) {
   if(!msg.contains("MsgType")) {
     // Client is way too old, does not even use the current init format
 void Core::processClientMessage(QTcpSocket *socket, const QVariantMap &msg) {
   if(!msg.contains("MsgType")) {
     // Client is way too old, does not even use the current init format
-    quWarning() << qPrintable(tr("Antique client trying to connect... refusing."));
+    qWarning() << qPrintable(tr("Antique client trying to connect... refusing."));
     socket->close();
     return;
   }
     socket->close();
     return;
   }
@@ -448,7 +448,7 @@ void Core::processClientMessage(QTcpSocket *socket, const QVariantMap &msg) {
       "This core needs at least client/core protocol version %1.<br>"
       "Please consider upgrading your client.").arg(Quassel::buildInfo().coreNeedsProtocol);
       SignalProxy::writeDataToDevice(socket, reply);
       "This core needs at least client/core protocol version %1.<br>"
       "Please consider upgrading your client.").arg(Quassel::buildInfo().coreNeedsProtocol);
       SignalProxy::writeDataToDevice(socket, reply);
-      quWarning() << qPrintable(tr("Client")) << qPrintable(socket->peerAddress().toString()) << qPrintable(tr("too old, rejecting."));
+      qWarning() << qPrintable(tr("Client")) << qPrintable(socket->peerAddress().toString()) << qPrintable(tr("too old, rejecting."));
       socket->close(); return;
     }
 
       socket->close(); return;
     }
 
@@ -508,7 +508,7 @@ void Core::processClientMessage(QTcpSocket *socket, const QVariantMap &msg) {
 #ifdef HAVE_SSL
     // after we told the client that we are ssl capable we switch to ssl mode
     if(supportSsl && msg["UseSsl"].toBool()) {
 #ifdef HAVE_SSL
     // after we told the client that we are ssl capable we switch to ssl mode
     if(supportSsl && msg["UseSsl"].toBool()) {
-      quDebug() << qPrintable(tr("Starting TLS for Client:"))  << qPrintable(socket->peerAddress().toString());
+      qDebug() << qPrintable(tr("Starting TLS for Client:"))  << qPrintable(socket->peerAddress().toString());
       connect(sslSocket, SIGNAL(sslErrors(const QList<QSslError> &)), this, SLOT(sslErrors(const QList<QSslError> &)));
       sslSocket->startServerEncryption();
     }
       connect(sslSocket, SIGNAL(sslErrors(const QList<QSslError> &)), this, SLOT(sslErrors(const QList<QSslError> &)));
       sslSocket->startServerEncryption();
     }
@@ -517,7 +517,7 @@ void Core::processClientMessage(QTcpSocket *socket, const QVariantMap &msg) {
 #ifndef QT_NO_COMPRESS
     if(supportsCompression && msg["UseCompression"].toBool()) {
       socket->setProperty("UseCompression", true);
 #ifndef QT_NO_COMPRESS
     if(supportsCompression && msg["UseCompression"].toBool()) {
       socket->setProperty("UseCompression", true);
-      quDebug() << "Using compression for Client:" << qPrintable(socket->peerAddress().toString());
+      qDebug() << "Using compression for Client:" << qPrintable(socket->peerAddress().toString());
     }
 #endif
 
     }
 #endif
 
@@ -528,7 +528,7 @@ void Core::processClientMessage(QTcpSocket *socket, const QVariantMap &msg) {
       reply["MsgType"] = "ClientLoginReject";
       reply["Error"] = tr("<b>Client not initialized!</b><br>You need to send an init message before trying to login.");
       SignalProxy::writeDataToDevice(socket, reply);
       reply["MsgType"] = "ClientLoginReject";
       reply["Error"] = tr("<b>Client not initialized!</b><br>You need to send an init message before trying to login.");
       SignalProxy::writeDataToDevice(socket, reply);
-      quWarning() << qPrintable(tr("Client")) << qPrintable(socket->peerAddress().toString()) << qPrintable(tr("did not send an init message before trying to login, rejecting."));
+      qWarning() << qPrintable(tr("Client")) << qPrintable(socket->peerAddress().toString()) << qPrintable(tr("did not send an init message before trying to login, rejecting."));
       socket->close(); return;
     }
     if(msg["MsgType"] == "CoreSetupData") {
       socket->close(); return;
     }
     if(msg["MsgType"] == "CoreSetupData") {
@@ -571,7 +571,7 @@ void Core::clientDisconnected() {
     socket->deleteLater();
   } else {
     // we have to crawl through the hashes and see if we find a victim to remove
     socket->deleteLater();
   } else {
     // we have to crawl through the hashes and see if we find a victim to remove
-    quDebug() << qPrintable(tr("Non-authed client disconnected. (socket allready destroyed)"));
+    qDebug() << qPrintable(tr("Non-authed client disconnected. (socket allready destroyed)"));
 
     // DO NOT CALL ANY METHODS ON socket!!
     socket = static_cast<QTcpSocket *>(sender());
 
     // DO NOT CALL ANY METHODS ON socket!!
     socket = static_cast<QTcpSocket *>(sender());
@@ -613,7 +613,7 @@ void Core::setupClientSession(QTcpSocket *socket, UserId uid) {
   blocksizes.remove(socket);
   clientInfo.remove(socket);
   if(!sess) {
   blocksizes.remove(socket);
   clientInfo.remove(socket);
   if(!sess) {
-    quWarning() << qPrintable(tr("Could not initialize session for client:")) << qPrintable(socket->peerAddress().toString());
+    qWarning() << qPrintable(tr("Could not initialize session for client:")) << qPrintable(socket->peerAddress().toString());
     socket->close();
   }
   sess->addClient(socket);
     socket->close();
   }
   sess->addClient(socket);
@@ -640,7 +640,7 @@ void Core::setupInternalClientSession(SignalProxy *proxy) {
 
 SessionThread *Core::createSession(UserId uid, bool restore) {
   if(sessions.contains(uid)) {
 
 SessionThread *Core::createSession(UserId uid, bool restore) {
   if(sessions.contains(uid)) {
-    quWarning() << "Calling createSession() when a session for the user already exists!";
+    qWarning() << "Calling createSession() when a session for the user already exists!";
     return 0;
   }
   SessionThread *sess = new SessionThread(uid, restore, this);
     return 0;
   }
   SessionThread *sess = new SessionThread(uid, restore, this);
@@ -661,5 +661,5 @@ void Core::sslErrors(const QList<QSslError> &errors) {
 void Core::socketError(QAbstractSocket::SocketError err) {
   QAbstractSocket *socket = qobject_cast<QAbstractSocket *>(sender());
   if(socket && err != QAbstractSocket::RemoteHostClosedError)
 void Core::socketError(QAbstractSocket::SocketError err) {
   QAbstractSocket *socket = qobject_cast<QAbstractSocket *>(sender());
   if(socket && err != QAbstractSocket::RemoteHostClosedError)
-    quWarning() << "Core::socketError()" << socket << err << socket->errorString();
+    qWarning() << "Core::socketError()" << socket << err << socket->errorString();
 }
 }
index 3d8b159..2cdc5a6 100644 (file)
@@ -21,6 +21,7 @@
 #include "coreapplication.h"
 
 #include "core.h"
 #include "coreapplication.h"
 
 #include "core.h"
+#include "logger.h"
 
 CoreApplicationInternal::CoreApplicationInternal()
   : _coreCreated(false)
 
 CoreApplicationInternal::CoreApplicationInternal()
   : _coreCreated(false)
@@ -67,9 +68,14 @@ bool CoreApplicationInternal::init() {
 
 /*****************************************************************************/
 
 
 /*****************************************************************************/
 
-CoreApplication::CoreApplication(int &argc, char **argv) : QCoreApplication(argc, argv), Quassel() {
+CoreApplication::CoreApplication(int &argc, char **argv)
+  : QCoreApplication(argc, argv),
+    Quassel()
+{
   setRunMode(Quassel::CoreOnly);
   _internal = new CoreApplicationInternal();
   setRunMode(Quassel::CoreOnly);
   _internal = new CoreApplicationInternal();
+
+  qInstallMsgHandler(Logger::logMessage);
 }
 
 CoreApplication::~CoreApplication() {
 }
 
 CoreApplication::~CoreApplication() {
index 6a2149d..a7cbd22 100644 (file)
@@ -32,7 +32,7 @@ CoreNetwork::CoreNetwork(const NetworkId &networkid, CoreSession *session)
 
 void CoreNetwork::requestConnect() const {
   if(connectionState() != Disconnected) {
 
 void CoreNetwork::requestConnect() const {
   if(connectionState() != Disconnected) {
-    quWarning() << "Requesting connect while already being connected!";
+    qWarning() << "Requesting connect while already being connected!";
     return;
   }
   emit connectRequested(networkId());
     return;
   }
   emit connectRequested(networkId());
@@ -40,7 +40,7 @@ void CoreNetwork::requestConnect() const {
 
 void CoreNetwork::requestDisconnect() const {
   if(connectionState() == Disconnected) {
 
 void CoreNetwork::requestDisconnect() const {
   if(connectionState() == Disconnected) {
-    quWarning() << "Requesting disconnect while not being connected!";
+    qWarning() << "Requesting disconnect while not being connected!";
     return;
   }
   emit disconnectRequested(networkId());
     return;
   }
   emit disconnectRequested(networkId());
index 0dd3358..acb9aa2 100644 (file)
@@ -140,13 +140,13 @@ void CoreSession::loadSettings() {
   foreach(IdentityId id, s.identityIds()) {
     Identity *i = new Identity(s.identity(id), this);
     if(!i->isValid()) {
   foreach(IdentityId id, s.identityIds()) {
     Identity *i = new Identity(s.identity(id), this);
     if(!i->isValid()) {
-      quWarning() << "Invalid identity! Removing...";
+      qWarning() << "Invalid identity! Removing...";
       s.removeIdentity(id);
       delete i;
       continue;
     }
     if(_identities.contains(i->id())) {
       s.removeIdentity(id);
       delete i;
       continue;
     }
     if(_identities.contains(i->id())) {
-      quWarning() << "Duplicate identity, ignoring!";
+      qWarning() << "Duplicate identity, ignoring!";
       delete i;
       continue;
     }
       delete i;
       continue;
     }
@@ -184,7 +184,7 @@ void CoreSession::updateBufferInfo(UserId uid, const BufferInfo &bufinfo) {
 void CoreSession::connectToNetwork(NetworkId id) {
   CoreNetwork *net = network(id);
   if(!net) {
 void CoreSession::connectToNetwork(NetworkId id) {
   CoreNetwork *net = network(id);
   if(!net) {
-    quWarning() << "Connect to unknown network requested! net:" << id << "user:" << user();
+    qWarning() << "Connect to unknown network requested! net:" << id << "user:" << user();
     return;
   }
 
     return;
   }
 
@@ -230,7 +230,7 @@ void CoreSession::networkStateRequested() {
 
 void CoreSession::addClient(QIODevice *device) {
   if(!device) {
 
 void CoreSession::addClient(QIODevice *device) {
   if(!device) {
-    quError() << "Invoking CoreSession::addClient with a QObject that is not a QIODevice!";
+    qCritical() << "Invoking CoreSession::addClient with a QObject that is not a QIODevice!";
   } else {
     // if the socket is an orphan, the signalProxy adopts it.
     // -> we don't need to care about it anymore
   } else {
     // if the socket is an orphan, the signalProxy adopts it.
     // -> we don't need to care about it anymore
@@ -294,7 +294,7 @@ void CoreSession::msgFromClient(BufferInfo bufinfo, QString msg) {
   if(conn) {
     conn->userInput(bufinfo, msg);
   } else {
   if(conn) {
     conn->userInput(bufinfo, msg);
   } else {
-    quWarning() << "Trying to send to unconnected network:" << msg;
+    qWarning() << "Trying to send to unconnected network:" << msg;
   }
 }
 
   }
 }
 
@@ -399,7 +399,7 @@ void CoreSession::removeIdentity(IdentityId id) {
 void CoreSession::identityUpdated(const QVariantMap &data) {
   IdentityId id = data.value("identityId", 0).value<IdentityId>();
   if(!id.isValid() || !_identities.contains(id)) {
 void CoreSession::identityUpdated(const QVariantMap &data) {
   IdentityId id = data.value("identityId", 0).value<IdentityId>();
   if(!id.isValid() || !_identities.contains(id)) {
-    quWarning() << "Update request for unknown identity received!";
+    qWarning() << "Update request for unknown identity received!";
     return;
   }
   CoreUserSettings s(user());
     return;
   }
   CoreUserSettings s(user());
@@ -416,7 +416,7 @@ void CoreSession::createNetwork(const NetworkInfo &info_) {
     Core::createNetwork(user(), info);
 
   if(!info.networkId.isValid()) {
     Core::createNetwork(user(), info);
 
   if(!info.networkId.isValid()) {
-    quWarning() << qPrintable(tr("CoreSession::createNetwork(): Got invalid networkId from Core when trying to create network %1!").arg(info.networkName));
+    qWarning() << qPrintable(tr("CoreSession::createNetwork(): Got invalid networkId from Core when trying to create network %1!").arg(info.networkName));
     return;
   }
 
     return;
   }
 
@@ -431,7 +431,7 @@ void CoreSession::createNetwork(const NetworkInfo &info_) {
     signalProxy()->synchronize(net);
     emit networkCreated(id);
   } else {
     signalProxy()->synchronize(net);
     emit networkCreated(id);
   } else {
-    quWarning() << qPrintable(tr("CoreSession::createNetwork(): Trying to create a network that already exists, updating instead!"));
+    qWarning() << qPrintable(tr("CoreSession::createNetwork(): Trying to create a network that already exists, updating instead!"));
     _networks[info.networkId]->requestSetNetworkInfo(info);
   }
 }
     _networks[info.networkId]->requestSetNetworkInfo(info);
   }
 }
@@ -471,24 +471,24 @@ void CoreSession::destroyNetwork(NetworkId id) {
 void CoreSession::removeBufferRequested(BufferId bufferId) {
   BufferInfo bufferInfo = Core::getBufferInfo(user(), bufferId);
   if(!bufferInfo.isValid()) {
 void CoreSession::removeBufferRequested(BufferId bufferId) {
   BufferInfo bufferInfo = Core::getBufferInfo(user(), bufferId);
   if(!bufferInfo.isValid()) {
-    quWarning() << "CoreSession::removeBufferRequested(): invalid BufferId:" << bufferId << "for User:" << user();
+    qWarning() << "CoreSession::removeBufferRequested(): invalid BufferId:" << bufferId << "for User:" << user();
     return;
   }
 
   if(bufferInfo.type() == BufferInfo::StatusBuffer) {
     return;
   }
 
   if(bufferInfo.type() == BufferInfo::StatusBuffer) {
-    quWarning() << "CoreSession::removeBufferRequested(): Status Buffers cannot be removed!";
+    qWarning() << "CoreSession::removeBufferRequested(): Status Buffers cannot be removed!";
     return;
   }
 
   if(bufferInfo.type() == BufferInfo::ChannelBuffer) {
     CoreNetwork *net = network(bufferInfo.networkId());
     if(!net) {
     return;
   }
 
   if(bufferInfo.type() == BufferInfo::ChannelBuffer) {
     CoreNetwork *net = network(bufferInfo.networkId());
     if(!net) {
-      quWarning() << "CoreSession::removeBufferRequested(): Received BufferInfo with unknown networkId!";
+      qWarning() << "CoreSession::removeBufferRequested(): Received BufferInfo with unknown networkId!";
       return;
     }
     IrcChannel *chan = net->ircChannel(bufferInfo.bufferName());
     if(chan) {
       return;
     }
     IrcChannel *chan = net->ircChannel(bufferInfo.bufferName());
     if(chan) {
-      quWarning() << "CoreSession::removeBufferRequested(): Unable to remove Buffer for joined Channel:" << bufferInfo.bufferName();
+      qWarning() << "CoreSession::removeBufferRequested(): Unable to remove Buffer for joined Channel:" << bufferInfo.bufferName();
       return;
     }
   }
       return;
     }
   }
index f466065..93076ec 100644 (file)
@@ -48,7 +48,7 @@ IrcServerHandler::~IrcServerHandler() {
 void IrcServerHandler::handleServerMsg(QByteArray msg) {
   try {
     if(msg.isEmpty()) {
 void IrcServerHandler::handleServerMsg(QByteArray msg) {
   try {
     if(msg.isEmpty()) {
-      quWarning() << "Received empty string from server!";
+      qWarning() << "Received empty string from server!";
       return;
     }
 
       return;
     }
 
@@ -68,7 +68,7 @@ void IrcServerHandler::handleServerMsg(QByteArray msg) {
     QList<QByteArray> params = msg.split(' ');
     if(!trailing.isEmpty()) params << trailing;
     if(params.count() < 1) {
     QList<QByteArray> params = msg.split(' ');
     if(!trailing.isEmpty()) params << trailing;
     if(params.count() < 1) {
-      quWarning() << "Received invalid string from server!";
+      qWarning() << "Received invalid string from server!";
       return;
     }
 
       return;
     }
 
@@ -79,7 +79,7 @@ void IrcServerHandler::handleServerMsg(QByteArray msg) {
       foo.remove(0, 1);
       prefix = foo;
       if(params.count() < 1) {
       foo.remove(0, 1);
       prefix = foo;
       if(params.count() < 1) {
-        quWarning() << "Received invalid string from server!";
+        qWarning() << "Received invalid string from server!";
         return;
       }
       foo = serverDecode(params.takeFirst());
         return;
       }
       foo = serverDecode(params.takeFirst());
@@ -92,7 +92,7 @@ void IrcServerHandler::handleServerMsg(QByteArray msg) {
     uint num = cmd.toUInt();
     if(num > 0) {
       if(params.count() == 0) {
     uint num = cmd.toUInt();
     if(num > 0) {
       if(params.count() == 0) {
-        quWarning() << "Message received from server violates RFC and is ignored!";
+        qWarning() << "Message received from server violates RFC and is ignored!";
         return;
       }
       params.removeFirst();
         return;
       }
       params.removeFirst();
@@ -244,7 +244,7 @@ void IrcServerHandler::handleMode(const QString &prefix, const QList<QByteArray>
          else
            channel->removeUserMode(ircUser, QString(modes[c]));
        } else {
          else
            channel->removeUserMode(ircUser, QString(modes[c]));
        } else {
-         quWarning() << "Received MODE with too few parameters:" << serverDecode(params);
+         qWarning() << "Received MODE with too few parameters:" << serverDecode(params);
        }
        paramOffset++;
       } else {
        }
        paramOffset++;
       } else {
@@ -255,7 +255,7 @@ void IrcServerHandler::handleMode(const QString &prefix, const QList<QByteArray>
            if(paramOffset < params.count()) {
              value = params[paramOffset];
            } else {
            if(paramOffset < params.count()) {
              value = params[paramOffset];
            } else {
-             quWarning() << "Received MODE with too few parameters:" << serverDecode(params);
+             qWarning() << "Received MODE with too few parameters:" << serverDecode(params);
            }
            paramOffset++;
        }
            }
            paramOffset++;
        }
@@ -304,7 +304,7 @@ void IrcServerHandler::handleNick(const QString &prefix, const QList<QByteArray>
 
   IrcUser *ircuser = network()->updateNickFromMask(prefix);
   if(!ircuser) {
 
   IrcUser *ircuser = network()->updateNickFromMask(prefix);
   if(!ircuser) {
-    quWarning() << "IrcServerHandler::handleNick(): Unknown IrcUser!";
+    qWarning() << "IrcServerHandler::handleNick(): Unknown IrcUser!";
     return;
   }
   QString newnick = serverDecode(params[0]);
     return;
   }
   QString newnick = serverDecode(params[0]);
@@ -341,7 +341,7 @@ void IrcServerHandler::handlePart(const QString &prefix, const QList<QByteArray>
   IrcUser *ircuser = network()->updateNickFromMask(prefix);
   QString channel = serverDecode(params[0]);
   if(!ircuser) {
   IrcUser *ircuser = network()->updateNickFromMask(prefix);
   QString channel = serverDecode(params[0]);
   if(!ircuser) {
-    quWarning() << "IrcServerHandler::handlePart(): Unknown IrcUser!";
+    qWarning() << "IrcServerHandler::handlePart(): Unknown IrcUser!";
     return;
   }
 
     return;
   }
 
@@ -383,12 +383,12 @@ void IrcServerHandler::handlePrivmsg(const QString &prefix, const QList<QByteArr
 
   IrcUser *ircuser = network()->updateNickFromMask(prefix);
   if(!ircuser) {
 
   IrcUser *ircuser = network()->updateNickFromMask(prefix);
   if(!ircuser) {
-    quWarning() << "IrcServerHandler::handlePrivmsg(): Unknown IrcUser!";
+    qWarning() << "IrcServerHandler::handlePrivmsg(): Unknown IrcUser!";
     return;
   }
 
   if(params.isEmpty()) {
     return;
   }
 
   if(params.isEmpty()) {
-    quWarning() << "IrcServerHandler::handlePrivmsg(): received PRIVMSG without target or message from:" << prefix;
+    qWarning() << "IrcServerHandler::handlePrivmsg(): received PRIVMSG without target or message from:" << prefix;
     return;
   }
      
     return;
   }
      
@@ -879,7 +879,7 @@ void IrcServerHandler::handle353(const QString &prefix, const QList<QByteArray>
 
   IrcChannel *channel = network()->ircChannel(channelname);
   if(!channel) {
 
   IrcChannel *channel = network()->ircChannel(channelname);
   if(!channel) {
-    quWarning() << "IrcServerHandler::handle353(): received unknown target channel:" << channelname;
+    qWarning() << "IrcServerHandler::handle353(): received unknown target channel:" << channelname;
     return;
   }
 
     return;
   }
 
@@ -963,7 +963,7 @@ void IrcServerHandler::tryNextNick(const QString &errnick) {
 
 bool IrcServerHandler::checkParamCount(const QString &methodName, const QList<QByteArray> &params, int minParams) {
   if(params.count() < minParams) {
 
 bool IrcServerHandler::checkParamCount(const QString &methodName, const QList<QByteArray> &params, int minParams) {
   if(params.count() < minParams) {
-    quWarning() << qPrintable(methodName) << "requires" << minParams << "parameters but received only" << params.count() << serverDecode(params);
+    qWarning() << qPrintable(methodName) << "requires" << minParams << "parameters but received only" << params.count() << serverDecode(params);
     return false;
   } else {
     return true;
     return false;
   } else {
     return true;
index 5815a91..5d27965 100644 (file)
@@ -179,11 +179,11 @@ void NetworkConnection::connectToIrc(bool reconnecting) {
   QVariantList serverList = network()->serverList();
   Identity *identity = coreSession()->identity(network()->identity());
   if(!serverList.count()) {
   QVariantList serverList = network()->serverList();
   Identity *identity = coreSession()->identity(network()->identity());
   if(!serverList.count()) {
-    quWarning() << "Server list empty, ignoring connect request!";
+    qWarning() << "Server list empty, ignoring connect request!";
     return;
   }
   if(!identity) {
     return;
   }
   if(!identity) {
-    quWarning() << "Invalid identity configures, ignoring connect request!";
+    qWarning() << "Invalid identity configures, ignoring connect request!";
     return;
   }
   // use a random server?
     return;
   }
   // use a random server?
@@ -278,7 +278,7 @@ void NetworkConnection::socketHasData() {
 
 void NetworkConnection::socketError(QAbstractSocket::SocketError) {
   _previousConnectionAttemptFailed = true;
 
 void NetworkConnection::socketError(QAbstractSocket::SocketError) {
   _previousConnectionAttemptFailed = true;
-  quWarning() << qPrintable(tr("Could not connect to %1 (%2)").arg(network()->networkName(), socket.errorString()));
+  qWarning() << qPrintable(tr("Could not connect to %1 (%2)").arg(network()->networkName(), socket.errorString()));
   emit connectionError(socket.errorString());
   emit displayMsg(Message::Error, BufferInfo::StatusBuffer, "", tr("Connection failure: %1").arg(socket.errorString()));
   network()->emitConnectionError(socket.errorString());
   emit connectionError(socket.errorString());
   emit displayMsg(Message::Error, BufferInfo::StatusBuffer, "", tr("Connection failure: %1").arg(socket.errorString()));
   network()->emitConnectionError(socket.errorString());
@@ -335,7 +335,7 @@ void NetworkConnection::socketInitialized() {
   //emit connected(networkId());  initialize first!
   Identity *identity = coreSession()->identity(network()->identity());
   if(!identity) {
   //emit connected(networkId());  initialize first!
   Identity *identity = coreSession()->identity(network()->identity());
   if(!identity) {
-    quError() << "Identity invalid!";
+    qCritical() << "Identity invalid!";
     disconnectFromIrc();
     return;
   }
     disconnectFromIrc();
     return;
   }
@@ -398,7 +398,7 @@ void NetworkConnection::socketDisconnected() {
 
 void NetworkConnection::doAutoReconnect() {
   if(connectionState() != Network::Disconnected && connectionState() != Network::Reconnecting) {
 
 void NetworkConnection::doAutoReconnect() {
   if(connectionState() != Network::Disconnected && connectionState() != Network::Reconnecting) {
-    quWarning() << "NetworkConnection::doAutoReconnect(): Cannot reconnect while not being disconnected!";
+    qWarning() << "NetworkConnection::doAutoReconnect(): Cannot reconnect while not being disconnected!";
     return;
   }
   if(_autoReconnectCount > 0) _autoReconnectCount--;
     return;
   }
   if(_autoReconnectCount > 0) _autoReconnectCount--;
index 7c46333..ef510e7 100644 (file)
@@ -269,7 +269,7 @@ bool SqliteStorage::removeNetwork(UserId user, const NetworkId &networkId) {
   if(withTransaction) {
     sync();
     if(!logDb().transaction()) {
   if(withTransaction) {
     sync();
     if(!logDb().transaction()) {
-      quWarning() << "SqliteStorage::removeNetwork(): cannot start transaction. continuing with out rollback support!";
+      qWarning() << "SqliteStorage::removeNetwork(): cannot start transaction. continuing with out rollback support!";
       withTransaction = false;
     }
   }
       withTransaction = false;
     }
   }
@@ -503,19 +503,19 @@ BufferInfo SqliteStorage::getBufferInfo(UserId user, const NetworkId &networkId,
     query->exec();
     if(!query->first()) {
       watchQuery(query);
     query->exec();
     if(!query->first()) {
       watchQuery(query);
-      quWarning() << "unable to create BufferInfo for:" << user << networkId << buffer;
+      qWarning() << "unable to create BufferInfo for:" << user << networkId << buffer;
       return BufferInfo();
     }
   }
 
   BufferInfo bufferInfo = BufferInfo(query->value(0).toInt(), networkId, (BufferInfo::Type)query->value(1).toInt(), 0, buffer);
   if(query->next()) {
       return BufferInfo();
     }
   }
 
   BufferInfo bufferInfo = BufferInfo(query->value(0).toInt(), networkId, (BufferInfo::Type)query->value(1).toInt(), 0, buffer);
   if(query->next()) {
-    quError() << "SqliteStorage::getBufferInfo(): received more then one Buffer!";
-    quError() << "         Query:" << query->lastQuery();
-    quError() << "  bound Values:";
+    qCritical() << "SqliteStorage::getBufferInfo(): received more then one Buffer!";
+    qCritical() << "         Query:" << query->lastQuery();
+    qCritical() << "  bound Values:";
     QList<QVariant> list = query->boundValues().values();
     for (int i = 0; i < list.size(); ++i)
     QList<QVariant> list = query->boundValues().values();
     for (int i = 0; i < list.size(); ++i)
-      quError() << i << ":" << list.at(i).toString().toAscii().data();
+      qCritical() << i << ":" << list.at(i).toString().toAscii().data();
     Q_ASSERT(false);
   }
 
     Q_ASSERT(false);
   }
 
@@ -825,7 +825,7 @@ bool SqliteStorage::init(const QVariantMap &settings) {
   getPasswordsQuery.exec();
 
   if(!watchQuery(&getPasswordsQuery)) {
   getPasswordsQuery.exec();
 
   if(!watchQuery(&getPasswordsQuery)) {
-    quError() << "unable to migrate to new password format!";
+    qCritical() << "unable to migrate to new password format!";
     return false;
   }
 
     return false;
   }
 
@@ -843,6 +843,6 @@ bool SqliteStorage::init(const QVariantMap &settings) {
     watchQuery(&setPasswordsQuery);
   }
 
     watchQuery(&setPasswordsQuery);
   }
 
-  quDebug() << "successfully migrated passwords!";
+  qDebug() << "successfully migrated passwords!";
   return true;
 }
   return true;
 }
index c94859e..c7e1b35 100644 (file)
@@ -46,7 +46,7 @@ SslServer::SslServer(QObject *parent)
 
   _certIsValid = !_cert.isNull() && _cert.isValid() && !_key.isNull();
   if(!_certIsValid) {
 
   _certIsValid = !_cert.isNull() && _cert.isValid() && !_key.isNull();
   if(!_certIsValid) {
-    quWarning() << "SslServer: SSL Certificate is either missing or has a wrong format!\n"
+    qWarning() << "SslServer: SSL Certificate is either missing or has a wrong format!\n"
                << "          Quassel Core will still work, but cannot provide SSL for client connections.\n"
                << "          Please see http://quassel-irc.org/faq/cert to learn how to enable SSL support.";
   }
                << "          Quassel Core will still work, but cannot provide SSL for client connections.\n"
                << "          Please see http://quassel-irc.org/faq/cert to learn how to enable SSL support.";
   }
index 35bda86..4a59126 100644 (file)
@@ -25,6 +25,7 @@ set(SOURCES
     coreconnectdlg.cpp
     coreinfodlg.cpp
     debugconsole.cpp
     coreconnectdlg.cpp
     coreinfodlg.cpp
     debugconsole.cpp
+    debuglogwidget.cpp
     inputwidget.cpp
     jumpkeyhandler.cpp
     mainwin.cpp
     inputwidget.cpp
     jumpkeyhandler.cpp
     mainwin.cpp
@@ -62,6 +63,7 @@ set(MOC_HDRS
     coreconnectdlg.h
     coreinfodlg.h
     debugconsole.h
     coreconnectdlg.h
     coreinfodlg.h
     debugconsole.h
+    debuglogwidget.h
     inputwidget.h
     jumpkeyhandler.h
     mainwin.h
     inputwidget.h
     jumpkeyhandler.h
     mainwin.h
@@ -102,6 +104,7 @@ set(FORMS
     coreconnectdlg.ui
     coreinfodlg.ui
     debugconsole.ui
     coreconnectdlg.ui
     coreinfodlg.ui
     debugconsole.ui
+    debuglogwidget.ui
     inputwidget.ui
     msgprocessorstatuswidget.ui
     nicklistwidget.ui
     inputwidget.ui
     msgprocessorstatuswidget.ui
     nicklistwidget.ui
index 1f701f5..e7390ea 100644 (file)
@@ -34,6 +34,7 @@
 #include "clientbacklogmanager.h"
 #include "coreinfodlg.h"
 #include "coreconnectdlg.h"
 #include "clientbacklogmanager.h"
 #include "coreinfodlg.h"
 #include "coreconnectdlg.h"
+#include "debuglogwidget.h"
 #include "iconloader.h"
 #include "inputwidget.h"
 #include "inputline.h"
 #include "iconloader.h"
 #include "inputwidget.h"
 #include "inputline.h"
@@ -197,6 +198,8 @@ void MainWin::setupActions() {
                                          qApp, SLOT(aboutQt())));
   coll->addAction("DebugNetworkModel", new Action(SmallIcon("tools-report-bug"), tr("Debug &NetworkModel"), coll,
                                        this, SLOT(on_actionDebugNetworkModel_triggered())));
                                          qApp, SLOT(aboutQt())));
   coll->addAction("DebugNetworkModel", new Action(SmallIcon("tools-report-bug"), tr("Debug &NetworkModel"), coll,
                                        this, SLOT(on_actionDebugNetworkModel_triggered())));
+  coll->addAction("DebugLog", new Action(SmallIcon("tools-report-bug"), tr("Debug &Log"), coll,
+                                       this, SLOT(on_actionDebugLog_triggered())));
 }
 
 void MainWin::setupMenus() {
 }
 
 void MainWin::setupMenus() {
@@ -231,6 +234,7 @@ void MainWin::setupMenus() {
   _helpMenu->addSeparator();
   _helpDebugMenu = _helpMenu->addMenu(SmallIcon("tools-report-bug"), tr("Debug"));
   _helpDebugMenu->addAction(coll->action("DebugNetworkModel"));
   _helpMenu->addSeparator();
   _helpDebugMenu = _helpMenu->addMenu(SmallIcon("tools-report-bug"), tr("Debug"));
   _helpDebugMenu->addAction(coll->action("DebugNetworkModel"));
+  _helpDebugMenu->addAction(coll->action("DebugLog"));
 }
 
 void MainWin::setupBufferWidget() {
 }
 
 void MainWin::setupBufferWidget() {
@@ -733,6 +737,11 @@ void MainWin::on_actionDebugNetworkModel_triggered() {
   view->show();
 }
 
   view->show();
 }
 
+void MainWin::on_actionDebugLog_triggered() {
+  DebugLogWidget *logWidget = new DebugLogWidget(0);
+  logWidget->show();
+}
+
 void MainWin::saveStateToSession(const QString &sessionId) {
   return;
   SessionSettings s(sessionId);
 void MainWin::saveStateToSession(const QString &sessionId) {
   return;
   SessionSettings s(sessionId);
index 74953c0..a2d0bc8 100644 (file)
@@ -84,6 +84,7 @@ class MainWin : public QMainWindow {
     void on_actionManageViews_triggered();
     void on_actionLockDockPositions_toggled(bool lock);
     void on_actionDebugNetworkModel_triggered();
     void on_actionManageViews_triggered();
     void on_actionLockDockPositions_toggled(bool lock);
     void on_actionDebugNetworkModel_triggered();
+    void on_actionDebugLog_triggered();
 
     void clientNetworkCreated(NetworkId);
     void clientNetworkRemoved(NetworkId);
 
     void clientNetworkCreated(NetworkId);
     void clientNetworkRemoved(NetworkId);
index 7a6f097..90e2739 100644 (file)
 #include "qtui.h"
 #include "sessionsettings.h"
 
 #include "qtui.h"
 #include "sessionsettings.h"
 
-QtUiApplication::QtUiApplication(int &argc, char **argv) : QApplication(argc, argv), Quassel() {
+
+// void myMessageOutput(QtMsgType type, const char *msg) {
+//   Client::debugLog() << "Debug:" <<  msg << '\n';
+//   return;
+// //   switch (type) {
+// //   case QtDebugMsg:
+// //     break;
+// //   case QtWarningMsg:
+// //     fprintf(stderr, "Warning: %s\n", msg);
+// //     break;
+// //   case QtCriticalMsg:
+// //     fprintf(stderr, "Critical: %s\n", msg);
+// //     break;
+// //   case QtFatalMsg:
+// //     fprintf(stderr, "Fatal: %s\n", msg);
+// //     abort();
+// //   }
+// }
+
+QtUiApplication::QtUiApplication(int &argc, char **argv)
+  : QApplication(argc, argv), Quassel()
+{
   setRunMode(Quassel::ClientOnly);
 
   // put client-only arguments here
   CliParser *parser = Quassel::cliParser();
   parser->addSwitch("debugbufferswitches",0,"Enables debugging for bufferswitches");
   parser->addSwitch("debugmodel",0,"Enables debugging for models");
   setRunMode(Quassel::ClientOnly);
 
   // put client-only arguments here
   CliParser *parser = Quassel::cliParser();
   parser->addSwitch("debugbufferswitches",0,"Enables debugging for bufferswitches");
   parser->addSwitch("debugmodel",0,"Enables debugging for models");
+
+  qInstallMsgHandler(Client::logMessage);
 }
 
 bool QtUiApplication::init() {
 }
 
 bool QtUiApplication::init() {
@@ -79,3 +102,5 @@ void QtUiApplication::resumeSessionIfPossible() {
     s.cleanup();
   }
 }
     s.cleanup();
   }
 }
+
+
index f46f3a7..9fb572a 100644 (file)
@@ -32,20 +32,19 @@ class QtUi;
 class QtUiApplication : public QApplication, public Quassel {
   Q_OBJECT
 
 class QtUiApplication : public QApplication, public Quassel {
   Q_OBJECT
 
-  public:
-    QtUiApplication(int &, char **);
-    ~QtUiApplication();
-    virtual bool init();
-
-    void resumeSessionIfPossible();
-    virtual void saveState(QSessionManager & manager);
-
-  signals:
-    void saveStateToSession(const QString &sessionId);
-    void saveStateToSessionSettings(SessionSettings &s); // FIXME refs in signals won't probably work
-    void resumeFromSession(const QString sessionId);
-    void resumeFromSessionSettings(SessionSettings &s);
-
+ public:
+  QtUiApplication(int &, char **);
+  ~QtUiApplication();
+  virtual bool init();
+
+  void resumeSessionIfPossible();
+  virtual void saveState(QSessionManager & manager);
+
+signals:
+  void saveStateToSession(const QString &sessionId);
+  void saveStateToSessionSettings(SessionSettings &s); // FIXME refs in signals won't probably work
+  void resumeFromSession(const QString sessionId);
+  void resumeFromSessionSettings(SessionSettings &s);
 };
 
 #endif
 };
 
 #endif