mysocials-core 1.0
|
00001 #ifndef QIMAGEVIEWER_H 00002 #define QIMAGEVIEWER_H 00003 00004 #include <QMainWindow> 00005 #include <QGraphicsView> 00006 #include <QGraphicsScene> 00007 #include <QGraphicsPixmapItem> 00008 #include <QMessageBox> 00009 #include <QDebug> 00010 #include <QMouseEvent> 00011 #include <QLibrary> 00012 #include <QLabel> 00013 #include <QVBoxLayout> 00014 #include <QHBoxLayout> 00015 #include <QPushButton> 00016 #include <QDesktopWidget> 00017 #include <QGraphicsProxyWidget> 00018 #include <QGraphicsLinearLayout> 00019 #include <QMenuBar> 00020 00021 #include "servicemgr.h" 00022 #include "datatypes/photo.h" 00023 #include "widgets/qmousetrackingview.h" 00024 #include "widgets/qcommentwidget.h" 00025 #include "widgets/qaddcomment.h" 00026 00027 #ifdef Q_WS_MAEMO_5 00028 #include "utils/fullscreenexitbutton.h" 00029 #endif 00030 00031 #ifdef Q_WS_MAEMO_5 00032 #define WINDOW_TITLE "Gallery" 00033 #else 00034 #define WINDOW_TITLE "MySocials Gallery Image Viewer" 00035 #endif 00036 00037 class QImageViewer : public QMainWindow 00038 { 00039 Q_OBJECT 00040 public: 00041 explicit QImageViewer(QFont textFont, QWidget *parent = 0); 00042 ~QImageViewer(); 00043 00049 void loadImage(ServiceMgr *sm, Photo image); 00050 00051 protected: 00052 void keyPressEvent(QKeyEvent *event); 00053 00054 private: 00058 void showImage(bool isNeedCompare); 00059 void showComments(); 00060 00061 // start photo for slide showing 00062 Photo currentPhoto; 00063 00064 // list of photos that are showing 00065 PhotoList list; 00066 00067 // service manager 00068 ServiceMgr *sm; 00069 00070 // description for photo 00071 QLabel *description; 00072 00073 // list of comments 00074 QWidget *comments; 00075 QGraphicsProxyWidget *commentsWidget; 00076 00077 QMouseTrackingView *view; 00078 QGraphicsScene *scene; 00079 00080 // container for photos 00081 QGraphicsPixmapItem *pixmapItem; 00082 00083 // container for text messages 00084 QGraphicsTextItem *processItem; 00085 00086 // the current size of window 00087 QSize windowSize; 00088 00089 // index of current showing image 00090 int currentImageIndex; 00091 00092 void createMenu(); 00093 00094 #ifdef Q_WS_MAEMO_5 00095 FullScreenExitButton *fullScreenButton; 00096 #endif 00097 00098 signals: 00099 00100 private slots: 00101 void action_refresh_comments_toggled(); 00102 void action_add_comment_toggled(); 00103 00104 public slots: 00105 00106 void imageListUpdate(QString accountId, QString friendId, QString albumId, PhotoList list, bool isLastUpdate); 00107 void gotProfile(Friend profile); 00108 void close(); 00109 void resizeEvent(QResizeEvent *); 00110 void moveImage(Qt::ArrowType); 00111 void on_actionFull_screen_toggled(); 00112 void orientationChanged(); 00113 00114 void gotComments(QString photoId, PhotoCommentList list); 00115 }; 00116 00117 #endif // QIMAGEVIEWER_H