[c5c04b]: plugins / amplifyfree / module.cpp Maximize Restore History

Download this file

module.cpp    79 lines (63 with data), 2.3 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
#include <stdio.h>
#include <stdlib.h>
#include <qpushbutton.h>
#include <qkeycode.h>
#include <kapp.h>
#include "module.h"
#include "libkwave/String.h"
const char *version = "1.0";
const char *author = "Martin Wilz";
const char *name = "amplifyfree";
//**********************************************************
Dialog *getDialog(DialogOperation *operation)
{
return new AmplifyCurveDialog(operation->getLength(),
operation->isModal());
}
//**********************************************************
AmplifyCurveDialog::AmplifyCurveDialog (int time, bool modal)
:Dialog(modal)
{
comstr = 0;
setCaption (i18n("Choose Amplification Curve :"));
ok = new QPushButton (OK, this);
cancel = new QPushButton (CANCEL, this);
xscale = new ScaleWidget (this, 0, time, "ms");
yscale = new ScaleWidget (this, 100, 0, "%");
corner = new CornerPatchWidget (this);
curve = new CurveWidget (this);
int bsize = ok->sizeHint().height();
setMinimumSize (320, bsize*8);
resize (320, bsize*8);
ok->setAccel (Key_Return);
cancel->setAccel(Key_Escape);
ok->setFocus ();
connect (ok , SIGNAL(clicked()), SLOT (accept()));
connect (cancel , SIGNAL(clicked()), SLOT (reject()));
}
//**********************************************************
const char* AmplifyCurveDialog::getCommand ()
{
char buf[4096];
deleteString (comstr);
snprintf(buf, sizeof(buf), "amplifyfree (%s)", curve->getCommand());
comstr = duplicateString (buf);
return comstr;
}
//**********************************************************
void AmplifyCurveDialog::resizeEvent (QResizeEvent *)
{
int bsize = ok->sizeHint().height();
curve->setGeometry (8 + bsize, 0, width() - bsize - 16, height() - bsize*3);
xscale->setGeometry (8 + bsize, height() - bsize*3, width() - bsize - 16, bsize);
yscale->setGeometry (8, 0, bsize, height() - bsize*3);
corner->setGeometry (8, height() - bsize*3, bsize, bsize);
ok->setGeometry (width() / 10, height() - bsize*3 / 2, width()*3 / 10, bsize);
cancel->setGeometry (width()*6 / 10, height() - bsize*3 / 2, width()*3 / 10, bsize);
}
//**********************************************************
AmplifyCurveDialog::~AmplifyCurveDialog ()
{
deleteString (comstr);
delete curve ;
}