mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-09-21 09:05:10 -07:00
[DeckShare] Use the stable server client for the visual deck storage tab
This commit is contained in:
parent
bb06de724f
commit
4b870fdf06
3 changed files with 8 additions and 8 deletions
|
|
@ -672,7 +672,7 @@ void TabSupervisor::actTabVisualDeckStorage(bool checked)
|
|||
|
||||
void TabSupervisor::openTabVisualDeckStorage()
|
||||
{
|
||||
tabVisualDeckStorage = new TabDeckStorageVisual(this);
|
||||
tabVisualDeckStorage = new TabDeckStorageVisual(this, client);
|
||||
myAddTab(tabVisualDeckStorage, aTabVisualDeckStorage);
|
||||
connect(tabVisualDeckStorage, &QObject::destroyed, this, [this] {
|
||||
tabVisualDeckStorage = nullptr;
|
||||
|
|
|
|||
|
|
@ -17,8 +17,8 @@
|
|||
#include <libcockatrice/protocol/pb/response_deck_share_create.pb.h>
|
||||
#include <libcockatrice/protocol/pending_command.h>
|
||||
|
||||
TabDeckStorageVisual::TabDeckStorageVisual(TabSupervisor *_tabSupervisor)
|
||||
: Tab(_tabSupervisor), visualDeckStorageWidget(new VisualDeckStorageWidget(this))
|
||||
TabDeckStorageVisual::TabDeckStorageVisual(TabSupervisor *_tabSupervisor, AbstractClient *_client)
|
||||
: Tab(_tabSupervisor), client(_client), visualDeckStorageWidget(new VisualDeckStorageWidget(this))
|
||||
{
|
||||
connect(this, &TabDeckStorageVisual::openDeckEditor, tabSupervisor, &TabSupervisor::openDeckInNewTab);
|
||||
connect(visualDeckStorageWidget, &VisualDeckStorageWidget::deckLoadRequested, this,
|
||||
|
|
@ -35,7 +35,6 @@ TabDeckStorageVisual::TabDeckStorageVisual(TabSupervisor *_tabSupervisor)
|
|||
}
|
||||
});
|
||||
|
||||
AbstractClient *client = tabSupervisor->getClient();
|
||||
connect(client, &AbstractClient::statusChanged, this, &TabDeckStorageVisual::handleConnectionChanged);
|
||||
shareDeckAvailable = (client->getStatus() == StatusLoggedIn);
|
||||
visualDeckStorageWidget->setShareAvailable(shareDeckAvailable);
|
||||
|
|
@ -152,9 +151,9 @@ void TabDeckStorageVisual::actShareSelected()
|
|||
}
|
||||
|
||||
shareBar->setCreateEnabled(false);
|
||||
PendingCommand *pend = tabSupervisor->getClient()->prepareSessionCommand(cmd);
|
||||
PendingCommand *pend = client->prepareSessionCommand(cmd);
|
||||
connect(pend, &PendingCommand::finished, this, &TabDeckStorageVisual::shareFinished);
|
||||
tabSupervisor->getClient()->sendCommand(pend);
|
||||
client->sendCommand(pend);
|
||||
}
|
||||
|
||||
void TabDeckStorageVisual::shareFinished(const Response &response, const CommandContainer & /*commandContainer*/)
|
||||
|
|
@ -175,7 +174,7 @@ void TabDeckStorageVisual::shareFinished(const Response &response, const Command
|
|||
const QDateTime expiry = QDateTime::fromSecsSinceEpoch(resp.expires_at(), Qt::UTC);
|
||||
#endif
|
||||
|
||||
const QString link = DeckShareUtils::buildShareLink(tabSupervisor->getClient(), token);
|
||||
const QString link = DeckShareUtils::buildShareLink(client, token);
|
||||
DeckShareUtils::copyShareLinkToClipboard(link);
|
||||
|
||||
showShareNotice(
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ class TabDeckStorageVisual final : public Tab
|
|||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit TabDeckStorageVisual(TabSupervisor *_tabSupervisor);
|
||||
explicit TabDeckStorageVisual(TabSupervisor *_tabSupervisor, AbstractClient *_client);
|
||||
void retranslateUi() override;
|
||||
|
||||
[[nodiscard]] QString getTabText() const override
|
||||
|
|
@ -73,6 +73,7 @@ private:
|
|||
VisualDeckStorageWidget *visualDeckStorageWidget;
|
||||
|
||||
ShareBarWidget *shareBar;
|
||||
AbstractClient *client;
|
||||
bool shareDeckAvailable = false;
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue