mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-18 08:22:15 -07:00
Merge branch 'master' into visual_deck_storage_v2
This commit is contained in:
commit
b750cc28c5
28 changed files with 4377 additions and 3615 deletions
|
|
@ -1,6 +1,6 @@
|
|||
# This script re-signs all apps after CPack packages them. This is necessary because CPack modifies
|
||||
# the library references used by Cockatrice to App relative paths, invalidating the code signature.
|
||||
string(LENGTH $ENV{MACOS_CERTIFICATE_NAME} MACOS_CERTIFICATE_NAME_LEN)
|
||||
string(LENGTH "$ENV{MACOS_CERTIFICATE_NAME}" MACOS_CERTIFICATE_NAME_LEN)
|
||||
|
||||
if(APPLE AND MACOS_CERTIFICATE_NAME_LEN GREATER 0)
|
||||
set(APPLICATIONS "cockatrice" "servatrice" "oracle" "dbconverter")
|
||||
|
|
|
|||
|
|
@ -1,13 +1,14 @@
|
|||
#include "tab.h"
|
||||
|
||||
#include "../ui/widgets/cards/card_info_display_widget.h"
|
||||
#include "./tab_supervisor.h"
|
||||
|
||||
#include <QApplication>
|
||||
#include <QDebug>
|
||||
#include <QScreen>
|
||||
|
||||
Tab::Tab(TabSupervisor *_tabSupervisor, QWidget *parent)
|
||||
: QMainWindow(parent), tabSupervisor(_tabSupervisor), contentsChanged(false), infoPopup(0)
|
||||
Tab::Tab(TabSupervisor *_tabSupervisor)
|
||||
: QMainWindow(_tabSupervisor), tabSupervisor(_tabSupervisor), contentsChanged(false), infoPopup(0)
|
||||
{
|
||||
setAttribute(Qt::WA_DeleteOnClose);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ private:
|
|||
QList<QMenu *> tabMenus;
|
||||
|
||||
public:
|
||||
Tab(TabSupervisor *_tabSupervisor, QWidget *parent = nullptr);
|
||||
explicit Tab(TabSupervisor *_tabSupervisor);
|
||||
const QList<QMenu *> &getTabMenus() const
|
||||
{
|
||||
return tabMenus;
|
||||
|
|
@ -50,7 +50,13 @@ public:
|
|||
}
|
||||
virtual QString getTabText() const = 0;
|
||||
virtual void retranslateUi() = 0;
|
||||
virtual void closeRequest()
|
||||
/**
|
||||
* Sends a request to close the tab.
|
||||
* Signals for cleanup should be emitted from this method instead of the destructor.
|
||||
*
|
||||
* @param forced whether this close request was initiated by the user or forced by the server.
|
||||
*/
|
||||
virtual void closeRequest(bool /*forced*/ = false)
|
||||
{
|
||||
}
|
||||
virtual void tabActivated()
|
||||
|
|
|
|||
|
|
@ -18,11 +18,8 @@
|
|||
#include <QPushButton>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
TabUserLists::TabUserLists(TabSupervisor *_tabSupervisor,
|
||||
AbstractClient *_client,
|
||||
const ServerInfo_User &userInfo,
|
||||
QWidget *parent)
|
||||
: Tab(_tabSupervisor, parent), client(_client)
|
||||
TabUserLists::TabUserLists(TabSupervisor *_tabSupervisor, AbstractClient *_client, const ServerInfo_User &userInfo)
|
||||
: Tab(_tabSupervisor), client(_client)
|
||||
{
|
||||
allUsersList = new UserList(_tabSupervisor, client, UserList::AllUsersList);
|
||||
buddyList = new UserList(_tabSupervisor, client, UserList::BuddyList);
|
||||
|
|
|
|||
|
|
@ -46,12 +46,9 @@ private:
|
|||
void addToList(const std::string &listName, const QString &userName);
|
||||
|
||||
public:
|
||||
TabUserLists(TabSupervisor *_tabSupervisor,
|
||||
AbstractClient *_client,
|
||||
const ServerInfo_User &userInfo,
|
||||
QWidget *parent = nullptr);
|
||||
void retranslateUi();
|
||||
QString getTabText() const
|
||||
TabUserLists(TabSupervisor *_tabSupervisor, AbstractClient *_client, const ServerInfo_User &userInfo);
|
||||
void retranslateUi() override;
|
||||
QString getTabText() const override
|
||||
{
|
||||
return tr("Account");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -54,8 +54,8 @@ int ShutdownDialog::getMinutes() const
|
|||
return minutesEdit->value();
|
||||
}
|
||||
|
||||
TabAdmin::TabAdmin(TabSupervisor *_tabSupervisor, AbstractClient *_client, bool _fullAdmin, QWidget *parent)
|
||||
: Tab(_tabSupervisor, parent), locked(true), client(_client), fullAdmin(_fullAdmin)
|
||||
TabAdmin::TabAdmin(TabSupervisor *_tabSupervisor, AbstractClient *_client, bool _fullAdmin)
|
||||
: Tab(_tabSupervisor), locked(true), client(_client), fullAdmin(_fullAdmin)
|
||||
{
|
||||
updateServerMessageButton = new QPushButton;
|
||||
connect(updateServerMessageButton, &QPushButton::clicked, this, &TabAdmin::actUpdateServerMessage);
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ private:
|
|||
QSpinBox *minutesEdit;
|
||||
|
||||
public:
|
||||
ShutdownDialog(QWidget *parent = nullptr);
|
||||
explicit ShutdownDialog(QWidget *parent = nullptr);
|
||||
QString getReason() const;
|
||||
int getMinutes() const;
|
||||
};
|
||||
|
|
@ -54,9 +54,9 @@ private slots:
|
|||
void actLock();
|
||||
|
||||
public:
|
||||
TabAdmin(TabSupervisor *_tabSupervisor, AbstractClient *_client, bool _fullAdmin, QWidget *parent = nullptr);
|
||||
void retranslateUi();
|
||||
QString getTabText() const
|
||||
TabAdmin(TabSupervisor *_tabSupervisor, AbstractClient *_client, bool _fullAdmin);
|
||||
void retranslateUi() override;
|
||||
QString getTabText() const override
|
||||
{
|
||||
return tr("Administration");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -358,7 +358,7 @@ void TabDeckEditor::createMenus()
|
|||
analyzeDeckMenu->addAction(aAnalyzeDeckTappedout);
|
||||
|
||||
aClose = new QAction(QString(), this);
|
||||
connect(aClose, SIGNAL(triggered()), this, SLOT(closeRequest()));
|
||||
connect(aClose, &QAction::triggered, this, [this] { closeRequest(); });
|
||||
|
||||
aClearFilterAll = new QAction(QString(), this);
|
||||
aClearFilterAll->setIcon(QPixmap("theme:icons/clearsearch"));
|
||||
|
|
@ -698,8 +698,7 @@ void TabDeckEditor::loadLayout()
|
|||
QTimer::singleShot(100, this, SLOT(freeDocksSize()));
|
||||
}
|
||||
|
||||
TabDeckEditor::TabDeckEditor(TabSupervisor *_tabSupervisor, QWidget *parent)
|
||||
: Tab(_tabSupervisor, parent), modified(false)
|
||||
TabDeckEditor::TabDeckEditor(TabSupervisor *_tabSupervisor) : Tab(_tabSupervisor), modified(false)
|
||||
{
|
||||
setObjectName("TabDeckEditor");
|
||||
|
||||
|
|
@ -721,11 +720,6 @@ TabDeckEditor::TabDeckEditor(TabSupervisor *_tabSupervisor, QWidget *parent)
|
|||
loadLayout();
|
||||
}
|
||||
|
||||
TabDeckEditor::~TabDeckEditor()
|
||||
{
|
||||
emit deckEditorClosing(this);
|
||||
}
|
||||
|
||||
void TabDeckEditor::retranslateUi()
|
||||
{
|
||||
cardInfo->retranslateUi();
|
||||
|
|
@ -987,10 +981,14 @@ bool TabDeckEditor::confirmClose()
|
|||
return true;
|
||||
}
|
||||
|
||||
void TabDeckEditor::closeRequest()
|
||||
void TabDeckEditor::closeRequest(bool forced)
|
||||
{
|
||||
if (confirmClose())
|
||||
deleteLater();
|
||||
if (!forced && !confirmClose()) {
|
||||
return;
|
||||
}
|
||||
|
||||
emit deckEditorClosing(this);
|
||||
close();
|
||||
}
|
||||
|
||||
void TabDeckEditor::actNewDeck()
|
||||
|
|
|
|||
|
|
@ -163,8 +163,7 @@ private:
|
|||
QWidget *centralWidget;
|
||||
|
||||
public:
|
||||
explicit TabDeckEditor(TabSupervisor *_tabSupervisor, QWidget *parent = nullptr);
|
||||
~TabDeckEditor() override;
|
||||
explicit TabDeckEditor(TabSupervisor *_tabSupervisor);
|
||||
void retranslateUi() override;
|
||||
QString getTabText() const override;
|
||||
void setDeck(DeckLoader *_deckLoader);
|
||||
|
|
@ -179,7 +178,7 @@ public:
|
|||
void updateCardInfo(CardInfoPtr _card);
|
||||
|
||||
public slots:
|
||||
void closeRequest() override;
|
||||
void closeRequest(bool forced = false) override;
|
||||
void showPrintingSelector();
|
||||
signals:
|
||||
void openDeckEditor(const DeckLoader *deckLoader);
|
||||
|
|
|
|||
|
|
@ -64,8 +64,8 @@ private slots:
|
|||
|
||||
public:
|
||||
TabDeckStorage(TabSupervisor *_tabSupervisor, AbstractClient *_client);
|
||||
void retranslateUi();
|
||||
QString getTabText() const
|
||||
void retranslateUi() override;
|
||||
QString getTabText() const override
|
||||
{
|
||||
return tr("Deck storage");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -164,7 +164,7 @@ void DeckViewContainer::retranslateUi()
|
|||
{
|
||||
loadLocalButton->setText(tr("Load deck..."));
|
||||
loadRemoteButton->setText(tr("Load remote deck..."));
|
||||
unloadDeckButton->setText(tr("Unload deck..."));
|
||||
unloadDeckButton->setText(tr("Unload deck"));
|
||||
readyStartButton->setText(tr("Ready to start"));
|
||||
forceStartGameButton->setText(tr("Force start"));
|
||||
updateSideboardLockButtonText();
|
||||
|
|
@ -581,16 +581,14 @@ void TabGame::emitUserEvent()
|
|||
|
||||
TabGame::~TabGame()
|
||||
{
|
||||
scene->clearViews();
|
||||
|
||||
delete replay;
|
||||
|
||||
QMapIterator<int, Player *> i(players);
|
||||
while (i.hasNext()) {
|
||||
delete i.next().value();
|
||||
}
|
||||
|
||||
players.clear();
|
||||
|
||||
emit gameClosing(this);
|
||||
}
|
||||
|
||||
void TabGame::updatePlayerListDockTitle()
|
||||
|
|
@ -701,9 +699,15 @@ void TabGame::retranslateUi()
|
|||
scene->retranslateUi();
|
||||
}
|
||||
|
||||
void TabGame::closeRequest()
|
||||
void TabGame::closeRequest(bool forced)
|
||||
{
|
||||
actLeaveGame();
|
||||
if (!forced && !leaveGame()) {
|
||||
return;
|
||||
}
|
||||
|
||||
emit gameClosing(this);
|
||||
|
||||
close();
|
||||
}
|
||||
|
||||
void TabGame::replayNextEvent(Player::EventProcessingOptions options)
|
||||
|
|
@ -794,19 +798,23 @@ void TabGame::actConcede()
|
|||
}
|
||||
}
|
||||
|
||||
void TabGame::actLeaveGame()
|
||||
/**
|
||||
* Confirms the leave game and sends the leave game command, if applicable.
|
||||
*
|
||||
* @return True if the leave game is confirmed
|
||||
*/
|
||||
bool TabGame::leaveGame()
|
||||
{
|
||||
if (!gameClosed) {
|
||||
if (!spectator)
|
||||
if (QMessageBox::question(this, tr("Leave game"), tr("Are you sure you want to leave this game?"),
|
||||
QMessageBox::Yes | QMessageBox::No, QMessageBox::No) != QMessageBox::Yes)
|
||||
return;
|
||||
return false;
|
||||
|
||||
if (!replay)
|
||||
sendGameCommand(Command_LeaveGame());
|
||||
}
|
||||
scene->clearViews();
|
||||
deleteLater();
|
||||
return true;
|
||||
}
|
||||
|
||||
void TabGame::actSay()
|
||||
|
|
@ -1598,7 +1606,7 @@ void TabGame::createMenuItems()
|
|||
aConcede = new QAction(this);
|
||||
connect(aConcede, SIGNAL(triggered()), this, SLOT(actConcede()));
|
||||
aLeaveGame = new QAction(this);
|
||||
connect(aLeaveGame, SIGNAL(triggered()), this, SLOT(actLeaveGame()));
|
||||
connect(aLeaveGame, &QAction::triggered, this, [this] { closeRequest(); });
|
||||
aFocusChat = new QAction(this);
|
||||
connect(aFocusChat, SIGNAL(triggered()), sayEdit, SLOT(setFocus()));
|
||||
aCloseReplay = nullptr;
|
||||
|
|
@ -1648,7 +1656,7 @@ void TabGame::createReplayMenuItems()
|
|||
aFocusChat = nullptr;
|
||||
aLeaveGame = nullptr;
|
||||
aCloseReplay = new QAction(this);
|
||||
connect(aCloseReplay, SIGNAL(triggered()), this, SLOT(actLeaveGame()));
|
||||
connect(aCloseReplay, &QAction::triggered, this, [this] { closeRequest(); });
|
||||
|
||||
phasesMenu = nullptr;
|
||||
gameMenu = new QMenu(this);
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ signals:
|
|||
void stateChanged();
|
||||
|
||||
public:
|
||||
ToggleButton(QWidget *parent = nullptr);
|
||||
explicit ToggleButton(QWidget *parent = nullptr);
|
||||
bool getState() const
|
||||
{
|
||||
return state;
|
||||
|
|
@ -80,7 +80,7 @@ public:
|
|||
void setState(bool _state);
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *event);
|
||||
void paintEvent(QPaintEvent *event) override;
|
||||
};
|
||||
|
||||
class DeckViewContainer : public QWidget
|
||||
|
|
@ -189,6 +189,7 @@ private:
|
|||
void startGame(bool resuming);
|
||||
void stopGame();
|
||||
void closeGame();
|
||||
bool leaveGame();
|
||||
|
||||
void eventSpectatorSay(const Event_GameSay &event, int eventPlayerId, const GameEventContext &context);
|
||||
void eventSpectatorLeave(const Event_Leave &event, int eventPlayerId, const GameEventContext &context);
|
||||
|
|
@ -242,7 +243,6 @@ private slots:
|
|||
|
||||
void actGameInfo();
|
||||
void actConcede();
|
||||
void actLeaveGame();
|
||||
void actRemoveLocalArrows();
|
||||
void actRotateViewCW();
|
||||
void actRotateViewCCW();
|
||||
|
|
@ -278,7 +278,7 @@ public:
|
|||
~TabGame() override;
|
||||
void retranslateUi() override;
|
||||
void updatePlayerListDockTitle();
|
||||
void closeRequest() override;
|
||||
void closeRequest(bool forced = false) override;
|
||||
const QMap<int, Player *> &getPlayers() const
|
||||
{
|
||||
return players;
|
||||
|
|
|
|||
|
|
@ -21,8 +21,7 @@
|
|||
#include <QtGui>
|
||||
#include <QtWidgets>
|
||||
|
||||
TabLog::TabLog(TabSupervisor *_tabSupervisor, AbstractClient *_client, QWidget *parent)
|
||||
: Tab(_tabSupervisor, parent), client(_client)
|
||||
TabLog::TabLog(TabSupervisor *_tabSupervisor, AbstractClient *_client) : Tab(_tabSupervisor), client(_client)
|
||||
{
|
||||
roomTable = new QTableWidget();
|
||||
roomTable->setColumnCount(6);
|
||||
|
|
|
|||
|
|
@ -53,10 +53,10 @@ private slots:
|
|||
void restartLayout();
|
||||
|
||||
public:
|
||||
TabLog(TabSupervisor *_tabSupervisor, AbstractClient *_client, QWidget *parent = nullptr);
|
||||
~TabLog();
|
||||
void retranslateUi();
|
||||
QString getTabText() const
|
||||
TabLog(TabSupervisor *_tabSupervisor, AbstractClient *_client);
|
||||
~TabLog() override;
|
||||
void retranslateUi() override;
|
||||
QString getTabText() const override
|
||||
{
|
||||
return tr("Logs");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ TabMessage::TabMessage(TabSupervisor *_tabSupervisor,
|
|||
vbox->addWidget(sayEdit);
|
||||
|
||||
aLeave = new QAction(this);
|
||||
connect(aLeave, SIGNAL(triggered()), this, SLOT(actLeave()));
|
||||
connect(aLeave, &QAction::triggered, this, [this] { closeRequest(); });
|
||||
|
||||
messageMenu = new QMenu(this);
|
||||
messageMenu->addAction(aLeave);
|
||||
|
|
@ -53,7 +53,6 @@ TabMessage::TabMessage(TabSupervisor *_tabSupervisor,
|
|||
|
||||
TabMessage::~TabMessage()
|
||||
{
|
||||
emit talkClosing(this);
|
||||
delete ownUserInfo;
|
||||
delete otherUserInfo;
|
||||
}
|
||||
|
|
@ -86,9 +85,10 @@ QString TabMessage::getTabText() const
|
|||
return tr("%1 - Private chat").arg(QString::fromStdString(otherUserInfo->name()));
|
||||
}
|
||||
|
||||
void TabMessage::closeRequest()
|
||||
void TabMessage::closeRequest(bool /*forced*/)
|
||||
{
|
||||
actLeave();
|
||||
emit talkClosing(this);
|
||||
close();
|
||||
}
|
||||
|
||||
void TabMessage::sendMessage()
|
||||
|
|
@ -114,11 +114,6 @@ void TabMessage::messageSent(const Response &response)
|
|||
"This user is ignoring you, they cannot see your messages in main chat and you cannot join their games."));
|
||||
}
|
||||
|
||||
void TabMessage::actLeave()
|
||||
{
|
||||
deleteLater();
|
||||
}
|
||||
|
||||
void TabMessage::processUserMessageEvent(const Event_UserMessage &event)
|
||||
{
|
||||
auto userInfo = event.sender_name() == otherUserInfo->name() ? otherUserInfo : ownUserInfo;
|
||||
|
|
|
|||
|
|
@ -29,7 +29,6 @@ signals:
|
|||
void maximizeClient();
|
||||
private slots:
|
||||
void sendMessage();
|
||||
void actLeave();
|
||||
void messageSent(const Response &response);
|
||||
void addMentionTag(QString mentionTag);
|
||||
void messageClicked();
|
||||
|
|
@ -39,12 +38,12 @@ public:
|
|||
AbstractClient *_client,
|
||||
const ServerInfo_User &_ownUserInfo,
|
||||
const ServerInfo_User &_otherUserInfo);
|
||||
~TabMessage();
|
||||
void retranslateUi();
|
||||
void closeRequest();
|
||||
void tabActivated();
|
||||
~TabMessage() override;
|
||||
void retranslateUi() override;
|
||||
void closeRequest(bool forced = false) override;
|
||||
void tabActivated() override;
|
||||
QString getUserName() const;
|
||||
QString getTabText() const;
|
||||
QString getTabText() const override;
|
||||
|
||||
void processUserMessageEvent(const Event_UserMessage &event);
|
||||
|
||||
|
|
|
|||
|
|
@ -59,8 +59,8 @@ signals:
|
|||
|
||||
public:
|
||||
TabReplays(TabSupervisor *_tabSupervisor, AbstractClient *_client);
|
||||
void retranslateUi();
|
||||
QString getTabText() const
|
||||
void retranslateUi() override;
|
||||
QString getTabText() const override
|
||||
{
|
||||
return tr("Game replays");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -101,7 +101,7 @@ TabRoom::TabRoom(TabSupervisor *_tabSupervisor,
|
|||
hbox->addWidget(userList, 1);
|
||||
|
||||
aLeaveRoom = new QAction(this);
|
||||
connect(aLeaveRoom, SIGNAL(triggered()), this, SLOT(actLeaveRoom()));
|
||||
connect(aLeaveRoom, &QAction::triggered, this, [this] { closeRequest(); });
|
||||
|
||||
roomMenu = new QMenu(this);
|
||||
roomMenu->addAction(aLeaveRoom);
|
||||
|
|
@ -135,11 +135,6 @@ TabRoom::TabRoom(TabSupervisor *_tabSupervisor,
|
|||
setCentralWidget(mainWidget);
|
||||
}
|
||||
|
||||
TabRoom::~TabRoom()
|
||||
{
|
||||
emit roomClosing(this);
|
||||
}
|
||||
|
||||
void TabRoom::retranslateUi()
|
||||
{
|
||||
gameSelector->retranslateUi();
|
||||
|
|
@ -175,9 +170,11 @@ void TabRoom::actShowPopup(const QString &message)
|
|||
}
|
||||
}
|
||||
|
||||
void TabRoom::closeRequest()
|
||||
void TabRoom::closeRequest(bool /*forced*/)
|
||||
{
|
||||
actLeaveRoom();
|
||||
sendRoomCommand(prepareRoomCommand(Command_LeaveRoom()));
|
||||
emit roomClosing(this);
|
||||
close();
|
||||
}
|
||||
|
||||
void TabRoom::tabActivated()
|
||||
|
|
@ -216,12 +213,6 @@ void TabRoom::sayFinished(const Response &response)
|
|||
chatView->appendMessage(tr("You are flooding the chat. Please wait a couple of seconds."));
|
||||
}
|
||||
|
||||
void TabRoom::actLeaveRoom()
|
||||
{
|
||||
sendRoomCommand(prepareRoomCommand(Command_LeaveRoom()));
|
||||
deleteLater();
|
||||
}
|
||||
|
||||
void TabRoom::actClearChat()
|
||||
{
|
||||
chatView->clearChat();
|
||||
|
|
|
|||
|
|
@ -70,7 +70,6 @@ signals:
|
|||
private slots:
|
||||
void sendMessage();
|
||||
void sayFinished(const Response &response);
|
||||
void actLeaveRoom();
|
||||
void actClearChat();
|
||||
void actOpenChatSettings();
|
||||
void addMentionTag(QString mentionTag);
|
||||
|
|
@ -91,10 +90,9 @@ public:
|
|||
AbstractClient *_client,
|
||||
ServerInfo_User *_ownUser,
|
||||
const ServerInfo_Room &info);
|
||||
~TabRoom();
|
||||
void retranslateUi();
|
||||
void closeRequest();
|
||||
void tabActivated();
|
||||
void retranslateUi() override;
|
||||
void closeRequest(bool forced = false) override;
|
||||
void tabActivated() override;
|
||||
void processRoomEvent(const RoomEvent &event);
|
||||
int getRoomId() const
|
||||
{
|
||||
|
|
@ -108,7 +106,7 @@ public:
|
|||
{
|
||||
return roomName;
|
||||
}
|
||||
QString getTabText() const
|
||||
QString getTabText() const override
|
||||
{
|
||||
return roomName;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -138,8 +138,7 @@ void RoomSelector::joinClicked()
|
|||
emit joinRoomRequest(id, true);
|
||||
}
|
||||
|
||||
TabServer::TabServer(TabSupervisor *_tabSupervisor, AbstractClient *_client, QWidget *parent)
|
||||
: Tab(_tabSupervisor, parent), client(_client)
|
||||
TabServer::TabServer(TabSupervisor *_tabSupervisor, AbstractClient *_client) : Tab(_tabSupervisor), client(_client)
|
||||
{
|
||||
roomSelector = new RoomSelector(client);
|
||||
serverInfoBox = new QTextBrowser;
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ signals:
|
|||
void joinRoomRequest(int, bool setCurrent);
|
||||
|
||||
public:
|
||||
RoomSelector(AbstractClient *_client, QWidget *parent = nullptr);
|
||||
explicit RoomSelector(AbstractClient *_client, QWidget *parent = nullptr);
|
||||
void retranslateUi();
|
||||
};
|
||||
|
||||
|
|
@ -55,9 +55,9 @@ private:
|
|||
bool shouldEmitUpdate = false;
|
||||
|
||||
public:
|
||||
TabServer(TabSupervisor *_tabSupervisor, AbstractClient *_client, QWidget *parent = nullptr);
|
||||
void retranslateUi();
|
||||
QString getTabText() const
|
||||
TabServer(TabSupervisor *_tabSupervisor, AbstractClient *_client);
|
||||
void retranslateUi() override;
|
||||
QString getTabText() const override
|
||||
{
|
||||
return tr("Server");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -304,29 +304,26 @@ void TabSupervisor::stop()
|
|||
tabAdmin = 0;
|
||||
tabLog = 0;
|
||||
|
||||
for (const auto tab : deckEditorTabs) {
|
||||
disconnect(tab, nullptr, this, nullptr);
|
||||
tab->deleteLater();
|
||||
}
|
||||
deckEditorTabs.clear();
|
||||
QList<Tab *> tabsToDelete;
|
||||
|
||||
for (auto i = roomTabs.cbegin(), end = roomTabs.cend(); i != end; ++i) {
|
||||
disconnect(i.value(), nullptr, this, nullptr);
|
||||
i.value()->deleteLater();
|
||||
tabsToDelete << i.value();
|
||||
}
|
||||
roomTabs.clear();
|
||||
|
||||
for (auto i = gameTabs.cbegin(), end = gameTabs.cend(); i != end; ++i) {
|
||||
disconnect(i.value(), nullptr, this, nullptr);
|
||||
i.value()->deleteLater();
|
||||
tabsToDelete << i.value();
|
||||
}
|
||||
gameTabs.clear();
|
||||
|
||||
for (const auto tab : replayTabs) {
|
||||
disconnect(tab, nullptr, this, nullptr);
|
||||
tab->deleteLater();
|
||||
for (auto i = messageTabs.cbegin(), end = messageTabs.cend(); i != end; ++i) {
|
||||
tabsToDelete << i.value();
|
||||
}
|
||||
messageTabs.clear();
|
||||
|
||||
for (const auto tab : tabsToDelete) {
|
||||
tab->closeRequest(true);
|
||||
}
|
||||
replayTabs.clear();
|
||||
|
||||
delete userInfo;
|
||||
userInfo = 0;
|
||||
|
|
@ -342,19 +339,12 @@ void TabSupervisor::updatePingTime(int value, int max)
|
|||
setTabIcon(indexOf(tabServer), QIcon(PingPixmapGenerator::generatePixmap(15, value, max)));
|
||||
}
|
||||
|
||||
void TabSupervisor::closeButtonPressed()
|
||||
{
|
||||
Tab *tab = static_cast<Tab *>(static_cast<CloseButton *>(sender())->property("tab").value<QObject *>());
|
||||
tab->closeRequest();
|
||||
}
|
||||
|
||||
void TabSupervisor::addCloseButtonToTab(Tab *tab, int tabIndex)
|
||||
{
|
||||
QTabBar::ButtonPosition closeSide =
|
||||
(QTabBar::ButtonPosition)tabBar()->style()->styleHint(QStyle::SH_TabBar_CloseButtonPosition, 0, tabBar());
|
||||
CloseButton *closeButton = new CloseButton;
|
||||
connect(closeButton, &CloseButton::clicked, this, &TabSupervisor::closeButtonPressed);
|
||||
closeButton->setProperty("tab", QVariant::fromValue((QObject *)tab));
|
||||
auto closeSide = static_cast<QTabBar::ButtonPosition>(
|
||||
tabBar()->style()->styleHint(QStyle::SH_TabBar_CloseButtonPosition, nullptr, tabBar()));
|
||||
auto *closeButton = new CloseButton(tab);
|
||||
connect(closeButton, &CloseButton::clicked, tab, [tab] { tab->closeRequest(); });
|
||||
tabBar()->setTabButton(tabIndex, closeSide, closeButton);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -38,28 +38,28 @@ class MacOSTabFixStyle : public QProxyStyle
|
|||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
QRect subElementRect(SubElement, const QStyleOption *, const QWidget *) const;
|
||||
QRect subElementRect(SubElement, const QStyleOption *, const QWidget *) const override;
|
||||
};
|
||||
|
||||
class CloseButton : public QAbstractButton
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
CloseButton(QWidget *parent = nullptr);
|
||||
QSize sizeHint() const;
|
||||
inline QSize minimumSizeHint() const
|
||||
explicit CloseButton(QWidget *parent = nullptr);
|
||||
QSize sizeHint() const override;
|
||||
inline QSize minimumSizeHint() const override
|
||||
{
|
||||
return sizeHint();
|
||||
}
|
||||
|
||||
protected:
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||
void enterEvent(QEnterEvent *event);
|
||||
void enterEvent(QEnterEvent *event) override;
|
||||
#else
|
||||
void enterEvent(QEvent *event);
|
||||
void enterEvent(QEvent *event) override;
|
||||
#endif
|
||||
void leaveEvent(QEvent *event);
|
||||
void paintEvent(QPaintEvent *event);
|
||||
void leaveEvent(QEvent *event) override;
|
||||
void paintEvent(QPaintEvent *event) override;
|
||||
};
|
||||
|
||||
class TabSupervisor : public QTabWidget, public UserlistProxy
|
||||
|
|
@ -87,8 +87,8 @@ private:
|
|||
bool isLocalGame;
|
||||
|
||||
public:
|
||||
TabSupervisor(AbstractClient *_client, QWidget *parent = nullptr);
|
||||
~TabSupervisor();
|
||||
explicit TabSupervisor(AbstractClient *_client, QWidget *parent = nullptr);
|
||||
~TabSupervisor() override;
|
||||
void retranslateUi();
|
||||
void start(const ServerInfo_User &userInfo);
|
||||
void startLocal(const QList<AbstractClient *> &_clients);
|
||||
|
|
@ -116,11 +116,11 @@ public:
|
|||
}
|
||||
bool getAdminLocked() const;
|
||||
bool closeRequest();
|
||||
bool isOwnUserRegistered() const;
|
||||
QString getOwnUsername() const;
|
||||
bool isUserBuddy(const QString &userName) const;
|
||||
bool isUserIgnored(const QString &userName) const;
|
||||
const ServerInfo_User *getOnlineUser(const QString &userName) const;
|
||||
bool isOwnUserRegistered() const override;
|
||||
QString getOwnUsername() const override;
|
||||
bool isUserBuddy(const QString &userName) const override;
|
||||
bool isUserIgnored(const QString &userName) const override;
|
||||
const ServerInfo_User *getOnlineUser(const QString &userName) const override;
|
||||
bool switchToGameTabIfAlreadyExists(const int gameId);
|
||||
void actShowPopup(const QString &message);
|
||||
signals:
|
||||
|
|
@ -135,7 +135,6 @@ public slots:
|
|||
void openReplay(GameReplay *replay);
|
||||
void maximizeMainWindow();
|
||||
private slots:
|
||||
void closeButtonPressed();
|
||||
void updateCurrent(int index);
|
||||
void updatePingTime(int value, int max);
|
||||
void gameJoined(const Event_GameJoined &event);
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ TabDeckStorageVisual::TabDeckStorageVisual(TabSupervisor *_tabSupervisor, Abstra
|
|||
retranslateUi();
|
||||
}
|
||||
|
||||
void TabDeckStorageVisual::closeRequest()
|
||||
void TabDeckStorageVisual::closeRequest(bool /*forced*/)
|
||||
{
|
||||
this->close();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -866,7 +866,7 @@ MainWindow::MainWindow(QWidget *parent)
|
|||
createActions();
|
||||
createMenus();
|
||||
|
||||
tabSupervisor = new TabSupervisor(client);
|
||||
tabSupervisor = new TabSupervisor(client, this);
|
||||
connect(tabSupervisor, &TabSupervisor::setMenu, this, &MainWindow::updateTabMenu);
|
||||
connect(tabSupervisor, &TabSupervisor::localGameEnded, this, &MainWindow::localGameEnded);
|
||||
connect(tabSupervisor, &TabSupervisor::showWindowIfHidden, this, &MainWindow::showWindowIfHidden);
|
||||
|
|
|
|||
|
|
@ -3668,7 +3668,7 @@ Cockatrice will now reload the card database.</translation>
|
|||
<source>%1 is looking at the %4 %3 card(s) %2.</source>
|
||||
<oldsource>%1 is looking at the top %3 card(s) %2.</oldsource>
|
||||
<comment>top card for singular, top %3 cards for plural</comment>
|
||||
<translation><numerusform>%1 is looking at the %4 %3 card(s) %2.</numerusform><numerusform>%1 is looking at the %4 %3 card(s) %2.</numerusform></translation>
|
||||
<translation><numerusform>%1 is looking at the %4 %3 card %2.</numerusform><numerusform>%1 is looking at the %4 %3 cards %2.</numerusform></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="src/server/message_log_widget.cpp" line="393"/>
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue