Loading...
Searching...
No Matches
uimonitortext.cpp
Go to the documentation of this file.
/**
* \file pappsomspp/processing/uimonitor/uimonitortext.cpp
* \date 14/5/2021
* \author Olivier Langella
* \brief simle text monitor implementation of the User Interface Monitor
**/
/*******************************************************************************
* Copyright (c) 2021 Olivier Langella
*<Olivier.Langella@universite-paris-saclay.fr>.
*
* This file is part of the PAPPSOms++ library.
*
* PAPPSOms++ is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PAPPSOms++ is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with PAPPSOms++. If not, see <http://www.gnu.org/licenses/>.
*
******************************************************************************/
#include <QObject>
#include "uimonitortext.h"
using namespace pappso;
UiMonitorText::UiMonitorText(QTextStream &output_stream)
: m_outputStream(output_stream)
{
}
UiMonitorText::~UiMonitorText()
{
}
bool
pappso::UiMonitorText::shouldIstop()
{
// by defaut not interruptible
return false;
}
void
pappso::UiMonitorText::setTitle(const QString &title)
{
m_outputStream << title << Qt::endl;
m_outputStream.flush();
}
void
pappso::UiMonitorText::setStatus(const QString &status)
{
m_outputStream << status << Qt::endl;
m_outputStream.flush();
}
void
pappso::UiMonitorText::count()
{
m_count++;
if(m_count <= m_totalSteps)
{
m_outputStream << m_count << " ";
}
else
{
m_outputStream << QObject::tr("%1 on %2").arg(m_count).arg(m_totalSteps)
<< " ";
}
m_outputStream.flush();
}
void
pappso::UiMonitorText::appendText(const QString &text)
{
m_outputStream << text;
m_outputStream.flush();
}
void
pappso::UiMonitorText::setTotalSteps(std::size_t total_number_of_steps)
{
UiMonitorInterface::setTotalSteps(total_number_of_steps);
m_count = 0;
}
pappso::UiMonitorInterface::setTotalSteps
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...
Definition uimonitorinterface.h:66
pappso::UiMonitorText::count
virtual void count() override
count steps report when a step is computed in an algorithm
Definition uimonitortext.cpp:66
pappso::UiMonitorText::setStatus
virtual void setStatus(const QString &status) override
current status of the process
Definition uimonitortext.cpp:59
pappso::UiMonitorText::setTitle
virtual void setTitle(const QString &title) override
current kind of process running
Definition uimonitortext.cpp:52
pappso::UiMonitorText::shouldIstop
virtual bool shouldIstop() override
should the procces be stopped ? If true, then cancel process Use this function at strategic point of ...
Definition uimonitortext.cpp:45
pappso::UiMonitorText::~UiMonitorText
~UiMonitorText()
Definition uimonitortext.cpp:40
pappso::UiMonitorText::setTotalSteps
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...
Definition uimonitortext.cpp:89
pappso::UiMonitorText::appendText
virtual void appendText(const QString &text) override
append a text to a long report
Definition uimonitortext.cpp:82
pappso::UiMonitorText::UiMonitorText
UiMonitorText(QTextStream &output_stream)
Definition uimonitortext.cpp:35
pappso
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
Definition aa.cpp:39
uimonitortext.h
simle text monitor implementation of the User Interface Monitor