Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Donald Haase
Cockatrice
Commits
1f33e34d
Commit
1f33e34d
authored
Mar 19, 2015
by
Fabio Bas
Browse files
Add tooltips to tabs
parent
31635d2a
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
cockatrice/src/tab_supervisor.cpp
View file @
1f33e34d
...
...
@@ -126,7 +126,10 @@ void TabSupervisor::retranslateUi()
for
(
int
i
=
0
;
i
<
tabs
.
size
();
++
i
)
if
(
tabs
[
i
])
{
setTabText
(
indexOf
(
tabs
[
i
]),
sanitizeTabName
(
tabs
[
i
]
->
getTabText
()));
int
idx
=
indexOf
(
tabs
[
i
]);
QString
tabText
=
tabs
[
i
]
->
getTabText
();
setTabText
(
idx
,
sanitizeTabName
(
tabText
));
setTabToolTip
(
idx
,
sanitizeHtml
(
tabText
));
tabs
[
i
]
->
retranslateUi
();
}
}
...
...
@@ -158,11 +161,25 @@ QString TabSupervisor::sanitizeTabName(QString dirty) const
return
dirty
.
replace
(
"&"
,
"&&"
);
}
QString
TabSupervisor
::
sanitizeHtml
(
QString
dirty
)
const
{
return
dirty
.
replace
(
"&"
,
"&"
)
.
replace
(
"<"
,
"<"
)
.
replace
(
">"
,
">"
)
.
replace
(
"
\"
"
,
"""
);
}
int
TabSupervisor
::
myAddTab
(
Tab
*
tab
)
{
connect
(
tab
,
SIGNAL
(
userEvent
(
bool
)),
this
,
SLOT
(
tabUserEvent
(
bool
)));
connect
(
tab
,
SIGNAL
(
tabTextChanged
(
Tab
*
,
QString
)),
this
,
SLOT
(
updateTabText
(
Tab
*
,
QString
)));
return
addTab
(
tab
,
sanitizeTabName
(
tab
->
getTabText
()));
QString
tabText
=
tab
->
getTabText
();
int
idx
=
addTab
(
tab
,
sanitizeTabName
(
tabText
));
setTabToolTip
(
idx
,
sanitizeHtml
(
tabText
));
return
idx
;
}
void
TabSupervisor
::
start
(
const
ServerInfo_User
&
_userInfo
)
...
...
@@ -457,7 +474,9 @@ void TabSupervisor::tabUserEvent(bool globalEvent)
void
TabSupervisor
::
updateTabText
(
Tab
*
tab
,
const
QString
&
newTabText
)
{
setTabText
(
indexOf
(
tab
),
newTabText
);
int
idx
=
indexOf
(
tab
);
setTabText
(
idx
,
sanitizeTabName
(
newTabText
));
setTabToolTip
(
idx
,
sanitizeHtml
(
newTabText
));
}
void
TabSupervisor
::
processRoomEvent
(
const
RoomEvent
&
event
)
...
...
cockatrice/src/tab_supervisor.h
View file @
1f33e34d
...
...
@@ -59,6 +59,7 @@ private:
int
myAddTab
(
Tab
*
tab
);
void
addCloseButtonToTab
(
Tab
*
tab
,
int
tabIndex
);
QString
sanitizeTabName
(
QString
dirty
)
const
;
QString
sanitizeHtml
(
QString
dirty
)
const
;
public:
TabSupervisor
(
AbstractClient
*
_client
,
QWidget
*
parent
=
0
);
~
TabSupervisor
();
...
...
cockatrice/translations/cockatrice_en.ts
View file @
1f33e34d
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment