mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-14 22:42:14 -07:00
implement functionality
This commit is contained in:
parent
335c396608
commit
c6fcb5be1d
4 changed files with 20 additions and 5 deletions
|
|
@ -356,7 +356,7 @@ void TabEdhRecMain::processAverageDeckResponse(QJsonObject reply)
|
||||||
{
|
{
|
||||||
EdhrecAverageDeckApiResponse deckData;
|
EdhrecAverageDeckApiResponse deckData;
|
||||||
deckData.fromJson(reply);
|
deckData.fromJson(reply);
|
||||||
tabSupervisor->addVisualDeckEditorTab(deckData.deck.deckLoader);
|
tabSupervisor->openDeckInNewTab(deckData.deck.deckLoader);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TabEdhRecMain::prettyPrintJson(const QJsonValue &value, int indentLevel)
|
void TabEdhRecMain::prettyPrintJson(const QJsonValue &value, int indentLevel)
|
||||||
|
|
|
||||||
|
|
@ -590,7 +590,7 @@ void TabSupervisor::actTabDeckStorage(bool checked)
|
||||||
void TabSupervisor::openTabDeckStorage()
|
void TabSupervisor::openTabDeckStorage()
|
||||||
{
|
{
|
||||||
tabDeckStorage = new TabDeckStorage(this, client, userInfo);
|
tabDeckStorage = new TabDeckStorage(this, client, userInfo);
|
||||||
connect(tabDeckStorage, &TabDeckStorage::openDeckEditor, this, &TabSupervisor::addDeckEditorTab);
|
connect(tabDeckStorage, &TabDeckStorage::openDeckEditor, this, &TabSupervisor::openDeckInNewTab);
|
||||||
myAddTab(tabDeckStorage, aTabDeckStorage);
|
myAddTab(tabDeckStorage, aTabDeckStorage);
|
||||||
connect(tabDeckStorage, &Tab::closed, this, [this] {
|
connect(tabDeckStorage, &Tab::closed, this, [this] {
|
||||||
tabDeckStorage = nullptr;
|
tabDeckStorage = nullptr;
|
||||||
|
|
@ -691,7 +691,7 @@ void TabSupervisor::gameJoined(const Event_GameJoined &event)
|
||||||
auto *tab = new TabGame(this, QList<AbstractClient *>() << client, event, roomGameTypes);
|
auto *tab = new TabGame(this, QList<AbstractClient *>() << client, event, roomGameTypes);
|
||||||
connect(tab, &TabGame::gameClosing, this, &TabSupervisor::gameLeft);
|
connect(tab, &TabGame::gameClosing, this, &TabSupervisor::gameLeft);
|
||||||
connect(tab, &TabGame::openMessageDialog, this, &TabSupervisor::addMessageTab);
|
connect(tab, &TabGame::openMessageDialog, this, &TabSupervisor::addMessageTab);
|
||||||
connect(tab, &TabGame::openDeckEditor, this, &TabSupervisor::addDeckEditorTab);
|
connect(tab, &TabGame::openDeckEditor, this, &TabSupervisor::openDeckInNewTab);
|
||||||
myAddTab(tab);
|
myAddTab(tab);
|
||||||
gameTabs.insert(event.game_info().game_id(), tab);
|
gameTabs.insert(event.game_info().game_id(), tab);
|
||||||
setCurrentWidget(tab);
|
setCurrentWidget(tab);
|
||||||
|
|
@ -701,7 +701,7 @@ void TabSupervisor::localGameJoined(const Event_GameJoined &event)
|
||||||
{
|
{
|
||||||
auto *tab = new TabGame(this, localClients, event, QMap<int, QString>());
|
auto *tab = new TabGame(this, localClients, event, QMap<int, QString>());
|
||||||
connect(tab, &TabGame::gameClosing, this, &TabSupervisor::gameLeft);
|
connect(tab, &TabGame::gameClosing, this, &TabSupervisor::gameLeft);
|
||||||
connect(tab, &TabGame::openDeckEditor, this, &TabSupervisor::addDeckEditorTab);
|
connect(tab, &TabGame::openDeckEditor, this, &TabSupervisor::openDeckInNewTab);
|
||||||
myAddTab(tab);
|
myAddTab(tab);
|
||||||
gameTabs.insert(event.game_info().game_id(), tab);
|
gameTabs.insert(event.game_info().game_id(), tab);
|
||||||
setCurrentWidget(tab);
|
setCurrentWidget(tab);
|
||||||
|
|
@ -807,6 +807,20 @@ void TabSupervisor::talkLeft(TabMessage *tab)
|
||||||
removeTab(indexOf(tab));
|
removeTab(indexOf(tab));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new deck editor tab and loads the deck into it.
|
||||||
|
* Creates either a classic or visual deck editor tab depending on settings
|
||||||
|
* @param deckToOpen The deck to open in the tab. Creates a copy of the DeckLoader instance.
|
||||||
|
*/
|
||||||
|
void TabSupervisor::openDeckInNewTab(const DeckLoader *deckToOpen)
|
||||||
|
{
|
||||||
|
if (SettingsCache::instance().getOpenInVisualDeckEditor()) {
|
||||||
|
addVisualDeckEditorTab(deckToOpen);
|
||||||
|
} else {
|
||||||
|
addDeckEditorTab(deckToOpen);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new deck editor tab
|
* Creates a new deck editor tab
|
||||||
* @param deckToOpen The deck to open in the tab. Creates a copy of the DeckLoader instance.
|
* @param deckToOpen The deck to open in the tab. Creates a copy of the DeckLoader instance.
|
||||||
|
|
|
||||||
|
|
@ -152,6 +152,7 @@ signals:
|
||||||
void showWindowIfHidden();
|
void showWindowIfHidden();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
void openDeckInNewTab(const DeckLoader *deckToOpen);
|
||||||
TabDeckEditor *addDeckEditorTab(const DeckLoader *deckToOpen);
|
TabDeckEditor *addDeckEditorTab(const DeckLoader *deckToOpen);
|
||||||
TabDeckEditorVisual *addVisualDeckEditorTab(const DeckLoader *deckToOpen);
|
TabDeckEditorVisual *addVisualDeckEditorTab(const DeckLoader *deckToOpen);
|
||||||
TabVisualDatabaseDisplay *addVisualDatabaseDisplayTab();
|
TabVisualDatabaseDisplay *addVisualDatabaseDisplayTab();
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@
|
||||||
TabDeckStorageVisual::TabDeckStorageVisual(TabSupervisor *_tabSupervisor)
|
TabDeckStorageVisual::TabDeckStorageVisual(TabSupervisor *_tabSupervisor)
|
||||||
: Tab(_tabSupervisor), visualDeckStorageWidget(new VisualDeckStorageWidget(this))
|
: Tab(_tabSupervisor), visualDeckStorageWidget(new VisualDeckStorageWidget(this))
|
||||||
{
|
{
|
||||||
connect(this, &TabDeckStorageVisual::openDeckEditor, tabSupervisor, &TabSupervisor::addVisualDeckEditorTab);
|
connect(this, &TabDeckStorageVisual::openDeckEditor, tabSupervisor, &TabSupervisor::openDeckInNewTab);
|
||||||
connect(visualDeckStorageWidget, &VisualDeckStorageWidget::deckLoadRequested, this,
|
connect(visualDeckStorageWidget, &VisualDeckStorageWidget::deckLoadRequested, this,
|
||||||
&TabDeckStorageVisual::actOpenLocalDeck);
|
&TabDeckStorageVisual::actOpenLocalDeck);
|
||||||
connect(visualDeckStorageWidget, &VisualDeckStorageWidget::openDeckEditor, this,
|
connect(visualDeckStorageWidget, &VisualDeckStorageWidget::openDeckEditor, this,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue