New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GUI: Add more dialogs to dialog dumper #5433
Conversation
WalkthroughWalkthroughThe changes involve the removal of a function call in the main application code and the expansion of GUI-related functionality in a specific module. The Changes
TipsChat with CodeRabbit Bot (
|
gui/dump-all-dialogs.cpp
Outdated
void handleSimpleDialog(GUI::Dialog &dialog, const Common::String &filename,Graphics::Surface &surf) { | ||
dialog.open(); // For rendering | ||
dialog.reflowLayout(); // For updating surface | ||
g_gui.redrawFull(); | ||
g_system->grabOverlay(surf); | ||
saveGUISnapshot(surf, filename); | ||
dialog.close(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The handleSimpleDialog
function is a good abstraction that simplifies the process of taking snapshots of dialogs. However, ensure that the surf
parameter is always in a valid state before passing it to saveGUISnapshot
. It might be beneficial to check if surf
is successfully created before using it.
gui/dump-all-dialogs.cpp
Outdated
|
||
// MassAddDialog | ||
GUI::MassAddDialog massAddDialog(Common::FSNode(".")); | ||
handleSimpleDialog(massAddDialog, "massAddDialog-" + filename, surf); | ||
|
||
// LauncherDialog | ||
#if 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The LauncherDialog
code is commented out with a preprocessor directive #if 0
. If this code is no longer needed, it should be removed to avoid confusion. If it's being temporarily disabled for a specific reason, add a comment explaining why.
gui/dump-all-dialogs.cpp
Outdated
|
||
Common::String filename = Common::String::format("%d-%s.png", res, lang.c_str()); | ||
|
||
// Skipping Tooltips as not required | ||
|
||
// MessageDialog | ||
GUI::MessageDialog messageDialog(message); | ||
messageDialog.open(); // For rendering | ||
messageDialog.reflowLayout(); // For updating surface | ||
g_gui.redrawFull(); | ||
g_system->grabOverlay(surf); | ||
saveGUISnapshot(surf, "message-" + filename); | ||
messageDialog.close(); | ||
handleSimpleDialog(messageDialog, "messageDialog-" + filename, surf); | ||
|
||
// AboutDialog | ||
GUI::AboutDialog aboutDialog; | ||
aboutDialog.open(); // For rendering | ||
aboutDialog.reflowLayout(); // For updating surface | ||
g_gui.redrawFull(); | ||
g_system->grabOverlay(surf); | ||
saveGUISnapshot(surf, "about-" + filename); | ||
aboutDialog.close(); | ||
handleSimpleDialog(aboutDialog, "aboutDialog-" + filename, surf); | ||
|
||
// CloudConnectingWizard | ||
GUI::CloudConnectionWizard cloudConnectingWizard; | ||
handleSimpleDialog(cloudConnectingWizard, "cloudConnectingWizard-" + filename, surf); | ||
|
||
// FluidSynthSettingsDialog | ||
GUI::FluidSynthSettingsDialog fluidSynthSettingsDialog; | ||
handleSimpleDialog(fluidSynthSettingsDialog, "fluidSynthSettings-" + filename, surf); | ||
|
||
// ThemeBrowserDialog | ||
GUI::ThemeBrowser themeBrowser; | ||
handleSimpleDialog(themeBrowser, "themeBrowser" + filename, surf); | ||
|
||
// BrowserDialog | ||
GUI::BrowserDialog browserDialog(_("Select directory with game data"), true); | ||
handleSimpleDialog(browserDialog, "browserDialog-" + filename, surf); | ||
|
||
// RemoteBrowserDialog | ||
GUI::RemoteBrowserDialog remoteBrowserDialog(_("Select directory with game data")); | ||
handleSimpleDialog(remoteBrowserDialog, "remoteBrowserDialog-" + filename, surf); | ||
|
||
// ChooserDialog | ||
GUI::ChooserDialog chooserDialog(_("Pick the game:")); | ||
handleSimpleDialog(chooserDialog, "chooserDialog-" + filename, surf); | ||
|
||
// DownloadIconPacksDialog | ||
GUI::DownloadPacksDialog downloadIconPacksDialog(_("icon packs"), "LIST", "gui-icons*.dat"); | ||
handleSimpleDialog(downloadIconPacksDialog, "downloadIconPacksDialog-" + filename, surf); | ||
|
||
// DownloadShaderPacksDialog | ||
GUI::DownloadPacksDialog downloadShaderPacksDialog(_("shader packs"), "LIST-SHADERS", "shaders*.dat"); | ||
handleSimpleDialog(downloadShaderPacksDialog, "downloadShaderPacksDialog-" + filename, surf); | ||
|
||
// MassAddDialog | ||
GUI::MassAddDialog massAddDialog(Common::FSNode(".")); | ||
handleSimpleDialog(massAddDialog, "massAddDialog-" + filename, surf); | ||
|
||
// LauncherDialog | ||
#if 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The dumpDialogs
function has been updated to handle various new dialogs using the handleSimpleDialog
function. This is a good use of abstraction to reduce code duplication. However, ensure that the surf
object is properly disposed of after use to prevent any memory leaks. Additionally, the concatenation in line 111 is missing a hyphen before the filename, which could lead to incorrect file naming.
- handleSimpleDialog(themeBrowser, "themeBrowser" + filename, surf);
+ handleSimpleDialog(themeBrowser, "themeBrowser-" + filename, surf);
Commitable suggestion
[!IMPORTANT]
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
Common::String filename = Common::String::format("%d-%s.png", res, lang.c_str()); | |
// Skipping Tooltips as not required | |
// MessageDialog | |
GUI::MessageDialog messageDialog(message); | |
messageDialog.open(); // For rendering | |
messageDialog.reflowLayout(); // For updating surface | |
g_gui.redrawFull(); | |
g_system->grabOverlay(surf); | |
saveGUISnapshot(surf, "message-" + filename); | |
messageDialog.close(); | |
handleSimpleDialog(messageDialog, "messageDialog-" + filename, surf); | |
// AboutDialog | |
GUI::AboutDialog aboutDialog; | |
aboutDialog.open(); // For rendering | |
aboutDialog.reflowLayout(); // For updating surface | |
g_gui.redrawFull(); | |
g_system->grabOverlay(surf); | |
saveGUISnapshot(surf, "about-" + filename); | |
aboutDialog.close(); | |
handleSimpleDialog(aboutDialog, "aboutDialog-" + filename, surf); | |
// CloudConnectingWizard | |
GUI::CloudConnectionWizard cloudConnectingWizard; | |
handleSimpleDialog(cloudConnectingWizard, "cloudConnectingWizard-" + filename, surf); | |
// FluidSynthSettingsDialog | |
GUI::FluidSynthSettingsDialog fluidSynthSettingsDialog; | |
handleSimpleDialog(fluidSynthSettingsDialog, "fluidSynthSettings-" + filename, surf); | |
// ThemeBrowserDialog | |
GUI::ThemeBrowser themeBrowser; | |
handleSimpleDialog(themeBrowser, "themeBrowser" + filename, surf); | |
// BrowserDialog | |
GUI::BrowserDialog browserDialog(_("Select directory with game data"), true); | |
handleSimpleDialog(browserDialog, "browserDialog-" + filename, surf); | |
// RemoteBrowserDialog | |
GUI::RemoteBrowserDialog remoteBrowserDialog(_("Select directory with game data")); | |
handleSimpleDialog(remoteBrowserDialog, "remoteBrowserDialog-" + filename, surf); | |
// ChooserDialog | |
GUI::ChooserDialog chooserDialog(_("Pick the game:")); | |
handleSimpleDialog(chooserDialog, "chooserDialog-" + filename, surf); | |
// DownloadIconPacksDialog | |
GUI::DownloadPacksDialog downloadIconPacksDialog(_("icon packs"), "LIST", "gui-icons*.dat"); | |
handleSimpleDialog(downloadIconPacksDialog, "downloadIconPacksDialog-" + filename, surf); | |
// DownloadShaderPacksDialog | |
GUI::DownloadPacksDialog downloadShaderPacksDialog(_("shader packs"), "LIST-SHADERS", "shaders*.dat"); | |
handleSimpleDialog(downloadShaderPacksDialog, "downloadShaderPacksDialog-" + filename, surf); | |
// MassAddDialog | |
GUI::MassAddDialog massAddDialog(Common::FSNode(".")); | |
handleSimpleDialog(massAddDialog, "massAddDialog-" + filename, surf); | |
// LauncherDialog | |
#if 0 | |
Common::String filename = Common::String::format("%d-%s.png", res, lang.c_str()); | |
// Skipping Tooltips as not required | |
// MessageDialog | |
GUI::MessageDialog messageDialog(message); | |
handleSimpleDialog(messageDialog, "messageDialog-" + filename, surf); | |
// AboutDialog | |
GUI::AboutDialog aboutDialog; | |
handleSimpleDialog(aboutDialog, "aboutDialog-" + filename, surf); | |
// CloudConnectingWizard | |
GUI::CloudConnectionWizard cloudConnectingWizard; | |
handleSimpleDialog(cloudConnectingWizard, "cloudConnectingWizard-" + filename, surf); | |
// FluidSynthSettingsDialog | |
GUI::FluidSynthSettingsDialog fluidSynthSettingsDialog; | |
handleSimpleDialog(fluidSynthSettingsDialog, "fluidSynthSettings-" + filename, surf); | |
// ThemeBrowserDialog | |
GUI::ThemeBrowser themeBrowser; | |
handleSimpleDialog(themeBrowser, "themeBrowser-" + filename, surf); | |
// BrowserDialog | |
GUI::BrowserDialog browserDialog(_("Select directory with game data"), true); | |
handleSimpleDialog(browserDialog, "browserDialog-" + filename, surf); | |
// RemoteBrowserDialog | |
GUI::RemoteBrowserDialog remoteBrowserDialog(_("Select directory with game data")); | |
handleSimpleDialog(remoteBrowserDialog, "remoteBrowserDialog-" + filename, surf); | |
// ChooserDialog | |
GUI::ChooserDialog chooserDialog(_("Pick the game:")); | |
handleSimpleDialog(chooserDialog, "chooserDialog-" + filename, surf); | |
// DownloadIconPacksDialog | |
GUI::DownloadPacksDialog downloadIconPacksDialog(_("icon packs"), "LIST", "gui-icons*.dat"); | |
handleSimpleDialog(downloadIconPacksDialog, "downloadIconPacksDialog-" + filename, surf); | |
// DownloadShaderPacksDialog | |
GUI::DownloadPacksDialog downloadShaderPacksDialog(_("shader packs"), "LIST-SHADERS", "shaders*.dat"); | |
handleSimpleDialog(downloadShaderPacksDialog, "downloadShaderPacksDialog-" + filename, surf); | |
// MassAddDialog | |
GUI::MassAddDialog massAddDialog(Common::FSNode(".")); | |
handleSimpleDialog(massAddDialog, "massAddDialog-" + filename, surf); | |
// LauncherDialog | |
#if 0 |
No description provided.