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

List:       kde-commits
Subject:    [phonon/five] phonon: Make SourceControl inherit from Frontend
From:       Casian Andrei <skeletk13 () gmail ! com>
Date:       2013-11-30 19:36:07
Message-ID: E1VmqKl-0007Rn-L5 () scm ! kde ! org
[Download RAW message or body]

Git commit 9c7414a1f6df596fac01ceabe48f8aee7e8d4ac1 by Casian Andrei.
Committed on 30/11/2013 at 17:12.
Pushed by casianandrei into branch 'five'.

Make SourceControl inherit from Frontend

And SourceControlPrivate inherit from FrontendPrivate.

Similar to the Player class.

Also modify it's getters.

M  +20   -12   phonon/sourcecontrol.cpp
M  +10   -5    phonon/sourcecontrol.h
M  +18   -2    phonon/sourcecontrol_p.h
M  +5    -2    phonon/sourcecontrolinterface.h

http://commits.kde.org/phonon/9c7414a1f6df596fac01ceabe48f8aee7e8d4ac1

diff --git a/phonon/sourcecontrol.cpp b/phonon/sourcecontrol.cpp
index 0223b49..b2a0b8c 100644
--- a/phonon/sourcecontrol.cpp
+++ b/phonon/sourcecontrol.cpp
@@ -23,17 +23,19 @@
 #include "sourcecontrol.h"
 #include "sourcecontrol_p.h"
 
+#include "factory_p.h"
+
 namespace Phonon
 {
 
-SourceControl::SourceControl(Source &source)
-    : d(new SourceControlPrivate(source))
-{
 
-}
+/*
+ * SourceControl
+ */
 
-SourceControl::SourceControl(SourceControlPrivate &dd)
-    : d(&dd)
+SourceControl::SourceControl(SourceControlPrivate &pd, QObject *parent)
+    : QObject(parent)
+    , Frontend(pd)
 {
 
 }
@@ -43,19 +45,25 @@ SourceControl::~SourceControl()
 
 }
 
-Source SourceControl::source() const
+bool SourceControl::isActive() const
 {
-    return d->m_source;
+    P_D(const SourceControl);
+    if (!d->m_scInterface)
+        return false;
+    return d->m_scInterface->isActive();
 }
 
-bool SourceControl::isActive() const
+Source SourceControl::source() const
 {
-    return d->m_active;
+    P_D(const SourceControl);
+    return d->m_source;
 }
 
+// private
+
 SourceControlPrivate::SourceControlPrivate(Source &source)
-    : m_source(source)
-    , m_active(false)
+    : m_scInterface(0)
+    , m_source(source)
 {
 
 }
diff --git a/phonon/sourcecontrol.h b/phonon/sourcecontrol.h
index 69f27d3..11a6da8 100644
--- a/phonon/sourcecontrol.h
+++ b/phonon/sourcecontrol.h
@@ -23,25 +23,30 @@
 #ifndef PHONON_SOURCE_CONTROL_H_
 #define PHONON_SOURCE_CONTROL_H_
 
+#include "frontend.h"
+#include "phonondefs.h"
 #include "source.h"
 
+#include <QtCore/QObject>
+
 namespace Phonon
 {
 
 class SourceControlPrivate;
 
-class PHONON_EXPORT SourceControl
+class PHONON_EXPORT SourceControl : public QObject, public Frontend
 {
+    Q_OBJECT
+
 public:
-    explicit SourceControl(Source &source);
+    SourceControl(SourceControlPrivate &pd, QObject *parent = 0);
     virtual ~SourceControl();
 
     Source source() const;
     bool isActive() const;
 
-protected:
-    QExplicitlySharedDataPointer<SourceControlPrivate> d;
-    SourceControl(SourceControlPrivate &);
+private:
+    P_DECLARE_PRIVATE(SourceControl)
 };
 
 } // Phonon namespace
diff --git a/phonon/sourcecontrol_p.h b/phonon/sourcecontrol_p.h
index e3a7e98..ba9985c 100644
--- a/phonon/sourcecontrol_p.h
+++ b/phonon/sourcecontrol_p.h
@@ -24,18 +24,34 @@
 #define PHONON_SOURCE_CONTROL_P_H_
 
 #include "sourcecontrol.h"
+#include "sourcecontrolinterface.h"
+
+#include "frontend_p.h"
+#include "phononpimpl_p.h"
 
 namespace Phonon
 {
 
-class SourceControlPrivate : public QSharedData
+class SourceControlPrivate : public FrontendPrivate
 {
 public:
     explicit SourceControlPrivate(Source &source);
     virtual ~SourceControlPrivate();
 
+    SourceControlInterface *m_scInterface;
+
     Source m_source;
-    bool m_active;
+
+private:
+    P_DECLARE_PUBLIC(SourceControl)
+    Q_DISABLE_COPY(SourceControlPrivate);
+
+protected:
+    virtual void createBackendObject() = 0;
+
+private:
+    P_DECLARE_PUBLIC(SourceControl)
+    Q_DISABLE_COPY(SourceControlPrivate)
 };
 
 } // Phonon namespace
diff --git a/phonon/sourcecontrolinterface.h b/phonon/sourcecontrolinterface.h
index 8f7313c..e51cade 100644
--- a/phonon/sourcecontrolinterface.h
+++ b/phonon/sourcecontrolinterface.h
@@ -23,6 +23,10 @@
 #ifndef PHONON_SOURCE_CONTROL_INTERFACE_H_
 #define PHONON_SOURCE_CONTROL_INTERFACE_H_
 
+#include "source.h"
+
+#include "sourcecontrol.h"
+
 namespace Phonon
 {
 
@@ -33,8 +37,7 @@ class SourceControlInterface
 public:
     virtual ~SourceControlInterface() {}
 
-    virtual SourceControl *frontendObject() const = 0;
-    virtual void setFrontendObject(SourceControl *) = 0;
+    virtual bool isActive() const = 0;
 };
 
 } // namespace Phonon

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

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