[0f6817]: kwave / about.cpp Maximize Restore History

Download this file

about.cpp    170 lines (141 with data), 4.7 kB

  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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
#include "about.h"
#include <qaccel.h>
#include <qpntarry.h>
#include <qdir.h>
#include <math.h>
#include <kapp.h>
extern KApplication *app;
char about_text[]="\nKwave Version 0.29.3 alpha release\n\
(c) 1998 by Martin Wilz (mwilz@ernie.mi.uni-koeln.de)\n\n\
\nFFT-Code by GNU gsl-Project, library version 0.3 beta\n\
(GSL-Library may be retrieved from ftp://alpha.gnu.org/gnu/)\n\n\
Memory Mapping routines by Juhana Kouhia\n\n\
Some Gui modifications and additional functionality by Gerhard Zintel\n\n\
Thanks go to:\n\
Carsten Jacobi\n\
Frank Christian Stoffel\n\
Achim Dahlhaus\n
Klaus Hendrik Lorenz\n\n
This program is free software; you can redistribute it and/or\n\
modify it under the terms of the GNU General Public License\n\
as published by the Free Software Foundation; either version 2\n\
of the License, or (at your option) any later version.\n\n\
This program is distributed in the hope that it will be useful,\n\
but WITHOUT ANY WARRANTY; without even the implied warranty of\n\
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n\
GNU General Public License for more details.\n\n\
You should have received a copy of the GNU General Public License\n\
along with this program; if not, write to the Free Software\n\
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.\n";
AboutDialog::AboutDialog (QWidget *par=NULL): QDialog(par, "Choose Length and Rate",true)
{
resize (480,200);
setCaption ("About KWave");
abouttext=new QMultiLineEdit (this);
ok =new QPushButton ("Ok",this);
logo=new LogoWidget (this);
abouttext->setText(about_text);
abouttext->setReadOnly(TRUE);
abouttext->setCursorPosition (0,0);
int bsize=ok->sizeHint().height();
setMinimumSize (480,bsize*6);
setMaximumSize (640,400);
ok->setAccel (Key_Return);
ok->setFocus ();
connect (ok ,SIGNAL(clicked()),SLOT (accept()));
}
//**********************************************************
void AboutDialog::resizeEvent (QResizeEvent *)
{
int bsize=ok->sizeHint().height();
abouttext->setGeometry(width()/6,0,width()*5/6,height()-bsize*3/2);
logo->setGeometry (0,0,width()/6,height()-bsize*3/2);
ok->setGeometry (width()/20,height()-bsize*5/4,width()*18/20,bsize);
}
//**********************************************************
AboutDialog::~AboutDialog ()
{
}
//**********************************************************
LogoWidget::LogoWidget (QWidget *parent): QWidget (parent)
{
for (int i=0;i<MAXSIN;deg[i++]=0);
height=-1;
pixmap=0;
img=new QPixmap ();
QString dirname=app->kde_datadir ();
QDir dir (dirname.data());
dir.cd ("kwave");
dir.cd ("pics");
img->convertFromImage (QImage(dir.filePath("logo.xpm").data()));
this->setBackgroundColor (black);
timer=new QTimer (this);
connect (timer,SIGNAL(timeout()),this,SLOT(doAnim()));
timer->start (40,false); //gives 50 Hz refresh... qt-lib gives interlace-feeling ;-)...
}
//**********************************************************
void LogoWidget::doAnim ()
{
double mul=0.04131211+deg[MAXSIN-1]/75;
for (int i=0;i<MAXSIN;i++)
{
deg[i]+=mul;
if (deg[i]>2*M_PI) deg[i]=0;
mul=((mul*521)/437);
mul-=floor(mul); // gives again a number between 0 and 1
mul/=17;
mul+=deg[i]/100; //so that chaos may be ...
}
rpaint=true;
repaint ();
}
//**********************************************************
LogoWidget::~LogoWidget ()
{
if (img) delete img;
timer->stop();
}
//**********************************************************
void LogoWidget::paintEvent (QPaintEvent *)
{
///if pixmap has to be resized ...
if ((rect().height()!=height)||(rect().width()!=width))
{
height=rect().height();
width=rect().width();
if (pixmap) delete pixmap;
pixmap=new QPixmap (size());
rpaint=true;
}
if ((rpaint)&&(pixmap))
{
QPointArray si(20+3);
p.begin (pixmap);
p.setPen (white);
p.setBrush (white);
p.drawRect (0,0,width,height);
p.setRasterOp (XorROP);
double amp=sin (deg[MAXSIN-1]*3);
for (int j=0;j<MAXSIN;j++)
{
for (int i=0;i<21;i++)
si.setPoint (i,
(j*width/MAXSIN)+(int)(amp*sin(M_PI*i/10+deg[j])*width/2),height*i/20);
si.setPoint (21,width/2,height);
si.setPoint (22,width/2,0);
p.drawPolygon (si);
amp=sin (deg[j]*3);
}
p.end();
rpaint=false;
}
//blit pixmap to window in every case
int ampx=(img->width()-width)/2;
int ampy=(img->height()-height)/2;
if (pixmap)
{
bitBlt (this,-ampx+(int) (sin(deg[0])*ampx),-ampy+(int) (sin(deg[1])*ampy),
img,0,0,img->width(),img->height(),CopyROP);
bitBlt (this,0,0,pixmap,0,0,width,height,XorROP);
}
}