ZIMA CAD Parts
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
localdatasource.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 LOCALDATASOURCE_H
22 #define LOCALDATASOURCE_H
23 
24 #include <QThread>
25 #include "basedatasource.h"
26 
27 class LocalCopier : public QThread
28 {
29  Q_OBJECT
30 public:
31  LocalCopier(QList<File*> files = QList<File*>());
32  LocalCopier(File* file);
33  void run();
34  void addFiles(QList<File*> files);
35  void addFile(File* file);
36 
37 private:
38  QList<File*> files;
39  QString target;
40 
41 signals:
42  void aboutToCopy(File *file);
43  void fileCopied(File *file);
44  void done();
45  void progress(File*);
46 };
47 
49 {
50  Q_OBJECT
51 public:
52  explicit LocalDataSource(QObject *parent = 0);
53  QString internalName();
54  QString pathToDataRoot();
55  QString getTechSpecPathForItem(Item *item);
56  QString getPathForItem(Item *item);
57  QString getRelativePathForItem(Item *item);
58  QString name();
59 
60  QString localPath;
61 
62 public slots:
63  void loadRootItem(Item *item);
64  void loadDirectory(Item* item);
65  void deleteFiles(QList<File*> files);
66  void addFileToDownload(File *f);
67  void downloadFiles(QList<File*> files, QString dir);
68  void downloadFile(File* file);
69  void resumeDownload();
70  void abort();
71  void assignTechSpecUrlToItem(QString url, Item *item, QString lang, bool overwrite = false);
72  void assignPartsIndexUrlToItem(QString url, Item *item, QString lang, bool overwrite = false);
73 
74 protected:
75  void loadItemLogo(Item *item);
76 
78 
79 protected slots:
80  void aboutToCopy(File *file);
81 
82 };
83 
84 #endif // LOCALDATASOURCE_H
void resumeDownload()
Definition: localdatasource.cpp:305
void fileCopied(File *file)
void aboutToCopy(File *file)
Definition: localdatasource.cpp:369
void downloadFiles(QList< File * > files, QString dir)
Definition: localdatasource.cpp:288
QString internalName()
Definition: localdatasource.cpp:105
QString getRelativePathForItem(Item *item)
Definition: localdatasource.cpp:138
Definition: item.h:130
QString localPath
Definition: localdatasource.h:60
void assignTechSpecUrlToItem(QString url, Item *item, QString lang, bool overwrite=false)
Definition: localdatasource.cpp:315
void loadItemLogo(Item *item)
Definition: localdatasource.cpp:115
void loadRootItem(Item *item)
Definition: localdatasource.cpp:110
void abort()
Definition: localdatasource.cpp:310
Definition: localdatasource.h:27
QString name()
Definition: localdatasource.cpp:145
Definition: basedatasource.h:50
void addFile(File *file)
Definition: localdatasource.cpp:82
QString getPathForItem(Item *item)
Definition: localdatasource.cpp:133
void deleteFiles(QList< File * > files)
Definition: localdatasource.cpp:258
Definition: item.h:41
LocalCopier * copier
Definition: localdatasource.h:77
void run()
Definition: localdatasource.cpp:42
Definition: localdatasource.h:48
void assignPartsIndexUrlToItem(QString url, Item *item, QString lang, bool overwrite=false)
Definition: localdatasource.cpp:342
void addFiles(QList< File * > files)
Definition: localdatasource.cpp:87
QString pathToDataRoot()
Definition: localdatasource.cpp:374
void addFileToDownload(File *f)
Definition: localdatasource.cpp:283
QString getTechSpecPathForItem(Item *item)
Definition: localdatasource.cpp:128
void loadDirectory(Item *item)
Definition: localdatasource.cpp:150
LocalCopier(QList< File * > files=QList< File * >())
Definition: localdatasource.cpp:31
LocalDataSource(QObject *parent=0)
Definition: localdatasource.cpp:92
void downloadFile(File *file)
Definition: localdatasource.cpp:300
void progress(File *)
void aboutToCopy(File *file)