mirror of
https://github.com/izzy2lost/dolphin.git
synced 2026-06-19 01:16:48 -07:00
Merge pull request #13651 from jordan-woyak/config-list
DolphinQt: Change Config QTabWidget into a QListWidget and QStackedWidget.
This commit is contained in:
@@ -56,20 +56,21 @@ void AchievementsWindow::CreateMainLayout()
|
||||
m_settings_widget = new AchievementSettingsWidget(m_tab_widget);
|
||||
m_progress_widget = new AchievementProgressWidget(m_tab_widget);
|
||||
m_leaderboard_widget = new AchievementLeaderboardWidget(m_tab_widget);
|
||||
m_tab_widget->addTab(GetWrappedWidget(m_settings_widget, this, 125, 100), tr("Settings"));
|
||||
m_tab_widget->addTab(GetWrappedWidget(m_progress_widget, this, 125, 100), tr("Progress"));
|
||||
m_tab_widget->setTabVisible(1, is_game_loaded);
|
||||
m_tab_widget->addTab(GetWrappedWidget(m_leaderboard_widget, this, 125, 100), tr("Leaderboards"));
|
||||
m_tab_widget->setTabVisible(2, is_game_loaded);
|
||||
m_tab_widget->addTab(GetWrappedWidget(m_settings_widget), tr("Settings"));
|
||||
m_tab_widget->addTab(GetWrappedWidget(m_progress_widget), tr("Progress"));
|
||||
m_tab_widget->addTab(GetWrappedWidget(m_leaderboard_widget), tr("Leaderboards"));
|
||||
|
||||
m_button_box = new QDialogButtonBox(QDialogButtonBox::Close);
|
||||
|
||||
auto* layout = new QVBoxLayout();
|
||||
auto* const layout = new QVBoxLayout{this};
|
||||
layout->addWidget(m_header_widget);
|
||||
layout->addWidget(m_tab_widget);
|
||||
layout->addWidget(m_button_box);
|
||||
|
||||
WrapInScrollArea(this, layout);
|
||||
adjustSize();
|
||||
|
||||
m_tab_widget->setTabVisible(1, is_game_loaded);
|
||||
m_tab_widget->setTabVisible(2, is_game_loaded);
|
||||
}
|
||||
|
||||
void AchievementsWindow::ConnectWidgets()
|
||||
|
||||
@@ -18,14 +18,12 @@
|
||||
|
||||
#include "Common/StringUtil.h"
|
||||
#include "Core/CheatSearch.h"
|
||||
#include "Core/Config/MainSettings.h"
|
||||
#include "Core/Core.h"
|
||||
#include "Core/HW/Memmap.h"
|
||||
#include "Core/PowerPC/MMU.h"
|
||||
#include "Core/System.h"
|
||||
#include "DolphinQt/QtUtils/ModalMessageBox.h"
|
||||
#include "DolphinQt/QtUtils/NonDefaultQPushButton.h"
|
||||
#include "DolphinQt/QtUtils/WrapInScrollArea.h"
|
||||
|
||||
CheatSearchFactoryWidget::CheatSearchFactoryWidget()
|
||||
{
|
||||
@@ -40,7 +38,7 @@ Q_DECLARE_METATYPE(Cheats::DataType);
|
||||
|
||||
void CheatSearchFactoryWidget::CreateWidgets()
|
||||
{
|
||||
auto* layout = new QVBoxLayout();
|
||||
auto* const layout = new QVBoxLayout{this};
|
||||
|
||||
auto* address_space_group = new QGroupBox(tr("Address Space"));
|
||||
auto* address_space_layout = new QVBoxLayout();
|
||||
@@ -124,8 +122,6 @@ void CheatSearchFactoryWidget::CreateWidgets()
|
||||
layout->addWidget(m_new_search);
|
||||
|
||||
layout->addStretch();
|
||||
|
||||
WrapInScrollArea(this, layout);
|
||||
}
|
||||
|
||||
void CheatSearchFactoryWidget::ConnectWidgets()
|
||||
|
||||
@@ -3,8 +3,6 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
#include "Core/CheatSearch.h"
|
||||
|
||||
@@ -249,7 +249,7 @@ void CheatSearchWidget::CreateWidgets()
|
||||
checkboxes_layout->addWidget(m_autoupdate_current_values);
|
||||
checkboxes_layout->setStretchFactor(m_autoupdate_current_values, 2);
|
||||
|
||||
QVBoxLayout* layout = new QVBoxLayout();
|
||||
auto* const layout = new QVBoxLayout{this};
|
||||
layout->addWidget(session_info_label);
|
||||
layout->addWidget(instructions_label);
|
||||
layout->addLayout(value_layout);
|
||||
@@ -258,8 +258,6 @@ void CheatSearchWidget::CreateWidgets()
|
||||
layout->addWidget(m_info_label_1);
|
||||
layout->addWidget(m_info_label_2);
|
||||
layout->addWidget(m_address_table);
|
||||
|
||||
WrapInScrollArea(this, layout);
|
||||
}
|
||||
|
||||
void CheatSearchWidget::ConnectWidgets()
|
||||
|
||||
@@ -5,19 +5,13 @@
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
#include <functional>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
|
||||
#include "Common/CommonTypes.h"
|
||||
#include "Core/ActionReplay.h"
|
||||
#include "Core/CheatSearch.h"
|
||||
|
||||
namespace ActionReplay
|
||||
{
|
||||
struct ARCode;
|
||||
}
|
||||
namespace Core
|
||||
{
|
||||
class System;
|
||||
@@ -57,7 +51,7 @@ public:
|
||||
signals:
|
||||
void ActionReplayCodeGenerated(const ActionReplay::ARCode& ar_code);
|
||||
void RequestWatch(QString name, u32 address);
|
||||
void ShowMemory(const u32 address);
|
||||
void ShowMemory(u32 address);
|
||||
|
||||
private:
|
||||
void CreateWidgets();
|
||||
|
||||
@@ -3,17 +3,15 @@
|
||||
|
||||
#include "DolphinQt/CheatsManager.h"
|
||||
|
||||
#include <functional>
|
||||
|
||||
#include <QDialogButtonBox>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
#include "Core/ActionReplay.h"
|
||||
#include "Core/CheatSearch.h"
|
||||
#include "Core/ConfigManager.h"
|
||||
#include "Core/Core.h"
|
||||
|
||||
#include "UICommon/GameFile.h"
|
||||
#include "DolphinQt/QtUtils/QtUtils.h"
|
||||
#include "DolphinQt/QtUtils/WrapInScrollArea.h"
|
||||
|
||||
#include "DolphinQt/CheatSearchFactoryWidget.h"
|
||||
#include "DolphinQt/CheatSearchWidget.h"
|
||||
@@ -36,6 +34,8 @@ CheatsManager::CheatsManager(Core::System& system, QWidget* parent)
|
||||
CreateWidgets();
|
||||
ConnectWidgets();
|
||||
|
||||
QtUtils::AdjustSizeWithinScreen(this);
|
||||
|
||||
auto& settings = Settings::GetQSettings();
|
||||
restoreGeometry(settings.value(QStringLiteral("cheatsmanager/geometry")).toByteArray());
|
||||
}
|
||||
@@ -124,18 +124,19 @@ void CheatsManager::CreateWidgets()
|
||||
m_tab_widget = new PartiallyClosableTabWidget;
|
||||
m_button_box = new QDialogButtonBox(QDialogButtonBox::Close);
|
||||
|
||||
int tab_index;
|
||||
int tab_index = 0;
|
||||
|
||||
m_ar_code = new ARCodeWidget(m_game_id, m_revision, false);
|
||||
tab_index = m_tab_widget->addTab(m_ar_code, tr("AR Code"));
|
||||
tab_index = m_tab_widget->addTab(GetWrappedWidget(m_ar_code), tr("AR Code"));
|
||||
m_tab_widget->setTabUnclosable(tab_index);
|
||||
|
||||
m_gecko_code = new GeckoCodeWidget(m_game_id, m_game_tdb_id, m_revision, false);
|
||||
tab_index = m_tab_widget->addTab(m_gecko_code, tr("Gecko Codes"));
|
||||
tab_index = m_tab_widget->addTab(GetWrappedWidget(m_gecko_code), tr("Gecko Codes"));
|
||||
m_tab_widget->setTabUnclosable(tab_index);
|
||||
|
||||
m_cheat_search_new = new CheatSearchFactoryWidget();
|
||||
tab_index = m_tab_widget->addTab(m_cheat_search_new, tr("Start New Cheat Search"));
|
||||
tab_index =
|
||||
m_tab_widget->addTab(GetWrappedWidget(m_cheat_search_new), tr("Start New Cheat Search"));
|
||||
m_tab_widget->setTabUnclosable(tab_index);
|
||||
|
||||
auto* layout = new QVBoxLayout;
|
||||
|
||||
@@ -24,9 +24,6 @@
|
||||
#include "DolphinQt/Config/HardcoreWarningWidget.h"
|
||||
#include "DolphinQt/QtUtils/NonDefaultQPushButton.h"
|
||||
#include "DolphinQt/QtUtils/SetWindowDecorations.h"
|
||||
#include "DolphinQt/QtUtils/WrapInScrollArea.h"
|
||||
|
||||
#include "UICommon/GameFile.h"
|
||||
|
||||
ARCodeWidget::ARCodeWidget(std::string game_id, u16 game_revision, bool restart_required)
|
||||
: m_game_id(std::move(game_id)), m_game_revision(game_revision),
|
||||
@@ -77,7 +74,7 @@ void ARCodeWidget::CreateWidgets()
|
||||
button_layout->addWidget(m_code_edit);
|
||||
button_layout->addWidget(m_code_remove);
|
||||
|
||||
QVBoxLayout* layout = new QVBoxLayout;
|
||||
auto* const layout = new QVBoxLayout{this};
|
||||
|
||||
layout->addWidget(m_warning);
|
||||
#ifdef USE_RETRO_ACHIEVEMENTS
|
||||
@@ -85,8 +82,6 @@ void ARCodeWidget::CreateWidgets()
|
||||
#endif // USE_RETRO_ACHIEVEMENTS
|
||||
layout->addWidget(m_code_list);
|
||||
layout->addLayout(button_layout);
|
||||
|
||||
WrapInScrollArea(this, layout);
|
||||
}
|
||||
|
||||
void ARCodeWidget::ConnectWidgets()
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include "DolphinQt/Config/CommonControllersWidget.h"
|
||||
#include "DolphinQt/Config/GamecubeControllersWidget.h"
|
||||
#include "DolphinQt/Config/WiimoteControllersWidget.h"
|
||||
#include "DolphinQt/QtUtils/QtUtils.h"
|
||||
#include "DolphinQt/QtUtils/WrapInScrollArea.h"
|
||||
|
||||
ControllersWindow::ControllersWindow(QWidget* parent) : QDialog(parent)
|
||||
@@ -41,6 +42,7 @@ void ControllersWindow::CreateMainLayout()
|
||||
layout->addWidget(m_button_box);
|
||||
|
||||
WrapInScrollArea(this, layout);
|
||||
QtUtils::AdjustSizeWithinScreen(this);
|
||||
}
|
||||
|
||||
void ControllersWindow::ConnectWidgets()
|
||||
|
||||
@@ -6,12 +6,12 @@
|
||||
#include <QApplication>
|
||||
#include <QCoreApplication>
|
||||
#include <QFileInfo>
|
||||
#include <QGridLayout>
|
||||
#include <QHeaderView>
|
||||
#include <QMenu>
|
||||
#include <QStandardItemModel>
|
||||
#include <QStyleFactory>
|
||||
#include <QTreeView>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
#include <future>
|
||||
|
||||
@@ -55,7 +55,10 @@ FilesystemWidget::~FilesystemWidget() = default;
|
||||
|
||||
void FilesystemWidget::CreateWidgets()
|
||||
{
|
||||
auto* layout = new QVBoxLayout;
|
||||
// Note: At least with KDE Plasma,
|
||||
// QTreeView takes on an ugly square-corner style when alone in a QVBoxLayout.
|
||||
// QGridLayout does not produce this problem.
|
||||
auto* const layout = new QGridLayout{this};
|
||||
|
||||
m_tree_model = new QStandardItemModel(0, 2);
|
||||
m_tree_model->setHorizontalHeaderLabels({tr("Name"), tr("Size")});
|
||||
@@ -78,8 +81,6 @@ void FilesystemWidget::CreateWidgets()
|
||||
#endif
|
||||
|
||||
layout->addWidget(m_tree_view);
|
||||
|
||||
setLayout(layout);
|
||||
}
|
||||
|
||||
void FilesystemWidget::ConnectWidgets()
|
||||
|
||||
@@ -205,14 +205,11 @@ void GameConfigWidget::CreateWidgets()
|
||||
|
||||
auto* gfx_tabs = new QTabWidget;
|
||||
|
||||
gfx_tabs->addTab(GetWrappedWidget(new GeneralWidget(this, m_layer.get()), this, 125, 100),
|
||||
tr("General"));
|
||||
gfx_tabs->addTab(GetWrappedWidget(new EnhancementsWidget(this, m_layer.get()), this, 125, 100),
|
||||
gfx_tabs->addTab(GetWrappedWidget(new GeneralWidget(this, m_layer.get())), tr("General"));
|
||||
gfx_tabs->addTab(GetWrappedWidget(new EnhancementsWidget(this, m_layer.get())),
|
||||
tr("Enhancements"));
|
||||
gfx_tabs->addTab(GetWrappedWidget(new HacksWidget(this, m_layer.get()), this, 125, 100),
|
||||
tr("Hacks"));
|
||||
gfx_tabs->addTab(GetWrappedWidget(new AdvancedWidget(this, m_layer.get()), this, 125, 100),
|
||||
tr("Advanced"));
|
||||
gfx_tabs->addTab(GetWrappedWidget(new HacksWidget(this, m_layer.get())), tr("Hacks"));
|
||||
gfx_tabs->addTab(GetWrappedWidget(new AdvancedWidget(this, m_layer.get())), tr("Advanced"));
|
||||
const int editor_index = tab_widget->addTab(advanced_widget, tr("Editor"));
|
||||
gfx_layout->addWidget(gfx_tabs);
|
||||
|
||||
|
||||
@@ -29,11 +29,10 @@
|
||||
#include "DolphinQt/Config/HardcoreWarningWidget.h"
|
||||
#include "DolphinQt/QtUtils/ModalMessageBox.h"
|
||||
#include "DolphinQt/QtUtils/NonDefaultQPushButton.h"
|
||||
#include "DolphinQt/QtUtils/QtUtils.h"
|
||||
#include "DolphinQt/QtUtils/SetWindowDecorations.h"
|
||||
#include "DolphinQt/QtUtils/WrapInScrollArea.h"
|
||||
|
||||
#include "UICommon/GameFile.h"
|
||||
|
||||
GeckoCodeWidget::GeckoCodeWidget(std::string game_id, std::string gametdb_id, u16 game_revision,
|
||||
bool restart_required)
|
||||
: m_game_id(std::move(game_id)), m_gametdb_id(std::move(gametdb_id)),
|
||||
@@ -76,7 +75,7 @@ void GeckoCodeWidget::CreateWidgets()
|
||||
#ifdef USE_RETRO_ACHIEVEMENTS
|
||||
m_hc_warning = new HardcoreWarningWidget(this);
|
||||
#endif // USE_RETRO_ACHIEVEMENTS
|
||||
m_code_list = new QListWidget;
|
||||
m_code_list = new QtUtils::MinimumSizeHintWidget<QListWidget>;
|
||||
m_name_label = new QLabel;
|
||||
m_creator_label = new QLabel;
|
||||
|
||||
@@ -105,7 +104,7 @@ void GeckoCodeWidget::CreateWidgets()
|
||||
|
||||
m_download_codes->setToolTip(tr("Download Codes from the WiiRD Database"));
|
||||
|
||||
auto* layout = new QVBoxLayout;
|
||||
auto* const layout = new QVBoxLayout{this};
|
||||
|
||||
layout->addWidget(m_warning);
|
||||
#ifdef USE_RETRO_ACHIEVEMENTS
|
||||
@@ -139,8 +138,6 @@ void GeckoCodeWidget::CreateWidgets()
|
||||
btn_layout->addWidget(m_download_codes);
|
||||
|
||||
layout->addLayout(btn_layout);
|
||||
|
||||
WrapInScrollArea(this, layout);
|
||||
}
|
||||
|
||||
void GeckoCodeWidget::ConnectWidgets()
|
||||
|
||||
@@ -156,8 +156,8 @@ void ColorCorrectionConfigWindow::Create()
|
||||
layout->addStretch();
|
||||
layout->addWidget(m_button_box);
|
||||
|
||||
setLayout(layout);
|
||||
WrapInScrollArea(this, layout);
|
||||
adjustSize();
|
||||
}
|
||||
|
||||
void ColorCorrectionConfigWindow::ConnectWidgets()
|
||||
|
||||
@@ -12,17 +12,16 @@
|
||||
|
||||
#include "Common/Config/Config.h"
|
||||
#include "Core/Config/MainSettings.h"
|
||||
#include "Core/ConfigManager.h"
|
||||
|
||||
#include "DolphinQt/Config/Graphics/AdvancedWidget.h"
|
||||
#include "DolphinQt/Config/Graphics/EnhancementsWidget.h"
|
||||
#include "DolphinQt/Config/Graphics/GeneralWidget.h"
|
||||
#include "DolphinQt/Config/Graphics/HacksWidget.h"
|
||||
#include "DolphinQt/MainWindow.h"
|
||||
#include "DolphinQt/QtUtils/QtUtils.h"
|
||||
#include "DolphinQt/QtUtils/WrapInScrollArea.h"
|
||||
|
||||
#include "VideoCommon/VideoBackendBase.h"
|
||||
#include "VideoCommon/VideoConfig.h"
|
||||
|
||||
GraphicsWindow::GraphicsWindow(MainWindow* parent) : QDialog(parent), m_main_window(parent)
|
||||
{
|
||||
@@ -32,6 +31,8 @@ GraphicsWindow::GraphicsWindow(MainWindow* parent) : QDialog(parent), m_main_win
|
||||
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
|
||||
|
||||
OnBackendChanged(QString::fromStdString(Config::Get(Config::MAIN_GFX_BACKEND)));
|
||||
|
||||
QtUtils::AdjustSizeWithinScreen(this);
|
||||
}
|
||||
|
||||
void GraphicsWindow::CreateMainLayout()
|
||||
@@ -52,10 +53,10 @@ void GraphicsWindow::CreateMainLayout()
|
||||
|
||||
connect(general_widget, &GeneralWidget::BackendChanged, this, &GraphicsWindow::OnBackendChanged);
|
||||
|
||||
QWidget* const wrapped_general = GetWrappedWidget(general_widget, this, 50, 100);
|
||||
QWidget* const wrapped_enhancements = GetWrappedWidget(enhancements_widget, this, 50, 100);
|
||||
QWidget* const wrapped_hacks = GetWrappedWidget(hacks_widget, this, 50, 100);
|
||||
QWidget* const wrapped_advanced = GetWrappedWidget(advanced_widget, this, 50, 100);
|
||||
QWidget* const wrapped_general = GetWrappedWidget(general_widget);
|
||||
QWidget* const wrapped_enhancements = GetWrappedWidget(enhancements_widget);
|
||||
QWidget* const wrapped_hacks = GetWrappedWidget(hacks_widget);
|
||||
QWidget* const wrapped_advanced = GetWrappedWidget(advanced_widget);
|
||||
|
||||
tab_widget->addTab(wrapped_general, tr("General"));
|
||||
tab_widget->addTab(wrapped_enhancements, tr("Enhancements"));
|
||||
|
||||
@@ -37,6 +37,8 @@ InfoWidget::InfoWidget(const UICommon::GameFile& game) : m_game(game)
|
||||
if (!game.GetLanguages().empty())
|
||||
layout->addWidget(CreateBannerDetails());
|
||||
|
||||
layout->addStretch(1);
|
||||
|
||||
setLayout(layout);
|
||||
}
|
||||
|
||||
|
||||
@@ -50,6 +50,7 @@
|
||||
#include "DolphinQt/Config/Mapping/WiimoteEmuMotionControlIMU.h"
|
||||
#include "DolphinQt/QtUtils/ModalMessageBox.h"
|
||||
#include "DolphinQt/QtUtils/NonDefaultQPushButton.h"
|
||||
#include "DolphinQt/QtUtils/QtUtils.h"
|
||||
#include "DolphinQt/QtUtils/SetWindowDecorations.h"
|
||||
#include "DolphinQt/QtUtils/WindowActivationEventFilter.h"
|
||||
#include "DolphinQt/QtUtils/WrapInScrollArea.h"
|
||||
@@ -96,6 +97,8 @@ MappingWindow::MappingWindow(QWidget* parent, Type type, int port_num)
|
||||
[] { HotkeyManagerEmu::Enable(false); });
|
||||
|
||||
MappingCommon::CreateMappingProcessor(this);
|
||||
|
||||
QtUtils::AdjustSizeWithinScreen(this);
|
||||
}
|
||||
|
||||
void MappingWindow::CreateDevicesLayout()
|
||||
@@ -543,7 +546,7 @@ void MappingWindow::PopulateProfileSelection()
|
||||
|
||||
QWidget* MappingWindow::AddWidget(const QString& name, QWidget* widget)
|
||||
{
|
||||
QWidget* wrapper = GetWrappedWidget(widget, this, 150, 210);
|
||||
auto* const wrapper = GetWrappedWidget(widget);
|
||||
m_tab_widget->addTab(wrapper, name);
|
||||
return wrapper;
|
||||
}
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
|
||||
#include <QDialogButtonBox>
|
||||
#include <QPushButton>
|
||||
#include <QTabWidget>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
#include "DiscIO/Enums.h"
|
||||
@@ -24,28 +23,22 @@
|
||||
#include "DolphinQt/QtUtils/WrapInScrollArea.h"
|
||||
|
||||
#include "UICommon/GameFile.h"
|
||||
#include "VideoCommon/VideoConfig.h"
|
||||
|
||||
PropertiesDialog::PropertiesDialog(QWidget* parent, const UICommon::GameFile& game)
|
||||
: QDialog(parent)
|
||||
: StackedSettingsWindow{parent}
|
||||
{
|
||||
setWindowTitle(QStringLiteral("%1: %2 - %3")
|
||||
.arg(QString::fromStdString(game.GetFileName()),
|
||||
QString::fromStdString(game.GetGameID()),
|
||||
QString::fromStdString(game.GetLongName())));
|
||||
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
|
||||
|
||||
QVBoxLayout* layout = new QVBoxLayout();
|
||||
|
||||
QTabWidget* tab_widget = new QTabWidget(this);
|
||||
InfoWidget* info = new InfoWidget(game);
|
||||
|
||||
ARCodeWidget* ar = new ARCodeWidget(game.GetGameID(), game.GetRevision());
|
||||
GeckoCodeWidget* gecko =
|
||||
auto* const info = new InfoWidget(game);
|
||||
auto* const ar = new ARCodeWidget(game.GetGameID(), game.GetRevision());
|
||||
auto* const gecko =
|
||||
new GeckoCodeWidget(game.GetGameID(), game.GetGameTDBID(), game.GetRevision());
|
||||
PatchesWidget* patches = new PatchesWidget(game);
|
||||
GameConfigWidget* game_config = new GameConfigWidget(game);
|
||||
GraphicsModListWidget* graphics_mod_list = new GraphicsModListWidget(game);
|
||||
auto* const patches = new PatchesWidget(game);
|
||||
auto* const game_config = new GameConfigWidget(game);
|
||||
auto* const graphics_mod_list = new GraphicsModListWidget(game);
|
||||
|
||||
connect(gecko, &GeckoCodeWidget::OpenGeneralSettings, this,
|
||||
&PropertiesDialog::OpenGeneralSettings);
|
||||
@@ -63,45 +56,31 @@ PropertiesDialog::PropertiesDialog(QWidget* parent, const UICommon::GameFile& ga
|
||||
connect(graphics_mod_list, &GraphicsModListWidget::OpenGraphicsSettings, this,
|
||||
&PropertiesDialog::OpenGraphicsSettings);
|
||||
|
||||
const int padding_width = 120;
|
||||
const int padding_height = 100;
|
||||
tab_widget->addTab(GetWrappedWidget(info, this, padding_width, padding_height), tr("Info"));
|
||||
tab_widget->addTab(GetWrappedWidget(game_config, this, padding_width, padding_height),
|
||||
tr("Game Config"));
|
||||
tab_widget->addTab(GetWrappedWidget(patches, this, padding_width, padding_height), tr("Patches"));
|
||||
tab_widget->addTab(GetWrappedWidget(ar, this, padding_width, padding_height), tr("AR Codes"));
|
||||
tab_widget->addTab(GetWrappedWidget(gecko, this, padding_width, padding_height),
|
||||
tr("Gecko Codes"));
|
||||
tab_widget->addTab(GetWrappedWidget(graphics_mod_list, this, padding_width, padding_height),
|
||||
tr("Graphics Mods"));
|
||||
// Note: Intentional selective use of AddWrappedPane for a sensible dialog "minimumSize".
|
||||
AddWrappedPane(info, tr("Info"));
|
||||
AddPane(game_config, tr("Game Config"));
|
||||
AddPane(patches, tr("Patches"));
|
||||
AddPane(ar, tr("AR Codes"));
|
||||
AddPane(gecko, tr("Gecko Codes"));
|
||||
AddWrappedPane(graphics_mod_list, tr("Graphics Mods"));
|
||||
|
||||
if (game.GetPlatform() != DiscIO::Platform::ELFOrDOL)
|
||||
{
|
||||
std::shared_ptr<DiscIO::Volume> volume = DiscIO::CreateVolume(game.GetFilePath());
|
||||
if (volume)
|
||||
{
|
||||
VerifyWidget* verify = new VerifyWidget(volume);
|
||||
tab_widget->addTab(GetWrappedWidget(verify, this, padding_width, padding_height),
|
||||
tr("Verify"));
|
||||
auto* const verify = new VerifyWidget(volume);
|
||||
AddPane(verify, tr("Verify"));
|
||||
|
||||
if (DiscIO::IsDisc(game.GetPlatform()))
|
||||
{
|
||||
FilesystemWidget* filesystem = new FilesystemWidget(volume);
|
||||
tab_widget->addTab(GetWrappedWidget(filesystem, this, padding_width, padding_height),
|
||||
tr("Filesystem"));
|
||||
auto* const filesystem = new FilesystemWidget(volume);
|
||||
AddPane(filesystem, tr("Filesystem"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
layout->addWidget(tab_widget);
|
||||
connect(this, &QDialog::rejected, graphics_mod_list, &GraphicsModListWidget::SaveToDisk);
|
||||
|
||||
QDialogButtonBox* close_box = new QDialogButtonBox(QDialogButtonBox::Close);
|
||||
|
||||
connect(close_box, &QDialogButtonBox::rejected, this, &QDialog::reject);
|
||||
connect(close_box, &QDialogButtonBox::rejected, graphics_mod_list,
|
||||
&GraphicsModListWidget::SaveToDisk);
|
||||
|
||||
layout->addWidget(close_box);
|
||||
|
||||
setLayout(layout);
|
||||
OnDoneCreatingPanes();
|
||||
}
|
||||
|
||||
@@ -5,12 +5,14 @@
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
#include "DolphinQt/Config/SettingsWindow.h"
|
||||
|
||||
namespace UICommon
|
||||
{
|
||||
class GameFile;
|
||||
}
|
||||
|
||||
class PropertiesDialog final : public QDialog
|
||||
class PropertiesDialog final : public StackedSettingsWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
||||
@@ -4,13 +4,13 @@
|
||||
#include "DolphinQt/Config/SettingsWindow.h"
|
||||
|
||||
#include <QDialogButtonBox>
|
||||
#include <QPushButton>
|
||||
#include <QTabWidget>
|
||||
#include <QHBoxLayout>
|
||||
#include <QListWidget>
|
||||
#include <QStackedWidget>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
#include "DolphinQt/QtUtils/QtUtils.h"
|
||||
#include "DolphinQt/QtUtils/WrapInScrollArea.h"
|
||||
#include "DolphinQt/Resources.h"
|
||||
#include "DolphinQt/Settings.h"
|
||||
#include "DolphinQt/Settings/AdvancedPane.h"
|
||||
#include "DolphinQt/Settings/AudioPane.h"
|
||||
#include "DolphinQt/Settings/GameCubePane.h"
|
||||
@@ -19,45 +19,137 @@
|
||||
#include "DolphinQt/Settings/PathPane.h"
|
||||
#include "DolphinQt/Settings/WiiPane.h"
|
||||
|
||||
#include "Core/Core.h"
|
||||
|
||||
SettingsWindow::SettingsWindow(QWidget* parent) : QDialog(parent)
|
||||
StackedSettingsWindow::StackedSettingsWindow(QWidget* parent) : QDialog{parent}
|
||||
{
|
||||
// Set Window Properties
|
||||
setWindowTitle(tr("Settings"));
|
||||
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
|
||||
|
||||
// Main Layout
|
||||
QVBoxLayout* layout = new QVBoxLayout;
|
||||
// This eliminates the ugly line between the title bar and window contents with KDE Plasma.
|
||||
setStyleSheet(QStringLiteral("QDialog { border: none; }"));
|
||||
|
||||
// Add content to layout before dialog buttons.
|
||||
m_tab_widget = new QTabWidget();
|
||||
layout->addWidget(m_tab_widget);
|
||||
auto* const layout = new QHBoxLayout{this};
|
||||
|
||||
m_tab_widget->addTab(GetWrappedWidget(new GeneralPane, this, 125, 100), tr("General"));
|
||||
m_tab_widget->addTab(GetWrappedWidget(new InterfacePane, this, 125, 100), tr("Interface"));
|
||||
m_tab_widget->addTab(GetWrappedWidget(new AudioPane, this, 125, 100), tr("Audio"));
|
||||
m_tab_widget->addTab(GetWrappedWidget(new PathPane, this, 125, 100), tr("Paths"));
|
||||
m_tab_widget->addTab(GetWrappedWidget(new GameCubePane, this, 125, 100), tr("GameCube"));
|
||||
m_tab_widget->addTab(GetWrappedWidget(new WiiPane, this, 125, 100), tr("Wii"));
|
||||
m_tab_widget->addTab(GetWrappedWidget(new AdvancedPane, this, 125, 200), tr("Advanced"));
|
||||
// Calculated value for the padding in our list items.
|
||||
const int list_item_padding = layout->contentsMargins().left() / 2;
|
||||
|
||||
// Dialog box buttons
|
||||
QDialogButtonBox* close_box = new QDialogButtonBox(QDialogButtonBox::Close);
|
||||
// Eliminate padding around layouts.
|
||||
layout->setContentsMargins(QMargins{});
|
||||
layout->setSpacing(0);
|
||||
|
||||
connect(close_box, &QDialogButtonBox::rejected, this, &QDialog::reject);
|
||||
m_navigation_list = new QListWidget;
|
||||
|
||||
layout->addWidget(close_box);
|
||||
// Ensure list doesn't grow horizontally and is not resized smaller than its contents.
|
||||
m_navigation_list->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Minimum);
|
||||
m_navigation_list->setSizeAdjustPolicy(QAbstractScrollArea::AdjustToContents);
|
||||
|
||||
setLayout(layout);
|
||||
// FYI: "base" is the window color on Windows and "alternate-base" is very high contrast on macOS.
|
||||
const auto [list_background, list_hover_background] =
|
||||
#if defined(_WIN32)
|
||||
std::pair("palette(alternate-base)", "palette(base)");
|
||||
#else
|
||||
std::pair("palette(base)", "palette(alternate-base)");
|
||||
#endif
|
||||
|
||||
m_navigation_list->setStyleSheet(
|
||||
QString::fromUtf8(
|
||||
// Remove border around entire widget and adjust background color.
|
||||
"QListWidget { border: 0; background: %1; } "
|
||||
"QListWidget::item { padding: %2; "
|
||||
#if defined(__linux__)
|
||||
"} "
|
||||
#else
|
||||
// For some reason this is needed to fix inconsistent item padding on Windows and macOS,
|
||||
// but it unfortunately also breaks item background color changes.
|
||||
"border: 0; } "
|
||||
// Restore selected item color.
|
||||
"QListWidget::item:selected { background: palette(highlight); "
|
||||
#if defined(_WIN32)
|
||||
// Prevent text color change on focus loss on Windows.
|
||||
// This seems to breaks the nice white text on macOS.
|
||||
"color: palette(highlighted-text); "
|
||||
#endif
|
||||
"} "
|
||||
// Restore hovered item color, though not really the correct color.
|
||||
"QListWidget::item:hover:!selected { background: %3; } "
|
||||
#endif
|
||||
#if defined(_WIN32)
|
||||
// Remove ugly dotted outline on selected row.
|
||||
"* { outline: none; } "
|
||||
#endif
|
||||
)
|
||||
.arg(QString::fromUtf8(list_background))
|
||||
.arg(list_item_padding)
|
||||
#if !defined(__linux__)
|
||||
.arg(QString::fromUtf8(list_hover_background))
|
||||
#endif
|
||||
);
|
||||
|
||||
layout->addWidget(m_navigation_list);
|
||||
|
||||
auto* const right_side = new QVBoxLayout;
|
||||
layout->addLayout(right_side);
|
||||
|
||||
m_stacked_panes = new QStackedWidget;
|
||||
|
||||
right_side->addWidget(m_stacked_panes);
|
||||
|
||||
// The QFrame gives us some padding around the button.
|
||||
auto* const button_frame = new QFrame;
|
||||
auto* const button_layout = new QGridLayout{button_frame};
|
||||
auto* const button_box = new QDialogButtonBox(QDialogButtonBox::Close);
|
||||
right_side->addWidget(button_frame);
|
||||
button_layout->addWidget(button_box);
|
||||
|
||||
connect(button_box, &QDialogButtonBox::rejected, this, &QDialog::reject);
|
||||
|
||||
connect(m_navigation_list, &QListWidget::currentRowChanged, m_stacked_panes,
|
||||
&QStackedWidget::setCurrentIndex);
|
||||
}
|
||||
|
||||
void StackedSettingsWindow::OnDoneCreatingPanes()
|
||||
{
|
||||
// Make sure the first item is actually selected by default.
|
||||
ActivatePane(0);
|
||||
// Take on the preferred size.
|
||||
QtUtils::AdjustSizeWithinScreen(this);
|
||||
}
|
||||
|
||||
void StackedSettingsWindow::AddPane(QWidget* widget, const QString& name)
|
||||
{
|
||||
m_stacked_panes->addWidget(widget);
|
||||
m_navigation_list->addItem(name);
|
||||
}
|
||||
|
||||
void StackedSettingsWindow::AddWrappedPane(QWidget* widget, const QString& name)
|
||||
{
|
||||
AddPane(GetWrappedWidget(widget), name);
|
||||
}
|
||||
|
||||
void StackedSettingsWindow::ActivatePane(int index)
|
||||
{
|
||||
m_navigation_list->setCurrentRow(index);
|
||||
}
|
||||
|
||||
SettingsWindow::SettingsWindow(QWidget* parent) : StackedSettingsWindow{parent}
|
||||
{
|
||||
setWindowTitle(tr("Settings"));
|
||||
|
||||
AddWrappedPane(new GeneralPane, tr("General"));
|
||||
AddWrappedPane(new InterfacePane, tr("Interface"));
|
||||
AddWrappedPane(new AudioPane, tr("Audio"));
|
||||
AddWrappedPane(new PathPane, tr("Paths"));
|
||||
AddWrappedPane(new GameCubePane, tr("GameCube"));
|
||||
AddWrappedPane(new WiiPane, tr("Wii"));
|
||||
AddWrappedPane(new AdvancedPane, tr("Advanced"));
|
||||
|
||||
OnDoneCreatingPanes();
|
||||
}
|
||||
|
||||
void SettingsWindow::SelectAudioPane()
|
||||
{
|
||||
m_tab_widget->setCurrentIndex(static_cast<int>(TabIndex::Audio));
|
||||
ActivatePane(static_cast<int>(TabIndex::Audio));
|
||||
}
|
||||
|
||||
void SettingsWindow::SelectGeneralPane()
|
||||
{
|
||||
m_tab_widget->setCurrentIndex(static_cast<int>(TabIndex::General));
|
||||
ActivatePane(static_cast<int>(TabIndex::General));
|
||||
}
|
||||
|
||||
@@ -5,7 +5,31 @@
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
class QTabWidget;
|
||||
class QStackedWidget;
|
||||
class QListWidget;
|
||||
|
||||
// A settings window with a QListWidget to switch between panes of a QStackedWidget.
|
||||
class StackedSettingsWindow : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit StackedSettingsWindow(QWidget* parent = nullptr);
|
||||
|
||||
void ActivatePane(int index);
|
||||
|
||||
protected:
|
||||
void AddPane(QWidget*, const QString& name);
|
||||
|
||||
// Adds a scrollable Pane.
|
||||
void AddWrappedPane(QWidget*, const QString& name);
|
||||
|
||||
// For derived classes to call after they create their settings panes.
|
||||
void OnDoneCreatingPanes();
|
||||
|
||||
private:
|
||||
QStackedWidget* m_stacked_panes;
|
||||
QListWidget* m_navigation_list;
|
||||
};
|
||||
|
||||
enum class TabIndex
|
||||
{
|
||||
@@ -13,14 +37,12 @@ enum class TabIndex
|
||||
Audio = 2
|
||||
};
|
||||
|
||||
class SettingsWindow final : public QDialog
|
||||
class SettingsWindow final : public StackedSettingsWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit SettingsWindow(QWidget* parent = nullptr);
|
||||
|
||||
void SelectGeneralPane();
|
||||
void SelectAudioPane();
|
||||
|
||||
private:
|
||||
QTabWidget* m_tab_widget;
|
||||
};
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include <QDateTimeEdit>
|
||||
#include <QHBoxLayout>
|
||||
#include <QLabel>
|
||||
#include <QScreen>
|
||||
|
||||
namespace QtUtils
|
||||
{
|
||||
@@ -35,4 +36,13 @@ QWidget* CreateIconWarning(QWidget* parent, QStyle::StandardPixmap standard_pixm
|
||||
return widget;
|
||||
}
|
||||
|
||||
void AdjustSizeWithinScreen(QWidget* widget)
|
||||
{
|
||||
const auto screen_size = widget->screen()->availableSize();
|
||||
|
||||
const auto adj_screen_size = screen_size * 9 / 10;
|
||||
|
||||
widget->resize(widget->sizeHint().boundedTo(adj_screen_size));
|
||||
}
|
||||
|
||||
} // namespace QtUtils
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user