1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-22 21:54:00 +02:00

Updated settings dialog to handle download folder setting.

This commit is contained in:
Christian Muehlhaeuser
2015-03-11 05:19:42 +01:00
parent 94ee994112
commit 29f2e721ed
6 changed files with 105 additions and 1 deletions

View File

@@ -104,6 +104,7 @@ namespace TomahawkUtils
ListRemove,
ListAdd,
AdvancedSettings,
DownloadsSettings,
AccountSettings,
MusicSettings,
Add,

View File

@@ -733,6 +733,9 @@ defaultPixmap( ImageType type, ImageMode mode, const QSize& size )
case MusicSettings:
pixmap = ImageRegistry::instance()->pixmap( RESPATH "images/music-settings.svg", size );
break;
case DownloadsSettings:
pixmap = ImageRegistry::instance()->pixmap( RESPATH "images/music-settings.svg", size );
break;
case DropSong:
pixmap = ImageRegistry::instance()->pixmap( RESPATH "images/drop-song.svg", size );

View File

@@ -79,6 +79,7 @@ SET( tomahawkUI ${tomahawkUI}
dialogs/Settings_Accounts.ui
dialogs/Settings_Advanced.ui
dialogs/Settings_Collection.ui
dialogs/Settings_Downloads.ui
TomahawkWindow.ui

View File

@@ -25,6 +25,7 @@
#include "ui_Settings_Accounts.h"
#include "ui_Settings_Collection.h"
#include "ui_Settings_Advanced.h"
#include "ui_Settings_Downloads.h"
#include "config.h"
@@ -79,6 +80,8 @@ SettingsDialog::SettingsDialog(QObject *parent )
, m_collectionWidget( new QWidget )
, m_advancedWidgetUi( new Ui_Settings_Advanced )
, m_advancedWidget( new QWidget )
, m_downloadsWidgetUi( new Ui_Settings_Downloads )
, m_downloadsWidget( new QWidget )
, m_staticHostSettings( 0 )
, m_proxySettings( 0 )
, m_restartRequired( false )
@@ -88,10 +91,12 @@ SettingsDialog::SettingsDialog(QObject *parent )
m_accountsWidget->setFont( TomahawkUtils::systemFont() );
m_collectionWidget->setFont( TomahawkUtils::systemFont() );
m_advancedWidget->setFont( TomahawkUtils::systemFont() );
m_downloadsWidget->setFont( TomahawkUtils::systemFont() );
m_accountsWidgetUi->setupUi( m_accountsWidget );
m_collectionWidgetUi->setupUi( m_collectionWidget );
m_advancedWidgetUi->setupUi( m_advancedWidget );
m_downloadsWidgetUi->setupUi( m_downloadsWidget );
m_accountsWidgetUi->accountsFilterCombo->setFocusPolicy( Qt::NoFocus );
m_dialog = new QToolbarTabDialog;
@@ -210,6 +215,9 @@ SettingsDialog::SettingsDialog(QObject *parent )
m_advancedWidgetUi->proxyButton->setFixedWidth( buttonsWidth );
m_advancedWidgetUi->aclEntryClearButton->setFixedWidth( buttonsWidth );
m_downloadsWidgetUi->downloadsFolder->setText( TomahawkSettings::instance()->downloadsPath() );
connect( m_downloadsWidgetUi->pickFolderButton, SIGNAL( clicked() ), SLOT( pickDownloadsPath() ) );
#ifndef Q_OS_MAC
m_advancedWidget->setMinimumSize( m_advancedWidget->sizeHint() );
m_accountsWidget->setMinimumWidth( 500 );
@@ -248,6 +256,9 @@ SettingsDialog::SettingsDialog(QObject *parent )
"network connectivity settings, browser interaction "
"and more." ) );
m_dialog->addTab( m_downloadsWidget, TomahawkUtils::defaultPixmap( TomahawkUtils::DownloadsSettings ),
tr( "Downloads" ), tr( "Configure Tomahawk's integrated download manager." ) );
m_dialog->setCurrentIndex( 0 );
connect( m_advancedWidgetUi->staticHostSettingsButton, SIGNAL( clicked() ), SLOT( showStaticHostSettings() ) );
@@ -290,6 +301,7 @@ SettingsDialog::saveSettings()
s->setWatchForChanges( m_collectionWidgetUi->checkBoxWatchForChanges->isChecked() );
s->setScannerTime( m_collectionWidgetUi->scannerTimeSpinBox->value() );
s->setEnableEchonestCatalogs( m_collectionWidgetUi->enableEchonestCatalog->isChecked() );
s->setDownloadsPath( m_downloadsWidgetUi->downloadsFolder->text() );
// s->setNowPlayingEnabled( ui->checkBoxEnableAdium->isChecked() );
@@ -411,10 +423,24 @@ SettingsDialog::toggleProxyEnabled()
}
void
SettingsDialog::pickDownloadsPath()
{
const QString dir = QFileDialog::getExistingDirectory( m_downloadsWidget, tr( "Open Directory" ),
QDir::homePath(),
QFileDialog::ShowDirsOnly );
if ( !dir.isEmpty() )
{
m_downloadsWidgetUi->downloadsFolder->setText( dir );
}
}
void
SettingsDialog::addLibraryPath()
{
QString dir = QFileDialog::getExistingDirectory( m_collectionWidget, tr( "Open Directory" ),
const QString dir = QFileDialog::getExistingDirectory( m_collectionWidget, tr( "Open Directory" ),
QDir::homePath(),
QFileDialog::ShowDirsOnly );

View File

@@ -32,6 +32,7 @@ class QListWidgetItem;
class Ui_Settings_Accounts;
class Ui_Settings_Collection;
class Ui_Settings_Advanced;
class Ui_Settings_Downloads;
class SipPlugin;
class ResolversModel;
class QNetworkReply;
@@ -110,6 +111,7 @@ private slots:
void showProxySettings();
void addLibraryPath();
void removeLibraryPath();
void pickDownloadsPath();
void accountsFilterChanged( int );
@@ -138,6 +140,9 @@ private:
Ui_Settings_Advanced* m_advancedWidgetUi;
QWidget* m_advancedWidget;
Ui_Settings_Downloads* m_downloadsWidgetUi;
QWidget* m_downloadsWidget;
QToolbarTabDialog* m_dialog;
HostDialog m_staticHostSettings;

View File

@@ -0,0 +1,68 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Settings_Downloads</class>
<widget class="QWidget" name="Settings_Downloads">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>423</width>
<height>367</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle">
<string notr="true" extracomment="not translatable because not shown to the user">Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="label_6">
<property name="text">
<string>Folder to download music to:</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLineEdit" name="downloadsFolder">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pickFolderButton">
<property name="text">
<string>Browse...</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>303</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>