PCManFM-Qt
foldermodelitem.h
1 /*
2  *
3  * Copyright (C) 2012 Hong Jen Yee (PCMan) <pcman.tw@gmail.com>
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18  */
19 
20 
21 #ifndef FM_FOLDERMODELITEM_H
22 #define FM_FOLDERMODELITEM_H
23 
24 #include "libfmqtglobals.h"
25 #include <libfm/fm.h>
26 #include <QImage>
27 #include <QString>
28 #include <QIcon>
29 #include <QVector>
30 #include "icontheme.h"
31 
32 namespace Fm {
33 
34 class LIBFM_QT_API FolderModelItem {
35 public:
36 
37  enum ThumbnailStatus {
38  ThumbnailNotChecked,
39  ThumbnailLoading,
40  ThumbnailLoaded,
41  ThumbnailFailed
42  };
43 
44  struct Thumbnail {
45  int size;
46  ThumbnailStatus status;
47  QImage image;
48  };
49 
50 public:
51  FolderModelItem(FmFileInfo* _info);
52  FolderModelItem(const FolderModelItem& other);
53  virtual ~FolderModelItem();
54 
55  Thumbnail* findThumbnail(int size);
56  // void setThumbnail(int size, QImage image);
57  void removeThumbnail(int size);
58 
59  void updateIcon() {
60  icon = IconTheme::icon(fm_file_info_get_icon(info));
61  }
62 
63  QString displayName;
64  QIcon icon;
65  FmFileInfo* info;
66  QVector<Thumbnail> thumbnails;
67 };
68 
69 }
70 
71 #endif // FM_FOLDERMODELITEM_H
Definition: appchoosercombobox.cpp:26
Definition: foldermodelitem.h:44
Definition: foldermodelitem.h:34