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