Files
KytyPS5/src/launcher/include/configurationEditDialog.h
T
M4andnmzik 69fdb03dc2 Launcher display options (#1938)
* launcher: add minimize and maximize buttons to the main window

The main window is a QDialog, which on Windows only gets a close button.

* graphics: keep the game's aspect ratio when presenting to the window

The guest frame was blitted across the whole swapchain image, so a window
or fullscreen display whose shape differs from the frame stretched the
picture. Fit the frame inside the window instead and clear the remaining
bars to black. The video-out overlay layer is drawn into the same
rectangle so it stays aligned with the frame underneath.

* launcher: accept custom screen resolutions such as 21:9

The resolution was a fixed enum of four 16:9 sizes. Make the combo box
editable so any WIDTHxHEIGHT between 320 and 16384 can be entered, and
add ultrawide presets (2560x1080, 3440x1440, 3840x1600, 5120x2160).

Settings saved by older launchers stored the enum key ("R1920X1080");
NormalizeResolution still accepts that form, so they load unchanged.

* launcher: add a Stretch to window option

Presentation now keeps the game's aspect ratio with black bars. Add
--stretch to fill the whole window as before, exposed in the launcher as
a "Stretch to window" checkbox under General, off by default.

* launcher: make the settings dialog resizable and its tabs scrollable

The dialog had no maximize button and pinned its minimum width to its
initial 900 px, and without scroll areas it could not be made shorter
than its content. Add a maximize button (not minimize, since the dialog
is modal), drop the width pin, and wrap each tab page in a frameless
scroll area.

With the scroll areas the layout's minimum size no longer forces the
dialog open, so size it explicitly: grow it to fit the largest tab,
capped at the available screen, when there is no saved geometry and
whenever the global settings add the game folders panel.

* launcher: simplify display options and preserve saved settings

---------

Co-authored-by: nmzik <Nmzik@mail.ru>
2026-10-27 21:59:56 +01:00

74 lines
2.0 KiB
C++

#ifndef CONFIGURATION_EDIT_DIALOG_H
#define CONFIGURATION_EDIT_DIALOG_H
#include <QDialog>
#include <QString>
#include <QStringList>
class QByteArray;
class QGroupBox;
class QLineEdit;
class QListWidget;
class QMoveEvent;
class QResizeEvent;
class QToolButton;
class QSettings;
class QWidget;
class Configuration;
namespace Ui {
class ConfigurationEditDialog;
} // namespace Ui
class ConfigurationEditDialog: public QDialog {
Q_OBJECT
public:
explicit ConfigurationEditDialog(Configuration& info, QWidget* parent = nullptr);
~ConfigurationEditDialog() override;
static void WriteSettings(QSettings& s);
static void ReadSettings(QSettings& s);
void SetGlobalSettings(const QStringList& dirs, const QString& addons_dir);
[[nodiscard]] QString GetAddonsDirectory() const;
[[nodiscard]] QStringList GetGameDirectories() const;
signals:
void PreviewControllerColor(const QString& color);
void ImportGameSettings();
void ExportGameSettings();
private:
Ui::ConfigurationEditDialog* m_ui = nullptr;
Configuration& m_info;
QGroupBox* m_game_dirs_group = nullptr;
QListWidget* m_game_dirs_list = nullptr;
QLineEdit* m_addons_dir_edit = nullptr;
QToolButton* m_remove_game_dir_button = nullptr;
bool m_global_settings = false;
bool m_geometry_restored = false;
protected:
void Init(const Configuration& info);
void InitGameDirectories();
void AddGameDirectoryItem(const QString& dir);
void MakeTabsScrollable();
void GrowToFitContents();
void ShowTab(QWidget* page);
void moveEvent(QMoveEvent* event) override;
void resizeEvent(QResizeEvent* event) override;
static QByteArray g_last_geometry;
/*slots:*/
void save();
void clear();
void add_game_directory();
void remove_selected_game_directories();
void update_game_directory_buttons();
};
#endif // CONFIGURATION_EDIT_DIALOG_H