• 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 <kapplication.h>
33 
34 #include <kwinmodule.h>
35 #include <kwin.h>
36 
37 #include <tqfile.h>
38 #include <kfile.h>
39 #include <tqfileinfo.h>
40 #include <kaction.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 <kpopupmenu.h>
56 #include <tqcursor.h>
57 #include <netwm.h>
58 #include <kiconloader.h>
59 #include <kfiledialog.h>
60 #include <tqmap.h>
61 #include <kurl.h>
62 #include <krun.h>
63 #include <tqdatetime.h>
64 #include <tqbitmap.h>
65 #include <kconfig.h>
66 #include <kprocess.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 "networksensor.h"
86 #include "xmmssensor.h"
87 #include "noatunsensor.h"
88 #include "programsensor.h"
89 #include "disksensor.h"
90 #include "sensorsensor.h"
91 #include "textfilesensor.h"
92 
93 #include "clickmap.h"
94 #include "rsssensor.h"
95 //#include "clickable.h"
96 #include "taskmanager.h"
97 #include "showdesktop.h"
98 #include "systemtray.h"
99 #include "themefile.h"
100 
109 class KarambaPython;
110 class LineParser;
111 
112 class karamba : public TQWidget
113 {
114  Q_OBJECT
115  TQ_OBJECT
116 
117 public:
118  karamba(TQString fn, TQString name, bool reloading = false,
119  int instance = -1, bool sub_theme = false);
120  TQObjectList *menuList;
121 
122  virtual ~karamba();
123  const ThemeFile& theme() const { return m_theme; };
124 
125  TQObjectList *meterList;
126  TQObjectList *imageList;
127  TQObjectList *clickList;
128  void setSensor(const LineParser& lineParser, Meter* meter);
129  TQString getSensor(Meter* meter);
130  TQString findSensorFromMap(Sensor* sensor);
131  void deleteMeterFromSensors(Meter* meter);
132  Sensor* findSensorFromList(Meter* meter);
133  KPopupMenu* keditpop;
134  KPopupMenu *kpop;
135  TQBitmap* widgetMask;
136  KarambaRootPixmap *kroot;
137  TaskManager taskManager;
138  Systemtray* systray;
139  KProcess* currProcess;
140  bool useSmoothTransforms();
141 
142  void changeInterval(int interval);
143  void setWidgetUpdate(bool wu) { widgetUpdate = wu; };
144  bool getWidgetUpdate() { return widgetUpdate; };
145  bool hasMeter(Meter* meter) { return meterList->containsRef(meter) > 0; };
146  char getTempUnit() { return tempUnit; };
147  void addMenuConfigOption(TQString key, TQString name);
148  bool setMenuConfigOption(TQString key, bool value);
149  bool readMenuConfigOption(TQString key);
150  void writeConfigData();
151  TextField* getDefaultTextProps() { return defaultTextField; };
152  int instance() const { return m_instance; };
153  void setInstance(int instance) { m_instance = instance; };
154  void closeTheme(bool reloading = false);
155  void keyPressed(const TQString& s, const Meter* meter);
156 
157  int numberOfConfMenuItems;
158  KConfig* config;
159  TQString prettyName;
160  bool m_sub_theme;
161  bool isSubTheme() { return m_sub_theme; }
162 
163  void toggleWidgetUpdate( bool );
164 
165  KWinModule* kWinModule;
166 
167  TQString incomingData;
168  TQString getIncomingData() { return incomingData; }
169  void _setIncomingData(TQString data) { incomingData = data; }
170  void setIncomingData(TQString theme, TQString data);
171 
172  void themeNotify(TQString theme, TQString txt);
173  void callTheme(TQString theme, TQString txt);
174 
175  double getUpdateTime() { return update_time; }
176  void setUpdateTime(double time) { update_time = time; }
177 
178  void makeActive();
179  void makePassive();
180 
181  void showMenuExtension();
182  void hideMenuExtension();
183 
184 protected:
185  void mousePressEvent( TQMouseEvent *);
186  void wheelEvent( TQWheelEvent *);
187  void mouseReleaseEvent( TQMouseEvent *);
188  void mouseDoubleClickEvent( TQMouseEvent *);
189  void mouseMoveEvent( TQMouseEvent *);
190  void keyPressEvent ( TQKeyEvent * e );
191  void closeEvent ( TQCloseEvent *);
192  void paintEvent ( TQPaintEvent *);
193  void saveProperties(KConfig *);
194  void readProperties(KConfig *);
195  void dragEnterEvent(TQDragEnterEvent* event);
196  void dropEvent(TQDropEvent* event);
197 
198 private:
199  bool widgetUpdate;
200  bool repaintInProgress;
201  //bool reloading;
202  bool want_right_button;
203  bool want_meter_wheel_event;
204 
205  NETWinInfo* info;
206  bool onTop;
207  bool managed;
208  bool fixedPosition;
209  bool haveUpdated;
210  char tempUnit;
211  double update_time;
212  int m_instance;
213 
214  bool parseConfig();
215 
216  void passClick( TQMouseEvent* );
217  void passWheelClick( TQWheelEvent* );
218  void meterClicked(TQMouseEvent*, Meter*);
219 
220  TQMap<TQString, Sensor*> sensorMap;
221  TQObjectList *sensorList;
222  TQObjectList *timeList;
223 
224  TQTime lowerTimer;
225  // use only the first occurance of KARAMBA in a config file
226  bool foundKaramba;
227 
228  KPopupMenu* themeConfMenu;
229  KPopupMenu* toDesktopMenu;
230  KPopupMenu* kglobal;
231 
232  DCOPClient *client;
233  TQCString appId;
234 
235  TQPixmap pm;
236  TQPixmap background;
237  TQPainter p;
238 
239  TQPoint clickPos;
240  KActionCollection* accColl;
241  KActionCollection* menuAccColl;
242  KToggleAction *toggleLocked;
243  // use highquality scale and rotate algorithms
244  KToggleAction *toggleFastTransforms;
245 
246  // Python module references
247  KarambaPython* pythonIface;
248  TextField *defaultTextField;
249 
250  int desktop;
251  ThemeFile m_theme;
252 
253  int trayMenuSeperatorId;
254  int trayMenuQuitId;
255  int trayMenuToggleId;
256  int trayMenuThemeId;
257  void start();
258 
259 public slots:
260  void step();
261  void externalStep();
262  void widgetClosed();
263  void updateSensors();
264  void currentDesktopChanged(int);
265  void currentWallpaperChanged(int);
266  void slotToggleConfigOption(TQString key, bool);
267  void updateBackground(KSharedPixmap*);
268  void passMenuOptionChanged(TQString key, bool);
269  void passMenuItemClicked(int);
270  void processExited (KProcess *proc);
271  void receivedStdout (KProcess *proc, char *buffer, int buflen);
272  void toDesktop(int desktopid, int menuid);
273  const char *getPrettyName() { return prettyName.ascii(); }
274 
275  // Systray
276  void systrayUpdated();
277 
278  // Task Manager
279  void startupAdded(Startup*);
280  void startupRemoved(Startup*);
281 
282  void taskAdded(Task*);
283  void taskRemoved(Task*);
284  void activeTaskChanged(Task*);
285  void reloadConfig();
286 
287  void setAlwaysOnTop(bool stay);
288 
293  void setWantRightButton(bool yesno) { want_right_button = yesno; }
294 
295  void setWantMeterWheelEvent(bool yesno) { want_meter_wheel_event = yesno; }
296 
300  void management_popup( void );
301 
302 private:
303  bool m_reloading;
304  bool themeStarted;
305  TQTimer *m_sysTimer;
306  int m_interval;
307 
308 private slots:
309  void initPythonInterface();
310  void killWidget();
311  void editConfig();
312  void editScript();
313  void slotToggleLocked();
314  void slotToggleFastTransforms();
315  void popupNotify(int);
316  void slotFileChanged( const TQString & );
317 
318  void slotToggleSystemTray();
319  void slotQuit();
320  void slotShowTheme();
321 };
322 
323 /*
324  * Slot to receive the event of moving the karamba object
325  * to a new desktop. Generated by karamba::toDesktopMenu items
326  */
327 class DesktopChangeSlot : public TQObject
328 {
329  Q_OBJECT
330  TQ_OBJECT
331 
332  public:
333  DesktopChangeSlot(TQObject *parent, int desktop_id);
334  /* Parent should be the karamba object
335  * desktop id of 0 indicates all desktops */
336  void setMenuId(int id);
337  int menuId();
338 
339  public slots:
340  void receive();
341 
342  protected:
343  int desktopid;
344  int menuid;
345 };
346 
348 class SignalBridge : public TQObject
349 {
350  Q_OBJECT
351  TQ_OBJECT
352 
353  public:
354  SignalBridge(TQObject* parent, TQString, KActionCollection*);
355 
356  signals:
357  void enabled(TQString, bool);
358 
359  public slots:
360  void receive();
361 
362  private:
363  KActionCollection* collection;
364 };
365 
366 #endif // _KARAMBA_H_

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.1.2
This website is maintained by Timothy Pearson.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. |