• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • superkaramba
 

superkaramba

  • superkaramba
  • src
karamba.h
1 /*
2  * Copyright (C) 2003 Hans Karlsson <karlsson.h@home.se>
3  * Copyright (C) 2004,2005 Luke Kenneth Casson Leighton <lkcl@lkcl.net>
4  * Copyright (C) 2003-2004 Adam Geitgey <adam@rootnode.org>
5  * Copyright (c) 2005 Ryan Nickell <p0z3r@earthlink.net>
6  *
7  * This file is part of SuperKaramba.
8  *
9  * SuperKaramba is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * SuperKaramba is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with SuperKaramba; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22  ****************************************************************************/
23 
24 #ifndef _KARAMBA_H_
25 #define _KARAMBA_H_
26 
27 #ifdef HAVE_CONFIG_H
28 #include <config.h>
29 #endif
30 
31 #include <tqwidget.h>
32 #include <tdeapplication.h>
33 
34 #include <twinmodule.h>
35 #include <twin.h>
36 
37 #include <tqfile.h>
38 #include <tdefile.h>
39 #include <tqfileinfo.h>
40 #include <tdeaction.h>
41 #include <tqtimer.h>
42 #include <tqpixmap.h>
43 #include <tqpainter.h>
44 
45 //#include <krootpixmap.h>
46 
47 #include <tqregexp.h>
48 #include <tqlabel.h>
49 #include <tqobjectlist.h>
50 #include <tqstring.h>
51 #include <tqstringlist.h>
52 #include <ksharedpixmap.h>
53 #include <tqvaluestack.h>
54 #include <dcopclient.h>
55 #include <tdepopupmenu.h>
56 #include <tqcursor.h>
57 #include <netwm.h>
58 #include <kiconloader.h>
59 #include <tdefiledialog.h>
60 #include <tqmap.h>
61 #include <kurl.h>
62 #include <krun.h>
63 #include <tqdatetime.h>
64 #include <tqbitmap.h>
65 #include <tdeconfig.h>
66 #include <tdeprocess.h>
67 #include <tqdragobject.h>
68 
69 #include "karambarootpixmap.h"
70 
71 #include "bar.h"
72 #include "textlabel.h"
73 #include "imagelabel.h"
74 #include "graph.h"
75 #include "input.h"
76 
77 #include "clickarea.h"
78 
79 #include "sensorparams.h"
80 #include "memsensor.h"
81 #include "datesensor.h"
82 #include "uptimesensor.h"
83 #include "memsensor.h"
84 #include "cpusensor.h"
85 #include "gpusensor.h"
86 #include "networksensor.h"
87 #include "xmmssensor.h"
88 #include "noatunsensor.h"
89 #include "programsensor.h"
90 #include "disksensor.h"
91 #include "sensorsensor.h"
92 #include "textfilesensor.h"
93 
94 #include "clickmap.h"
95 #include "rsssensor.h"
96 //#include "clickable.h"
97 #include "taskmanager.h"
98 #include "showdesktop.h"
99 #include "systemtray.h"
100 #include "themefile.h"
101 
110 class KarambaPython;
111 class LineParser;
112 
113 class karamba : public TQWidget
114 {
115  TQ_OBJECT
116 
117 
118 public:
119  karamba(TQString fn, TQString name, bool reloading = false,
120  int instance = -1, bool sub_theme = false);
121  TQObjectList *menuList;
122 
123  virtual ~karamba();
124  const ThemeFile& theme() const { return m_theme; };
125 
126  TQObjectList *meterList;
127  TQObjectList *imageList;
128  TQObjectList *clickList;
129  void setSensor(const LineParser& lineParser, Meter* meter);
130  TQString getSensor(Meter* meter);
131  TQString findSensorFromMap(Sensor* sensor);
132  void deleteMeterFromSensors(Meter* meter);
133  Sensor* findSensorFromList(Meter* meter);
134  TDEPopupMenu* keditpop;
135  TDEPopupMenu *kpop;
136  TQBitmap* widgetMask;
137  KarambaRootPixmap *kroot;
138  TaskManager taskManager;
139  Systemtray* systray;
140  TDEProcess* currProcess;
141  bool useSmoothTransforms();
142 
143  void changeInterval(int interval);
144  void setWidgetUpdate(bool wu) { widgetUpdate = wu; };
145  bool getWidgetUpdate() { return widgetUpdate; };
146  bool hasMeter(Meter* meter) { return meterList->containsRef(meter) > 0; };
147  char getTempUnit() { return tempUnit; };
148  void addMenuConfigOption(TQString key, TQString name);
149  bool setMenuConfigOption(TQString key, bool value);
150  bool readMenuConfigOption(TQString key);
151  void writeConfigData();
152  TextField* getDefaultTextProps() { return defaultTextField; };
153  int instance() const { return m_instance; };
154  void setInstance(int instance) { m_instance = instance; };
155  void closeTheme(bool reloading = false);
156  void keyPressed(const TQString& s, const Meter* meter);
157 
158  int numberOfConfMenuItems;
159  TDEConfig* config;
160  TQString prettyName;
161  bool m_sub_theme;
162  bool isSubTheme() { return m_sub_theme; }
163 
164  void toggleWidgetUpdate( bool );
165 
166  KWinModule* kWinModule;
167 
168  TQString incomingData;
169  TQString getIncomingData() { return incomingData; }
170  void _setIncomingData(TQString data) { incomingData = data; }
171  void setIncomingData(TQString theme, TQString data);
172 
173  void themeNotify(TQString theme, TQString txt);
174  void callTheme(TQString theme, TQString txt);
175 
176  double getUpdateTime() { return update_time; }
177  void setUpdateTime(double time) { update_time = time; }
178 
179  void makeActive();
180  void makePassive();
181 
182  void showMenuExtension();
183  void hideMenuExtension();
184 
185 protected:
186  void mousePressEvent( TQMouseEvent *);
187  void wheelEvent( TQWheelEvent *);
188  void mouseReleaseEvent( TQMouseEvent *);
189  void mouseDoubleClickEvent( TQMouseEvent *);
190  void mouseMoveEvent( TQMouseEvent *);
191  void keyPressEvent ( TQKeyEvent * e );
192  void closeEvent ( TQCloseEvent *);
193  void paintEvent ( TQPaintEvent *);
194  void saveProperties(TDEConfig *);
195  void readProperties(TDEConfig *);
196  void dragEnterEvent(TQDragEnterEvent* event);
197  void dropEvent(TQDropEvent* event);
198 
199 private:
200  bool widgetUpdate;
201  bool repaintInProgress;
202  //bool reloading;
203  bool want_right_button;
204  bool want_meter_wheel_event;
205 
206  NETWinInfo* info;
207  bool onTop;
208  bool managed;
209  bool fixedPosition;
210  bool haveUpdated;
211  char tempUnit;
212  double update_time;
213  int m_instance;
214 
215  bool parseConfig();
216 
217  void passClick( TQMouseEvent* );
218  void passWheelClick( TQWheelEvent* );
219  void meterClicked(TQMouseEvent*, Meter*);
220 
221  TQMap<TQString, Sensor*> sensorMap;
222  TQObjectList *sensorList;
223  TQObjectList *timeList;
224 
225  TQTime lowerTimer;
226  // use only the first occurance of KARAMBA in a config file
227  bool foundKaramba;
228 
229  TDEPopupMenu* themeConfMenu;
230  TDEPopupMenu* toDesktopMenu;
231  TDEPopupMenu* kglobal;
232 
233  DCOPClient *client;
234  TQCString appId;
235 
236  TQPixmap pm;
237  TQPixmap background;
238  TQPainter p;
239 
240  TQPoint clickPos;
241  TDEActionCollection* accColl;
242  TDEActionCollection* menuAccColl;
243  TDEToggleAction *toggleLocked;
244  // use highquality scale and rotate algorithms
245  TDEToggleAction *toggleFastTransforms;
246 
247  // Python module references
248  KarambaPython* pythonIface;
249  TextField *defaultTextField;
250 
251  int desktop;
252  ThemeFile m_theme;
253 
254  int trayMenuSeperatorId;
255  int trayMenuQuitId;
256  int trayMenuToggleId;
257  int trayMenuThemeId;
258  void start();
259 
260 public slots:
261  void step();
262  void externalStep();
263  void widgetClosed();
264  void updateSensors();
265  void currentDesktopChanged(int);
266  void currentWallpaperChanged(int);
267  void slotToggleConfigOption(TQString key, bool);
268  void updateBackground(TDESharedPixmap*);
269  void passMenuOptionChanged(TQString key, bool);
270  void passMenuItemClicked(int);
271  void processExited (TDEProcess *proc);
272  void receivedStdout (TDEProcess *proc, char *buffer, int buflen);
273  void toDesktop(int desktopid, int menuid);
274  const char *getPrettyName() { return prettyName.ascii(); }
275 
276  // Systray
277  void systrayUpdated();
278 
279  // Task Manager
280  void startupAdded(Startup*);
281  void startupRemoved(Startup*);
282 
283  void taskAdded(Task*);
284  void taskRemoved(Task*);
285  void activeTaskChanged(Task*);
286  void reloadConfig();
287 
288  void setAlwaysOnTop(bool stay);
289 
294  void setWantRightButton(bool yesno) { want_right_button = yesno; }
295 
296  void setWantMeterWheelEvent(bool yesno) { want_meter_wheel_event = yesno; }
297 
301  void management_popup( void );
302 
303 private:
304  bool m_reloading;
305  bool themeStarted;
306  TQTimer *m_sysTimer;
307  int m_interval;
308 
309 private slots:
310  void initPythonInterface();
311  void killWidget();
312  void editConfig();
313  void editScript();
314  void slotToggleLocked();
315  void slotToggleFastTransforms();
316  void popupNotify(int);
317  void slotFileChanged( const TQString & );
318 
319  void slotToggleSystemTray();
320  void slotQuit();
321  void slotShowTheme();
322 };
323 
324 /*
325  * Slot to receive the event of moving the karamba object
326  * to a new desktop. Generated by karamba::toDesktopMenu items
327  */
328 class DesktopChangeSlot : public TQObject
329 {
330  TQ_OBJECT
331 
332 
333  public:
334  DesktopChangeSlot(TQObject *parent, int desktop_id);
335  /* Parent should be the karamba object
336  * desktop id of 0 indicates all desktops */
337  void setMenuId(int id);
338  int menuId();
339 
340  public slots:
341  void receive();
342 
343  protected:
344  int desktopid;
345  int menuid;
346 };
347 
349 class SignalBridge : public TQObject
350 {
351  TQ_OBJECT
352 
353 
354  public:
355  SignalBridge(TQObject* parent, TQString, TDEActionCollection*);
356 
357  signals:
358  void enabled(TQString, bool);
359 
360  public slots:
361  void receive();
362 
363  private:
364  TDEActionCollection* collection;
365 };
366 
367 #endif // _KARAMBA_H_
ThemeFile
Definition: themefile.h:42
Startup
Represents a task which is in the process of starting.
Definition: taskmanager.h:376
TaskManager
A generic API for task managers.
Definition: taskmanager.h:432
SignalBridge
SignalBridge is an ungulate that lives in the forests of wild Wisconsin.
Definition: karamba.h:349
LineParser
Definition: lineparser.h:33
KarambaRootPixmap
Definition: karambarootpixmap.h:22
Task
A dynamic interface to a task (main window).
Definition: taskmanager.h:49
TextField
Ralph M.
Definition: textfield.h:21

superkaramba

Skip menu "superkaramba"
  • Main Page
  • Alphabetical List
  • Class List
  • File List
  • Class Members

superkaramba

Skip menu "superkaramba"
  • kcalc
  •   knumber
  • superkaramba
Generated for superkaramba by doxygen 1.8.13
This website is maintained by Timothy Pearson.