Set 'store XXX in music folder' options in wizard
This commit is contained in:
committed by
craig.p.drummond
parent
93142f1386
commit
fa5ef5293d
@@ -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();
|
||||
}
|
||||
|
||||
@@ -297,6 +297,155 @@
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWizardPage" name="filesPage">
|
||||
<layout class="QGridLayout" name="gridLayoutf">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_6f">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Covers, Lyrics, and Streams</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<spacer name="verticalSpacer_9f">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>16</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="2">
|
||||
<widget class="QLabel" name="label_5f">
|
||||
<property name="text">
|
||||
<string><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></string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<spacer name="verticalSpacer_7f">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>8</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="4" column="0" colspan="2">
|
||||
<layout class="QFormLayout" name="filesFormLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="BuddyLabel" name="storeCoversInMpdDirLabel">
|
||||
<property name="text">
|
||||
<string>Save downloaded covers in music folder:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>storeCoversInMpdDir</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="OnOffButton" name="storeCoversInMpdDir"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="BuddyLabel" name="storeLyricsInMpdDirLabel">
|
||||
<property name="text">
|
||||
<string>Save downloaded lyrics in music folder:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>storeLyricsInMpdDir</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="OnOffButton" name="storeLyricsInMpdDir">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="storeStreamsInMpdDirLabel">
|
||||
<property name="text">
|
||||
<string>Save list of streams in music folder:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>storeStreamsInMpdDir</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="OnOffButton" name="storeStreamsInMpdDir">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<spacer name="verticalSpacer_7f2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>8</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="6" column="0" colspan="2">
|
||||
<widget class="QLabel" name="httpNote">
|
||||
<property name="text">
|
||||
<string><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></string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0" colspan="2">
|
||||
<spacer name="verticalSpacer_8f">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>352</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWizardPage" name="wizardPage">
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
@@ -405,6 +554,11 @@
|
||||
<extends>QLineEdit</extends>
|
||||
<header>lineedit.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>OnOffButton</class>
|
||||
<extends>QcheckBox</extends>
|
||||
<header>onoffbutton.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>PathRequester</class>
|
||||
<extends>QLineEdit</extends>
|
||||
|
||||
Reference in New Issue
Block a user