File indexing completed on 2024-05-19 04:48:39

0001 /****************************************************************************************
0002  * Copyright (c) 2008 Daniel Caleb Jones <danielcjones@gmail.com>                       *
0003  * Copyright (c) 2009 Mark Kretschmann <kretschmann@kde.org>                            *
0004  * Copyright (c) 2010,2011 Ralf Engels <ralf-engels@gmx.de>                                  *
0005  *                                                                                      *
0006  * This program is free software; you can redistribute it and/or modify it under        *
0007  * the terms of the GNU General Public License as published by the Free Software        *
0008  * Foundation; either version 2 of the License, or (at your option) version 3 or        *
0009  * any later version accepted by the membership of KDE e.V. (or its successor approved  *
0010  * by the membership of KDE e.V.), which shall act as a proxy defined in Section 14 of  *
0011  * version 3 of the license.                                                            *
0012  *                                                                                      *
0013  * This program is distributed in the hope that it will be useful, but WITHOUT ANY      *
0014  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A      *
0015  * PARTICULAR PURPOSE. See the GNU General Public License for more details.             *
0016  *                                                                                      *
0017  * You should have received a copy of the GNU General Public License along with         *
0018  * this program.  If not, see <http://www.gnu.org/licenses/>.                           *
0019  ****************************************************************************************/
0020 
0021 #ifndef AMAROK_DYNAMICBIASDIALOG_H
0022 #define AMAROK_DYNAMICBIASDIALOG_H
0023 
0024 #include "amarok_export.h"
0025 #include "dynamic/Bias.h"
0026 
0027 #include <QDialog>
0028 
0029 class QVBoxLayout;
0030 class QLabel;
0031 class QComboBox;
0032 
0033 namespace PlaylistBrowserNS
0034 {
0035 
0036     /** A dialog that contains the widget from a bias and allows to edit it.
0037     */
0038     class BiasDialog : public QDialog
0039     {
0040         Q_OBJECT
0041 
0042         public:
0043             explicit BiasDialog( const Dynamic::BiasPtr &bias, QWidget* parent = nullptr );
0044             ~BiasDialog() override;
0045 
0046         public Q_SLOTS:
0047             void accept() override;
0048             void reject() override;
0049 
0050         protected Q_SLOTS:
0051             /** Updates the list of biases in the bias type selection list */
0052             void factoriesChanged();
0053             /** Called when a new bias type has been selected */
0054             void selectionChanged( int index );
0055             void biasReplaced( const Dynamic::BiasPtr &oldBias, Dynamic::BiasPtr newBias );
0056 
0057         protected:
0058 
0059             QVBoxLayout* m_mainLayout;
0060             QVBoxLayout* m_biasLayout;
0061 
0062             QComboBox* m_biasSelection;
0063             QLabel *m_descriptionLabel;
0064             QWidget *m_biasWidget;
0065 
0066             Dynamic::BiasPtr m_origBias;
0067 
0068             /** A copy of the bias given when constructing this object.
0069              *
0070              *  We edit only in the copy so that we can discard it if needed.
0071              */
0072             Dynamic::BiasPtr m_bias;
0073     };
0074 
0075 }
0076 
0077 #endif