Formats minimally release source files based on former clang-format
This commit is contained in:
387 files changed
+37323
-38074
No files matched your search
+36
-30
@@ -8,52 +8,58 @@
|
||||
|
||||
namespace LtsUtils
|
||||
{
|
||||
int ConnectingDialog::s_waitForHistoricalDataWaitTime = 10000;
|
||||
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)));
|
||||
}
|
||||
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)));
|
||||
}
|
||||
|
||||
void ConnectingDialog::setup()
|
||||
{
|
||||
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);
|
||||
connect(m_ui->pbRetry,
|
||||
&QPushButton::clicked,
|
||||
this,
|
||||
[this]()
|
||||
{
|
||||
m_ui->pbRetry->setEnabled(false);
|
||||
m_ui->pbIgnore->setEnabled(false);
|
||||
|
||||
reset();
|
||||
emit signalStopLoop();
|
||||
});
|
||||
reset();
|
||||
emit signalStopLoop();
|
||||
});
|
||||
|
||||
connect(m_ui->pbIgnore, &QPushButton::clicked, this, [this]() {
|
||||
m_ui->pbIgnore->setEnabled(false);
|
||||
m_ui->pbRetry->setEnabled(false);
|
||||
m_ui->pbIgnore->setText(tr("continuing.."));
|
||||
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;
|
||||
});
|
||||
}
|
||||
deleteLater();
|
||||
return;
|
||||
});
|
||||
}
|
||||
|
||||
ConnectingDialog::~ConnectingDialog()
|
||||
{
|
||||
ConnectingDialog::~ConnectingDialog()
|
||||
{
|
||||
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)));
|
||||
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->pbRetry->setEnabled(true);
|
||||
m_ui->pbIgnore->setEnabled(true);
|
||||
|
||||
raise();
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace LtsUtils
|
||||
+33
-28
@@ -11,47 +11,52 @@
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class ConnectingDialog;
|
||||
class ConnectingDialog;
|
||||
}
|
||||
|
||||
namespace LtsUtils
|
||||
{
|
||||
|
||||
class LTSUTILSGUICONNECTDIALOG_EXPORT ConnectingDialog : public LtsWidgets::LtsFramelessDialog
|
||||
{
|
||||
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)
|
||||
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();
|
||||
setWindowTitle(tr("Connecting .."));
|
||||
setup();
|
||||
show();
|
||||
|
||||
while (true)
|
||||
while (true)
|
||||
{
|
||||
if ((dtc.get()->*waitForHistoricalDataFunction)(s_waitForHistoricalDataWaitTime))
|
||||
{
|
||||
if ((dtc.get()->*waitForHistoricalDataFunction)(s_waitForHistoricalDataWaitTime))
|
||||
{
|
||||
deleteLater();
|
||||
return;
|
||||
}
|
||||
|
||||
if (s_waitForHistoricalDataWaitTime >= 999999)
|
||||
{
|
||||
deleteLater();
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
failed();
|
||||
}
|
||||
deleteLater();
|
||||
return;
|
||||
}
|
||||
|
||||
if (s_waitForHistoricalDataWaitTime >= 999999)
|
||||
{
|
||||
deleteLater();
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
failed();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
~ConnectingDialog();
|
||||
@@ -61,13 +66,13 @@ class LTSUTILSGUICONNECTDIALOG_EXPORT ConnectingDialog : public LtsWidgets::LtsF
|
||||
private:
|
||||
QString m_serviceName;
|
||||
QString m_exerciseName;
|
||||
Ui::ConnectingDialog* m_ui;
|
||||
Ui::ConnectingDialog *m_ui;
|
||||
|
||||
void reset();
|
||||
void setup();
|
||||
|
||||
signals:
|
||||
void signalStopLoop();
|
||||
};
|
||||
};
|
||||
|
||||
} // namespace LtsUtils
|
||||
+63
-54
@@ -12,39 +12,50 @@
|
||||
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_autoRetryTimer->setInterval(1000);
|
||||
connect(m_autoRetryTimer, &QTimer::timeout, this, [this]() {
|
||||
if (m_autoRetryTick < 1)
|
||||
{
|
||||
slotRetry();
|
||||
return;
|
||||
}
|
||||
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);
|
||||
|
||||
connect(m_ui->pbIgnore, &QPushButton::clicked, this, [this]() {
|
||||
m_ui->pbIgnore->setEnabled(false);
|
||||
m_ui->pbRetry->setEnabled(false);
|
||||
m_ui->pbIgnore->setText(tr("continuing.."));
|
||||
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;
|
||||
});
|
||||
emit signalFailed();
|
||||
deleteLater();
|
||||
return;
|
||||
});
|
||||
|
||||
show();
|
||||
|
||||
@@ -52,32 +63,32 @@ ConnectingDialogNT::ConnectingDialogNT(const std::function<bool(int)>& checkFn,
|
||||
|
||||
m_go = true;
|
||||
m_ui->pbRetry->setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
int ConnectingDialogNT::random(int min, int max)
|
||||
{
|
||||
int ConnectingDialogNT::random(int min, int max)
|
||||
{
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
|
||||
return QRandomGenerator::global()->bounded(min, max);
|
||||
#else
|
||||
return (qrand() % (((max + 1) - min) + min));
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
bool ConnectingDialogNT::event(QEvent* event)
|
||||
{
|
||||
bool ConnectingDialogNT::event(QEvent *event)
|
||||
{
|
||||
bool result = LtsWidgets::LtsFramelessDialog::event(event);
|
||||
|
||||
if (event->type() == QEvent::Paint && m_go)
|
||||
{
|
||||
m_go = false;
|
||||
QTimer::singleShot(0, this, &ConnectingDialogNT::signalGo);
|
||||
m_go = false;
|
||||
QTimer::singleShot(0, this, &ConnectingDialogNT::signalGo);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
void ConnectingDialogNT::slotRetry()
|
||||
{
|
||||
void ConnectingDialogNT::slotRetry()
|
||||
{
|
||||
m_autoRetryTimer->stop();
|
||||
|
||||
m_ui->pbRetry->setText(tr("Retry"));
|
||||
@@ -86,36 +97,34 @@ void ConnectingDialogNT::slotRetry()
|
||||
|
||||
reset();
|
||||
QTimer::singleShot(1, this, &ConnectingDialogNT::slotGo);
|
||||
}
|
||||
}
|
||||
|
||||
void ConnectingDialogNT::slotGo()
|
||||
{
|
||||
void ConnectingDialogNT::slotGo()
|
||||
{
|
||||
|
||||
if (m_checkFn(ConnectingDialog::s_waitForHistoricalDataWaitTime))
|
||||
{
|
||||
emit signalSuccess();
|
||||
deleteLater();
|
||||
return;
|
||||
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)));
|
||||
}
|
||||
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)));
|
||||
}
|
||||
|
||||
ConnectingDialogNT::~ConnectingDialogNT()
|
||||
{
|
||||
ConnectingDialogNT::~ConnectingDialogNT()
|
||||
{
|
||||
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)));
|
||||
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->pbRetry->setEnabled(true);
|
||||
m_ui->pbIgnore->setEnabled(true);
|
||||
@@ -124,6 +133,6 @@ void ConnectingDialogNT::failed()
|
||||
m_autoRetryTimer->start();
|
||||
|
||||
raise();
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace LtsUtils
|
||||
+8
-9
@@ -11,19 +11,18 @@ class QTimer;
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class ConnectingDialog;
|
||||
class ConnectingDialog;
|
||||
}
|
||||
|
||||
namespace LtsUtils
|
||||
{
|
||||
|
||||
class LTSUTILSGUICONNECTDIALOG_EXPORT ConnectingDialogNT : public LtsWidgets::LtsFramelessDialog
|
||||
{
|
||||
class LTSUTILSGUICONNECTDIALOG_EXPORT ConnectingDialogNT : public LtsWidgets::LtsFramelessDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit ConnectingDialogNT(const std::function<bool(int)>& checkFn, const QString& serviceName,
|
||||
const QString& exerciseName, QWidget* parent);
|
||||
explicit ConnectingDialogNT(const std::function<bool(int)> &checkFn, const QString &serviceName, const QString &exerciseName, QWidget *parent);
|
||||
~ConnectingDialogNT();
|
||||
|
||||
void failed();
|
||||
@@ -43,14 +42,14 @@ class LTSUTILSGUICONNECTDIALOG_EXPORT ConnectingDialogNT : public LtsWidgets::Lt
|
||||
std::function<bool(int)> m_checkFn;
|
||||
bool m_go;
|
||||
|
||||
QTimer* m_autoRetryTimer;
|
||||
QTimer *m_autoRetryTimer;
|
||||
int m_autoRetryTick{0};
|
||||
|
||||
Ui::ConnectingDialog* m_ui;
|
||||
Ui::ConnectingDialog *m_ui;
|
||||
|
||||
int random(int min, int max);
|
||||
bool event(QEvent* event) override;
|
||||
bool event(QEvent *event) override;
|
||||
void reset();
|
||||
};
|
||||
};
|
||||
|
||||
} // namespace LtsUtils
|
||||
Reference in new issue
Block a user