mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-09-21 09:05:10 -07:00
[DeckShare] Create temporary share links for local and server decks
This commit is contained in:
parent
45fec7fc74
commit
d91fe34d20
26 changed files with 967 additions and 15 deletions
|
|
@ -0,0 +1,28 @@
|
|||
#include "deck_share_utils.h"
|
||||
|
||||
#include <QClipboard>
|
||||
#include <QGuiApplication>
|
||||
#include <QTimeZone>
|
||||
#include <libcockatrice/network/client/abstract/abstract_client.h>
|
||||
|
||||
namespace DeckShareUtils
|
||||
{
|
||||
|
||||
QString buildShareLink(const AbstractClient *client, const QString &token)
|
||||
{
|
||||
return QString("cockatrice://opendeck?share=%1&hostname=%2&port=%3")
|
||||
.arg(token, client->serverName(), QString::number(client->serverPort()));
|
||||
}
|
||||
|
||||
QString copyShareLinkToClipboard(const QString &link)
|
||||
{
|
||||
QGuiApplication::clipboard()->setText(link);
|
||||
return link;
|
||||
}
|
||||
|
||||
QString formatShareExpiry(const QDateTime &expiry)
|
||||
{
|
||||
return expiry.toLocalTime().toString();
|
||||
}
|
||||
|
||||
} // namespace DeckShareUtils
|
||||
Loading…
Add table
Add a link
Reference in a new issue