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