Initial commit
This commit is contained in:
commit
b7d90b9afe
16245 files changed
+3396666
No files matched your search
@@ -0,0 +1,89 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* Wait Dialog while trying to get Historical Operator Data from OPM on EX0
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
*
|
||||
* Created by Mike Wille, SLSE, 2017-04-24
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <ConnectDialog/ltsutilsguiconnectdialog_export.h>
|
||||
#include <LtsWidgets/lts_frameless_dialog.h>
|
||||
|
||||
#include <QWidget>
|
||||
#include <QTimer>
|
||||
|
||||
#include <functional>
|
||||
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class ConnectingDialog;
|
||||
}
|
||||
|
||||
namespace LtsUtils
|
||||
{
|
||||
|
||||
class LTSUTILSGUICONNECTDIALOG_EXPORT ConnectingDialog : public LtsWidgets::LtsFramelessDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
static int s_waitForHistoricalDataWaitTime;
|
||||
|
||||
template <typename DtcType, typename WaitForHistoricalDataFunction>
|
||||
explicit ConnectingDialog(DtcType dtc,
|
||||
WaitForHistoricalDataFunction waitForHistoricalDataFunction,
|
||||
const QString &serviceName,
|
||||
const QString &exerciseName,
|
||||
QWidget *parent = nullptr)
|
||||
: LtsWidgets::LtsFramelessDialog(parent, LtsWidgets::Behaviour::Modal)
|
||||
, m_serviceName(serviceName)
|
||||
, m_exerciseName(exerciseName)
|
||||
, m_ui(nullptr)
|
||||
{
|
||||
setWindowTitle(tr("Connecting .."));
|
||||
setup();
|
||||
show();
|
||||
|
||||
while (true)
|
||||
{
|
||||
if ((dtc.get()->*waitForHistoricalDataFunction)(s_waitForHistoricalDataWaitTime))
|
||||
{
|
||||
deleteLater();
|
||||
return; // connection successful!
|
||||
}
|
||||
|
||||
if (s_waitForHistoricalDataWaitTime >= 999999)
|
||||
{ // not successful, but ignore this error while valgrinding
|
||||
deleteLater();
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
failed();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
~ConnectingDialog();
|
||||
|
||||
void failed();
|
||||
|
||||
private:
|
||||
QString m_serviceName;
|
||||
QString m_exerciseName;
|
||||
Ui::ConnectingDialog *m_ui;
|
||||
|
||||
void reset();
|
||||
void setup();
|
||||
|
||||
signals:
|
||||
void signalStopLoop();
|
||||
|
||||
};
|
||||
|
||||
} // namespace LtsUtils
|
||||
Reference in new issue
Block a user