Icons stuff

This commit is contained in:
Dmugetsu 2025-03-11 16:50:57 -06:00
parent 7aa17d03d9
commit c45cc5b939
9 changed files with 29 additions and 44 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.9 KiB

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 4.4 KiB

View File

@ -153,11 +153,6 @@ void MainWindow::toggleFullscreen() {
event.type = SDL_EVENT_TOGGLE_FULLSCREEN; event.type = SDL_EVENT_TOGGLE_FULLSCREEN;
SDL_PushEvent(&event); SDL_PushEvent(&event);
SDL_Event check_event;
while (SDL_PollEvent(&check_event)) {
SDL_PushEvent(&check_event);
}
} }
void MainWindow::AddUiWidgets() { void MainWindow::AddUiWidgets() {
@ -173,34 +168,28 @@ void MainWindow::AddUiWidgets() {
mainLayout->setSpacing(15); mainLayout->setSpacing(15);
bool showLabels = ui->toggleLabelsAct->isChecked(); bool showLabels = ui->toggleLabelsAct->isChecked();
QPalette palette = qApp->palette();
auto createButtonWithLabel = [&](QPushButton* button, const QString& labelText) { auto createButtonWithLabel = [&](QPushButton* button, const QString& labelText) {
QWidget* container = new QWidget(this); QWidget* container = new QWidget(this);
QVBoxLayout* layout = new QVBoxLayout(container); QVBoxLayout* layout = new QVBoxLayout(container);
layout->setAlignment(Qt::AlignHCenter | Qt::AlignBottom); layout->setAlignment(Qt::AlignHCenter | Qt::AlignBottom);
layout->setContentsMargins(0, 0, 0, 0); layout->setContentsMargins(0, 0, 0, 0);
layout->addWidget(button); layout->addWidget(button);
if (ui->toggleLabelsAct->isChecked()) { if (showLabels) {
QLabel* label = new QLabel(labelText, this); QLabel* label = new QLabel(labelText, this);
label->setAlignment(Qt::AlignCenter); label->setAlignment(Qt::AlignCenter | Qt::AlignBottom);
layout->addWidget(label); layout->addWidget(label);
button->setToolTip("");
} else { } else {
button->setToolTip(labelText);
button->setToolTip(
QString("<span style='color:%1;'><b>%2</b></span>")
.arg(palette().color(QPalette::Window).lightness() > 128 ? "#000" : "#000",
labelText));
} }
container->setLayout(layout); container->setLayout(layout);
return container; return container;
}; };
QWidget* buttonGroup = new QWidget(this);
QHBoxLayout* buttonLayout = new QHBoxLayout(buttonGroup);
auto createLine = [this]() { auto createLine = [this]() {
QFrame* line = new QFrame(this); QFrame* line = new QFrame(this);
line->setFrameShape(QFrame::VLine); line->setFrameShape(QFrame::VLine);
@ -209,22 +198,19 @@ void MainWindow::AddUiWidgets() {
return line; return line;
}; };
QWidget* buttonGroup = new QWidget(this);
QHBoxLayout* buttonLayout = new QHBoxLayout(buttonGroup);
buttonLayout->setContentsMargins(0, 0, 0, 0); buttonLayout->setContentsMargins(0, 0, 0, 0);
buttonLayout->setSpacing(15); buttonLayout->setSpacing(15);
buttonLayout->addWidget(createButtonWithLabel(ui->playButton, tr("Play"))); buttonLayout->addWidget(createButtonWithLabel(ui->playButton, tr("Play")));
buttonLayout->addWidget(createButtonWithLabel(ui->pauseButton, tr("Pause"))); buttonLayout->addWidget(createButtonWithLabel(ui->pauseButton, tr("Pause")));
buttonLayout->addWidget(createButtonWithLabel(ui->stopButton, tr("Stop"))); buttonLayout->addWidget(createButtonWithLabel(ui->stopButton, tr("Stop")));
buttonLayout->addWidget(createLine());
buttonLayout->addWidget(createButtonWithLabel(ui->settingsButton, tr("Settings"))); buttonLayout->addWidget(createButtonWithLabel(ui->settingsButton, tr("Settings")));
buttonLayout->addWidget(createButtonWithLabel(ui->fullscreenButton, tr("Full Screen"))); buttonLayout->addWidget(createButtonWithLabel(ui->fullscreenButton, tr("Full Screen")));
buttonLayout->addWidget(createLine());
buttonLayout->addWidget(createButtonWithLabel(ui->controllerButton, tr("Controllers"))); buttonLayout->addWidget(createButtonWithLabel(ui->controllerButton, tr("Controllers")));
buttonLayout->addWidget(createButtonWithLabel(ui->keyboardButton, tr("Keyboard"))); buttonLayout->addWidget(createButtonWithLabel(ui->keyboardButton, tr("Keyboard")));
buttonLayout->addWidget(createButtonWithLabel(ui->refreshButton, tr("Refresh List"))); buttonLayout->addWidget(createButtonWithLabel(ui->refreshButton, tr("Refresh List")));
buttonLayout->addWidget(createLine());
QWidget* searchSliderContainer = new QWidget(this); QWidget* searchSliderContainer = new QWidget(this);
QHBoxLayout* searchSliderLayout = new QHBoxLayout(searchSliderContainer); QHBoxLayout* searchSliderLayout = new QHBoxLayout(searchSliderContainer);
@ -232,14 +218,12 @@ void MainWindow::AddUiWidgets() {
searchSliderLayout->setSpacing(10); searchSliderLayout->setSpacing(10);
searchSliderLayout->addWidget(ui->sizeSliderContainer); searchSliderLayout->addWidget(ui->sizeSliderContainer);
searchSliderLayout->addWidget(ui->mw_searchbar); searchSliderLayout->addWidget(ui->mw_searchbar);
searchSliderContainer->setLayout(searchSliderLayout); searchSliderContainer->setLayout(searchSliderLayout);
mainLayout->addWidget(buttonGroup); buttonLayout->addWidget(searchSliderContainer);
mainLayout->addWidget(searchSliderContainer);
mainLayout->addWidget(buttonGroup);
toolbarContainer->setLayout(mainLayout); toolbarContainer->setLayout(mainLayout);
ui->toolBar->addWidget(toolbarContainer); ui->toolBar->addWidget(toolbarContainer);
} }

View File

@ -75,7 +75,6 @@ private:
void PlayBackgroundMusic(); void PlayBackgroundMusic();
QIcon RecolorIcon(const QIcon& icon, bool isWhite); QIcon RecolorIcon(const QIcon& icon, bool isWhite);
void StartEmulator(std::filesystem::path); void StartEmulator(std::filesystem::path);
bool is_paused = false;
bool isIconBlack = false; bool isIconBlack = false;
bool isTableList = true; bool isTableList = true;
bool isGameRunning = false; bool isGameRunning = false;

View File

@ -19,7 +19,7 @@ void WindowThemes::SetWindowTheme(Theme theme, QLineEdit* mw_searchbar) {
themePalette.setColor(QPalette::WindowText, Qt::white); themePalette.setColor(QPalette::WindowText, Qt::white);
themePalette.setColor(QPalette::Base, QColor(20, 20, 20)); themePalette.setColor(QPalette::Base, QColor(20, 20, 20));
themePalette.setColor(QPalette::AlternateBase, QColor(53, 53, 53)); themePalette.setColor(QPalette::AlternateBase, QColor(53, 53, 53));
themePalette.setColor(QPalette::ToolTipBase, Qt::white); themePalette.setColor(QPalette::ToolTipBase, QColor(20, 20, 20));
themePalette.setColor(QPalette::ToolTipText, Qt::white); themePalette.setColor(QPalette::ToolTipText, Qt::white);
themePalette.setColor(QPalette::Text, Qt::white); themePalette.setColor(QPalette::Text, Qt::white);
themePalette.setColor(QPalette::Button, QColor(53, 53, 53)); themePalette.setColor(QPalette::Button, QColor(53, 53, 53));
@ -40,8 +40,8 @@ void WindowThemes::SetWindowTheme(Theme theme, QLineEdit* mw_searchbar) {
themePalette.setColor(QPalette::Window, QColor(240, 240, 240)); // Light gray themePalette.setColor(QPalette::Window, QColor(240, 240, 240)); // Light gray
themePalette.setColor(QPalette::WindowText, Qt::black); // Black themePalette.setColor(QPalette::WindowText, Qt::black); // Black
themePalette.setColor(QPalette::Base, QColor(230, 230, 230, 80)); // Grayish themePalette.setColor(QPalette::Base, QColor(230, 230, 230, 80)); // Grayish
themePalette.setColor(QPalette::ToolTipBase, Qt::white); // Black themePalette.setColor(QPalette::ToolTipBase, QColor(230, 230, 230, 80)); // Grayish
themePalette.setColor(QPalette::ToolTipText, Qt::black); // Black themePalette.setColor(QPalette::ToolTipText, Qt::black); // Black
themePalette.setColor(QPalette::Text, Qt::black); // Black themePalette.setColor(QPalette::Text, Qt::black); // Black
themePalette.setColor(QPalette::Button, QColor(240, 240, 240)); // Light gray themePalette.setColor(QPalette::Button, QColor(240, 240, 240)); // Light gray
themePalette.setColor(QPalette::ButtonText, Qt::black); // Black themePalette.setColor(QPalette::ButtonText, Qt::black); // Black
@ -63,7 +63,8 @@ void WindowThemes::SetWindowTheme(Theme theme, QLineEdit* mw_searchbar) {
themePalette.setColor(QPalette::Base, QColor(25, 40, 25)); // Darker green base themePalette.setColor(QPalette::Base, QColor(25, 40, 25)); // Darker green base
themePalette.setColor(QPalette::AlternateBase, themePalette.setColor(QPalette::AlternateBase,
QColor(53, 69, 53)); // Dark green alternate base QColor(53, 69, 53)); // Dark green alternate base
themePalette.setColor(QPalette::ToolTipBase, Qt::white); // White tooltip background themePalette.setColor(QPalette::ToolTipBase,
QColor(25, 40, 25)); // White tooltip background
themePalette.setColor(QPalette::ToolTipText, Qt::white); // White tooltip text themePalette.setColor(QPalette::ToolTipText, Qt::white); // White tooltip text
themePalette.setColor(QPalette::Text, Qt::white); // White text themePalette.setColor(QPalette::Text, Qt::white); // White text
themePalette.setColor(QPalette::Button, QColor(53, 69, 53)); // Dark green button themePalette.setColor(QPalette::Button, QColor(53, 69, 53)); // Dark green button
@ -86,7 +87,8 @@ void WindowThemes::SetWindowTheme(Theme theme, QLineEdit* mw_searchbar) {
themePalette.setColor(QPalette::Base, QColor(20, 40, 60)); // Darker blue base themePalette.setColor(QPalette::Base, QColor(20, 40, 60)); // Darker blue base
themePalette.setColor(QPalette::AlternateBase, themePalette.setColor(QPalette::AlternateBase,
QColor(40, 60, 90)); // Dark blue alternate base QColor(40, 60, 90)); // Dark blue alternate base
themePalette.setColor(QPalette::ToolTipBase, Qt::white); // White tooltip background themePalette.setColor(QPalette::ToolTipBase,
QColor(20, 40, 60)); // White tooltip background
themePalette.setColor(QPalette::ToolTipText, Qt::white); // White tooltip text themePalette.setColor(QPalette::ToolTipText, Qt::white); // White tooltip text
themePalette.setColor(QPalette::Text, Qt::white); // White text themePalette.setColor(QPalette::Text, Qt::white); // White text
themePalette.setColor(QPalette::Button, QColor(40, 60, 90)); // Dark blue button themePalette.setColor(QPalette::Button, QColor(40, 60, 90)); // Dark blue button
@ -110,7 +112,8 @@ void WindowThemes::SetWindowTheme(Theme theme, QLineEdit* mw_searchbar) {
themePalette.setColor(QPalette::Base, QColor(80, 30, 90)); // Darker violet base themePalette.setColor(QPalette::Base, QColor(80, 30, 90)); // Darker violet base
themePalette.setColor(QPalette::AlternateBase, themePalette.setColor(QPalette::AlternateBase,
QColor(100, 50, 120)); // Violet alternate base QColor(100, 50, 120)); // Violet alternate base
themePalette.setColor(QPalette::ToolTipBase, Qt::white); // White tooltip background themePalette.setColor(QPalette::ToolTipBase,
QColor(80, 30, 90)); // White tooltip background
themePalette.setColor(QPalette::ToolTipText, Qt::white); // White tooltip text themePalette.setColor(QPalette::ToolTipText, Qt::white); // White tooltip text
themePalette.setColor(QPalette::Text, Qt::white); // White text themePalette.setColor(QPalette::Text, Qt::white); // White text
themePalette.setColor(QPalette::Button, QColor(100, 50, 120)); // Violet button themePalette.setColor(QPalette::Button, QColor(100, 50, 120)); // Violet button
@ -133,7 +136,7 @@ void WindowThemes::SetWindowTheme(Theme theme, QLineEdit* mw_searchbar) {
themePalette.setColor(QPalette::WindowText, QColor(249, 245, 215)); themePalette.setColor(QPalette::WindowText, QColor(249, 245, 215));
themePalette.setColor(QPalette::Base, QColor(29, 32, 33)); themePalette.setColor(QPalette::Base, QColor(29, 32, 33));
themePalette.setColor(QPalette::AlternateBase, QColor(50, 48, 47)); themePalette.setColor(QPalette::AlternateBase, QColor(50, 48, 47));
themePalette.setColor(QPalette::ToolTipBase, QColor(249, 245, 215)); themePalette.setColor(QPalette::ToolTipBase, QColor(29, 32, 33));
themePalette.setColor(QPalette::ToolTipText, QColor(249, 245, 215)); themePalette.setColor(QPalette::ToolTipText, QColor(249, 245, 215));
themePalette.setColor(QPalette::Text, QColor(249, 245, 215)); themePalette.setColor(QPalette::Text, QColor(249, 245, 215));
themePalette.setColor(QPalette::Button, QColor(40, 40, 40)); themePalette.setColor(QPalette::Button, QColor(40, 40, 40));
@ -155,7 +158,7 @@ void WindowThemes::SetWindowTheme(Theme theme, QLineEdit* mw_searchbar) {
themePalette.setColor(QPalette::WindowText, QColor(192, 202, 245)); themePalette.setColor(QPalette::WindowText, QColor(192, 202, 245));
themePalette.setColor(QPalette::Base, QColor(25, 28, 39)); themePalette.setColor(QPalette::Base, QColor(25, 28, 39));
themePalette.setColor(QPalette::AlternateBase, QColor(36, 40, 59)); themePalette.setColor(QPalette::AlternateBase, QColor(36, 40, 59));
themePalette.setColor(QPalette::ToolTipBase, QColor(192, 202, 245)); themePalette.setColor(QPalette::ToolTipBase, QColor(25, 28, 39));
themePalette.setColor(QPalette::ToolTipText, QColor(192, 202, 245)); themePalette.setColor(QPalette::ToolTipText, QColor(192, 202, 245));
themePalette.setColor(QPalette::Text, QColor(192, 202, 245)); themePalette.setColor(QPalette::Text, QColor(192, 202, 245));
themePalette.setColor(QPalette::Button, QColor(30, 30, 41)); themePalette.setColor(QPalette::Button, QColor(30, 30, 41));
@ -173,7 +176,7 @@ void WindowThemes::SetWindowTheme(Theme theme, QLineEdit* mw_searchbar) {
themePalette.setColor(QPalette::WindowText, Qt::white); themePalette.setColor(QPalette::WindowText, Qt::white);
themePalette.setColor(QPalette::Base, Qt::black); themePalette.setColor(QPalette::Base, Qt::black);
themePalette.setColor(QPalette::AlternateBase, Qt::black); themePalette.setColor(QPalette::AlternateBase, Qt::black);
themePalette.setColor(QPalette::ToolTipBase, Qt::white); themePalette.setColor(QPalette::ToolTipBase, Qt::black);
themePalette.setColor(QPalette::ToolTipText, Qt::white); themePalette.setColor(QPalette::ToolTipText, Qt::white);
themePalette.setColor(QPalette::Text, Qt::white); themePalette.setColor(QPalette::Text, Qt::white);
themePalette.setColor(QPalette::Button, QColor(5, 5, 5)); themePalette.setColor(QPalette::Button, QColor(5, 5, 5));

View File

@ -229,15 +229,15 @@ public:
settingsButton = new QPushButton(centralWidget); settingsButton = new QPushButton(centralWidget);
settingsButton->setFlat(true); settingsButton->setFlat(true);
settingsButton->setIcon(QIcon(":images/settings_icon.png")); settingsButton->setIcon(QIcon(":images/settings_icon.png"));
settingsButton->setIconSize(QSize(42, 42)); settingsButton->setIconSize(QSize(40, 40));
controllerButton = new QPushButton(centralWidget); controllerButton = new QPushButton(centralWidget);
controllerButton->setFlat(true); controllerButton->setFlat(true);
controllerButton->setIcon(QIcon(":images/controller_icon.png")); controllerButton->setIcon(QIcon(":images/controller_icon.png"));
controllerButton->setIconSize(QSize(40, 40)); controllerButton->setIconSize(QSize(55, 48));
keyboardButton = new QPushButton(centralWidget); keyboardButton = new QPushButton(centralWidget);
keyboardButton->setFlat(true); keyboardButton->setFlat(true);
keyboardButton->setIcon(QIcon(":images/keyboard_icon.png")); keyboardButton->setIcon(QIcon(":images/keyboard_icon.png"));
keyboardButton->setIconSize(QSize(48, 44)); keyboardButton->setIconSize(QSize(50, 50));
sizeSliderContainer = new QWidget(centralWidget); sizeSliderContainer = new QWidget(centralWidget);
sizeSliderContainer->setObjectName("sizeSliderContainer"); sizeSliderContainer->setObjectName("sizeSliderContainer");

View File

@ -404,13 +404,13 @@ void WindowSDL::WaitEvent() {
} }
case SDL_EVENT_TOGGLE_PAUSE: case SDL_EVENT_TOGGLE_PAUSE:
SDL_Log("Received SDL_EVENT_TOGGLE_PAUSE"); SDL_Log("Received SDL_EVENT_TOGGLE_PAUSE");
is_paused = !is_paused;
if (is_paused) { if (DebugState.IsGuestThreadsPaused()) {
SDL_Log("Game Paused");
DebugState.PauseGuestThreads();
} else {
SDL_Log("Game Resumed"); SDL_Log("Game Resumed");
DebugState.ResumeGuestThreads(); DebugState.ResumeGuestThreads();
} else {
SDL_Log("Game Paused");
DebugState.PauseGuestThreads();
} }
break; break;
} }

View File

@ -108,7 +108,6 @@ private:
SDL_Window* window{}; SDL_Window* window{};
bool is_shown{}; bool is_shown{};
bool is_open{true}; bool is_open{true};
bool is_paused = false;
}; };
} // namespace Frontend } // namespace Frontend