mirror of
https://github.com/citra-emu/citra.git
synced 2024-11-24 08:31:05 +00:00
8b8b39ec0e
The user would be notified if the message contains "@" followed by the user's nickname or forum username. An alert would be shown, and the icon and message in the status bar would be changed. All notification is only shown if the chat window currently does not have focus. Also added a connected_notification icon for showing in the status bar.
79 lines
2.3 KiB
C++
79 lines
2.3 KiB
C++
// Copyright 2018 Citra Emulator Project
|
|
// Licensed under GPLv2 or any later version
|
|
// Refer to the license.txt file included.
|
|
|
|
#pragma once
|
|
|
|
#include <QWidget>
|
|
#include "core/announce_multiplayer_session.h"
|
|
#include "network/network.h"
|
|
|
|
class QStandardItemModel;
|
|
class Lobby;
|
|
class HostRoomWindow;
|
|
class ClientRoomWindow;
|
|
class DirectConnectWindow;
|
|
class ClickableLabel;
|
|
|
|
class MultiplayerState : public QWidget {
|
|
Q_OBJECT;
|
|
|
|
public:
|
|
explicit MultiplayerState(QWidget* parent, QStandardItemModel* game_list, QAction* leave_room,
|
|
QAction* show_room);
|
|
~MultiplayerState();
|
|
|
|
/**
|
|
* Close all open multiplayer related dialogs
|
|
*/
|
|
void Close();
|
|
|
|
ClickableLabel* GetStatusText() const {
|
|
return status_text;
|
|
}
|
|
|
|
ClickableLabel* GetStatusIcon() const {
|
|
return status_icon;
|
|
}
|
|
|
|
void retranslateUi();
|
|
|
|
public slots:
|
|
void OnNetworkStateChanged(const Network::RoomMember::State& state);
|
|
void OnNetworkError(const Network::RoomMember::Error& error);
|
|
void OnViewLobby();
|
|
void OnCreateRoom();
|
|
bool OnCloseRoom();
|
|
void OnOpenNetworkRoom();
|
|
void OnDirectConnectToRoom();
|
|
void OnAnnounceFailed(const Common::WebResult&);
|
|
void UpdateThemedIcons();
|
|
void ShowNotification();
|
|
void HideNotification();
|
|
|
|
signals:
|
|
void NetworkStateChanged(const Network::RoomMember::State&);
|
|
void NetworkError(const Network::RoomMember::Error&);
|
|
void AnnounceFailed(const Common::WebResult&);
|
|
|
|
private:
|
|
Lobby* lobby = nullptr;
|
|
HostRoomWindow* host_room = nullptr;
|
|
ClientRoomWindow* client_room = nullptr;
|
|
DirectConnectWindow* direct_connect = nullptr;
|
|
ClickableLabel* status_icon = nullptr;
|
|
ClickableLabel* status_text = nullptr;
|
|
QStandardItemModel* game_list_model = nullptr;
|
|
QAction* leave_room;
|
|
QAction* show_room;
|
|
std::shared_ptr<Core::AnnounceMultiplayerSession> announce_multiplayer_session;
|
|
Network::RoomMember::State current_state = Network::RoomMember::State::Uninitialized;
|
|
bool has_mod_perms = false;
|
|
Network::RoomMember::CallbackHandle<Network::RoomMember::State> state_callback_handle;
|
|
Network::RoomMember::CallbackHandle<Network::RoomMember::Error> error_callback_handle;
|
|
|
|
bool show_notification = false;
|
|
};
|
|
|
|
Q_DECLARE_METATYPE(Common::WebResult);
|