14 #include <QPushButton> 17 #include <QVBoxLayout> 30 BaseWidget(parent,
"RecordSessionWidget",
"Record Session"),
31 mAcquisitionService(base),
32 mInfoLabel(new QLabel(
"")),
33 mStartStopButton(new QPushButton(QIcon(
":/icons/open_icon_library/media-record-3.png"),
"Start")),
34 mCancelButton(new QPushButton(QIcon(
":/icons/open_icon_library/process-stop-7.png"),
"Cancel")),
38 QVBoxLayout* layout =
new QVBoxLayout(
this);
40 layout->addWidget(mInfoLabel);
42 QHBoxLayout* buttonLayout =
new QHBoxLayout();
44 int buttonheight = mStartStopButton->sizeHint().height()*2.5;
45 mStartStopButton->setMinimumHeight(buttonheight);
46 mCancelButton->setMinimumHeight(buttonheight);
48 buttonLayout->addWidget(mStartStopButton);
49 buttonLayout->addWidget(mCancelButton);
50 layout->addLayout(buttonLayout);
52 warningText =
"<font color=red>Note! This widget must be visible during active recording</font><br>";
53 QLabel* warningInfoLabel =
new QLabel(warningText);
54 layout->addWidget(warningInfoLabel);
58 mStartStopButton->setCheckable(
true);
59 connect(mStartStopButton, &QPushButton::clicked,
this, &RecordSessionWidget::startStopSlot);
60 connect(mCancelButton, &QPushButton::clicked,
this, &RecordSessionWidget::cancelSlot);
62 this->recordStateChangedSlot();
65 this->onReadinessChanged();
71 void RecordSessionWidget::onReadinessChanged()
73 this->setEnabled(mAcquisitionService->isReady(mContext));
74 mInfoLabel->setText(mAcquisitionService->getInfoText(mContext));
77 void RecordSessionWidget::recordStateChangedSlot()
81 mStartStopButton->blockSignals(
true);
86 mStartStopButton->setChecked(
true);
87 mStartStopButton->setText(
"Stop");
88 mStartStopButton->setIcon(QIcon(
":/icons/open_icon_library/media-playback-stop.png"));
89 mStartStopButton->setEnabled(
true);
90 mCancelButton->setEnabled(
true);
93 mStartStopButton->setChecked(
false);
94 mStartStopButton->setText(
"Start");
95 mStartStopButton->setIcon(QIcon(
":/icons/open_icon_library/media-record-3.png"));
96 mStartStopButton->setEnabled(
true);
97 mCancelButton->setEnabled(
false);
100 mStartStopButton->setChecked(
false);
101 mStartStopButton->setText(
"Processing...");
102 mStartStopButton->setIcon(QIcon(
":/icons/open_icon_library/media-record-3.png"));
103 mStartStopButton->setEnabled(
false);
104 mCancelButton->setEnabled(
false);
108 mStartStopButton->blockSignals(
false);
111 void RecordSessionWidget::startStopSlot(
bool checked)
113 RecordSessionPtr session = mAcquisitionService->getSession(mCurrentSession);
116 mAcquisitionService->stopRecord();
118 mAcquisitionService->startRecord(mContext, mCategory, session);
123 void RecordSessionWidget::cancelSlot()
125 mAcquisitionService->cancelRecord();
130 mCurrentSession = uid;
boost::shared_ptr< class AcquisitionService > AcquisitionServicePtr
boost::shared_ptr< class RecordSession > RecordSessionPtr
void usReadinessChanged()
Namespace for all CustusX production code.