Cockatrice/cockatrice/src/client/tabs/tab_replays.h
RickyRister ab4373d025
Some checks failed
Build Desktop / Configure (push) Has been cancelled
Build Docker Image / amd64 & arm64 (push) Has been cancelled
Build Desktop / ${{matrix.distro}} ${{matrix.version}} (Debian, DEB, 13) (push) Has been cancelled
Build Desktop / ${{matrix.distro}} ${{matrix.version}} (Debian, DEB, skip, 11) (push) Has been cancelled
Build Desktop / ${{matrix.distro}} ${{matrix.version}} (Debian, DEB, skip, 12) (push) Has been cancelled
Build Desktop / ${{matrix.distro}} ${{matrix.version}} (Fedora, RPM, 42) (push) Has been cancelled
Build Desktop / ${{matrix.distro}} ${{matrix.version}} (Fedora, RPM, skip, 41) (push) Has been cancelled
Build Desktop / ${{matrix.distro}} ${{matrix.version}} (Ubuntu, DEB, 24.04) (push) Has been cancelled
Build Desktop / ${{matrix.distro}} ${{matrix.version}} (Ubuntu, DEB, skip, 22.04) (push) Has been cancelled
Build Desktop / ${{matrix.distro}} ${{matrix.version}} (yes, Arch, skip) (push) Has been cancelled
Build Desktop / macOS ${{matrix.target}}${{ matrix.soc == 'Intel' && ' Intel' || '' }}${{ matrix.type == 'Debug' && ' Debug' || '' }} (1, macos-13, Intel, 13, Release, 14.3.1) (push) Has been cancelled
Build Desktop / macOS ${{matrix.target}}${{ matrix.soc == 'Intel' && ' Intel' || '' }}${{ matrix.type == 'Debug' && ' Debug' || '' }} (1, macos-14, Apple, 14, Release, 15.4) (push) Has been cancelled
Build Desktop / macOS ${{matrix.target}}${{ matrix.soc == 'Intel' && ' Intel' || '' }}${{ matrix.type == 'Debug' && ' Debug' || '' }} (1, macos-15, Apple, 15, Release, 16.2) (push) Has been cancelled
Build Desktop / macOS ${{matrix.target}}${{ matrix.soc == 'Intel' && ' Intel' || '' }}${{ matrix.type == 'Debug' && ' Debug' || '' }} (macos-15, Apple, 15, Debug, 16.2) (push) Has been cancelled
Build Desktop / Windows ${{matrix.target}} (msvc2019_64, 5.15.*, 7) (push) Has been cancelled
Build Desktop / Windows ${{matrix.target}} (msvc2019_64, qtimageformats qtmultimedia qtwebsockets, 6.6.*, 10) (push) Has been cancelled
Implement replay sharing (#6066)
* new protos

* implement commands on server

* add buttons

* icons

* run formatter

* Message on get replay code failure

* Add new commands to switch statement

* Better failure messages

* Fix permission check query

* Change hash method

* Prevent adding duplicate replays

* Clean up TabReplay ui

* Copy over replay name

* base64 encode the hash

* Shorten hash

* Better failure messages

* change icon back to search icon

* check hash before checking if user already has access

* update share icon

* Update label text
2025-08-24 22:40:44 -04:00

86 lines
2.5 KiB
C++

#ifndef TAB_REPLAYS_H
#define TAB_REPLAYS_H
#include "../../server/abstract_client.h"
#include "tab.h"
class ServerInfo_User;
class Response;
class AbstractClient;
class QTreeView;
class QFileSystemModel;
class QToolBar;
class QGroupBox;
class RemoteReplayList_TreeWidget;
class GameReplay;
class Event_ReplayAdded;
class CommandContainer;
class TabReplays : public Tab
{
Q_OBJECT
private:
AbstractClient *client;
QTreeView *localDirView;
QFileSystemModel *localDirModel;
RemoteReplayList_TreeWidget *serverDirView;
QGroupBox *leftGroupBox, *rightGroupBox;
QAction *aOpenLocalReplay, *aRenameLocal, *aNewLocalFolder, *aDeleteLocalReplay;
QAction *aOpenReplaysFolder;
QAction *aOpenRemoteReplay, *aDownload, *aKeep, *aDeleteRemoteReplay, *aGetReplayCode;
QAction *aSubmitReplayCode;
QGroupBox *createLeftLayout();
QGroupBox *createRightLayout();
void setRemoteEnabled(bool enabled);
void downloadNodeAtIndex(const QModelIndex &curLeft, const QModelIndex &curRight);
private slots:
void handleConnected(const ServerInfo_User &userInfo);
void handleConnectionChanged(ClientStatus status);
void actLocalDoubleClick(const QModelIndex &curLeft);
void actRenameLocal();
void actOpenLocalReplay();
void actNewLocalFolder();
void actDeleteLocalReplay();
void actOpenReplaysFolder();
void actRemoteDoubleClick(const QModelIndex &curLeft);
void actOpenRemoteReplay();
void openRemoteReplayFinished(const Response &r);
void actDownload();
void downloadFinished(const Response &r, const CommandContainer &commandContainer, const QVariant &extraData);
void actKeepRemoteReplay();
void keepRemoteReplayFinished(const Response &r, const CommandContainer &commandContainer);
void actDeleteRemoteReplay();
void deleteRemoteReplayFinished(const Response &r, const CommandContainer &commandContainer);
void actGetReplayCode();
void getReplayCodeFinished(const Response &r, const CommandContainer &commandContainer);
void actSubmitReplayCode();
void submitReplayCodeFinished(const Response &r, const CommandContainer &commandContainer);
void replayAddedEventReceived(const Event_ReplayAdded &event);
signals:
void openReplay(GameReplay *replay);
public:
TabReplays(TabSupervisor *_tabSupervisor, AbstractClient *_client, const ServerInfo_User *currentUserInfo);
void retranslateUi() override;
QString getTabText() const override
{
return tr("Game Replays");
}
};
#endif