File indexing completed on 2024-05-05 04:44:41

0001 /*  This file is part of the KDE project
0002     Copyright (C) 2006 Matthias Kretz <kretz@kde.org>
0003 
0004     This library is free software; you can redistribute it and/or
0005     modify it under the terms of the GNU Lesser General Public
0006     License as published by the Free Software Foundation; either
0007     version 2.1 of the License, or (at your option) version 3, or any
0008     later version accepted by the membership of KDE e.V. (or its
0009     successor approved by the membership of KDE e.V.), Nokia Corporation
0010     (or its successors, if any) and the KDE Free Qt Foundation, which shall
0011     act as a proxy defined in Section 6 of version 3 of the license.
0012 
0013     This library is distributed in the hope that it will be useful,
0014     but WITHOUT ANY WARRANTY; without even the implied warranty of
0015     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0016     Lesser General Public License for more details.
0017 
0018     You should have received a copy of the GNU Lesser General Public
0019     License along with this library.  If not, see <http://www.gnu.org/licenses/>.
0020 
0021 */
0022 
0023 #include "visualization.h"
0024 #include "visualization_p.h"
0025 #include "../objectdescription.h"
0026 #include "../path.h"
0027 #include "factory_p.h"
0028 
0029 #define PHONON_CLASSNAME Visualization
0030 
0031 namespace Phonon
0032 {
0033 namespace Experimental
0034 {
0035 PHONON_OBJECT_IMPL
0036 
0037 Visualization::~Visualization()
0038 {
0039 }
0040 
0041 VisualizationDescription Visualization::visualization() const
0042 {
0043     P_D(const Visualization);
0044     if (!d->m_backendObject) {
0045         return d->description;
0046     }
0047     int index;
0048     BACKEND_GET(int, index, "visualization");
0049     return VisualizationDescription::fromIndex(index);
0050 }
0051 
0052 void Visualization::setVisualization(const VisualizationDescription &newVisualization)
0053 {
0054     P_D(Visualization);
0055     d->description = newVisualization;
0056     if (k_ptr->backendObject()) {
0057         BACKEND_CALL1("setVisualization", int, newVisualization.index());
0058     }
0059 }
0060 
0061 /*
0062 bool Visualization::hasParameterWidget() const
0063 {
0064     P_D(const Visualization);
0065     if (d->m_backendObject)
0066     {
0067         bool ret;
0068         BACKEND_GET(bool, ret, "hasParameterWidget");
0069         return ret;
0070     }
0071     return false;
0072 }
0073 
0074 QWidget *Visualization::createParameterWidget(QWidget *parent)
0075 {
0076     P_D(Visualization);
0077     if (k_ptr->backendObject())
0078     {
0079         QWidget *ret;
0080         BACKEND_GET1(QWidget *, ret, "createParameterWidget", QWidget *, parent);
0081         return ret;
0082     }
0083     return 0;
0084 }
0085 */
0086 
0087 void VisualizationPrivate::phononObjectDestroyed(MediaNodePrivate *bp)
0088 {
0089     Q_UNUSED(bp);
0090     // this method is called from Phonon::MediaNodePrivate::~MediaNodePrivate(), meaning the AudioEffect
0091     // dtor has already been called and the private class is down to MediaNodePrivate
0092     /*
0093     Q_ASSERT(bp);
0094     if (audioPath->k_ptr == bp)
0095     {
0096         pBACKEND_CALL1("setAudioPath", QObject *, static_cast<QObject *>(0));
0097         audioPath = 0;
0098     }
0099     else if (videoOutput->k_ptr == bp)
0100     {
0101         pBACKEND_CALL1("setVideoOutput", QObject *, static_cast<QObject *>(0));
0102         videoOutput = 0;
0103     }
0104     */
0105 }
0106 
0107 bool VisualizationPrivate::aboutToDeleteBackendObject()
0108 {
0109     return true;
0110 }
0111 
0112 void VisualizationPrivate::setupBackendObject()
0113 {
0114     Q_ASSERT(m_backendObject);
0115 
0116     pBACKEND_CALL1("setVisualization", int, description.index());
0117     /*
0118     if (audioPath)
0119         pBACKEND_CALL1("setAudioPath", QObject *, audioPath->k_ptr->backendObject());
0120     if (videoOutput)
0121         pBACKEND_CALL1("setVideoOutput", QObject *, videoOutput->k_ptr->backendObject());
0122         */
0123 }
0124 
0125 } // namespace Experimental
0126 } // namespace Phonon
0127 
0128 #undef PHONON_CLASSNAME
0129 // vim: sw=4 ts=4