1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-04-21 00:12:06 +02:00

Handle preferred download format in SettingsDialog.

This commit is contained in:
Christian Muehlhaeuser 2015-04-01 01:11:02 +02:00
parent 013d54ed63
commit 2c8c285c66
3 changed files with 30 additions and 1 deletions

View File

@ -1,6 +1,6 @@
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
*
* Copyright 2010-2013, Christian Muehlhaeuser <muesli@tomahawk-player.org>
* Copyright 2010-2015, Christian Muehlhaeuser <muesli@tomahawk-player.org>
* Copyright 2010-2011, Leo Franchi <lfranchi@kde.org>
* Copyright 2010-2012, Jeff Mitchell <jeff@tomahawk-player.org>
* Copyright 2012-2014, Teo Mrnjavac <teo@kde.org>
@ -218,6 +218,19 @@ SettingsDialog::SettingsDialog(QObject *parent )
m_downloadsWidgetUi->downloadsFolder->setText( TomahawkSettings::instance()->downloadsPath() );
connect( m_downloadsWidgetUi->pickFolderButton, SIGNAL( clicked() ), SLOT( pickDownloadsPath() ) );
m_downloadsFormats.insert( "MP3", tr( "MP3" ) );
m_downloadsFormats.insert( "FLAC", tr( "FLAC" ) );
m_downloadsFormats.insert( "M4A", tr( "M4A" ) );
m_downloadsFormats.insert( "MP4", tr( "MP4" ) );
foreach ( const QString& format, m_downloadsFormats.values() )
{
m_downloadsWidgetUi->preferredFormatComboBox->addItem( format );
}
int i = m_downloadsWidgetUi->preferredFormatComboBox->findText( m_downloadsFormats.value( TomahawkSettings::instance()->downloadsPreferredFormat() ) );
if ( i < 0 )
i = m_downloadsWidgetUi->preferredFormatComboBox->findText( "MP3" );
m_downloadsWidgetUi->preferredFormatComboBox->setCurrentIndex( i );
#ifndef Q_OS_MAC
m_advancedWidget->setMinimumSize( m_advancedWidget->sizeHint() );
m_accountsWidget->setMinimumWidth( 500 );
@ -302,6 +315,7 @@ SettingsDialog::saveSettings()
s->setScannerTime( m_collectionWidgetUi->scannerTimeSpinBox->value() );
s->setEnableEchonestCatalogs( m_collectionWidgetUi->enableEchonestCatalog->isChecked() );
s->setDownloadsPath( m_downloadsWidgetUi->downloadsFolder->text() );
s->setDownloadsPreferredFormat( m_downloadsFormats.key( m_downloadsWidgetUi->preferredFormatComboBox->currentText() ) );
// s->setNowPlayingEnabled( ui->checkBoxEnableAdium->isChecked() );

View File

@ -150,6 +150,7 @@ private:
bool m_restartRequired;
Tomahawk::Accounts::AccountModel* m_accountModel;
Tomahawk::Accounts::AccountModelFilterProxy* m_accountProxy;
QHash<QString, QString> m_downloadsFormats;
AnimatedSpinner* m_sipSpinner;
};

View File

@ -48,6 +48,20 @@
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Preferred download format:</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="preferredFormatComboBox"/>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">