1 /*
2  * Cantata
3  *
4  * Copyright (c) 2011-2020 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 DEVICEPROPERTIESWIDGET_H
25 #define DEVICEPROPERTIESWIDGET_H
26 
27 #include "ui_devicepropertieswidget.h"
28 #include "device.h"
29 #include "support/utils.h"
30 
31 class FilenameSchemeDialog;
32 class DevicePropertiesWidget : public QWidget, Ui::DevicePropertiesWidget
33 {
34     Q_OBJECT
35 
36 public:
37     enum Properties {
38         Prop_Basic       = 0x0000,
39 
40         Prop_Name        = 0x0001,
41         Prop_Folder      = 0x0002,
42         Prop_FileName    = 0x0004,
43         Prop_CoversAll   = 0x0008,
44         Prop_CoversBasic = 0x0010,
45         Prop_Va          = 0x0020,
46         Prop_Transcoder  = 0x0040,
47         Prop_Cache       = 0x0080,
48         Prop_AutoScan    = 0x0100,
49 
50         Prop_Encoder     = 0x0200,
51 
52         Prop_All         = 0x03FF
53     };
54     DevicePropertiesWidget(QWidget *parent);
~DevicePropertiesWidget()55     ~DevicePropertiesWidget() override { }
56     void update(const QString &path, const DeviceOptions &opts, const QList<DeviceStorage> &storage, int props, int disabledProps);
57     DeviceOptions settings();
isModified()58     bool isModified() const { return modified; }
isSaveable()59     bool isSaveable() const { return saveable; }
music()60     QString music() const { return musicFolder && musicFolder->isEnabled() ? Utils::convertPathFromDisplay(musicFolder->text()) : origMusicFolder; }
61     QString cover() const;
showRemoteConnectionNote(bool v)62     void showRemoteConnectionNote(bool v) { remoteDeviceNote->setVisible(v); }
63 
64 Q_SIGNALS:
65     void updated();
66 
67 private Q_SLOTS:
68     void configureFilenameScheme();
69     void checkSaveable();
70     void transcoderChanged();
71     void albumCoversChanged();
72     void setSize();
73 
74 private:
75     FilenameSchemeDialog *schemeDlg;
76     DeviceOptions origOpts;
77     QString origMusicFolder;
78     QString noCoverText;
79     QString embedCoverText;
80     bool modified;
81     bool saveable;
82 };
83 
84 #endif
85