From 46cfc108d3929aeb9cf423e2c195b6e5f01468e0 Mon Sep 17 00:00:00 2001 From: Robert Knight Date: Sat, 29 Dec 2007 16:07:31 +0000 Subject: [PATCH] * Replace all usage of qDebug() with kDebug(), since kDebug() provides information about which part of the code the message came from and allows filtering of output using kdebugdialog * Remove explicit creation of singleton classes SessionManager,ColorSchemeManager and KeyboardTranslatorManager and automate it with K_GLOBAL_STATIC. This ensures that the singleton destructors are called appropriately by KPart clients when they unload the libkonsolepart library. svn path=/trunk/KDE/kdebase/apps/konsole/; revision=754334 --- src/Application.cpp | 16 --------------- src/BookmarkHandler.cpp | 2 +- src/ColorScheme.cpp | 37 +++++++++++++++------------------- src/ColorScheme.h | 3 --- src/ColorSchemeEditor.cpp | 6 +++--- src/EditProfileDialog.cpp | 5 +++-- src/Emulation.cpp | 2 +- src/Filter.cpp | 14 ++++++------- src/History.cpp | 8 ++++---- src/KeyBindingEditor.cpp | 6 +++--- src/KeyboardTranslator.cpp | 20 ++++++++---------- src/KeyboardTranslator.h | 7 ------- src/ManageProfilesDialog.cpp | 2 +- src/Part.cpp | 8 -------- src/ProcessInfo.cpp | 18 ++++++++--------- src/ProcessInfo.h | 6 +++--- src/Profile.cpp | 6 +++--- src/ProfileList.cpp | 2 +- src/ProfileListWidget.cpp | 4 ++-- src/Pty.cpp | 4 ++-- src/RemoteConnectionDialog.cpp | 4 ++-- src/Screen.cpp | 10 ++++----- src/ScreenWindow.cpp | 6 +++--- src/Session.cpp | 8 ++++---- src/SessionController.cpp | 10 ++++----- src/SessionManager.cpp | 27 +++++++++++-------------- src/SessionManager.h | 2 -- src/ShellCommand.cpp | 2 +- src/ViewContainer.cpp | 12 +++++------ src/ViewManager.cpp | 6 +++--- src/ViewSplitter.cpp | 26 ++++++++++++------------ 31 files changed, 121 insertions(+), 168 deletions(-) diff --git a/src/Application.cpp b/src/Application.cpp index 75a1bf10f..7a4ec91b7 100644 --- a/src/Application.cpp +++ b/src/Application.cpp @@ -64,15 +64,6 @@ void Application::init() _sessionList = 0; _backgroundInstance = 0; - // create session manager - SessionManager::setInstance( new SessionManager() ); - - // create color scheme manager - ColorSchemeManager::setInstance( new ColorSchemeManager() ); - - // new keyboard translator manager - KeyboardTranslatorManager::setInstance( new KeyboardTranslatorManager() ); - // check for compositing functionality TerminalDisplay::setTransparencyEnabled( KWindowSystem::compositingActive() ); } @@ -267,13 +258,6 @@ void Application::toggleBackgroundInstance() Application::~Application() { - delete SessionManager::instance(); - delete ColorSchemeManager::instance(); - delete KeyboardTranslatorManager::instance(); - - SessionManager::setInstance(0); - ColorSchemeManager::setInstance(0); - KeyboardTranslatorManager::setInstance(0); } void Application::detachView(Session* session) diff --git a/src/BookmarkHandler.cpp b/src/BookmarkHandler.cpp index 4608ee5a2..91bb02714 100644 --- a/src/BookmarkHandler.cpp +++ b/src/BookmarkHandler.cpp @@ -157,7 +157,7 @@ QList > BookmarkHandler::currentBookmarkList() const void BookmarkHandler::setViews(const QList& views) { - //qDebug() << "BookmarkHandler - View list changed."; + //kDebug() << "BookmarkHandler - View list changed."; m_views = views; } QList BookmarkHandler::views() const diff --git a/src/ColorScheme.cpp b/src/ColorScheme.cpp index f27d72f61..bd4aa3152 100644 --- a/src/ColorScheme.cpp +++ b/src/ColorScheme.cpp @@ -112,8 +112,6 @@ const char* ColorScheme::translatedColorNames[TABLE_COLORS] = I18N_NOOP("Color 8 (Intense)") }; -ColorSchemeManager* ColorSchemeManager::_instance = 0; - ColorScheme::ColorScheme() { _table = 0; @@ -178,9 +176,9 @@ ColorEntry ColorScheme::colorEntry(int index , uint randomSeed) const ColorEntry entry = colorTable()[index]; - // qDebug() << "Old color: " << entry.color; + // kDebug() << "Old color: " << entry.color; - // qDebug() << "Random seed: " << randomSeed << "random table: " << + // kDebug() << "Random seed: " << randomSeed << "random table: " << // _randomTable << "isnull: " << ((_randomTable) ? _randomTable[index].isNull() : true); if ( randomSeed != 0 && @@ -195,18 +193,18 @@ ColorEntry ColorScheme::colorEntry(int index , uint randomSeed) const int valueDifference = range.value ? (qrand() % range.value) - range.value/2 : 0; QColor& color = entry.color; - // qDebug() << "Standard hue" << color.hue() << "saturation" << color.saturation() << "value" << color.value(); + // kDebug() << "Standard hue" << color.hue() << "saturation" << color.saturation() << "value" << color.value(); int newHue = qAbs( (color.hue() + hueDifference) % MAX_HUE ); int newValue = qMin( qAbs(color.value() + valueDifference) , 255 ); int newSaturation = qMin( qAbs(color.saturation() + saturationDifference) , 255 ); - // qDebug() << "New hue: " << newHue << "New sat:" << newSaturation << + // kDebug() << "New hue: " << newHue << "New sat:" << newSaturation << // "New value:" << newValue; color.setHsv(newHue,newSaturation,newValue); } - // qDebug() << "New color: " << entry.color; + // kDebug() << "New color: " << entry.color; return entry; } @@ -532,9 +530,9 @@ void ColorSchemeManager::loadAllColorSchemes() } // if ( success > 0 ) - // qDebug() << "succeeded to load " << success << " color schemes."; + // kDebug() << "succeeded to load " << success << " color schemes."; if ( failed > 0 ) - qDebug() << "failed to load " << failed << " color schemes."; + kDebug() << "failed to load " << failed << " color schemes."; _haveLoadedAll = true; } @@ -549,7 +547,7 @@ QList ColorSchemeManager::allColorSchemes() } bool ColorSchemeManager::loadKDE3ColorScheme(const QString& filePath) { - //qDebug() << "loading KDE 3 format color scheme from " << filePath; + //kDebug() << "loading KDE 3 format color scheme from " << filePath; QFile file(filePath); if (!filePath.endsWith(".schema") || !file.open(QIODevice::ReadOnly)) @@ -562,19 +560,19 @@ bool ColorSchemeManager::loadKDE3ColorScheme(const QString& filePath) Q_ASSERT( !scheme->name().isEmpty() ); - //qDebug() << "found KDE 3 format color scheme - " << scheme->name(); + //kDebug() << "found KDE 3 format color scheme - " << scheme->name(); QFileInfo info(filePath); if ( !_colorSchemes.contains(info.baseName()) ) { - //qDebug() << "added color scheme - " << info.baseName(); + //kDebug() << "added color scheme - " << info.baseName(); _colorSchemes.insert(scheme->name(),scheme); } else { - qDebug() << "color scheme with name" << scheme->name() << "has already been" << + kDebug() << "color scheme with name" << scheme->name() << "has already been" << "found, ignoring."; delete scheme; } @@ -616,7 +614,7 @@ bool ColorSchemeManager::loadColorScheme(const QString& filePath) } else { - qDebug() << "color scheme with name" << scheme->name() << "has already been" << + kDebug() << "color scheme with name" << scheme->name() << "has already been" << "found, ignoring."; delete scheme; @@ -672,7 +670,7 @@ QString ColorSchemeManager::findColorSchemePath(const QString& name) const } const ColorScheme* ColorSchemeManager::findColorScheme(const QString& name) { - //qDebug() << "looking for color scheme - " << name; + //kDebug() << "looking for color scheme - " << name; if ( name.isEmpty() ) return defaultColorScheme(); @@ -693,16 +691,13 @@ const ColorScheme* ColorSchemeManager::findColorScheme(const QString& name) return findColorScheme(name); } - qDebug() << "Could not find color scheme - " << name; + kDebug() << "Could not find color scheme - " << name; return 0; } } +K_GLOBAL_STATIC( ColorSchemeManager , theColorSchemeManager ) ColorSchemeManager* ColorSchemeManager::instance() { - return _instance; -} -void ColorSchemeManager::setInstance(ColorSchemeManager* instance) -{ - _instance = instance; + return theColorSchemeManager; } diff --git a/src/ColorScheme.h b/src/ColorScheme.h index 63d3d9c19..572074d49 100644 --- a/src/ColorScheme.h +++ b/src/ColorScheme.h @@ -301,8 +301,6 @@ public: */ QList allColorSchemes(); - /** Sets the global color scheme manager instance. */ - static void setInstance(ColorSchemeManager* instance); /** Returns the global color scheme manager instance. */ static ColorSchemeManager* instance(); @@ -327,7 +325,6 @@ private: bool _haveLoadedAll; static const ColorScheme _defaultColorScheme; - static ColorSchemeManager* _instance; }; } diff --git a/src/ColorSchemeEditor.cpp b/src/ColorSchemeEditor.cpp index b0a9af7b5..ff91bf728 100644 --- a/src/ColorSchemeEditor.cpp +++ b/src/ColorSchemeEditor.cpp @@ -92,7 +92,7 @@ ColorSchemeEditor::ColorSchemeEditor(QWidget* parent) connect( _ui->colorTable , SIGNAL(itemClicked(QTableWidgetItem*)) , this , SLOT(editColorItem(QTableWidgetItem*)) ); - qDebug() << "Color scheme editor - have compositing = " << KWindowSystem::compositingActive(); + kDebug() << "Color scheme editor - have compositing = " << KWindowSystem::compositingActive(); // warning label when transparency is not available if ( KWindowSystem::compositingActive() ) @@ -147,7 +147,7 @@ void ColorSchemeEditor::setTransparencyPercentLabel(int percent) qreal opacity = ( 100.0 - percent ) / 100.0; _colors->setOpacity(opacity); - //qDebug() << "set opacity to:" << opacity; + //kDebug() << "set opacity to:" << opacity; } void ColorSchemeEditor::setup(const ColorScheme* scheme) { @@ -163,7 +163,7 @@ void ColorSchemeEditor::setup(const ColorScheme* scheme) setupColorTable(_colors); // setup transparency slider - //qDebug() << "read opacity: " << _colors->opacity(); + //kDebug() << "read opacity: " << _colors->opacity(); const int transparencyPercent = (int) ( (1-_colors->opacity())*100 ); _ui->transparencySlider->setValue(transparencyPercent); diff --git a/src/EditProfileDialog.cpp b/src/EditProfileDialog.cpp index a3bd9efb7..b19abfd99 100644 --- a/src/EditProfileDialog.cpp +++ b/src/EditProfileDialog.cpp @@ -25,7 +25,7 @@ #include #include #include -#include +#include #include #include #include @@ -36,6 +36,7 @@ // KDE #include +#include #include #include #include @@ -673,7 +674,7 @@ void EditProfileDialog::colorSchemeSelected() QAbstractItemModel* model = _ui->colorSchemeList->model(); const ColorScheme* colors = model->data(selected.first(),Qt::UserRole+1).value(); - qDebug() << "Setting temp profile color to" << colors->name(); + kDebug() << "Setting temp profile color to" << colors->name(); previewColorScheme(selected.first()); _tempProfile->setProperty(Profile::ColorScheme,colors->name()); diff --git a/src/Emulation.cpp b/src/Emulation.cpp index d9e267116..07ffacf4f 100644 --- a/src/Emulation.cpp +++ b/src/Emulation.cpp @@ -426,7 +426,7 @@ char Emulation::getErase() const void Emulation::setImageSize(int lines, int columns) { - //qDebug() << "Resizing image to: " << lines << "by" << columns << QTime::currentTime().msec(); + //kDebug() << "Resizing image to: " << lines << "by" << columns << QTime::currentTime().msec(); Q_ASSERT( lines > 0 ); Q_ASSERT( columns > 0 ); diff --git a/src/Filter.cpp b/src/Filter.cpp index 2d94340f3..28b056aab 100644 --- a/src/Filter.cpp +++ b/src/Filter.cpp @@ -28,7 +28,7 @@ #include #include #include -#include +#include #include #include @@ -209,7 +209,7 @@ void Filter::getLineColumn(int position , int& startLine , int& startColumn) for (int i = 0 ; i < _linePositions->count() ; i++) { - //qDebug() << "line position at " << i << " = " << _linePositions[i]; + //kDebug() << "line position at " << i << " = " << _linePositions[i]; int nextLine = 0; if ( i == _linePositions->count()-1 ) @@ -221,7 +221,7 @@ void Filter::getLineColumn(int position , int& startLine , int& startColumn) nextLine = _linePositions->value(i+1); } - // qDebug() << "pos - " << position << " line pos(" << i<< ") " << _linePositions->value(i) << + // kDebug() << "pos - " << position << " line pos(" << i<< ") " << _linePositions->value(i) << // " next = " << nextLine << " buffer len = " << _buffer->length(); if ( _linePositions->value(i) <= position && position < nextLine ) @@ -386,13 +386,13 @@ void RegExpFilter::process() int endColumn = 0; - //qDebug() << "pos from " << pos << " to " << pos + _searchText.matchedLength(); + //kDebug() << "pos from " << pos << " to " << pos + _searchText.matchedLength(); getLineColumn(pos,startLine,startColumn); getLineColumn(pos + _searchText.matchedLength(),endLine,endColumn); - //qDebug() << "start " << startLine << " / " << startColumn; - //qDebug() << "end " << endLine << " / " << endColumn; + //kDebug() << "start " << startLine << " / " << startColumn; + //kDebug() << "end " << endLine << " / " << endColumn; RegExpFilter::HotSpot* spot = newHotSpot(startLine,startColumn, endLine,endColumn); @@ -460,7 +460,7 @@ void UrlFilter::HotSpot::activate(QObject* object) if ( actionName == "copy-action" ) { - //qDebug() << "Copying url to clipboard:" << url; + //kDebug() << "Copying url to clipboard:" << url; QApplication::clipboard()->setText(url); return; diff --git a/src/History.cpp b/src/History.cpp index 2dd356b78..ef802d4ba 100644 --- a/src/History.cpp +++ b/src/History.cpp @@ -345,7 +345,7 @@ bool HistoryScrollBuffer::isWrappedLine(int lineNumber) if (lineNumber < _usedLines) { - //qDebug() << "Line" << lineNumber << "wrapped is" << _wrappedLine[bufferIndex(lineNumber)]; + //kDebug() << "Line" << lineNumber << "wrapped is" << _wrappedLine[bufferIndex(lineNumber)]; return _wrappedLine[bufferIndex(lineNumber)]; } else @@ -366,9 +366,9 @@ void HistoryScrollBuffer::getCells(int lineNumber, int startColumn, int count, C const HistoryLine& line = _historyBuffer[bufferIndex(lineNumber)]; - //qDebug() << "startCol " << startColumn; - //qDebug() << "line.size() " << line.size(); - //qDebug() << "count " << count; + //kDebug() << "startCol " << startColumn; + //kDebug() << "line.size() " << line.size(); + //kDebug() << "count " << count; Q_ASSERT( startColumn <= line.size() - count ); diff --git a/src/KeyBindingEditor.cpp b/src/KeyBindingEditor.cpp index b3e95339e..a088903b3 100644 --- a/src/KeyBindingEditor.cpp +++ b/src/KeyBindingEditor.cpp @@ -137,7 +137,7 @@ bool KeyBindingEditor::eventFilter( QObject* watched , QEvent* event ) _ui->testAreaInputEdit->setText(keyEvent->text()); _ui->testAreaOutputEdit->setText(keyEvent->text()); } - //qDebug() << "Entry: " << entry.resultToString(); + //kDebug() << "Entry: " << entry.resultToString(); keyEvent->accept(); return true; @@ -187,7 +187,7 @@ void KeyBindingEditor::bindingTableItemChanged(QTableWidgetItem* item) KeyboardTranslator::Entry entry = KeyboardTranslatorReader::createEntry(condition,result); - qDebug() << "Created entry: " << entry.conditionToString() << " , " << entry.resultToString(); + kDebug() << "Created entry: " << entry.conditionToString() << " , " << entry.resultToString(); _translator->replaceEntry(existing,entry); @@ -206,7 +206,7 @@ void KeyBindingEditor::setupKeyBindingTable(const KeyboardTranslator* translator QList entries = translator->entries(); _ui->keyBindingTable->setRowCount(entries.count()); - //qDebug() << "Keyboard translator has" << entries.count() << "entries."; + //kDebug() << "Keyboard translator has" << entries.count() << "entries."; for ( int row = 0 ; row < entries.count() ; row++ ) { diff --git a/src/KeyboardTranslator.cpp b/src/KeyboardTranslator.cpp index fab907359..0e56a3077 100644 --- a/src/KeyboardTranslator.cpp +++ b/src/KeyboardTranslator.cpp @@ -28,13 +28,14 @@ // Qt #include -#include +#include #include #include #include #include // KDE +#include #include #include @@ -45,8 +46,6 @@ const char* KeyboardTranslatorManager::defaultTranslatorText = #include ; -KeyboardTranslatorManager* KeyboardTranslatorManager::_instance = 0; - KeyboardTranslatorManager::KeyboardTranslatorManager() : _haveLoadedAll(false) { @@ -105,7 +104,7 @@ bool KeyboardTranslatorManager::saveTranslator(const KeyboardTranslator* transla const QString path = KGlobal::dirs()->saveLocation("data","konsole/")+translator->name() +".keytab"; - qDebug() << "Saving translator to" << path; + kDebug() << "Saving translator to" << path; QFile destination(path); @@ -144,7 +143,7 @@ KeyboardTranslator* KeyboardTranslatorManager::loadTranslator(const QString& nam const KeyboardTranslator* KeyboardTranslatorManager::defaultTranslator() { - qDebug() << "Loading default translator from text" << defaultTranslatorText; + kDebug() << "Loading default translator from text" << defaultTranslatorText; QBuffer textBuffer; textBuffer.setData(defaultTranslatorText,strlen(defaultTranslatorText)); return loadTranslator(&textBuffer,"fallback"); @@ -363,7 +362,7 @@ bool KeyboardTranslatorReader::decodeSequence(const QString& text, else if ( parseAsKeyCode(buffer,itemKeyCode) ) keyCode = itemKeyCode; else - qDebug() << "Unable to parse key binding item:" << buffer; + kDebug() << "Unable to parse key binding item:" << buffer; buffer.clear(); } @@ -427,7 +426,7 @@ bool KeyboardTranslatorReader::parseAsKeyCode(const QString& item , int& keyCode if ( sequence.count() > 1 ) { - qDebug() << "Unhandled key codes in sequence: " << item; + kDebug() << "Unhandled key codes in sequence: " << item; } } // additional cases implemented for backwards compatibility with KDE 3 @@ -873,11 +872,8 @@ bool KeyboardTranslatorManager::deleteTranslator(const QString& name) return false; } } -void KeyboardTranslatorManager::setInstance(KeyboardTranslatorManager* instance) -{ - _instance = instance; -} +K_GLOBAL_STATIC( KeyboardTranslatorManager , theKeyboardTranslatorManager ) KeyboardTranslatorManager* KeyboardTranslatorManager::instance() { - return _instance; + return theKeyboardTranslatorManager; } diff --git a/src/KeyboardTranslator.h b/src/KeyboardTranslator.h index 95464f417..5ad3b23dc 100644 --- a/src/KeyboardTranslator.h +++ b/src/KeyboardTranslator.h @@ -484,9 +484,6 @@ public: */ QList allTranslators(); - - /** Sets the global KeyboardTranslatorManager instance. */ - static void setInstance(KeyboardTranslatorManager* instance); /** Returns the global KeyboardTranslatorManager instance. */ static KeyboardTranslatorManager* instance(); @@ -503,11 +500,7 @@ private: QHash _translators; // maps translator-name -> KeyboardTranslator // instance - - bool _haveLoadedAll; - - static KeyboardTranslatorManager* _instance; }; inline int KeyboardTranslator::Entry::keyCode() const { return _keyCode; } diff --git a/src/ManageProfilesDialog.cpp b/src/ManageProfilesDialog.cpp index 0e1fa6269..a04763eeb 100644 --- a/src/ManageProfilesDialog.cpp +++ b/src/ManageProfilesDialog.cpp @@ -109,7 +109,7 @@ void ManageProfilesDialog::itemDataChanged(QStandardItem* item) { QKeySequence sequence = QKeySequence::fromString(item->text()); - qDebug() << "New key sequence: " << item->text(); + kDebug() << "New key sequence: " << item->text(); SessionManager::instance()->setShortcut(item->data(ShortcutRole).value(), sequence); diff --git a/src/Part.cpp b/src/Part.cpp index 1d01f53d9..592022b90 100644 --- a/src/Part.cpp +++ b/src/Part.cpp @@ -70,14 +70,6 @@ Part::Part(QWidget* parentWidget , QObject* parent) ,_pluggedController(0) ,_manageProfilesAction(0) { - // setup global managers - if ( SessionManager::instance() == 0 ) - SessionManager::setInstance( new SessionManager() ); - if ( ColorSchemeManager::instance() == 0 ) - ColorSchemeManager::setInstance( new ColorSchemeManager() ); - if ( KeyboardTranslatorManager::instance() == 0 ) - KeyboardTranslatorManager::setInstance( new KeyboardTranslatorManager() ); - // setup global actions createGlobalActions(); diff --git a/src/ProcessInfo.cpp b/src/ProcessInfo.cpp index 3adb13431..33e6ddfb0 100644 --- a/src/ProcessInfo.cpp +++ b/src/ProcessInfo.cpp @@ -26,7 +26,7 @@ #include // Qt -#include +#include #include #include #include @@ -484,9 +484,9 @@ SSHProcessInfo::SSHProcessInfo(const ProcessInfo& process) if ( !ok || name != "ssh" ) { if ( !ok ) - qDebug() << "Could not read process info"; + kDebug() << "Could not read process info"; else - qDebug() << "Process is not a SSH process"; + kDebug() << "Process is not a SSH process"; return; } @@ -538,7 +538,7 @@ SSHProcessInfo::SSHProcessInfo(const ProcessInfo& process) if ( _host.isEmpty() ) { // found username and host argument - qDebug() << "[username] and host: " << args[i]; + kDebug() << "[username] and host: " << args[i]; // check to see if only a hostname is specified, or whether // both a username and host are specified ( in which case they @@ -551,14 +551,14 @@ SSHProcessInfo::SSHProcessInfo(const ProcessInfo& process) _user = args[i].left(separatorPosition); _host = args[i].mid(separatorPosition+1); - qDebug() << "found user: " << _user; - qDebug() << "found host: " << _host; + kDebug() << "found user: " << _user; + kDebug() << "found host: " << _host; } else { // just the host specified _host = args[i]; - qDebug() << "found only host: " << _host; + kDebug() << "found only host: " << _host; } } else @@ -566,14 +566,14 @@ SSHProcessInfo::SSHProcessInfo(const ProcessInfo& process) // host has already been found, this must be the command argument _command = args[i]; - qDebug() << "found command: " << _command; + kDebug() << "found command: " << _command; } } } else { - qDebug() << "Could not read arguments"; + kDebug() << "Could not read arguments"; return; } diff --git a/src/ProcessInfo.h b/src/ProcessInfo.h index 86cc24d6e..eedaf0da4 100644 --- a/src/ProcessInfo.h +++ b/src/ProcessInfo.h @@ -64,15 +64,15 @@ namespace Konsole * bool ok; * QString value = info->name(&ok); * - * if ( ok ) qDebug() << "process name - " << name; + * if ( ok ) kDebug() << "process name - " << name; * * int parentPid = info->parentPid(&ok); * - * if ( ok ) qDebug() << "parent process - " << parentPid; + * if ( ok ) kDebug() << "parent process - " << parentPid; * * int foregroundPid = info->foregroundColororegroundPid(&ok); * - * if ( ok ) qDebug() << "foreground process - " << foregroundPid; + * if ( ok ) kDebug() << "foreground process - " << foregroundPid; * } * @endcode */ diff --git a/src/Profile.cpp b/src/Profile.cpp index 6dfeed17d..114e14e7b 100644 --- a/src/Profile.cpp +++ b/src/Profile.cpp @@ -345,7 +345,7 @@ QStringList KDE4ProfileReader::findProfiles() } bool KDE4ProfileReader::readProfile(const QString& path , Profile* profile , QString& parentProfile) { - //qDebug() << "KDE 4 Profile Reader:" << path; + //kDebug() << "KDE 4 Profile Reader:" << path; KConfig config(path,KConfig::NoGlobals); @@ -450,7 +450,7 @@ bool KDE3ProfileReader::readProfile(const QString& path , Profile* profile , QSt if ( config->hasKey("Name") ) profile->setProperty(Profile::Name,config->readEntry("Name")); - qDebug() << "reading KDE 3 profile " << profile->name(); + kDebug() << "reading KDE 3 profile " << profile->name(); if ( config->hasKey("Icon") ) profile->setProperty(Profile::Icon,config->readEntry("Icon")); @@ -513,7 +513,7 @@ QHash ProfileCommandParser::parse(const QString& inp regExp.capturedTexts()[1]); const QString value = regExp.capturedTexts()[2]; - qDebug() << "property:" << property << "value:" << value; + kDebug() << "property:" << property << "value:" << value; changes.insert(property,value); } diff --git a/src/ProfileList.cpp b/src/ProfileList.cpp index e0cd1447e..c9714534a 100644 --- a/src/ProfileList.cpp +++ b/src/ProfileList.cpp @@ -23,7 +23,7 @@ // Qt #include #include -#include +#include // KDE #include diff --git a/src/ProfileListWidget.cpp b/src/ProfileListWidget.cpp index 03ea7c788..b522ee6a2 100644 --- a/src/ProfileListWidget.cpp +++ b/src/ProfileListWidget.cpp @@ -21,7 +21,7 @@ #include "ProfileListWidget.h" // Qt -#include +#include #include #include #include @@ -45,7 +45,7 @@ ProfileListWidget::ProfileListWidget(QWidget* parent) void ProfileListWidget::startDrag(Qt::DropActions /*supportedActions*/) { - qDebug() << "drag and drop started in session list widget"; + kDebug() << "drag and drop started in session list widget"; QMimeData* mimeData = new QMimeData(); diff --git a/src/Pty.cpp b/src/Pty.cpp index 86fc8fb9d..5f5e8443f 100644 --- a/src/Pty.cpp +++ b/src/Pty.cpp @@ -111,7 +111,7 @@ char Pty::erase() const { if (pty()->masterFd() >= 0) { - qDebug() << "Getting erase char"; + kDebug() << "Getting erase char"; struct ::termios ttyAttributes; pty()->tcGetAttr(&ttyAttributes); return ttyAttributes.c_cc[VERASE]; @@ -135,7 +135,7 @@ void Pty::addEnvironmentVariables(const QStringList& environment) QString variable = pair.left(pos); QString value = pair.mid(pos+1); - //qDebug() << "Setting environment pair" << variable << + //kDebug() << "Setting environment pair" << variable << // " set to " << value; setEnvironment(variable,value); diff --git a/src/RemoteConnectionDialog.cpp b/src/RemoteConnectionDialog.cpp index 775a228a7..a5ddfa8c9 100644 --- a/src/RemoteConnectionDialog.cpp +++ b/src/RemoteConnectionDialog.cpp @@ -21,7 +21,7 @@ #include "RemoteConnectionDialog.h" // Qt -#include +#include // KDE #include @@ -76,7 +76,7 @@ QString RemoteConnectionDialog::sessionKey() const */ //QString key = manager->addSessionType( customSession ); - //qDebug() << "session key = " << key; + //kDebug() << "session key = " << key; return QString(); //return key; diff --git a/src/Screen.cpp b/src/Screen.cpp index 4c7db5635..11638e81c 100644 --- a/src/Screen.cpp +++ b/src/Screen.cpp @@ -845,7 +845,7 @@ void Screen::resetDroppedLines() } void Screen::resetScrolledLines() { - //qDebug() << "scrolled lines reset"; + //kDebug() << "scrolled lines reset"; _scrolledLines = 0; } @@ -895,7 +895,7 @@ void Screen::scrollDown(int n) void Screen::scrollDown(int from, int n) { - //qDebug() << "Screen::scrollDown( from: " << from << " , n: " << n << ")"; + //kDebug() << "Screen::scrollDown( from: " << from << " , n: " << n << ")"; _scrolledLines += n; @@ -1024,7 +1024,7 @@ NOTE: moveImage() can only move whole lines. void Screen::moveImage(int dest, int sourceBegin, int sourceEnd) { - //qDebug() << "moving image from (" << (sourceBegin/columns) + //kDebug() << "moving image from (" << (sourceBegin/columns) // << "," << (sourceEnd/columns) << ") to " << // (dest/columns); @@ -1311,8 +1311,8 @@ void Screen::writeSelectionToStream(TerminalCharacterDecoder* decoder , Q_ASSERT( top >= 0 && left >= 0 && bottom >= 0 && right >= 0 ); - //qDebug() << "sel_TL = " << sel_TL; - //qDebug() << "columns = " << columns; + //kDebug() << "sel_TL = " << sel_TL; + //kDebug() << "columns = " << columns; for (int y=top;y<=bottom;y++) { diff --git a/src/ScreenWindow.cpp b/src/ScreenWindow.cpp index 4da342384..e39cd9478 100644 --- a/src/ScreenWindow.cpp +++ b/src/ScreenWindow.cpp @@ -21,7 +21,7 @@ #include "ScreenWindow.h" // Qt -#include +#include // Konsole #include "Screen.h" @@ -219,7 +219,7 @@ bool ScreenWindow::atEndOfOutput() const void ScreenWindow::scrollTo( int line ) { - //qDebug() << "ScreenWindow scrolled to " << line << ":" << this; + //kDebug() << "ScreenWindow scrolled to " << line << ":" << this; if ( line < 0 ) line = 0; @@ -251,7 +251,7 @@ bool ScreenWindow::trackOutput() const int ScreenWindow::scrollCount() const { - // qDebug() << "window returning scroll count of " << _scrollCount; + // kDebug() << "window returning scroll count of " << _scrollCount; return _scrollCount; } diff --git a/src/Session.cpp b/src/Session.cpp index c925fb441..181c73f0c 100644 --- a/src/Session.cpp +++ b/src/Session.cpp @@ -988,11 +988,11 @@ void SessionGroup::setMasterStatus(Session* session , bool master) } void SessionGroup::connectPair(Session* master , Session* other) { - qDebug() << k_funcinfo; + kDebug() << k_funcinfo; if ( _masterMode & CopyInputToAll ) { - qDebug() << "Connection session " << master->nameTitle() << "to" << other->nameTitle(); + kDebug() << "Connection session " << master->nameTitle() << "to" << other->nameTitle(); connect( master->emulation() , SIGNAL(sendData(const char*,int)) , other->emulation() , SLOT(sendString(const char*,int)) ); @@ -1000,11 +1000,11 @@ void SessionGroup::connectPair(Session* master , Session* other) } void SessionGroup::disconnectPair(Session* master , Session* other) { - qDebug() << k_funcinfo; + kDebug() << k_funcinfo; if ( _masterMode & CopyInputToAll ) { - qDebug() << "Disconnecting session " << master->nameTitle() << "from" << other->nameTitle(); + kDebug() << "Disconnecting session " << master->nameTitle() << "from" << other->nameTitle(); disconnect( master->emulation() , SIGNAL(sendData(const char*,int)) , other->emulation() , SLOT(sendString(const char*,int)) ); diff --git a/src/SessionController.cpp b/src/SessionController.cpp index b3c6c3787..8492eff96 100644 --- a/src/SessionController.cpp +++ b/src/SessionController.cpp @@ -354,7 +354,7 @@ bool SessionController::eventFilter(QObject* watched , QEvent* event) _view->filterChain()->addFilter( _viewUrlFilter ); } - //qDebug() << "Updating url filter."; + //kDebug() << "Updating url filter."; _view->processFilters(); _urlFilterUpdateRequired = false; @@ -1266,13 +1266,13 @@ void SearchHistoryTask::executeOnScreenWindow( SessionPtr session , ScreenWindow } } - //qDebug() << "Searching lines " << qMin(endLine,line) << " to " << qMax(endLine,line); + //kDebug() << "Searching lines " << qMin(endLine,line) << " to " << qMax(endLine,line); decoder.begin(&searchStream); emulation->writeToStream(&decoder, qMin(endLine,line) , qMax(endLine,line) ); decoder.end(); - //qDebug() << "Stream contents: " << string; + //kDebug() << "Stream contents: " << string; pos = -1; if (forwards) pos = string.indexOf(_regExp); @@ -1315,10 +1315,10 @@ void SearchHistoryTask::highlightResult(ScreenWindowPtr window , int findPos) window->scrollTo(findPos); window->setSelectionStart( 0 , findPos - window->currentLine() , false ); window->setSelectionEnd( window->columnCount() , findPos - window->currentLine() ); - //qDebug() << "Current line " << window->currentLine(); + //kDebug() << "Current line " << window->currentLine(); window->setTrackOutput(false); window->notifyOutputChanged(); - //qDebug() << "Post update current line " << window->currentLine(); + //kDebug() << "Post update current line " << window->currentLine(); } SearchHistoryTask::SearchHistoryTask(QObject* parent) diff --git a/src/SessionManager.cpp b/src/SessionManager.cpp index 385c2076f..34e6710f1 100644 --- a/src/SessionManager.cpp +++ b/src/SessionManager.cpp @@ -35,6 +35,7 @@ #include #include #include +#include #include #include #include @@ -48,8 +49,6 @@ using namespace Konsole; -SessionManager* SessionManager::_instance = 0; - #if 0 bool Profile::isAvailable() const @@ -142,7 +141,7 @@ QString SessionManager::loadProfile(const QString& shortPath) if ( !parentProfile.isEmpty() ) { - //qDebug() << "Loading parent profile" << parentProfile; + //kDebug() << "Loading parent profile" << parentProfile; QString parentKey = loadProfile(parentProfile); newProfile->setParent(profile(parentKey)); @@ -170,7 +169,7 @@ void SessionManager::loadAllProfiles() if ( _loadedAllProfiles ) return; - qDebug() << "Loading all profiles"; + kDebug() << "Loading all profiles"; KDE3ProfileReader kde3Reader; KDE4ProfileReader kde4Reader; @@ -267,7 +266,7 @@ void SessionManager::sessionTerminated(QObject* sessionObject) { Session* session = qobject_cast(sessionObject); - //qDebug() << "Session finished: " << session->title(Session::NameRole); + //kDebug() << "Session finished: " << session->title(Session::NameRole); Q_ASSERT( session ); @@ -325,7 +324,7 @@ void SessionManager::changeProfile(const QString& key , return; } - qDebug() << "Profile about to change: " << info->name(); + kDebug() << "Profile about to change: " << info->name(); // insert the changes into the existing Profile instance QListIterator iter(propertyMap.keys()); @@ -335,7 +334,7 @@ void SessionManager::changeProfile(const QString& key , info->setProperty(property,propertyMap[property]); } - qDebug() << "Profile changed: " << info->name(); + kDebug() << "Profile changed: " << info->name(); // apply the changes to existing sessions applyProfile(key,true); @@ -512,7 +511,7 @@ void SessionManager::setDefaultProfile(const QString& key) QFileInfo fileInfo(path); - qDebug() << "setting default session type to " << fileInfo.fileName(); + kDebug() << "setting default session type to " << fileInfo.fileName(); KSharedConfigPtr config = KGlobal::config(); KConfigGroup group = config->group("Desktop Entry"); @@ -531,14 +530,14 @@ void SessionManager::setFavorite(const QString& key , bool favorite) if ( favorite && !_favorites.contains(key) ) { - qDebug() << "adding favorite - " << key; + kDebug() << "adding favorite - " << key; _favorites.insert(key); emit favoriteStatusChanged(key,favorite); } else if ( !favorite && _favorites.contains(key) ) { - qDebug() << "removing favorite - " << key; + kDebug() << "removing favorite - " << key; _favorites.remove(key); emit favoriteStatusChanged(key,favorite); } @@ -720,13 +719,11 @@ QKeySequence SessionManager::shortcut(const QString& profileKey) const return QKeySequence(); } -void SessionManager::setInstance(SessionManager* instance) -{ - _instance = instance; -} + +K_GLOBAL_STATIC( SessionManager , theSessionManager ) SessionManager* SessionManager::instance() { - return _instance; + return theSessionManager; } diff --git a/src/SessionManager.h b/src/SessionManager.h index 8eec5ef50..7efe6dba8 100644 --- a/src/SessionManager.h +++ b/src/SessionManager.h @@ -325,8 +325,6 @@ private: bool _loadedAllProfiles; // set to true after loadAllProfiles has been called QSignalMapper* _sessionMapper; - - static SessionManager* _instance; }; } diff --git a/src/ShellCommand.cpp b/src/ShellCommand.cpp index d432774a0..0dcb3cc19 100644 --- a/src/ShellCommand.cpp +++ b/src/ShellCommand.cpp @@ -21,7 +21,7 @@ #include "ShellCommand.h" // Qt -#include +#include using namespace Konsole; diff --git a/src/ViewContainer.cpp b/src/ViewContainer.cpp index fdc6e3fbf..786987e17 100644 --- a/src/ViewContainer.cpp +++ b/src/ViewContainer.cpp @@ -100,11 +100,11 @@ void ViewContainer::setNavigationDisplayMode(NavigationDisplayMode mode) #if 0 if ( mode == AlwaysShowNavigation ) - qDebug() << "Always show nav"; + kDebug() << "Always show nav"; else if ( mode == AlwaysHideNavigation ) - qDebug() << "Always hide nav"; + kDebug() << "Always hide nav"; else if ( mode == ShowNavigationAsNeeded ) - qDebug() << "Show nav as needed"; + kDebug() << "Show nav as needed"; #endif navigationDisplayModeChanged(mode); @@ -556,8 +556,8 @@ void TabbedViewContainerV2::navigationDisplayModeChanged(NavigationDisplayMode m } void TabbedViewContainerV2::dynamicTabBarVisibility() { - qDebug() << "tab bar count:" << _tabBar->count(); - qDebug() << "tab var hidden:" << _tabBar->isHidden(); + kDebug() << "tab bar count:" << _tabBar->count(); + kDebug() << "tab var hidden:" << _tabBar->isHidden(); if ( _tabBar->count() > 1 && _tabBar->isHidden() ) setTabBarVisible(true); @@ -694,7 +694,7 @@ void TabbedViewContainerV2::updateTitle(ViewProperties* item) } void TabbedViewContainerV2::updateIcon(ViewProperties* item) { - qDebug() << "Tab icon changed."; + kDebug() << "Tab icon changed."; QListIterator iter(widgetsForItem(item)); while ( iter.hasNext() ) diff --git a/src/ViewManager.cpp b/src/ViewManager.cpp index 9bfb6094f..7dc0e9294 100644 --- a/src/ViewManager.cpp +++ b/src/ViewManager.cpp @@ -231,14 +231,14 @@ void ViewManager::updateDetachViewState() } void ViewManager::moveActiveViewLeft() { - qDebug() << "Moving active view to the left"; + kDebug() << "Moving active view to the left"; ViewContainer* container = _viewSplitter->activeContainer(); Q_ASSERT( container ); container->moveActiveView( ViewContainer::MoveViewLeft ); } void ViewManager::moveActiveViewRight() { - qDebug() << "Moving active view to the right"; + kDebug() << "Moving active view to the right"; ViewContainer* container = _viewSplitter->activeContainer(); Q_ASSERT( container ); container->moveActiveView( ViewContainer::MoveViewRight ); @@ -573,7 +573,7 @@ ViewManager::NavigationMethod ViewManager::navigationMethod() const { return _na void ViewManager::containerViewsChanged(QObject* container) { - //qDebug() << "Container views changed"; + //kDebug() << "Container views changed"; if ( container == _viewSplitter->activeContainer() ) { diff --git a/src/ViewSplitter.cpp b/src/ViewSplitter.cpp index e329dc856..0786685fb 100644 --- a/src/ViewSplitter.cpp +++ b/src/ViewSplitter.cpp @@ -41,7 +41,7 @@ ViewSplitter::ViewSplitter(QWidget* parent) void ViewSplitter::childEmpty(ViewSplitter* splitter) { - // qDebug() << k_funcinfo << ": deleting child splitter " ; + // kDebug() << k_funcinfo << ": deleting child splitter " ; delete splitter; @@ -60,22 +60,22 @@ void ViewSplitter::adjustContainerSize(ViewContainer* container , int percentage int oldSize = containerSizes[containerIndex]; int newSize = (int)(oldSize * ( 1.0 + percentage/100.0 )); - // qDebug() << "Old container size:" << oldSize << ", new size:" << newSize; + // kDebug() << "Old container size:" << oldSize << ", new size:" << newSize; int perContainerDelta = (count() == 1 ) ? 0 : ( (newSize-oldSize) / (count()-1) ) * (-1); - // qDebug() << "Changing sizes of other containers by " << perContainerDelta << "pixels."; + // kDebug() << "Changing sizes of other containers by " << perContainerDelta << "pixels."; for ( int i = 0 ; i < containerSizes.count() ; i++ ) { - //qDebug() << "Container" << i << "old size =" << containerSizes[i]; + //kDebug() << "Container" << i << "old size =" << containerSizes[i]; if ( i == containerIndex ) containerSizes[i] = newSize; else containerSizes[i] = containerSizes[i] + perContainerDelta; - //qDebug() << "Container" << i << "new size =" << containerSizes[i]; + //kDebug() << "Container" << i << "new size =" << containerSizes[i]; } setSizes(containerSizes); @@ -83,7 +83,7 @@ void ViewSplitter::adjustContainerSize(ViewContainer* container , int percentage ViewSplitter* ViewSplitter::activeSplitter() { - // qDebug() << "BEGIN activeSplitter" ; + // kDebug() << "BEGIN activeSplitter" ; QWidget* widget = focusWidget() ? focusWidget() : this; @@ -91,14 +91,14 @@ ViewSplitter* ViewSplitter::activeSplitter() while ( !splitter && widget ) { - // qDebug() << widget ; + // kDebug() << widget ; splitter = dynamic_cast(widget); widget = widget->parentWidget(); } Q_ASSERT( splitter ); - //qDebug() << "END activeSplitter"; + //kDebug() << "END activeSplitter"; return splitter; } @@ -107,7 +107,7 @@ void ViewSplitter::registerContainer( ViewContainer* container ) { _containers << container; - //qDebug() << k_funcinfo << ": adding container " << ((QTabWidget*)container->containerWidget())->tabText(0); + //kDebug() << k_funcinfo << ": adding container " << ((QTabWidget*)container->containerWidget())->tabText(0); connect( container , SIGNAL(destroyed(ViewContainer*)) , this , SLOT( containerDestroyed(ViewContainer*) ) ); connect( container , SIGNAL(empty(ViewContainer*)) , this , SLOT( containerEmpty(ViewContainer*) ) ); @@ -117,7 +117,7 @@ void ViewSplitter::unregisterContainer( ViewContainer* container ) { _containers.removeAll(container); - //qDebug() << k_funcinfo << ": removing container " << ((QTabWidget*)container->containerWidget())->tabText(0); + //kDebug() << k_funcinfo << ": removing container " << ((QTabWidget*)container->containerWidget())->tabText(0); disconnect( container , 0 , this , 0 ); } @@ -262,10 +262,10 @@ ViewContainer* ViewSplitter::activeContainer() const { if ( QWidget* focusW = focusWidget() ) { - // qDebug() << k_funcinfo << ": focus-widget = " << focusW ; + // kDebug() << k_funcinfo << ": focus-widget = " << focusW ; // if ( dynamic_cast(focusW) ) - // qDebug() << k_funcinfo << ": focus-widget-text = " << ((QLineEdit*)focusW)->text(); - // qDebug() << k_funcinfo << ": container count = " << _containers.count(); + // kDebug() << k_funcinfo << ": focus-widget-text = " << ((QLineEdit*)focusW)->text(); + // kDebug() << k_funcinfo << ": container count = " << _containers.count(); ViewContainer* focusContainer = 0;