[client] replaced Qt dialog icons by traintastic icon

Dieser Commit ist enthalten in:
Reinder Feenstra 2025-11-21 22:52:11 +01:00
Ursprung a095feff7b
Commit 30eea2bf6d
10 geänderte Dateien mit 32 neuen und 12 gelöschten Zeilen

Datei anzeigen

@ -94,7 +94,7 @@ BoardWidget::BoardWidget(std::shared_ptr<Board> object, QWidget* parent) :
, m_tileResizeStarted{false}
, m_nxButtonTimerId(0)
{
setWindowIcon(Theme::getIconForClassId(object->classId));
Theme::setWindowIcon(*this, object->classId);
setFocusPolicy(Qt::StrongFocus);
if(AbstractProperty* name = m_object->getProperty("name"))

Datei anzeigen

@ -3,7 +3,7 @@
*
* This file is part of the traintastic source code.
*
* Copyright (C) 2022-2023 Reinder Feenstra
* Copyright (C) 2022-2025 Reinder Feenstra
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -116,6 +116,7 @@ LNCVProgrammer::LNCVProgrammer(std::shared_ptr<Connection> connection, QWidget*
, m_stop{new QPushButton(Locale::tr("lncv_programmer:stop"))}
{
setWindowTitle(Locale::tr("lncv_programmer:lncv_programmer"));
Theme::setWindowIcon(*this, "lncv_programmer");
loadInterfaces();
connect(m_interface, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &LNCVProgrammer::updateStartEnabled);

Datei anzeigen

@ -3,7 +3,7 @@
*
* This file is part of the traintastic source code.
*
* Copyright (C) 2019-2024 Reinder Feenstra
* Copyright (C) 2019-2025 Reinder Feenstra
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -103,6 +103,7 @@ void SubWindow::setObject(const ObjectPtr& object)
else
m_id = object->classId();
setWidget(createWidget(object));
connect(widget(), &QWidget::windowIconChanged, this, &SubWindow::setWindowIcon);
connect(widget(), &QWidget::windowTitleChanged, this, &SubWindow::setWindowTitle);
if(!widget()->windowTitle().isEmpty())
setWindowTitle(widget()->windowTitle());

Datei anzeigen

@ -3,7 +3,7 @@
*
* This file is part of the traintastic source code.
*
* Copyright (C) 2021,2023-2024 Reinder Feenstra
* Copyright (C) 2021-2025 Reinder Feenstra
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -24,6 +24,7 @@
#include <cassert>
#include <QFile>
#include <QPalette>
#include <QWidget>
const QString iconPathDefault = QStringLiteral(":/");
const QString iconPathDark = QStringLiteral(":/dark/");
@ -75,6 +76,18 @@ QIcon Theme::getIconForClassId(const QString& classId)
return QIcon();
}
void Theme::setWindowIcon(QWidget& widget, const QString& classId)
{
if(auto icon = Theme::getIconForClassId(classId); !icon.isNull())
{
widget.setWindowIcon(icon);
}
else
{
widget.setWindowIcon(QIcon(":/appicon.svg"));
}
}
const std::array<const QString*, 3>& Theme::getIconPaths()
{
switch(s_iconSet)

Datei anzeigen

@ -3,7 +3,7 @@
*
* This file is part of the traintastic source code.
*
* Copyright (C) 2021,2024 Reinder Feenstra
* Copyright (C) 2021-2025 Reinder Feenstra
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -55,6 +55,8 @@ class Theme
inline static QIcon getIcon(const QString& id) { return QIcon(getIconFile(id)); }
static QIcon getIcon(const QString& idOff, const QString& idOn);
static QIcon getIconForClassId(const QString& classId);
static void setWindowIcon(QWidget& widget, const QString& classId);
};
#endif

Datei anzeigen

@ -3,7 +3,7 @@
*
* This file is part of the traintastic source code.
*
* Copyright (C) 2019-2024 Reinder Feenstra
* Copyright (C) 2019-2025 Reinder Feenstra
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -35,7 +35,7 @@ ListWidget::ListWidget(const ObjectPtr& object, QWidget* parent)
, m_object{object}
, m_tableWidget{new TableWidget(this)}
{
setWindowIcon(Theme::getIconForClassId(m_object->classId()));
Theme::setWindowIcon(*this, m_object->classId());
m_tableWidget->setSelectionBehavior(QAbstractItemView::SelectRows);

Datei anzeigen

@ -3,7 +3,7 @@
*
* This file is part of the traintastic source code.
*
* Copyright (C) 2021,2023-2024 Reinder Feenstra
* Copyright (C) 2021-2025 Reinder Feenstra
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -68,7 +68,7 @@ ItemsEditWidget::ItemsEditWidget(const QString& id, QWidget* parent) :
void ItemsEditWidget::buildForm()
{
setObjectWindowTitle();
setWindowIcon(Theme::getIconForClassId(m_object->classId()));
Theme::setWindowIcon(*this, m_object->classId());
m_propertyItems = dynamic_cast<ObjectVectorProperty*>(m_object->getVectorProperty("items"));
m_methodCreate = m_object->getMethod("create");

Datei anzeigen

@ -3,7 +3,7 @@
*
* This file is part of the traintastic source code.
*
* Copyright (C) 2019-2020,2022,2024 Reinder Feenstra
* Copyright (C) 2019-2025 Reinder Feenstra
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -62,7 +62,7 @@ LuaScriptEditWidget::LuaScriptEditWidget(const QString& id, QWidget* parent) :
void LuaScriptEditWidget::buildForm()
{
setObjectWindowTitle();
setWindowIcon(Theme::getIconForClassId(m_object->classId()));
Theme::setWindowIcon(*this, m_object->classId());
m_propertyState = dynamic_cast<Property*>(m_object->getProperty("state"));
m_methodStart = m_object->getMethod("start");

Datei anzeigen

@ -69,7 +69,7 @@ ObjectEditWidget::ObjectEditWidget(ObjectProperty& property, QWidget* parent)
void ObjectEditWidget::buildForm()
{
setObjectWindowTitle();
setWindowIcon(Theme::getIconForClassId(m_object->classId()));
Theme::setWindowIcon(*this, m_object->classId());
if(QWidget* widget = createWidgetIfCustom(m_object))
{

Datei anzeigen

@ -24,6 +24,7 @@
#include <QTabWidget>
#include "../../network/object.hpp"
#include "../../network/property.hpp"
#include "../../theme/theme.hpp"
#include "../interfaceitemnamelabel.hpp"
#include "../createwidget.hpp"
#include "tileimagewidget.hpp"
@ -34,6 +35,8 @@ TileWidget::TileWidget(ObjectPtr object, QWidget* parent)
, m_tabs{new QTabWidget(this)}
, m_image{new TileImageWidget(this)}
{
Theme::setWindowIcon(*this, m_object->classId());
auto* grid = new QGridLayout();
grid->setContentsMargins(2, 2, 2, 2);