00001 /*************************************************************************** 00002 * Copyright (C) 2009 by vishwajeet * 00003 * vishwajeet.dusane@gmail.com * 00004 * * 00005 * This program is free software; you can redistribute it and/or modify * 00006 * it under the terms of the GNU General Public License as published by * 00007 * the Free Software Foundation; either version 2 of the License, or * 00008 * (at your option) any later version. * 00009 * * 00010 * This program is distributed in the hope that it will be useful, * 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00013 * GNU General Public License for more details. * 00014 * * 00015 * You should have received a copy of the GNU General Public License * 00016 * along with this program; if not, write to the * 00017 * Free Software Foundation, Inc., * 00018 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * 00019 ***************************************************************************/ 00020 #ifndef MAINPICTUREWALLAREA_H 00021 #define MAINPICTUREWALLAREA_H 00022 00023 #include <QGraphicsView> 00024 #include <QtGui> 00025 00026 00031 struct ScaledImageInfo 00032 { 00033 QImage m_ScaledImage; 00034 QString m_ScaledImagePath; 00035 }; 00036 00047 class CMainPictureWallArea : public QGraphicsView 00048 { 00049 Q_OBJECT 00050 public: 00051 CMainPictureWallArea(QWidget *parent = 0); 00052 00053 virtual ~CMainPictureWallArea(); 00054 00061 enum EZoomFocus 00062 { 00063 IN, 00064 OUT 00065 }; 00066 00067 public slots: 00068 00075 void loadImagesFromDirectoryRecursivelySlot(QString directoryPath); 00076 00081 void changeZoomLevelByFactor(EZoomFocus zoom); 00082 00088 void showGoogleImageResult(QHash<QString,QString> result); 00089 00093 void cleanAllResults(); 00094 00095 00096 private slots: 00101 void showImageOnWall(int num); 00102 00108 void showImageOnWall(QByteArray image,QString); 00109 00110 00111 protected: 00116 virtual void wheelEvent ( QWheelEvent * ); 00117 00118 00123 virtual void mousePressEvent ( QMouseEvent * ); 00128 virtual void mouseReleaseEvent ( QMouseEvent * ); 00133 virtual void mouseMoveEvent ( QMouseEvent * ); 00134 00135 00136 private: 00141 void setMessage(const QString &text); 00142 00143 00144 private: 00145 QFutureWatcher<ScaledImageInfo> *m_pImageScaling; 00146 int m_Row; 00147 int m_Column; 00148 QGraphicsScene m_GraphicsScene; 00149 qreal m_ZoomFactor; 00150 int m_MouseDeltaValueForPressedEvent; 00151 bool m_MouseButtonPressed; 00152 }; 00153 00154 #endif 00155 00156