summaryrefslogtreecommitdiffstats
path: root/delegates.h
diff options
context:
space:
mode:
authorArno <am@disconnect.de>2013-07-27 03:59:47 +0200
committerArno <am@disconnect.de>2013-07-27 04:02:21 +0200
commit0afebd0e3cb3da831cd5ffba1eefbe9e61e408a1 (patch)
treee92bd13b2ddda3af1af51d25c22d5042fb635139 /delegates.h
parent46a552d89c70895abc75d94f3c647be29873afd9 (diff)
downloadSheMov-0afebd0e3cb3da831cd5ffba1eefbe9e61e408a1.tar.gz
SheMov-0afebd0e3cb3da831cd5ffba1eefbe9e61e408a1.tar.bz2
SheMov-0afebd0e3cb3da831cd5ffba1eefbe9e61e408a1.zip
Read JSON from ffprobe
Use JSON output from ffprobe instead of string parsing to get some kind of type safety. For doing that, some changes were needed in FileView: Use delegates for displaying Duration and Bitrate instead of mangling output in Qt::Displayrole. To reuse code, move all delegates from the new Archive to a separate file. And, of course, the initial objective: Show the accumulated size and duration of selected files in the status bar from the experimental archive.
Diffstat (limited to 'delegates.h')
-rw-r--r--delegates.h59
1 files changed, 59 insertions, 0 deletions
diff --git a/delegates.h b/delegates.h
new file mode 100644
index 0000000..86ee94e
--- /dev/null
+++ b/delegates.h
@@ -0,0 +1,59 @@
+/*
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License
+ as published by the Free Software Foundation; either version
+ 2 of the License, or (at your option) any later version.
+*/
+
+#ifndef DELEGATES_H
+#define DELEGATES_H
+
+#include <QString>
+#include <QWidget>
+#include <QStyleOptionViewItem>
+#include <QStyledItemDelegate>
+
+class FileNoDelegate : public QStyledItemDelegate {
+ Q_OBJECT
+ public:
+ explicit FileNoDelegate(QObject *parent = 0) : QStyledItemDelegate(parent) {}
+ virtual QString displayText(const QVariant &value, const QLocale &locale) const;
+ virtual QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const;
+};
+
+class DvdNoDelegate : public QStyledItemDelegate {
+ Q_OBJECT
+ public:
+ explicit DvdNoDelegate(QObject *parent = 0) : QStyledItemDelegate(parent) {}
+ virtual QString displayText(const QVariant &value, const QLocale &locale) const;
+};
+
+class SizeDelegate : public QStyledItemDelegate {
+ Q_OBJECT
+ public:
+ explicit SizeDelegate(QObject *parent = 0) : QStyledItemDelegate(parent) {}
+ virtual QString displayText(const QVariant &value, const QLocale &locale) const;
+};
+
+class DurationDelegate : public QStyledItemDelegate {
+ Q_OBJECT
+ public:
+ explicit DurationDelegate(QObject *parent = 0) : QStyledItemDelegate(parent) {}
+ virtual QString displayText(const QVariant &value, const QLocale &locale) const;
+};
+
+class BitrateDelegate : public QStyledItemDelegate {
+ Q_OBJECT
+ public:
+ explicit BitrateDelegate(QObject *parent = 0) : QStyledItemDelegate(parent) {}
+ virtual QString displayText(const QVariant &value, const QLocale &locale) const;
+};
+
+class EmptyDelegate : public QStyledItemDelegate {
+ Q_OBJECT
+ public:
+ explicit EmptyDelegate(QObject *parent = 0) : QStyledItemDelegate(parent) {}
+ virtual QString displayText(const QVariant &value, const QLocale &locale) const;
+};
+
+#endif // DELEGATES_H