Cockatrice/cockatrice/src/interface/widgets/tabs/tab.h
BruebachL 60ee81cfbe
[Client] Route cockatrice:// link clicks from chat to the intent chain (#7136)
* [Client] Route cockatrice:// link clicks from chat to the intent chain

A cockatrice:// link clicked in chat is currently handed to the OS (or
does nothing in-process). Clicks now emit a cockatriceLinkActivated signal
that travels ChatView -> Tab -> TabSupervisor -> MainWindow, which feeds
the URL through the same IntentUrlParser the OS activation path uses, so
the join runs entirely in-process. card/user schemes and all other links
behave as before.

* [Client] Route cockatrice:// link clicks from the in-game chat to the intent chain

* [Client] Reuse one IntentUrlParser instance for cockatrice:// links

Took 59 seconds

---------

Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
2026-08-17 01:03:37 +02:00

76 lines
1.7 KiB
C++

/**
* @file tab.h
* @ingroup Tabs
*/
//! \todo Document this file.
#ifndef TAB_H
#define TAB_H
#include <QMainWindow>
#include <libcockatrice/utility/card_ref.h>
class QMenu;
class TabSupervisor;
class CardInfoDisplayWidget;
class Tab : public QMainWindow
{
Q_OBJECT
signals:
void userEvent(bool globalEvent = true);
void tabTextChanged(Tab *tab, const QString &newTabText);
void cockatriceLinkActivated(const QString &url);
protected:
TabSupervisor *tabSupervisor;
void addTabMenu(QMenu *menu)
{
tabMenus.append(menu);
}
protected slots:
void showCardInfoPopup(const QPoint &pos, const CardRef &cardRef);
void deleteCardInfoPopup(const QString &cardName);
private:
CardRef currentCard;
bool contentsChanged;
CardInfoDisplayWidget *infoPopup;
QList<QMenu *> tabMenus;
public:
explicit Tab(TabSupervisor *_tabSupervisor);
[[nodiscard]] const QList<QMenu *> &getTabMenus() const
{
return tabMenus;
}
[[nodiscard]] TabSupervisor *getTabSupervisor() const
{
return tabSupervisor;
}
[[nodiscard]] bool getContentsChanged() const
{
return contentsChanged;
}
void setContentsChanged(bool _contentsChanged)
{
contentsChanged = _contentsChanged;
}
[[nodiscard]] virtual QString getTabText() const = 0;
virtual void retranslateUi() = 0;
/**
* Nicely asks to close the tab.
* Override this method to do checks or ask for confirmation before closing the tab.
* If you need to force close the tab, just call close() instead.
*
* @return True if the tab is successfully closed.
*/
virtual bool closeRequest();
virtual void tabActivated()
{
}
};
#endif