Continues migration with DDS, Common
This commit is contained in:
1 parent
9b15cee841
commit
fa48db111e
668 files changed
+111841
-2
No files matched your search
@@ -0,0 +1,82 @@
|
||||
|
||||
|
||||
|
||||
#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;
|
||||
}
|
||||
|
||||
if (s_waitForHistoricalDataWaitTime >= 999999)
|
||||
{
|
||||
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();
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user