summaryrefslogtreecommitdiffstats
path: root/kipi-plugins/kameraklient/gpcontroller.h
blob: ab9f320ea912c367cb520fe50cb0fe8f25c78589 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
/* ============================================================
 * File  : gpcontroller.h
 * Author: Renchi Raju <renchi@pooh.tam.uiuc.edu>
 * Date  : 2003-01-22
 * Description : 
 * 
 * Copyright 2003 by Renchi Raju <renchi@pooh.tam.uiuc.edu>

 * This program is free software; you can redistribute it
 * and/or modify it under the terms of the GNU General
 * Public License as published by the Free Software Foundation;
 * either version 2, or (at your option)
 * any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * ============================================================ */

#ifndef GPCONTROLLER_H
#define GPCONTROLLER_H

#include <qobject.h>
#include <qthread.h>
#include <qmutex.h>

#include "mtqueue.h"
#include "gpcommand.h"
#include "cameratype.h"

class QString;
class QImage;

namespace KIPIKameraKlientPlugin
{

class GPCamera;

class GPController : public QObject, public QThread {
    Q_OBJECT

public:
    GPController(QObject *parent, const CameraType& ctype);
    ~GPController();

    void requestInitialize();
    void requestGetSubFolders(const QString& folder);
    void requestMakeFolder(const QString& folder, const QString& newFolder);
    void requestDeleteFolder(const QString& folder);
    void requestGetItemsInfo(const QString& folder);
    void requestGetAllItemsInfo(const QString& folder);
    void requestGetThumbnail(const QString& folder, const QString& imageName);
    void requestDownloadItem(const QString& folder, const QString& itemName, const QString& saveFile);
    void requestDeleteItem(const QString& folder, const QString& itemName);
    void requestUploadItem(const QString& folder, const QString& localFile, const QString& uploadName);
    void requestOpenItem(const QString& folder, const QString& itemName, const QString& saveFile);
    void requestOpenItemWithService(const QString& folder, const QString& itemName, const QString& saveFile, const QString& serviceName);
    void cancel();
    void getInformation(QString& summary, QString& manual, QString& about);

protected:
    void run();

private:
    void initialize();
    void getSubFolders(const QString& folder);
    void makeFolder(const QString& folder, const QString& newFolder);
    void deleteFolder(const QString& folder);
    void getItemsInfo(const QString& folder);
    void getAllItemsInfo(const QString& folder);
    void getThumbnail(const QString& folder, const QString& imageName);
    void downloadItem(const QString& folder, const QString& itemName, const QString& saveFile);
    void deleteItem(const QString& folder, const QString& itemName);
    void uploadItem(const QString& folder, const QString& uploadName, const QString& localFile);
    void openItem(const QString& folder, const QString& itemName, const QString& saveFile);
    void openItemWithService(const QString& folder, const QString& itemName, const QString& saveFile, const QString& serviceName);
    void exifInfo(const QString& folder, const QString& itemName);
    void error(const QString& errorMsg);

    void scaleHighlightThumbnail(QImage& thumbnail);
    void showBusy(bool val);
    
    QObject  *parent_;
    GPCamera *camera_;
    QMutex    mutex_;
    MTQueue<GPCommand> cmdQueue_;
    bool      close_;

private slots:
    void slotStatusMsg(const QString& msg);
    void slotProgressVal(int val);
    void slotErrorMsg(const QString& msg);
};

}  // NameSpace KIPIKameraKlientPlugin

#endif /* GPCONTROLLER_H */