2022-07-25 16:18:30 +01:00
|
|
|
// SPDX-FileCopyrightText: Copyright 2017 Citra Emulator Project
|
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
2021-12-25 19:27:52 +00:00
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <memory>
|
|
|
|
#include <QDialog>
|
|
|
|
#include <QSortFilterProxyModel>
|
|
|
|
#include <QStandardItemModel>
|
|
|
|
#include <QVariant>
|
|
|
|
#include "network/network.h"
|
|
|
|
#include "yuzu/multiplayer/chat_room.h"
|
|
|
|
#include "yuzu/multiplayer/validation.h"
|
|
|
|
|
|
|
|
namespace Ui {
|
|
|
|
class HostRoom;
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace Core {
|
2022-08-28 18:31:16 +01:00
|
|
|
class System;
|
2021-12-25 19:27:52 +00:00
|
|
|
class AnnounceMultiplayerSession;
|
2022-08-28 18:31:16 +01:00
|
|
|
} // namespace Core
|
2021-12-25 19:27:52 +00:00
|
|
|
|
|
|
|
class ConnectionError;
|
|
|
|
class ComboBoxProxyModel;
|
|
|
|
|
|
|
|
class ChatMessage;
|
|
|
|
|
|
|
|
namespace Network::VerifyUser {
|
|
|
|
class Backend;
|
|
|
|
};
|
|
|
|
|
|
|
|
class HostRoomWindow : public QDialog {
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
explicit HostRoomWindow(QWidget* parent, QStandardItemModel* list,
|
2022-07-22 15:31:13 +01:00
|
|
|
std::shared_ptr<Core::AnnounceMultiplayerSession> session,
|
2022-08-27 02:41:19 +01:00
|
|
|
Core::System& system_);
|
2021-12-25 19:27:52 +00:00
|
|
|
~HostRoomWindow();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Updates the dialog with a new game list model.
|
|
|
|
* This model should be the original model of the game list.
|
|
|
|
*/
|
|
|
|
void UpdateGameList(QStandardItemModel* list);
|
|
|
|
void RetranslateUi();
|
|
|
|
|
2022-09-09 21:29:22 +01:00
|
|
|
signals:
|
|
|
|
void SaveConfig();
|
|
|
|
|
2021-12-25 19:27:52 +00:00
|
|
|
private:
|
|
|
|
void Host();
|
|
|
|
std::unique_ptr<Network::VerifyUser::Backend> CreateVerifyBackend(bool use_validation) const;
|
|
|
|
|
|
|
|
std::unique_ptr<Ui::HostRoom> ui;
|
|
|
|
std::weak_ptr<Core::AnnounceMultiplayerSession> announce_multiplayer_session;
|
|
|
|
QStandardItemModel* game_list;
|
|
|
|
ComboBoxProxyModel* proxy;
|
|
|
|
Validation validation;
|
2022-08-27 02:41:19 +01:00
|
|
|
Core::System& system;
|
2022-07-22 15:31:13 +01:00
|
|
|
Network::RoomNetwork& room_network;
|
2021-12-25 19:27:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Proxy Model for the game list combo box so we can reuse the game list model while still
|
|
|
|
* displaying the fields slightly differently
|
|
|
|
*/
|
|
|
|
class ComboBoxProxyModel : public QSortFilterProxyModel {
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
int columnCount(const QModelIndex& idx) const override {
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
QVariant data(const QModelIndex& idx, int role) const override;
|
|
|
|
|
|
|
|
bool lessThan(const QModelIndex& left, const QModelIndex& right) const override;
|
|
|
|
};
|