2018-11-23 02:03:33 +00:00
|
|
|
// Copyright 2018 yuzu Emulator Project
|
|
|
|
// Licensed under GPLv2 or any later version
|
|
|
|
// Refer to the license.txt file included.
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <vector>
|
|
|
|
#include <QDialog>
|
|
|
|
#include <QList>
|
|
|
|
#include "core/frontend/applets/profile_select.h"
|
2019-01-11 02:53:07 +00:00
|
|
|
#include "core/hle/service/acc/profile_manager.h"
|
2018-11-23 02:03:33 +00:00
|
|
|
|
2021-11-28 05:26:51 +00:00
|
|
|
class ControllerNavigation;
|
2018-11-23 02:03:33 +00:00
|
|
|
class GMainWindow;
|
|
|
|
class QDialogButtonBox;
|
|
|
|
class QGraphicsScene;
|
|
|
|
class QLabel;
|
|
|
|
class QScrollArea;
|
|
|
|
class QStandardItem;
|
|
|
|
class QStandardItemModel;
|
2022-03-19 05:16:04 +00:00
|
|
|
class QTreeView;
|
2018-11-23 02:03:33 +00:00
|
|
|
class QVBoxLayout;
|
|
|
|
|
2021-11-28 05:26:51 +00:00
|
|
|
namespace Core::HID {
|
|
|
|
class HIDCore;
|
|
|
|
} // namespace Core::HID
|
|
|
|
|
2018-11-23 02:03:33 +00:00
|
|
|
class QtProfileSelectionDialog final : public QDialog {
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2021-11-28 05:26:51 +00:00
|
|
|
explicit QtProfileSelectionDialog(Core::HID::HIDCore& hid_core, QWidget* parent);
|
2018-11-23 02:03:33 +00:00
|
|
|
~QtProfileSelectionDialog() override;
|
|
|
|
|
2020-10-21 18:36:57 +00:00
|
|
|
int exec() override;
|
2018-11-23 02:03:33 +00:00
|
|
|
void accept() override;
|
|
|
|
void reject() override;
|
|
|
|
|
2019-05-29 04:23:46 +00:00
|
|
|
int GetIndex() const;
|
2018-11-23 02:03:33 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
void SelectUser(const QModelIndex& index);
|
|
|
|
|
2019-05-29 04:34:42 +00:00
|
|
|
int user_index = 0;
|
|
|
|
|
2018-11-23 02:03:33 +00:00
|
|
|
QVBoxLayout* layout;
|
|
|
|
QTreeView* tree_view;
|
|
|
|
QStandardItemModel* item_model;
|
|
|
|
QGraphicsScene* scene;
|
|
|
|
|
|
|
|
std::vector<QList<QStandardItem*>> list_items;
|
|
|
|
|
|
|
|
QVBoxLayout* outer_layout;
|
|
|
|
QLabel* instruction_label;
|
|
|
|
QScrollArea* scroll_area;
|
|
|
|
QDialogButtonBox* buttons;
|
|
|
|
|
|
|
|
std::unique_ptr<Service::Account::ProfileManager> profile_manager;
|
2021-11-28 05:26:51 +00:00
|
|
|
ControllerNavigation* controller_navigation = nullptr;
|
2018-11-23 02:03:33 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class QtProfileSelector final : public QObject, public Core::Frontend::ProfileSelectApplet {
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
explicit QtProfileSelector(GMainWindow& parent);
|
|
|
|
~QtProfileSelector() override;
|
|
|
|
|
2020-12-05 13:37:13 +00:00
|
|
|
void SelectProfile(std::function<void(std::optional<Common::UUID>)> callback_) const override;
|
2018-11-23 02:03:33 +00:00
|
|
|
|
|
|
|
signals:
|
|
|
|
void MainWindowSelectProfile() const;
|
|
|
|
|
|
|
|
private:
|
2019-01-11 02:53:07 +00:00
|
|
|
void MainWindowFinishedSelection(std::optional<Common::UUID> uuid);
|
2018-11-23 02:03:33 +00:00
|
|
|
|
2019-01-11 02:53:07 +00:00
|
|
|
mutable std::function<void(std::optional<Common::UUID>)> callback;
|
2018-11-23 02:03:33 +00:00
|
|
|
};
|