2019-03-30 07:50:57 -06:00
|
|
|
// Copyright 2019 Dolphin Emulator Project
|
2021-07-04 19:22:19 -06:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
2019-03-30 07:50:57 -06:00
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2019-04-07 21:50:09 -06:00
|
|
|
#include <map>
|
|
|
|
#include <mutex>
|
|
|
|
#include <optional>
|
|
|
|
#include <thread>
|
2019-03-30 07:50:57 -06:00
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
#include <QDialog>
|
|
|
|
|
2019-04-07 21:50:09 -06:00
|
|
|
#include "Common/Event.h"
|
|
|
|
#include "Common/Flag.h"
|
2019-03-30 07:50:57 -06:00
|
|
|
#include "UICommon/NetPlayIndex.h"
|
|
|
|
|
2019-04-07 15:53:13 -06:00
|
|
|
class QCheckBox;
|
2019-03-30 07:50:57 -06:00
|
|
|
class QComboBox;
|
|
|
|
class QDialogButtonBox;
|
|
|
|
class QLabel;
|
|
|
|
class QLineEdit;
|
|
|
|
class QPushButton;
|
|
|
|
class QRadioButton;
|
|
|
|
class QTableWidget;
|
|
|
|
|
|
|
|
class NetPlayBrowser : public QDialog
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
explicit NetPlayBrowser(QWidget* parent = nullptr);
|
2019-04-07 21:50:09 -06:00
|
|
|
~NetPlayBrowser();
|
2019-03-30 07:50:57 -06:00
|
|
|
|
|
|
|
void accept() override;
|
|
|
|
signals:
|
|
|
|
void Join();
|
2020-08-14 17:28:19 -06:00
|
|
|
void UpdateStatusRequested(const QString& status);
|
|
|
|
void UpdateListRequested(std::vector<NetPlaySession> sessions);
|
2019-03-30 07:50:57 -06:00
|
|
|
|
|
|
|
private:
|
|
|
|
void CreateWidgets();
|
|
|
|
void ConnectWidgets();
|
|
|
|
|
|
|
|
void Refresh();
|
2019-04-07 21:50:09 -06:00
|
|
|
void RefreshLoop();
|
|
|
|
void UpdateList();
|
2019-03-30 07:50:57 -06:00
|
|
|
|
|
|
|
void OnSelectionChanged();
|
|
|
|
|
2020-08-14 17:28:19 -06:00
|
|
|
void OnUpdateStatusRequested(const QString& status);
|
|
|
|
void OnUpdateListRequested(std::vector<NetPlaySession> sessions);
|
|
|
|
|
2020-04-13 06:32:10 -06:00
|
|
|
void SaveSettings() const;
|
|
|
|
void RestoreSettings();
|
|
|
|
|
2019-03-30 07:50:57 -06:00
|
|
|
QComboBox* m_region_combo;
|
|
|
|
QLabel* m_status_label;
|
|
|
|
QPushButton* m_button_refresh;
|
|
|
|
QTableWidget* m_table_widget;
|
|
|
|
QDialogButtonBox* m_button_box;
|
|
|
|
QLineEdit* m_edit_name;
|
|
|
|
QLineEdit* m_edit_game_id;
|
2019-04-07 15:53:13 -06:00
|
|
|
QCheckBox* m_check_hide_incompatible;
|
2020-04-12 16:37:32 -06:00
|
|
|
QCheckBox* m_check_hide_ingame;
|
2019-03-30 07:50:57 -06:00
|
|
|
|
|
|
|
QRadioButton* m_radio_all;
|
|
|
|
QRadioButton* m_radio_private;
|
|
|
|
QRadioButton* m_radio_public;
|
|
|
|
|
|
|
|
std::vector<NetPlaySession> m_sessions;
|
2019-04-07 21:50:09 -06:00
|
|
|
|
|
|
|
std::thread m_refresh_thread;
|
|
|
|
std::optional<std::map<std::string, std::string>> m_refresh_filters;
|
|
|
|
std::mutex m_refresh_filters_mutex;
|
|
|
|
Common::Flag m_refresh_run;
|
|
|
|
Common::Event m_refresh_event;
|
2019-03-30 07:50:57 -06:00
|
|
|
};
|
2020-08-14 17:28:19 -06:00
|
|
|
|
|
|
|
Q_DECLARE_METATYPE(std::vector<NetPlaySession>)
|