Back to index

kdeartwork  4.3.2
SolarWinds.h
Go to the documentation of this file.
00001 /*
00002  *  Terence Welsh Screensaver - Solar Winds
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 SOLARWINDS_H
00023 #define SOLARWINDS_H
00024 
00025 #include <qgl.h>
00026 
00027 
00028 #define LIGHTSIZE   64
00029 
00030 
00031 class wind;
00032 class QTimer;
00033 
00034 class SWindsWidget : public QGLWidget
00035 {
00036     Q_OBJECT
00037 
00038 public:
00039 
00040     enum eDefault
00041     {
00042         Regular,
00043         CosmicStrings,
00044         ColdPricklies,
00045         SpaceFur,
00046         Jiggly,
00047         Undertow,
00048 
00049         DefaultModes
00050     };
00051 
00052     SWindsWidget( QWidget* parent=0 );
00053     ~SWindsWidget();
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     wind* _winds;
00074     unsigned char lightTexture[LIGHTSIZE][LIGHTSIZE];
00075 
00076     int dWinds;
00077     int dEmitters;
00078     int dParticles;
00079     int dGeometry;
00080     float dSize;
00081     int dParticlespeed;
00082     int dEmitterspeed;
00083     int dWindspeed;
00084     int dBlur;
00085 
00086 
00087     // Using QTimer rather than timerEvent() to avoid getting locked out of
00088     // the QEvent loop on lower-end systems.  Ian Geiser <geiseri@kde.org>
00089     // says this is the way to go.
00090     QTimer* _timer;
00091     int _frameTime;
00092 
00093     friend class wind;
00094 };
00095 
00096 
00097 #ifndef UNIT_TEST
00098 #include <kdialog.h>
00099 #include <kscreensaver.h>
00100 
00101 
00102 class KSWindsScreenSaver : public KScreenSaver
00103 {
00104     Q_OBJECT
00105 
00106 public:
00107 
00108     KSWindsScreenSaver( WId id );
00109     virtual ~KSWindsScreenSaver();
00110 
00111     int mode() const { return _mode; }
00112 
00113 public slots:
00114 
00115     void setMode( int );
00116 
00117 private:
00118 
00119     void readSettings();
00120 
00121     SWindsWidget* _flux;
00122     int _mode;
00123 };
00124 
00125 
00126 class QComboBox;
00127 
00128 class KSWindsSetup : public KDialog
00129 {
00130     Q_OBJECT
00131 
00132 public:
00133 
00134     KSWindsSetup( QWidget* parent = 0 );
00135     ~KSWindsSetup();
00136 
00137 private slots:
00138 
00139     void slotHelp();
00140     void slotOk();
00141 
00142 private:
00143 
00144     QComboBox* modeW;
00145     KSWindsScreenSaver* _saver;
00146 };
00147 #endif
00148 
00149 
00150 #endif //__SOLARWINDS_H__