MythTV  master
imageview.h
Go to the documentation of this file.
1 // -*- Mode: c++ -*-
2 /* ============================================================
3  * File : imageview.h
4  * Description :
5  *
6  * Copyright 2004-2006 Renchi Raju, Daniel Kristjansson
7  *
8  * This program is free software; you can redistribute it
9  * and/or modify it under the terms of the GNU General
10  * Public License as published bythe Free Software Foundation;
11  * either version 2, or (at your option)
12  * any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU General Public License for more details.
18  *
19  * ============================================================ */
20 
21 #ifndef IMAGEVIEW_H
22 #define IMAGEVIEW_H
23 
24 #include <vector>
25 using namespace std;
26 
27 #include <QObject>
28 // MythGallery headers
29 #include "iconview.h"
30 #include "sequence.h"
31 
32 class MThread;
33 class QImage;
34 class QMutex;
35 class QRunnable;
36 class QTimer;
37 class QWaitCondition;
38 class ImageView;
39 class ThumbItem;
40 
42 class LoadAlbumListener : public QObject {
43  Q_OBJECT
45 public:
46  explicit LoadAlbumListener(ImageView *parent);
47  virtual ~LoadAlbumListener() = default;
48 private slots:
49  void FinishLoading() const;
50 };
51 
52 class ImageView
53 {
54  Q_DECLARE_TR_FUNCTIONS(ImageView);
55 
56  public:
57  ImageView(const ThumbList &itemList,
58  int *pos, int slideShow, int sortorder);
59  ThumbItem *getCurrentItem() const;
60  virtual ~ImageView();
61 
62  protected:
63  static SequenceBase *ComposeSlideshowSequence(int slideshow_sequencing);
64 
65  // Commands
66  virtual void Rotate(int angle) = 0;
67  virtual void DisplayNext(bool reset, bool loadImage) = 0;
68  virtual void DisplayPrev(bool reset, bool loadImage) = 0;
69  virtual void Load(void) = 0;
70 
71  // Sets
72  virtual void SetZoom(float zoom) = 0;
73 
74  // Effects
75  virtual void RegisterEffects(void) = 0;
76  virtual QString GetRandomEffect(void) const;
77  virtual void RunEffect(const QString &effect) = 0;
78 
79  void UpdateLCD(const ThumbItem *item);
80  QString GetDescriptionStatus(void) const;
81  void GetScreenShot(QImage& image, const ThumbItem *item);
82  virtual void AddItems(const ThumbList &itemList);
83  ThumbItem *advanceItem();
84  ThumbItem *retreatItem();
85 
86  private:
87  friend class LoadAlbumListener;
88  void FinishLoading();
89  double GetSeasonalWeight(ThumbItem *item);
90 
91  protected:
92  QSize m_screenSize;
93  float m_wmult;
94  float m_hmult;
95  int m_pos;
96  int *m_savedPos;
98  float m_zoom;
99 
102 
103  // Common slideshow variables
109  const char *m_slideshow_mode;
110 
111  // Common effect state variables
115  QMap<QString,QString> m_effect_map;
117 
118 private:
119  Q_DISABLE_COPY(ImageView)
121 
122  LoadAlbumRunnable *m_loaderRunnable;
123  LoadAlbumListener m_listener;
124  MThread *m_loaderThread;
125  QWaitCondition m_imagesLoaded;
126  // This lock must be held to access m_itemList and m_slideshow_sequence.
127  mutable QMutex m_itemListLock;
128  ThumbList m_itemList;
129  SequenceBase *m_slideshow_sequence;
130  bool m_finishedLoading;
131 };
132 
133 #endif /* IMAGEVIEW_H */
float m_zoom
Definition: imageview.h:98
int m_pos
Definition: imageview.h:95
This is a wrapper around QThread that does several additional things.
Definition: mthread.h:46
unsigned int slots[4]
Definition: element.c:38
int * m_savedPos
Definition: imageview.h:96
float m_hmult
Definition: imageview.h:94
bool m_info_show_short
Definition: imageview.h:101
int m_movieState
Definition: imageview.h:97
int m_slideshow_frame_delay_state
Definition: imageview.h:107
int m_slideshow_frame_delay
Definition: imageview.h:106
QList< ThumbItem * > ThumbList
Definition: thumbview.h:80
QMap< QString, QString > m_effect_map
Definition: imageview.h:115
int m_effect_current_frame
Definition: imageview.h:113
bool m_effect_random
Definition: imageview.h:116
ImageView * m_parent
Definition: imageview.h:44
const int m_slideshow_sequencing
Definition: imageview.h:105
QString m_effect_method
Definition: imageview.h:114
QSize m_screenSize
Definition: imageview.h:92
QTimer * m_slideshow_timer
Definition: imageview.h:108
bool m_effect_running
Definition: imageview.h:112
float m_wmult
Definition: imageview.h:93
Handler for events related to LoadAlbumListener.
Definition: imageview.h:42
const char * m_slideshow_mode
Definition: imageview.h:109
void FinishLoading() const
Definition: imageview.cpp:454
bool m_slideshow_running
Definition: imageview.h:104
bool m_info_show
Definition: imageview.h:100