| 1 | /* This file is part of the KDE project |
| 2 | Copyright (C) 2006 Matthias Kretz <kretz@kde.org> |
| 3 | |
| 4 | This library is free software; you can redistribute it and/or |
| 5 | modify it under the terms of the GNU Lesser General Public |
| 6 | License as published by the Free Software Foundation; either |
| 7 | version 2.1 of the License, or (at your option) version 3, or any |
| 8 | later version accepted by the membership of KDE e.V. (or its |
| 9 | successor approved by the membership of KDE e.V.), Nokia Corporation |
| 10 | (or its successors, if any) and the KDE Free Qt Foundation, which shall |
| 11 | act as a proxy defined in Section 6 of version 3 of the license. |
| 12 | |
| 13 | This library is distributed in the hope that it will be useful, |
| 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 16 | Lesser General Public License for more details. |
| 17 | |
| 18 | You should have received a copy of the GNU Lesser General Public |
| 19 | License along with this library. If not, see <http://www.gnu.org/licenses/>. |
| 20 | |
| 21 | */ |
| 22 | |
| 23 | #include "visualization.h" |
| 24 | #include "visualization_p.h" |
| 25 | #include "../objectdescription.h" |
| 26 | #include "../path.h" |
| 27 | #include "factory_p.h" |
| 28 | |
| 29 | #define PHONON_CLASSNAME Visualization |
| 30 | |
| 31 | namespace Phonon |
| 32 | { |
| 33 | namespace Experimental |
| 34 | { |
| 35 | PHONON_OBJECT_IMPL |
| 36 | |
| 37 | Visualization::~Visualization() |
| 38 | { |
| 39 | } |
| 40 | |
| 41 | VisualizationDescription Visualization::visualization() const |
| 42 | { |
| 43 | P_D(const Visualization); |
| 44 | if (!d->m_backendObject) { |
| 45 | return d->description; |
| 46 | } |
| 47 | int index; |
| 48 | BACKEND_GET(int, index, "visualization" ); |
| 49 | return VisualizationDescription::fromIndex(index); |
| 50 | } |
| 51 | |
| 52 | void Visualization::setVisualization(const VisualizationDescription &newVisualization) |
| 53 | { |
| 54 | P_D(Visualization); |
| 55 | d->description = newVisualization; |
| 56 | if (k_ptr->backendObject()) { |
| 57 | BACKEND_CALL1("setVisualization" , int, newVisualization.index()); |
| 58 | } |
| 59 | } |
| 60 | |
| 61 | /* |
| 62 | bool Visualization::hasParameterWidget() const |
| 63 | { |
| 64 | P_D(const Visualization); |
| 65 | if (d->m_backendObject) |
| 66 | { |
| 67 | bool ret; |
| 68 | BACKEND_GET(bool, ret, "hasParameterWidget"); |
| 69 | return ret; |
| 70 | } |
| 71 | return false; |
| 72 | } |
| 73 | |
| 74 | QWidget *Visualization::createParameterWidget(QWidget *parent) |
| 75 | { |
| 76 | P_D(Visualization); |
| 77 | if (k_ptr->backendObject()) |
| 78 | { |
| 79 | QWidget *ret; |
| 80 | BACKEND_GET1(QWidget *, ret, "createParameterWidget", QWidget *, parent); |
| 81 | return ret; |
| 82 | } |
| 83 | return 0; |
| 84 | } |
| 85 | */ |
| 86 | |
| 87 | void VisualizationPrivate::phononObjectDestroyed(MediaNodePrivate *bp) |
| 88 | { |
| 89 | Q_UNUSED(bp); |
| 90 | // this method is called from Phonon::MediaNodePrivate::~MediaNodePrivate(), meaning the AudioEffect |
| 91 | // dtor has already been called and the private class is down to MediaNodePrivate |
| 92 | /* |
| 93 | Q_ASSERT(bp); |
| 94 | if (audioPath->k_ptr == bp) |
| 95 | { |
| 96 | pBACKEND_CALL1("setAudioPath", QObject *, static_cast<QObject *>(0)); |
| 97 | audioPath = 0; |
| 98 | } |
| 99 | else if (videoOutput->k_ptr == bp) |
| 100 | { |
| 101 | pBACKEND_CALL1("setVideoOutput", QObject *, static_cast<QObject *>(0)); |
| 102 | videoOutput = 0; |
| 103 | } |
| 104 | */ |
| 105 | } |
| 106 | |
| 107 | bool VisualizationPrivate::aboutToDeleteBackendObject() |
| 108 | { |
| 109 | return true; |
| 110 | } |
| 111 | |
| 112 | void VisualizationPrivate::setupBackendObject() |
| 113 | { |
| 114 | Q_ASSERT(m_backendObject); |
| 115 | |
| 116 | pBACKEND_CALL1("setVisualization" , int, description.index()); |
| 117 | /* |
| 118 | if (audioPath) |
| 119 | pBACKEND_CALL1("setAudioPath", QObject *, audioPath->k_ptr->backendObject()); |
| 120 | if (videoOutput) |
| 121 | pBACKEND_CALL1("setVideoOutput", QObject *, videoOutput->k_ptr->backendObject()); |
| 122 | */ |
| 123 | } |
| 124 | |
| 125 | } // namespace Experimental |
| 126 | } // namespace Phonon |
| 127 | |
| 128 | #undef PHONON_CLASSNAME |
| 129 | // vim: sw=4 ts=4 |
| 130 | |