1 /*
2  * Cantata
3  *
4  * Copyright (c) 2011-2014 Craig Drummond <craig.p.drummond@gmail.com>
5  *
6  * ----
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  * General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; see the file COPYING.  If not, write to
20  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21  * Boston, MA 02110-1301, USA.
22  */
23 
24 #ifndef _SYNC_DIALOG_H_
25 #define _SYNC_DIALOG_H_
26 
27 #include "support/dialog.h"
28 #include "mpd-interface/song.h"
29 #include "deviceoptions.h"
30 
31 class Device;
32 class SyncCollectionWidget;
33 class SqueezedTextLabel;
34 
35 class SyncDialog : public Dialog
36 {
37     Q_OBJECT
38 
39     enum State {
40         State_Lists,
41         State_CopyToDevice,
42         State_CopyToLib
43     };
44 
45 public:
46     static int instanceCount();
47 
48     SyncDialog(QWidget *parent);
49     ~SyncDialog() override;
50 
51     void sync(const QString &udi);
52 
53 private Q_SLOTS:
54     void copy(const QList<Song> &songs);
55     void librarySongs(const QList<Song> &songs, double pc);
56     void selectionChanged();
57     void configure();
58     void saveProperties(const QString &path, const DeviceOptions &opts);
59 
60 private:
61     void updateSongs();
62     void slotButtonClicked(int button) override;
63     Device * getDevice();
64 
65 private:
66     State state;
67     SqueezedTextLabel *statusLabel;
68     QString devUdi;
69     Device *currentDev;
70     SyncCollectionWidget *devWidget;
71     SyncCollectionWidget *libWidget;
72     QSet<Song> libSongs;
73     DeviceOptions libOptions;
74 };
75 
76 #endif
77