Hide cover, HTTP stream, and top-level folder options under a 'Show All Options' button.

This commit is contained in:
craig.p.drummond
2015-04-03 17:44:39 +00:00
committed by craig.p.drummond
parent 6ce001a66f
commit fb8e6710ca
4 changed files with 114 additions and 10 deletions

View File

@@ -36,6 +36,8 @@
artist.
23. For Linux builds, if system tray icon is null (becasue QIcon cannot find
it) then add icon files manually.
24. Hide cover, HTTP stream, and top-level folder options under a 'Show All
Options' button.
1.5.2
-----

View File

@@ -79,6 +79,8 @@ class CollectionNameValidator : public QValidator
ServerSettings::ServerSettings(QWidget *p)
: QWidget(p)
, haveBasicCollection(false)
, isCurrentConnection(false)
, allOptions(true) // will be toggled
, prevIndex(0)
{
setupUi(this);
@@ -116,6 +118,10 @@ ServerSettings::ServerSettings(QWidget *p)
#ifdef Q_OS_MAC
expandingSpacer->changeSize(0, 0, QSizePolicy::Fixed, QSizePolicy::Fixed);
#endif
toggleOptions();
connect(settingsLevelButton, SIGNAL(clicked()), SLOT(toggleOptions()));
connect(basicSettingsLevelButton, SIGNAL(clicked()), SLOT(toggleOptions()));
}
void ServerSettings::load()
@@ -322,6 +328,27 @@ void ServerSettings::topLevelChanged()
topLevelNoteLabel->setOn(0==stackedWidget->currentIndex() && !topLevel->text().trimmed().isEmpty());
}
void ServerSettings::toggleOptions()
{
allOptions=!allOptions;
settingsLevelButton->setText(allOptions ? i18n("Show Basic Options <<") : i18n("Show All Options >>"));
basicSettingsLevelButton->setText(allOptions ? i18n("Show Basic Options <<") : i18n("Show All Options >>"));
coverName->setVisible(allOptions);
coverNameLabel->setVisible(allOptions);
coverNameNoteLabel->setVisible(allOptions);
topLevel->setVisible(allOptions);
topLevelLabel->setVisible(allOptions);
topLevelNoteLabel->setVisible(allOptions);
basicCoverName->setVisible(allOptions);
basicCoverNameLabel->setVisible(allOptions);
basicCoverNameNoteLabel->setVisible(allOptions);
if (streamUrlNoteLabel) {
streamUrl->setVisible(allOptions);
streamUrlLabel->setVisible(allOptions);
streamUrlNoteLabel->setVisible(allOptions);
}
}
QString ServerSettings::generateName(int ignore) const
{
QString n;

View File

@@ -54,6 +54,7 @@ private Q_SLOTS:
void nameChanged();
void basicDirChanged();
void topLevelChanged();
void toggleOptions();
private:
void setDetails(const MPDConnectionDetails &details);
@@ -62,9 +63,10 @@ private:
private:
QList<Collection> collections;
bool haveBasicCollection;
Collection prevBasic;
bool haveBasicCollection;
bool isCurrentConnection;
bool allOptions;
int prevIndex;
};

View File

@@ -182,34 +182,74 @@
</layout>
</item>
<item row="1" column="0" colspan="2">
<layout class="QHBoxLayout" name="settingsLevelLayout">
<property name="spacing">
<number>0</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>2</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="settingsLevelButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
</layout>
</item>
<item row="2" column="0" colspan="2">
<widget class="NoteLabel" name="musicFolderNoteLabel">
<property name="text">
<string>The 'Music folder' setting is used to lookup cover-art (either the value specified above, or &lt;code&gt;cover.jpg / cover.png&lt;/code&gt; if not set). If you also have write permissions to this folder (and it's sub-folders), then Cantata will save any downloaded covers into the respective album folder.</string>
<string>The 'Music folder' setting is used to lookup cover-art. If you also have write permissions to this folder (and it's sub-folders), then Cantata will save any downloaded covers into the respective album folder.</string>
</property>
</widget>
</item>
<item row="2" column="0" colspan="2">
<item row="3" column="0" colspan="2">
<widget class="NoteLabel" name="coverNameNoteLabel">
<property name="text">
<string>If no setting is specified for 'Cover filename', then Cantata will use a default of &lt;code&gt;cover&lt;/code&gt;</string>
</property>
</widget>
</item>
<item row="4" column="0" colspan="2">
<widget class="NoteLabel" name="socketNoteLabel">
<property name="text">
<string>When using a local socket the full absolute path to the socket needs to be set. (Port number is not required.)</string>
</property>
</widget>
</item>
<item row="3" column="0" colspan="2">
<item row="5" column="0" colspan="2">
<widget class="NoteLabel" name="topLevelNoteLabel">
<property name="text">
<string>If your MPD is configured to use a UPnP/DLNA backend, then 'Top-level music path' should be set to the 'All Music' path (e.g. servername\Music\All Music\) to prevent duplicate tracks. If this setting is used, then Cantata will only list tracks that are under this MPD path. For most MPD setups, this setting should be left blank. Changes to this setting will require a full refresh of the database.</string>
</property>
</widget>
</item>
<item row="4" column="0" colspan="2">
<item row="6" column="0" colspan="2">
<widget class="NoteLabel" name="streamUrlNoteLabel">
<property name="text">
<string>'HTTP Stream URL' is only of use if you have MPD configured to output to a HTTP stream, and you wish Cantata to be able to play that stream.</string>
</property>
</widget>
</item>
<item row="4" column="0">
<item row="7" column="0">
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
@@ -276,20 +316,53 @@
</layout>
</item>
<item row="2" column="0" colspan="4">
<layout class="QHBoxLayout" name="basicSettingsLevelLayout">
<property name="spacing">
<number>0</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item>
<spacer name="basicHorizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>2</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="basicSettingsLevelButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
</layout>
</item>
<item row="3" column="0" colspan="4">
<widget class="NoteLabel" name="basicMusicFolderNoteLabel">
<property name="text">
<string>If you change the 'Music folder' setting, then you will need to manually update the music database. This can be performed by pressing the 'Refresh Database' button in the 'Artists' or 'Albums' views.</string>
</property>
</widget>
</item>
<item row="3" column="0" colspan="4">
<widget class="NoteLabel" name="musicFolderNoteLabel_2">
<item row="4" column="0" colspan="2">
<widget class="NoteLabel" name="basicCoverNameNoteLabel">
<property name="text">
<string>If no setting is specified for 'Cover filename, then Cantata will use a default of &lt;code&gt;cover&lt;/code&gt;</string>
<string>If no setting is specified for 'Cover filename', then Cantata will use a default of &lt;code&gt;cover&lt;/code&gt;</string>
</property>
</widget>
</item>
<item row="4" column="2">
<item row="5" column="2">
<spacer name="expandingSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>