File indexing completed on 2024-05-05 04:49:24

0001 /****************************************************************************************
0002  * Copyright (c) 2010 Téo Mrnjavac <teo@kde.org>                                        *
0003  *                                                                                      *
0004  * This program is free software; you can redistribute it and/or modify it under        *
0005  * the terms of the GNU General Public License as published by the Free Software        *
0006  * Foundation; either version 2 of the License, or (at your option) any later           *
0007  * version.                                                                             *
0008  *                                                                                      *
0009  * This program is distributed in the hope that it will be useful, but WITHOUT ANY      *
0010  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A      *
0011  * PARTICULAR PURPOSE. See the GNU General Public License for more details.             *
0012  *                                                                                      *
0013  * You should have received a copy of the GNU General Public License along with         *
0014  * this program.  If not, see <http://www.gnu.org/licenses/>.                           *
0015  ****************************************************************************************/
0016 
0017 #ifndef TRANSCODING_ASSISTANTDIALOG_H
0018 #define TRANSCODING_ASSISTANTDIALOG_H
0019 
0020 #include "amarok_transcoding_export.h"
0021 #include "transcoding/ui_TranscodingAssistantDialog.h"
0022 #include "core/collections/CollectionLocationDelegate.h"
0023 #include "core/support/Debug.h"
0024 #include "core/transcoding/TranscodingFormat.h"
0025 #include "core/transcoding/TranscodingConfiguration.h"
0026 
0027 #include <KPageDialog>
0028 
0029 class QListWidget;
0030 
0031 namespace Transcoding
0032 {
0033 
0034 /**
0035  * A QDialog for initiating a transcoding operation.
0036  * @author Téo Mrnjavac <teo@kde.org>
0037  */
0038 class AMAROK_TRANSCODING_EXPORT AssistantDialog : public KPageDialog
0039 {
0040     Q_OBJECT
0041 public:
0042     /**
0043      * Create transcoding assistant dialog. Only encoders that encode to one of the
0044      * @p playableFileTypes will be enabled.
0045      * @param playableFileTypes the playable file types
0046      * @param saveSupported true if transcoding config preference can be saved
0047      * @param operation whether this is copying or moving
0048      * @param destCollectionName name of the destination collection
0049      * @param prevConfiguration previous configuration
0050      * @param parent the parent widget
0051      */
0052     AssistantDialog( const QStringList &playableFileTypes, bool saveSupported,
0053                      Collections::CollectionLocationDelegate::OperationType operation,
0054                      const QString &destCollectionName,
0055                      const Configuration &prevConfiguration,
0056                      QWidget *parent = nullptr );
0057 
0058     Configuration configuration() const { return m_configuration; }
0059 
0060     /**
0061      * Return true if user wants to remember this configuration per destination collection
0062      */
0063     bool shouldSave() const { return m_save; }
0064 
0065 private:
0066     inline void populateFormatList();
0067     Configuration::TrackSelection trackSelection() const;
0068 
0069     Configuration m_configuration;
0070     bool m_save;
0071     QStringList m_playableFileTypes;
0072     Ui::AssistantDialog ui;
0073 
0074 private Q_SLOTS:
0075     void onJustCopyClicked();
0076     void onTranscodeClicked();
0077     void onFormatSelect( QListWidgetItem *item );
0078     void onRememberToggled( bool checked );
0079 };
0080 
0081 } //namespace Transcoding
0082 
0083 #endif //TRANSCODING_ASSISTANTDIALOG_H