35 #include <QPushButton>
38 #include <QVBoxLayout>
51 BaseWidget(parent,
"RecordSessionWidget",
"Record Session"),
52 mAcquisitionService(base),
53 mInfoLabel(new QLabel(
"")),
54 mStartStopButton(new QPushButton(QIcon(
":/icons/open_icon_library/media-record-3.png"),
"Start")),
55 mCancelButton(new QPushButton(QIcon(
":/icons/open_icon_library/process-stop-7.png"),
"Cancel")),
59 QVBoxLayout* layout =
new QVBoxLayout(
this);
61 layout->addWidget(mInfoLabel);
63 QHBoxLayout* buttonLayout =
new QHBoxLayout();
65 int buttonheight = mStartStopButton->sizeHint().height()*2.5;
66 mStartStopButton->setMinimumHeight(buttonheight);
67 mCancelButton->setMinimumHeight(buttonheight);
69 buttonLayout->addWidget(mStartStopButton);
70 buttonLayout->addWidget(mCancelButton);
71 layout->addLayout(buttonLayout);
75 mStartStopButton->setCheckable(
true);
76 connect(mStartStopButton, &QPushButton::clicked,
this, &RecordSessionWidget::startStopSlot);
77 connect(mCancelButton, &QPushButton::clicked,
this, &RecordSessionWidget::cancelSlot);
79 this->recordStateChangedSlot();
82 this->onReadinessChanged();
88 void RecordSessionWidget::onReadinessChanged()
90 this->setEnabled(mAcquisitionService->isReady(mContext));
91 mInfoLabel->setText(mAcquisitionService->getInfoText(mContext));
94 void RecordSessionWidget::recordStateChangedSlot()
98 mStartStopButton->blockSignals(
true);
103 mStartStopButton->setChecked(
true);
104 mStartStopButton->setText(
"Stop");
105 mStartStopButton->setIcon(QIcon(
":/icons/open_icon_library/media-playback-stop.png"));
106 mStartStopButton->setEnabled(
true);
107 mCancelButton->setEnabled(
true);
110 mStartStopButton->setChecked(
false);
111 mStartStopButton->setText(
"Start");
112 mStartStopButton->setIcon(QIcon(
":/icons/open_icon_library/media-record-3.png"));
113 mStartStopButton->setEnabled(
true);
114 mCancelButton->setEnabled(
false);
117 mStartStopButton->setChecked(
false);
118 mStartStopButton->setText(
"Processing...");
119 mStartStopButton->setIcon(QIcon(
":/icons/open_icon_library/media-record-3.png"));
120 mStartStopButton->setEnabled(
false);
121 mCancelButton->setEnabled(
false);
125 mStartStopButton->blockSignals(
false);
128 void RecordSessionWidget::startStopSlot(
bool checked)
130 RecordSessionPtr session = mAcquisitionService->getSession(mCurrentSession);
133 mAcquisitionService->stopRecord();
135 mAcquisitionService->startRecord(mContext, mCategory, session);
140 void RecordSessionWidget::cancelSlot()
142 mAcquisitionService->cancelRecord();
147 mCurrentSession = uid;
boost::shared_ptr< class AcquisitionService > AcquisitionServicePtr
boost::shared_ptr< class RecordSession > RecordSessionPtr
void usReadinessChanged()