summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexandr Akulich <akulichalexander@gmail.com>2016-08-31 16:30:00 (GMT)
committerAlexandr Akulich <akulichalexander@gmail.com>2016-09-06 12:09:40 (GMT)
commit17b0f5e4a7600487b9d92e766c6f1f44b8aa014a (patch)
tree6a93e07d0a9099172cddcf9a08333422cd40f40f
parentccdf6a3c006a0f385a1224ee45f89a3776aa0fb9 (diff)
[debugger] Cleanup and reformat, no any change of logic
REVIEW: 128845
-rw-r--r--tools/debugger/debug-message-view.cpp37
-rw-r--r--tools/debugger/debug-message-view.h14
-rw-r--r--tools/debugger/main-window.h1
3 files changed, 20 insertions, 32 deletions
diff --git a/tools/debugger/debug-message-view.cpp b/tools/debugger/debug-message-view.cpp
index af09715..ea09d79 100644
--- a/tools/debugger/debug-message-view.cpp
+++ b/tools/debugger/debug-message-view.cpp
@@ -25,13 +25,10 @@
#include <QDebug>
#include <QAction>
#include <QFileDialog>
-#include <KColorScheme>
#include <KStandardAction>
#include <KLocalizedString>
-#include <KFindDialog>
#include <KService>
#include <KTextEditor/View>
-#include <kfind.h>
#include <KTextEditor/Document>
#include <ctime>
@@ -49,8 +46,7 @@ DebugMessageView::DebugMessageView(QWidget *parent)
if (service) {
m_editor = qobject_cast<KTextEditor::Document*>(service->createInstance<KParts::ReadWritePart>(this));
Q_ASSERT(m_editor && "Failed to instantiate a KatePart");
- }
- else {
+ } else {
qCritical() << "Could not find kate part";
}
@@ -64,6 +60,17 @@ DebugMessageView::DebugMessageView(QWidget *parent)
view->contextMenu()->addAction(KStandardAction::clear(this, SLOT(clear()), this));
}
+DebugMessageView::~DebugMessageView()
+{
+ if (m_debugReceiver && m_ready) {
+ //disable monitoring and do it synchronously before all the objects are destroyed
+ Tp::PendingOperation *op = m_debugReceiver->setMonitoringEnabled(false);
+ QEventLoop loop;
+ connect(op, SIGNAL(finished(Tp::PendingOperation*)), &loop, SLOT(quit()));
+ loop.exec();
+ }
+}
+
void DebugMessageView::clear()
{
m_editor->setReadWrite(true);
@@ -86,17 +93,6 @@ void DebugMessageView::addDelayedMessages()
m_tmpCache.clear();
}
-DebugMessageView::~DebugMessageView()
-{
- if (m_debugReceiver && m_ready) {
- //disable monitoring and do it synchronously before all the objects are destroyed
- Tp::PendingOperation *op = m_debugReceiver->setMonitoringEnabled(false);
- QEventLoop loop;
- connect(op, SIGNAL(finished(Tp::PendingOperation*)), &loop, SLOT(quit()));
- loop.exec();
- }
-}
-
void DebugMessageView::setService(const QString &service)
{
m_serviceName = service;
@@ -199,7 +195,6 @@ void DebugMessageView::onNewDebugMessage(const Tp::DebugMessage & msg)
}
}
-
//taken from empathy
static inline QString formatTimestamp(double timestamp)
{
@@ -223,15 +218,14 @@ static inline QString formatTimestamp(double timestamp)
void DebugMessageView::appendMessage(const Tp::DebugMessage &msg)
{
- if ( isVisible() ) {
+ if (isVisible()) {
QString message = QString(formatTimestamp(msg.timestamp) %
QLatin1Literal(" - [") % msg.domain % QLatin1Literal("] ") %
msg.message);
m_editor->setReadWrite(true);
m_editor->insertText(m_editor->documentEnd(), message + QString::fromLatin1("\n"));
m_editor->setReadWrite(false);
- }
- else {
+ } else {
m_tmpCache.append(msg);
}
}
@@ -241,6 +235,3 @@ void DebugMessageView::saveLogFile()
QUrl savedFile = QUrl::fromUserInput(QFileDialog::getSaveFileName(this, i18nc("@title:window", "Save Log")));
m_editor->saveAs(savedFile);
}
-
-
-
diff --git a/tools/debugger/debug-message-view.h b/tools/debugger/debug-message-view.h
index 0bde707..ae745db 100644
--- a/tools/debugger/debug-message-view.h
+++ b/tools/debugger/debug-message-view.h
@@ -18,21 +18,20 @@
#ifndef DEBUG_MESSAGES_MODEL_H
#define DEBUG_MESSAGES_MODEL_H
-#include <QTextEdit>
+#include <QWidget>
#include <TelepathyQt/Types>
#include <TelepathyQt/PendingOperation>
-#include <kparts/part.h>
#include <KTextEditor/Document>
-
class DebugMessageView : public QWidget
{
Q_OBJECT
public:
explicit DebugMessageView(QWidget *parent = 0);
- void setService(const QString & service);
virtual ~DebugMessageView();
- virtual void showEvent(QShowEvent* );
+
+ void setService(const QString & service);
+ virtual void showEvent(QShowEvent *event);
void saveLogFile();
private Q_SLOTS:
@@ -46,9 +45,6 @@ private Q_SLOTS:
void addDelayedMessages();
void clear();
-Q_SIGNALS:
- void statusMessage(const QString& msg);
-
private:
void appendMessage(const Tp::DebugMessage &msg);
@@ -57,7 +53,7 @@ private:
Tp::DebugMessageList m_tmpCache;
QDBusServiceWatcher *m_serviceWatcher;
bool m_ready;
- KTextEditor::Document* m_editor;
+ KTextEditor::Document *m_editor;
};
#endif // DEBUG_MESSAGES_MODEL_H
diff --git a/tools/debugger/main-window.h b/tools/debugger/main-window.h
index 2e7c968..86eeaed 100644
--- a/tools/debugger/main-window.h
+++ b/tools/debugger/main-window.h
@@ -21,6 +21,7 @@
#include "ui_main-window.h"
#include <TelepathyQt/Types>
+#include <TelepathyQt/PendingOperation>
#include <KXmlGuiWindow>