2018-01-19 13:42:21 +00:00
|
|
|
// Copyright 2017 Citra Emulator Project
|
|
|
|
// Licensed under GPLv2 or any later version
|
|
|
|
// Refer to the license.txt file included.
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <memory>
|
|
|
|
#include <QDialog>
|
|
|
|
#include <QSortFilterProxyModel>
|
|
|
|
#include <QStandardItemModel>
|
|
|
|
#include <QVariant>
|
|
|
|
#include "citra_qt/multiplayer/chat_room.h"
|
2018-04-18 16:29:03 +00:00
|
|
|
#include "citra_qt/multiplayer/validation.h"
|
2018-01-19 13:42:21 +00:00
|
|
|
#include "network/network.h"
|
2018-04-18 16:29:03 +00:00
|
|
|
|
|
|
|
namespace Ui {
|
|
|
|
class HostRoom;
|
|
|
|
}
|
2018-01-19 13:42:21 +00:00
|
|
|
|
|
|
|
namespace Core {
|
|
|
|
class AnnounceMultiplayerSession;
|
|
|
|
}
|
|
|
|
|
|
|
|
class ConnectionError;
|
|
|
|
class ComboBoxProxyModel;
|
|
|
|
|
|
|
|
class ChatMessage;
|
|
|
|
|
2018-10-27 07:49:00 +00:00
|
|
|
namespace Network::VerifyUser {
|
|
|
|
class Backend;
|
|
|
|
};
|
|
|
|
|
2018-01-19 13:42:21 +00:00
|
|
|
class HostRoomWindow : public QDialog {
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
explicit HostRoomWindow(QWidget* parent, QStandardItemModel* list,
|
|
|
|
std::shared_ptr<Core::AnnounceMultiplayerSession> session);
|
2018-04-18 16:29:03 +00:00
|
|
|
~HostRoomWindow();
|
2018-01-19 13:42:21 +00:00
|
|
|
|
2019-04-20 04:38:19 +00:00
|
|
|
/**
|
|
|
|
* Updates the dialog with a new game list model.
|
|
|
|
* This model should be the original model of the game list.
|
|
|
|
*/
|
|
|
|
void UpdateGameList(QStandardItemModel* list);
|
2018-10-09 15:08:33 +00:00
|
|
|
void RetranslateUi();
|
|
|
|
|
2018-01-19 13:42:21 +00:00
|
|
|
private:
|
|
|
|
void Host();
|
2018-10-27 07:49:00 +00:00
|
|
|
std::unique_ptr<Network::VerifyUser::Backend> CreateVerifyBackend(bool use_validation) const;
|
2018-01-19 13:42:21 +00:00
|
|
|
|
|
|
|
std::weak_ptr<Core::AnnounceMultiplayerSession> announce_multiplayer_session;
|
|
|
|
QStandardItemModel* game_list;
|
|
|
|
ComboBoxProxyModel* proxy;
|
2018-04-18 05:06:02 +00:00
|
|
|
std::unique_ptr<Ui::HostRoom> ui;
|
2018-04-18 16:29:03 +00:00
|
|
|
Validation validation;
|
2018-01-19 13:42:21 +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;
|
|
|
|
};
|