1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-04-14 13:01:53 +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)
#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

View File

@ -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