Qt: Add interface and view types to setup wizard

pull/3765/head
Stenzek 2 weeks ago
parent 4bc8ace9b0
commit 866d230428
No known key found for this signature in database

@ -84,14 +84,22 @@ static const char* SUPPORTED_FORMATS_STRING =
".pbp (PlayStation Portable, Only Decrypted)");
static constexpr std::array<const char*, GameListModel::Column_Count> s_column_names = {{
QT_TRANSLATE_NOOP("GameListModel", "Icon"), QT_TRANSLATE_NOOP("GameListModel", "Serial"),
QT_TRANSLATE_NOOP("GameListModel", "Title"), QT_TRANSLATE_NOOP("GameListModel", "File Title"),
QT_TRANSLATE_NOOP("GameListModel", "Developer"), QT_TRANSLATE_NOOP("GameListModel", "Publisher"),
QT_TRANSLATE_NOOP("GameListModel", "Genre"), QT_TRANSLATE_NOOP("GameListModel", "Year"),
QT_TRANSLATE_NOOP("GameListModel", "Players"), QT_TRANSLATE_NOOP("GameListModel", "Time Played"),
QT_TRANSLATE_NOOP("GameListModel", "Last Played"), QT_TRANSLATE_NOOP("GameListModel", "Size"),
QT_TRANSLATE_NOOP("GameListModel", "Data Size"), QT_TRANSLATE_NOOP("GameListModel", "Region"),
QT_TRANSLATE_NOOP("GameListModel", "Achievements"), QT_TRANSLATE_NOOP("GameListModel", "Compatibility"),
QT_TRANSLATE_NOOP("GameListModel", "Icon"),
QT_TRANSLATE_NOOP("GameListModel", "Serial"),
QT_TRANSLATE_NOOP("GameListModel", "Title"),
QT_TRANSLATE_NOOP("GameListModel", "File Title"),
QT_TRANSLATE_NOOP("GameListModel", "Developer"),
QT_TRANSLATE_NOOP("GameListModel", "Publisher"),
QT_TRANSLATE_NOOP("GameListModel", "Genre"),
QT_TRANSLATE_NOOP("GameListModel", "Year"),
QT_TRANSLATE_NOOP("GameListModel", "Players"),
QT_TRANSLATE_NOOP("GameListModel", "Time Played"),
QT_TRANSLATE_NOOP("GameListModel", "Last Played"),
QT_TRANSLATE_NOOP("GameListModel", "Size"),
QT_TRANSLATE_NOOP("GameListModel", "Data Size"),
QT_TRANSLATE_NOOP("GameListModel", "Region"),
QT_TRANSLATE_NOOP("GameListModel", "Achievements"),
QT_TRANSLATE_NOOP("GameListModel", "Compatibility"),
"Cover", // Do not translate.
}};
@ -1899,11 +1907,6 @@ GameListWidget::GameListWidget(QWidget* parent, QAction* action_view_list, QActi
connect(g_main_window, &MainWindow::themeChanged, this, &GameListWidget::onThemeChanged);
const bool grid_view = Core::GetBaseBoolSettingValue("UI", "GameListGridView", false);
if (grid_view)
action_view_grid->setChecked(true);
else
action_view_list->setChecked(true);
action_merge_disc_sets->setChecked(m_sort_model->isMergingDiscSets());
action_show_localized_titles->setChecked(m_model->getShowLocalizedTitles());
action_show_list_icons->setChecked(m_model->getShowGameIcons());
@ -1912,7 +1915,7 @@ GameListWidget::GameListWidget(QWidget* parent, QAction* action_view_list, QActi
action_show_grid_titles->setChecked(m_model->getShowCoverTitles());
onIconSizeChanged(m_model->getIconSize());
setViewMode(grid_view ? VIEW_MODE_GRID : VIEW_MODE_LIST);
reloadViewModeFromSettings();
updateBackground(true);
}
@ -2096,6 +2099,8 @@ void GameListWidget::onRefreshComplete()
// if we still had no games, switch to the helper widget
if (m_model->rowCount() == 0)
setViewMode(VIEW_MODE_NO_GAMES);
else
reloadViewModeFromSettings();
}
void GameListWidget::onSelectionModelCurrentChanged(const QModelIndex& current, const QModelIndex& previous)
@ -2193,6 +2198,16 @@ void GameListWidget::showGameGrid()
setViewMode(VIEW_MODE_GRID);
}
void GameListWidget::reloadViewModeFromSettings()
{
const bool grid_view = Core::GetBaseBoolSettingValue("UI", "GameListGridView", false);
m_ui.viewGameList->defaultAction()->setChecked(!grid_view);
m_ui.viewGameGrid->defaultAction()->setChecked(grid_view);
if (m_model->rowCount() > 0 || m_ui.stack->currentIndex() != VIEW_MODE_NO_GAMES)
setViewMode(grid_view ? VIEW_MODE_GRID : VIEW_MODE_LIST);
}
void GameListWidget::setMergeDiscSets(bool enabled)
{
if (m_sort_model->isMergingDiscSets() == enabled)

@ -283,6 +283,7 @@ public:
void showGameList();
void showGameGrid();
void reloadViewModeFromSettings();
void setMergeDiscSets(bool enabled);
void setShowLocalizedTitles(bool enabled);
void setShowGameIcons(bool enabled);

@ -6,6 +6,7 @@
#include "biossettingswidget.h"
#include "controllerbindingwidgets.h"
#include "controllersettingwidgetbinder.h"
#include "gamelistwidget.h"
#include "graphicssettingswidget.h"
#include "interfacesettingswidget.h"
#include "mainwindow.h"
@ -26,6 +27,8 @@
#include "fmt/format.h"
#include <QtWidgets/QButtonGroup>
#include "moc_setupwizarddialog.cpp"
using namespace Qt::StringLiterals;
@ -162,6 +165,8 @@ void SetupWizardDialog::setupUi()
m_page_labels[Page_Controller] = m_ui.labelController;
m_page_labels[Page_Graphics] = m_ui.labelGraphics;
m_page_labels[Page_Achievements] = m_ui.labelAchievements;
m_page_labels[Page_Interface] = m_ui.labelInterface;
m_page_labels[Page_GameListView] = m_ui.labelGameListView;
m_page_labels[Page_Complete] = m_ui.labelComplete;
connect(m_ui.back, &QPushButton::clicked, this, &SetupWizardDialog::previousPage);
@ -174,6 +179,8 @@ void SetupWizardDialog::setupUi()
setupControllerPage(true);
setupGraphicsPage(true);
setupAchievementsPage(true);
setupInterfacePage();
setupGameListViewPage();
}
void SetupWizardDialog::setupLanguagePage(bool initial)
@ -653,3 +660,61 @@ void SetupWizardDialog::onAchievementsViewProfileClicked()
QtUtils::OpenURL(
this, QUrl(QStringLiteral("https://retroachievements.org/user/%1").arg(QString::fromUtf8(encoded_username))));
}
void SetupWizardDialog::setupGameListViewPage()
{
const bool use_grid = Core::GetBaseBoolSettingValue("UI", "GameListGridView", false);
m_ui.listView->setChecked(!use_grid);
m_ui.gridView->setChecked(use_grid);
connect(m_ui.listView, &QRadioButton::toggled, this, &SetupWizardDialog::onGridViewChanged);
connect(m_ui.gridView, &QRadioButton::toggled, this, &SetupWizardDialog::onGridViewChanged);
}
void SetupWizardDialog::onGridViewChanged(bool checked)
{
if (!checked)
return;
bool setting_value;
if (const QObject* const sender_widget = sender(); sender_widget == m_ui.listView)
setting_value = false;
else if (sender_widget == m_ui.gridView)
setting_value = true;
else
return;
// NOTE: No settings apply here, we explicitly change the layout.
Core::SetBaseBoolSettingValue("UI", "GameListGridView", setting_value);
Core::SetBaseUIntSettingValue("Main", "DefaultFullscreenUIGameView", setting_value ? 0 : 1);
Host::CommitBaseSettingChanges();
g_main_window->getGameListWidget()->reloadViewModeFromSettings();
}
void SetupWizardDialog::setupInterfacePage()
{
const bool use_big_picture = Core::GetBaseBoolSettingValue("Main", "StartFullscreenUI", false);
m_ui.desktopMode->setChecked(!use_big_picture);
m_ui.bigPictureMode->setChecked(use_big_picture);
connect(m_ui.desktopMode, &QRadioButton::toggled, this, &SetupWizardDialog::onStartFullscreenUIChanged);
connect(m_ui.bigPictureMode, &QRadioButton::toggled, this, &SetupWizardDialog::onStartFullscreenUIChanged);
}
void SetupWizardDialog::onStartFullscreenUIChanged(bool checked)
{
if (!checked)
return;
bool setting_value;
if (const QObject* const sender_widget = sender(); sender_widget == m_ui.desktopMode)
setting_value = false;
else if (sender_widget == m_ui.bigPictureMode)
setting_value = true;
else
return;
// NOTE: No settings apply here, this is queried after the wizard completes.
Core::SetBaseBoolSettingValue("Main", "StartFullscreenUI", setting_value);
Host::CommitBaseSettingChanges();
}

@ -29,6 +29,8 @@ private:
Page_Controller,
Page_Graphics,
Page_Achievements,
Page_Interface,
Page_GameListView,
Page_Complete,
Page_Count,
};
@ -40,6 +42,8 @@ private:
void setupControllerPage(bool initial);
void setupGraphicsPage(bool initial);
void setupAchievementsPage(bool initial);
void setupInterfacePage();
void setupGameListViewPage();
void updateStylesheets();
void updatePageLabels(int prev_page);
@ -75,6 +79,9 @@ private:
void updateAchievementsEnableState();
void updateAchievementsLoginState();
void onGridViewChanged(bool checked);
void onStartFullscreenUIChanged(bool checked);
private:
Ui::SetupWizardDialog m_ui;

@ -19,6 +19,9 @@
</property>
<item row="0" column="0">
<layout class="QVBoxLayout" name="verticalLayout_2">
<property name="spacing">
<number>15</number>
</property>
<item>
<widget class="QLabel" name="logo">
<property name="sizePolicy">
@ -57,8 +60,8 @@
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
<width>0</width>
<height>0</height>
</size>
</property>
</spacer>
@ -66,7 +69,7 @@
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
<number>20</number>
<number>15</number>
</property>
<item>
<widget class="QLabel" name="labelLanguage">
@ -115,6 +118,20 @@
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="labelInterface">
<property name="text">
<string>Interface Selection</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="labelGameListView">
<property name="text">
<string>View Selection</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="labelComplete">
<property name="text">
@ -724,8 +741,8 @@
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>1</height>
<width>0</width>
<height>0</height>
</size>
</property>
</spacer>
@ -945,7 +962,7 @@
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<width>0</width>
<height>0</height>
</size>
</property>
@ -1107,8 +1124,196 @@ Login token generated at:</string>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>1</height>
<width>0</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<widget class="QWidget" name="interfacePage">
<layout class="QVBoxLayout" name="interfacePageLayout">
<property name="spacing">
<number>16</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="interfaceDescription">
<property name="text">
<string>Choose the interface DuckStation should show when it starts. Desktop Mode is designed for mouse and keyboard use, while Big Picture Mode is optimized for navigation with a controller on a TV.
You can change this at a later time by toggling the &quot;Start In Big Picture Mode&quot; setting in Interface Settings.</string>
</property>
<property name="alignment">
<set>Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignTop</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="interfaceChoicesLayout">
<property name="spacing">
<number>16</number>
</property>
<item>
<widget class="CardRadioButton" name="desktopMode">
<property name="text">
<string>Desktop Mode</string>
</property>
<property name="icon">
<iconset resource="resources/duckstation-qt.qrc">
<normaloff>:/icons/monochrome/svg/window-2-line.svg</normaloff>:/icons/monochrome/svg/window-2-line.svg</iconset>
</property>
<property name="iconSize">
<size>
<width>64</width>
<height>64</height>
</size>
</property>
<attribute name="buttonGroup">
<string notr="true">interfaceGroup</string>
</attribute>
</widget>
</item>
<item>
<widget class="CardRadioButton" name="bigPictureMode">
<property name="text">
<string>Big Picture Mode</string>
</property>
<property name="icon">
<iconset resource="resources/duckstation-qt.qrc">
<normaloff>:/icons/monochrome/svg/tv-2-line.svg</normaloff>:/icons/monochrome/svg/tv-2-line.svg</iconset>
</property>
<property name="iconSize">
<size>
<width>64</width>
<height>64</height>
</size>
</property>
<attribute name="buttonGroup">
<string notr="true">interfaceGroup</string>
</attribute>
</widget>
</item>
</layout>
</item>
<item>
<spacer name="interfacePageSpacer">
<property name="orientation">
<enum>Qt::Orientation::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<widget class="QWidget" name="gameListViewPage">
<layout class="QVBoxLayout" name="gameListViewPageLayout">
<property name="spacing">
<number>16</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="gameListViewDescription">
<property name="text">
<string>Choose how games should initially be displayed in both Desktop and Big Picture Mode. List View shows detailed information in columns, while Grid View shows game cover art.
You can change this option at a later time by using the toolbar in Desktop Mode or shortcuts in Big Picture Mode.</string>
</property>
<property name="alignment">
<set>Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignTop</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="gameListViewChoicesLayout">
<property name="spacing">
<number>16</number>
</property>
<item>
<widget class="CardRadioButton" name="listView">
<property name="text">
<string>List View</string>
</property>
<property name="icon">
<iconset resource="resources/duckstation-qt.qrc">
<normaloff>:/icons/monochrome/svg/list-check.svg</normaloff>:/icons/monochrome/svg/list-check.svg</iconset>
</property>
<property name="iconSize">
<size>
<width>64</width>
<height>64</height>
</size>
</property>
<attribute name="buttonGroup">
<string notr="true">viewGroup</string>
</attribute>
</widget>
</item>
<item>
<widget class="CardRadioButton" name="gridView">
<property name="text">
<string>Grid View</string>
</property>
<property name="icon">
<iconset resource="resources/duckstation-qt.qrc">
<normaloff>:/icons/monochrome/svg/function-line.svg</normaloff>:/icons/monochrome/svg/function-line.svg</iconset>
</property>
<property name="iconSize">
<size>
<width>64</width>
<height>64</height>
</size>
</property>
<attribute name="buttonGroup">
<string notr="true">viewGroup</string>
</attribute>
</widget>
</item>
</layout>
</item>
<item>
<spacer name="gameListViewPageSpacer">
<property name="orientation">
<enum>Qt::Orientation::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
</spacer>
@ -1148,8 +1353,19 @@ Login token generated at:</string>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>CardRadioButton</class>
<extends>QRadioButton</extends>
<header>cardradiobutton.h</header>
</customwidget>
</customwidgets>
<resources>
<include location="resources/duckstation-qt.qrc"/>
</resources>
<connections/>
<buttongroups>
<buttongroup name="viewGroup"/>
<buttongroup name="interfaceGroup"/>
</buttongroups>
</ui>

Loading…
Cancel
Save