Apply clang-format to Lts/Common and DTC/enum headers
- Formatted all CodeGen module files (9 files) - Formatted LtsAppDescriptor module files - Formatted LtsAppManager/AppChooser files - Applied clang-format to all DTC and enum headers across modules - Removed coordTransTests from CommonUnitTestsPlaceholder (moved to tests/) Cosmetic changes only, no functional modifications. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
848 files changed
+89305
-100020
No files matched your search
Executable → Regular
+26
-40
@@ -1,73 +1,59 @@
|
||||
|
||||
|
||||
|
||||
#include "connect_dialog.h"
|
||||
|
||||
#include "ui_connect_dialog.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
|
||||
namespace LtsUtils
|
||||
{
|
||||
int ConnectingDialog::s_waitForHistoricalDataWaitTime = 10000;
|
||||
|
||||
|
||||
void ConnectingDialog::reset()
|
||||
{
|
||||
m_ui->label->setText(QStringLiteral("<font color='orange'>%1</font>").arg(tr("Connecting to %1 on %2 ...").arg(m_serviceName, m_exerciseName)));
|
||||
m_ui->label->setText(QStringLiteral("<font color='orange'>%1</font>")
|
||||
.arg(tr("Connecting to %1 on %2 ...").arg(m_serviceName, m_exerciseName)));
|
||||
}
|
||||
|
||||
|
||||
void ConnectingDialog::setup()
|
||||
{
|
||||
m_ui = new Ui::ConnectingDialog;
|
||||
m_ui->setupUi(this);
|
||||
reset();
|
||||
setMinimumSize(sizeHint());
|
||||
connect(m_ui->pbRetry, &QPushButton::clicked,
|
||||
this, [this]()
|
||||
{
|
||||
m_ui->pbRetry->setEnabled(false);
|
||||
m_ui->pbIgnore->setEnabled(false);
|
||||
|
||||
m_ui = new Ui::ConnectingDialog;
|
||||
m_ui->setupUi(this);
|
||||
reset();
|
||||
emit signalStopLoop();
|
||||
});
|
||||
setMinimumSize(sizeHint());
|
||||
connect(m_ui->pbRetry, &QPushButton::clicked, this, [this]() {
|
||||
m_ui->pbRetry->setEnabled(false);
|
||||
m_ui->pbIgnore->setEnabled(false);
|
||||
|
||||
connect(m_ui->pbIgnore, &QPushButton::clicked,
|
||||
this, [this]()
|
||||
{
|
||||
m_ui->pbIgnore->setEnabled(false);
|
||||
m_ui->pbRetry->setEnabled(false);
|
||||
m_ui->pbIgnore->setText(tr("continuing.."));
|
||||
reset();
|
||||
emit signalStopLoop();
|
||||
});
|
||||
|
||||
deleteLater();
|
||||
return;
|
||||
connect(m_ui->pbIgnore, &QPushButton::clicked, this, [this]() {
|
||||
m_ui->pbIgnore->setEnabled(false);
|
||||
m_ui->pbRetry->setEnabled(false);
|
||||
m_ui->pbIgnore->setText(tr("continuing.."));
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
});
|
||||
deleteLater();
|
||||
return;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
ConnectingDialog::~ConnectingDialog()
|
||||
{
|
||||
delete m_ui;
|
||||
delete m_ui;
|
||||
}
|
||||
|
||||
|
||||
void ConnectingDialog::failed()
|
||||
{
|
||||
m_ui->label->setText(QStringLiteral("<font color='red'>%1</font>").arg(tr("Could not connect to %1 on %2 !").arg(m_serviceName, m_exerciseName)));
|
||||
m_ui->label->setText(QStringLiteral("<font color='red'>%1</font>")
|
||||
.arg(tr("Could not connect to %1 on %2 !").arg(m_serviceName, m_exerciseName)));
|
||||
|
||||
m_ui->pbRetry->setEnabled(true);
|
||||
m_ui->pbIgnore->setEnabled(true);
|
||||
m_ui->pbRetry->setEnabled(true);
|
||||
m_ui->pbIgnore->setEnabled(true);
|
||||
|
||||
raise();
|
||||
raise();
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace LtsUtils
|
||||
Executable → Regular
+43
-53
@@ -1,18 +1,14 @@
|
||||
|
||||
|
||||
|
||||
#pragma once
|
||||
#include <QObject>
|
||||
|
||||
#include "ltsutilsguiconnectdialog_export.h"
|
||||
|
||||
#include <LtsWidgets/lts_frameless_dialog.h>
|
||||
|
||||
#include <QWidget>
|
||||
#include <QObject>
|
||||
#include <QTimer>
|
||||
|
||||
#include <QWidget>
|
||||
#include <functional>
|
||||
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class ConnectingDialog;
|
||||
@@ -23,61 +19,55 @@ namespace LtsUtils
|
||||
|
||||
class LTSUTILSGUICONNECTDIALOG_EXPORT ConnectingDialog : public LtsWidgets::LtsFramelessDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
static int s_waitForHistoricalDataWaitTime;
|
||||
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)
|
||||
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)
|
||||
{
|
||||
if ((dtc.get()->*waitForHistoricalDataFunction)(s_waitForHistoricalDataWaitTime))
|
||||
{
|
||||
deleteLater();
|
||||
return;
|
||||
}
|
||||
setWindowTitle(tr("Connecting .."));
|
||||
setup();
|
||||
show();
|
||||
|
||||
if (s_waitForHistoricalDataWaitTime >= 999999)
|
||||
{
|
||||
deleteLater();
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
failed();
|
||||
}
|
||||
while (true)
|
||||
{
|
||||
if ((dtc.get()->*waitForHistoricalDataFunction)(s_waitForHistoricalDataWaitTime))
|
||||
{
|
||||
deleteLater();
|
||||
return;
|
||||
}
|
||||
|
||||
if (s_waitForHistoricalDataWaitTime >= 999999)
|
||||
{
|
||||
deleteLater();
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
failed();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
~ConnectingDialog();
|
||||
~ConnectingDialog();
|
||||
|
||||
void failed();
|
||||
void failed();
|
||||
|
||||
private:
|
||||
QString m_serviceName;
|
||||
QString m_exerciseName;
|
||||
Ui::ConnectingDialog *m_ui;
|
||||
private:
|
||||
QString m_serviceName;
|
||||
QString m_exerciseName;
|
||||
Ui::ConnectingDialog* m_ui;
|
||||
|
||||
void reset();
|
||||
void setup();
|
||||
|
||||
signals:
|
||||
void signalStopLoop();
|
||||
void reset();
|
||||
void setup();
|
||||
|
||||
signals:
|
||||
void signalStopLoop();
|
||||
};
|
||||
|
||||
}
|
||||
} // namespace LtsUtils
|
||||
Executable → Regular
+70
-98
@@ -1,157 +1,129 @@
|
||||
|
||||
|
||||
#include "connect_dialog_nt.h"
|
||||
|
||||
#include "connect_dialog.h"
|
||||
#include "connect_dialog_nt.h"
|
||||
#include "ui_connect_dialog.h"
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
|
||||
#include <QRandomGenerator>
|
||||
#endif
|
||||
|
||||
|
||||
namespace LtsUtils
|
||||
{
|
||||
|
||||
|
||||
ConnectingDialogNT::ConnectingDialogNT(const std::function<bool(int)> &checkFn,
|
||||
const QString &serviceName,
|
||||
const QString &exerciseName,
|
||||
QWidget *parent)
|
||||
: LtsWidgets::LtsFramelessDialog(parent, LtsWidgets::Behaviour::Modal)
|
||||
, m_serviceName(serviceName)
|
||||
, m_exerciseName(exerciseName)
|
||||
, m_checkFn(checkFn)
|
||||
, m_go(false)
|
||||
, m_autoRetryTimer(new QTimer(this))
|
||||
, m_ui(new Ui::ConnectingDialog )
|
||||
ConnectingDialogNT::ConnectingDialogNT(const std::function<bool(int)>& checkFn, const QString& serviceName,
|
||||
const QString& exerciseName, QWidget* parent)
|
||||
: LtsWidgets::LtsFramelessDialog(parent, LtsWidgets::Behaviour::Modal), m_serviceName(serviceName),
|
||||
m_exerciseName(exerciseName), m_checkFn(checkFn), m_go(false), m_autoRetryTimer(new QTimer(this)),
|
||||
m_ui(new Ui::ConnectingDialog)
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
m_ui->setupUi(this);
|
||||
|
||||
m_autoRetryTimer->setInterval(1000);
|
||||
connect(m_autoRetryTimer, &QTimer::timeout,
|
||||
this, [this]()
|
||||
{
|
||||
if (m_autoRetryTick < 1)
|
||||
{
|
||||
slotRetry();
|
||||
return;
|
||||
}
|
||||
m_autoRetryTimer->setInterval(1000);
|
||||
connect(m_autoRetryTimer, &QTimer::timeout, this, [this]() {
|
||||
if (m_autoRetryTick < 1)
|
||||
{
|
||||
slotRetry();
|
||||
return;
|
||||
}
|
||||
|
||||
m_ui->pbRetry->setText(QStringLiteral("%1 [%2]").arg(tr("Retry")).arg(m_autoRetryTick));
|
||||
m_autoRetryTick--;
|
||||
});
|
||||
m_ui->pbRetry->setText(QStringLiteral("%1 [%2]").arg(tr("Retry")).arg(m_autoRetryTick));
|
||||
m_autoRetryTick--;
|
||||
});
|
||||
|
||||
reset();
|
||||
setMinimumSize(sizeHint());
|
||||
connect(m_ui->pbRetry, &QPushButton::clicked,
|
||||
this, &ConnectingDialogNT::slotRetry);
|
||||
reset();
|
||||
setMinimumSize(sizeHint());
|
||||
connect(m_ui->pbRetry, &QPushButton::clicked, this, &ConnectingDialogNT::slotRetry);
|
||||
|
||||
connect(m_ui->pbIgnore, &QPushButton::clicked,
|
||||
this, [this]()
|
||||
{
|
||||
m_ui->pbIgnore->setEnabled(false);
|
||||
connect(m_ui->pbIgnore, &QPushButton::clicked, this, [this]() {
|
||||
m_ui->pbIgnore->setEnabled(false);
|
||||
m_ui->pbRetry->setEnabled(false);
|
||||
m_ui->pbIgnore->setText(tr("continuing.."));
|
||||
|
||||
emit signalFailed();
|
||||
deleteLater();
|
||||
return;
|
||||
});
|
||||
|
||||
show();
|
||||
|
||||
connect(this, &ConnectingDialogNT::signalGo, this, &ConnectingDialogNT::slotGo, Qt::QueuedConnection);
|
||||
|
||||
m_go = true;
|
||||
m_ui->pbRetry->setEnabled(false);
|
||||
m_ui->pbIgnore->setText(tr("continuing.."));
|
||||
|
||||
emit signalFailed();
|
||||
deleteLater();
|
||||
return;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
});
|
||||
|
||||
show();
|
||||
|
||||
connect(this, &ConnectingDialogNT::signalGo,
|
||||
this, &ConnectingDialogNT::slotGo, Qt::QueuedConnection);
|
||||
|
||||
m_go = true;
|
||||
m_ui->pbRetry->setEnabled(false);
|
||||
}
|
||||
|
||||
|
||||
int ConnectingDialogNT::random(int min, int max)
|
||||
{
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
|
||||
return QRandomGenerator::global()->bounded(min, max);
|
||||
return QRandomGenerator::global()->bounded(min, max);
|
||||
#else
|
||||
return (qrand() % (((max + 1) - min) + min));
|
||||
return (qrand() % (((max + 1) - min) + min));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool ConnectingDialogNT::event(QEvent *event)
|
||||
bool ConnectingDialogNT::event(QEvent* event)
|
||||
{
|
||||
bool result = LtsWidgets::LtsFramelessDialog::event(event);
|
||||
bool result = LtsWidgets::LtsFramelessDialog::event(event);
|
||||
|
||||
if (event->type() == QEvent::Paint && m_go)
|
||||
{
|
||||
m_go = false;
|
||||
QTimer::singleShot(0, this, &ConnectingDialogNT::signalGo);
|
||||
}
|
||||
if (event->type() == QEvent::Paint && m_go)
|
||||
{
|
||||
m_go = false;
|
||||
QTimer::singleShot(0, this, &ConnectingDialogNT::signalGo);
|
||||
}
|
||||
|
||||
return result;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
void ConnectingDialogNT::slotRetry()
|
||||
{
|
||||
m_autoRetryTimer->stop();
|
||||
m_autoRetryTimer->stop();
|
||||
|
||||
m_ui->pbRetry->setText(tr("Retry"));
|
||||
m_ui->pbRetry->setEnabled(false);
|
||||
m_ui->pbIgnore->setEnabled(false);
|
||||
m_ui->pbRetry->setText(tr("Retry"));
|
||||
m_ui->pbRetry->setEnabled(false);
|
||||
m_ui->pbIgnore->setEnabled(false);
|
||||
|
||||
reset();
|
||||
QTimer::singleShot(1, this, &ConnectingDialogNT::slotGo);
|
||||
reset();
|
||||
QTimer::singleShot(1, this, &ConnectingDialogNT::slotGo);
|
||||
}
|
||||
|
||||
|
||||
void ConnectingDialogNT::slotGo()
|
||||
{
|
||||
|
||||
if (m_checkFn(ConnectingDialog::s_waitForHistoricalDataWaitTime))
|
||||
{
|
||||
emit signalSuccess();
|
||||
deleteLater();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
failed();
|
||||
if (m_checkFn(ConnectingDialog::s_waitForHistoricalDataWaitTime))
|
||||
{
|
||||
emit signalSuccess();
|
||||
deleteLater();
|
||||
return;
|
||||
}
|
||||
|
||||
failed();
|
||||
}
|
||||
|
||||
|
||||
void ConnectingDialogNT::reset()
|
||||
{
|
||||
m_ui->label->setText(QStringLiteral("<font color='orange'>%1</font>").arg(tr("Connecting to %1 on %2 ...").arg(m_serviceName, m_exerciseName)));
|
||||
m_ui->label->setText(QStringLiteral("<font color='orange'>%1</font>")
|
||||
.arg(tr("Connecting to %1 on %2 ...").arg(m_serviceName, m_exerciseName)));
|
||||
}
|
||||
|
||||
|
||||
ConnectingDialogNT::~ConnectingDialogNT()
|
||||
{
|
||||
delete m_ui;
|
||||
delete m_ui;
|
||||
}
|
||||
|
||||
|
||||
void ConnectingDialogNT::failed()
|
||||
{
|
||||
m_ui->label->setText(QStringLiteral("<font color='red'>%1</font>").arg(tr("Could not connect to %1 on %2 !").arg(m_serviceName, m_exerciseName)));
|
||||
m_ui->label->setText(QStringLiteral("<font color='red'>%1</font>")
|
||||
.arg(tr("Could not connect to %1 on %2 !").arg(m_serviceName, m_exerciseName)));
|
||||
|
||||
m_ui->pbRetry->setEnabled(true);
|
||||
m_ui->pbIgnore->setEnabled(true);
|
||||
m_ui->pbRetry->setEnabled(true);
|
||||
m_ui->pbIgnore->setEnabled(true);
|
||||
|
||||
m_autoRetryTick = random(5, 20);
|
||||
m_autoRetryTimer->start();
|
||||
m_autoRetryTick = random(5, 20);
|
||||
m_autoRetryTimer->start();
|
||||
|
||||
raise();
|
||||
raise();
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace LtsUtils
|
||||
Executable → Regular
+27
-35
@@ -1,15 +1,12 @@
|
||||
|
||||
|
||||
|
||||
#pragma once
|
||||
#include <QObject>
|
||||
|
||||
#include "ltsutilsguiconnectdialog_export.h"
|
||||
|
||||
#include <LtsWidgets/lts_frameless_dialog.h>
|
||||
|
||||
#include <QObject>
|
||||
#include <functional>
|
||||
|
||||
|
||||
class QTimer;
|
||||
|
||||
namespace Ui
|
||||
@@ -22,43 +19,38 @@ namespace LtsUtils
|
||||
|
||||
class LTSUTILSGUICONNECTDIALOG_EXPORT ConnectingDialogNT : public LtsWidgets::LtsFramelessDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
|
||||
public:
|
||||
explicit ConnectingDialogNT(const std::function<bool(int)>& checkFn, const QString& serviceName,
|
||||
const QString& exerciseName, QWidget* parent);
|
||||
~ConnectingDialogNT();
|
||||
|
||||
explicit ConnectingDialogNT(const std::function<bool(int)> &checkFn,
|
||||
const QString &serviceName,
|
||||
const QString &exerciseName,
|
||||
QWidget *parent);
|
||||
~ConnectingDialogNT();
|
||||
void failed();
|
||||
|
||||
private slots:
|
||||
void slotGo();
|
||||
void slotRetry();
|
||||
|
||||
void failed();
|
||||
signals:
|
||||
void signalGo();
|
||||
void signalFailed();
|
||||
void signalSuccess();
|
||||
|
||||
private slots:
|
||||
void slotGo();
|
||||
void slotRetry();
|
||||
private:
|
||||
QString m_serviceName;
|
||||
QString m_exerciseName;
|
||||
std::function<bool(int)> m_checkFn;
|
||||
bool m_go;
|
||||
|
||||
signals:
|
||||
void signalGo();
|
||||
void signalFailed();
|
||||
void signalSuccess();
|
||||
QTimer* m_autoRetryTimer;
|
||||
int m_autoRetryTick{0};
|
||||
|
||||
private:
|
||||
QString m_serviceName;
|
||||
QString m_exerciseName;
|
||||
std::function<bool(int)> m_checkFn;
|
||||
bool m_go;
|
||||
Ui::ConnectingDialog* m_ui;
|
||||
|
||||
QTimer *m_autoRetryTimer;
|
||||
int m_autoRetryTick { 0 };
|
||||
|
||||
Ui::ConnectingDialog *m_ui;
|
||||
|
||||
int random(int min, int max);
|
||||
bool event(QEvent *event) override;
|
||||
void reset();
|
||||
int random(int min, int max);
|
||||
bool event(QEvent* event) override;
|
||||
void reset();
|
||||
};
|
||||
|
||||
}
|
||||
} // namespace LtsUtils
|
||||
Reference in new issue
Block a user