use kDebug
[kdegraphics.git] / kamera / kcontrol / kamera.h
blob928d7f080b48153c76690aecedfb8eb9ff6db3d0
1 /*
3 Copyright (C) 2001 The Kompany
4 2002-2003 Ilya Konstantinov <kde-devel@future.shiny.co.il>
5 2002-2003 Marcus Meissner <marcus@jet.franken.de>
6 2003 Nadeem Hasan <nhasan@nadmm.com>
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
23 #ifndef __kamera_h__
24 #define __kamera_h__
26 #include <kcmodule.h>
27 #include <gphoto2.h>
28 #include <KPluginFactory>
30 class QWidget;
31 class QPushButton;
32 class Q3IconViewItem;
34 class KCamera;
35 class KameraDeviceSelectDialog;
36 class KConfig;
37 class K3IconView;
38 class KActionCollection;
39 class KToolBar;
40 class KMenu;
42 class KKameraConfig : public KCModule
44 Q_OBJECT
45 friend class KameraDeviceSelectDialog;
47 public:
48 KKameraConfig(QWidget *parent, const QVariantList &);
49 virtual ~KKameraConfig();
51 // KCModule interface methods
52 void load();
53 void save();
54 void defaults();
55 int buttons();
56 QString quickHelp() const;
58 protected:
59 QString suggestName(const QString &name);
61 protected slots:
62 void slot_deviceMenu(Q3IconViewItem *item, const QPoint &point);
63 void slot_deviceSelected(Q3IconViewItem *item);
64 void slot_addCamera();
65 void slot_removeCamera();
66 void slot_configureCamera();
67 void slot_cameraSummary();
68 void slot_testCamera();
69 void slot_cancelOperation();
70 void slot_error(const QString &message);
71 void slot_error(const QString &message, const QString &details);
73 private:
74 void displayGPFailureDialogue(void);
75 void displayGPSuccessDialogue(void);
76 void displayCameraAbilities(const CameraAbilities &abilities);
77 void populateDeviceListView(void);
78 void beforeCameraOperation(void);
79 void afterCameraOperation(void);
81 // gphoto callbacks
82 static void cbGPIdle(GPContext *context, void *data);
83 static GPContextFeedback cbGPCancel(GPContext *context, void *data);
85 private:
86 typedef QMap<QString, KCamera *> CameraDevicesMap;
88 KConfig *m_config;
89 CameraDevicesMap m_devices;
90 bool m_cancelPending;
92 // gphoto members
93 GPContext *m_context;
95 // widgets for the cameras listview
96 K3IconView *m_deviceSel;
97 KActionCollection *m_actions;
98 QPushButton *m_addCamera, *m_removeCamera, *m_testCamera, *m_configureCamera;
99 KToolBar *m_toolbar;
100 KMenu *m_devicePopup;
102 // true if libgphoto2 was initialised successfully in
103 // the constructor
104 bool m_gpInitialised;
106 static KKameraConfig *m_instance;
109 #endif