diff --git a/gui/initialsettingswizard.cpp b/gui/initialsettingswizard.cpp index aa83742d2..8e243c1cd 100644 --- a/gui/initialsettingswizard.cpp +++ b/gui/initialsettingswizard.cpp @@ -30,6 +30,13 @@ static const int constIconSize=48; +enum Pages { + PAGE_INTRO, + PAGE_CONNECTION, + PAGE_FILES, + PAGE_END +}; + InitialSettingsWizard::InitialSettingsWizard(QWidget *p) : QWizard(p) { @@ -55,6 +62,9 @@ InitialSettingsWizard::InitialSettingsWizard(QWidget *p) groupWarningLabel->setVisible(showGroupWarning); groupWarningIcon->setVisible(showGroupWarning); groupWarningIcon->setPixmap(Icon("dialog-warning").pixmap(constIconSize, constIconSize)); + storeCoversInMpdDir->setChecked(Settings::self()->storeCoversInMpdDir()); + storeLyricsInMpdDir->setChecked(Settings::self()->storeLyricsInMpdDir()); + storeStreamsInMpdDir->setChecked(Settings::self()->storeStreamsInMpdDir()); } InitialSettingsWizard::~InitialSettingsWizard() @@ -67,7 +77,7 @@ MPDConnectionDetails InitialSettingsWizard::getDetails() det.hostname=host->text().trimmed(); det.port=port->value(); det.password=password->text(); - det.dir=dir->text(); + det.dir=dir->text().trimmed(); det.dirReadable=det.dir.isEmpty() ? false : QDir(det.dir).isReadable(); det.dynamizerPort=0; return det; @@ -81,7 +91,7 @@ void InitialSettingsWizard::connectToMpd() void InitialSettingsWizard::mpdConnectionStateChanged(bool c) { statusLabel->setText(c ? i18n("Connection Established") : i18n("Connection Failed")); - if (1==currentId()) { + if (PAGE_CONNECTION==currentId()) { controlNextButton(); } } @@ -94,13 +104,24 @@ void InitialSettingsWizard::showError(const QString &message, bool showActions) void InitialSettingsWizard::pageChanged(int p) { - if (1==p) { + if (PAGE_CONNECTION==p) { controlNextButton(); - } else { - button(NextButton)->setEnabled(0==p); + return; } + if (PAGE_FILES==p) { + if (dir->text().trimmed().startsWith(QLatin1String("http:/"))) { + storeCoversInMpdDir->setChecked(false); + storeLyricsInMpdDir->setChecked(false); + storeStreamsInMpdDir->setChecked(false); + httpNote->setVisible(true); + } else { + httpNote->setVisible(false); + } + } + button(NextButton)->setEnabled(PAGE_END!=p); } + void InitialSettingsWizard::controlNextButton() { bool isOk=MPDConnection::self()->isConnected(); @@ -108,7 +129,7 @@ void InitialSettingsWizard::controlNextButton() if (isOk) { MPDConnectionDetails det=getDetails(); MPDConnectionDetails mpdDet=MPDConnection::self()->getDetails(); - isOk=det.hostname==mpdDet.hostname && det.dir==mpdDet.dir && (det.isLocal() || det.port==mpdDet.port); + isOk=det.hostname==mpdDet.hostname && (det.isLocal() || det.port==mpdDet.port); } button(NextButton)->setEnabled(isOk); @@ -117,6 +138,9 @@ void InitialSettingsWizard::controlNextButton() void InitialSettingsWizard::accept() { Settings::self()->saveConnectionDetails(getDetails()); + Settings::self()->saveStoreCoversInMpdDir(storeCoversInMpdDir->isChecked()); + Settings::self()->saveStoreLyricsInMpdDir(storeLyricsInMpdDir->isChecked()); + Settings::self()->saveStoreStreamsInMpdDir(storeStreamsInMpdDir->isChecked()); Settings::self()->save(true); QDialog::accept(); } diff --git a/gui/initialsettingswizard.ui b/gui/initialsettingswizard.ui index d1590e0a3..cd152cef2 100644 --- a/gui/initialsettingswizard.ui +++ b/gui/initialsettingswizard.ui @@ -297,6 +297,155 @@ + + + + + + + 75 + true + + + + Covers, Lyrics, and Streams + + + + + + + Qt::Vertical + + + QSizePolicy::Fixed + + + + 20 + 16 + + + + + + + + <p>Cantata will download missing covers, and lyrics, from the internet. Cantata also allows you to save a list of internet streams that you wish to be able to playback.</p><p>For each of these, please confirm whether you wish Cantata to store the relevant files within the music folder, or within the cache/config folders in your home folder.</p> + + + true + + + + + + + Qt::Vertical + + + QSizePolicy::Fixed + + + + 20 + 8 + + + + + + + + + + Save downloaded covers in music folder: + + + storeCoversInMpdDir + + + + + + + + + + Save downloaded lyrics in music folder: + + + storeLyricsInMpdDir + + + + + + + + + + + + + + Save list of streams in music folder: + + + storeStreamsInMpdDir + + + + + + + + + + + + + + + + Qt::Vertical + + + QSizePolicy::Fixed + + + + 20 + 8 + + + + + + + + <i><b>NOTE:</b> The 'Music folder' is set to a HTTP address, and Cantata currently cannot upload files to external HTTP servers. Therefore, the above settings should be left disabled.</i> + + + true + + + + + + + Qt::Vertical + + + + 20 + 352 + + + + + + @@ -405,6 +554,11 @@ QLineEdit
lineedit.h
+ + OnOffButton + QcheckBox +
onoffbutton.h
+
PathRequester QLineEdit