Internal
Public Access
About dialog: fix unreadable dark-mode text and missing version
The subtitle and version line used palette(mid), a role meant for 3D bevel/shadow decoration, not text -- it has poor contrast against the window background in dark themes. Replaced with a color blended from the widget's actual text/window palette colors, so it stays readable (de-emphasized but never low-contrast) in either theme. Also: QCoreApplication::applicationVersion() was never being set anywhere, so the dialog always showed "Development build" regardless of the actual built version. CMake's PROJECT_VERSION is now exposed to the app via a compile definition and wired into setApplicationVersion() at startup. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -134,6 +134,7 @@ add_executable(orbithub WIN32 MACOSX_BUNDLE ${ORBITHUB_SOURCES})
|
|||||||
|
|
||||||
target_link_libraries(orbithub PRIVATE Qt6::Widgets Qt6::Sql)
|
target_link_libraries(orbithub PRIVATE Qt6::Widgets Qt6::Sql)
|
||||||
target_link_libraries(orbithub PRIVATE KodoTerm::KodoTerm)
|
target_link_libraries(orbithub PRIVATE KodoTerm::KodoTerm)
|
||||||
|
target_compile_definitions(orbithub PRIVATE ORBITHUB_VERSION_STRING="${PROJECT_VERSION}")
|
||||||
if(TARGET freerdp AND TARGET winpr)
|
if(TARGET freerdp AND TARGET winpr)
|
||||||
target_compile_definitions(orbithub PRIVATE ORBITHUB_HAS_FREERDP)
|
target_compile_definitions(orbithub PRIVATE ORBITHUB_HAS_FREERDP)
|
||||||
target_include_directories(orbithub PRIVATE
|
target_include_directories(orbithub PRIVATE
|
||||||
|
|||||||
+27
-2
@@ -8,6 +8,31 @@
|
|||||||
#include <QTextBrowser>
|
#include <QTextBrowser>
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
// palette(mid) is meant for 3D bevel/shadow decoration, not text — it has
|
||||||
|
// poor contrast against the window background in dark themes (barely
|
||||||
|
// legible). Blend the widget's actual text and window colors instead, so
|
||||||
|
// the result is reliably readable — de-emphasized relative to full-strength
|
||||||
|
// text, but never low-contrast — in either a light or dark theme.
|
||||||
|
QColor mutedTextColor(const QWidget* widget)
|
||||||
|
{
|
||||||
|
const QPalette pal = widget->palette();
|
||||||
|
const QColor text = pal.color(QPalette::WindowText);
|
||||||
|
const QColor background = pal.color(QPalette::Window);
|
||||||
|
constexpr qreal kTextWeight = 0.65;
|
||||||
|
|
||||||
|
auto blend = [kTextWeight](int textChannel, int backgroundChannel) {
|
||||||
|
return qBound(0,
|
||||||
|
qRound(textChannel * kTextWeight + backgroundChannel * (1.0 - kTextWeight)),
|
||||||
|
255);
|
||||||
|
};
|
||||||
|
|
||||||
|
return QColor(blend(text.red(), background.red()),
|
||||||
|
blend(text.green(), background.green()),
|
||||||
|
blend(text.blue(), background.blue()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
AboutDialog::AboutDialog(QWidget* parent) : QDialog(parent)
|
AboutDialog::AboutDialog(QWidget* parent) : QDialog(parent)
|
||||||
{
|
{
|
||||||
setWindowTitle(QStringLiteral("About OrbitHub"));
|
setWindowTitle(QStringLiteral("About OrbitHub"));
|
||||||
@@ -34,7 +59,7 @@ AboutDialog::AboutDialog(QWidget* parent) : QDialog(parent)
|
|||||||
QStringLiteral("Unified remote session manager for SSH, RDP, and VNC workflows."),
|
QStringLiteral("Unified remote session manager for SSH, RDP, and VNC workflows."),
|
||||||
this);
|
this);
|
||||||
subtitle->setWordWrap(true);
|
subtitle->setWordWrap(true);
|
||||||
subtitle->setStyleSheet(QStringLiteral("color: palette(mid);"));
|
subtitle->setStyleSheet(QStringLiteral("color: %1;").arg(mutedTextColor(this).name()));
|
||||||
|
|
||||||
const QString version = QCoreApplication::applicationVersion().trimmed().isEmpty()
|
const QString version = QCoreApplication::applicationVersion().trimmed().isEmpty()
|
||||||
? QStringLiteral("Development build")
|
? QStringLiteral("Development build")
|
||||||
@@ -42,7 +67,7 @@ AboutDialog::AboutDialog(QWidget* parent) : QDialog(parent)
|
|||||||
auto* buildLine = new QLabel(
|
auto* buildLine = new QLabel(
|
||||||
QStringLiteral("Version: %1 | Qt runtime linked dynamically").arg(version),
|
QStringLiteral("Version: %1 | Qt runtime linked dynamically").arg(version),
|
||||||
this);
|
this);
|
||||||
buildLine->setStyleSheet(QStringLiteral("color: palette(mid);"));
|
buildLine->setStyleSheet(QStringLiteral("color: %1;").arg(mutedTextColor(this).name()));
|
||||||
|
|
||||||
titleColumn->addWidget(title);
|
titleColumn->addWidget(title);
|
||||||
titleColumn->addWidget(subtitle);
|
titleColumn->addWidget(subtitle);
|
||||||
|
|||||||
@@ -10,6 +10,9 @@ int main(int argc, char* argv[])
|
|||||||
QApplication app(argc, argv);
|
QApplication app(argc, argv);
|
||||||
app.setOrganizationName(QStringLiteral("FireBugIT"));
|
app.setOrganizationName(QStringLiteral("FireBugIT"));
|
||||||
app.setApplicationName(QStringLiteral("OrbitHub"));
|
app.setApplicationName(QStringLiteral("OrbitHub"));
|
||||||
|
#ifdef ORBITHUB_VERSION_STRING
|
||||||
|
app.setApplicationVersion(QStringLiteral(ORBITHUB_VERSION_STRING));
|
||||||
|
#endif
|
||||||
app.setWindowIcon(createOrbitHubAppIcon());
|
app.setWindowIcon(createOrbitHubAppIcon());
|
||||||
|
|
||||||
SessionWindow window;
|
SessionWindow window;
|
||||||
|
|||||||
Reference in New Issue
Block a user