blob: 8f108b36ce0e1d97381f931c709a05d3339b6a0d (
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
|
/* ============================================================
* File : gpeventfilter.cpp
* Author: Renchi Raju <renchi@pooh.tam.uiuc.edu>
* Date : 2003-01-21
* 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.
*
* ============================================================ */
// TQt
#include <tqevent.h>
// Local
#include "cameraui.h"
#include "gpeventfilter.h"
#include "gpevents.h"
namespace KIPIKameraKlientPlugin
{
GPEventFilter::GPEventFilter(TQObject* parent)
: TQObject(parent) {
parent->installEventFilter(this);
view_ = static_cast<CameraUI *>(TQT_TQWIDGET(parent));
}
GPEventFilter::~GPEventFilter() {
}
bool GPEventFilter::eventFilter(TQObject *, TQEvent *e) {
if (e->type() < TQCustomEvent::User) {
return false;
}
switch (e->type()) {
case(GPEvent::Init): {
view_->cameraInitialized(true);
break;
}
case (GPEvent::Error): {
GPEventError *event(static_cast<GPEventError *>(e));
view_->cameraErrorMsg(event->errorMsg());
break;
}
case (GPEvent::GetSubFolders): {
GPEventGetSubFolders *event(static_cast<GPEventGetSubFolders *>(e));
TQString folder(event->folder());
MTList<TQString> subFolderList(event->subFolderList());
for (int i=0; i<subFolderList.count(); i++) {
view_->cameraSubFolder(folder, subFolderList[i]);
}
break;
}
case (GPEvent::GetItemsInfo): {
GPEventGetItemsInfo *event(static_cast<GPEventGetItemsInfo *>(e));
TQString folder(event->folder());
MTList<GPFileItemInfo> mtList(event->infoList());
GPFileItemInfoList infoList;
GPFileItemInfoList::const_iterator it;
for (it = mtList.begin(); it != mtList.end(); ++it)
infoList.append(*it);
view_->cameraNewItems(folder, infoList);
break;
}
case (GPEvent::GetAllItemsInfo): {
GPEventGetAllItemsInfo *event(static_cast<GPEventGetAllItemsInfo *>(e));
MTList<GPFileItemInfo> mtList(event->infoList());
GPFileItemInfoList infoList;
GPFileItemInfoList::const_iterator it;
for (it = mtList.begin(); it != mtList.end(); ++it) {
infoList.append(*it);
}
view_->cameraNewItems(infoList);
break;
}
case(GPEvent::GetThumbnail): {
GPEventGetThumbnail *event(static_cast<GPEventGetThumbnail *>(e));
view_->cameraNewThumbnail(event->folder(), event->imageName(), event->thumbnail());
break;
}
case(GPEvent::DownloadItem): {
GPEventDownloadItem *event(static_cast<GPEventDownloadItem *>(e));
view_->cameraDownloadedItem(event->folder(), event->itemName());
break;
}
case(GPEvent::DeleteItem): {
GPEventDeleteItem *event(static_cast<GPEventDeleteItem *>(e));
view_->cameraDeletedItem(event->folder(), event->itemName());
break;
}
case(GPEvent::StatusMsg): {
GPEventStatusMsg *event(static_cast<GPEventStatusMsg *>(e));
emit signalStatusMsg(event->msg());
break;
}
case(GPEvent::Progress): {
GPEventProgress *event(static_cast<GPEventProgress *>(e));
emit signalProgressVal(event->val());
break;
}
case(GPEvent::Busy): {
GPEventBusy *event(static_cast<GPEventBusy *>(e));
emit signalBusy(event->busy());
break;
}
default: {
tqWarning("Event Filter: Unknown Event");
break;
}
}
// eat this event
return true;
}
} // NameSpace KIPIKameraKlientPlugin
#include "gpeventfilter.moc"
|