Add HotSpot::File, differentiate between Url links and Local Files

wilder
Tomaz Canabrava 4 years ago committed by Tomaz Canabrava
parent 04d99f7cdc
commit 31a82152c3
  1. 2
      src/filterHotSpots/FileFilterHotspot.cpp
  2. 6
      src/filterHotSpots/FilterChain.cpp
  3. 2
      src/filterHotSpots/HotSpot.cpp
  4. 4
      src/filterHotSpots/HotSpot.h

@ -52,7 +52,7 @@ FileFilterHotSpot::FileFilterHotSpot(int startLine,
, _session(session)
, _thumbnailFinished(false)
{
setType(Link);
setType(File);
}
void FileFilterHotSpot::activate(QObject *)

@ -251,7 +251,7 @@ void FilterChain::paint(TerminalDisplay *td, QPainter &painter)
for (const auto &spot : spots) {
QRegion region;
if (spot->type() == HotSpot::Link || spot->type() == HotSpot::EMailAddress || spot->type() == HotSpot::EscapedUrl) {
if (spot->type() == HotSpot::Link || spot->type() == HotSpot::EMailAddress || spot->type() == HotSpot::EscapedUrl || spot->type() == HotSpot::File) {
QPair<QRegion, QRect> spotRegion =
spot->region(td->terminalFont()->fontWidth(), td->terminalFont()->fontHeight(), td->columns(), td->contentRect());
region = spotRegion.first;
@ -259,7 +259,7 @@ void FilterChain::paint(TerminalDisplay *td, QPainter &painter)
// TODO: Move this paint code to HotSpot->drawHint();
// TODO: Fix the Url Hints access from the Profile.
if (_showUrlHint && spot->type() == HotSpot::Link) {
if (_showUrlHint && (spot->type() == HotSpot::Link || spot->type() == HotSpot::File)) {
if (urlNumber >= 0 && urlNumber < 10) {
// Position at the beginning of the URL
QRect hintRect(*region.begin());
@ -327,7 +327,7 @@ void FilterChain::paint(TerminalDisplay *td, QPainter &painter)
// TODO: Fix accessing the urlHint here.
// TODO: Move this code to UrlFilterHotSpot.
const bool hasMouse = region.contains(td->mapFromGlobal(QCursor::pos()));
if ((spot->type() == HotSpot::Link && _showUrlHint) || hasMouse) {
if (((spot->type() == HotSpot::Link || spot->type() == HotSpot::File) && _showUrlHint) || hasMouse) {
QFontMetrics metrics(td->font());
// find the baseline (which is the invisible line that the characters in the font sit on,

@ -101,7 +101,7 @@ void HotSpot::mouseMoveEvent(TerminalDisplay *td, QMouseEvent *ev)
bool HotSpot::isUrl()
{
return (_type == HotSpot::Link || _type == HotSpot::EMailAddress || _type == HotSpot::EscapedUrl);
return (_type == HotSpot::Link || _type == HotSpot::EMailAddress || _type == HotSpot::EscapedUrl || _type == HotSpot::File);
}
void HotSpot::mouseEnterEvent(TerminalDisplay *td, QMouseEvent *ev)

@ -53,7 +53,9 @@ public:
enum Type {
// the type of the hotspot is not specified
NotSpecified,
// this hotspot represents a clickable link
// this hotspot rpresents a file on the filesystem
File,
// this hotspot represents a clickable URL link
Link,
// this hotspot represents a clickable e-mail address
EMailAddress,

Loading…
Cancel
Save