From dfafff97d464fad3641a1c28bcacf46f9fc4cca5 Mon Sep 17 00:00:00 2001 From: Kurt Hindenburg Date: Fri, 31 Mar 2017 21:06:18 -0400 Subject: [PATCH] remove QDebug/qWarning and use QCDebug --- src/Application.cpp | 1 - src/ColorSchemeManager.cpp | 13 +++++++------ src/ExtendedCharTable.cpp | 5 ++--- src/Filter.cpp | 5 +++-- src/History.cpp | 6 +++--- src/KeyboardTranslator.cpp | 11 ++++++----- src/KeyboardTranslatorManager.cpp | 13 ++++++------- src/Part.cpp | 1 - src/ProcessInfo.cpp | 1 - src/ProfileManager.cpp | 9 +++++---- src/Pty.cpp | 25 +++++++++++++------------ src/Session.cpp | 1 - src/SessionController.cpp | 9 +++++---- src/SessionManager.cpp | 7 ++++--- src/TerminalDisplay.cpp | 1 - src/Vt102Emulation.cpp | 1 - src/settings/ProfileSettings.cpp | 2 -- 17 files changed, 54 insertions(+), 57 deletions(-) diff --git a/src/Application.cpp b/src/Application.cpp index 2cdbaba63..de6a172b9 100644 --- a/src/Application.cpp +++ b/src/Application.cpp @@ -26,7 +26,6 @@ #include #include #include -#include // KDE #include diff --git a/src/ColorSchemeManager.cpp b/src/ColorSchemeManager.cpp index 53e15c729..096cc556c 100644 --- a/src/ColorSchemeManager.cpp +++ b/src/ColorSchemeManager.cpp @@ -22,6 +22,8 @@ // Own #include "ColorSchemeManager.h" +#include "konsoledebug.h" + // Qt #include #include @@ -30,7 +32,6 @@ // KDE #include -#include using namespace Konsole; @@ -65,7 +66,7 @@ void ColorSchemeManager::loadAllColorSchemes() } if (failed > 0) - qWarning() << "failed to load " << failed << " color schemes."; + qCDebug(KonsoleDebug) << "failed to load " << failed << " color schemes."; _haveLoadedAll = true; } @@ -92,7 +93,7 @@ bool ColorSchemeManager::loadColorScheme(const QString& filePath) scheme->read(config); if (scheme->name().isEmpty()) { - qWarning() << "Color scheme in" << filePath << "does not have a valid name and was not loaded."; + qCDebug(KonsoleDebug) << "Color scheme in" << filePath << "does not have a valid name and was not loaded."; delete scheme; return false; } @@ -162,7 +163,7 @@ bool ColorSchemeManager::deleteColorScheme(const QString& name) _colorSchemes.remove(name); return true; } else { - qWarning() << "Failed to remove color scheme -" << path; + qCDebug(KonsoleDebug)<<"Failed to remove color scheme -"< +#include "konsoledebug.h" // Konsole #include "TerminalDisplay.h" @@ -91,7 +90,7 @@ ushort ExtendedCharTable::createExtendedChar(const ushort* unicodePoints , ushor } } } else { - qWarning() << "Using all the extended char hashes, going to miss this extended character"; + qCDebug(KonsoleDebug) << "Using all the extended char hashes, going to miss this extended character"; return 0; } } diff --git a/src/Filter.cpp b/src/Filter.cpp index b57df8207..7d3ccc2cb 100644 --- a/src/Filter.cpp +++ b/src/Filter.cpp @@ -20,8 +20,9 @@ // Own #include "Filter.h" +#include "konsoledebug.h" + // Qt -#include #include #include #include @@ -499,7 +500,7 @@ RegExpFilter::HotSpot* FileFilter::newHotSpot(int startLine, int startColumn, in int endColumn, const QStringList& capturedTexts) { if (!_session) { - qWarning() << "Trying to create new hot spot without session!"; + qCDebug(KonsoleDebug) << "Trying to create new hot spot without session!"; return nullptr; } diff --git a/src/History.cpp b/src/History.cpp index c1493b187..dae5b19a5 100644 --- a/src/History.cpp +++ b/src/History.cpp @@ -21,6 +21,8 @@ // Own #include "History.h" +#include "konsoledebug.h" + // System #include #include @@ -30,8 +32,6 @@ #include // KDE -#include - #include #include #include @@ -108,7 +108,7 @@ void HistoryFile::map() if (_fileMap == MAP_FAILED) { _readWriteBalance = 0; _fileMap = 0; - qWarning() << "mmap'ing history failed. errno = " << errno; + qCDebug(KonsoleDebug) << "mmap'ing history failed. errno = " << errno; } } diff --git a/src/KeyboardTranslator.cpp b/src/KeyboardTranslator.cpp index 16241facb..2760ecad3 100644 --- a/src/KeyboardTranslator.cpp +++ b/src/KeyboardTranslator.cpp @@ -22,6 +22,8 @@ // Own #include "KeyboardTranslator.h" +#include "konsoledebug.h" + // System #include #include @@ -33,7 +35,6 @@ #include // KDE -#include #include using namespace Konsole; @@ -128,7 +129,7 @@ void KeyboardTranslatorReader::readNext() } else if (tokens[2].type == Token::Command) { // identify command if (!parseAsCommand(tokens[2].text, command)) - qWarning() << "Key" << tokens[1].text << ", Command" << tokens[2].text << "not understood. "; + qCDebug(KonsoleDebug) << "Key" << tokens[1].text << ", Command" << tokens[2].text << "not understood. "; } KeyboardTranslator::Entry newEntry; @@ -218,7 +219,7 @@ bool KeyboardTranslatorReader::decodeSequence(const QString& text, } else if (parseAsKeyCode(buffer, itemKeyCode)) { keyCode = itemKeyCode; } else { - qWarning() << "Unable to parse key binding item:" << buffer; + qCDebug(KonsoleDebug) << "Unable to parse key binding item:" << buffer; } buffer.clear(); @@ -283,7 +284,7 @@ bool KeyboardTranslatorReader::parseAsKeyCode(const QString& item , int& keyCode keyCode = sequence[0]; if (sequence.count() > 1) { - qWarning() << "Unhandled key codes in sequence: " << item; + qCDebug(KonsoleDebug) << "Unhandled key codes in sequence: " << item; } } else { return false; @@ -381,7 +382,7 @@ QList KeyboardTranslatorReader::tokenize(const QRegularExpressionMatch keyMatch(key.match(text)); if (!keyMatch.hasMatch()) { - qWarning() << "Line in keyboard translator file could not be understood:" << text; + qCDebug(KonsoleDebug) << "Line in keyboard translator file could not be understood:" << text; return list; } diff --git a/src/KeyboardTranslatorManager.cpp b/src/KeyboardTranslatorManager.cpp index 5b8f0b505..b353db2bc 100644 --- a/src/KeyboardTranslatorManager.cpp +++ b/src/KeyboardTranslatorManager.cpp @@ -22,13 +22,12 @@ // Own #include "KeyboardTranslatorManager.h" +#include "konsoledebug.h" + // Qt #include #include #include - -// KDE -#include #include using namespace Konsole; @@ -57,7 +56,7 @@ void KeyboardTranslatorManager::addTranslator(KeyboardTranslator* translator) _translators.insert(translator->name(), translator); if (!saveTranslator(translator)) - qWarning() << "Unable to save translator" << translator->name() + qCDebug(KonsoleDebug) << "Unable to save translator" << translator->name() << "to disk."; } @@ -71,7 +70,7 @@ bool KeyboardTranslatorManager::deleteTranslator(const QString& name) _translators.remove(name); return true; } else { - qWarning() << "Failed to remove translator - " << path; + qCDebug(KonsoleDebug) << "Failed to remove translator - " << path; return false; } } @@ -121,7 +120,7 @@ const KeyboardTranslator* KeyboardTranslatorManager::findTranslator(const QStrin if (translator != 0) _translators[name] = translator; else if (!name.isEmpty()) - qWarning() << "Unable to load translator" << name; + qCDebug(KonsoleDebug) << "Unable to load translator" << name; return translator; } @@ -136,7 +135,7 @@ bool KeyboardTranslatorManager::saveTranslator(const KeyboardTranslator* transla QFile destination(path); if (!destination.open(QIODevice::WriteOnly | QIODevice::Text)) { - qWarning() << "Unable to save keyboard translation:" + qCDebug(KonsoleDebug) << "Unable to save keyboard translation:" << destination.errorString(); return false; } diff --git a/src/Part.cpp b/src/Part.cpp index fb0599d89..2b68214e8 100644 --- a/src/Part.cpp +++ b/src/Part.cpp @@ -30,7 +30,6 @@ #include #include #include -#include // Konsole #include "EditProfileDialog.h" diff --git a/src/ProcessInfo.cpp b/src/ProcessInfo.cpp index d716248c0..697a92a49 100644 --- a/src/ProcessInfo.cpp +++ b/src/ProcessInfo.cpp @@ -43,7 +43,6 @@ #include #include #include -#include #if defined(Q_OS_FREEBSD) || defined(Q_OS_OPENBSD) || defined(Q_OS_OSX) #include diff --git a/src/ProfileManager.cpp b/src/ProfileManager.cpp index a35851a99..7ca963262 100644 --- a/src/ProfileManager.cpp +++ b/src/ProfileManager.cpp @@ -22,6 +22,8 @@ // Own #include "ProfileManager.h" +#include "konsoledebug.h" + // Qt #include #include @@ -31,7 +33,6 @@ // KDE #include #include -#include #include #include @@ -161,7 +162,7 @@ Profile::Ptr ProfileManager::loadProfile(const QString& shortPath) PopStackOnExit popGuardOnExit(recursionGuard); if (recursionGuard.contains(path)) { - qWarning() << "Ignoring attempt to load profile recursively from" << path; + qCDebug(KonsoleDebug) << "Ignoring attempt to load profile recursively from" << path; return _fallbackProfile; } else { recursionGuard.push(path); @@ -184,7 +185,7 @@ Profile::Ptr ProfileManager::loadProfile(const QString& shortPath) delete reader; if (!result) { - qWarning() << "Could not load profile from " << path; + qCDebug(KonsoleDebug) << "Could not load profile from " << path; return Profile::Ptr(); } else { addProfile(newProfile); @@ -429,7 +430,7 @@ bool ProfileManager::deleteProfile(Profile::Ptr profile) // try to delete the config file if (profile->isPropertySet(Profile::Path) && QFile::exists(profile->path())) { if (!QFile::remove(profile->path())) { - qWarning() << "Could not delete profile: " << profile->path() + qCDebug(KonsoleDebug) << "Could not delete profile: " << profile->path() << "The file is most likely in a directory which is read-only."; return false; diff --git a/src/Pty.cpp b/src/Pty.cpp index d1abc11df..d094705ed 100644 --- a/src/Pty.cpp +++ b/src/Pty.cpp @@ -21,6 +21,8 @@ // Own #include "Pty.h" +#include "konsoledebug.h" + // System #include #include @@ -30,7 +32,6 @@ #include // KDE -#include #include using Konsole::Pty; @@ -77,7 +78,7 @@ void Pty::sendData(const QByteArray& data) return; if (pty()->write(data.constData()) == -1) { - qWarning() << "Could not send input data to terminal process."; + qCDebug(KonsoleDebug) << "Could not send input data to terminal process."; return; } } @@ -118,7 +119,7 @@ void Pty::setFlowControlEnabled(bool enable) ttmode.c_iflag &= ~(IXOFF | IXON); if (!pty()->tcSetAttr(&ttmode)) - qWarning() << "Unable to set terminal attributes."; + qCDebug(KonsoleDebug) << "Unable to set terminal attributes."; } } @@ -130,7 +131,7 @@ bool Pty::flowControlEnabled() const return ((ttmode.c_iflag & IXOFF) != 0u) && ((ttmode.c_iflag & IXON) != 0u); } else { - qWarning() << "Unable to get flow control status, terminal not connected."; + qCDebug(KonsoleDebug) << "Unable to get flow control status, terminal not connected."; return _xonXoff; } } @@ -149,7 +150,7 @@ void Pty::setUtf8Mode(bool enable) ttmode.c_iflag &= ~IUTF8; if (!pty()->tcSetAttr(&ttmode)) - qWarning() << "Unable to set terminal attributes."; + qCDebug(KonsoleDebug) << "Unable to set terminal attributes."; } #else Q_UNUSED(enable); @@ -166,7 +167,7 @@ void Pty::setEraseChar(char eChar) ttmode.c_cc[VERASE] = eChar; if (!pty()->tcSetAttr(&ttmode)) - qWarning() << "Unable to set terminal attributes."; + qCDebug(KonsoleDebug) << "Unable to set terminal attributes."; } } @@ -177,7 +178,7 @@ char Pty::eraseChar() const pty()->tcGetAttr(&ttyAttributes); return ttyAttributes.c_cc[VERASE]; } else { - qWarning() << "Unable to get erase char attribute, terminal not connected."; + qCDebug(KonsoleDebug) << "Unable to get erase char attribute, terminal not connected."; return _eraseChar; } } @@ -267,15 +268,15 @@ void Pty::setWriteable(bool writeable) if (QT_STAT(pty()->ttyName(), &sbuf) == 0) { if (writeable) { if (::chmod(pty()->ttyName(), sbuf.st_mode | S_IWGRP) < 0) { - qWarning() << "Could not set writeable on "<ttyName(); + qCDebug(KonsoleDebug) << "Could not set writeable on "<ttyName(); } } else { if (::chmod(pty()->ttyName(), sbuf.st_mode & ~(S_IWGRP | S_IWOTH)) < 0) { - qWarning() << "Could not unset writeable on "<ttyName(); + qCDebug(KonsoleDebug) << "Could not unset writeable on "<ttyName(); } } } else { - qWarning() << "Could not stat "<ttyName(); + qCDebug(KonsoleDebug) << "Could not stat "<ttyName(); } } @@ -287,14 +288,14 @@ void Pty::closePty() void Pty::sendEof() { if (pty()->masterFd() < 0) { - qWarning() << "Unable to get eof char attribute, terminal not connected."; + qCDebug(KonsoleDebug) << "Unable to get eof char attribute, terminal not connected."; return; } struct ::termios ttyAttributes; pty()->tcGetAttr(&ttyAttributes); char eofChar = ttyAttributes.c_cc[VEOF]; if (pty()->write(QByteArray(1, eofChar)) == -1) { - qWarning() << "Unable to send EOF"; + qCDebug(KonsoleDebug) << "Unable to send EOF"; } pty()->waitForBytesWritten(); diff --git a/src/Session.cpp b/src/Session.cpp index 72ffef69a..98d0155ee 100644 --- a/src/Session.cpp +++ b/src/Session.cpp @@ -39,7 +39,6 @@ #include // KDE -#include #include #include #include diff --git a/src/SessionController.cpp b/src/SessionController.cpp index fb1119c72..99fa3c285 100644 --- a/src/SessionController.cpp +++ b/src/SessionController.cpp @@ -20,7 +20,9 @@ // Own #include "SessionController.h" + #include "ProfileManager.h" +#include "konsoledebug.h" // Qt #include @@ -34,7 +36,6 @@ #include #include #include -#include // KDE #include @@ -338,7 +339,7 @@ void SessionController::openUrl(const QUrl& url) i18n("Konsole does not know how to open the bookmark: ") + url.toDisplayString()); - qWarning() << "Unable to open bookmark at url" << url << ", I do not know" + qCDebug(KonsoleDebug) << "Unable to open bookmark at url" << url << ", I do not know" << " how to handle the protocol " << url.scheme(); } } @@ -907,7 +908,7 @@ void SessionController::closeSession() if (_session->closeInForceWay()) return; else - qWarning() << "Konsole failed to close a session in any way."; + qCDebug(KonsoleDebug) << "Konsole failed to close a session in any way."; } } } @@ -1577,7 +1578,7 @@ void SessionController::showDisplayContextMenu(const QPoint& position) if (chosen && chosen->objectName() == "close-session") chosen->trigger(); } else { - qWarning() << "Unable to display popup menu for session" + qCDebug(KonsoleDebug) << "Unable to display popup menu for session" << _session->title(Session::NameRole) << ", no GUI factory available to build the popup."; } diff --git a/src/SessionManager.cpp b/src/SessionManager.cpp index 4ae05ba68..d31b5d52f 100644 --- a/src/SessionManager.cpp +++ b/src/SessionManager.cpp @@ -22,6 +22,8 @@ // Own #include "SessionManager.h" +#include "konsoledebug.h" + // Qt #include #include @@ -30,7 +32,6 @@ // KDE #include #include -#include // Konsole #include "Session.h" @@ -53,7 +54,7 @@ SessionManager::SessionManager() SessionManager::~SessionManager() { if (_sessions.count() > 0) { - qWarning() << "Konsole SessionManager destroyed with"<< _sessions.count()<<"session(s) still alive"; + qCDebug(KonsoleDebug) << "Konsole SessionManager destroyed with"<< _sessions.count()<<"session(s) still alive"; // ensure that the Session doesn't later try to call back and do things to the // SessionManager foreach(Session* session, _sessions) { @@ -319,7 +320,7 @@ Session* SessionManager::idToSession(int id) return session; } // this should not happen - qWarning() << "Failed to find session for ID" << id; + qCDebug(KonsoleDebug) << "Failed to find session for ID" << id; return nullptr; } diff --git a/src/TerminalDisplay.cpp b/src/TerminalDisplay.cpp index 603e9870c..f34f18dcd 100644 --- a/src/TerminalDisplay.cpp +++ b/src/TerminalDisplay.cpp @@ -50,7 +50,6 @@ #include #include #include -#include #include #include #include diff --git a/src/Vt102Emulation.cpp b/src/Vt102Emulation.cpp index 413c760f2..7419785f0 100644 --- a/src/Vt102Emulation.cpp +++ b/src/Vt102Emulation.cpp @@ -34,7 +34,6 @@ // KDE #include -#include // Konsole #include "KeyboardTranslator.h" diff --git a/src/settings/ProfileSettings.cpp b/src/settings/ProfileSettings.cpp index 93144eaa1..138fdaae0 100644 --- a/src/settings/ProfileSettings.cpp +++ b/src/settings/ProfileSettings.cpp @@ -27,7 +27,6 @@ // KDE #include -#include #include #include #include @@ -482,7 +481,6 @@ ShortcutItemDelegate::ShortcutItemDelegate(QObject* aParent) void ShortcutItemDelegate::editorModified(const QKeySequence& keys) { Q_UNUSED(keys); - ////qDebug() << keys.toString(); KKeySequenceWidget* editor = qobject_cast(sender()); Q_ASSERT(editor);