Public Slots | Signals | Public Member Functions | Protected Slots | Protected Member Functions | Protected Attributes

QmitkUpdateTimerWidget Class Reference

QmitkUpdateTimerWidget. More...

#include <QmitkUpdateTimerWidget.h>

Collaboration diagram for QmitkUpdateTimerWidget:
Collaboration graph
[legend]

List of all members.

Public Slots

void EnableWidget ()
void DisableWidget ()

Signals

void Started ()
void Stopped ()

Public Member Functions

 QmitkUpdateTimerWidget (QWidget *parent)
 default constructor
virtual ~QmitkUpdateTimerWidget ()
 default destructor
unsigned int GetTimerInterval ()
 This method returns the timer's timeout interval in msec.
void SetTimerInterval (unsigned int msec)
 This method sets the timer's timeout interval in msec.
void StartTimer ()
 This method starts the timer if it is not already active.
void StopTimer ()
 This method stops the timer if it is active at the moment.
QTimer * GetUpdateTimer ()
 This method returns this object's timer.
void SetPurposeLabelText (QString text)
 This method sets the given QString for the purpose of this update timer e.g. if "Navigation" is given, the start and stop button will be labeled "Start Navigation" and "Stop Navigation". Furthermore the purpose description is used for the timer status label: "Navigation started ... " in this case.
void HideFramerateSettings (bool hidden)

Protected Slots

void OnStartTimer ()
 This method is called when the start button is pressed. It starts the timer using StartTimer().
void OnStopTimer ()
 This method is called when the stop button is pressed. It stops the timer using StopTimer().
void OnChangeTimerInterval (int interval)
 This method is called when the value in the spinbox is changed. It updates the timer interval using SetTimerInterval( ).

Protected Member Functions

void CreateConnections ()
void CreateQtPartControl (QWidget *parent)

Protected Attributes

Ui::QmitkUpdateTimerWidgetControlsm_Controls
 gui widgets

Detailed Description

QmitkUpdateTimerWidget.

Widget for setting up and controlling an update timer in an IGT-Pipeline.

Definition at line 31 of file QmitkUpdateTimerWidget.h.


Constructor & Destructor Documentation

QmitkUpdateTimerWidget::QmitkUpdateTimerWidget ( QWidget *  parent )

default constructor

Definition at line 30 of file QmitkUpdateTimerWidget.cpp.

References CreateQtPartControl(), DEFAULTUPDATEVALUE, DisableWidget(), m_Controls, Ui_QmitkUpdateTimerWidgetControls::m_StopNavigationBtn, Ui_QmitkUpdateTimerWidgetControls::m_UpdateRateSB, MAXIMUMUPDATEVALUE, MINIMUMUPDATEVALUE, and UPDATEVALUESTEP.

: QWidget(parent), m_Controls(NULL)
{
  this->m_UpdateTimer = new QTimer( this );
  this->CreateQtPartControl( this );

  this->m_Controls->m_StopNavigationBtn->setEnabled( false );    
  this->SetupUpdateRateSB( MINIMUMUPDATEVALUE, MAXIMUMUPDATEVALUE, UPDATEVALUESTEP );

  this->m_UpdateTimer->setInterval( DEFAULTUPDATEVALUE );
  this->m_Controls->m_UpdateRateSB->setValue( DEFAULTUPDATEVALUE );

  this->DisableWidget();
}
QmitkUpdateTimerWidget::~QmitkUpdateTimerWidget (  ) [virtual]

default destructor

Definition at line 45 of file QmitkUpdateTimerWidget.cpp.

References m_Controls.

{
  m_UpdateTimer->stop();
  m_UpdateTimer = NULL;
  m_Controls = NULL;
}

Member Function Documentation

void QmitkUpdateTimerWidget::CreateConnections (  ) [protected]

Definition at line 65 of file QmitkUpdateTimerWidget.cpp.

References m_Controls, Ui_QmitkUpdateTimerWidgetControls::m_StartNavigationBtn, Ui_QmitkUpdateTimerWidgetControls::m_StopNavigationBtn, Ui_QmitkUpdateTimerWidgetControls::m_UpdateRateSB, OnChangeTimerInterval(), OnStartTimer(), and OnStopTimer().

Referenced by CreateQtPartControl().

{
  connect( (QObject*)(m_Controls->m_StartNavigationBtn), SIGNAL(clicked()), this, SLOT(OnStartTimer()) );
  connect( (QObject*)(m_Controls->m_StopNavigationBtn), SIGNAL(clicked()), this, SLOT(OnStopTimer()) );
  connect(  m_Controls->m_UpdateRateSB, SIGNAL(valueChanged(int)), this, SLOT(OnChangeTimerInterval(int)) );
}
void QmitkUpdateTimerWidget::CreateQtPartControl ( QWidget *  parent ) [protected]
void QmitkUpdateTimerWidget::DisableWidget (  ) [slot]

Definition at line 167 of file QmitkUpdateTimerWidget.cpp.

References StopTimer().

Referenced by QmitkUpdateTimerWidget().

{
  this->StopTimer();
  this->setEnabled( false );
}
void QmitkUpdateTimerWidget::EnableWidget (  ) [slot]

Definition at line 162 of file QmitkUpdateTimerWidget.cpp.

{
  this->setEnabled( true );
}
unsigned int QmitkUpdateTimerWidget::GetTimerInterval (  )

This method returns the timer's timeout interval in msec.

Definition at line 72 of file QmitkUpdateTimerWidget.cpp.

{
  return this->m_UpdateTimer->interval();
}
QTimer * QmitkUpdateTimerWidget::GetUpdateTimer (  )

This method returns this object's timer.

Definition at line 117 of file QmitkUpdateTimerWidget.cpp.

Referenced by QmitkToolPairNavigationView::SetNavigationUp().

{
  return this->m_UpdateTimer;
}
void QmitkUpdateTimerWidget::HideFramerateSettings ( bool  hidden )
void QmitkUpdateTimerWidget::OnChangeTimerInterval ( int  interval ) [protected, slot]

This method is called when the value in the spinbox is changed. It updates the timer interval using SetTimerInterval( ).

Definition at line 77 of file QmitkUpdateTimerWidget.cpp.

References SetTimerInterval().

Referenced by CreateConnections().

{
  this->SetTimerInterval(interval);
  this->SetFrameRateLabel();
}
void QmitkUpdateTimerWidget::OnStartTimer (  ) [protected, slot]

This method is called when the start button is pressed. It starts the timer using StartTimer().

Definition at line 122 of file QmitkUpdateTimerWidget.cpp.

References StartTimer().

Referenced by CreateConnections().

{
  this->StartTimer();
}
void QmitkUpdateTimerWidget::OnStopTimer (  ) [protected, slot]

This method is called when the stop button is pressed. It stops the timer using StopTimer().

Definition at line 127 of file QmitkUpdateTimerWidget.cpp.

References StopTimer().

Referenced by CreateConnections().

{
  this->StopTimer();
}
void QmitkUpdateTimerWidget::SetPurposeLabelText ( QString  text )

This method sets the given QString for the purpose of this update timer e.g. if "Navigation" is given, the start and stop button will be labeled "Start Navigation" and "Stop Navigation". Furthermore the purpose description is used for the timer status label: "Navigation started ... " in this case.

Definition at line 133 of file QmitkUpdateTimerWidget.cpp.

References m_Controls, Ui_QmitkUpdateTimerWidgetControls::m_StartNavigationBtn, and Ui_QmitkUpdateTimerWidgetControls::m_StopNavigationBtn.

Referenced by QmitkToolPairNavigationView::SetNavigationUp().

{
  m_Controls->m_StartNavigationBtn->setText( " Start " + text );
  m_Controls->m_StopNavigationBtn->setText( " Stop " + text );
}
void QmitkUpdateTimerWidget::SetTimerInterval ( unsigned int  msec )

This method sets the timer's timeout interval in msec.

Definition at line 83 of file QmitkUpdateTimerWidget.cpp.

References m_Controls, and Ui_QmitkUpdateTimerWidgetControls::m_UpdateRateSB.

Referenced by OnChangeTimerInterval(), and QmitkToolPairNavigationView::SetNavigationUp().

{
  this->m_UpdateTimer->setInterval( msec );
  this->m_Controls->m_UpdateRateSB->setValue( msec );
}
void QmitkUpdateTimerWidget::Started (  ) [signal]

Referenced by StartTimer().

void QmitkUpdateTimerWidget::StartTimer (  )

This method starts the timer if it is not already active.

Definition at line 89 of file QmitkUpdateTimerWidget.cpp.

References m_Controls, Ui_QmitkUpdateTimerWidgetControls::m_NavigationStateLbl, Ui_QmitkUpdateTimerWidgetControls::m_StartNavigationBtn, Ui_QmitkUpdateTimerWidgetControls::m_StopNavigationBtn, and Started().

Referenced by OnStartTimer().

{
  if(!m_UpdateTimer->isActive())
  {
    this->m_UpdateTimer->start();
    this->m_Controls->m_StartNavigationBtn->setEnabled( false );
    this->m_Controls->m_StopNavigationBtn->setEnabled( true );
    this->m_Controls->m_NavigationStateLbl->setStyleSheet( "QLabel{background-color: #96e066 }" );
    this->m_Controls->m_NavigationStateLbl->setText( "Started ... " );

    emit Started();
  }
}
void QmitkUpdateTimerWidget::Stopped (  ) [signal]

Referenced by StopTimer().

void QmitkUpdateTimerWidget::StopTimer (  )

This method stops the timer if it is active at the moment.

Definition at line 103 of file QmitkUpdateTimerWidget.cpp.

References m_Controls, Ui_QmitkUpdateTimerWidgetControls::m_NavigationStateLbl, Ui_QmitkUpdateTimerWidgetControls::m_StartNavigationBtn, Ui_QmitkUpdateTimerWidgetControls::m_StopNavigationBtn, and Stopped().

Referenced by DisableWidget(), QmitkToolPairNavigationView::Disconnected(), OnStopTimer(), and QmitkToolPairNavigationView::SetNavigationUp().

{
  if(m_UpdateTimer->isActive())
  {
    m_UpdateTimer->stop();
    this->m_Controls->m_StopNavigationBtn->setEnabled( false );
    this->m_Controls->m_StartNavigationBtn->setEnabled( true );
    this->m_Controls->m_NavigationStateLbl->setStyleSheet( "QLabel{background-color: #ffcccc }" );
    this->m_Controls->m_NavigationStateLbl->setText( "Stopped ... " );

    emit Stopped();
  }
}

Member Data Documentation


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines