- Added Play, Pause, Stop and several other UI icons. (#91)

* - Added Play, Pause, Stop and several other UI icons.
- Added a screenshot :3

* update reuse

* reuse again

* screenshot
This commit is contained in:
Younes 2024-03-01 01:47:28 -07:00 committed by GitHub
parent 7425cb41a5
commit f2691d83b8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
21 changed files with 171 additions and 11 deletions

View File

@ -10,6 +10,22 @@ Files: CMakeSettings.json
.github/shadps4.png
.gitmodules
src/images/shadps4.ico
screenshots/screenshot.png
src/images/controller_icon.png
src/images/exit_icon.png
src/images/file_icon.png
src/images/folder_icon.png
src/images/grid_icon.png
src/images/iconsize_icon.png
src/images/list_icon.png
src/images/list_mode_icon.png
src/images/pause_icon.png
src/images/play_icon.png
src/images/refresh_icon.png
src/images/settings_icon.png
src/images/stop_icon.png
src/images/themes_icon.png
src/shadps4.rc
src/shadps4.qrc
Copyright: shadPS4 Emulator Project
License: GPL-2.0-or-later

View File

@ -137,6 +137,7 @@ set(HOST_SOURCES src/Emulator/Host/controller.cpp
# the above is shared in sdl and qt version (TODO share them all)
if(ENABLE_QT_GUI)
qt_add_resources(RESOURCE_FILES src/shadps4.qrc)
set(QT_GUI
src/qt_gui/main_window_ui.h
src/qt_gui/main_window.cpp
@ -166,6 +167,7 @@ if(ENABLE_QT_GUI)
src/qt_gui/main_window_themes.cpp
src/qt_gui/main_window_themes.h
src/qt_gui/main.cpp
${RESOURCE_FILES}
)
endif()

BIN
screenshots/screenshot.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 810 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.9 KiB

BIN
src/images/exit_icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1017 B

BIN
src/images/file_icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

BIN
src/images/folder_icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

BIN
src/images/grid_icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

BIN
src/images/list_icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

BIN
src/images/pause_icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
src/images/play_icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

BIN
src/images/refresh_icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

BIN
src/images/stop_icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
src/images/themes_icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

View File

@ -27,20 +27,14 @@ MainWindow::~MainWindow() {
}
bool MainWindow::Init() {
// add toolbar widgets
QApplication::setStyle("Fusion");
ui->toolBar->setObjectName("mw_toolbar");
ui->sizeSlider->setRange(0, gui::game_list_max_slider_pos);
ui->toolBar->addWidget(ui->sizeSliderContainer);
ui->toolBar->addWidget(ui->mw_searchbar);
AddUiWidgets();
CreateActions();
CreateDockWindows();
CreateConnects();
SetLastUsedTheme();
setMinimumSize(350, minimumSizeHint().height());
setWindowTitle(QString::fromStdString("ShadPS4 v0.0.2"));
setWindowTitle(QString::fromStdString("ShadPS4 v0.0.3"));
ConfigureGuiFromSettings();
@ -75,6 +69,25 @@ void MainWindow::CreateActions() {
m_theme_act_group->addAction(ui->setThemeViolet);
}
void MainWindow::AddUiWidgets() {
// add toolbar widgets
QApplication::setStyle("Fusion");
ui->toolBar->setObjectName("mw_toolbar");
ui->sizeSlider->setRange(0, gui::game_list_max_slider_pos);
ui->toolBar->addWidget(ui->playButton);
ui->toolBar->addWidget(ui->pauseButton);
ui->toolBar->addWidget(ui->stopButton);
ui->toolBar->addWidget(ui->settingsButton);
ui->toolBar->addWidget(ui->controllerButton);
QFrame* line = new QFrame(this);
line->setFrameShape(QFrame::StyledPanel);
line->setFrameShadow(QFrame::Sunken);
ui->toolBar->addWidget(line);
// ui->toolBar->addWidget(ui->emuRunWidget);
ui->toolBar->addWidget(ui->sizeSliderContainer);
ui->toolBar->addWidget(ui->mw_searchbar);
}
void MainWindow::CreateDockWindows() {
m_main_window = new QMainWindow();
m_main_window->setContextMenuPolicy(Qt::PreventContextMenu);
@ -167,22 +180,42 @@ void MainWindow::CreateConnects() {
connect(ui->setThemeLight, &QAction::triggered, &m_window_themes, [this]() {
m_window_themes.SetWindowTheme(Theme::Light, ui->mw_searchbar);
m_gui_settings->SetValue(gui::mw_themes, static_cast<int>(Theme::Light));
if (!isIconBlack) {
SetUiIcons(true);
isIconBlack = true;
}
});
connect(ui->setThemeDark, &QAction::triggered, &m_window_themes, [this]() {
m_window_themes.SetWindowTheme(Theme::Dark, ui->mw_searchbar);
m_gui_settings->SetValue(gui::mw_themes, static_cast<int>(Theme::Dark));
if (isIconBlack) {
SetUiIcons(false);
isIconBlack = false;
}
});
connect(ui->setThemeGreen, &QAction::triggered, &m_window_themes, [this]() {
m_window_themes.SetWindowTheme(Theme::Green, ui->mw_searchbar);
m_gui_settings->SetValue(gui::mw_themes, static_cast<int>(Theme::Green));
if (isIconBlack) {
SetUiIcons(false);
isIconBlack = false;
}
});
connect(ui->setThemeBlue, &QAction::triggered, &m_window_themes, [this]() {
m_window_themes.SetWindowTheme(Theme::Blue, ui->mw_searchbar);
m_gui_settings->SetValue(gui::mw_themes, static_cast<int>(Theme::Blue));
if (isIconBlack) {
SetUiIcons(false);
isIconBlack = false;
}
});
connect(ui->setThemeViolet, &QAction::triggered, &m_window_themes, [this]() {
m_window_themes.SetWindowTheme(Theme::Violet, ui->mw_searchbar);
m_gui_settings->SetValue(gui::mw_themes, static_cast<int>(Theme::Violet));
if (isIconBlack) {
SetUiIcons(false);
isIconBlack = false;
}
});
}
@ -347,18 +380,69 @@ void MainWindow::SetLastUsedTheme() {
switch (lastTheme) {
case Theme::Light:
ui->setThemeLight->setChecked(true);
isIconBlack = true;
break;
case Theme::Dark:
ui->setThemeDark->setChecked(true);
isIconBlack = false;
SetUiIcons(false);
break;
case Theme::Green:
ui->setThemeGreen->setChecked(true);
isIconBlack = false;
SetUiIcons(false);
break;
case Theme::Blue:
ui->setThemeBlue->setChecked(true);
isIconBlack = false;
SetUiIcons(false);
break;
case Theme::Violet:
ui->setThemeViolet->setChecked(true);
isIconBlack = false;
SetUiIcons(false);
break;
}
}
QIcon MainWindow::recolorIcon(const QIcon& icon, bool isWhite) {
QPixmap pixmap(icon.pixmap(icon.actualSize(QSize(120, 120)), QIcon::Normal));
QColor clr(isWhite ? Qt::white : Qt::black);
QBitmap mask = pixmap.createMaskFromColor(clr, Qt::MaskOutColor);
pixmap.fill(QColor(isWhite ? Qt::black : Qt::white));
pixmap.setMask(mask);
QIcon newIcon(pixmap);
return newIcon;
}
void MainWindow::SetUiIcons(bool isWhite) {
QIcon icon;
icon = recolorIcon(ui->bootInstallPkgAct->icon(), isWhite);
ui->bootInstallPkgAct->setIcon(icon);
icon = recolorIcon(ui->exitAct->icon(), isWhite);
ui->exitAct->setIcon(icon);
icon = recolorIcon(ui->setlistModeListAct->icon(), isWhite);
ui->setlistModeListAct->setIcon(icon);
icon = recolorIcon(ui->setlistModeGridAct->icon(), isWhite);
ui->setlistModeGridAct->setIcon(icon);
icon = recolorIcon(ui->gameInstallPathAct->icon(), isWhite);
ui->gameInstallPathAct->setIcon(icon);
icon = recolorIcon(ui->menuThemes->icon(), isWhite);
ui->menuThemes->setIcon(icon);
icon = recolorIcon(ui->menuGame_List_Icons->icon(), isWhite);
ui->menuGame_List_Icons->setIcon(icon);
icon = recolorIcon(ui->playButton->icon(), isWhite);
ui->playButton->setIcon(icon);
icon = recolorIcon(ui->pauseButton->icon(), isWhite);
ui->pauseButton->setIcon(icon);
icon = recolorIcon(ui->stopButton->icon(), isWhite);
ui->stopButton->setIcon(icon);
icon = recolorIcon(ui->settingsButton->icon(), isWhite);
ui->settingsButton->setIcon(icon);
icon = recolorIcon(ui->controllerButton->icon(), isWhite);
ui->controllerButton->setIcon(icon);
icon = recolorIcon(ui->refreshGameListAct->icon(), isWhite);
ui->refreshGameListAct->setIcon(icon);
icon = recolorIcon(ui->menuGame_List_Mode->icon(), isWhite);
ui->menuGame_List_Mode->setIcon(icon);
}

View File

@ -37,10 +37,15 @@ private Q_SLOTS:
void SaveWindowState() const;
private:
void AddUiWidgets();
void CreateActions();
void CreateDockWindows();
void CreateConnects();
void SetLastUsedTheme();
void SetUiIcons(bool isWhite);
QIcon recolorIcon(const QIcon& icon, bool isWhite);
bool isIconBlack = false;
QActionGroup* m_icon_size_act_group = nullptr;
QActionGroup* m_list_mode_act_group = nullptr;

View File

@ -47,6 +47,13 @@ public:
QAction* setThemeViolet;
QWidget* centralWidget;
QLineEdit* mw_searchbar;
QPushButton* playButton;
QPushButton* pauseButton;
QPushButton* stopButton;
QPushButton* settingsButton;
QPushButton* controllerButton;
QWidget* emuRunWidget;
QHBoxLayout* emuRunLayer;
QWidget* sizeSliderContainer;
QHBoxLayout* sizeSliderContainer_layout;
@ -77,13 +84,16 @@ public:
QMainWindow::AnimatedDocks | QMainWindow::GroupedDragging);
bootInstallPkgAct = new QAction(MainWindow);
bootInstallPkgAct->setObjectName("bootInstallPkgAct");
bootInstallPkgAct->setIcon(QIcon(":images/file_icon.png"));
exitAct = new QAction(MainWindow);
exitAct->setObjectName("exitAct");
exitAct->setIcon(QIcon(":images/exit_icon.png"));
showGameListAct = new QAction(MainWindow);
showGameListAct->setObjectName("showGameListAct");
showGameListAct->setCheckable(true);
refreshGameListAct = new QAction(MainWindow);
refreshGameListAct->setObjectName("refreshGameListAct");
refreshGameListAct->setIcon(QIcon(":/images/refresh_icon.png"));
setIconSizeTinyAct = new QAction(MainWindow);
setIconSizeTinyAct->setObjectName("setIconSizeTinyAct");
setIconSizeTinyAct->setCheckable(true);
@ -101,11 +111,14 @@ public:
setlistModeListAct->setObjectName("setlistModeListAct");
setlistModeListAct->setCheckable(true);
setlistModeListAct->setChecked(true);
setlistModeListAct->setIcon(QIcon(":images/list_icon.png"));
setlistModeGridAct = new QAction(MainWindow);
setlistModeGridAct->setObjectName("setlistModeGridAct");
setlistModeGridAct->setCheckable(true);
setlistModeGridAct->setIcon(QIcon(":images/grid_icon.png"));
gameInstallPathAct = new QAction(MainWindow);
gameInstallPathAct->setObjectName("gameInstallPathAct");
gameInstallPathAct->setIcon(QIcon(":images/folder_icon.png"));
setThemeLight = new QAction(MainWindow);
setThemeLight->setObjectName("setThemeLight");
setThemeLight->setCheckable(true);
@ -128,9 +141,7 @@ public:
centralWidget->setSizePolicy(sizePolicy);
mw_searchbar = new QLineEdit(centralWidget);
mw_searchbar->setObjectName("mw_searchbar");
mw_searchbar->setGeometry(QRect(480, 10, 150, 31));
sizePolicy.setHeightForWidth(mw_searchbar->sizePolicy().hasHeightForWidth());
mw_searchbar->setSizePolicy(sizePolicy);
mw_searchbar->setGeometry(QRect(250, 10, 130, 31));
mw_searchbar->setMaximumWidth(250);
QFont font;
font.setPointSize(10);
@ -140,6 +151,27 @@ public:
mw_searchbar->setFrame(false);
mw_searchbar->setClearButtonEnabled(false);
playButton = new QPushButton(centralWidget);
playButton->setFlat(true);
playButton->setIcon(QIcon(":images/play_icon.png"));
playButton->setIconSize(QSize(40, 40));
pauseButton = new QPushButton(centralWidget);
pauseButton->setFlat(true);
pauseButton->setIcon(QIcon(":images/pause_icon.png"));
pauseButton->setIconSize(QSize(40, 40));
stopButton = new QPushButton(centralWidget);
stopButton->setFlat(true);
stopButton->setIcon(QIcon(":images/stop_icon.png"));
stopButton->setIconSize(QSize(40, 40));
settingsButton = new QPushButton(centralWidget);
settingsButton->setFlat(true);
settingsButton->setIcon(QIcon(":images/settings_icon.png"));
settingsButton->setIconSize(QSize(40, 40));
controllerButton = new QPushButton(centralWidget);
controllerButton->setFlat(true);
controllerButton->setIcon(QIcon(":images/controller_icon.png"));
controllerButton->setIconSize(QSize(40, 40));
sizeSliderContainer = new QWidget(centralWidget);
sizeSliderContainer->setObjectName("sizeSliderContainer");
sizeSliderContainer->setGeometry(QRect(280, 10, 181, 31));
@ -178,12 +210,15 @@ public:
menuView->setObjectName("menuView");
menuGame_List_Icons = new QMenu(menuView);
menuGame_List_Icons->setObjectName("menuGame_List_Icons");
menuGame_List_Icons->setIcon(QIcon(":images/iconsize_icon.png"));
menuGame_List_Mode = new QMenu(menuView);
menuGame_List_Mode->setObjectName("menuGame_List_Mode");
menuGame_List_Mode->setIcon(QIcon(":images/list_mode_icon.png"));
menuSettings = new QMenu(menuBar);
menuSettings->setObjectName("menuSettings");
menuThemes = new QMenu(menuView);
menuThemes->setObjectName("menuThemes");
menuThemes->setIcon(QIcon(":images/themes_icon.png"));
MainWindow->setMenuBar(menuBar);
toolBar = new QToolBar(MainWindow);
toolBar->setObjectName("toolBar");

18
src/shadps4.qrc Normal file
View File

@ -0,0 +1,18 @@
<RCC>
<qresource prefix="/">
<file>images/play_icon.png</file>
<file>images/pause_icon.png</file>
<file>images/stop_icon.png</file>
<file>images/file_icon.png</file>
<file>images/folder_icon.png</file>
<file>images/themes_icon.png</file>
<file>images/iconsize_icon.png</file>
<file>images/list_icon.png</file>
<file>images/grid_icon.png</file>
<file>images/exit_icon.png</file>
<file>images/settings_icon.png</file>
<file>images/controller_icon.png</file>
<file>images/refresh_icon.png</file>
<file>images/list_mode_icon.png</file>
</qresource>
</RCC>