1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-06 14:16:32 +02:00

Update some values/logic before it gets too public

This commit is contained in:
Jeff Mitchell
2011-06-14 14:03:58 -04:00
parent 4337a220b6
commit 43c2aba4d2
2 changed files with 44 additions and 16 deletions

View File

@@ -149,13 +149,19 @@ TomahawkSettings::scannerPaths()
{ {
//FIXME: After enough time, remove this hack (and make const) //FIXME: After enough time, remove this hack (and make const)
#ifndef TOMAHAWK_HEADLESS #ifndef TOMAHAWK_HEADLESS
if( value( "scannerpaths" ).isNull() ) if( value( "scanner/paths" ).isNull() )
setValue( "scannerpaths", value( "scannerpath" ) ); {
return value( "scannerpaths", QDesktopServices::storageLocation( QDesktopServices::MusicLocation ) ).toStringList(); setValue( "scanner/paths", value( "scannerpath" ) );
remove( "scannerpath" );
}
return value( "scanner/paths", QDesktopServices::storageLocation( QDesktopServices::MusicLocation ) ).toStringList();
#else #else
if( value( "scannerpaths" ).isNull() ) if( value( "scanner/paths" ).isNull() )
setValue( "scannerpaths", value( "scannerpath" ) ); {
return value( "scannerpaths", "" ).toStringList(); setValue( "scanner/paths", value( "scannerpath" ) );
remove( "scannerpath" );
}
return value( "scanner/paths", "" ).toStringList();
#endif #endif
} }
@@ -163,7 +169,7 @@ TomahawkSettings::scannerPaths()
void void
TomahawkSettings::setScannerPaths( const QStringList& paths ) TomahawkSettings::setScannerPaths( const QStringList& paths )
{ {
setValue( "scannerpaths", paths ); setValue( "scanner/paths", paths );
} }
@@ -171,49 +177,49 @@ bool
TomahawkSettings::hasScannerPaths() const TomahawkSettings::hasScannerPaths() const
{ {
//FIXME: After enough time, remove this hack //FIXME: After enough time, remove this hack
return contains( "scannerpaths" ) || contains( "scannerpath" ); return contains( "scanner/paths" ) || contains( "scannerpath" );
} }
TomahawkSettings::ScannerMode TomahawkSettings::ScannerMode
TomahawkSettings::scannerMode() const TomahawkSettings::scannerMode() const
{ {
return (TomahawkSettings::ScannerMode) value( "scanner-mode", TomahawkSettings::Files ).toInt(); return (TomahawkSettings::ScannerMode) value( "scanner/mode", TomahawkSettings::Files ).toInt();
} }
void void
TomahawkSettings::setScannerMode( ScannerMode mode ) TomahawkSettings::setScannerMode( ScannerMode mode )
{ {
setValue( "scanner-mode", mode ); setValue( "scanner/mode", mode );
} }
uint uint
TomahawkSettings::scannerTime() const TomahawkSettings::scannerTime() const
{ {
return value( "scannerTime", 60 ).toUInt(); return value( "scanner/intervaltime", 60 ).toUInt();
} }
void void
TomahawkSettings::setScannerTime( uint time ) TomahawkSettings::setScannerTime( uint time )
{ {
setValue( "scannerTime", time ); setValue( "scanner/intervaltime", time );
} }
bool bool
TomahawkSettings::watchForChanges() const TomahawkSettings::watchForChanges() const
{ {
return value( "watchForChanges", false ).toBool(); return value( "scanner/watchforchanges", false ).toBool();
} }
void void
TomahawkSettings::setWatchForChanges( bool watch ) TomahawkSettings::setWatchForChanges( bool watch )
{ {
setValue( "watchForChanges", watch ); setValue( "scanner/watchforchanges", watch );
} }
void void

View File

@@ -118,9 +118,15 @@ SettingsDialog::SettingsDialog( QWidget *parent )
ui->checkBoxWatchForChanges->setChecked( s->watchForChanges() ); ui->checkBoxWatchForChanges->setChecked( s->watchForChanges() );
ui->scannerTimeSpinBox->setValue( s->scannerTime() ); ui->scannerTimeSpinBox->setValue( s->scannerTime() );
if ( s->scannerMode() == TomahawkSettings::Files ) if ( s->scannerMode() == TomahawkSettings::Files )
ui->scannerFileModeButton->setChecked( true ); {
else
ui->scannerDirModeButton->setChecked( false ); 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->checkBoxWatchForChanges, SIGNAL( clicked( bool ) ), SLOT( updateScanOptionsView() ) );
connect( ui->scannerDirModeButton, SIGNAL( clicked( bool ) ), SLOT( updateScanOptionsView() ) ); connect( ui->scannerDirModeButton, SIGNAL( clicked( bool ) ), SLOT( updateScanOptionsView() ) );
connect( ui->scannerFileModeButton, 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->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 ); 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 // NOW PLAYING
#ifdef Q_WS_MAC #ifdef Q_WS_MAC