summaryrefslogtreecommitdiff
path: root/Source/Core/DolphinQt/Settings/USBDeviceAddToWhitelistDialog.h
blob: 5ae1199f2e0b5f7c50e4af3a54a98cce845b0491 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// Copyright 2017 Dolphin Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later

#pragma once

#include <QDialog>

class QTimer;
class QDialog;
class QHeaderView;
class QLabel;
class QLineEdit;
class QDialogButtonBox;
class QVBoxLayout;
class QHBoxLayout;
class QListView;
class QPushButton;
class QListWidget;
class QPushButton;
class QErrorMessage;
class QMessageBox;

class USBDeviceAddToWhitelistDialog final : public QDialog
{
  Q_OBJECT
public:
  explicit USBDeviceAddToWhitelistDialog(QWidget* parent);

private:
  static constexpr int DEVICE_REFRESH_INTERVAL_MS = 100;
  QTimer* m_refresh_devices_timer;
  QDialogButtonBox* m_whitelist_buttonbox;
  QVBoxLayout* main_layout;
  QLabel* enter_device_id_label;
  QHBoxLayout* entry_hbox_layout;
  QLineEdit* device_vid_textbox;
  QLineEdit* device_pid_textbox;
  QLabel* select_label;
  QListWidget* usb_inserted_devices_list;

  void InitControls();
  void RefreshDeviceList();
  void AddUSBDeviceToWhitelist();

  void OnDeviceSelection();

  std::map<std::pair<quint16, quint16>, std::string> m_shown_devices;
};