MythTV  0.26-pre
thumbview.h
Go to the documentation of this file.
00001 // -*- Mode: c++ -*-
00002 
00003 #ifndef _THUMBVIEW_H_
00004 #define _THUMBVIEW_H_
00005 
00006 // Qt headers
00007 #include <QString>
00008 #include <QList>
00009 #include <QHash>
00010 #include <QPixmap>
00011 
00012 class MythMediaDevice;
00013 class QPixmap;
00014 
00015 class ThumbItem
00016 {
00017   public:
00018     ThumbItem() :
00019         m_name(QString::null), m_caption(QString::null),
00020         m_path(QString::null), m_isDir(false),
00021         m_pixmap(NULL),        m_mediaDevice(NULL) { }
00022     ThumbItem(const QString &name, const QString &path, bool isDir,
00023               MythMediaDevice *dev = NULL);
00024     ~ThumbItem();
00025 
00026     // commands
00027     bool Remove(void);
00028     void InitCaption(bool get_caption);
00029 
00030     // sets
00031     void SetRotationAngle(int angle);
00032     void SetName(const QString &name)
00033         { m_name = name; m_name.detach(); }
00034     void SetCaption(const QString &caption)
00035         { m_caption = caption; m_caption.detach(); }
00036     void SetPath(const QString &path, bool isDir)
00037         { m_path = path; m_path.detach(), m_isDir = isDir; }
00038     void SetImageFilename(const QString &filename)
00039         { m_imageFilename = filename; m_imageFilename.detach(); }
00040     void SetPixmap(QPixmap *pixmap);
00041     void SetMediaDevice(MythMediaDevice *dev)
00042         { m_mediaDevice = dev; }
00043 
00044     // gets
00045     long    GetRotationAngle(void);
00046     QString GetName(void)    const { return m_name;               }
00047     bool    HasCaption(void) const { return !m_caption.trimmed().isEmpty(); }
00048     QString GetCaption(void) const { return m_caption;            }
00049     QString GetImageFilename(void) const { return m_imageFilename; }
00050     QString GetPath(void)    const { return m_path;               }
00051     bool    IsDir(void)      const { return m_isDir;              }
00052     QString GetDescription(const QString &status,
00053                            const QSize &sz, int angle) const;
00054 
00055     // non-const gets
00056     QPixmap         *GetPixmap(void)      { return m_pixmap;      }
00057     MythMediaDevice *GetMediaDevice(void) { return m_mediaDevice; }
00058 
00059   private:
00060     QString  m_name;
00061     QString  m_caption;
00062     QString  m_path;
00063     QString  m_imageFilename;
00064     bool     m_isDir;
00065     QPixmap *m_pixmap;
00066     MythMediaDevice *m_mediaDevice;
00067 };
00068 typedef QList<ThumbItem*> ThumbList;
00069 typedef QHash<QString, ThumbItem*>    ThumbHash;
00070 
00071 #endif // _THUMBVIEW_H_
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends