Skip to content

Commit

Permalink
added icon for dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
Eism committed Feb 28, 2025
1 parent 1372c0a commit 0bbe67b
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/app/app.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,7 @@
<file>configs/data/shortcuts_mac.xml</file>
<file>configs/data/shortcuts_azerty.xml</file>
<file>configs/workspaces.cfg</file>
<file>configs/ui.cfg</file>
<file alias="resources/appIcon.png">../../share/icons/AppIcon/MS4_AppIcon_96x96.png</file>
</qresource>
</RCC>
3 changes: 3 additions & 0 deletions src/app/configs/ui.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"appIconPath": ":/resources/appIcon.png"
}
7 changes: 7 additions & 0 deletions src/framework/ui/internal/uiconfiguration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ static const int TOOLTIP_DELAY = 500;

void UiConfiguration::init()
{
m_config = ConfigReader::read(":/configs/ui.cfg");

settings()->setDefaultValue(UI_CURRENT_THEME_CODE_KEY, Val(LIGHT_THEME_CODE));
settings()->setDefaultValue(UI_FOLLOW_SYSTEM_THEME_KEY, Val(false));
settings()->setDefaultValue(UI_FONT_FAMILY_KEY, Val(defaultFontFamily()));
Expand Down Expand Up @@ -513,6 +515,11 @@ muse::async::Notification UiConfiguration::iconsFontChanged() const
return m_iconsFontChanged;
}

io::path_t UiConfiguration::appIconPath() const
{
return m_config.value("appIconPath").toPath();
}

std::string UiConfiguration::musicalFontFamily() const
{
return settings()->value(UI_MUSICAL_FONT_FAMILY_KEY).toString();
Expand Down
4 changes: 4 additions & 0 deletions src/framework/ui/internal/uiconfiguration.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ class UiConfiguration : public IUiConfiguration, public Injectable, public async
int iconsFontSize(IconSizeType type) const override;
async::Notification iconsFontChanged() const override;

io::path_t appIconPath() const override;

std::string musicalFontFamily() const override;
int musicalFontSize() const override;
async::Notification musicalFontChanged() const override;
Expand Down Expand Up @@ -156,6 +158,8 @@ class UiConfiguration : public IUiConfiguration, public Injectable, public async
ThemeList m_themes;
size_t m_currentThemeIndex = 0;
std::optional<double> m_customDPI;

Config m_config;
};
}

Expand Down
2 changes: 2 additions & 0 deletions src/framework/ui/iuiconfiguration.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ class IUiConfiguration : MODULE_EXPORT_INTERFACE
virtual int iconsFontSize(IconSizeType type) const = 0;
virtual async::Notification iconsFontChanged() const = 0;

virtual io::path_t appIconPath() const = 0;

virtual std::string musicalFontFamily() const = 0;
virtual int musicalFontSize() const = 0;
virtual async::Notification musicalFontChanged() const = 0;
Expand Down
2 changes: 2 additions & 0 deletions src/framework/ui/tests/mocks/uiconfigurationmock.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ class UiConfigurationMock : public IUiConfiguration
MOCK_METHOD(int, iconsFontSize, (IconSizeType), (const, override));
MOCK_METHOD(async::Notification, iconsFontChanged, (), (const, override));

MOCK_METHOD(io::path_t, appIconPath, (), (const, override));

MOCK_METHOD(std::string, musicalFontFamily, (), (const, override));
MOCK_METHOD(int, musicalFontSize, (), (const, override));
MOCK_METHOD(async::Notification, musicalFontChanged, (), (const, override));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ void PopupWindow_QQuickView::init(QQmlEngine* engine, bool isDialogMode, bool is
// dialog
if (isDialogMode) {
m_view->setFlags(Qt::Dialog);
m_view->setIcon(QIcon(uiConfiguration()->appIconPath().toString()));

if (isFrameless) {
m_view->setColor(QColor(Qt::transparent));
Expand Down

0 comments on commit 0bbe67b

Please sign in to comment.