libpappsomspp
Library for mass spectrometry
Loading...
Searching...
No Matches
pappso::UiMonitorText Class Reference

#include <uimonitortext.h>

Inheritance diagram for pappso::UiMonitorText:
pappso::UiMonitorInterface pappso::UiMonitorTextPercent

Public Member Functions

 UiMonitorText (QTextStream &output_stream)
 
 ~UiMonitorText ()
 
virtual bool shouldIstop () override
 should the procces be stopped ? If true, then cancel process Use this function at strategic point of your process in order to interrupt it cleanly Implementation must take care of thread resistance if implemented
 
virtual void count () override
 count steps report when a step is computed in an algorithm
 
virtual void setTitle (const QString &title) override
 current kind of process running
 
virtual void setStatus (const QString &status) override
 current status of the process
 
virtual void appendText (const QString &text) override
 append a text to a long report
 
virtual void setTotalSteps (std::size_t total_number_of_steps)
 use it if the number of steps is known in an algorithm the total number of steps is usefull to report to the user a progress message in percents or with a progress bar
 

Protected Attributes

QTextStream & m_outputStream
 
std::size_t m_count = 0
 
- Protected Attributes inherited from pappso::UiMonitorInterface
std::size_t m_totalSteps = 0
 

Detailed Description

Todo
simple text monitor using text stream

Definition at line 41 of file uimonitortext.h.

Constructor & Destructor Documentation

◆ UiMonitorText()

UiMonitorText::UiMonitorText ( QTextStream & output_stream)

Default constructor

Definition at line 35 of file uimonitortext.cpp.

35 : m_outputStream(output_stream)
36{
37}
QTextStream & m_outputStream

References m_outputStream.

Referenced by pappso::UiMonitorTextPercent::UiMonitorTextPercent().

◆ ~UiMonitorText()

UiMonitorText::~UiMonitorText ( )

Destructor

Definition at line 39 of file uimonitortext.cpp.

40{
41}

Member Function Documentation

◆ appendText()

void pappso::UiMonitorText::appendText ( const QString & text)
overridevirtual

append a text to a long report

Parameters
textstring to append in a long report

Implements pappso::UiMonitorInterface.

Definition at line 80 of file uimonitortext.cpp.

81{
82 m_outputStream << text << Qt::endl;
83 m_outputStream.flush();
84}

References m_outputStream.

◆ count()

void pappso::UiMonitorText::count ( )
overridevirtual

count steps report when a step is computed in an algorithm

Implements pappso::UiMonitorInterface.

Reimplemented in pappso::UiMonitorTextPercent.

Definition at line 65 of file uimonitortext.cpp.

66{
67 m_count++;
69 {
70 m_outputStream << m_count << " ";
71 }
72 else
73 {
74 m_outputStream << QObject::tr("%1 on %2").arg(m_count).arg(m_totalSteps) << " ";
75 }
76 m_outputStream.flush();
77}

References m_count, m_outputStream, and pappso::UiMonitorInterface::m_totalSteps.

◆ setStatus()

void pappso::UiMonitorText::setStatus ( const QString & status)
overridevirtual

current status of the process

Parameters
statusstatus message

Implements pappso::UiMonitorInterface.

Definition at line 58 of file uimonitortext.cpp.

59{
60 m_outputStream << status << Qt::endl;
61 m_outputStream.flush();
62}

References m_outputStream.

◆ setTitle()

void pappso::UiMonitorText::setTitle ( const QString & title)
overridevirtual

current kind of process running

Parameters
titleprocess title

Implements pappso::UiMonitorInterface.

Definition at line 51 of file uimonitortext.cpp.

52{
53 m_outputStream << title << Qt::endl;
54 m_outputStream.flush();
55}

References m_outputStream.

◆ setTotalSteps()

void pappso::UiMonitorText::setTotalSteps ( std::size_t total_number_of_steps)
virtual

use it if the number of steps is known in an algorithm the total number of steps is usefull to report to the user a progress message in percents or with a progress bar

Parameters
total_number_of_stepsthe total number of steps

Reimplemented from pappso::UiMonitorInterface.

Reimplemented in pappso::UiMonitorTextPercent.

Definition at line 87 of file uimonitortext.cpp.

88{
89 UiMonitorInterface::setTotalSteps(total_number_of_steps);
90 m_count = 0;
91}
virtual void setTotalSteps(std::size_t total_number_of_steps)
use it if the number of steps is known in an algorithm the total number of steps is usefull to report...

References m_count, and pappso::UiMonitorInterface::setTotalSteps().

Referenced by pappso::UiMonitorTextPercent::setTotalSteps().

◆ shouldIstop()

bool pappso::UiMonitorText::shouldIstop ( )
overridevirtual

should the procces be stopped ? If true, then cancel process Use this function at strategic point of your process in order to interrupt it cleanly Implementation must take care of thread resistance if implemented

Implements pappso::UiMonitorInterface.

Definition at line 44 of file uimonitortext.cpp.

45{
46 // by defaut not interruptible
47 return false;
48}

Member Data Documentation

◆ m_count

std::size_t pappso::UiMonitorText::m_count = 0
protected

◆ m_outputStream

QTextStream& pappso::UiMonitorText::m_outputStream
protected

The documentation for this class was generated from the following files: