dolphin/Source/Core/DolphinQt/Config/ConfigControls/ConfigUserPath.h
Maximilian Mader 514beb2081
DolphinQt: Add an optional default value to ConfigUserPath constructor
The optional default value is used to implement `ConfigUserPath::Reset()`.
Since `ConfigUserPath` must not be empty, there was no easy way to reset
these paths to their default value.

With this change users of `ConfigUserPath` can now set the default path.
At the moment users of `ConfigUserPath` must place a reset button and
connect a callback to `ConfigUserPath::Reset` on their own.
2026-04-21 15:47:41 +02:00

33 lines
856 B
C++

// Copyright 2025 Dolphin Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
#include <QLineEdit>
#include "Common/Config/ConfigInfo.h"
#include "DolphinQt/Config/ConfigControls/ConfigText.h"
class ConfigUserPath final : public ConfigText
{
Q_OBJECT
public:
ConfigUserPath(const unsigned int dir_index, const Config::Info<std::string>& setting);
ConfigUserPath(const unsigned int dir_index, const Config::Info<std::string>& setting,
std::string default_value);
ConfigUserPath(const unsigned int dir_index, const Config::Info<std::string>& setting,
std::string default_value, Config::Layer* layer);
void Reset();
protected:
void OnConfigChanged() override;
private:
void RefreshText();
void Update();
const unsigned int m_dir_index;
const std::string m_default_value;
};