tab modified indicator
This commit is contained in:
parent
5d6652f5de
commit
70594387de
5 changed files with 103 additions and 7 deletions
|
@ -1,6 +1,7 @@
|
||||||
<RCC>
|
<RCC>
|
||||||
<qresource prefix="/" >
|
<qresource prefix="/" >
|
||||||
<file alias="back.svg" >resources/back.svg</file>
|
<file alias="back.svg" >resources/back.svg</file>
|
||||||
|
<file>resources/icon_tab_changed.svg</file>
|
||||||
<file>resources/icon_config_general.svg</file>
|
<file>resources/icon_config_general.svg</file>
|
||||||
<file>resources/icon_config_appearance.svg</file>
|
<file>resources/icon_config_appearance.svg</file>
|
||||||
<file>resources/icon_config_messages.svg</file>
|
<file>resources/icon_config_messages.svg</file>
|
||||||
|
|
75
cockatrice/resources/icon_tab_changed.svg
Normal file
75
cockatrice/resources/icon_tab_changed.svg
Normal file
|
@ -0,0 +1,75 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||||
|
|
||||||
|
<svg
|
||||||
|
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||||
|
xmlns:cc="http://creativecommons.org/ns#"
|
||||||
|
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||||
|
xmlns:svg="http://www.w3.org/2000/svg"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||||
|
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||||
|
width="100"
|
||||||
|
height="100"
|
||||||
|
id="svg2858"
|
||||||
|
version="1.1"
|
||||||
|
inkscape:version="0.47pre4 r22446"
|
||||||
|
sodipodi:docname="New document 2">
|
||||||
|
<defs
|
||||||
|
id="defs2860">
|
||||||
|
<inkscape:perspective
|
||||||
|
sodipodi:type="inkscape:persp3d"
|
||||||
|
inkscape:vp_x="0 : 526.18109 : 1"
|
||||||
|
inkscape:vp_y="0 : 1000 : 0"
|
||||||
|
inkscape:vp_z="744.09448 : 526.18109 : 1"
|
||||||
|
inkscape:persp3d-origin="372.04724 : 350.78739 : 1"
|
||||||
|
id="perspective2866" />
|
||||||
|
<inkscape:perspective
|
||||||
|
id="perspective2853"
|
||||||
|
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
|
||||||
|
inkscape:vp_z="1 : 0.5 : 1"
|
||||||
|
inkscape:vp_y="0 : 1000 : 0"
|
||||||
|
inkscape:vp_x="0 : 0.5 : 1"
|
||||||
|
sodipodi:type="inkscape:persp3d" />
|
||||||
|
</defs>
|
||||||
|
<sodipodi:namedview
|
||||||
|
id="base"
|
||||||
|
pagecolor="#ffffff"
|
||||||
|
bordercolor="#666666"
|
||||||
|
borderopacity="1.0"
|
||||||
|
inkscape:pageopacity="0.0"
|
||||||
|
inkscape:pageshadow="2"
|
||||||
|
inkscape:zoom="5"
|
||||||
|
inkscape:cx="49.8"
|
||||||
|
inkscape:cy="49.523097"
|
||||||
|
inkscape:document-units="px"
|
||||||
|
inkscape:current-layer="layer1"
|
||||||
|
showgrid="false"
|
||||||
|
inkscape:window-width="1280"
|
||||||
|
inkscape:window-height="750"
|
||||||
|
inkscape:window-x="-4"
|
||||||
|
inkscape:window-y="-3"
|
||||||
|
inkscape:window-maximized="1" />
|
||||||
|
<metadata
|
||||||
|
id="metadata2863">
|
||||||
|
<rdf:RDF>
|
||||||
|
<cc:Work
|
||||||
|
rdf:about="">
|
||||||
|
<dc:format>image/svg+xml</dc:format>
|
||||||
|
<dc:type
|
||||||
|
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||||
|
<dc:title></dc:title>
|
||||||
|
</cc:Work>
|
||||||
|
</rdf:RDF>
|
||||||
|
</metadata>
|
||||||
|
<g
|
||||||
|
inkscape:label="Layer 1"
|
||||||
|
inkscape:groupmode="layer"
|
||||||
|
id="layer1"
|
||||||
|
transform="translate(0,-952.36218)">
|
||||||
|
<path
|
||||||
|
style="font-size:253.89010620000001950px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;fill:#78ff50;fill-opacity:1;stroke:#000000;stroke-width:2.39700006999999982;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;display:inline;font-family:Century Schoolbook L;-inkscape-font-specification:Century Schoolbook L Medium"
|
||||||
|
d="m 53.225642,1018.5513 c 0.486911,-13.2677 1.704142,-22.64046 4.016877,-30.55249 3.895149,-13.38951 4.138607,-14.48503 4.138607,-19.23224 0,-7.66855 -4.260334,-12.17232 -11.320268,-12.17232 -7.181659,0 -11.441984,4.50377 -11.441984,12.17232 0,3.16481 0.60863,7.18167 1.704135,10.83336 4.868924,16.06746 5.720972,21.30157 6.45134,38.95137 l 6.451293,0 m -3.286511,6.8165 c -6.207884,0 -11.320257,5.1124 -11.320257,11.3204 0,6.2079 5.112373,11.4419 11.198528,11.4419 6.451342,0 11.563724,-5.1124 11.563724,-11.4419 0,-6.208 -5.112382,-11.3204 -11.441995,-11.3204"
|
||||||
|
id="text3838" />
|
||||||
|
</g>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 3.1 KiB |
|
@ -11,10 +11,14 @@ signals:
|
||||||
void userEvent();
|
void userEvent();
|
||||||
protected:
|
protected:
|
||||||
QMenu *tabMenu;
|
QMenu *tabMenu;
|
||||||
|
private:
|
||||||
|
bool contentsChanged;
|
||||||
public:
|
public:
|
||||||
Tab(QWidget *parent = 0)
|
Tab(QWidget *parent = 0)
|
||||||
: QWidget(parent), tabMenu(0) { }
|
: QWidget(parent), tabMenu(0), contentsChanged(false) { }
|
||||||
QMenu *getTabMenu() const { return tabMenu; }
|
QMenu *getTabMenu() const { return tabMenu; }
|
||||||
|
bool getContentsChanged() const { return contentsChanged; }
|
||||||
|
void setContentsChanged(bool _contentsChanged) { contentsChanged = _contentsChanged; }
|
||||||
virtual QString getTabText() const = 0;
|
virtual QString getTabText() const = 0;
|
||||||
virtual void retranslateUi() = 0;
|
virtual void retranslateUi() = 0;
|
||||||
};
|
};
|
||||||
|
|
|
@ -11,8 +11,14 @@
|
||||||
TabSupervisor:: TabSupervisor(QWidget *parent)
|
TabSupervisor:: TabSupervisor(QWidget *parent)
|
||||||
: QTabWidget(parent), client(0), tabServer(0), tabDeckStorage(0)
|
: QTabWidget(parent), client(0), tabServer(0), tabDeckStorage(0)
|
||||||
{
|
{
|
||||||
|
tabChangedIcon = new QIcon(":/resources/icon_tab_changed.svg");
|
||||||
setIconSize(QSize(15, 15));
|
setIconSize(QSize(15, 15));
|
||||||
connect(this, SIGNAL(currentChanged(int)), this, SLOT(updateMenu(int)));
|
connect(this, SIGNAL(currentChanged(int)), this, SLOT(updateCurrent(int)));
|
||||||
|
}
|
||||||
|
|
||||||
|
TabSupervisor::~TabSupervisor()
|
||||||
|
{
|
||||||
|
delete tabChangedIcon;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TabSupervisor::retranslateUi()
|
void TabSupervisor::retranslateUi()
|
||||||
|
@ -131,7 +137,10 @@ void TabSupervisor::chatChannelLeft(TabChatChannel *tab)
|
||||||
void TabSupervisor::tabUserEvent()
|
void TabSupervisor::tabUserEvent()
|
||||||
{
|
{
|
||||||
Tab *tab = static_cast<Tab *>(sender());
|
Tab *tab = static_cast<Tab *>(sender());
|
||||||
// XXX Mark tab as changed (exclamation mark icon?)
|
if (tab != currentWidget()) {
|
||||||
|
tab->setContentsChanged(true);
|
||||||
|
setTabIcon(indexOf(tab), *tabChangedIcon);
|
||||||
|
}
|
||||||
QApplication::alert(this);
|
QApplication::alert(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -152,10 +161,15 @@ void TabSupervisor::processGameEvent(GameEvent *event)
|
||||||
qDebug() << "gameEvent: invalid gameId";
|
qDebug() << "gameEvent: invalid gameId";
|
||||||
}
|
}
|
||||||
|
|
||||||
void TabSupervisor::updateMenu(int index)
|
void TabSupervisor::updateCurrent(int index)
|
||||||
{
|
{
|
||||||
if (index != -1)
|
if (index != -1) {
|
||||||
|
Tab *tab = static_cast<Tab *>(widget(index));
|
||||||
|
if (tab->getContentsChanged()) {
|
||||||
|
setTabIcon(index, QIcon());
|
||||||
|
tab->setContentsChanged(false);
|
||||||
|
}
|
||||||
emit setMenu(static_cast<Tab *>(widget(index))->getTabMenu());
|
emit setMenu(static_cast<Tab *>(widget(index))->getTabMenu());
|
||||||
else
|
} else
|
||||||
emit setMenu(0);
|
emit setMenu(0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,6 +18,7 @@ class Event_GameJoined;
|
||||||
class TabSupervisor : public QTabWidget {
|
class TabSupervisor : public QTabWidget {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
private:
|
private:
|
||||||
|
QIcon *tabChangedIcon;
|
||||||
Client *client;
|
Client *client;
|
||||||
TabServer *tabServer;
|
TabServer *tabServer;
|
||||||
TabDeckStorage *tabDeckStorage;
|
TabDeckStorage *tabDeckStorage;
|
||||||
|
@ -26,13 +27,14 @@ private:
|
||||||
void myAddTab(Tab *tab);
|
void myAddTab(Tab *tab);
|
||||||
public:
|
public:
|
||||||
TabSupervisor(QWidget *parent = 0);
|
TabSupervisor(QWidget *parent = 0);
|
||||||
|
~TabSupervisor();
|
||||||
void retranslateUi();
|
void retranslateUi();
|
||||||
void start(Client *_client);
|
void start(Client *_client);
|
||||||
void stop();
|
void stop();
|
||||||
signals:
|
signals:
|
||||||
void setMenu(QMenu *menu);
|
void setMenu(QMenu *menu);
|
||||||
private slots:
|
private slots:
|
||||||
void updateMenu(int index);
|
void updateCurrent(int index);
|
||||||
void updatePingTime(int value, int max);
|
void updatePingTime(int value, int max);
|
||||||
void gameJoined(Event_GameJoined *event);
|
void gameJoined(Event_GameJoined *event);
|
||||||
void gameLeft(TabGame *tab);
|
void gameLeft(TabGame *tab);
|
||||||
|
|
Loading…
Reference in a new issue