From 43c2aba4d232225978054e7537a98ef96f43dca2 Mon Sep 17 00:00:00 2001 From: Jeff Mitchell <tomahawk@jefferai.org> Date: Tue, 14 Jun 2011 14:03:58 -0400 Subject: [PATCH] Update some values/logic before it gets too public --- src/libtomahawk/tomahawksettings.cpp | 34 ++++++++++++++++------------ src/settingsdialog.cpp | 26 +++++++++++++++++++-- 2 files changed, 44 insertions(+), 16 deletions(-) diff --git a/src/libtomahawk/tomahawksettings.cpp b/src/libtomahawk/tomahawksettings.cpp index a154eaa3b..a16ecf3a1 100644 --- a/src/libtomahawk/tomahawksettings.cpp +++ b/src/libtomahawk/tomahawksettings.cpp @@ -149,13 +149,19 @@ TomahawkSettings::scannerPaths() { //FIXME: After enough time, remove this hack (and make const) #ifndef TOMAHAWK_HEADLESS - if( value( "scannerpaths" ).isNull() ) - setValue( "scannerpaths", value( "scannerpath" ) ); - return value( "scannerpaths", QDesktopServices::storageLocation( QDesktopServices::MusicLocation ) ).toStringList(); + if( value( "scanner/paths" ).isNull() ) + { + setValue( "scanner/paths", value( "scannerpath" ) ); + remove( "scannerpath" ); + } + return value( "scanner/paths", QDesktopServices::storageLocation( QDesktopServices::MusicLocation ) ).toStringList(); #else - if( value( "scannerpaths" ).isNull() ) - setValue( "scannerpaths", value( "scannerpath" ) ); - return value( "scannerpaths", "" ).toStringList(); + if( value( "scanner/paths" ).isNull() ) + { + setValue( "scanner/paths", value( "scannerpath" ) ); + remove( "scannerpath" ); + } + return value( "scanner/paths", "" ).toStringList(); #endif } @@ -163,7 +169,7 @@ TomahawkSettings::scannerPaths() void TomahawkSettings::setScannerPaths( const QStringList& paths ) { - setValue( "scannerpaths", paths ); + setValue( "scanner/paths", paths ); } @@ -171,49 +177,49 @@ bool TomahawkSettings::hasScannerPaths() const { //FIXME: After enough time, remove this hack - return contains( "scannerpaths" ) || contains( "scannerpath" ); + return contains( "scanner/paths" ) || contains( "scannerpath" ); } TomahawkSettings::ScannerMode TomahawkSettings::scannerMode() const { - return (TomahawkSettings::ScannerMode) value( "scanner-mode", TomahawkSettings::Files ).toInt(); + return (TomahawkSettings::ScannerMode) value( "scanner/mode", TomahawkSettings::Files ).toInt(); } void TomahawkSettings::setScannerMode( ScannerMode mode ) { - setValue( "scanner-mode", mode ); + setValue( "scanner/mode", mode ); } uint TomahawkSettings::scannerTime() const { - return value( "scannerTime", 60 ).toUInt(); + return value( "scanner/intervaltime", 60 ).toUInt(); } void TomahawkSettings::setScannerTime( uint time ) { - setValue( "scannerTime", time ); + setValue( "scanner/intervaltime", time ); } bool TomahawkSettings::watchForChanges() const { - return value( "watchForChanges", false ).toBool(); + return value( "scanner/watchforchanges", false ).toBool(); } void TomahawkSettings::setWatchForChanges( bool watch ) { - setValue( "watchForChanges", watch ); + setValue( "scanner/watchforchanges", watch ); } void diff --git a/src/settingsdialog.cpp b/src/settingsdialog.cpp index 36393fb8e..61f56ec93 100644 --- a/src/settingsdialog.cpp +++ b/src/settingsdialog.cpp @@ -118,9 +118,15 @@ SettingsDialog::SettingsDialog( QWidget *parent ) ui->checkBoxWatchForChanges->setChecked( s->watchForChanges() ); ui->scannerTimeSpinBox->setValue( s->scannerTime() ); if ( s->scannerMode() == TomahawkSettings::Files ) - ui->scannerFileModeButton->setChecked( true ); - else + { ui->scannerDirModeButton->setChecked( false ); + ui->scannerFileModeButton->setChecked( true ); + } + else + { + ui->scannerDirModeButton->setChecked( true ); + ui->scannerFileModeButton->setChecked( false ); + } connect( ui->checkBoxWatchForChanges, SIGNAL( clicked( bool ) ), SLOT( updateScanOptionsView() ) ); connect( ui->scannerDirModeButton, SIGNAL( clicked( bool ) ), SLOT( updateScanOptionsView() ) ); connect( ui->scannerFileModeButton, SIGNAL( clicked( bool ) ), SLOT( updateScanOptionsView() ) ); @@ -134,6 +140,22 @@ SettingsDialog::SettingsDialog( QWidget *parent ) ui->scanInformationLabel->setText( "Directory mode mode uses the changed time of collection directories to\ndetermine if files have changed. This is less processor, disk, and \nnetwork-intensive when simply running checks, so may be better for\nfiles over a network connection. However, it will only pick up changes\nif a file has been added to or removed from a directory, and scans\nentire directories at once (so is not good for very flat collections)." ); ui->scannerDirModeButton->setChecked( true ); } + if ( ui->checkBoxWatchForChanges->isChecked() ) + { + ui->scanTimeLabel->show(); + ui->scannerTimeSpinBox->show(); + ui->scannerDirModeButton->show(); + ui->scannerFileModeButton->show(); + ui->scanInformationLabel->show(); + } + else + { + ui->scanTimeLabel->hide(); + ui->scannerTimeSpinBox->hide(); + ui->scannerDirModeButton->hide(); + ui->scannerFileModeButton->hide(); + ui->scanInformationLabel->hide(); + } // NOW PLAYING #ifdef Q_WS_MAC