File indexing completed on 2024-05-05 04:51:40

0001 /*
0002     SPDX-FileCopyrightText: 1998-2007 Sebastian Trueg <trueg@k3b.org>
0003     SPDX-License-Identifier: GPL-2.0-or-later
0004 */
0005 
0006 #ifndef _K3B_AUDIODATASOURCE_EDITWIDGET_H_
0007 #define _K3B_AUDIODATASOURCE_EDITWIDGET_H_
0008 
0009 #include "k3bmsf.h"
0010 
0011 #include <QWidget>
0012 
0013 namespace K3b {
0014     class AudioDataSource;
0015 }
0016 namespace K3b {
0017     class AudioEditorWidget;
0018 }
0019 namespace K3b {
0020     class MsfEdit;
0021 }
0022 
0023 /**
0024  * Widget to modify the start and end offset of a source or simply change
0025  * the length of a silence source.
0026  */
0027 namespace K3b {
0028     class AudioDataSourceEditWidget : public QWidget
0029     {
0030         Q_OBJECT
0031 
0032     public:
0033         explicit AudioDataSourceEditWidget( QWidget* parent = 0 );
0034         ~AudioDataSourceEditWidget() override;
0035 
0036         K3b::Msf startOffset() const;
0037 
0038         /**
0039          * Highest value (meaning to use all the data up to the end of the source)
0040          * is source::originalLength().
0041          *
0042          * Be aware that this differs from AudioDataSource::endOffset() which
0043          * points after the last used sector for internal reasons.
0044          */
0045         K3b::Msf endOffset() const;
0046 
0047     public Q_SLOTS:
0048         void loadSource( K3b::AudioDataSource* );
0049         void saveSource();
0050 
0051         void setStartOffset( const K3b::Msf& );
0052         void setEndOffset( const K3b::Msf& );
0053 
0054     private Q_SLOTS:
0055         void slotRangeModified( int, const K3b::Msf&, const K3b::Msf& );
0056         void slotStartOffsetEdited( const K3b::Msf& );
0057         void slotEndOffsetEdited( const K3b::Msf& );
0058 
0059     private:
0060         AudioDataSource* m_source;
0061         int m_rangeId;
0062 
0063         AudioEditorWidget* m_editor;
0064         MsfEdit* m_editStartOffset;
0065         MsfEdit* m_editEndOffset;
0066     };
0067 }
0068 
0069 #endif