00001
00002
00003
00004
00005 #ifndef _KARAMBA_H_
00006 #define _KARAMBA_H_
00007
00008 #ifdef HAVE_CONFIG_H
00009 #include <config.h>
00010 #endif
00011
00012 #include <qwidget.h>
00013 #include <qfile.h>
00014 #include <qfileinfo.h>
00015 #include <qtimer.h>
00016 #include <qpixmap.h>
00017 #include <qpainter.h>
00018 #include <qregexp.h>
00019 #include <qlabel.h>
00020 #include <qobjectlist.h>
00021 #include <qstring.h>
00022 #include <qstringlist.h>
00023 #include <qvaluestack.h>
00024 #include <qcursor.h>
00025 #include <qmap.h>
00026 #include <qdatetime.h>
00027
00028 #include <kapplication.h>
00029 #include <kwinmodule.h>
00030 #include <kwin.h>
00031 #include <kfile.h>
00032 #include <kaction.h>
00033 #include <ksharedpixmap.h>
00034 #include <dcopclient.h>
00035 #include <dcopref.h>
00036 #include <kpopupmenu.h>
00037 #include <kiconloader.h>
00038 #include <kfiledialog.h>
00039 #include <kurl.h>
00040 #include <krun.h>
00041 #include <ksimpleconfig.h>
00042 #include <kaboutapplication.h>
00043 #include <kaboutkde.h>
00044 #include <kpixmapeffect.h>
00045 #include <kdebug.h>
00046
00047 #include <netwm.h>
00048
00049 #include "karambarootpixmap.h"
00050 #include "bar.h"
00051 #include "textlabel.h"
00052 #include "imagelabel.h"
00053 #include "iconlabel.h"
00054 #include "iconbox/iconboxlabel.h"
00055 #include "graph.h"
00056 #include "clickarea.h"
00057 #include "child.h"
00058 #include "sensorparams.h"
00059 #include "memsensor.h"
00060 #include "datesensor.h"
00061 #include "uptimesensor.h"
00062 #include "memsensor.h"
00063 #include "cpusensor.h"
00064 #include "networksensor.h"
00065 #include "xmmssensor.h"
00066 #include "noatunsensor.h"
00067 #include "programsensor.h"
00068 #include "disksensor.h"
00069 #include "sensorsensor.h"
00070 #include "textfilesensor.h"
00071 #include "karambaconf.h"
00072 #include "meterlist.h"
00073 #include "dcopiface.h"
00074
00075 class IconLabel;
00076 class IconBoxLabel;
00077
00083 class karamba : public QWidget, virtual public DCOPiface
00084 {
00085 Q_OBJECT
00086
00087 public:
00088 karamba(QWidget* parent = 0, QString fn = 0, bool noquit = false);
00089
00090 virtual ~karamba();
00091
00092 bool isRunning;
00093 bool hidden;
00094 int themeX;
00095 int themeY;
00096 int themeW;
00097 int themeH;
00098 QString themeFile;
00099 QString themePath;
00103 QPtrList<karamba> *KarProcList;
00104 QPtrList<karamba> *KarChildList;
00105 QPtrList<IconLabel> *iconList;
00106 QPtrList<IconBoxLabel> *iconBoxList;
00107 QObjectList *clickList;
00108 QObjectList *meterList;
00109 bool foundKaramba;
00110 KPopupMenu *ksubpop;
00111
00112 protected:
00113 void mousePressEvent( QMouseEvent *);
00114 void mouseReleaseEvent( QMouseEvent *);
00115 void mouseDoubleClickEvent( QMouseEvent *);
00116 void mouseMoveEvent( QMouseEvent *);
00117 void dragMoveEvent( QDragMoveEvent *);
00118 void dropEvent(QDropEvent *e);
00119 void enterEvent ( QEvent *);
00120 void leaveEvent ( QEvent *);
00121 void dragEnterEvent ( QDragEnterEvent *);
00122 void dragLeaveEvent ( QDragLeaveEvent *);
00123 void closeEvent ( QCloseEvent *);
00124 void paintEvent ( QPaintEvent *);
00125 void windowActivationChange(bool b);
00126
00127 private:
00128 KWinModule* kWinModule;
00129 NETWinInfo* info;
00130 bool onTop;
00131 bool onBottom;
00132 bool fixedPosition;
00133 bool nq;
00134 QWidget* pr;
00135 QColor bgColor;
00136 QPtrList<MeterList> *m_meter_list;
00137 MeterList *m_meter;
00138
00139 bool parseConfig();
00140 int getInt( QString, QString & );
00141 int getInt( QString, QString &, bool & );
00145 void get3Int(QString w, QString &line, int&, int&, int& );
00146 void get3Int(QString w, QString &line, int&, int&, int&, bool& );
00147 QString getString( QString, QString & );
00148 QString getString( QString, QString &, bool& );
00149 bool getBoolean( QString, QString & );
00150 bool getBoolean( QString, QString &, bool& );
00151
00152 void setSensor( QString &line , Meter* meter);
00153 void passClick( QMouseEvent* );
00154
00155 QMap<QString, Sensor*> sensorMap;
00156 QObjectList *sensorList;
00157 QObjectList *childList;
00158 QObjectList *timeList;
00159 QObjectList *imageList;
00160 karamba* kn;
00161
00162 QTime lowerTimer;
00163 QTimer *m_sysTimer;
00167 DCOPClient *client;
00168 QCString appId;
00169 KPixmap pm;
00170 KPixmap background;
00171 bool fade;
00172 QColor fadeColor;
00173 double fadeLevel;
00174 KarambaRootPixmap *kroot;
00175 QString hidek;
00176 int Hlimit;
00177 bool MouseOver;
00178 bool popupIsShown;
00179
00180 QPoint clickPos;
00181 int clickX;
00182 int clickY;
00183 KActionCollection *accColl;
00184 KToggleAction *toggleLocked;
00185 bool locked;
00186 QPainter p;
00187 KPopupMenu *kpop;
00188 bool shadow;
00189 bool shadowed;
00190
00191 public slots:
00195 void updateSensors();
00199 void about();
00203 void aboutKDE();
00207 void reloadConfig();
00211 void startNewKaramba();
00215 void editConfig();
00219 void LaunchCreator();
00223 void Config();
00227 void toggleHide();
00231 void step();
00235 void updateBackground(KSharedPixmap*);
00239 void ChangeBgColor(QColor);
00243 void slotMove(int nx=0, int ny=0);
00247 QPtrList<MeterList>* getMeterList();
00251 void setActiveWin();
00252
00253 private slots:
00254 void currentDesktopChanged(int);
00255 void slotToggleLocked();
00256 void status( bool );
00257 void popupShown();
00258 void popupHiden();
00259
00260 signals:
00264 void karambaRun( bool );
00268 void ActiveWin( bool );
00272 void configChanged();
00273
00274 };
00275
00276 #endif // _KARAMBA_H_