Back to index

kdeartwork  4.3.2
Flux.h
Go to the documentation of this file.
00001 /*
00002  *  Terence Welsh Screensaver - Flux
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 FLUXSS_H
00023 #define FLUXSS_H
00024 
00025 #include <qgl.h>
00026 
00027 #define LIGHTSIZE   64
00028 
00029 class flux;
00030 class particle;
00031 class QTimer;
00032 
00033 class FluxWidget : public QGLWidget
00034 {
00035     Q_OBJECT
00036 
00037 public:
00038 
00039     enum eDefault
00040     {
00041         Regular,
00042         Hypnotic,
00043         Insane,
00044         Sparklers,
00045         Paradigm,
00046         Galactic,
00047         DefaultModes
00048     };
00049 
00050     FluxWidget( QWidget* parent=0 );
00051     ~FluxWidget();
00052 
00053     void setDefaults( int which );
00054     void updateParameters();
00055 
00056 protected:
00057 
00058     void paintGL();
00059     void resizeGL( int w, int h );
00060     void initializeGL();
00061 #ifdef UNIT_TEST
00062     void keyPressEvent( QKeyEvent* );
00063 #endif
00064 
00065 private slots:
00066 
00067     void nextFrame();
00068 
00069 private:
00070 
00071     float lumdiff;
00072     float cameraAngle;
00073     float cosCameraAngle, sinCameraAngle;
00074     unsigned char lightTexture[LIGHTSIZE][LIGHTSIZE];
00075 
00076     int dFluxes;
00077     int dParticles;
00078     int dTrail;
00079     int dGeometry;
00080     float dSize;
00081     int dComplexity;
00082     int dRandomize;
00083     int dExpansion;
00084     int dRotation;
00085     int dWind;
00086     float dInstability;
00087     int dBlur;
00088     int dSmart;
00089     int dPriority;
00090 
00091     flux* _fluxes;
00092 
00093     // Using QTimer rather than timerEvent() to avoid getting locked out of
00094     // the QEvent loop on lower-end systems.  Ian Geiser <geiseri@kde.org>
00095     // says this is the way to go.
00096     QTimer* _timer;
00097     int _frameTime;
00098 
00099     friend class flux;
00100     friend class particle;
00101 };
00102 
00103 
00104 #ifndef UNIT_TEST
00105 #include <kdialog.h>
00106 #include <kscreensaver.h>
00107 
00108 
00109 class KFluxScreenSaver : public KScreenSaver
00110 {
00111     Q_OBJECT
00112 
00113 public:
00114 
00115     KFluxScreenSaver( WId id );
00116     virtual ~KFluxScreenSaver();
00117 
00118     int mode() const { return _mode; }
00119 
00120 public slots:
00121 
00122     void setMode( int );
00123 
00124 private:
00125 
00126     void readSettings();
00127 
00128     FluxWidget* _flux;
00129     int _mode;
00130 };
00131 
00132 
00133 class QComboBox;
00134 
00135 class KFluxSetup : public KDialog
00136 {
00137     Q_OBJECT
00138 
00139 public:
00140 
00141     KFluxSetup( QWidget* parent = 0 );
00142     ~KFluxSetup();
00143 
00144 private slots:
00145 
00146     void slotHelp();
00147     void slotOk();
00148 
00149 private:
00150 
00151     QComboBox* modeW;
00152     KFluxScreenSaver* _saver;
00153 };
00154 #endif
00155 
00156 
00157 #endif //__FLUXSS_H__