00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef GLSINGLEVIEW_H
00023 #define GLSINGLEVIEW_H
00024 #ifdef USING_OPENGL
00025
00026
00027 #include <mythdialogs.h>
00028 #include <mthread.h>
00029 #include <mythmiscutil.h>
00030
00031
00032 #include "imageview.h"
00033 #include "iconview.h"
00034 #include "sequence.h"
00035 #include "gltexture.h"
00036
00037
00038 #include <QGLWidget>
00039
00040 class QImage;
00041 class QTimer;
00042
00043 class GLSingleView;
00044 class KenBurnsImageLoader;
00045
00046 class GLSDialog : public MythDialog
00047 {
00048 public:
00049 GLSDialog(const ThumbList& itemList,
00050 int *pos, int slideShow, int sortOrder,
00051 MythMainWindow *parent, const char *name="GLSDialog");
00052
00053 protected:
00054 void closeEvent(QCloseEvent *e);
00055
00056 private:
00057 GLSingleView *m_view;
00058 };
00059
00060 class GLSingleView : public QGLWidget, public ImageView
00061 {
00062 Q_OBJECT
00063
00064 public:
00065 GLSingleView(ThumbList itemList, int *pos, int slideShow, int sordorder,
00066 QWidget *parent);
00067 ~GLSingleView();
00068
00069 void CleanUp(void);
00070 void Ready(){m_effect_kenBurns_image_ready = true;}
00071 void LoadImage(QImage image, QSize origSize);
00072
00073
00074 protected:
00075 void initializeGL(void);
00076
00077
00078 virtual void Rotate(int angle);
00079 virtual void DisplayNext(bool reset, bool loadImage);
00080 virtual void DisplayPrev(bool reset, bool loadImage);
00081 virtual void Load(void);
00082 void resizeGL(int w, int h);
00083
00084 void paintGL(void);
00085 void paintTexture(void);
00086 void createTexInfo(void);
00087 virtual void keyPressEvent(QKeyEvent *e);
00088 void checkPosition(void);
00089
00090
00091 virtual void SetZoom(float zoom);
00092 void SetTransitionTimeout(int timeout);
00093
00094
00095 int GetNearestGLTextureSize(int) const;
00096
00097 virtual void RegisterEffects(void);
00098 virtual void RunEffect(const QString &effect);
00099
00100 void EffectNone(void);
00101 void EffectBlend(void);
00102 void EffectZoomBlend(void);
00103 void EffectFade(void);
00104 void EffectRotate(void);
00105 void EffectBend(void);
00106 void EffectInOut(void);
00107 void EffectSlide(void);
00108 void EffectFlutter(void);
00109 void EffectCube(void);
00110 void EffectKenBurns(void);
00111
00112 private:
00113 float FindMaxScale(float x_loc, float y_loc);
00114 void FindRandXY(float &x_loc, float &y_loc);
00115
00116 private slots:
00117 void SlideTimeout(void);
00118
00119 private:
00120
00121 float m_source_x;
00122 float m_source_y;
00123 ScaleMax m_scaleMax;
00124
00125
00126 int m_texMaxDim;
00127 QSize m_texSize;
00128 GLTexture m_texItem[2];
00129 int m_texCur;
00130 bool m_tex1First;
00131
00132
00133 GLuint m_texInfo;
00134
00135
00136 int m_effect_rotate_direction;
00137 MythTimer m_effect_frame_time;
00138 int m_effect_transition_timeout;
00139 float m_effect_transition_timeout_inv;
00140
00141
00142 float m_effect_flutter_points[40][40][3];
00143 float m_effect_cube_xrot;
00144 float m_effect_cube_yrot;
00145 float m_effect_cube_zrot;
00146 float m_effect_kenBurns_location_x[2];
00147 float m_effect_kenBurns_location_y[2];
00148 int m_effect_kenBurns_projection[2];
00149 MythTimer m_effect_kenBurns_image_time[2];
00150 float m_effect_kenBurns_image_timeout;
00151 KenBurnsImageLoader *m_effect_kenBurns_imageLoadThread;
00152 bool m_effect_kenBurns_image_ready;
00153 QImage m_effect_kenBurns_image;
00154 QSize m_effect_kenBurns_orig_image_size;
00155 ThumbItem *m_effect_kenBurns_item;
00156 bool m_effect_kenBurns_initialized;
00157 bool m_effect_kenBurns_new_image_started;
00158
00159 };
00160
00161 class KenBurnsImageLoader : public MThread
00162 {
00163 public:
00164 KenBurnsImageLoader(GLSingleView *singleView, ThumbList &itemList, QSize m_texSize, QSize m_screenSize);
00165 void Initialize(int pos);
00166 void run();
00167 private:
00168 GLSingleView *m_singleView;
00169 ThumbList m_itemList;
00170 int m_pos;
00171 bool m_tex1First;
00172 QSize m_screenSize;
00173 QSize m_texSize;
00174
00175 };
00176
00177 #endif // USING_OPENGL
00178 #endif // GLSINGLEVIEW_H