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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
|
/*
* Copyright (C) 2003 Hans Karlsson <karlsson.h@home.se>
* Copyright (C) 2004,2005 Luke Kenneth Casson Leighton <lkcl@lkcl.net>
* Copyright (C) 2003-2004 Adam Geitgey <adam@rootnode.org>
* Copyright (c) 2005 Ryan Nickell <p0z3r@earthlink.net>
*
* This file is part of SuperKaramba.
*
* SuperKaramba 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 of the License, or
* (at your option) any later version.
*
* SuperKaramba 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.
*
* You should have received a copy of the GNU General Public License
* along with SuperKaramba; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
****************************************************************************/
#ifndef _KARAMBA_H_
#define _KARAMBA_H_
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <tqwidget.h>
#include <tdeapplication.h>
#include <twinmodule.h>
#include <twin.h>
#include <tqfile.h>
#include <tdefile.h>
#include <tqfileinfo.h>
#include <tdeaction.h>
#include <tqtimer.h>
#include <tqpixmap.h>
#include <tqpainter.h>
//#include <krootpixmap.h>
#include <tqregexp.h>
#include <tqlabel.h>
#include <tqobjectlist.h>
#include <tqstring.h>
#include <tqstringlist.h>
#include <ksharedpixmap.h>
#include <tqvaluestack.h>
#include <dcopclient.h>
#include <tdepopupmenu.h>
#include <tqcursor.h>
#include <netwm.h>
#include <kiconloader.h>
#include <tdefiledialog.h>
#include <tqmap.h>
#include <kurl.h>
#include <krun.h>
#include <tqdatetime.h>
#include <tqbitmap.h>
#include <tdeconfig.h>
#include <kprocess.h>
#include <tqdragobject.h>
#include "karambarootpixmap.h"
#include "bar.h"
#include "textlabel.h"
#include "imagelabel.h"
#include "graph.h"
#include "input.h"
#include "clickarea.h"
#include "sensorparams.h"
#include "memsensor.h"
#include "datesensor.h"
#include "uptimesensor.h"
#include "memsensor.h"
#include "cpusensor.h"
#include "networksensor.h"
#include "xmmssensor.h"
#include "noatunsensor.h"
#include "programsensor.h"
#include "disksensor.h"
#include "sensorsensor.h"
#include "textfilesensor.h"
#include "clickmap.h"
#include "rsssensor.h"
//#include "clickable.h"
#include "taskmanager.h"
#include "showdesktop.h"
#include "systemtray.h"
#include "themefile.h"
/**
* @short Application Main Window
* @author Adam Geitgey <adam@rootnode.org>
* @author Hans Karlsson <karlsson.h@home.se>
* @author Luke Kenneth Casson Leighton <lkcl@lkcl.net>
* @version 0.26
*/
class KarambaPython;
class LineParser;
class karamba : public TQWidget
{
Q_OBJECT
public:
karamba(TQString fn, TQString name, bool reloading = false,
int instance = -1, bool sub_theme = false);
TQObjectList *menuList;
virtual ~karamba();
const ThemeFile& theme() const { return m_theme; };
TQObjectList *meterList;
TQObjectList *imageList;
TQObjectList *clickList;
void setSensor(const LineParser& lineParser, Meter* meter);
TQString getSensor(Meter* meter);
TQString findSensorFromMap(Sensor* sensor);
void deleteMeterFromSensors(Meter* meter);
Sensor* findSensorFromList(Meter* meter);
TDEPopupMenu* keditpop;
TDEPopupMenu *kpop;
TQBitmap* widgetMask;
KarambaRootPixmap *kroot;
TaskManager taskManager;
Systemtray* systray;
TDEProcess* currProcess;
bool useSmoothTransforms();
void changeInterval(int interval);
void setWidgetUpdate(bool wu) { widgetUpdate = wu; };
bool getWidgetUpdate() { return widgetUpdate; };
bool hasMeter(Meter* meter) { return meterList->containsRef(meter) > 0; };
char getTempUnit() { return tempUnit; };
void addMenuConfigOption(TQString key, TQString name);
bool setMenuConfigOption(TQString key, bool value);
bool readMenuConfigOption(TQString key);
void writeConfigData();
TextField* getDefaultTextProps() { return defaultTextField; };
int instance() const { return m_instance; };
void setInstance(int instance) { m_instance = instance; };
void closeTheme(bool reloading = false);
void keyPressed(const TQString& s, const Meter* meter);
int numberOfConfMenuItems;
TDEConfig* config;
TQString prettyName;
bool m_sub_theme;
bool isSubTheme() { return m_sub_theme; }
void toggleWidgetUpdate( bool );
KWinModule* kWinModule;
TQString incomingData;
TQString getIncomingData() { return incomingData; }
void _setIncomingData(TQString data) { incomingData = data; }
void setIncomingData(TQString theme, TQString data);
void themeNotify(TQString theme, TQString txt);
void callTheme(TQString theme, TQString txt);
double getUpdateTime() { return update_time; }
void setUpdateTime(double time) { update_time = time; }
void makeActive();
void makePassive();
void showMenuExtension();
void hideMenuExtension();
protected:
void mousePressEvent( TQMouseEvent *);
void wheelEvent( TQWheelEvent *);
void mouseReleaseEvent( TQMouseEvent *);
void mouseDoubleClickEvent( TQMouseEvent *);
void mouseMoveEvent( TQMouseEvent *);
void keyPressEvent ( TQKeyEvent * e );
void closeEvent ( TQCloseEvent *);
void paintEvent ( TQPaintEvent *);
void saveProperties(TDEConfig *);
void readProperties(TDEConfig *);
void dragEnterEvent(TQDragEnterEvent* event);
void dropEvent(TQDropEvent* event);
private:
bool widgetUpdate;
bool repaintInProgress;
//bool reloading;
bool want_right_button;
bool want_meter_wheel_event;
NETWinInfo* info;
bool onTop;
bool managed;
bool fixedPosition;
bool haveUpdated;
char tempUnit;
double update_time;
int m_instance;
bool parseConfig();
void passClick( TQMouseEvent* );
void passWheelClick( TQWheelEvent* );
void meterClicked(TQMouseEvent*, Meter*);
TQMap<TQString, Sensor*> sensorMap;
TQObjectList *sensorList;
TQObjectList *timeList;
TQTime lowerTimer;
// use only the first occurance of KARAMBA in a config file
bool foundKaramba;
TDEPopupMenu* themeConfMenu;
TDEPopupMenu* toDesktopMenu;
TDEPopupMenu* kglobal;
DCOPClient *client;
TQCString appId;
TQPixmap pm;
TQPixmap background;
TQPainter p;
TQPoint clickPos;
TDEActionCollection* accColl;
TDEActionCollection* menuAccColl;
TDEToggleAction *toggleLocked;
// use highquality scale and rotate algorithms
TDEToggleAction *toggleFastTransforms;
// Python module references
KarambaPython* pythonIface;
TextField *defaultTextField;
int desktop;
ThemeFile m_theme;
int trayMenuSeperatorId;
int trayMenuQuitId;
int trayMenuToggleId;
int trayMenuThemeId;
void start();
public slots:
void step();
void externalStep();
void widgetClosed();
void updateSensors();
void currentDesktopChanged(int);
void currentWallpaperChanged(int);
void slotToggleConfigOption(TQString key, bool);
void updateBackground(TDESharedPixmap*);
void passMenuOptionChanged(TQString key, bool);
void passMenuItemClicked(int);
void processExited (TDEProcess *proc);
void receivedStdout (TDEProcess *proc, char *buffer, int buflen);
void toDesktop(int desktopid, int menuid);
const char *getPrettyName() { return prettyName.ascii(); }
// Systray
void systrayUpdated();
// Task Manager
void startupAdded(Startup*);
void startupRemoved(Startup*);
void taskAdded(Task*);
void taskRemoved(Task*);
void activeTaskChanged(Task*);
void reloadConfig();
void setAlwaysOnTop(bool stay);
/**
* If true, then when a right button is pressed on the theme,
* the theme's python widgetMouseMoved function is called.
*/
void setWantRightButton(bool yesno) { want_right_button = yesno; }
void setWantMeterWheelEvent(bool yesno) { want_meter_wheel_event = yesno; }
/**
* can be used to fire up the karamba management popup menu
*/
void management_popup( void );
private:
bool m_reloading;
bool themeStarted;
TQTimer *m_sysTimer;
int m_interval;
private slots:
void initPythonInterface();
void killWidget();
void editConfig();
void editScript();
void slotToggleLocked();
void slotToggleFastTransforms();
void popupNotify(int);
void slotFileChanged( const TQString & );
void slotToggleSystemTray();
void slotQuit();
void slotShowTheme();
};
/*
* Slot to receive the event of moving the karamba object
* to a new desktop. Generated by karamba::toDesktopMenu items
*/
class DesktopChangeSlot : public TQObject
{
Q_OBJECT
public:
DesktopChangeSlot(TQObject *parent, int desktop_id);
/* Parent should be the karamba object
* desktop id of 0 indicates all desktops */
void setMenuId(int id);
int menuId();
public slots:
void receive();
protected:
int desktopid;
int menuid;
};
/** SignalBridge is an ungulate that lives in the forests of wild Wisconsin. */
class SignalBridge : public TQObject
{
Q_OBJECT
public:
SignalBridge(TQObject* parent, TQString, TDEActionCollection*);
signals:
void enabled(TQString, bool);
public slots:
void receive();
private:
TDEActionCollection* collection;
};
#endif // _KARAMBA_H_
|