Add URL label if mopidy is used
This commit is contained in:
committed by
craig.p.drummond
parent
e53c40c1a8
commit
4e2e6ca759
@@ -55,6 +55,11 @@
|
||||
#include <QDBusConnection>
|
||||
#endif
|
||||
|
||||
#define REMOVE(w) \
|
||||
w->setVisible(false); \
|
||||
w->deleteLater(); \
|
||||
w=0
|
||||
|
||||
static int iCount=0;
|
||||
|
||||
int ActionDialog::instanceCount()
|
||||
@@ -175,6 +180,15 @@ void ActionDialog::showSongs()
|
||||
songDialog->show();
|
||||
}
|
||||
|
||||
void ActionDialog::showMopidyMessage()
|
||||
{
|
||||
MessageBox::information(this, i18n("Cantata has detected that you are connected to a Mopidy server.\n\n"
|
||||
"Currently it is not possible for Cantata to force Mopidy to refresh its local "
|
||||
"music listing. Therefore, you will need to stop Cantata, manually refresh "
|
||||
"Mopidy's database, and restart Cantata for any changes to be active."),
|
||||
QLatin1String("Mopidy"));
|
||||
}
|
||||
|
||||
void ActionDialog::hideSongs()
|
||||
{
|
||||
if (songDialog) {
|
||||
@@ -369,6 +383,12 @@ void ActionDialog::init(const QString &srcUdi, const QString &dstUdi, const QLis
|
||||
albumsWithoutRgTags.clear();
|
||||
#endif
|
||||
updateUnity(false);
|
||||
|
||||
if ((Remove==m && srcUdi.isEmpty()) || (Copy==m && !srcUdi.isEmpty())) {
|
||||
connect(mopidyNote, SIGNAL(leftClickedUrl()), SLOT(showMopidyMessage()));
|
||||
} else {
|
||||
REMOVE(mopidyNote);
|
||||
}
|
||||
}
|
||||
|
||||
void ActionDialog::slotButtonClicked(int button)
|
||||
|
||||
@@ -76,6 +76,7 @@ private Q_SLOTS:
|
||||
void cacheSaved();
|
||||
void controlInfoLabel();
|
||||
void showSongs();
|
||||
void showMopidyMessage();
|
||||
|
||||
private:
|
||||
void hideSongs();
|
||||
|
||||
@@ -143,28 +143,35 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="codecLabel">
|
||||
<property name="text">
|
||||
<string>Destination format:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<item row="3" column="1">
|
||||
<widget class="QLabel" name="codec">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<item row="4" column="1">
|
||||
<widget class="QCheckBox" name="overwrite">
|
||||
<property name="text">
|
||||
<string>Overwrite songs</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="songCountLabel">
|
||||
<property name="text">
|
||||
<string>To copy:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<item row="5" column="1">
|
||||
<widget class="UrlLabel" name="songCount">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
|
||||
@@ -174,10 +181,10 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QCheckBox" name="overwrite">
|
||||
<property name="text">
|
||||
<string>Overwrite songs</string>
|
||||
<item row="6" column="0" colspan="2">
|
||||
<widget class="UrlLabel" name="mopidyNote">
|
||||
<property name="text" stdset="0">
|
||||
<string><i><b>NOTE:</b> Connected to a Mopidy server (manual update required).</i></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
||||
@@ -104,10 +104,12 @@ TagEditor::TagEditor(QWidget *parent, const QList<Song> &songs,
|
||||
return;
|
||||
}
|
||||
|
||||
bool isMopidy=false;
|
||||
#ifdef ENABLE_DEVICES_SUPPORT
|
||||
if (deviceUdi.isEmpty()) {
|
||||
baseDir=MPDConnection::self()->getDetails().dir;
|
||||
composerSupport=MPDConnection::self()->composerTagSupported();
|
||||
isMopidy=MPDConnection::self()->isMopdidy();
|
||||
} else {
|
||||
Device *dev=getDevice(udi, parentWidget());
|
||||
|
||||
@@ -121,6 +123,7 @@ TagEditor::TagEditor(QWidget *parent, const QList<Song> &songs,
|
||||
#else
|
||||
baseDir=MPDConnection::self()->getDetails().dir;
|
||||
composerSupport=MPDConnection::self()->composerTagSupported();
|
||||
isMopidy=MPDConnection::self()->isMopdidy();
|
||||
#endif
|
||||
qSort(original);
|
||||
|
||||
@@ -130,6 +133,11 @@ TagEditor::TagEditor(QWidget *parent, const QList<Song> &songs,
|
||||
|
||||
QWidget *mainWidet = new QWidget(this);
|
||||
setupUi(mainWidet);
|
||||
if (isMopidy) {
|
||||
connect(mopidyNote, SIGNAL(leftClickedUrl()), SLOT(showMopidyMessage()));
|
||||
} else {
|
||||
REMOVE(mopidyNote);
|
||||
}
|
||||
setMainWidget(mainWidet);
|
||||
ButtonCodes buttons=Ok|Cancel|Reset|User3;
|
||||
if (songs.count()>1) {
|
||||
@@ -700,6 +708,15 @@ void TagEditor::setIndex(int idx)
|
||||
updating=false;
|
||||
}
|
||||
|
||||
void TagEditor::showMopidyMessage()
|
||||
{
|
||||
MessageBox::information(this, i18n("Cantata has detected that you are connected to a Mopidy server.\n\n"
|
||||
"Currently it is not possible for Cantata to force Mopidy to refresh its local "
|
||||
"music listing. Therefore, you will need to stop Cantata, manually refresh "
|
||||
"Mopidy's database, and restart Cantata for any changes to be active."),
|
||||
QLatin1String("Mopidy"));
|
||||
}
|
||||
|
||||
bool TagEditor::applyUpdates()
|
||||
{
|
||||
bool skipFirst=original.count()>1;
|
||||
@@ -806,17 +823,10 @@ bool TagEditor::applyUpdates()
|
||||
emit update();
|
||||
}
|
||||
|
||||
if (MPDConnection::self()->isMopdidy()) {
|
||||
MessageBox::information(this, i18n("Cantata has detected that you are connected to a Mopidy server.\n\n"
|
||||
"In order for Mopidy to notice the changes you have made, you will need "
|
||||
"to manually update its database. After this, restart Cantata."));
|
||||
MusicLibraryModel::self()->removeCache();
|
||||
}
|
||||
|
||||
if (renameFiles &&
|
||||
MessageBox::Yes==MessageBox::questionYesNo(this, i18n("Would you also like to rename your song files, so as to match your tags?"),
|
||||
i18n("Rename Files"), GuiItem(i18n("Rename")), StdGuiItem::cancel())) {
|
||||
TrackOrganiser *dlg=new TrackOrganiser(parentWidget(), false);
|
||||
TrackOrganiser *dlg=new TrackOrganiser(parentWidget());
|
||||
dlg->show(updatedSongs, udi);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,6 +74,7 @@ private Q_SLOTS:
|
||||
void updateEdited(bool isFromAll=false);
|
||||
void setSong(const Song &s);
|
||||
void setIndex(int idx);
|
||||
void showMopidyMessage();
|
||||
|
||||
private:
|
||||
QString baseDir;
|
||||
|
||||
@@ -151,6 +151,13 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="UrlLabel" name="mopidyNote">
|
||||
<property name="text" stdset="0">
|
||||
<string><i><b>NOTE:</b> Connected to a Mopidy server (manual update required).</i></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QProgressBar" name="progress"/>
|
||||
</item>
|
||||
@@ -182,6 +189,11 @@
|
||||
<extends>QLabel</extends>
|
||||
<header>statelabel.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>UrlLabel</class>
|
||||
<extends>QLabel</extends>
|
||||
<header>urllabel.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<tabstops>
|
||||
<tabstop>trackName</tabstop>
|
||||
|
||||
@@ -42,6 +42,11 @@
|
||||
#include <QFile>
|
||||
#include <QDir>
|
||||
|
||||
#define REMOVE(w) \
|
||||
w->setVisible(false); \
|
||||
w->deleteLater(); \
|
||||
w=0;
|
||||
|
||||
static int iCount=0;
|
||||
|
||||
int TrackOrganiser::instanceCount()
|
||||
@@ -49,13 +54,12 @@ int TrackOrganiser::instanceCount()
|
||||
return iCount;
|
||||
}
|
||||
|
||||
TrackOrganiser::TrackOrganiser(QWidget *parent, bool showMopidyWarning)
|
||||
TrackOrganiser::TrackOrganiser(QWidget *parent)
|
||||
: SongDialog(parent, "TrackOrganiser", QSize(800, 500))
|
||||
, schemeDlg(0)
|
||||
, autoSkip(false)
|
||||
, paused(false)
|
||||
, updated(false)
|
||||
, warnIfMopidy(showMopidyWarning)
|
||||
{
|
||||
iCount++;
|
||||
setButtons(Ok|Cancel);
|
||||
@@ -98,10 +102,12 @@ void TrackOrganiser::show(const QList<Song> &songs, const QString &udi)
|
||||
}
|
||||
|
||||
QString musicFolder;
|
||||
bool isMopidy=false;
|
||||
#ifdef ENABLE_DEVICES_SUPPORT
|
||||
if (udi.isEmpty()) {
|
||||
musicFolder=MPDConnection::self()->getDetails().dir;
|
||||
opts.load(MPDConnectionDetails::configGroupName(MPDConnection::self()->getDetails().name), true);
|
||||
isMopidy=MPDConnection::self()->isMopdidy();
|
||||
} else {
|
||||
deviceUdi=udi;
|
||||
Device *dev=getDevice(parentWidget());
|
||||
@@ -117,6 +123,7 @@ void TrackOrganiser::show(const QList<Song> &songs, const QString &udi)
|
||||
#else
|
||||
opts.load(MPDConnectionDetails::configGroupName(MPDConnection::self()->getDetails().name), true);
|
||||
musicFolder=MPDConnection::self()->getDetails().dir;
|
||||
isMopidy=MPDConnection::self()->isMopdidy();
|
||||
#endif
|
||||
qSort(origSongs);
|
||||
|
||||
@@ -135,7 +142,11 @@ void TrackOrganiser::show(const QList<Song> &songs, const QString &udi)
|
||||
if (!songsOk(origSongs, musicFolder, udi.isEmpty())) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (isMopidy) {
|
||||
connect(mopidyNote, SIGNAL(leftClickedUrl()), SLOT(showMopidyMessage()));
|
||||
} else {
|
||||
REMOVE(mopidyNote);
|
||||
}
|
||||
Dialog::show();
|
||||
enableButtonOk(false);
|
||||
updateView();
|
||||
@@ -428,17 +439,18 @@ void TrackOrganiser::removeItems()
|
||||
}
|
||||
}
|
||||
|
||||
void TrackOrganiser::showMopidyMessage()
|
||||
{
|
||||
MessageBox::information(this, i18n("Cantata has detected that you are connected to a Mopidy server.\n\n"
|
||||
"Currently it is not possible for Cantata to force Mopidy to refresh its local "
|
||||
"music listing. Therefore, you will need to stop Cantata, manually refresh "
|
||||
"Mopidy's database, and restart Cantata for any changes to be active."),
|
||||
QLatin1String("Mopidy"));
|
||||
}
|
||||
|
||||
void TrackOrganiser::finish(bool ok)
|
||||
{
|
||||
if (updated) {
|
||||
if (warnIfMopidy && MPDConnection::self()->isMopdidy()) {
|
||||
MessageBox::information(this, i18n("Cantata has detected that you are connected to a Mopidy server.\n\n"
|
||||
"In order for Mopidy to notice the changes you have made, you will need "
|
||||
"to manually update its database. After this, restart Cantata."));
|
||||
MusicLibraryModel::self()->removeCache();
|
||||
DirViewModel::self()->removeCache();
|
||||
}
|
||||
|
||||
if (deviceUdi.isEmpty()) {
|
||||
emit update();
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ class TrackOrganiser : public SongDialog, Ui::TrackOrganiser
|
||||
public:
|
||||
static int instanceCount();
|
||||
|
||||
TrackOrganiser(QWidget *parent, bool showMopidyWarning=true);
|
||||
TrackOrganiser(QWidget *parent);
|
||||
virtual ~TrackOrganiser();
|
||||
|
||||
void show(const QList<Song> &songs, const QString &udi);
|
||||
@@ -59,6 +59,7 @@ private Q_SLOTS:
|
||||
void renameFile();
|
||||
void controlRemoveAct();
|
||||
void removeItems();
|
||||
void showMopidyMessage();
|
||||
|
||||
private:
|
||||
void slotButtonClicked(int button);
|
||||
@@ -77,7 +78,6 @@ private:
|
||||
bool autoSkip;
|
||||
bool paused;
|
||||
bool updated;
|
||||
bool warnIfMopidy;
|
||||
DeviceOptions opts;
|
||||
};
|
||||
|
||||
|
||||
@@ -124,6 +124,13 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="UrlLabel" name="mopidyNote">
|
||||
<property name="text" stdset="0">
|
||||
<string><i><b>NOTE:</b> Connected to a Mopidy server (manual update required).</i></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QProgressBar" name="progress"/>
|
||||
</item>
|
||||
@@ -140,6 +147,11 @@
|
||||
<extends>QLabel</extends>
|
||||
<header>buddylabel.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>UrlLabel</class>
|
||||
<extends>QLabel</extends>
|
||||
<header>urllabel.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<tabstops>
|
||||
<tabstop>vfatSafe</tabstop>
|
||||
|
||||
Reference in New Issue
Block a user