[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [kdev-valgrind] /: Simplify `IView` code
From:       Anton Anikin <null () kde ! org>
Date:       2017-01-31 16:32:45
Message-ID: E1cYbML-0007M8-FW () code ! kde ! org
[Download RAW message or body]

Git commit 26d31fbfaf2657b7de1c3f1663135bb8ddbaf423 by Anton Anikin.
Committed on 31/01/2017 at 16:31.
Pushed by antonanikin into branch 'master'.

Simplify `IView` code

M  +1    -2    interfaces/ijob.cpp
M  +0    -10   interfaces/iview.cpp
M  +0    -6    interfaces/iview.h
M  +1    -1    plugin.h
M  +0    -1    tools/massif/parser.h
M  +2    -2    widget.cpp

https://commits.kde.org/kdev-valgrind/26d31fbfaf2657b7de1c3f1663135bb8ddbaf423

diff --git a/interfaces/ijob.cpp b/interfaces/ijob.cpp
index b2e3b58..fd56f3f 100644
--- a/interfaces/ijob.cpp
+++ b/interfaces/ijob.cpp
@@ -286,8 +286,7 @@ void IJob::childProcessExited(int exitCode, QProcess::ExitStatus exitStatus)
     IView* view = createView();
     if (view) {
         view->setModel(m_model);
-        view->setName(target(), tool());
-        emit m_plugin->addView(view);
+        emit m_plugin->addView(view, QStringLiteral("%1 (%2)").arg(target()).arg(tool()));
     }
 
     m_plugin->jobFinished(this);
diff --git a/interfaces/iview.cpp b/interfaces/iview.cpp
index 671947b..b5a5d74 100644
--- a/interfaces/iview.cpp
+++ b/interfaces/iview.cpp
@@ -26,15 +26,5 @@ IView::~IView()
 {
 }
 
-QString IView::name()
-{
-    return m_name;
-}
-
-void IView::setName(const QString& target, const QString& tool)
-{
-    m_name = QStringLiteral("%1 (%2)").arg(target).arg(tool);
-}
-
 }
 
diff --git a/interfaces/iview.h b/interfaces/iview.h
index 24717f0..b5d9f8d 100644
--- a/interfaces/iview.h
+++ b/interfaces/iview.h
@@ -34,13 +34,7 @@ class IView
 public:
     virtual ~IView();
 
-    QString name();
-    void setName(const QString& target, const QString& tool);
-
     virtual void setModel(IModel*) = 0;
-
-protected:
-    QString m_name;
 };
 
 }
diff --git a/plugin.h b/plugin.h
index 22f0e91..bf1b5f1 100644
--- a/plugin.h
+++ b/plugin.h
@@ -52,7 +52,7 @@ public:
     void jobFinished(KJob* job);
 
 signals:
-    void addView(IView* view);
+    void addView(IView* view, const QString& name);
 
 private:
     void runValgrind();
diff --git a/tools/massif/parser.h b/tools/massif/parser.h
index c5d5aba..96f6a57 100644
--- a/tools/massif/parser.h
+++ b/tools/massif/parser.h
@@ -26,7 +26,6 @@
 namespace valgrind
 {
 
-class MassifItem;
 class ModelItem;
 
 /**
diff --git a/widget.cpp b/widget.cpp
index fa4cc5f..7482d4b 100644
--- a/widget.cpp
+++ b/widget.cpp
@@ -53,10 +53,10 @@ Widget::Widget(Plugin* plugin, QWidget* parent)
         removeTab(index);
     });
 
-    connect(plugin, &Plugin::addView, this, [this](IView* view){
+    connect(plugin, &Plugin::addView, this, [this](IView* view, const QString& name){
         Q_ASSERT(view);
 
-        addTab(dynamic_cast<QWidget*>(view), view->name());
+        addTab(dynamic_cast<QWidget*>(view), name);
         setCurrentWidget(dynamic_cast<QWidget*>(view));
         setMovable(true);
     });
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic