-
Notifications
You must be signed in to change notification settings - Fork 345
/
smartplaylist.h
314 lines (231 loc) · 6.96 KB
/
smartplaylist.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
#ifndef SMARTPLAYLIST_H_
#define SMARTPLAYLIST_H_
// c/c++
#include <vector>
class MythUIButton;using namespace std;
// qt
#include <QDateTime>
#include <QVariant>
#include <QKeyEvent>
// mythtv
#include <mythscreentype.h>
struct SmartPLOperator;
struct SmartPLField;
enum SmartPLFieldType
{
ftString = 1,
ftNumeric,
ftDate,
ftBoolean
};
// used by playlist.cpp
QString getCriteriaSQL(QString fieldName, QString operatorName,
QString value1, QString value2);
QString getSQLFieldName(QString orderBy);
QString getOrderBySQL(QString orderByFields);
// used by playbackbox.cpp
QString formattedFieldValue(const QVariant &value);
/*
/////////////////////////////////////////////////////////////////////////////
*/
class SmartPLCriteriaRow
{
public:
SmartPLCriteriaRow(const QString &_Field, const QString &_Operator,
const QString &_Value1, const QString &_Value2);
SmartPLCriteriaRow(void);
~SmartPLCriteriaRow(void);
QString getSQL(void);
bool saveToDatabase(int smartPlaylistID);
QString toString(void);
public:
QString Field;
QString Operator;
QString Value1;
QString Value2;
};
Q_DECLARE_METATYPE(SmartPLCriteriaRow *)
class SmartPlaylistEditor : public MythScreenType
{
Q_OBJECT
public:
SmartPlaylistEditor(MythScreenStack *parent);
~SmartPlaylistEditor(void);
bool Create(void);
bool keyPressEvent(QKeyEvent *event);
void customEvent(QEvent *event);
QString getSQL(QString fields);
QString getWhereClause(void);
QString getOrderByClause(void);
void getCategoryAndName(QString &category, QString &name);
void newSmartPlaylist(QString category);
void editSmartPlaylist(QString category, QString name);
static bool deleteSmartPlaylist(QString category, QString name);
static bool deleteCategory(QString category);
static int lookupCategoryID(QString category);
signals:
void smartPLChanged(const QString &category, const QString &name);
protected slots:
void titleChanged(void);
void updateMatches(void);
// void categoryClicked(void);
void saveClicked(void);
void showResultsClicked(void);
void showCategoryMenu(void);
void showCriteriaMenu(void);
void newCategory(const QString &category);
void startDeleteCategory(const QString &category);
void renameCategory(const QString &category);
// void categoryEditChanged(void);
void orderByClicked(void);
void editCriteria(void);
void addCriteria(void);
void deleteCriteria(void);
void doDeleteCriteria(bool doit);
void criteriaChanged();
void orderByChanged(QString orderBy);
private:
void getSmartPlaylistCategories(void);
void loadFromDatabase(QString category, QString name);
QList<SmartPLCriteriaRow*> m_criteriaRows;
SmartPLCriteriaRow* m_tempCriteriaRow;
int m_matchesCount;
bool m_newPlaylist;
bool m_playlistIsValid;
QString m_originalCategory;
QString m_originalName;
// gui stuff
MythUIButtonList *m_categorySelector;
MythUIButton *m_categoryButton;
MythUITextEdit *m_titleEdit;
MythUIButtonList *m_matchSelector;
MythUIButtonList *m_criteriaList;
MythUIButtonList *m_orderBySelector;
MythUIButton *m_orderByButton;
MythUIText *m_matchesText;
MythUISpinBox *m_limitSpin;
MythUIButton *m_cancelButton;
MythUIButton *m_saveButton;
MythUIButton *m_showResultsButton;
};
class CriteriaRowEditor : public MythScreenType
{
Q_OBJECT
public:
CriteriaRowEditor(MythScreenStack *parent, SmartPLCriteriaRow *row);
~CriteriaRowEditor(void);
bool Create(void);
protected slots:
void fieldChanged(void);
void operatorChanged(void);
void valueEditChanged(void);
void valueButtonClicked(void);
void setValue(QString value);
void setDate(QString date);
void saveClicked(void);
signals:
void criteriaChanged();
private:
void updateFields(void);
void updateOperators(void);
void updateValues(void);
void enableSaveButton(void);
void getOperatorList(SmartPLFieldType fieldType);
void editDate(void);
SmartPLCriteriaRow* m_criteriaRow;
QStringList m_searchList;
// gui stuff
MythUIButtonList *m_fieldSelector;
MythUIButtonList *m_operatorSelector;
MythUITextEdit *m_value1Edit;
MythUITextEdit *m_value2Edit;
MythUIButtonList *m_value1Selector;
MythUIButtonList *m_value2Selector;
MythUISpinBox *m_value1Spinbox;
MythUISpinBox *m_value2Spinbox;
MythUIButton *m_value1Button;
MythUIButton *m_value2Button;
MythUIText *m_andText;
MythUIButton *m_cancelButton;
MythUIButton *m_saveButton;
};
class SmartPLResultViewer : public MythScreenType
{
Q_OBJECT
public:
SmartPLResultViewer(MythScreenStack *parent);
~SmartPLResultViewer(void);
bool Create(void);
bool keyPressEvent(QKeyEvent *event);
void setSQL(QString sql);
private slots:
void trackVisible(MythUIButtonListItem *item);
void trackSelected(MythUIButtonListItem *item);
private:
void showTrackInfo(void);
MythUIButtonList *m_trackList;
MythUIText *m_positionText;
};
class SmartPLOrderByDialog: public MythScreenType
{
Q_OBJECT
public:
SmartPLOrderByDialog(MythScreenStack *parent);
~SmartPLOrderByDialog();
bool Create(void);
QString getFieldList(void);
void setFieldList(const QString &fieldList);
signals:
void orderByChanged(QString orderBy);
protected slots:
void addPressed(void);
void deletePressed(void);
void moveUpPressed(void);
void moveDownPressed(void);
void ascendingPressed(void);
void descendingPressed(void);
void okPressed(void);
void orderByChanged(void);
void fieldListSelectionChanged(MythUIButtonListItem *item);
private:
void getOrderByFields(void);
MythUIButtonList *m_fieldList;
MythUIButtonList *m_orderSelector;
MythUIButton *m_addButton;
MythUIButton *m_deleteButton;
MythUIButton *m_moveUpButton;
MythUIButton *m_moveDownButton;
MythUIButton *m_ascendingButton;
MythUIButton *m_descendingButton;
MythUIButton *m_cancelButton;
MythUIButton *m_okButton;
};
class SmartPLDateDialog: public MythScreenType
{
Q_OBJECT
public:
SmartPLDateDialog(MythScreenStack *parent);
~SmartPLDateDialog();
bool Create(void);
QString getDate(void);
void setDate(QString date);
signals:
void dateChanged(QString date);
protected slots:
void okPressed(void);
void fixedCheckToggled(bool on);
void nowCheckToggled(bool on);
void valueChanged(void);
private:
bool m_updating;
MythUICheckBox *m_fixedRadio;
MythUISpinBox *m_daySpin;
MythUISpinBox *m_monthSpin;
MythUISpinBox *m_yearSpin;
MythUICheckBox *m_nowRadio;
MythUISpinBox *m_addDaysSpin;
MythUIText *m_statusText;
MythUIButton *m_cancelButton;
MythUIButton *m_okButton;
};
#endif