lbarthelemy@245
|
1 #include <QLabel>
|
lbarthelemy@245
|
2 #include "AudioRecorderWidget.h"
|
lbarthelemy@245
|
3
|
lbarthelemy@245
|
4
|
lbarthelemy@245
|
5 AudioRecorderWidget::AudioRecorderWidget(QWidget *parent){
|
lbarthelemy@245
|
6 this->setWindowFlags(Qt::ToolTip);
|
lbarthelemy@245
|
7
|
lbarthelemy@245
|
8 QLabel *labelTitle = new QLabel(tr("Voice recorder:"));
|
lbarthelemy@245
|
9
|
lbarthelemy@245
|
10 m_buttonBox = new QDialogButtonBox(Qt::Horizontal);
|
lbarthelemy@245
|
11 m_okButton = new QPushButton(tr("Ok"));
|
lbarthelemy@245
|
12 m_cancelButton = new QPushButton(tr("Cancel"));
|
lbarthelemy@245
|
13 m_startButton = new QPushButton(tr("Start"));
|
lbarthelemy@245
|
14 m_stopButton = new QPushButton(tr("Stop"));
|
lbarthelemy@245
|
15 m_playButton = new QPushButton(tr("Play"));
|
lbarthelemy@245
|
16
|
lbarthelemy@245
|
17 QFrame *auxFrame = new QFrame();
|
lbarthelemy@245
|
18 QVBoxLayout *mainLayout = new QVBoxLayout;
|
lbarthelemy@245
|
19 QVBoxLayout *auxLayout = new QVBoxLayout;
|
lbarthelemy@245
|
20 QHBoxLayout *centralLayout = new QHBoxLayout();
|
lbarthelemy@245
|
21 QFrame *centralFrame = new QFrame();
|
lbarthelemy@245
|
22
|
lbarthelemy@245
|
23 //populate the central layout
|
lbarthelemy@245
|
24 centralLayout->addWidget(m_startButton);
|
lbarthelemy@245
|
25 centralLayout->addWidget(m_stopButton);
|
lbarthelemy@245
|
26 centralLayout->addWidget(m_playButton);
|
lbarthelemy@245
|
27
|
lbarthelemy@245
|
28 //////
|
lbarthelemy@245
|
29
|
lbarthelemy@245
|
30
|
lbarthelemy@245
|
31 centralFrame->setLayout(centralLayout);
|
lbarthelemy@245
|
32
|
lbarthelemy@245
|
33 labelTitle->setAlignment(Qt::AlignCenter);
|
lbarthelemy@245
|
34
|
lbarthelemy@245
|
35 // default button for enter key
|
lbarthelemy@245
|
36 m_okButton->setDefault(true);
|
lbarthelemy@245
|
37
|
lbarthelemy@245
|
38 m_buttonBox->addButton(m_okButton, QDialogButtonBox::AcceptRole);
|
lbarthelemy@245
|
39 m_buttonBox->addButton(m_cancelButton, QDialogButtonBox::RejectRole);
|
lbarthelemy@245
|
40
|
lbarthelemy@245
|
41 connect(m_okButton, SIGNAL(clicked()), this, SLOT(accept()));
|
lbarthelemy@245
|
42 connect(m_cancelButton, SIGNAL(clicked()), this, SLOT(reject()));
|
lbarthelemy@245
|
43
|
lbarthelemy@245
|
44 auxLayout->addWidget(labelTitle);
|
lbarthelemy@245
|
45 auxLayout->addWidget(centralFrame);
|
lbarthelemy@245
|
46 auxLayout->addWidget(m_buttonBox);
|
lbarthelemy@245
|
47 auxLayout->setSizeConstraint(QLayout::SetFixedSize);
|
lbarthelemy@245
|
48
|
lbarthelemy@245
|
49 auxFrame->setLayout(auxLayout);
|
lbarthelemy@245
|
50 auxFrame->setFrameStyle(QFrame::Panel | QFrame::Plain);
|
lbarthelemy@245
|
51
|
lbarthelemy@245
|
52 mainLayout->addWidget(auxFrame);
|
lbarthelemy@245
|
53 mainLayout->setMargin(0);
|
lbarthelemy@245
|
54 mainLayout->setSpacing(0);
|
lbarthelemy@245
|
55 mainLayout->setSizeConstraint(QLayout::SetFixedSize);
|
lbarthelemy@245
|
56
|
lbarthelemy@245
|
57 setLayout(mainLayout);
|
lbarthelemy@245
|
58 }
|
lbarthelemy@245
|
59
|
lbarthelemy@245
|
60 void AudioRecorderWidget::setLocation(int x, int y){
|
lbarthelemy@245
|
61 this->setGeometry(x,y,this->width(),this->height());
|
lbarthelemy@245
|
62 }
|
lbarthelemy@245
|
63
|
lbarthelemy@245
|
64 void AudioRecorderWidget::setOpacity(qreal value){
|
lbarthelemy@245
|
65 this->setWindowOpacity(value);
|
lbarthelemy@245
|
66 } |