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:
23  m_isDir(false),
24  m_pixmap(nullptr), m_mediaDevice(nullptr) { }
25  ThumbItem(const QString &name, const QString &path, bool isDir,
26  MythMediaDevice *dev = nullptr) :
27  m_name(name),
28  m_path(path), m_isDir(isDir),
29  m_pixmap(nullptr), m_mediaDevice(dev) {}
30  ~ThumbItem();
31 
32  // commands
33  bool Remove(void);
34  void InitCaption(bool get_caption);
35  void InitTimestamp();
36 
37  // sets
38  void SetRotationAngle(int angle);
39  void SetName(const QString &name)
40  { m_name = name; }
41  void SetCaption(const QString &caption)
42  { m_caption = caption; }
43  void SetTimestamp(const QDateTime &timestamp)
44  { m_timestamp = timestamp; }
45  void SetPath(const QString &path, bool isDir)
46  { m_path = path; m_isDir = isDir; }
47  void SetImageFilename(const QString &filename)
48  { m_imageFilename = filename; }
49  void SetPixmap(QPixmap *pixmap);
51  { m_mediaDevice = dev; }
52 
53  // gets
54  long GetRotationAngle(void);
55  QString GetName(void) const { return m_name; }
56  bool HasCaption(void) const { return !m_caption.trimmed().isEmpty(); }
57  QString GetCaption(void) const { return m_caption; }
58  bool HasTimestamp(void) const { return m_timestamp.isValid(); }
59  QDateTime GetTimestamp(void) const { return m_timestamp; }
60  QString GetImageFilename(void) const { return m_imageFilename; }
61  QString GetPath(void) const { return m_path; }
62  bool IsDir(void) const { return m_isDir; }
63  QString GetDescription(const QString &status,
64  const QSize &sz, int angle) const;
65 
66  // non-const gets
67  QPixmap *GetPixmap(void) { return m_pixmap; }
69 
70  private:
71  QString m_name;
72  QString m_caption;
73  QDateTime m_timestamp;
74  QString m_path;
75  QString m_imageFilename;
76  bool m_isDir;
77  QPixmap *m_pixmap;
79 };
80 typedef QList<ThumbItem*> ThumbList;
81 typedef QHash<QString, ThumbItem*> ThumbHash;
82 
83 #endif // _THUMBVIEW_H_
QString GetCaption(void) const
Definition: thumbview.h:57
bool HasCaption(void) const
Definition: thumbview.h:56
MythMediaDevice * GetMediaDevice(void)
Definition: thumbview.h:68
QString m_imageFilename
Definition: thumbview.h:75
QString GetDescription(const QString &status, const QSize &sz, int angle) const
Definition: thumbview.cpp:113
QString m_name
Definition: thumbview.h:71
void SetPixmap(QPixmap *pixmap)
Definition: thumbview.cpp:74
QList< ThumbItem * > ThumbList
Definition: thumbview.h:80
void SetName(const QString &name)
Definition: thumbview.h:39
void SetTimestamp(const QDateTime &timestamp)
Definition: thumbview.h:43
QDateTime GetTimestamp(void) const
Definition: thumbview.h:59
QHash< QString, ThumbItem * > ThumbHash
Definition: thumbview.h:81
bool m_isDir
Definition: thumbview.h:76
ThumbItem(const QString &name, const QString &path, bool isDir, MythMediaDevice *dev=nullptr)
Definition: thumbview.h:25
QString GetName(void) const
Definition: thumbview.h:55
long GetRotationAngle(void)
Definition: thumbview.cpp:81
bool IsDir(void) const
Definition: thumbview.h:62
VERBOSE_PREAMBLE false
Definition: verbosedefs.h:85
MythMediaDevice * m_mediaDevice
Definition: thumbview.h:78
bool HasTimestamp(void) const
Definition: thumbview.h:58
const char * name
Definition: ParseText.cpp:339
void SetImageFilename(const QString &filename)
Definition: thumbview.h:47
QString m_path
Definition: thumbview.h:74
void SetPath(const QString &path, bool isDir)
Definition: thumbview.h:45
ThumbItem()
Definition: thumbview.h:22
QString GetPath(void) const
Definition: thumbview.h:61
QString GetImageFilename(void) const
Definition: thumbview.h:60
void InitCaption(bool get_caption)
Definition: thumbview.cpp:44
void SetCaption(const QString &caption)
Definition: thumbview.h:41
void SetRotationAngle(int angle)
Definition: thumbview.cpp:58
QString m_caption
Definition: thumbview.h:72
QPixmap * GetPixmap(void)
Definition: thumbview.h:67
QDateTime m_timestamp
Definition: thumbview.h:73
QPixmap * m_pixmap
Definition: thumbview.h:77
void SetMediaDevice(MythMediaDevice *dev)
Definition: thumbview.h:50
bool Remove(void)
Definition: thumbview.cpp:24
void InitTimestamp()
Definition: thumbview.cpp:52