From 39ef3b01cb60c3d289c658a921b57197245784b6 Mon Sep 17 00:00:00 2001 From: VocalFan <45863583+VocalFan@users.noreply.github.com> Date: Mon, 2 Oct 2023 01:14:36 -0400 Subject: [PATCH] Added settings and folder icons (#380) --- src/main_window.cpp | 19 ++++++++++++++----- src/resources.qrc | 4 ++++ src/resources/darkmode/cog-outline.svg | 1 + .../darkmode/folder-open-outline.svg | 1 + src/resources/lightmode/cog-outline.svg | 1 + .../lightmode/folder-open-outline.svg | 1 + 6 files changed, 22 insertions(+), 5 deletions(-) create mode 100644 src/resources/darkmode/cog-outline.svg create mode 100644 src/resources/darkmode/folder-open-outline.svg create mode 100644 src/resources/lightmode/cog-outline.svg create mode 100644 src/resources/lightmode/folder-open-outline.svg diff --git a/src/main_window.cpp b/src/main_window.cpp index c976c9621..2efb19b36 100644 --- a/src/main_window.cpp +++ b/src/main_window.cpp @@ -53,7 +53,7 @@ MainWindow::MainWindow() : // File menu. auto fileMenu = menuBar()->addMenu("&File"); auto installPkg = new QAction(QIcon(svgPath + "archive-arrow-down-outline.svg"), "&Install PKG", this); - auto openSystemFolder = new QAction("Open System &Folder", this); + auto openSystemFolder = new QAction(QIcon(svgPath + "folder-open-outline.svg"), "Open System &Folder", this); auto quit = new QAction("&Quit", this); connect(installPkg, &QAction::triggered, this, &MainWindow::installPkg); @@ -355,12 +355,21 @@ void MainWindow::requestGamesContextMenu(const QPoint &pos) auto model = reinterpret_cast(m_games->model()); auto game = model->get(index.row()); + // Determine current theme. + QString svgPath; + + if (QGuiApplication::styleHints()->colorScheme() == Qt::ColorScheme::Dark) { + svgPath = ":/resources/darkmode/"; + } else { + svgPath = ":/resources/lightmode/"; + } + // Setup menu. QMenu menu(this); - QAction openFolder("Open Game &Folder", this); // Opens game folder. - QAction settings("&Settings", this); // TODO LATER: Blank Settings + QAction openGameFolder(QIcon(svgPath + "folder-open-outline.svg"), "Open Game &Folder", this); // Opens game folder. + QAction settings(QIcon(svgPath + "cog-outline.svg"), "&Settings", this); // TODO LATER: Blank Settings - menu.addAction(&openFolder); + menu.addAction(&openGameFolder); menu.addAction(&settings); // Show menu. @@ -370,7 +379,7 @@ void MainWindow::requestGamesContextMenu(const QPoint &pos) return; } - if (selected == &openFolder) { + if (selected == &openGameFolder) { QString folderPath = game->directory(); QDesktopServices::openUrl(QUrl::fromLocalFile(folderPath)); } else if (selected == &settings) { diff --git a/src/resources.qrc b/src/resources.qrc index 933b3b1eb..4d7d0f472 100644 --- a/src/resources.qrc +++ b/src/resources.qrc @@ -3,9 +3,13 @@ resources/darkmode/archive-arrow-down-outline.svg resources/darkmode/card-text-outline.svg + resources/darkmode/cog-outline.svg + resources/darkmode/folder-open-outline.svg resources/darkmode/view-comfy.svg resources/lightmode/archive-arrow-down-outline.svg resources/lightmode/card-text-outline.svg + resources/lightmode/cog-outline.svg + resources/lightmode/folder-open-outline.svg resources/lightmode/view-comfy.svg resources/obliteration-icon.png diff --git a/src/resources/darkmode/cog-outline.svg b/src/resources/darkmode/cog-outline.svg new file mode 100644 index 000000000..1f8545647 --- /dev/null +++ b/src/resources/darkmode/cog-outline.svg @@ -0,0 +1 @@ + diff --git a/src/resources/darkmode/folder-open-outline.svg b/src/resources/darkmode/folder-open-outline.svg new file mode 100644 index 000000000..62b23658b --- /dev/null +++ b/src/resources/darkmode/folder-open-outline.svg @@ -0,0 +1 @@ + diff --git a/src/resources/lightmode/cog-outline.svg b/src/resources/lightmode/cog-outline.svg new file mode 100644 index 000000000..b8c89c257 --- /dev/null +++ b/src/resources/lightmode/cog-outline.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/resources/lightmode/folder-open-outline.svg b/src/resources/lightmode/folder-open-outline.svg new file mode 100644 index 000000000..28af2ad74 --- /dev/null +++ b/src/resources/lightmode/folder-open-outline.svg @@ -0,0 +1 @@ + \ No newline at end of file