Show number of songs to be copied on action dialog. Make number a link, when clicked produce a dialog showing list.

This commit is contained in:
craig.p.drummond
2013-05-30 18:08:06 +00:00
committed by craig.p.drummond
parent 7ee7bbb56d
commit 7f531f1398
4 changed files with 75 additions and 0 deletions

View File

@@ -33,6 +33,8 @@
21. Use checkboxes in sync dialog to mark songs to be copied.
22. Show number of selected artists, albums, and songs in sync dialog.
23. Save sync dialog size.
24. Show number of songs to be copied on action dialog. Make number a link,
when clicked produce a dialog showing list.
1.0.3
-----

View File

@@ -29,6 +29,7 @@
#include "devicepropertieswidget.h"
#include "settings.h"
#include "musiclibrarymodel.h"
#include "musiclibraryproxymodel.h"
#include "dirviewmodel.h"
#include "albumsmodel.h"
#include "mpdparseutils.h"
@@ -41,6 +42,7 @@
#include "icons.h"
#include "config.h"
#include "tags.h"
#include "treeview.h"
#ifdef ENABLE_ONLINE_SERVICES
#include "onlineservicesmodel.h"
#endif
@@ -64,10 +66,35 @@ enum Pages
PAGE_PROGRESS
};
class SongDialog : public Dialog
{
public:
SongDialog(ActionDialog *p)
: Dialog(p) {
setCaption(i18n("Songs To Be Copied"));
setButtons(Close);
MusicLibraryModel *model=new MusicLibraryModel(this, false);
MusicLibraryProxyModel *proxy=new MusicLibraryProxyModel(this);
proxy->setSourceModel(model);
model->setUseAlbumImages(false);
model->setUseArtistImages(false);
model->setSupportsAlbumArtistTag(true);
TreeView *view=new TreeView(this);
view->setPageDefaults();
view->setModel(model);
model->update(p->songsToAction.toSet());
setMainWidget(view);
int size=fontMetrics().height();
int numArtists=model->rowCount();
resize(20*size, qMin(qMax(10, numArtists)+4, 25)*(size*1.25));
}
};
ActionDialog::ActionDialog(QWidget *parent)
: Dialog(parent)
, mpdConfigured(false)
, currentDev(0)
, songDialog(0)
{
iCount++;
setButtons(Ok|Cancel);
@@ -82,6 +109,7 @@ ActionDialog::ActionDialog(QWidget *parent)
connect(configureSourceButton, SIGNAL(clicked()), SLOT(configureSource()));
connect(configureDestButton, SIGNAL(clicked()), SLOT(configureDest()));
connect(this, SIGNAL(update()), MPDConnection::self(), SLOT(update()));
connect(songCount, SIGNAL(leftClickedUrl()), SLOT(showSongs()));
}
ActionDialog::~ActionDialog()
@@ -128,6 +156,23 @@ void ActionDialog::controlInfoLabel(Device *dev)
}
}
void ActionDialog::showSongs()
{
if (!songDialog) {
songDialog=new SongDialog(this);
}
songDialog->show();
}
void ActionDialog::hideSongs()
{
if (songDialog) {
songDialog->setVisible(false);
songDialog->deleteLater();
songDialog=0;
}
}
void ActionDialog::controlInfoLabel()
{
controlInfoLabel(getDevice(sourceUdi.isEmpty() ? destUdi : sourceUdi));
@@ -208,6 +253,9 @@ void ActionDialog::copy(const QString &srcUdi, const QString &dstUdi, const QLis
//configureSourceLabel->setVisible(!isFromOnline && ((!destIsDev && !dev->isConfigured()) || (destIsDev && !mpdConfigured)));
configureSourceButton->setVisible(false);
configureSourceLabel->setVisible(false);
songCount->setVisible(!sourceIsAudioCd);
songCountLabel->setVisible(!sourceIsAudioCd);
songCount->setText(QString::number(songs.count()));
show();
if (!enoughSpace) {
MessageBox::information(this, i18n("There is insufficient space left on the destination device.\n"
@@ -230,6 +278,8 @@ void ActionDialog::remove(const QString &udi, const QList<Song> &songs)
init(udi, QString(), songs, Remove);
codecLabel->setVisible(false);
codec->setVisible(false);
songCountLabel->setVisible(false);
songCount->setVisible(false);
QString baseDir;
if (udi.isEmpty()) {
@@ -302,6 +352,7 @@ void ActionDialog::slotButtonClicked(int button)
}
Settings::self()->saveOverwriteSongs(overwrite->isChecked());
setPage(PAGE_PROGRESS);
hideSongs();
#ifdef ACTION_DIALOG_SHOW_TIME_REMAINING
timer.start();
#endif

View File

@@ -30,6 +30,8 @@
#include "ui_actiondialog.h"
#include <QElapsedTimer>
class SongDialog;
class ActionDialog : public Dialog, Ui::ActionDialog
{
Q_OBJECT
@@ -67,8 +69,10 @@ private Q_SLOTS:
void jobPercent(int percent);
void cacheSaved();
void controlInfoLabel();
void showSongs();
private:
void hideSongs();
void controlInfoLabel(Device *dev);
Device * getDevice(const QString &udi, bool logErrors=true);
void configure(const QString &udi);
@@ -112,6 +116,9 @@ private:
#ifdef ENABLE_REPLAYGAIN_SUPPORT
QSet<QString> albumsWithoutRgTags;
#endif
SongDialog *songDialog;
friend class SongDialog;
};
#endif

View File

@@ -165,6 +165,16 @@
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QLabel" name="songCountLabel">
<property name="text">
<string>Songs to copy:</string>
</property>
</widget>
</item>
<item row="6" column="1">
<widget class="UrlLabel" name="songCount"/>
</item>
</layout>
</widget>
<widget class="QWidget" name="page_3">
@@ -356,6 +366,11 @@
<extends>QLabel</extends>
<header>buddylabel.h</header>
</customwidget>
<customwidget>
<class>UrlLabel</class>
<extends>QLabel</extends>
<header>urllabel.h</header>
</customwidget>
</customwidgets>
<tabstops>
<tabstop>configureDestButton</tabstop>