Back to index

kdeartwork  4.3.2
Euphoria.h
Go to the documentation of this file.
00001 /*
00002  *  Terence Welsh Screensaver - Euphoria
00003  *  http://www.reallyslick.com/
00004  *
00005  *  Ported to KDE by Karl Robillard
00006  *  Copyright (C) 2002  Terence M. Welsh
00007  *
00008  *  This program is free software; you can redistribute it and/or
00009  *  modify it under the terms of the GNU General Public License as
00010  *  published by the Free Software Foundation; either version 2 of 
00011  *  the License, or (at your option) any later version.
00012  *   
00013  *  This program is distributed in the hope that it will be useful,
00014  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016  *  GNU General Public License for more details.
00017  *   
00018  *  You should have received a copy of the GNU General Public License
00019  *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
00020  */
00021 
00022 #ifndef EUPHORIASS_H
00023 #define EUPHORIASS_H
00024 
00025 #include <qgl.h>
00026 
00027 #include <kdialog.h>
00028 
00029 class wisp;
00030 class QTimer;
00031 
00032 class EuphoriaWidget : public QGLWidget
00033 {
00034     Q_OBJECT
00035 
00036 public:
00037 
00038     enum eDefault
00039     {
00040         Regular,
00041         Grid,
00042         Cubism,
00043         BadMath,
00044         MTheory,
00045         UHFTEM,   // ultra high frequency tunneling electron microscope
00046         Nowhere,
00047         Echo,
00048         Kaleidoscope,
00049         DefaultModes
00050     };
00051 
00052     EuphoriaWidget( QWidget* parent=0 );
00053     ~EuphoriaWidget();
00054 
00055     void updateParameters();
00056     void setDefaults( int which );
00057 
00058 protected:
00059 
00060     void paintGL();
00061     void resizeGL( int w, int h );
00062     void initializeGL();
00063 #ifdef UNIT_TEST
00064     void keyPressEvent( QKeyEvent* );
00065 #endif
00066 
00067 private slots:
00068 
00069     void nextFrame();
00070 
00071 private:
00072 
00073     GLuint texName;
00074     wisp* _wisps;
00075     wisp* _backwisps;
00076     unsigned char* feedbackmap;
00077     float aspectRatio;
00078     int viewport[4];
00079     double elapsedTime;
00080 
00081     // feedback texture object
00082     unsigned int feedbacktex;
00083     int feedbacktexsize;
00084     // feedback variables
00085     float fr[4];
00086     float fv[4];
00087     float f[4];
00088     // feedback limiters
00089     float lr[3];
00090     float lv[3];
00091     float l[3];
00092 
00093 
00094 
00095     int dWisps;
00096     int dBackground;
00097     int dDensity;
00098     int dVisibility;
00099     float dSpeed;
00100     int dFeedback;
00101     int dFeedbackspeed;
00102     int dFeedbacksize;
00103     int dWireframe;
00104     int dTexture;
00105     int dPriority;
00106 
00107 
00108     // Using QTimer rather than timerEvent() to avoid getting locked out of
00109     // the QEvent loop on lower-end systems.  Ian Geiser <geiseri@kde.org>
00110     // says this is the way to go.
00111     QTimer* _timer;
00112     int _frameTime;
00113 
00114     friend class wisp;
00115 };
00116 
00117 
00118 #ifndef UNIT_TEST
00119 #include <qdialog.h>
00120 #include <kscreensaver.h>
00121 
00122 
00123 class KEuphoriaScreenSaver : public KScreenSaver
00124 {
00125     Q_OBJECT
00126 
00127 public:
00128 
00129     KEuphoriaScreenSaver( WId id );
00130     virtual ~KEuphoriaScreenSaver();
00131 
00132     int mode() const { return _mode; }
00133 
00134 public slots:
00135 
00136     void setMode( int );
00137 
00138 private:
00139 
00140     void readSettings();
00141 
00142     EuphoriaWidget* _effect;
00143     int _mode;
00144 };
00145 
00146 
00147 class QComboBox;
00148 
00149 class KEuphoriaSetup : public KDialog
00150 {
00151     Q_OBJECT
00152 
00153 public:
00154     KEuphoriaSetup( QWidget* parent = 0 );
00155     ~KEuphoriaSetup();
00156 
00157 private slots:
00158     void slotHelp();
00159     void slotOk();
00160 
00161 private:
00162     QComboBox* modeW;
00163     KEuphoriaScreenSaver* _saver;
00164 };
00165 #endif
00166 
00167 #endif //__EUPHORIASS_H__