Back to index

kdeartwork  4.3.2
kvm.h
Go to the documentation of this file.
00001 //-----------------------------------------------------------------------------
00002 //
00003 // kvm screensaver
00004 //
00005 
00006 #ifndef KVM_H
00007 #define KVM_H
00008 
00009 #include <qtimer.h>
00010 
00011 #include <kdialog.h>
00012 #include <kscreensaver.h>
00013 
00014 extern "C" {
00015 #include "vm.h"
00016 #include "vm_random.h"
00017 }
00018 
00019 #define       THREAD_MAX_STACK_SIZE       10
00020 #define       MAX_THREADS_NUM             20
00021 
00022 #define       MAX_REFRESH_TIMEOUT  40
00023 
00024 typedef struct {
00025   QWidget *w;
00026   int grid_width, grid_height;
00027   int grid_margin_x;
00028   int grid_margin_y;
00029   int char_width, char_height;
00030   bool insert_top_p, insert_bottom_p;
00031   int density;
00032   struct tvm_pool*   pool;
00033   char*       modified;
00034   int  show_threads;
00035 
00036   QPixmap images;
00037   int image_width, image_height;
00038   int nglyphs;
00039 
00040 } m_state;
00041 
00042 
00043 class kVmSaver : public KScreenSaver
00044 {
00045        Q_OBJECT
00046 public:
00047        kVmSaver( WId id );
00048        virtual ~kVmSaver();
00049 
00050        void setSpeed( int spd );
00051        void setRefreshTimeout( const int refreshTimeout );
00052 
00053 protected:
00054        void readSettings();
00055         int getRandom( const int max_value );
00056         void modifyArea( const int op );
00057         void paintEvent(QPaintEvent *event);
00058 
00059 protected:
00060        QTimer      timer;
00061 
00062        int         speed;
00063        m_state*    pool_state;
00064         int   refreshStep;
00065         int   refreshTimeout;
00066 };
00067 
00068 
00069 class kVmSetup : public KDialog
00070 {
00071        Q_OBJECT
00072 public:
00073        kVmSetup( QWidget *parent = NULL );
00074     ~kVmSetup();
00075 protected:
00076        void readSettings();
00077 
00078 private slots:
00079        void slotSpeed( int );
00080        void slotRefreshTimeout( int num );
00081        void slotOk();
00082        void slotHelp();
00083 
00084 private:
00085        QWidget *preview;
00086        kVmSaver *saver;
00087 
00088        int speed;
00089        int refreshTimeout;
00090 };
00091 
00092 
00093 #endif
00094