Qt6 Migration: LtsWidgets, BUILD_RTI Guards, externe Dependencies dokumentiert
- LtsWidgets Verzeichnis vollständig migriert (Qt5→Qt6) - BUILD_RTI Guards für RTI-spezifische Module hinzugefügt - Externe Dependencies in EXTERNAL_DEPS.md dokumentiert - Qt6 API-Änderungen: QRegExp→QRegularExpression, enterEvent(QEnterEvent*) - AutoUic-Fehler bei ui_requirement behoben (SKIP_AUTOUIC) - Include-Pfade korrigiert (LtsElevation, LtsMultiMonitor, LtsUtilsCore) - MOC-Fehler behoben (Q_INTERFACES entfernt wo nicht benötigt) - CMakeLists.txt Anpassungen für Qt6 (PUBLIC statt INTERFACE) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
145 files changed
+17700
-14377
No files matched your search
+101
-75
@@ -1,4 +1,12 @@
|
||||
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* Helper Class, which manages a progress Dialog with two states.
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
*
|
||||
* Created by Mike Wille, SLSE, 2016-06-20
|
||||
*/
|
||||
|
||||
#include "lts_progress_dialog_helper.h"
|
||||
|
||||
@@ -11,118 +19,136 @@
|
||||
#include <QPushButton>
|
||||
#include <QTimer>
|
||||
|
||||
|
||||
namespace LtsWidgets
|
||||
{
|
||||
|
||||
LtsProgressDialogHelper::LtsProgressDialogHelper(QWidget* parent)
|
||||
: QObject(parent), m_waitDlg(nullptr), m_parentWidget(parent), m_textLabel(nullptr)
|
||||
{
|
||||
}
|
||||
LtsProgressDialogHelper::LtsProgressDialogHelper(QWidget *parent)
|
||||
: QObject(parent)
|
||||
, m_waitDlg(nullptr) // save mem
|
||||
, m_parentWidget(parent)
|
||||
, m_textLabel(nullptr)
|
||||
{}
|
||||
|
||||
|
||||
LtsProgressDialogHelper::~LtsProgressDialogHelper()
|
||||
{
|
||||
delete m_waitDlg;
|
||||
delete m_waitDlg;
|
||||
}
|
||||
|
||||
void LtsProgressDialogHelper::setCustomText(const QString& customText)
|
||||
{
|
||||
if (m_waitDlg == nullptr || m_textLabel == nullptr)
|
||||
return;
|
||||
|
||||
if (customText.isEmpty())
|
||||
m_textLabel->setText(tr("Waiting for server reply..."));
|
||||
else
|
||||
m_textLabel->setText(customText);
|
||||
void LtsProgressDialogHelper::setCustomText(const QString &customText)
|
||||
{
|
||||
if (m_waitDlg == nullptr || m_textLabel == nullptr)
|
||||
return;
|
||||
|
||||
if (customText.isEmpty())
|
||||
m_textLabel->setText(tr("Waiting for server reply..."));
|
||||
else
|
||||
m_textLabel->setText(customText);
|
||||
}
|
||||
|
||||
void LtsProgressDialogHelper::setParentWidget(QWidget* newParent)
|
||||
void LtsProgressDialogHelper::setParentWidget(QWidget *newParent)
|
||||
{
|
||||
m_parentWidget = newParent;
|
||||
if (m_waitDlg)
|
||||
{
|
||||
m_waitDlg->setParent(newParent);
|
||||
QTimer::singleShot(0, m_waitDlg.data(), &LtsFramelessDialog::onUpdateGeometry);
|
||||
}
|
||||
m_parentWidget = newParent;
|
||||
if (m_waitDlg)
|
||||
{
|
||||
m_waitDlg->setParent(newParent);
|
||||
QTimer::singleShot(0, m_waitDlg.data(), &LtsFramelessDialog::onUpdateGeometry);
|
||||
}
|
||||
}
|
||||
|
||||
void LtsProgressDialogHelper::slotShowWaitForReplyWindow()
|
||||
{
|
||||
if (m_waitDlg)
|
||||
m_waitDlg->deleteLater();
|
||||
m_waitDlg = new LtsFramelessDialog(m_parentWidget, Behaviour::Modal);
|
||||
if (m_waitDlg)
|
||||
m_waitDlg->deleteLater(); //delete m_waitDlg; // when there is already an instance
|
||||
m_waitDlg = new LtsFramelessDialog(m_parentWidget, Behaviour::Modal);
|
||||
|
||||
QHBoxLayout* l = new QHBoxLayout(m_waitDlg);
|
||||
QHBoxLayout *l = new QHBoxLayout(m_waitDlg);
|
||||
|
||||
QProgressBar* pb = new QProgressBar(m_waitDlg);
|
||||
pb->setMaximum(0);
|
||||
pb->setValue(-1);
|
||||
QProgressBar *pb = new QProgressBar(m_waitDlg);
|
||||
pb->setMaximum(0);
|
||||
pb->setValue(-1);
|
||||
|
||||
l->addWidget(pb);
|
||||
l->addWidget(pb);
|
||||
|
||||
m_textLabel = new QLabel(m_waitDlg);
|
||||
setCustomText();
|
||||
l->addWidget(m_textLabel);
|
||||
m_textLabel = new QLabel(m_waitDlg);
|
||||
setCustomText();
|
||||
l->addWidget(m_textLabel);
|
||||
|
||||
m_waitDlg->setLayout(l);
|
||||
m_waitDlg->show();
|
||||
m_waitDlg->raise();
|
||||
m_waitDlg->setLayout(l);
|
||||
m_waitDlg->show();
|
||||
m_waitDlg->raise(); // TODO: needed when StyOnTop is active ?
|
||||
|
||||
//QCoreApplication::processEvents(); // do not look glitched if dds hangs
|
||||
}
|
||||
|
||||
void LtsProgressDialogHelper::slotStopWaitForReplyWindow(const ReplyResult& replyResult, const QString& replyString)
|
||||
|
||||
void LtsProgressDialogHelper::slotStopWaitForReplyWindow(const ReplyResult &replyResult, const QString &replyString)
|
||||
{
|
||||
if (m_waitDlg == nullptr)
|
||||
{
|
||||
if (m_waitDlg == nullptr)
|
||||
{
|
||||
// TODO: debug/warning that there is no wait dlg..
|
||||
return;
|
||||
}
|
||||
|
||||
return;
|
||||
//qDeleteAll(m_waitDlg->children()); // delete the layout and it's children
|
||||
m_waitDlg->deleteLater(); // the easiest way
|
||||
m_waitDlg = nullptr;
|
||||
|
||||
// .. a new layout, telling the reply result
|
||||
QString resultText = tr("Unknown result (%1)!").arg((int)replyResult);
|
||||
|
||||
switch (replyResult)
|
||||
{
|
||||
case ReplyResult::Close:
|
||||
{
|
||||
return; // say nothing, just close
|
||||
}
|
||||
|
||||
m_waitDlg->deleteLater();
|
||||
m_waitDlg = nullptr;
|
||||
|
||||
QString resultText = tr("Unknown result (%1)!").arg((int)replyResult);
|
||||
|
||||
switch (replyResult)
|
||||
case ReplyResult::Success:
|
||||
{
|
||||
case ReplyResult::Close: {
|
||||
return;
|
||||
}
|
||||
|
||||
case ReplyResult::Success: {
|
||||
resultText = tr("Operation was successful");
|
||||
break;
|
||||
}
|
||||
|
||||
case ReplyResult::Failure: {
|
||||
resultText = tr("Operation has failed!\nReason: '%1'").arg(replyString);
|
||||
break;
|
||||
}
|
||||
|
||||
case ReplyResult::TimeOut: {
|
||||
resultText = tr("Operation has timed out and could not be processed! Please try again later");
|
||||
break;
|
||||
}
|
||||
resultText = tr("Operation was successful");
|
||||
break;
|
||||
}
|
||||
|
||||
m_waitDlg = new LtsFramelessDialog(m_parentWidget, Behaviour::Modal);
|
||||
case ReplyResult::Failure:
|
||||
{
|
||||
resultText = tr("Operation has failed!\nReason: '%1'").arg(replyString);
|
||||
break;
|
||||
}
|
||||
|
||||
QVBoxLayout* newLayout = new QVBoxLayout(m_waitDlg);
|
||||
newLayout->addWidget(new QLabel(resultText, m_waitDlg));
|
||||
case ReplyResult::TimeOut:
|
||||
{
|
||||
resultText = tr("Operation has timed out and could not be processed! Please try again later");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
QPushButton* btn = new QPushButton(tr("OK"), m_waitDlg);
|
||||
connect(btn, &QPushButton::clicked, this, &LtsProgressDialogHelper::accept);
|
||||
m_waitDlg = new LtsFramelessDialog(m_parentWidget, Behaviour::Modal);
|
||||
|
||||
newLayout->addWidget(btn);
|
||||
QVBoxLayout *newLayout = new QVBoxLayout(m_waitDlg);
|
||||
newLayout->addWidget(new QLabel(resultText, m_waitDlg));
|
||||
|
||||
m_waitDlg->setLayout(newLayout);
|
||||
m_waitDlg->show();
|
||||
QPushButton *btn = new QPushButton(tr("OK"),m_waitDlg);
|
||||
connect(btn, &QPushButton::clicked,
|
||||
this, &LtsProgressDialogHelper::accept); // TODO: or close?
|
||||
|
||||
newLayout->addWidget(btn);
|
||||
|
||||
m_waitDlg->setLayout(newLayout);
|
||||
m_waitDlg->show();
|
||||
|
||||
//QCoreApplication::processEvents(); // do not look glitched if dds hangs
|
||||
}
|
||||
|
||||
|
||||
void LtsProgressDialogHelper::accept()
|
||||
{
|
||||
m_waitDlg->accept();
|
||||
m_waitDlg->deleteLater();
|
||||
m_waitDlg = nullptr;
|
||||
emit accepted();
|
||||
m_waitDlg->accept();
|
||||
m_waitDlg->deleteLater();
|
||||
m_waitDlg = nullptr;
|
||||
emit accepted();
|
||||
}
|
||||
|
||||
} // namespace LtsWidgets
|
||||
Reference in new issue
Block a user