MythTV  master
thumbview.h
Go to the documentation of this file.
1 // -*- Mode: c++ -*-
2 
3 #ifndef _THUMBVIEW_H_
4 #define _THUMBVIEW_H_
5 
6 // Qt headers
7 #include <QDateTime>
8 #include <QString>
9 #include <QList>
10 #include <QHash>
11 #include <QPixmap>
12 #include <QCoreApplication>
13 
14 class MythMediaDevice;
15 class QPixmap;
16 
17 class ThumbItem
18 {
19  Q_DECLARE_TR_FUNCTIONS (ThumbItem)
20 
21  public:
22  ThumbItem() = default;
23  ThumbItem(const QString &name, const QString &path, bool isDir,
24  MythMediaDevice *dev = nullptr) :
25  m_name(name),
26  m_path(path), m_isDir(isDir),
27  m_mediaDevice(dev) {}
28  ~ThumbItem();
29 
30  // commands
31  bool Remove(void);
32  void InitCaption(bool get_caption);
33  void InitTimestamp();
34 
35  // sets
36  void SetRotationAngle(int angle);
37  void SetName(const QString &name)
38  { m_name = name; }
39  void SetCaption(const QString &caption)
40  { m_caption = caption; }
41  void SetTimestamp(const QDateTime &timestamp)
42  { m_timestamp = timestamp; }
43  void SetPath(const QString &path, bool isDir)
44  { m_path = path; m_isDir = isDir; }
45  void SetImageFilename(const QString &filename)
46  { m_imageFilename = filename; }
47  void SetPixmap(QPixmap *pixmap);
49  { m_mediaDevice = dev; }
50 
51  // gets
52  long GetRotationAngle(void);
53  QString GetName(void) const { return m_name; }
54  bool HasCaption(void) const { return !m_caption.trimmed().isEmpty(); }
55  QString GetCaption(void) const { return m_caption; }
56  bool HasTimestamp(void) const { return m_timestamp.isValid(); }
57  QDateTime GetTimestamp(void) const { return m_timestamp; }
58  QString GetImageFilename(void) const { return m_imageFilename; }
59  QString GetPath(void) const { return m_path; }
60  bool IsDir(void) const { return m_isDir; }
61  QString GetDescription(const QString &status,
62  const QSize &sz, int angle) const;
63 
64  // non-const gets
65  QPixmap *GetPixmap(void) { return m_pixmap; }
67 
68  private:
69  QString m_name;
70  QString m_caption;
71  QDateTime m_timestamp;
72  QString m_path;
73  QString m_imageFilename;
74  bool m_isDir {false};
75  QPixmap *m_pixmap {nullptr};
77 };
78 typedef QList<ThumbItem*> ThumbList;
79 typedef QHash<QString, ThumbItem*> ThumbHash;
80 
81 #endif // _THUMBVIEW_H_
QString GetCaption(void) const
Definition: thumbview.h:55
bool HasCaption(void) const
Definition: thumbview.h:54
MythMediaDevice * GetMediaDevice(void)
Definition: thumbview.h:66
QString m_imageFilename
Definition: thumbview.h:73
QString GetDescription(const QString &status, const QSize &sz, int angle) const
Definition: thumbview.cpp:112
QString m_name
Definition: thumbview.h:69
void SetPixmap(QPixmap *pixmap)
Definition: thumbview.cpp:74
QList< ThumbItem * > ThumbList
Definition: thumbview.h:78
void SetName(const QString &name)
Definition: thumbview.h:37
void SetTimestamp(const QDateTime &timestamp)
Definition: thumbview.h:41
QDateTime GetTimestamp(void) const
Definition: thumbview.h:57
QHash< QString, ThumbItem * > ThumbHash
Definition: thumbview.h:79
bool m_isDir
Definition: thumbview.h:74
ThumbItem(const QString &name, const QString &path, bool isDir, MythMediaDevice *dev=nullptr)
Definition: thumbview.h:23
QString GetName(void) const
Definition: thumbview.h:53
long GetRotationAngle(void)
Definition: thumbview.cpp:80
bool IsDir(void) const
Definition: thumbview.h:60
MythMediaDevice * m_mediaDevice
Definition: thumbview.h:76
bool HasTimestamp(void) const
Definition: thumbview.h:56
const char * name
Definition: ParseText.cpp:328
void SetImageFilename(const QString &filename)
Definition: thumbview.h:45
QString m_path
Definition: thumbview.h:72
void SetPath(const QString &path, bool isDir)
Definition: thumbview.h:43
ThumbItem()=default
QString GetPath(void) const
Definition: thumbview.h:59
QString GetImageFilename(void) const
Definition: thumbview.h:58
void InitCaption(bool get_caption)
Definition: thumbview.cpp:44
void SetCaption(const QString &caption)
Definition: thumbview.h:39
void SetRotationAngle(int angle)
Definition: thumbview.cpp:58
QString m_caption
Definition: thumbview.h:70
QPixmap * GetPixmap(void)
Definition: thumbview.h:65
QDateTime m_timestamp
Definition: thumbview.h:71
QPixmap * m_pixmap
Definition: thumbview.h:75
void SetMediaDevice(MythMediaDevice *dev)
Definition: thumbview.h:48
bool Remove(void)
Definition: thumbview.cpp:24
void InitTimestamp()
Definition: thumbview.cpp:52