* common: Move settings to common from core. - Removes a dependency on core and input_common from common. * code: Wrap settings values * Port from yuzu to allow per game settings * citra_qt: Initial per-game settings dialog * citra_qt: Use new API for read/save of config values * citra_qt: Per game audio settings * citra_qt: Per game graphics settings * citra_qt: Per game system settings * citra_qt: Per game general settings * citra_qt: Document and run clang format * citra_qt: Make icon smaller and centered * citra_qt: Remove version number * Not sure how to extract that, can always add it back later * citra_qt: Wrap UISettings * citra_qt: Fix unthottled fps setting * citra_qt: Remove margin in emulation tab * citra_qt: Implement some suggestions * Bring back speed switch hotkey * Allow configuration when game is running * Rename/adjust UI stuff * citra_qt: Fix build with separate windows * citra_qt: Address feedback * citra_qt: Log per-game settings before launching games * citra_qt: Add shader cache options * Also fix android build * citra_qt: Add DLC menu option * citra_qt: Run clang-format * citra_qt: Adjust for time offset * citra_qt: Implement suggestions * Run clang-format Co-authored-by: bunnei <bunneidev@gmail.com>
86 lines
2.4 KiB
C++
86 lines
2.4 KiB
C++
// Copyright 2020 Citra Emulator Project
|
|
// Licensed under GPLv2 or any later version
|
|
// Refer to the license.txt file included.
|
|
|
|
#pragma once
|
|
|
|
#include <functional>
|
|
#include <memory>
|
|
#include <optional>
|
|
#include <vector>
|
|
#include <QDialog>
|
|
#include "common/settings.h"
|
|
|
|
class QItemSelection;
|
|
class QModelIndex;
|
|
class QStandardItemModel;
|
|
class QStandardItem;
|
|
class QTimer;
|
|
|
|
namespace Common {
|
|
class ParamPackage;
|
|
}
|
|
|
|
namespace InputCommon {
|
|
namespace Polling {
|
|
class DevicePoller;
|
|
}
|
|
} // namespace InputCommon
|
|
|
|
namespace Ui {
|
|
class ConfigureTouchFromButton;
|
|
}
|
|
|
|
class ConfigureTouchFromButton : public QDialog {
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit ConfigureTouchFromButton(QWidget* parent,
|
|
const std::vector<Settings::TouchFromButtonMap>& touch_maps,
|
|
int default_index = 0);
|
|
~ConfigureTouchFromButton() override;
|
|
|
|
int GetSelectedIndex() const;
|
|
std::vector<Settings::TouchFromButtonMap> GetMaps() const;
|
|
|
|
public slots:
|
|
void ApplyConfiguration();
|
|
void NewBinding(const QPoint& pos);
|
|
void SetActiveBinding(int dot_id);
|
|
void SetCoordinates(int dot_id, const QPoint& pos);
|
|
|
|
protected:
|
|
void showEvent(QShowEvent* ev) override;
|
|
void keyPressEvent(QKeyEvent* event) override;
|
|
|
|
private slots:
|
|
void NewMapping();
|
|
void DeleteMapping();
|
|
void RenameMapping();
|
|
void EditBinding(const QModelIndex& qi);
|
|
void DeleteBinding();
|
|
void OnBindingSelection(const QItemSelection& selected, const QItemSelection& deselected);
|
|
void OnBindingChanged(QStandardItem* item);
|
|
void OnBindingDeleted(const QModelIndex& parent, int first, int last);
|
|
|
|
private:
|
|
void SetConfiguration();
|
|
void UpdateUiDisplay();
|
|
void ConnectEvents();
|
|
void GetButtonInput(int row_index, bool is_new);
|
|
void SetPollingResult(const Common::ParamPackage& params, bool cancel);
|
|
void SaveCurrentMapping();
|
|
|
|
std::unique_ptr<Ui::ConfigureTouchFromButton> ui;
|
|
QStandardItemModel* binding_list_model;
|
|
std::vector<Settings::TouchFromButtonMap> touch_maps;
|
|
int selected_index;
|
|
|
|
std::unique_ptr<QTimer> timeout_timer;
|
|
std::unique_ptr<QTimer> poll_timer;
|
|
std::vector<std::unique_ptr<InputCommon::Polling::DevicePoller>> device_pollers;
|
|
std::optional<std::function<void(const Common::ParamPackage&, bool)>> input_setter;
|
|
|
|
static constexpr int DataRoleDot = Qt::ItemDataRole::UserRole + 2;
|
|
};
|