mirror of
https://github.com/PabloMK7/citra.git
synced 2024-12-29 11:06:12 +00:00
QT: Implement themed icons (#3554)
* implement themed icons * fix theme search paths
This commit is contained in:
parent
7abfdb164b
commit
05cf7fe70a
BIN
dist/icons/citra.png
vendored
BIN
dist/icons/citra.png
vendored
Binary file not shown.
Before Width: | Height: | Size: 21 KiB |
7
dist/icons/icons.qrc
vendored
7
dist/icons/icons.qrc
vendored
|
@ -1,7 +0,0 @@
|
||||||
<RCC>
|
|
||||||
<qresource prefix="icons">
|
|
||||||
<file>checked.png</file>
|
|
||||||
<file>failed.png</file>
|
|
||||||
<file>citra.png</file>
|
|
||||||
</qresource>
|
|
||||||
</RCC>
|
|
11
dist/qt_themes/default/default.qrc
vendored
Normal file
11
dist/qt_themes/default/default.qrc
vendored
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
<RCC>
|
||||||
|
<qresource prefix="icons/default">
|
||||||
|
<file alias="index.theme">icons/index.theme</file>
|
||||||
|
|
||||||
|
<file alias="16x16/checked.png">icons/16x16/checked.png</file>
|
||||||
|
|
||||||
|
<file alias="16x16/failed.png">icons/16x16/failed.png</file>
|
||||||
|
|
||||||
|
<file alias="256x256/citra.png">icons/256x256/citra.png</file>
|
||||||
|
</qresource>
|
||||||
|
</RCC>
|
Before Width: | Height: | Size: 451 B After Width: | Height: | Size: 451 B |
Before Width: | Height: | Size: 428 B After Width: | Height: | Size: 428 B |
BIN
dist/qt_themes/default/icons/256x256/citra.png
vendored
Normal file
BIN
dist/qt_themes/default/icons/256x256/citra.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 26 KiB |
10
dist/qt_themes/default/icons/index.theme
vendored
Normal file
10
dist/qt_themes/default/icons/index.theme
vendored
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
[Icon Theme]
|
||||||
|
Name=default
|
||||||
|
Comment=default theme
|
||||||
|
Directories=16x16,256x256
|
||||||
|
|
||||||
|
[16x16]
|
||||||
|
Size=16
|
||||||
|
|
||||||
|
[256x256]
|
||||||
|
Size=256
|
11
dist/qt_themes/qdarkstyle/icons/index.theme
vendored
Normal file
11
dist/qt_themes/qdarkstyle/icons/index.theme
vendored
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
[Icon Theme]
|
||||||
|
Name=qdarkstyle
|
||||||
|
Comment=dark theme
|
||||||
|
Inherits=default
|
||||||
|
Directories=16x16,256x256
|
||||||
|
|
||||||
|
[16x16]
|
||||||
|
Size=16
|
||||||
|
|
||||||
|
[256x256]
|
||||||
|
Size=256
|
3
dist/qt_themes/qdarkstyle/style.qrc
vendored
3
dist/qt_themes/qdarkstyle/style.qrc
vendored
|
@ -1,4 +1,7 @@
|
||||||
<RCC>
|
<RCC>
|
||||||
|
<qresource prefix="icons/qdarkstyle">
|
||||||
|
<file alias="index.theme">icons/index.theme</file>
|
||||||
|
</qresource>
|
||||||
<qresource prefix="qss_icons">
|
<qresource prefix="qss_icons">
|
||||||
<file>rc/up_arrow_disabled.png</file>
|
<file>rc/up_arrow_disabled.png</file>
|
||||||
<file>rc/Hmovetoolbar.png</file>
|
<file>rc/Hmovetoolbar.png</file>
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
// Licensed under GPLv2 or any later version
|
// Licensed under GPLv2 or any later version
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
|
#include <QIcon>
|
||||||
#include "aboutdialog.h"
|
#include "aboutdialog.h"
|
||||||
#include "common/scm_rev.h"
|
#include "common/scm_rev.h"
|
||||||
#include "ui_aboutdialog.h"
|
#include "ui_aboutdialog.h"
|
||||||
|
@ -10,6 +11,7 @@ AboutDialog::AboutDialog(QWidget* parent)
|
||||||
: QDialog(parent, Qt::WindowTitleHint | Qt::WindowCloseButtonHint | Qt::WindowSystemMenuHint),
|
: QDialog(parent, Qt::WindowTitleHint | Qt::WindowCloseButtonHint | Qt::WindowSystemMenuHint),
|
||||||
ui(new Ui::AboutDialog) {
|
ui(new Ui::AboutDialog) {
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
ui->labelLogo->setPixmap(QIcon::fromTheme("citra").pixmap(200));
|
||||||
ui->labelBuildInfo->setText(ui->labelBuildInfo->text().arg(
|
ui->labelBuildInfo->setText(ui->labelBuildInfo->text().arg(
|
||||||
Common::g_build_name, Common::g_scm_branch, Common::g_scm_desc));
|
Common::g_build_name, Common::g_scm_branch, Common::g_scm_desc));
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
// Licensed under GPLv2 or any later version
|
// Licensed under GPLv2 or any later version
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
|
#include <QIcon>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include "citra_qt/configuration/configure_web.h"
|
#include "citra_qt/configuration/configure_web.h"
|
||||||
#include "core/settings.h"
|
#include "core/settings.h"
|
||||||
|
@ -67,12 +68,12 @@ void ConfigureWeb::RefreshTelemetryID() {
|
||||||
void ConfigureWeb::OnLoginChanged() {
|
void ConfigureWeb::OnLoginChanged() {
|
||||||
if (ui->edit_username->text().isEmpty() && ui->edit_token->text().isEmpty()) {
|
if (ui->edit_username->text().isEmpty() && ui->edit_token->text().isEmpty()) {
|
||||||
user_verified = true;
|
user_verified = true;
|
||||||
ui->label_username_verified->setPixmap(QPixmap(":/icons/checked.png"));
|
ui->label_username_verified->setPixmap(QIcon::fromTheme("checked").pixmap(16));
|
||||||
ui->label_token_verified->setPixmap(QPixmap(":/icons/checked.png"));
|
ui->label_token_verified->setPixmap(QIcon::fromTheme("checked").pixmap(16));
|
||||||
} else {
|
} else {
|
||||||
user_verified = false;
|
user_verified = false;
|
||||||
ui->label_username_verified->setPixmap(QPixmap(":/icons/failed.png"));
|
ui->label_username_verified->setPixmap(QIcon::fromTheme("failed").pixmap(16));
|
||||||
ui->label_token_verified->setPixmap(QPixmap(":/icons/failed.png"));
|
ui->label_token_verified->setPixmap(QIcon::fromTheme("failed").pixmap(16));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -89,11 +90,11 @@ void ConfigureWeb::OnLoginVerified() {
|
||||||
ui->button_verify_login->setText(tr("Verify"));
|
ui->button_verify_login->setText(tr("Verify"));
|
||||||
if (verified.get()) {
|
if (verified.get()) {
|
||||||
user_verified = true;
|
user_verified = true;
|
||||||
ui->label_username_verified->setPixmap(QPixmap(":/icons/checked.png"));
|
ui->label_username_verified->setPixmap(QIcon::fromTheme("checked").pixmap(16));
|
||||||
ui->label_token_verified->setPixmap(QPixmap(":/icons/checked.png"));
|
ui->label_token_verified->setPixmap(QIcon::fromTheme("checked").pixmap(16));
|
||||||
} else {
|
} else {
|
||||||
ui->label_username_verified->setPixmap(QPixmap(":/icons/failed.png"));
|
ui->label_username_verified->setPixmap(QIcon::fromTheme("failed").pixmap(16));
|
||||||
ui->label_token_verified->setPixmap(QPixmap(":/icons/failed.png"));
|
ui->label_token_verified->setPixmap(QIcon::fromTheme("failed").pixmap(16));
|
||||||
QMessageBox::critical(
|
QMessageBox::critical(
|
||||||
this, tr("Verification failed"),
|
this, tr("Verification failed"),
|
||||||
tr("Verification failed. Check that you have entered your username and token "
|
tr("Verification failed. Check that you have entered your username and token "
|
||||||
|
|
|
@ -130,6 +130,7 @@ GMainWindow::GMainWindow() : config(new Config()), emu_thread(nullptr) {
|
||||||
|
|
||||||
game_list->PopulateAsync(UISettings::values.gamedir, UISettings::values.gamedir_deepscan);
|
game_list->PopulateAsync(UISettings::values.gamedir, UISettings::values.gamedir_deepscan);
|
||||||
|
|
||||||
|
default_theme_paths = QIcon::themeSearchPaths();
|
||||||
UpdateUITheme();
|
UpdateUITheme();
|
||||||
|
|
||||||
// Show one-time "callout" messages to the user
|
// Show one-time "callout" messages to the user
|
||||||
|
@ -1226,7 +1227,9 @@ void GMainWindow::filterBarSetChecked(bool state) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void GMainWindow::UpdateUITheme() {
|
void GMainWindow::UpdateUITheme() {
|
||||||
if (UISettings::values.theme != UISettings::themes[0].second) {
|
QStringList theme_paths(default_theme_paths);
|
||||||
|
if (UISettings::values.theme != UISettings::themes[0].second &&
|
||||||
|
!UISettings::values.theme.isEmpty()) {
|
||||||
QString theme_uri(":" + UISettings::values.theme + "/style.qss");
|
QString theme_uri(":" + UISettings::values.theme + "/style.qss");
|
||||||
QFile f(theme_uri);
|
QFile f(theme_uri);
|
||||||
if (!f.exists()) {
|
if (!f.exists()) {
|
||||||
|
@ -1237,10 +1240,15 @@ void GMainWindow::UpdateUITheme() {
|
||||||
qApp->setStyleSheet(ts.readAll());
|
qApp->setStyleSheet(ts.readAll());
|
||||||
GMainWindow::setStyleSheet(ts.readAll());
|
GMainWindow::setStyleSheet(ts.readAll());
|
||||||
}
|
}
|
||||||
|
theme_paths.append(QStringList{":/icons/default", ":/icons/" + UISettings::values.theme});
|
||||||
|
QIcon::setThemeName(":/icons/" + UISettings::values.theme);
|
||||||
} else {
|
} else {
|
||||||
qApp->setStyleSheet("");
|
qApp->setStyleSheet("");
|
||||||
GMainWindow::setStyleSheet("");
|
GMainWindow::setStyleSheet("");
|
||||||
|
theme_paths.append(QStringList{":/icons/default"});
|
||||||
|
QIcon::setThemeName(":/icons/default");
|
||||||
}
|
}
|
||||||
|
QIcon::setThemeSearchPaths(theme_paths);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GMainWindow::LoadTranslation() {
|
void GMainWindow::LoadTranslation() {
|
||||||
|
|
|
@ -206,6 +206,9 @@ private:
|
||||||
|
|
||||||
QTranslator translator;
|
QTranslator translator;
|
||||||
|
|
||||||
|
// stores default icon theme search paths for the platform
|
||||||
|
QStringList default_theme_paths;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void dropEvent(QDropEvent* event) override;
|
void dropEvent(QDropEvent* event) override;
|
||||||
void dragEnterEvent(QDragEnterEvent* event) override;
|
void dragEnterEvent(QDragEnterEvent* event) override;
|
||||||
|
|
Loading…
Reference in a new issue