mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-02-04 15:40:02 +00:00
Added AchievementsWindow QDialog
AchievementsWindow is the dialog box that will eventually contain the settings and progress data for RetroAchievements on Dolphin. This adds the barebones dialog, and connects it to MainWindow's MenuBar.
This commit is contained in:
parent
da77084d2f
commit
e1e662b86a
48
Source/Core/DolphinQt/Achievements/AchievementsWindow.cpp
Normal file
48
Source/Core/DolphinQt/Achievements/AchievementsWindow.cpp
Normal file
@ -0,0 +1,48 @@
|
||||
// Copyright 2023 Dolphin Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#ifdef USE_RETRO_ACHIEVEMENTS
|
||||
#include "DolphinQt/Achievements/AchievementsWindow.h"
|
||||
|
||||
#include <QVBoxLayout>
|
||||
#include <QDialogButtonBox>
|
||||
|
||||
#include "DolphinQt/QtUtils/WrapInScrollArea.h"
|
||||
|
||||
AchievementsWindow::AchievementsWindow(QWidget* parent) : QDialog(parent)
|
||||
{
|
||||
setWindowTitle(tr("Achievements"));
|
||||
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
|
||||
|
||||
CreateMainLayout();
|
||||
ConnectWidgets();
|
||||
}
|
||||
|
||||
void AchievementsWindow::showEvent(QShowEvent* event)
|
||||
{
|
||||
QDialog::showEvent(event);
|
||||
update();
|
||||
}
|
||||
|
||||
void AchievementsWindow::CreateMainLayout()
|
||||
{
|
||||
auto* layout = new QVBoxLayout();
|
||||
|
||||
m_button_box = new QDialogButtonBox(QDialogButtonBox::Close);
|
||||
|
||||
layout->addWidget(m_button_box);
|
||||
|
||||
WrapInScrollArea(this, layout);
|
||||
}
|
||||
|
||||
void AchievementsWindow::ConnectWidgets()
|
||||
{
|
||||
connect(m_button_box, &QDialogButtonBox::rejected, this, &QDialog::reject);
|
||||
}
|
||||
|
||||
void AchievementsWindow::UpdateData()
|
||||
{
|
||||
update();
|
||||
}
|
||||
|
||||
#endif // USE_RETRO_ACHIEVEMENTS
|
26
Source/Core/DolphinQt/Achievements/AchievementsWindow.h
Normal file
26
Source/Core/DolphinQt/Achievements/AchievementsWindow.h
Normal file
@ -0,0 +1,26 @@
|
||||
// Copyright 2023 Dolphin Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifdef USE_RETRO_ACHIEVEMENTS
|
||||
#include <QDialog>
|
||||
|
||||
class QDialogButtonBox;
|
||||
|
||||
class AchievementsWindow : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit AchievementsWindow(QWidget* parent);
|
||||
void UpdateData();
|
||||
|
||||
private:
|
||||
void CreateMainLayout();
|
||||
void showEvent(QShowEvent* event);
|
||||
void ConnectWidgets();
|
||||
|
||||
QDialogButtonBox* m_button_box;
|
||||
};
|
||||
|
||||
#endif // USE_RETRO_ACHIEVEMENTS
|
@ -27,6 +27,8 @@ add_executable(dolphin-emu
|
||||
CheatSearchWidget.h
|
||||
CheatsManager.cpp
|
||||
CheatsManager.h
|
||||
Achievements/AchievementsWindow.cpp
|
||||
Achievements/AchievementsWindow.h
|
||||
Config/ARCodeWidget.cpp
|
||||
Config/ARCodeWidget.h
|
||||
Config/CheatCodeEditor.cpp
|
||||
|
@ -50,6 +50,7 @@
|
||||
<ClCompile Include="CheatSearchFactoryWidget.cpp" />
|
||||
<ClCompile Include="CheatSearchWidget.cpp" />
|
||||
<ClCompile Include="CheatsManager.cpp" />
|
||||
<ClCompile Include="Achievements\AchievementsWindow.cpp" />
|
||||
<ClCompile Include="Config\ARCodeWidget.cpp" />
|
||||
<ClCompile Include="Config\CheatCodeEditor.cpp" />
|
||||
<ClCompile Include="Config\CheatWarningWidget.cpp" />
|
||||
@ -252,6 +253,7 @@
|
||||
<QtMoc Include="CheatSearchFactoryWidget.h" />
|
||||
<QtMoc Include="CheatSearchWidget.h" />
|
||||
<QtMoc Include="CheatsManager.h" />
|
||||
<QtMoc Include="Achievements\AchievementsWindow.h" />
|
||||
<QtMoc Include="Config\ARCodeWidget.h" />
|
||||
<QtMoc Include="Config\CheatWarningWidget.h" />
|
||||
<QtMoc Include="Config\CommonControllersWidget.h" />
|
||||
|
@ -72,6 +72,7 @@
|
||||
#include "DiscIO/RiivolutionPatcher.h"
|
||||
|
||||
#include "DolphinQt/AboutDialog.h"
|
||||
#include "DolphinQt/Achievements/AchievementsWindow.h"
|
||||
#include "DolphinQt/CheatsManager.h"
|
||||
#include "DolphinQt/Config/ControllersWindow.h"
|
||||
#include "DolphinQt/Config/FreeLookWindow.h"
|
||||
@ -544,6 +545,10 @@ void MainWindow::ConnectMenuBar()
|
||||
connect(m_menu_bar, &MenuBar::ShowInfinityBase, this, &MainWindow::ShowInfinityBase);
|
||||
connect(m_menu_bar, &MenuBar::ConnectWiiRemote, this, &MainWindow::OnConnectWiiRemote);
|
||||
|
||||
#ifdef USE_RETRO_ACHIEVEMENTS
|
||||
connect(m_menu_bar, &MenuBar::ShowAchievementsWindow, this, &MainWindow::ShowAchievementsWindow);
|
||||
#endif // USE_RETRO_ACHIEVEMENTS
|
||||
|
||||
// Movie
|
||||
connect(m_menu_bar, &MenuBar::PlayRecording, this, &MainWindow::OnPlayRecording);
|
||||
connect(m_menu_bar, &MenuBar::StartRecording, this, &MainWindow::OnStartRecording);
|
||||
@ -1892,6 +1897,20 @@ void MainWindow::OnConnectWiiRemote(int id)
|
||||
});
|
||||
}
|
||||
|
||||
#ifdef USE_RETRO_ACHIEVEMENTS
|
||||
void MainWindow::ShowAchievementsWindow()
|
||||
{
|
||||
if (!m_achievements_window)
|
||||
{
|
||||
m_achievements_window = new AchievementsWindow(this);
|
||||
}
|
||||
|
||||
m_achievements_window->show();
|
||||
m_achievements_window->raise();
|
||||
m_achievements_window->activateWindow();
|
||||
}
|
||||
#endif // USE_RETRO_ACHIEVEMENTS
|
||||
|
||||
void MainWindow::ShowMemcardManager()
|
||||
{
|
||||
GCMemcardManager manager(this);
|
||||
|
@ -16,6 +16,7 @@
|
||||
class QStackedWidget;
|
||||
class QString;
|
||||
|
||||
class AchievementsWindow;
|
||||
class BreakpointWidget;
|
||||
struct BootParameters;
|
||||
class CheatsManager;
|
||||
@ -168,6 +169,10 @@ private:
|
||||
void ShowCheatsManager();
|
||||
void ShowRiivolutionBootWidget(const UICommon::GameFile& game);
|
||||
|
||||
#ifdef USE_RETRO_ACHIEVEMENTS
|
||||
void ShowAchievementsWindow();
|
||||
#endif // USE_RETRO_ACHIEVEMENTS
|
||||
|
||||
void NetPlayInit();
|
||||
bool NetPlayJoin();
|
||||
bool NetPlayHost(const UICommon::GameFile& game);
|
||||
@ -241,6 +246,10 @@ private:
|
||||
static constexpr int num_wii_controllers = 4;
|
||||
std::array<WiiTASInputWindow*, num_wii_controllers> m_wii_tas_input_windows{};
|
||||
|
||||
#ifdef USE_RETRO_ACHIEVEMENTS
|
||||
AchievementsWindow* m_achievements_window = nullptr;
|
||||
#endif // USE_RETRO_ACHIEVEMENTS
|
||||
|
||||
BreakpointWidget* m_breakpoint_widget;
|
||||
CodeWidget* m_code_widget;
|
||||
JITWidget* m_jit_widget;
|
||||
|
@ -21,6 +21,7 @@
|
||||
|
||||
#include "Core/Boot/Boot.h"
|
||||
#include "Core/CommonTitles.h"
|
||||
#include "Core/Config/AchievementSettings.h"
|
||||
#include "Core/Config/MainSettings.h"
|
||||
#include "Core/ConfigManager.h"
|
||||
#include "Core/Core.h"
|
||||
@ -236,6 +237,15 @@ void MenuBar::AddToolsMenu()
|
||||
|
||||
tools_menu->addSeparator();
|
||||
|
||||
#ifdef USE_RETRO_ACHIEVEMENTS
|
||||
if (Config::Get(Config::RA_ENABLED))
|
||||
{
|
||||
tools_menu->addAction(tr("Achievements"), this, [this] { emit ShowAchievementsWindow(); });
|
||||
|
||||
tools_menu->addSeparator();
|
||||
}
|
||||
#endif // USE_RETRO_ACHIEVEMENTS
|
||||
|
||||
QMenu* gc_ipl = tools_menu->addMenu(tr("Load GameCube Main Menu"));
|
||||
|
||||
m_ntscj_ipl = gc_ipl->addAction(tr("NTSC-J"), this,
|
||||
|
@ -93,6 +93,10 @@ signals:
|
||||
void ShowInfinityBase();
|
||||
void ConnectWiiRemote(int id);
|
||||
|
||||
#ifdef USE_RETRO_ACHIEVEMENTS
|
||||
void ShowAchievementsWindow();
|
||||
#endif // USE_RETRO_ACHIEVEMENTS
|
||||
|
||||
// Options
|
||||
void Configure();
|
||||
void ConfigureGraphics();
|
||||
|
Loading…
x
Reference in New Issue
Block a user