MITK-IGT
IGT Extension of MITK
Loading...
Searching...
No Matches
QmitkNavigationDataSequentialPlayerControlWidget.cpp
Go to the documentation of this file.
1/*============================================================================
2
3The Medical Imaging Interaction Toolkit (MITK)
4
5Copyright (c) German Cancer Research Center (DKFZ)
6All rights reserved.
7
8Use of this source code is governed by a 3-clause BSD license that can be
9found in the LICENSE file.
10
11============================================================================*/
12
14#include "ui_QmitkNavigationDataSequentialPlayerControlWidget.h"
15
16#include <QTimer>
17
19 QWidget(parent),
21{
22 ui->setupUi(this);
23 m_UpdateTimer = new QTimer();
24 connect( m_UpdateTimer, SIGNAL(timeout()), this, SLOT(OnUpdate()) );
25}
26
31
32void QmitkNavigationDataSequentialPlayerControlWidget::SetPlayer(mitk::NavigationDataSequentialPlayer::Pointer player)
33{
34 m_Player = player;
35
36 ui->samplePositionHorizontalSlider->setMaximum(player->GetNumberOfSnapshots());
37}
38
40{
41 m_UpdateTimer->stop();
42 m_Player->GoToSnapshot(0);
43
44 this->UpdatePlayerDisplay();
45
46 // make sure that the play/pause button is not checked after stopping
47 ui->playPushButton->setChecked(false);
48}
49
51{
52 if ( m_UpdateTimer->isActive() )
53 {
54 m_UpdateTimer->stop();
55 }
56 else
57 {
58 if ( m_Player->IsAtEnd() ) { m_Player->GoToSnapshot(0); }
59
60 m_UpdateTimer->start(ui->updateIntervalSpinBox->value());
61 if ( ! ui->playPushButton->isChecked() ) { ui->playPushButton->setChecked(true); }
62 }
63}
64
70
72{
73 // if the last snapshot was reached
74 if ( ! m_Player->GoToNextSnapshot() )
75 {
76 m_UpdateTimer->stop();
77 ui->playPushButton->setChecked(false);
78
79 emit SignalEndReached();
80 }
81
82 m_Player->Update();
83
84 this->UpdatePlayerDisplay();
85
86 emit SignalUpdate();
87}
88
90{
91 m_UpdateTimer->setInterval(value);
92}
93
95{
96 int currentSnapshotNumber = static_cast<int>(m_Player->GetCurrentSnapshotNumber());
97
98 ui->sampleLCDNumber->display(currentSnapshotNumber);
99
100 ui->samplePositionHorizontalSlider->setValue(currentSnapshotNumber);
101}
void SetPlayer(mitk::NavigationDataSequentialPlayer::Pointer player)