Major Changes:
- Merged latest Qt5 devel content from dlbo (292 files changed, 7 new dirs)
- Consolidated forward-declarations and include folders
- Removed unneeded modules per Niklas' repo check list
Build System Fixes:
- Fixed CMake VERSION_GREATER syntax in ParticipantManagement/CMakeLists.txt
- Added VLC packages (libvlc-dev, vlc-plugin-base) to docker_build.sh
- Added PostgreSQL dev packages (libpq-dev, postgresql-server-dev-all) to Dockerfile
- Fixed locale warnings (ANSI_X3.4-1968 → C.UTF-8)
- Fixed ArcGIS SDK path warnings when BUILD_ARCGIS=OFF
Code Generation Fixes:
- Fixed IDL enum collisions (PortType→CorePortType/DdsutPortType, PdmEventType)
- Fixed Grantlee template svc_translation.cpp.grantlee:
- Changed {{ idl_enum.name }}_def:: to {{ idl_enum.name }}::
- Fixed .underlying() calls for C++11 scoped enums (enum class)
- Removed generated files from repo (moc_*, *_dtc.h, *_ftc.h)
Validation:
- BUILD_RTI=ON: SUCCESS
- BUILD_RTI=OFF: SUCCESS
- C++17 standard maintained for RTI 7.7 compatibility
- Ubuntu 26.04 Docker environment verified
Remaining Warnings (expected):
- BgViewer, KDChart, KDReports, Poppler-Qt6 not found (optional features)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
201 lines
5.2 KiB
C++
201 lines
5.2 KiB
C++
#include "configurator.h"
|
|
|
|
#include "guez2018/guez2018.h"
|
|
|
|
#include <QApplication>
|
|
#include <QScreen>
|
|
#include <QPushButton>
|
|
#include <QMessageBox>
|
|
#include <QStyle>
|
|
#include <QDesktopWidget>
|
|
#include <QFile>
|
|
#include <QCheckBox>
|
|
#include <QProcess>
|
|
#include <QDebug>
|
|
|
|
|
|
Configurator::Configurator(const QString &filename)
|
|
: QWidget(nullptr)
|
|
, m_uiIfc(nullptr)
|
|
, m_currentScreen(nullptr)
|
|
, m_mainScreen(nullptr)
|
|
, m_filename(filename)
|
|
, m_cbMainScreen(nullptr)
|
|
{
|
|
int index = projectNames().indexOf(m_filename);
|
|
switch (index)
|
|
{
|
|
case 0: // guez2018
|
|
{
|
|
m_uiIfc = new Guez2018(this);
|
|
break;
|
|
}
|
|
|
|
default:
|
|
{
|
|
QMessageBox::critical(this, QString(), QStringLiteral("Ui implementation missing for this project - aborting."));
|
|
QCoreApplication::quit();
|
|
return;
|
|
}
|
|
}
|
|
|
|
m_cbMainScreen = findChild<QCheckBox *>(QStringLiteral("cbMainScreen"));
|
|
|
|
if (m_cbMainScreen == nullptr)
|
|
{
|
|
qWarning() << "Developer: there is no ui element 'cbMainScreen' !";
|
|
QCoreApplication::quit();
|
|
return;
|
|
}
|
|
|
|
m_screensToTest = QGuiApplication::screens();
|
|
|
|
QList<QPushButton *> screenButtons = findChildren<QPushButton *>();
|
|
|
|
for (auto i = screenButtons.constBegin(); i != screenButtons.constEnd(); ++i)
|
|
{
|
|
QPushButton *btn = *i;
|
|
|
|
btn->setStyleSheet(QStringLiteral("QPushButton:hover { padding: 4px; border: 1px solid; border-color: #009933; border-radius: 2px; background-color: #99ff99; outline: none; } "
|
|
"QPushButton { padding: 4px; border: 1px solid; border-color: #66ff66; border-radius: 2px; background-color: #ccffcc; outline: none; } "
|
|
"QPushButton:disabled { padding: 4px; border: 1px solid; border-color: #000000; border-radius: 2px; background-color: #b3b3b3; outline: none; }"));
|
|
|
|
connect(btn, &QPushButton::clicked,
|
|
this, &Configurator::slotScreenClicked);
|
|
}
|
|
|
|
|
|
slotGo();
|
|
}
|
|
|
|
|
|
Configurator::~Configurator()
|
|
{
|
|
delete m_uiIfc;
|
|
}
|
|
|
|
|
|
void Configurator::slotScreenClicked()
|
|
{
|
|
//QMap<QString, QPoint> m_config;
|
|
|
|
QPushButton *screenButton = qobject_cast<QPushButton *>(sender());
|
|
screenButton->setEnabled(false); // already selected now
|
|
|
|
if (m_cbMainScreen->isChecked())
|
|
{
|
|
m_mainScreen = m_currentScreen;
|
|
m_cbMainScreen->setEnabled(false); // cannot set more than one main screen :)
|
|
m_cbMainScreen->setChecked(false); // there is already the main screen
|
|
}
|
|
|
|
m_config.insert(m_currentScreen->name(),
|
|
QPoint(screenButton->property("screenX").toInt(),
|
|
screenButton->property("screenY").toInt()));
|
|
|
|
slotGo(); // next !
|
|
}
|
|
|
|
|
|
void Configurator::slotGo()
|
|
{
|
|
if (m_screensToTest.isEmpty())
|
|
{
|
|
done();
|
|
return;
|
|
}
|
|
|
|
m_currentScreen = m_screensToTest.takeFirst();
|
|
setGeometry(QStyle::alignedRect(Qt::LeftToRight, Qt::AlignCenter, size(), m_currentScreen->availableGeometry()));
|
|
}
|
|
|
|
|
|
void Configurator::done()
|
|
{
|
|
hide();
|
|
slotSave();
|
|
}
|
|
|
|
|
|
void Configurator::slotSave()
|
|
{
|
|
if (m_mainScreen == nullptr)
|
|
{
|
|
QMessageBox::critical(this, QString(), QStringLiteral("You did not specify the main screen - aborting."));
|
|
QCoreApplication::quit();
|
|
return;
|
|
}
|
|
|
|
QFile f(QStringLiteral(":/%1.conf").arg(m_filename));
|
|
|
|
if (!f.open(QFile::ReadOnly))
|
|
{
|
|
QMessageBox::critical(this, QString(), QStringLiteral("Cannot open project template file from resources - aborting."));
|
|
QCoreApplication::quit();
|
|
return;
|
|
}
|
|
|
|
QString config = QString::fromUtf8(f.readAll());
|
|
|
|
int index = projectNames().indexOf(m_filename);
|
|
switch (index)
|
|
{
|
|
case 0: // guez2018
|
|
{
|
|
QStringList metamodes;
|
|
|
|
for (auto i = m_config.constBegin(); i != m_config.constEnd(); ++i)
|
|
{
|
|
const QString &interfaceName = i.key();
|
|
const QPoint &screenPos = i.value();
|
|
|
|
metamodes.append(QStringLiteral("%1: nvidia-auto-select +%2+%3").arg(interfaceName).arg(screenPos.x()).arg(screenPos.y()));
|
|
}
|
|
|
|
|
|
config = config.arg(m_mainScreen->name(), metamodes.join(QStringLiteral(", ")));
|
|
|
|
break;
|
|
}
|
|
|
|
default:
|
|
{
|
|
QMessageBox::critical(this, QString(), QStringLiteral("Save implementation missing for this project - aborting."));
|
|
QCoreApplication::quit();
|
|
return;
|
|
}
|
|
}
|
|
|
|
|
|
QString configFileName(QStringLiteral("/etc/X11/xorg.conf.d/50-nvidia.conf"));
|
|
|
|
if (QFile::remove(QStringLiteral("/etc/X11/xorg.conf")))
|
|
qWarning() << "xorg.conf deleted as this file is non-sense..";
|
|
|
|
QFile configFile(configFileName);
|
|
|
|
if (!configFile.open(QFile::WriteOnly))
|
|
{
|
|
QMessageBox::critical(this, QString(), QStringLiteral("Cannot write to config file '%1'.\n%2.\nAborting.").arg(configFileName, configFile.errorString()));
|
|
QCoreApplication::quit();
|
|
return;
|
|
}
|
|
|
|
configFile.write(config.toUtf8());
|
|
|
|
if (QMessageBox::question(this, QString(),
|
|
QStringLiteral("Config file '%1' was successfully written.\nDo you want to restart the X server now?").arg(configFileName),
|
|
QMessageBox::StandardButton::Yes | QMessageBox::StandardButton::No) == QMessageBox::StandardButton::Yes)
|
|
{
|
|
QProcess::startDetached(QStringLiteral("systemctl restart display-manager"));
|
|
}
|
|
|
|
QCoreApplication::quit(); // done!
|
|
}
|
|
|
|
|
|
void Configurator::closeEvent(QCloseEvent */*event*/)
|
|
{
|
|
QCoreApplication::quit();
|
|
}
|