ZIMA CAD Parts
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
item.h
Go to the documentation of this file.
1 /*
2  ZIMA-CAD-Parts
3  http://www.zima-construction.cz/software/ZIMA-Parts
4 
5  Copyright (C) 2011-2012 Jakub Skokan <aither@havefun.cz>
6 
7  This program is free software: you can redistribute it and/or modify
8  it under the terms of the GNU General Public License as published by
9  the Free Software Foundation, either version 3 of the License, or
10  (at your option) any later version.
11 
12  This program is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU General Public License for more details.
16 
17  You should have received a copy of the GNU General Public License
18  along with this program. If not, see <http://www.gnu.org/licenses/>.
19 */
20 
21 #ifndef ITEM_H
22 #define ITEM_H
23 
24 #include <QString>
25 #include <QPixmap>
26 #include <QFile>
27 #include <QList>
28 #include <QVariant>
29 #include <QDateTime>
30 
31 #include "basedatasource.h"
32 #include "metadata.h"
33 #include "thumbnail.h"
34 #include "downloadmodel.h"
35 
36 class BaseDataSource;
37 class ServersModel;
38 class Item;
39 class DataTransfer;
40 
41 struct File
42 {
43  enum FileTypes {
44  // Pro/e
46  ASM,
47  DRW,
48  FRM,
50  // CATIA
54  // NX
56  // SolidWorks
60  // Solid Edge
61  PAR,
62  PSM,
63 // ASM,
64  DFT,
65  // Inventor
66  IPT,
67  IAM,
68  IDW,
69  // CAD NEUTRAL
72  DWG,
73  DXF,
74  // NonCAD
75  STL,
77  PDF,
86  };
87 
89  void setName(QString name);
90  QString baseName();
91  void detectFileType();
92  QPixmap icon();
94  static QString getLabelForFileType(FileTypes type);
95  static QString getRxForFileType(FileTypes type);
96  static QString getRxFromStringList(const QStringList &extensions);
97 
99  QString m_baseName; // name without version
100  QString name;
101  QString path;
102  QString targetPath;
103 
111  QString cachePath;
112 
114  QList<Thumbnail*> thumbnails;
115  QFile *openFtpFile;
116  bool isChecked;
117  QDateTime lastModified;
119  qint64 bytesDone;
120  qint64 size;
121  int version;
125 
126 private:
127  QPixmap m_icon;
128 };
129 
130 class Item
131 {
132 public:
133  Item();
134  int row() const;
135  void setNotEmpty();
136  Item *child(int r);
137  ~Item();
138  QString getLabel();
139  QString pathWithDataSource();
140  void addThumbnail(Thumbnail *thumb);
141  QList<Thumbnail*> thumbnails(bool include = true);
142 
143  int id;
144  QString name;
145  QString part;
146  QPixmap pixmap;
147  QString pixmapFile;
148  QPixmap logo;
149  bool showText;
150  QString path;
151  QMap<QString, QVariant> params;
152  QFile *openFtpFile;
153  bool isChecked;
154  bool isDir;
155  bool isEmpty;
156  bool isServer;
160  QList<Thumbnail*> m_thumbnails;
161 
163  QList<Item*> children;
164  QList<File*> files;
165 
167 };
168 
169 #endif // ITEM_H
qint64 bytesDone
Definition: item.h:119
Definition: item.h:76
void setNotEmpty()
Definition: item.cpp:344
Definition: item.h:70
void addThumbnail(Thumbnail *thumb)
Definition: item.cpp:363
bool isDir
Definition: item.h:154
Item()
Definition: item.cpp:303
QString path
Definition: item.h:150
Definition: item.h:55
void detectFileType()
Definition: item.cpp:40
BaseDataSource * server
Definition: item.h:159
QString cachePath
A cache path for file. Including file name.
Definition: item.h:111
Definition: item.h:62
QList< Thumbnail * > thumbnails
Definition: item.h:114
bool isEmpty
Definition: item.h:155
Definition: item.h:67
Item * child(int r)
Definition: item.cpp:338
Definition: item.h:66
Definition: item.h:77
QPixmap pixmap
Definition: item.h:146
Definition: item.h:78
Item * parent
Definition: item.h:162
QDateTime lastModified
Definition: item.h:117
Definition: item.h:48
bool showText
Definition: item.h:149
File()
Definition: item.h:88
FileTypes type
Definition: item.h:118
Definition: item.h:46
QString name
Definition: item.h:144
Definition: item.h:75
Definition: item.h:73
Definition: item.h:81
int row() const
Definition: item.cpp:330
Thumbnail * thumbnail
Definition: item.h:113
~Item()
Definition: item.cpp:318
Definition: item.h:52
void setName(QString name)
Definition: item.cpp:26
Definition: item.h:130
Definition: item.h:51
QFile * openFtpFile
Definition: item.h:115
QString name
Definition: item.h:100
Definition: item.h:83
int id
Definition: item.h:143
bool isChecked
Definition: item.h:116
QString pixmapFile
Definition: item.h:147
Definition: datatransfer.h:9
Item * parentItem
Definition: item.h:98
static QString getRxForFileType(FileTypes type)
Definition: item.cpp:221
QList< File * > files
Definition: item.h:164
Metadata * metadata
Definition: item.h:166
QString targetPath
Definition: item.h:102
Definition: item.h:68
QPixmap icon()
Definition: item.cpp:63
Definition: item.h:53
Definition: item.h:85
Definition: basedatasource.h:50
Definition: item.h:41
static QString getInternalNameForFileType(FileTypes type)
Definition: item.cpp:79
QString path
Definition: item.h:101
QMap< QString, QVariant > params
Definition: item.h:151
static QString getLabelForFileType(FileTypes type)
Definition: item.cpp:150
Definition: item.h:47
Definition: item.h:45
Definition: item.h:59
Definition: metadata.h:30
Definition: thumbnail.h:6
Definition: item.h:71
Definition: item.h:80
FileTypes
Definition: item.h:43
Definition: item.h:49
Definition: item.h:64
QList< Thumbnail * > m_thumbnails
Definition: item.h:160
bool hasLoadedChildren
Definition: item.h:158
DownloadModel::TransferHandlerType transferHandler
Definition: item.h:124
TransferHandlerType
Definition: downloadmodel.h:43
Definition: item.h:58
Definition: item.h:84
Definition: item.h:79
Definition: serversmodel.h:36
static QString getRxFromStringList(const QStringList &extensions)
Definition: item.cpp:292
Definition: item.h:61
QFile * openFtpFile
Definition: item.h:152
QPixmap logo
Definition: item.h:148
bool newestVersion
Definition: item.h:122
bool isChecked
Definition: item.h:153
bool isServer
Definition: item.h:156
QString pathWithDataSource()
Definition: item.cpp:358
Definition: item.h:82
QString getLabel()
Definition: item.cpp:351
QList< Thumbnail * > thumbnails(bool include=true)
Definition: item.cpp:368
qint64 size
Definition: item.h:120
bool hasTechSpecs
Definition: item.h:157
int version
Definition: item.h:121
Definition: item.h:72
DataTransfer * transfer
Definition: item.h:123
QString baseName()
Definition: item.cpp:33
QList< Item * > children
Definition: item.h:163
Definition: item.h:57
QString part
Definition: item.h:145
QString m_baseName
Definition: item.h:99