00001 // -*- Mode: c++ -*- 00002 /* ============================================================ 00003 * File : singleview.h 00004 * Description : 00005 * 00006 * Copyright 2004-2006 Renchi Raju, Daniel Kristjansson 00007 * 00008 * This program is free software; you can redistribute it 00009 * and/or modify it under the terms of the GNU General 00010 * Public License as published bythe Free Software Foundation; 00011 * either version 2, or (at your option) 00012 * any later version. 00013 * 00014 * This program is distributed in the hope that it will be useful, 00015 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00017 * GNU General Public License for more details. 00018 * 00019 * ============================================================ */ 00020 00021 #ifndef SINGLEVIEW_H 00022 #define SINGLEVIEW_H 00023 00024 #include <vector> 00025 00026 using namespace std; 00027 00028 // Qt headers 00029 #include <QImage> 00030 #include <QPolygon> 00031 #include <QPixmap> 00032 #include <QKeyEvent> 00033 #include <QPaintEvent> 00034 00035 00036 // MythTV plugin headers 00037 #include <mythdialogs.h> 00038 00039 #include "galleryutil.h" 00040 #include "imageview.h" 00041 #include "iconview.h" 00042 #include "sequence.h" 00043 00044 class QTimer; 00045 00046 class SingleView : public MythDialog, public ImageView 00047 { 00048 Q_OBJECT 00049 00050 public: 00051 SingleView(ThumbList itemList, int *pos, int slideShow, int sortorder, 00052 MythMainWindow *parent, const char *name="SingleView"); 00053 ~SingleView(); 00054 00055 // Effect subtype enumeration 00056 static const int kSweepRightToLeft = 0; 00057 static const int kSweepLeftToRight = 1; 00058 static const int kSweepBottomToTop = 2; 00059 static const int kSweepTopToBottom = 3; 00060 00061 static const int kIncomingEdgesFixed = 0; 00062 static const int kIncomingEdgesMoving = 1; 00063 00064 protected: 00065 // Commands 00066 virtual void Rotate(int angle); 00067 virtual void DisplayNext(bool reset, bool loadImage); 00068 virtual void DisplayPrev(bool reset, bool loadImage); 00069 virtual void Load(void); 00070 virtual void paintEvent(QPaintEvent *e); 00071 virtual void keyPressEvent(QKeyEvent *e); 00072 00073 // Sets 00074 virtual void SetZoom(float zoom); 00075 void SetPixmap(QPixmap*); 00076 00077 // Effects 00078 virtual void RegisterEffects(void); 00079 virtual void RunEffect(const QString &effect); 00080 00081 private: 00082 void StartPainter(void); 00083 void CreateEffectPixmap(void); 00084 void CheckPosition(void); 00085 00086 // Various special effects methods 00087 void EffectNone(void); 00088 void EffectChessboard(void); 00089 void EffectSweep(void); 00090 void EffectGrowing(void); 00091 void EffectHorizLines(void); 00092 void EffectVertLines(void); 00093 void EffectMeltdown(void); 00094 void EffectIncomingEdges(void); 00095 void EffectMultiCircleOut(void); 00096 void EffectSpiralIn(void); 00097 void EffectCircleOut(void); 00098 void EffectBlobs(void); 00099 void EffectNoise(void); 00100 00101 static QPixmap *CreateBackground(const QSize &sz); 00102 00103 private slots: 00104 void SlideTimeout(void); 00105 void CaptionTimeout(void); 00106 00107 private: 00108 // General 00109 QPixmap *m_pixmap; 00110 QImage m_image; 00111 int m_angle; 00112 QPoint m_source_loc; 00113 ScaleMax m_scaleMax; 00114 00115 // Info variables 00116 QPixmap *m_info_pixmap; 00117 00118 // Common slideshow variables 00119 int m_caption_show; 00120 bool m_caption_remove; 00121 QPixmap *m_caption_pixmap; 00122 QPixmap *m_caption_restore_pixmap; 00123 QTimer *m_caption_timer; 00124 00125 // Common effect state variables 00126 QPixmap *m_effect_pixmap; 00127 QPainter *m_effect_painter; 00128 int m_effect_subtype; 00129 QRect m_effect_bounds; 00130 QPoint m_effect_delta0; 00131 QPoint m_effect_delta1; 00132 int m_effect_i; 00133 int m_effect_j; 00134 int m_effect_framerate; 00135 float m_effect_delta2_x; 00136 float m_effect_delta2_y; 00137 float m_effect_alpha; 00138 00139 // Unshared effect state variables 00140 QPoint m_effect_spiral_tmp0; 00141 QPoint m_effect_spiral_tmp1; 00142 vector<int> m_effect_meltdown_y_disp; 00143 float m_effect_multi_circle_out_delta_alpha; 00144 QPolygon m_effect_milti_circle_out_points; 00145 QPolygon m_effect_circle_out_points; 00146 }; 00147 00148 #endif /* SINGLEVIEW_H */
1.6.3