mysocials-core 1.0
|
00001 #ifndef IMAGEBROWSERPANEL_H 00002 #define IMAGEBROWSERPANEL_H 00003 00004 #include <QWidget> 00005 #include <QPushButton> 00006 #include <QListWidget> 00007 #include <QMessageBox> 00008 #include <QRadioButton> 00009 #include <QString> 00010 00011 #include "widgets/qimageviewer.h" 00012 #include "widgets/qtoppanel.h" 00013 #include "utils/hintedit.h" 00014 00015 #include "datatypes/friend.h" 00016 #include "datatypes/album.h" 00017 #include "datatypes/photo.h" 00018 00019 #include "servicemgr.h" 00020 00021 namespace Ui { 00022 class ImageBrowserPanel; 00023 } 00024 00025 class ImageBrowserPanel : public QWidget 00026 { 00027 Q_OBJECT 00028 00029 public: 00030 explicit ImageBrowserPanel(QWidget *parent = 0); 00031 explicit ImageBrowserPanel(ServiceMgr *mgr, QWidget *parent = 0); 00032 ~ImageBrowserPanel(); 00033 00034 void init(); 00035 00036 void hideAll(QLayout *layout); 00037 void showAll(QLayout *layout); 00038 void setAlbumsVisible(const bool isShow); 00039 void setImagesVisible(const bool isShow); 00040 void setFriendsVisible(const bool isShow); 00041 00042 void clearEditOwnr(); 00043 00044 // window state for 2 panel mode. First panel is current, Last panel is previous 00045 enum WindowState { 00046 WindowFriendAlbum, 00047 WindowAlbumPhoto, 00048 WindowPhotoAlbum, 00049 WindowAlbumFriend 00050 }; 00051 00052 void showFriendAlbums(Friend fd); 00053 00054 // update window corresponding current state 00055 void setState(WindowState state); 00056 void setState(); 00057 00058 private: 00059 void setAlbumHeader(); 00060 void setAlbumHeader(Friend fr); 00061 void setPhotoHeader(); 00062 void setPhotoHeader(Album al); 00063 static QString albumItem(const Album& al); 00064 static QPixmap albumIcon(const Album& al); 00065 static QPixmap photoIcon(const Photo& al); 00066 static QPixmap photoIcon(const QAttachment& al); 00067 00068 00069 private: 00070 Ui::ImageBrowserPanel *ui; 00071 QTopPanel *albumsTopPanel; 00072 QTopPanel *photosTopPanel; 00073 00074 QFont usedFont; 00075 00076 //QLabel lablContacts; 00077 HintEdit *editOwnr; 00078 QPushButton *buttonEditOwnr; 00079 QPushButton *buttonRefreshFriends; 00080 QRadioButton *peopleradb; 00081 QRadioButton *newsradb; 00082 //QPushButton *buttonRefreshAlbums; 00083 //QPushButton *buttonRefreshPhotos; 00084 //QPushButton *buttonCloseAlbums; 00085 //QPushButton *buttonClosePhotos; 00086 00087 bool isSkipFriendUpdate; 00088 00089 ServiceMgr *sm; 00090 00091 bool isFriendsUpdate; 00092 bool isAlbumsUpdate; 00093 bool isPhotosUpdate; 00094 bool isFeedUpdate; 00095 00096 // current state for window 00097 WindowState state; 00098 bool isPortraitMode; 00099 00100 void ownrSelected(QListWidgetItem *item, bool isNeedUpdateState); 00101 00102 QListWidgetItem *createFriendWidget(Friend fr); 00103 void addMeToFriends(); 00104 00105 QString cutHeader(QString text); 00106 00107 signals: 00108 void openImage(Photo photo); 00109 void showFriendInfo(Friend fr); 00110 void showAlbumInfo(Album al); 00111 00112 private slots: 00113 //void on_pushButtonMe_toggled(bool checked); 00114 void editOwnr_textChanged(QString str); 00115 void buttonResetOwnr_clicked(); 00116 00117 void ownrSelected(QListWidgetItem *item); 00118 void albmSelected(QListWidgetItem *item); 00119 void photoSelected(QListWidgetItem *item); 00120 void feedEventSelected(QListWidgetItem *item); 00121 00122 void albumHeaderClicked(); 00123 void photoHeaderClicked(); 00124 00125 void showFriendPanel(bool isShow); 00126 00127 void refreshFriends(); 00128 void refreshFriends(bool isNeedUpdate); 00129 void refreshAlbums(); 00130 void refreshAlbums(bool isNeedUpdate); 00131 void refreshPhotos(); 00132 void refreshPhotos(bool isNeedUpdate); 00133 void refreshFeed(bool isNeedUpdate); 00134 00135 void gotError(QString msg, QTransport::Action action, bool isMajor); 00136 00137 void showFriendInfo(); 00138 00139 void hidePhotos(); 00140 void hideAlbums(); 00141 00142 void orientationChanged(); 00143 00144 void updateListFriends(FriendList list, bool isLastUpdate); 00145 void updateListAlbums(Friend fr, AlbumList, bool isLastUpdate); 00146 void updateListPhotos(QString accountId, QString ownerId, QString albumId, PhotoList, bool isLastUpdate); 00147 void updateFeed(QEventFeedList list, QEventFeed::FeedType type, bool isLastUpdate); 00148 00149 void disableFriendSkipUpdate(); 00150 00151 void updateAccounts(QString accountId, AccountList list); 00152 }; 00153 00154 #endif // IMAGEBROWSERPANEL_H