| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
#pragma once |
| 5 |
|
| 6 |
#include <map> |
| 7 |
#include <mutex> |
| 8 |
#include <optional> |
| 9 |
#include <thread> |
| 10 |
#include <vector> |
| 11 |
|
| 12 |
#include <QDialog> |
| 13 |
|
| 14 |
#include "Common/Event.h" |
| 15 |
#include "Common/Flag.h" |
| 16 |
#include "UICommon/NetPlayIndex.h" |
| 17 |
|
| 18 |
class QCheckBox; |
| 19 |
class QComboBox; |
| 20 |
class QDialogButtonBox; |
| 21 |
class QLabel; |
| 22 |
class QLineEdit; |
| 23 |
class QPushButton; |
| 24 |
class QRadioButton; |
| 25 |
class QTableWidget; |
| 26 |
|
| 27 |
class NetPlayBrowser : public QDialog |
| 28 |
{ |
| 29 |
Q_OBJECT |
| 30 |
public: |
| 31 |
explicit NetPlayBrowser(QWidget* parent = nullptr); |
| 32 |
~NetPlayBrowser() override; |
| 33 |
|
| 34 |
void accept() override; |
| 35 |
signals: |
| 36 |
void Join(); |
| 37 |
void UpdateStatusRequested(const QString& status); |
| 38 |
void UpdateListRequested(std::vector<NetPlaySession> sessions); |
| 39 |
|
| 40 |
private: |
| 41 |
void CreateWidgets(); |
| 42 |
void ConnectWidgets(); |
| 43 |
|
| 44 |
void Refresh(); |
| 45 |
void RefreshLoop(); |
| 46 |
void UpdateList(); |
| 47 |
|
| 48 |
void OnSelectionChanged(); |
| 49 |
|
| 50 |
void OnUpdateStatusRequested(const QString& status); |
| 51 |
void OnUpdateListRequested(std::vector<NetPlaySession> sessions); |
| 52 |
|
| 53 |
void SaveSettings() const; |
| 54 |
void RestoreSettings(); |
| 55 |
|
| 56 |
QComboBox* m_region_combo; |
| 57 |
QLabel* m_status_label; |
| 58 |
QPushButton* m_button_refresh; |
| 59 |
QTableWidget* m_table_widget; |
| 60 |
QDialogButtonBox* m_button_box; |
| 61 |
QLineEdit* m_edit_name; |
| 62 |
QLineEdit* m_edit_game_id; |
| 63 |
QCheckBox* m_check_hide_incompatible; |
| 64 |
QCheckBox* m_check_hide_ingame; |
| 65 |
|
| 66 |
QRadioButton* m_radio_all; |
| 67 |
QRadioButton* m_radio_private; |
| 68 |
QRadioButton* m_radio_public; |
| 69 |
|
| 70 |
std::vector<NetPlaySession> m_sessions; |
| 71 |
|
| 72 |
std::thread m_refresh_thread; |
| 73 |
std::optional<std::map<std::string, std::string>> m_refresh_filters; |
| 74 |
std::mutex m_refresh_filters_mutex; |
| 75 |
Common::Flag m_refresh_run; |
| 76 |
Common::Event m_refresh_event; |
| 77 |
}; |
| 78 |
|
| 79 |
Q_DECLARE_METATYPE(std::vector<NetPlaySession>) |