lbarthelemy@245: #include lbarthelemy@245: #include "AudioRecorderWidget.h" lbarthelemy@245: lbarthelemy@245: lbarthelemy@245: AudioRecorderWidget::AudioRecorderWidget(QWidget *parent){ lbarthelemy@245: this->setWindowFlags(Qt::ToolTip); lbarthelemy@245: lbarthelemy@245: QLabel *labelTitle = new QLabel(tr("Voice recorder:")); lbarthelemy@245: lbarthelemy@245: m_buttonBox = new QDialogButtonBox(Qt::Horizontal); lbarthelemy@245: m_okButton = new QPushButton(tr("Ok")); lbarthelemy@245: m_cancelButton = new QPushButton(tr("Cancel")); lbarthelemy@245: m_startButton = new QPushButton(tr("Start")); lbarthelemy@245: m_stopButton = new QPushButton(tr("Stop")); lbarthelemy@245: m_playButton = new QPushButton(tr("Play")); lbarthelemy@245: lbarthelemy@245: QFrame *auxFrame = new QFrame(); lbarthelemy@245: QVBoxLayout *mainLayout = new QVBoxLayout; lbarthelemy@245: QVBoxLayout *auxLayout = new QVBoxLayout; lbarthelemy@245: QHBoxLayout *centralLayout = new QHBoxLayout(); lbarthelemy@245: QFrame *centralFrame = new QFrame(); lbarthelemy@245: lbarthelemy@245: //populate the central layout lbarthelemy@245: centralLayout->addWidget(m_startButton); lbarthelemy@245: centralLayout->addWidget(m_stopButton); lbarthelemy@245: centralLayout->addWidget(m_playButton); lbarthelemy@245: lbarthelemy@245: ////// lbarthelemy@245: lbarthelemy@245: lbarthelemy@245: centralFrame->setLayout(centralLayout); lbarthelemy@245: lbarthelemy@245: labelTitle->setAlignment(Qt::AlignCenter); lbarthelemy@245: lbarthelemy@245: // default button for enter key lbarthelemy@245: m_okButton->setDefault(true); lbarthelemy@245: lbarthelemy@245: m_buttonBox->addButton(m_okButton, QDialogButtonBox::AcceptRole); lbarthelemy@245: m_buttonBox->addButton(m_cancelButton, QDialogButtonBox::RejectRole); lbarthelemy@245: lbarthelemy@245: connect(m_okButton, SIGNAL(clicked()), this, SLOT(accept())); lbarthelemy@245: connect(m_cancelButton, SIGNAL(clicked()), this, SLOT(reject())); lbarthelemy@245: lbarthelemy@245: auxLayout->addWidget(labelTitle); lbarthelemy@245: auxLayout->addWidget(centralFrame); lbarthelemy@245: auxLayout->addWidget(m_buttonBox); lbarthelemy@245: auxLayout->setSizeConstraint(QLayout::SetFixedSize); lbarthelemy@245: lbarthelemy@245: auxFrame->setLayout(auxLayout); lbarthelemy@245: auxFrame->setFrameStyle(QFrame::Panel | QFrame::Plain); lbarthelemy@245: lbarthelemy@245: mainLayout->addWidget(auxFrame); lbarthelemy@245: mainLayout->setMargin(0); lbarthelemy@245: mainLayout->setSpacing(0); lbarthelemy@245: mainLayout->setSizeConstraint(QLayout::SetFixedSize); lbarthelemy@245: lbarthelemy@245: setLayout(mainLayout); lbarthelemy@245: } lbarthelemy@245: lbarthelemy@245: void AudioRecorderWidget::setLocation(int x, int y){ lbarthelemy@245: this->setGeometry(x,y,this->width(),this->height()); lbarthelemy@245: } lbarthelemy@245: lbarthelemy@245: void AudioRecorderWidget::setOpacity(qreal value){ lbarthelemy@245: this->setWindowOpacity(value); lbarthelemy@245: }