Skip to content

Commit

Permalink
[FEATURE] show routes of hovered pilots and airports
Browse files Browse the repository at this point in the history
This shows the full route(s) of pilots and airports on hover.
  • Loading branch information
jonaseberle committed Jun 14, 2023
1 parent bd86d0c commit 4e05acc
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
21 changes: 16 additions & 5 deletions src/GLWidget.cpp
Expand Up @@ -289,7 +289,12 @@ void GLWidget::createPilotsList() {
continue;
}

if (!p->showDepLine() && !p->showDestLine()) {
const bool isHovered = m_hoveredObjects.contains(p)
|| m_hoveredObjects.contains(p->depAirport())
|| m_hoveredObjects.contains(p->destAirport())
;

if (!isHovered && !p->showDepLine() && !p->showDestLine()) {
continue;
}

Expand All @@ -299,7 +304,12 @@ void GLWidget::createPilotsList() {
QList<DoublePair> points; // these are the points that really get drawn

// Dep -> plane
if (p->showDepLine() && !qFuzzyIsNull(Settings::depLineStrength()) && !Settings::onlyShowImmediateRoutePart()) {
if (
(
isHovered || (p->showDepLine() && !Settings::onlyShowImmediateRoutePart())
)
&& !qFuzzyIsNull(Settings::depLineStrength())
) {
for (int i = 0; i < next; i++) {
if (!m_usedWaypointMapObjects.contains(waypoints[i])) {
m_usedWaypointMapObjects.append(waypoints[i]);
Expand All @@ -326,7 +336,7 @@ void GLWidget::createPilotsList() {
points.append(DoublePair(p->lat, p->lon));

// plane -> Dest
if (p->showDestLine() && next < waypoints.size()) {
if ((isHovered || p->showDestLine()) && next < waypoints.size()) {
// immediate
auto destImmediateNm = p->groundspeed * (Settings::destImmediateDurationMin() / 60.);

Expand Down Expand Up @@ -361,7 +371,7 @@ void GLWidget::createPilotsList() {
}

glPushAttrib(GL_ENABLE_BIT);
if (Settings::onlyShowImmediateRoutePart()) {
if (!isHovered && Settings::onlyShowImmediateRoutePart()) {
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glEnable(GL_TEXTURE_1D);
glBindTexture(GL_TEXTURE_1D, _immediateRouteTex);
Expand All @@ -375,7 +385,7 @@ void GLWidget::createPilotsList() {
}

// rest
if (!qFuzzyIsNull(Settings::destLineStrength()) && !Settings::onlyShowImmediateRoutePart()) {
if ((isHovered || !Settings::onlyShowImmediateRoutePart()) && !qFuzzyIsNull(Settings::destLineStrength())) {
while (points.size() > 1) {
points.takeFirst();
}
Expand Down Expand Up @@ -1347,6 +1357,7 @@ void GLWidget::mouseMoveEvent(QMouseEvent* event) {
break;
}
}
invalidatePilots(); // for hovered objects' routes
setCursor(hasPrimaryFunction? Qt::PointingHandCursor: Qt::ArrowCursor);
update();
}
Expand Down
3 changes: 2 additions & 1 deletion src/dialogs/PreferencesDialog.ui
Expand Up @@ -490,7 +490,8 @@ hr { height: 1px; border-width: 0; }
li.unchecked::marker { content: &quot;\2610&quot;; }
li.checked::marker { content: &quot;\2612&quot;; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-style:italic;&quot;&gt;QuteScoop can use the X-Plane 11 navigation database (AIRAC).&lt;br /&gt;Choose the directory that contains the file ‹earth_nav.dat›.&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-style:italic;&quot;&gt;QuteScoop can use the X-Plane 11 navigation database. You can get up-to-date data (AIRAC) &lt;/span&gt;&lt;span style=&quot; font-style:italic;&quot;&gt;from 3rd party vendors, for example Navigraph or Aerosoft&lt;/span&gt;&lt;span style=&quot; font-style:italic;&quot;&gt;.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-style:italic;&quot;&gt;&lt;br /&gt;Choose the directory (usually ‹./Custom Data›) that contains the file ‹earth_nav.dat›:&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="wordWrap">
<bool>true</bool>
Expand Down

0 comments on commit 4e05acc

Please sign in to comment.