Skip to content

Commit

Permalink
citra_qt: Add support for favorites, desktop shortcuts, and
Browse files Browse the repository at this point in the history
 play time tracking

Co-Authored-By: Reg Tiangha <[email protected]>
  • Loading branch information
2 people authored and Gamer64ytb committed Jul 26, 2024
1 parent 68360b5 commit 41eee6a
Show file tree
Hide file tree
Showing 32 changed files with 1,021 additions and 47 deletions.
3 changes: 3 additions & 0 deletions dist/license.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ qt_themes/default/icons/48x48/folder.png | CC BY-ND 3.0 | https://icons8.com
qt_themes/default/icons/48x48/no_avatar.png | CC BY-ND 3.0 | https://icons8.com
qt_themes/default/icons/48x48/plus.png | CC0 1.0 | Designed by BreadFish64 from the Citra team
qt_themes/default/icons/48x48/sd_card.png | CC BY-ND 3.0 | https://icons8.com
qt_themes/default/icons/48x48/star.png | CC BY-ND 3.0 | https://icons8.com
qt_themes/qdarkstyle/icons/16x16/connected.png | CC BY-ND 3.0 | https://icons8.com
qt_themes/qdarkstyle/icons/16x16/connected_notification.png | CC BY-ND 3.0 | https://icons8.com
qt_themes/qdarkstyle/icons/16x16/disconnected.png | CC BY-ND 3.0 | https://icons8.com
Expand All @@ -26,6 +27,7 @@ qt_themes/qdarkstyle/icons/48x48/folder.png | CC BY-ND 3.0 | https://icons8.com
qt_themes/qdarkstyle/icons/48x48/no_avatar.png | CC BY-ND 3.0 | https://icons8.com
qt_themes/qdarkstyle/icons/48x48/plus.png | CC0 1.0 | Designed by BreadFish64 from the Citra team
qt_themes/qdarkstyle/icons/48x48/sd_card.png | CC BY-ND 3.0 | https://icons8.com
qt_themes/qdarkstyle/icons/48x48/star.png | CC BY-ND 3.0 | https://icons8.com
qt_themes/colorful/icons/16x16/connected.png | CC BY-ND 3.0 | https://icons8.com
qt_themes/colorful/icons/16x16/connected_notification.png | CC BY-ND 3.0 | https://icons8.com
qt_themes/colorful/icons/16x16/disconnected.png | CC BY-ND 3.0 | https://icons8.com
Expand All @@ -36,6 +38,7 @@ qt_themes/colorful/icons/48x48/chip.png | CC BY-ND 3.0 | https://icons8.com
qt_themes/colorful/icons/48x48/folder.png | CC BY-ND 3.0 | https://icons8.com
qt_themes/colorful/icons/48x48/plus.png | CC BY-ND 3.0 | https://icons8.com
qt_themes/colorful/icons/48x48/sd_card.png | CC BY-ND 3.0 | https://icons8.com
qt_themes/colorful/icons/48x48/star.png | CC BY-ND 3.0 | https://icons8.com
qt_themes/colorful_dark/icons/16x16/connected.png | CC BY-ND 3.0 | https://icons8.com

<!-- TODO (B3N30): Add the license of the citra icon -->
Binary file added dist/qt_themes/colorful/icons/48x48/star.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions dist/qt_themes/colorful/style.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<file alias="48x48/folder.png">icons/48x48/folder.png</file>
<file alias="48x48/plus.png">icons/48x48/plus.png</file>
<file alias="48x48/sd_card.png">icons/48x48/sd_card.png</file>
<file alias="48x48/star.png">icons/48x48/star.png</file>
<file alias="256x256/plus_folder.png">icons/256x256/plus_folder.png</file>
</qresource>
<qresource prefix="colorful">
Expand Down
1 change: 1 addition & 0 deletions dist/qt_themes/colorful_dark/style.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<file alias="48x48/no_avatar.png">../qdarkstyle/icons/48x48/no_avatar.png</file>
<file alias="48x48/plus.png">../colorful/icons/48x48/plus.png</file>
<file alias="48x48/sd_card.png">../colorful/icons/48x48/sd_card.png</file>
<file alias="48x48/star.png">../colorful/icons/48x48/star.png</file>
<file alias="256x256/plus_folder.png">../colorful/icons/256x256/plus_folder.png</file>
</qresource>

Expand Down
1 change: 1 addition & 0 deletions dist/qt_themes/default/default.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
<file alias="48x48/plus.png">icons/48x48/plus.png</file>
<file alias="48x48/sd_card.png">icons/48x48/sd_card.png</file>
<file alias="256x256/citra.png">icons/256x256/citra.png</file>
<file alias="48x48/star.png">icons/48x48/star.png</file>
<file alias="256x256/plus_folder.png">icons/256x256/plus_folder.png</file>
</qresource>
<qresource prefix="default">
Expand Down
Binary file added dist/qt_themes/default/icons/48x48/star.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added dist/qt_themes/qdarkstyle/icons/48x48/star.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions dist/qt_themes/qdarkstyle/style.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<file alias="48x48/no_avatar.png">icons/48x48/no_avatar.png</file>
<file alias="48x48/plus.png">icons/48x48/plus.png</file>
<file alias="48x48/sd_card.png">icons/48x48/sd_card.png</file>
<file alias="48x48/star.png">icons/48x48/star.png</file>
<file alias="256x256/plus_folder.png">icons/256x256/plus_folder.png</file>
</qresource>
<qresource prefix="qss_icons">
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions dist/qt_themes/qdarkstyle_midnight_blue/style.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<file alias="48x48/no_avatar.png">icons/48x48/no_avatar.png</file>
<file alias="48x48/plus.png">icons/48x48/plus.png</file>
<file alias="48x48/sd_card.png">icons/48x48/sd_card.png</file>
<file alias="48x48/star.png">icons/48x48/star.png</file>
<file alias="256x256/plus_folder.png">icons/256x256/plus_folder.png</file>
</qresource>
<qresource prefix="qss_icons">
Expand Down
1 change: 1 addition & 0 deletions license.txt
Original file line number Diff line number Diff line change
Expand Up @@ -356,3 +356,4 @@ folder.png | CC BY-ND 3.0 | https://icons8.com
plus.png (Default, Dark) | CC0 1.0 | Designed by BreadFish64 from the Citra team
plus.png (Colorful, Colorful Dark) | CC BY-ND 3.0 | https://icons8.com
sd_card.png | CC BY-ND 3.0 | https://icons8.com
star.png | CC BY-ND 3.0 | https://icons8.com
2 changes: 2 additions & 0 deletions src/citra_qt/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,8 @@ add_executable(citra-qt
multiplayer/state.cpp
multiplayer/state.h
multiplayer/validation.h
play_time_manager.cpp
play_time_manager.h
precompiled_headers.h
uisettings.cpp
uisettings.h
Expand Down
18 changes: 18 additions & 0 deletions src/citra_qt/configuration/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -822,6 +822,15 @@ void Config::ReadUIGameListValues() {
ReadBasicSetting(UISettings::values.show_region_column);
ReadBasicSetting(UISettings::values.show_type_column);
ReadBasicSetting(UISettings::values.show_size_column);
ReadBasicSetting(UISettings::values.show_play_time_column);

const int favorites_size = qt_config->beginReadArray(QStringLiteral("favorites"));
for (int i = 0; i < favorites_size; i++) {
qt_config->setArrayIndex(i);
UISettings::values.favorited_ids.append(
ReadSetting(QStringLiteral("program_id")).toULongLong());
}
qt_config->endArray();

qt_config->endGroup();
}
Expand Down Expand Up @@ -1318,6 +1327,15 @@ void Config::SaveUIGameListValues() {
WriteBasicSetting(UISettings::values.show_region_column);
WriteBasicSetting(UISettings::values.show_type_column);
WriteBasicSetting(UISettings::values.show_size_column);
WriteBasicSetting(UISettings::values.show_play_time_column);

qt_config->beginWriteArray(QStringLiteral("favorites"));
for (int i = 0; i < UISettings::values.favorited_ids.size(); i++) {
qt_config->setArrayIndex(i);
WriteSetting(QStringLiteral("program_id"),
QVariant::fromValue(UISettings::values.favorited_ids[i]));
}
qt_config->endArray();

qt_config->endGroup();
}
Expand Down
12 changes: 0 additions & 12 deletions src/citra_qt/configuration/configure_per_game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,18 +141,6 @@ void ConfigurePerGame::HandleApplyButtonClicked() {
}
}

static QPixmap GetQPixmapFromSMDH(std::vector<u8>& smdh_data) {
Loader::SMDH smdh;
std::memcpy(&smdh, smdh_data.data(), sizeof(Loader::SMDH));

bool large = true;
std::vector<u16> icon_data = smdh.GetIcon(large);
const uchar* data = reinterpret_cast<const uchar*>(icon_data.data());
int size = large ? 48 : 24;
QImage icon(data, size, size, QImage::Format::Format_RGB16);
return QPixmap::fromImage(icon);
}

void ConfigurePerGame::LoadConfiguration() {
if (filename.empty()) {
return;
Expand Down
1 change: 1 addition & 0 deletions src/citra_qt/debugger/registers.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

#include <memory>
#include <QDockWidget>
#include "common/common_types.h"

class QTreeWidget;
class QTreeWidgetItem;
Expand Down
Loading

0 comments on commit 41eee6a

Please sign in to comment.