Mercurial > hg > easaier-soundaccess
diff widgets/AudioRecorderWidget.cpp @ 245:87ccc62d9ea5
the audio recorder widget
author | lbarthelemy |
---|---|
date | Fri, 28 Mar 2008 16:06:13 +0000 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/widgets/AudioRecorderWidget.cpp Fri Mar 28 16:06:13 2008 +0000 @@ -0,0 +1,66 @@ +#include <QLabel> +#include "AudioRecorderWidget.h" + + +AudioRecorderWidget::AudioRecorderWidget(QWidget *parent){ +this->setWindowFlags(Qt::ToolTip); + + QLabel *labelTitle = new QLabel(tr("Voice recorder:")); + + m_buttonBox = new QDialogButtonBox(Qt::Horizontal); + m_okButton = new QPushButton(tr("Ok")); + m_cancelButton = new QPushButton(tr("Cancel")); + m_startButton = new QPushButton(tr("Start")); + m_stopButton = new QPushButton(tr("Stop")); + m_playButton = new QPushButton(tr("Play")); + + QFrame *auxFrame = new QFrame(); + QVBoxLayout *mainLayout = new QVBoxLayout; + QVBoxLayout *auxLayout = new QVBoxLayout; + QHBoxLayout *centralLayout = new QHBoxLayout(); + QFrame *centralFrame = new QFrame(); + + //populate the central layout + centralLayout->addWidget(m_startButton); + centralLayout->addWidget(m_stopButton); + centralLayout->addWidget(m_playButton); + + ////// + + + centralFrame->setLayout(centralLayout); + + labelTitle->setAlignment(Qt::AlignCenter); + + // default button for enter key + m_okButton->setDefault(true); + + m_buttonBox->addButton(m_okButton, QDialogButtonBox::AcceptRole); + m_buttonBox->addButton(m_cancelButton, QDialogButtonBox::RejectRole); + + connect(m_okButton, SIGNAL(clicked()), this, SLOT(accept())); + connect(m_cancelButton, SIGNAL(clicked()), this, SLOT(reject())); + + auxLayout->addWidget(labelTitle); + auxLayout->addWidget(centralFrame); + auxLayout->addWidget(m_buttonBox); + auxLayout->setSizeConstraint(QLayout::SetFixedSize); + + auxFrame->setLayout(auxLayout); + auxFrame->setFrameStyle(QFrame::Panel | QFrame::Plain); + + mainLayout->addWidget(auxFrame); + mainLayout->setMargin(0); + mainLayout->setSpacing(0); + mainLayout->setSizeConstraint(QLayout::SetFixedSize); + + setLayout(mainLayout); +} + + void AudioRecorderWidget::setLocation(int x, int y){ + this->setGeometry(x,y,this->width(),this->height()); + } + + void AudioRecorderWidget::setOpacity(qreal value){ + this->setWindowOpacity(value); + } \ No newline at end of file