profile_select.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. // Copyright 2018 yuzu Emulator Project
  2. // Licensed under GPLv2 or any later version
  3. // Refer to the license.txt file included.
  4. #pragma once
  5. #include <vector>
  6. #include <QDialog>
  7. #include <QList>
  8. #include <QTreeView>
  9. #include "core/frontend/applets/profile_select.h"
  10. #include "core/hle/service/acc/profile_manager.h"
  11. class GMainWindow;
  12. class QDialogButtonBox;
  13. class QGraphicsScene;
  14. class QLabel;
  15. class QScrollArea;
  16. class QStandardItem;
  17. class QStandardItemModel;
  18. class QVBoxLayout;
  19. class QtProfileSelectionDialog final : public QDialog {
  20. Q_OBJECT
  21. public:
  22. explicit QtProfileSelectionDialog(QWidget* parent);
  23. ~QtProfileSelectionDialog() override;
  24. int exec() override;
  25. void accept() override;
  26. void reject() override;
  27. int GetIndex() const;
  28. private:
  29. void SelectUser(const QModelIndex& index);
  30. int user_index = 0;
  31. QVBoxLayout* layout;
  32. QTreeView* tree_view;
  33. QStandardItemModel* item_model;
  34. QGraphicsScene* scene;
  35. std::vector<QList<QStandardItem*>> list_items;
  36. QVBoxLayout* outer_layout;
  37. QLabel* instruction_label;
  38. QScrollArea* scroll_area;
  39. QDialogButtonBox* buttons;
  40. std::unique_ptr<Service::Account::ProfileManager> profile_manager;
  41. };
  42. class QtProfileSelector final : public QObject, public Core::Frontend::ProfileSelectApplet {
  43. Q_OBJECT
  44. public:
  45. explicit QtProfileSelector(GMainWindow& parent);
  46. ~QtProfileSelector() override;
  47. void SelectProfile(std::function<void(std::optional<Common::UUID>)> callback) const override;
  48. signals:
  49. void MainWindowSelectProfile() const;
  50. private:
  51. void MainWindowFinishedSelection(std::optional<Common::UUID> uuid);
  52. mutable std::function<void(std::optional<Common::UUID>)> callback;
  53. };