mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-01 11:03:54 -07:00
General Cleanup of Unused Assets (#5484)
This commit is contained in:
parent
7b94d5d501
commit
0cbad25385
8 changed files with 126 additions and 200 deletions
|
|
@ -16,7 +16,6 @@
|
||||||
#include "tab_supervisor.h"
|
#include "tab_supervisor.h"
|
||||||
#include "trice_limits.h"
|
#include "trice_limits.h"
|
||||||
|
|
||||||
#include <QHBoxLayout>
|
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
|
|
||||||
|
|
@ -44,72 +43,74 @@ TabAccount::TabAccount(TabSupervisor *_tabSupervisor, AbstractClient *_client, c
|
||||||
buddyListReceived(tabSupervisor->getUserListManager()->getBuddyList().values());
|
buddyListReceived(tabSupervisor->getUserListManager()->getBuddyList().values());
|
||||||
ignoreListReceived(tabSupervisor->getUserListManager()->getIgnoreList().values());
|
ignoreListReceived(tabSupervisor->getUserListManager()->getIgnoreList().values());
|
||||||
|
|
||||||
PendingCommand *pend = client->prepareSessionCommand(Command_ListUsers());
|
PendingCommand *pend = AbstractClient::prepareSessionCommand(Command_ListUsers());
|
||||||
connect(pend, &PendingCommand::finished, this, &TabAccount::processListUsersResponse);
|
connect(pend, &PendingCommand::finished, this, &TabAccount::processListUsersResponse);
|
||||||
client->sendCommand(pend);
|
client->sendCommand(pend);
|
||||||
|
|
||||||
QVBoxLayout *vbox = new QVBoxLayout;
|
auto *vbox = new QVBoxLayout;
|
||||||
vbox->addWidget(userInfoBox);
|
vbox->addWidget(userInfoBox);
|
||||||
vbox->addWidget(allUsersList);
|
vbox->addWidget(allUsersList);
|
||||||
|
|
||||||
QHBoxLayout *addToBuddyList = new QHBoxLayout;
|
auto *addToBuddyList = new QHBoxLayout;
|
||||||
addBuddyEdit = new LineEditUnfocusable;
|
addBuddyEdit = new LineEditUnfocusable;
|
||||||
addBuddyEdit->setMaxLength(MAX_NAME_LENGTH);
|
addBuddyEdit->setMaxLength(MAX_NAME_LENGTH);
|
||||||
addBuddyEdit->setPlaceholderText(tr("Add to Buddy List"));
|
addBuddyEdit->setPlaceholderText(tr("Add to Buddy List"));
|
||||||
connect(addBuddyEdit, &LineEditUnfocusable::returnPressed, this, &TabAccount::addToBuddyList);
|
connect(addBuddyEdit, &LineEditUnfocusable::returnPressed, this, &TabAccount::addToBuddyList);
|
||||||
QPushButton *addBuddyButton = new QPushButton("Add");
|
auto *addBuddyButton = new QPushButton("Add");
|
||||||
connect(addBuddyButton, &QPushButton::clicked, this, &TabAccount::addToBuddyList);
|
connect(addBuddyButton, &QPushButton::clicked, this, &TabAccount::addToBuddyList);
|
||||||
addToBuddyList->addWidget(addBuddyEdit);
|
addToBuddyList->addWidget(addBuddyEdit);
|
||||||
addToBuddyList->addWidget(addBuddyButton);
|
addToBuddyList->addWidget(addBuddyButton);
|
||||||
|
|
||||||
QHBoxLayout *addToIgnoreList = new QHBoxLayout;
|
auto *addToIgnoreList = new QHBoxLayout;
|
||||||
addIgnoreEdit = new LineEditUnfocusable;
|
addIgnoreEdit = new LineEditUnfocusable;
|
||||||
addIgnoreEdit->setMaxLength(MAX_NAME_LENGTH);
|
addIgnoreEdit->setMaxLength(MAX_NAME_LENGTH);
|
||||||
addIgnoreEdit->setPlaceholderText(tr("Add to Ignore List"));
|
addIgnoreEdit->setPlaceholderText(tr("Add to Ignore List"));
|
||||||
connect(addIgnoreEdit, &LineEditUnfocusable::returnPressed, this, &TabAccount::addToIgnoreList);
|
connect(addIgnoreEdit, &LineEditUnfocusable::returnPressed, this, &TabAccount::addToIgnoreList);
|
||||||
QPushButton *addIgnoreButton = new QPushButton("Add");
|
auto *addIgnoreButton = new QPushButton("Add");
|
||||||
connect(addIgnoreButton, &QPushButton::clicked, this, &TabAccount::addToIgnoreList);
|
connect(addIgnoreButton, &QPushButton::clicked, this, &TabAccount::addToIgnoreList);
|
||||||
addToIgnoreList->addWidget(addIgnoreEdit);
|
addToIgnoreList->addWidget(addIgnoreEdit);
|
||||||
addToIgnoreList->addWidget(addIgnoreButton);
|
addToIgnoreList->addWidget(addIgnoreButton);
|
||||||
|
|
||||||
QVBoxLayout *buddyPanel = new QVBoxLayout;
|
auto *buddyPanel = new QVBoxLayout;
|
||||||
buddyPanel->addWidget(buddyList);
|
buddyPanel->addWidget(buddyList);
|
||||||
buddyPanel->addLayout(addToBuddyList);
|
buddyPanel->addLayout(addToBuddyList);
|
||||||
|
|
||||||
QVBoxLayout *ignorePanel = new QVBoxLayout;
|
auto *ignorePanel = new QVBoxLayout;
|
||||||
ignorePanel->addWidget(ignoreList);
|
ignorePanel->addWidget(ignoreList);
|
||||||
ignorePanel->addLayout(addToIgnoreList);
|
ignorePanel->addLayout(addToIgnoreList);
|
||||||
|
|
||||||
QHBoxLayout *mainLayout = new QHBoxLayout;
|
auto *mainLayout = new QHBoxLayout;
|
||||||
mainLayout->addLayout(buddyPanel);
|
mainLayout->addLayout(buddyPanel);
|
||||||
mainLayout->addLayout(ignorePanel);
|
mainLayout->addLayout(ignorePanel);
|
||||||
mainLayout->addLayout(vbox);
|
mainLayout->addLayout(vbox);
|
||||||
|
|
||||||
retranslateUi();
|
retranslateUi();
|
||||||
|
|
||||||
QWidget *mainWidget = new QWidget(this);
|
auto *mainWidget = new QWidget(this);
|
||||||
mainWidget->setLayout(mainLayout);
|
mainWidget->setLayout(mainLayout);
|
||||||
setCentralWidget(mainWidget);
|
setCentralWidget(mainWidget);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TabAccount::addToBuddyList()
|
void TabAccount::addToBuddyList()
|
||||||
{
|
{
|
||||||
QString userName = addBuddyEdit->text();
|
const QString &userName = addBuddyEdit->text();
|
||||||
if (userName.length() < 1)
|
if (userName.isEmpty()) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
std::string listName = "buddy";
|
const std::string listName = "buddy";
|
||||||
addToList(listName, userName);
|
addToList(listName, userName);
|
||||||
addBuddyEdit->clear();
|
addBuddyEdit->clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TabAccount::addToIgnoreList()
|
void TabAccount::addToIgnoreList()
|
||||||
{
|
{
|
||||||
QString userName = addIgnoreEdit->text();
|
const QString &userName = addIgnoreEdit->text();
|
||||||
if (userName.length() < 1)
|
if (userName.isEmpty()) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
std::string listName = "ignore";
|
const std::string listName = "ignore";
|
||||||
addToList(listName, userName);
|
addToList(listName, userName);
|
||||||
addIgnoreEdit->clear();
|
addIgnoreEdit->clear();
|
||||||
}
|
}
|
||||||
|
|
@ -120,7 +121,7 @@ void TabAccount::addToList(const std::string &listName, const QString &userName)
|
||||||
cmd.set_list(listName);
|
cmd.set_list(listName);
|
||||||
cmd.set_user_name(userName.toStdString());
|
cmd.set_user_name(userName.toStdString());
|
||||||
|
|
||||||
client->sendCommand(client->prepareSessionCommand(cmd));
|
client->sendCommand(AbstractClient::prepareSessionCommand(cmd));
|
||||||
}
|
}
|
||||||
|
|
||||||
void TabAccount::retranslateUi()
|
void TabAccount::retranslateUi()
|
||||||
|
|
@ -134,11 +135,9 @@ void TabAccount::retranslateUi()
|
||||||
void TabAccount::processListUsersResponse(const Response &response)
|
void TabAccount::processListUsersResponse(const Response &response)
|
||||||
{
|
{
|
||||||
const Response_ListUsers &resp = response.GetExtension(Response_ListUsers::ext);
|
const Response_ListUsers &resp = response.GetExtension(Response_ListUsers::ext);
|
||||||
|
for (int i = 0; i < resp.user_list_size(); ++i) {
|
||||||
const int userListSize = resp.user_list_size();
|
|
||||||
for (int i = 0; i < userListSize; ++i) {
|
|
||||||
const ServerInfo_User &info = resp.user_list(i);
|
const ServerInfo_User &info = resp.user_list(i);
|
||||||
const QString userName = QString::fromStdString(info.name());
|
const QString &userName = QString::fromStdString(info.name());
|
||||||
allUsersList->processUserInfo(info, true);
|
allUsersList->processUserInfo(info, true);
|
||||||
ignoreList->setUserOnline(userName, true);
|
ignoreList->setUserOnline(userName, true);
|
||||||
buddyList->setUserOnline(userName, true);
|
buddyList->setUserOnline(userName, true);
|
||||||
|
|
@ -152,7 +151,7 @@ void TabAccount::processListUsersResponse(const Response &response)
|
||||||
void TabAccount::processUserJoinedEvent(const Event_UserJoined &event)
|
void TabAccount::processUserJoinedEvent(const Event_UserJoined &event)
|
||||||
{
|
{
|
||||||
const ServerInfo_User &info = event.user_info();
|
const ServerInfo_User &info = event.user_info();
|
||||||
const QString userName = QString::fromStdString(info.name());
|
const QString &userName = QString::fromStdString(info.name());
|
||||||
|
|
||||||
allUsersList->processUserInfo(info, true);
|
allUsersList->processUserInfo(info, true);
|
||||||
ignoreList->setUserOnline(userName, true);
|
ignoreList->setUserOnline(userName, true);
|
||||||
|
|
@ -162,18 +161,20 @@ void TabAccount::processUserJoinedEvent(const Event_UserJoined &event)
|
||||||
ignoreList->sortItems();
|
ignoreList->sortItems();
|
||||||
buddyList->sortItems();
|
buddyList->sortItems();
|
||||||
|
|
||||||
if (buddyList->getUsers().keys().contains(userName))
|
if (buddyList->getUsers().keys().contains(userName)) {
|
||||||
soundEngine->playSound("buddy_join");
|
soundEngine->playSound("buddy_join");
|
||||||
|
}
|
||||||
|
|
||||||
emit userJoined(info);
|
emit userJoined(info);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TabAccount::processUserLeftEvent(const Event_UserLeft &event)
|
void TabAccount::processUserLeftEvent(const Event_UserLeft &event)
|
||||||
{
|
{
|
||||||
QString userName = QString::fromStdString(event.name());
|
const QString &userName = QString::fromStdString(event.name());
|
||||||
|
|
||||||
if (buddyList->getUsers().keys().contains(userName))
|
if (buddyList->getUsers().keys().contains(userName)) {
|
||||||
soundEngine->playSound("buddy_leave");
|
soundEngine->playSound("buddy_leave");
|
||||||
|
}
|
||||||
|
|
||||||
if (allUsersList->deleteUser(userName)) {
|
if (allUsersList->deleteUser(userName)) {
|
||||||
ignoreList->setUserOnline(userName, false);
|
ignoreList->setUserOnline(userName, false);
|
||||||
|
|
@ -187,30 +188,34 @@ void TabAccount::processUserLeftEvent(const Event_UserLeft &event)
|
||||||
|
|
||||||
void TabAccount::buddyListReceived(const QList<ServerInfo_User> &_buddyList)
|
void TabAccount::buddyListReceived(const QList<ServerInfo_User> &_buddyList)
|
||||||
{
|
{
|
||||||
for (const auto &user : _buddyList)
|
for (const auto &user : _buddyList) {
|
||||||
buddyList->processUserInfo(user, false);
|
buddyList->processUserInfo(user, false);
|
||||||
|
}
|
||||||
buddyList->sortItems();
|
buddyList->sortItems();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TabAccount::ignoreListReceived(const QList<ServerInfo_User> &_ignoreList)
|
void TabAccount::ignoreListReceived(const QList<ServerInfo_User> &_ignoreList)
|
||||||
{
|
{
|
||||||
for (const auto &user : _ignoreList)
|
for (const auto &user : _ignoreList) {
|
||||||
ignoreList->processUserInfo(user, false);
|
ignoreList->processUserInfo(user, false);
|
||||||
|
}
|
||||||
ignoreList->sortItems();
|
ignoreList->sortItems();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TabAccount::processAddToListEvent(const Event_AddToList &event)
|
void TabAccount::processAddToListEvent(const Event_AddToList &event)
|
||||||
{
|
{
|
||||||
const ServerInfo_User &info = event.user_info();
|
const ServerInfo_User &info = event.user_info();
|
||||||
bool online = allUsersList->getUsers().contains(QString::fromStdString(info.name()));
|
const bool online = allUsersList->getUsers().contains(QString::fromStdString(info.name()));
|
||||||
QString list = QString::fromStdString(event.list_name());
|
const QString &list = QString::fromStdString(event.list_name());
|
||||||
UserListWidget *userList = 0;
|
|
||||||
if (list == "buddy")
|
UserListWidget *userList;
|
||||||
|
if (list == "buddy") {
|
||||||
userList = buddyList;
|
userList = buddyList;
|
||||||
else if (list == "ignore")
|
} else if (list == "ignore") {
|
||||||
userList = ignoreList;
|
userList = ignoreList;
|
||||||
if (!userList)
|
} else {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
userList->processUserInfo(info, online);
|
userList->processUserInfo(info, online);
|
||||||
userList->sortItems();
|
userList->sortItems();
|
||||||
|
|
@ -218,14 +223,17 @@ void TabAccount::processAddToListEvent(const Event_AddToList &event)
|
||||||
|
|
||||||
void TabAccount::processRemoveFromListEvent(const Event_RemoveFromList &event)
|
void TabAccount::processRemoveFromListEvent(const Event_RemoveFromList &event)
|
||||||
{
|
{
|
||||||
QString list = QString::fromStdString(event.list_name());
|
const auto &list = QString::fromStdString(event.list_name());
|
||||||
QString user = QString::fromStdString(event.user_name());
|
const auto &user = QString::fromStdString(event.user_name());
|
||||||
UserListWidget *userList = 0;
|
|
||||||
if (list == "buddy")
|
UserListWidget *userList;
|
||||||
|
if (list == "buddy") {
|
||||||
userList = buddyList;
|
userList = buddyList;
|
||||||
else if (list == "ignore")
|
} else if (list == "ignore") {
|
||||||
userList = ignoreList;
|
userList = ignoreList;
|
||||||
if (!userList)
|
} else {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
userList->deleteUser(user);
|
userList->deleteUser(user);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,17 +5,16 @@
|
||||||
#include "tab.h"
|
#include "tab.h"
|
||||||
|
|
||||||
class AbstractClient;
|
class AbstractClient;
|
||||||
class UserListWidget;
|
class Event_AddToList;
|
||||||
class UserInfoBox;
|
|
||||||
class LineEditUnfocusable;
|
|
||||||
|
|
||||||
class Event_ListRooms;
|
class Event_ListRooms;
|
||||||
|
class Event_RemoveFromList;
|
||||||
class Event_UserJoined;
|
class Event_UserJoined;
|
||||||
class Event_UserLeft;
|
class Event_UserLeft;
|
||||||
|
class LineEditUnfocusable;
|
||||||
class Response;
|
class Response;
|
||||||
class ServerInfo_User;
|
class ServerInfo_User;
|
||||||
class Event_AddToList;
|
class UserInfoBox;
|
||||||
class Event_RemoveFromList;
|
class UserListWidget;
|
||||||
|
|
||||||
class TabAccount : public Tab
|
class TabAccount : public Tab
|
||||||
{
|
{
|
||||||
|
|
@ -24,6 +23,7 @@ signals:
|
||||||
void openMessageDialog(const QString &userName, bool focus);
|
void openMessageDialog(const QString &userName, bool focus);
|
||||||
void userLeft(const QString &userName);
|
void userLeft(const QString &userName);
|
||||||
void userJoined(const ServerInfo_User &userInfo);
|
void userJoined(const ServerInfo_User &userInfo);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void processListUsersResponse(const Response &response);
|
void processListUsersResponse(const Response &response);
|
||||||
void processUserJoinedEvent(const Event_UserJoined &event);
|
void processUserJoinedEvent(const Event_UserJoined &event);
|
||||||
|
|
@ -46,9 +46,9 @@ private:
|
||||||
void addToList(const std::string &listName, const QString &userName);
|
void addToList(const std::string &listName, const QString &userName);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
TabAccount(TabSupervisor *_tabSupervisor, AbstractClient *_client, const ServerInfo_User &userInfo);
|
explicit TabAccount(TabSupervisor *_tabSupervisor, AbstractClient *_client, const ServerInfo_User &userInfo);
|
||||||
void retranslateUi() override;
|
void retranslateUi() override;
|
||||||
QString getTabText() const override
|
[[nodiscard]] QString getTabText() const override
|
||||||
{
|
{
|
||||||
return tr("Account");
|
return tr("Account");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,6 @@
|
||||||
#include "../../client/game_logic/abstract_client.h"
|
#include "../../client/game_logic/abstract_client.h"
|
||||||
#include "../../client/tapped_out_interface.h"
|
#include "../../client/tapped_out_interface.h"
|
||||||
#include "../../client/ui/widgets/cards/card_info_frame_widget.h"
|
#include "../../client/ui/widgets/cards/card_info_frame_widget.h"
|
||||||
#include "../../deck/deck_list_model.h"
|
|
||||||
#include "../../deck/deck_stats_interface.h"
|
#include "../../deck/deck_stats_interface.h"
|
||||||
#include "../../dialogs/dlg_load_deck.h"
|
#include "../../dialogs/dlg_load_deck.h"
|
||||||
#include "../../dialogs/dlg_load_deck_from_clipboard.h"
|
#include "../../dialogs/dlg_load_deck_from_clipboard.h"
|
||||||
|
|
@ -16,7 +15,6 @@
|
||||||
#include "../../settings/cache_settings.h"
|
#include "../../settings/cache_settings.h"
|
||||||
#include "../ui/picture_loader/picture_loader.h"
|
#include "../ui/picture_loader/picture_loader.h"
|
||||||
#include "../ui/pixel_map_generator.h"
|
#include "../ui/pixel_map_generator.h"
|
||||||
#include "../ui/widgets/printing_selector/printing_selector.h"
|
|
||||||
#include "pb/command_deck_upload.pb.h"
|
#include "pb/command_deck_upload.pb.h"
|
||||||
#include "pb/response.pb.h"
|
#include "pb/response.pb.h"
|
||||||
#include "tab_supervisor.h"
|
#include "tab_supervisor.h"
|
||||||
|
|
@ -891,8 +889,9 @@ void TabDeckEditor::updateBannerCardComboBox()
|
||||||
|
|
||||||
void TabDeckEditor::setBannerCard(int /* changedIndex */)
|
void TabDeckEditor::setBannerCard(int /* changedIndex */)
|
||||||
{
|
{
|
||||||
QVariantMap data = bannerCardComboBox->itemData(bannerCardComboBox->currentIndex()).toMap();
|
QVariantMap itemData = bannerCardComboBox->itemData(bannerCardComboBox->currentIndex()).toMap();
|
||||||
deckModel->getDeckList()->setBannerCard(QPair<QString, QString>(data["name"].toString(), data["uuid"].toString()));
|
deckModel->getDeckList()->setBannerCard(
|
||||||
|
QPair<QString, QString>(itemData["name"].toString(), itemData["uuid"].toString()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void TabDeckEditor::updateCardInfo(CardInfoPtr _card)
|
void TabDeckEditor::updateCardInfo(CardInfoPtr _card)
|
||||||
|
|
@ -1411,16 +1410,16 @@ void TabDeckEditor::actSwapCard()
|
||||||
deckView->setSelectionMode(QAbstractItemView::SingleSelection);
|
deckView->setSelectionMode(QAbstractItemView::SingleSelection);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool modified = false;
|
bool isModified = false;
|
||||||
for (const auto ¤tIndex : selectedRows) {
|
for (const auto ¤tIndex : selectedRows) {
|
||||||
if (swapCard(currentIndex)) {
|
if (swapCard(currentIndex)) {
|
||||||
modified = true;
|
isModified = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
deckView->setSelectionMode(QAbstractItemView::ExtendedSelection);
|
deckView->setSelectionMode(QAbstractItemView::ExtendedSelection);
|
||||||
|
|
||||||
if (modified) {
|
if (isModified) {
|
||||||
setModified(true);
|
setModified(true);
|
||||||
setSaveStatus(true);
|
setSaveStatus(true);
|
||||||
}
|
}
|
||||||
|
|
@ -1483,18 +1482,18 @@ void TabDeckEditor::actRemoveCard()
|
||||||
deckView->setSelectionMode(QAbstractItemView::SingleSelection);
|
deckView->setSelectionMode(QAbstractItemView::SingleSelection);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool modified = false;
|
bool isModified = false;
|
||||||
for (const auto &index : selectedRows) {
|
for (const auto &index : selectedRows) {
|
||||||
if (!index.isValid() || deckModel->hasChildren(index)) {
|
if (!index.isValid() || deckModel->hasChildren(index)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
deckModel->removeRow(index.row(), index.parent());
|
deckModel->removeRow(index.row(), index.parent());
|
||||||
modified = true;
|
isModified = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
deckView->setSelectionMode(QAbstractItemView::ExtendedSelection);
|
deckView->setSelectionMode(QAbstractItemView::ExtendedSelection);
|
||||||
|
|
||||||
if (modified) {
|
if (isModified) {
|
||||||
DeckLoader *const deck = deckModel->getDeckList();
|
DeckLoader *const deck = deckModel->getDeckList();
|
||||||
setSaveStatus(!deck->isEmpty());
|
setSaveStatus(!deck->isEmpty());
|
||||||
setModified(true);
|
setModified(true);
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,6 @@
|
||||||
#include "pb/event_user_message.pb.h"
|
#include "pb/event_user_message.pb.h"
|
||||||
#include "pb/game_event_container.pb.h"
|
#include "pb/game_event_container.pb.h"
|
||||||
#include "pb/game_replay.pb.h"
|
#include "pb/game_replay.pb.h"
|
||||||
#include "pb/moderator_commands.pb.h"
|
|
||||||
#include "pb/room_commands.pb.h"
|
#include "pb/room_commands.pb.h"
|
||||||
#include "pb/room_event.pb.h"
|
#include "pb/room_event.pb.h"
|
||||||
#include "pb/serverinfo_room.pb.h"
|
#include "pb/serverinfo_room.pb.h"
|
||||||
|
|
@ -29,7 +28,6 @@
|
||||||
#include "visual_deck_storage/tab_deck_storage_visual.h"
|
#include "visual_deck_storage/tab_deck_storage_visual.h"
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QDebug>
|
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
#include <QSystemTrayIcon>
|
#include <QSystemTrayIcon>
|
||||||
|
|
@ -50,15 +48,15 @@ CloseButton::CloseButton(QWidget *parent) : QAbstractButton(parent)
|
||||||
{
|
{
|
||||||
setFocusPolicy(Qt::NoFocus);
|
setFocusPolicy(Qt::NoFocus);
|
||||||
setCursor(Qt::ArrowCursor);
|
setCursor(Qt::ArrowCursor);
|
||||||
resize(sizeHint());
|
resize(this->sizeHint());
|
||||||
}
|
}
|
||||||
|
|
||||||
QSize CloseButton::sizeHint() const
|
QSize CloseButton::sizeHint() const
|
||||||
{
|
{
|
||||||
ensurePolished();
|
ensurePolished();
|
||||||
int width = style()->pixelMetric(QStyle::PM_TabCloseIndicatorWidth, 0, this);
|
int width = style()->pixelMetric(QStyle::PM_TabCloseIndicatorWidth, nullptr, this);
|
||||||
int height = style()->pixelMetric(QStyle::PM_TabCloseIndicatorHeight, 0, this);
|
int height = style()->pixelMetric(QStyle::PM_TabCloseIndicatorHeight, nullptr, this);
|
||||||
return QSize(width, height);
|
return {width, height};
|
||||||
}
|
}
|
||||||
|
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||||
|
|
@ -90,10 +88,9 @@ void CloseButton::paintEvent(QPaintEvent * /*event*/)
|
||||||
if (isDown())
|
if (isDown())
|
||||||
opt.state |= QStyle::State_Sunken;
|
opt.state |= QStyle::State_Sunken;
|
||||||
|
|
||||||
if (const QTabBar *tb = qobject_cast<const QTabBar *>(parent())) {
|
if (const auto *tb = qobject_cast<const QTabBar *>(parent())) {
|
||||||
int index = tb->currentIndex();
|
int index = tb->currentIndex();
|
||||||
QTabBar::ButtonPosition position =
|
auto position = (QTabBar::ButtonPosition)style()->styleHint(QStyle::SH_TabBar_CloseButtonPosition, nullptr, tb);
|
||||||
(QTabBar::ButtonPosition)style()->styleHint(QStyle::SH_TabBar_CloseButtonPosition, 0, tb);
|
|
||||||
if (tb->tabButton(index, position) == this)
|
if (tb->tabButton(index, position) == this)
|
||||||
opt.state |= QStyle::State_Selected;
|
opt.state |= QStyle::State_Selected;
|
||||||
}
|
}
|
||||||
|
|
@ -102,8 +99,9 @@ void CloseButton::paintEvent(QPaintEvent * /*event*/)
|
||||||
}
|
}
|
||||||
|
|
||||||
TabSupervisor::TabSupervisor(AbstractClient *_client, QMenu *tabsMenu, QWidget *parent)
|
TabSupervisor::TabSupervisor(AbstractClient *_client, QMenu *tabsMenu, QWidget *parent)
|
||||||
: QTabWidget(parent), userInfo(0), client(_client), tabsMenu(tabsMenu), tabVisualDeckStorage(nullptr), tabServer(0),
|
: QTabWidget(parent), userInfo(nullptr), client(_client), tabsMenu(tabsMenu), tabVisualDeckStorage(nullptr),
|
||||||
tabAccount(0), tabDeckStorage(0), tabReplays(0), tabAdmin(0), tabLog(0)
|
tabServer(nullptr), tabAccount(nullptr), tabDeckStorage(nullptr), tabReplays(nullptr), tabAdmin(nullptr),
|
||||||
|
tabLog(nullptr), isLocalGame(false)
|
||||||
{
|
{
|
||||||
setElideMode(Qt::ElideRight);
|
setElideMode(Qt::ElideRight);
|
||||||
setMovable(true);
|
setMovable(true);
|
||||||
|
|
@ -210,14 +208,15 @@ void TabSupervisor::retranslateUi()
|
||||||
while (messageIterator.hasNext())
|
while (messageIterator.hasNext())
|
||||||
tabs.append(messageIterator.next().value());
|
tabs.append(messageIterator.next().value());
|
||||||
|
|
||||||
for (int i = 0; i < tabs.size(); ++i)
|
for (auto &tab : tabs) {
|
||||||
if (tabs[i]) {
|
if (tab) {
|
||||||
int idx = indexOf(tabs[i]);
|
int idx = indexOf(tab);
|
||||||
QString tabText = tabs[i]->getTabText();
|
QString tabText = tab->getTabText();
|
||||||
setTabText(idx, sanitizeTabName(tabText));
|
setTabText(idx, sanitizeTabName(tabText));
|
||||||
setTabToolTip(idx, sanitizeHtml(tabText));
|
setTabToolTip(idx, sanitizeHtml(tabText));
|
||||||
tabs[i]->retranslateUi();
|
tab->retranslateUi();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TabSupervisor::refreshShortcuts()
|
void TabSupervisor::refreshShortcuts()
|
||||||
|
|
@ -249,12 +248,12 @@ AbstractClient *TabSupervisor::getClient() const
|
||||||
return localClients.isEmpty() ? client : localClients.first();
|
return localClients.isEmpty() ? client : localClients.first();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString TabSupervisor::sanitizeTabName(QString dirty) const
|
QString TabSupervisor::sanitizeTabName(QString dirty)
|
||||||
{
|
{
|
||||||
return dirty.replace("&", "&&");
|
return dirty.replace("&", "&&");
|
||||||
}
|
}
|
||||||
|
|
||||||
QString TabSupervisor::sanitizeHtml(QString dirty) const
|
QString TabSupervisor::sanitizeHtml(QString dirty)
|
||||||
{
|
{
|
||||||
return dirty.replace("&", "&").replace("<", "<").replace(">", ">").replace("\"", """);
|
return dirty.replace("&", "&").replace("<", "<").replace(">", ">").replace("\"", """);
|
||||||
}
|
}
|
||||||
|
|
@ -379,11 +378,11 @@ void TabSupervisor::startLocal(const QList<AbstractClient *> &_clients)
|
||||||
{
|
{
|
||||||
resetTabsMenu();
|
resetTabsMenu();
|
||||||
|
|
||||||
tabAccount = 0;
|
tabAccount = nullptr;
|
||||||
tabDeckStorage = 0;
|
tabDeckStorage = nullptr;
|
||||||
tabReplays = 0;
|
tabReplays = nullptr;
|
||||||
tabAdmin = 0;
|
tabAdmin = nullptr;
|
||||||
tabLog = 0;
|
tabLog = nullptr;
|
||||||
isLocalGame = true;
|
isLocalGame = true;
|
||||||
userInfo = new ServerInfo_User;
|
userInfo = new ServerInfo_User;
|
||||||
localClients = _clients;
|
localClients = _clients;
|
||||||
|
|
@ -404,8 +403,9 @@ void TabSupervisor::stop()
|
||||||
resetTabsMenu();
|
resetTabsMenu();
|
||||||
|
|
||||||
if (!localClients.isEmpty()) {
|
if (!localClients.isEmpty()) {
|
||||||
for (int i = 0; i < localClients.size(); ++i)
|
for (auto &localClient : localClients) {
|
||||||
localClients[i]->deleteLater();
|
localClient->deleteLater();
|
||||||
|
}
|
||||||
localClients.clear();
|
localClients.clear();
|
||||||
|
|
||||||
emit localGameEnded();
|
emit localGameEnded();
|
||||||
|
|
@ -451,14 +451,14 @@ void TabSupervisor::stop()
|
||||||
userListManager->handleDisconnect();
|
userListManager->handleDisconnect();
|
||||||
|
|
||||||
delete userInfo;
|
delete userInfo;
|
||||||
userInfo = 0;
|
userInfo = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TabSupervisor::actTabVisualDeckStorage(bool checked)
|
void TabSupervisor::actTabVisualDeckStorage(bool checked)
|
||||||
{
|
{
|
||||||
SettingsCache::instance().setTabVisualDeckStorageOpen(checked);
|
SettingsCache::instance().setTabVisualDeckStorageOpen(checked);
|
||||||
if (checked && !tabVisualDeckStorage) {
|
if (checked && !tabVisualDeckStorage) {
|
||||||
tabVisualDeckStorage = new TabDeckStorageVisual(this, client);
|
tabVisualDeckStorage = new TabDeckStorageVisual(this);
|
||||||
myAddTab(tabVisualDeckStorage, aTabVisualDeckStorage);
|
myAddTab(tabVisualDeckStorage, aTabVisualDeckStorage);
|
||||||
setCurrentWidget(tabVisualDeckStorage);
|
setCurrentWidget(tabVisualDeckStorage);
|
||||||
connect(tabVisualDeckStorage, &Tab::closed, this, [this] {
|
connect(tabVisualDeckStorage, &Tab::closed, this, [this] {
|
||||||
|
|
@ -588,7 +588,7 @@ void TabSupervisor::gameJoined(const Event_GameJoined &event)
|
||||||
roomGameTypes.insert(event.game_types(i).game_type_id(),
|
roomGameTypes.insert(event.game_types(i).game_type_id(),
|
||||||
QString::fromStdString(event.game_types(i).description()));
|
QString::fromStdString(event.game_types(i).description()));
|
||||||
|
|
||||||
TabGame *tab = new TabGame(this, userListManager, QList<AbstractClient *>() << client, event, roomGameTypes);
|
auto *tab = new TabGame(this, userListManager, 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::addDeckEditorTab);
|
||||||
|
|
@ -599,7 +599,7 @@ void TabSupervisor::gameJoined(const Event_GameJoined &event)
|
||||||
|
|
||||||
void TabSupervisor::localGameJoined(const Event_GameJoined &event)
|
void TabSupervisor::localGameJoined(const Event_GameJoined &event)
|
||||||
{
|
{
|
||||||
TabGame *tab = new TabGame(this, userListManager, localClients, event, QMap<int, QString>());
|
auto *tab = new TabGame(this, userListManager, 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::addDeckEditorTab);
|
||||||
myAddTab(tab);
|
myAddTab(tab);
|
||||||
|
|
@ -627,7 +627,7 @@ void TabSupervisor::gameLeft(TabGame *tab)
|
||||||
|
|
||||||
void TabSupervisor::addRoomTab(const ServerInfo_Room &info, bool setCurrent)
|
void TabSupervisor::addRoomTab(const ServerInfo_Room &info, bool setCurrent)
|
||||||
{
|
{
|
||||||
TabRoom *tab = new TabRoom(this, client, userInfo, userListManager, info);
|
auto *tab = new TabRoom(this, client, userInfo, userListManager, info);
|
||||||
connect(tab, &TabRoom::maximizeClient, this, &TabSupervisor::maximizeMainWindow);
|
connect(tab, &TabRoom::maximizeClient, this, &TabSupervisor::maximizeMainWindow);
|
||||||
connect(tab, &TabRoom::roomClosing, this, &TabSupervisor::roomLeft);
|
connect(tab, &TabRoom::roomClosing, this, &TabSupervisor::roomLeft);
|
||||||
connect(tab, &TabRoom::openMessageDialog, this, &TabSupervisor::addMessageTab);
|
connect(tab, &TabRoom::openMessageDialog, this, &TabSupervisor::addMessageTab);
|
||||||
|
|
@ -648,7 +648,7 @@ void TabSupervisor::roomLeft(TabRoom *tab)
|
||||||
|
|
||||||
void TabSupervisor::openReplay(GameReplay *replay)
|
void TabSupervisor::openReplay(GameReplay *replay)
|
||||||
{
|
{
|
||||||
TabGame *replayTab = new TabGame(this, replay);
|
auto *replayTab = new TabGame(this, replay);
|
||||||
connect(replayTab, &TabGame::gameClosing, this, &TabSupervisor::replayLeft);
|
connect(replayTab, &TabGame::gameClosing, this, &TabSupervisor::replayLeft);
|
||||||
myAddTab(replayTab);
|
myAddTab(replayTab);
|
||||||
replayTabs.append(replayTab);
|
replayTabs.append(replayTab);
|
||||||
|
|
@ -709,7 +709,7 @@ void TabSupervisor::talkLeft(TabMessage *tab)
|
||||||
|
|
||||||
TabDeckEditor *TabSupervisor::addDeckEditorTab(const DeckLoader *deckToOpen)
|
TabDeckEditor *TabSupervisor::addDeckEditorTab(const DeckLoader *deckToOpen)
|
||||||
{
|
{
|
||||||
TabDeckEditor *tab = new TabDeckEditor(this);
|
auto *tab = new TabDeckEditor(this);
|
||||||
if (deckToOpen)
|
if (deckToOpen)
|
||||||
tab->setDeck(new DeckLoader(*deckToOpen));
|
tab->setDeck(new DeckLoader(*deckToOpen));
|
||||||
connect(tab, &TabDeckEditor::deckEditorClosing, this, &TabSupervisor::deckEditorClosed);
|
connect(tab, &TabDeckEditor::deckEditorClosing, this, &TabSupervisor::deckEditorClosed);
|
||||||
|
|
@ -770,9 +770,9 @@ void TabSupervisor::processUserMessageEvent(const Event_UserMessage &event)
|
||||||
if (!tab)
|
if (!tab)
|
||||||
tab = messageTabs.value(QString::fromStdString(event.receiver_name()));
|
tab = messageTabs.value(QString::fromStdString(event.receiver_name()));
|
||||||
if (!tab) {
|
if (!tab) {
|
||||||
const ServerInfo_User *userInfo = userListManager->getOnlineUser(senderName);
|
const ServerInfo_User *onlineUserInfo = userListManager->getOnlineUser(senderName);
|
||||||
if (userInfo) {
|
if (onlineUserInfo) {
|
||||||
UserLevelFlags userLevel = UserLevelFlags(userInfo->user_level());
|
auto userLevel = UserLevelFlags(onlineUserInfo->user_level());
|
||||||
if (SettingsCache::instance().getIgnoreUnregisteredUserMessages() &&
|
if (SettingsCache::instance().getIgnoreUnregisteredUserMessages() &&
|
||||||
!userLevel.testFlag(ServerInfo_User::IsRegistered))
|
!userLevel.testFlag(ServerInfo_User::IsRegistered))
|
||||||
// Flags are additive, so reg/mod/admin are all IsRegistered
|
// Flags are additive, so reg/mod/admin are all IsRegistered
|
||||||
|
|
|
||||||
|
|
@ -91,8 +91,8 @@ private:
|
||||||
|
|
||||||
int myAddTab(Tab *tab, QAction *manager = nullptr);
|
int myAddTab(Tab *tab, QAction *manager = nullptr);
|
||||||
void addCloseButtonToTab(Tab *tab, int tabIndex, QAction *manager);
|
void addCloseButtonToTab(Tab *tab, int tabIndex, QAction *manager);
|
||||||
QString sanitizeTabName(QString dirty) const;
|
static QString sanitizeTabName(QString dirty);
|
||||||
QString sanitizeHtml(QString dirty) const;
|
static QString sanitizeHtml(QString dirty);
|
||||||
void resetTabsMenu();
|
void resetTabsMenu();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
@ -131,7 +131,7 @@ public:
|
||||||
bool getAdminLocked() const;
|
bool getAdminLocked() const;
|
||||||
bool closeRequest();
|
bool closeRequest();
|
||||||
bool switchToGameTabIfAlreadyExists(const int gameId);
|
bool switchToGameTabIfAlreadyExists(const int gameId);
|
||||||
void actShowPopup(const QString &message);
|
static void actShowPopup(const QString &message);
|
||||||
signals:
|
signals:
|
||||||
void setMenu(const QList<QMenu *> &newMenuList = QList<QMenu *>());
|
void setMenu(const QList<QMenu *> &newMenuList = QList<QMenu *>());
|
||||||
void localGameEnded();
|
void localGameEnded();
|
||||||
|
|
|
||||||
|
|
@ -1,99 +1,33 @@
|
||||||
#include "tab_deck_storage_visual.h"
|
#include "tab_deck_storage_visual.h"
|
||||||
|
|
||||||
#include "../../../game/cards/card_database_model.h"
|
#include "../../../game/cards/card_database_model.h"
|
||||||
|
#include "../../ui/widgets/cards/deck_preview_card_picture_widget.h"
|
||||||
|
#include "../../ui/widgets/visual_deck_storage/visual_deck_storage_widget.h"
|
||||||
#include "../tab_supervisor.h"
|
#include "../tab_supervisor.h"
|
||||||
#include "pb/command_deck_del.pb.h"
|
#include "pb/command_deck_del.pb.h"
|
||||||
|
|
||||||
#include <QAction>
|
|
||||||
#include <QDebug>
|
|
||||||
#include <QDirIterator>
|
|
||||||
#include <QFileSystemModel>
|
|
||||||
#include <QHBoxLayout>
|
|
||||||
#include <QInputDialog>
|
|
||||||
#include <QMessageBox>
|
|
||||||
#include <QMouseEvent>
|
#include <QMouseEvent>
|
||||||
#include <QScreen>
|
|
||||||
#include <QToolBar>
|
|
||||||
#include <QTreeView>
|
|
||||||
|
|
||||||
class FlowLayout;
|
TabDeckStorageVisual::TabDeckStorageVisual(TabSupervisor *_tabSupervisor)
|
||||||
TabDeckStorageVisual::TabDeckStorageVisual(TabSupervisor *_tabSupervisor, AbstractClient *_client)
|
: Tab(_tabSupervisor), visualDeckStorageWidget(new VisualDeckStorageWidget(this))
|
||||||
: Tab(_tabSupervisor), client(_client)
|
|
||||||
{
|
{
|
||||||
deck_list_model = new DeckListModel(this);
|
|
||||||
deck_list_model->setObjectName("visualDeckModel");
|
|
||||||
|
|
||||||
QWidget *container = new QWidget(this);
|
|
||||||
QVBoxLayout *layout = new QVBoxLayout(container);
|
|
||||||
container->setLayout(layout);
|
|
||||||
this->setCentralWidget(container);
|
|
||||||
|
|
||||||
leftToolBar = new QToolBar;
|
|
||||||
leftToolBar->setOrientation(Qt::Horizontal);
|
|
||||||
leftToolBar->setIconSize(QSize(32, 32));
|
|
||||||
QHBoxLayout *leftToolBarLayout = new QHBoxLayout(this);
|
|
||||||
leftToolBarLayout->addStretch();
|
|
||||||
leftToolBarLayout->addWidget(leftToolBar);
|
|
||||||
leftToolBarLayout->addStretch();
|
|
||||||
|
|
||||||
aOpenLocalDeck = new QAction(this);
|
|
||||||
aOpenLocalDeck->setIcon(QPixmap("theme:icons/pencil"));
|
|
||||||
connect(aOpenLocalDeck, SIGNAL(triggered()), this, SLOT(actOpenLocalDeck()));
|
|
||||||
aDeleteLocalDeck = new QAction(this);
|
|
||||||
aDeleteLocalDeck->setIcon(QPixmap("theme:icons/remove_row"));
|
|
||||||
connect(aDeleteLocalDeck, SIGNAL(triggered()), this, SLOT(actDeleteLocalDeck()));
|
|
||||||
|
|
||||||
connect(this, &TabDeckStorageVisual::openDeckEditor, tabSupervisor, &TabSupervisor::addDeckEditorTab);
|
connect(this, &TabDeckStorageVisual::openDeckEditor, tabSupervisor, &TabSupervisor::addDeckEditorTab);
|
||||||
|
|
||||||
leftToolBar->addAction(aOpenLocalDeck);
|
|
||||||
leftToolBar->addAction(aDeleteLocalDeck);
|
|
||||||
|
|
||||||
visualDeckStorageWidget = new VisualDeckStorageWidget(this);
|
|
||||||
connect(visualDeckStorageWidget, &VisualDeckStorageWidget::deckPreviewDoubleClicked, this,
|
connect(visualDeckStorageWidget, &VisualDeckStorageWidget::deckPreviewDoubleClicked, this,
|
||||||
&TabDeckStorageVisual::actOpenLocalDeck);
|
&TabDeckStorageVisual::actOpenLocalDeck);
|
||||||
|
|
||||||
// layout->addWidget(leftToolBar);
|
auto *widget = new QWidget(this);
|
||||||
|
auto *layout = new QVBoxLayout(widget);
|
||||||
|
widget->setLayout(layout);
|
||||||
|
this->setCentralWidget(widget);
|
||||||
layout->addWidget(visualDeckStorageWidget);
|
layout->addWidget(visualDeckStorageWidget);
|
||||||
|
|
||||||
retranslateUi();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TabDeckStorageVisual::retranslateUi()
|
void TabDeckStorageVisual::actOpenLocalDeck(QMouseEvent * /*event*/, DeckPreviewWidget *instance)
|
||||||
{
|
{
|
||||||
aOpenLocalDeck->setText(tr("Open in deck editor"));
|
|
||||||
aDeleteLocalDeck->setText(tr("Delete"));
|
|
||||||
}
|
|
||||||
|
|
||||||
QString TabDeckStorageVisual::getTargetPath() const
|
|
||||||
{
|
|
||||||
return {};
|
|
||||||
}
|
|
||||||
|
|
||||||
void TabDeckStorageVisual::actOpenLocalDeck(QMouseEvent *event, DeckPreviewWidget *instance)
|
|
||||||
{
|
|
||||||
(void)event;
|
|
||||||
DeckLoader deckLoader;
|
DeckLoader deckLoader;
|
||||||
if (!deckLoader.loadFromFile(instance->filePath, DeckLoader::CockatriceFormat, true))
|
if (!deckLoader.loadFromFile(instance->filePath, DeckLoader::CockatriceFormat, true)) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
emit openDeckEditor(&deckLoader);
|
emit openDeckEditor(&deckLoader);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TabDeckStorageVisual::actDeleteLocalDeck()
|
|
||||||
{
|
|
||||||
QModelIndex curLeft = localDirView->selectionModel()->currentIndex();
|
|
||||||
if (localDirModel->isDir(curLeft))
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (QMessageBox::warning(this, tr("Delete local file"),
|
|
||||||
tr("Are you sure you want to delete \"%1\"?").arg(localDirModel->fileName(curLeft)),
|
|
||||||
QMessageBox::Yes | QMessageBox::No) != QMessageBox::Yes)
|
|
||||||
return;
|
|
||||||
|
|
||||||
localDirModel->remove(curLeft);
|
|
||||||
}
|
|
||||||
|
|
||||||
void TabDeckStorageVisual::cardUpdateFinished(int exitCode, QProcess::ExitStatus exitStatus)
|
|
||||||
{
|
|
||||||
qDebug() << "Card update process finished with exit code:" << exitCode << "and exit status:" << exitStatus;
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -1,54 +1,40 @@
|
||||||
#ifndef TAB_DECK_STORAGE_VISUAL_H
|
#ifndef TAB_DECK_STORAGE_VISUAL_H
|
||||||
#define TAB_DECK_STORAGE_VISUAL_H
|
#define TAB_DECK_STORAGE_VISUAL_H
|
||||||
|
|
||||||
#include "../../../deck/deck_list_model.h"
|
|
||||||
#include "../../ui/widgets/cards/deck_preview_card_picture_widget.h"
|
|
||||||
#include "../../ui/widgets/visual_deck_storage/visual_deck_storage_widget.h"
|
|
||||||
#include "../tab.h"
|
#include "../tab.h"
|
||||||
|
|
||||||
#include <QProcess>
|
|
||||||
|
|
||||||
class AbstractClient;
|
class AbstractClient;
|
||||||
class QTreeView;
|
class CommandContainer;
|
||||||
|
class DeckLoader;
|
||||||
|
class DeckPreviewWidget;
|
||||||
class QFileSystemModel;
|
class QFileSystemModel;
|
||||||
|
class QGroupBox;
|
||||||
class QToolBar;
|
class QToolBar;
|
||||||
|
class QTreeView;
|
||||||
class QTreeWidget;
|
class QTreeWidget;
|
||||||
class QTreeWidgetItem;
|
class QTreeWidgetItem;
|
||||||
class QGroupBox;
|
|
||||||
class CommandContainer;
|
|
||||||
class Response;
|
class Response;
|
||||||
class DeckLoader;
|
class VisualDeckStorageWidget;
|
||||||
|
|
||||||
class TabDeckStorageVisual final : public Tab
|
class TabDeckStorageVisual final : public Tab
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
TabDeckStorageVisual(TabSupervisor *_tabSupervisor, AbstractClient *_client);
|
explicit TabDeckStorageVisual(TabSupervisor *_tabSupervisor);
|
||||||
|
void retranslateUi() override{};
|
||||||
void retranslateUi() override;
|
[[nodiscard]] QString getTabText() const override
|
||||||
QString getTabText() const override
|
|
||||||
{
|
{
|
||||||
return tr("Visual Deck storage");
|
return tr("Visual Deck storage");
|
||||||
}
|
}
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void cardUpdateFinished(int exitCode, QProcess::ExitStatus exitStatus);
|
void actOpenLocalDeck(QMouseEvent * /*event*/, DeckPreviewWidget *instance);
|
||||||
void actOpenLocalDeck(QMouseEvent *event, DeckPreviewWidget *instance);
|
|
||||||
void actDeleteLocalDeck();
|
|
||||||
signals:
|
signals:
|
||||||
void openDeckEditor(const DeckLoader *deckLoader);
|
void openDeckEditor(const DeckLoader *deckLoader);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QWidget *container;
|
|
||||||
QHBoxLayout *layout;
|
|
||||||
AbstractClient *client;
|
|
||||||
QTreeView *localDirView;
|
|
||||||
QFileSystemModel *localDirModel;
|
|
||||||
QToolBar *leftToolBar;
|
|
||||||
QGroupBox *leftGroupBox;
|
|
||||||
VisualDeckStorageWidget *visualDeckStorageWidget;
|
VisualDeckStorageWidget *visualDeckStorageWidget;
|
||||||
DeckListModel *deck_list_model;
|
|
||||||
QAction *aOpenLocalDeck, *aDeleteLocalDeck;
|
|
||||||
QString getTargetPath() const;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
#include "visual_deck_storage_widget.h"
|
#include "visual_deck_storage_widget.h"
|
||||||
|
|
||||||
#include "../../../../deck/deck_loader.h"
|
|
||||||
#include "../../../../game/cards/card_database_manager.h"
|
#include "../../../../game/cards/card_database_manager.h"
|
||||||
#include "../../../../settings/cache_settings.h"
|
#include "../../../../settings/cache_settings.h"
|
||||||
#include "deck_preview/deck_preview_widget.h"
|
#include "deck_preview/deck_preview_widget.h"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue