summaryrefslogtreecommitdiffstats
path: root/tdescreensaver/kdesavers/kvm.h
blob: eb68d3a43c98939bbfe71ee00fd9126fbddc65af (plain)
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
//-----------------------------------------------------------------------------
//
// kvm screensaver
//

#ifndef __KVM_H__
#define __KVM_H__

#include <tqtimer.h>
#include <tqptrlist.h>

#include <kdialogbase.h>
#include <tdescreensaver.h>

extern "C" {
#include "vm.h"
#include "vm_random.h"
}

#define	THREAD_MAX_STACK_SIZE	10
#define	MAX_THREADS_NUM		20

#define	MAX_REFRESH_TIMEOUT	40

typedef struct {
  TQWidget *w;
  int grid_width, grid_height;
  int grid_margin_x;
  int grid_margin_y;
  int char_width, char_height;
  bool insert_top_p, insert_bottom_p;
  int density;
  struct tvm_pool*	pool;
  char*	modified;
  int	show_threads;

  TQPixmap images;
  int image_width, image_height;
  int nglyphs;

} m_state;


class kVmSaver : public KScreenSaver
{
	Q_OBJECT
  
public:
	kVmSaver( WId id );
	virtual ~kVmSaver();

	void setSpeed( int spd );
	void setRefreshTimeout( const int refreshTimeout );

protected:
	void blank();
	void readSettings();
        int getRandom( const int max_value );
        void modifyArea( const int op );

protected slots:
	void slotTimeout();

protected:
	TQTimer      timer;
	int         colorContext;

	int         speed;
	m_state*    pool_state;
        int	refreshStep;
        int	refreshTimeout;
};


class kVmSetup : public KDialogBase
{
	Q_OBJECT
  
public:
	kVmSetup( TQWidget *parent = NULL, const char *name = NULL );
    ~kVmSetup();
protected:
	void readSettings();

private slots:
	void slotSpeed( int );
	void slotRefreshTimeout( int num );
	void slotOk();
	void slotHelp();

private:
	TQWidget *preview;
	kVmSaver *saver;

	int speed;
	int refreshTimeout;
};


#endif