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

0001 /*
0002     SPDX-FileCopyrightText: 1998-2010 Sebastian Trueg <trueg@k3b.org>
0003     SPDX-License-Identifier: GPL-2.0-or-later
0004 */
0005 
0006 #include "k3baudiotrackdialog.h"
0007 #include "k3baudiotrackwidget.h"
0008 #include "k3baudiotrack.h"
0009 #include "k3bmsf.h"
0010 #include "k3bmsfedit.h"
0011 
0012 #include <KLocalizedString>
0013 #include <KIO/Global>
0014 
0015 #include <QCheckBox>
0016 #include <QComboBox>
0017 #include <QDialogButtonBox>
0018 #include <QLabel>
0019 #include <QPushButton>
0020 #include <QVBoxLayout>
0021 
0022 
0023 // TODO: three modes:
0024 //    1. Only one track with only one source
0025 //         show decoder tech info, cdtext, options and the track editor without showing anything
0026 //         about sources
0027 //    2. Only one track with multiple sources
0028 //         like the above but with the possibility to edit the sources
0029 //    3. multiple tracks
0030 //         do only show cd-text and options (eventually index0)
0031 
0032 
0033 K3b::AudioTrackDialog::AudioTrackDialog( const QList<K3b::AudioTrack*>& tracks, QWidget *parent )
0034     : QDialog( parent)
0035 {
0036     m_tracks = tracks;
0037 
0038     setWindowTitle(i18n("Audio Track Properties"));
0039     setModal(true);
0040 
0041     m_audioTrackWidget = new K3b::AudioTrackWidget( m_tracks, this );
0042     QDialogButtonBox* buttonBox = new QDialogButtonBox( QDialogButtonBox::Ok | QDialogButtonBox::Cancel | QDialogButtonBox::Apply, this );
0043     connect( buttonBox, SIGNAL(accepted()), SLOT(accept()) );
0044     connect( buttonBox, SIGNAL(rejected()), SLOT(reject()) );
0045     connect( buttonBox->button( QDialogButtonBox::Apply ), SIGNAL(clicked()), SLOT(slotApply()));
0046 
0047     QVBoxLayout* mainLayout = new QVBoxLayout( this );
0048     mainLayout->addWidget( m_audioTrackWidget );
0049     mainLayout->addWidget( buttonBox );
0050 }
0051 
0052 
0053 K3b::AudioTrackDialog::~AudioTrackDialog()
0054 {
0055 }
0056 
0057 
0058 void K3b::AudioTrackDialog::accept()
0059 {
0060     slotApply();
0061     QDialog::accept();
0062 }
0063 
0064 
0065 void K3b::AudioTrackDialog::slotApply()
0066 {
0067     m_audioTrackWidget->save();
0068 }
0069 
0070 
0071 void K3b::AudioTrackDialog::updateTrackLengthDisplay()
0072 {
0073 //   K3b::Msf len = m_editTrackEnd->msfValue() - m_editTrackStart->msfValue();
0074 //   m_displayLength->setText( len.toString() );
0075 //   m_displaySize->setText( KIO::convertSize(len.audioBytes()) );
0076 }
0077 
0078 #include "moc_k3baudiotrackdialog.cpp"