1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-11-29 07:24:13 +01:00

Add all new alarm descriptions to resource file. Modify to show OK message and general usage tooltip.

This commit is contained in:
David Willis 2012-07-08 23:04:39 +01:00
parent 3125f4089d
commit e15615b2e4
4 changed files with 63 additions and 4 deletions

View File

@ -0,0 +1,13 @@
<html>
<head>
<title></title>
<meta content="">
<style></style>
</head>
<body>
<h1>Alarm: OK</h1>
<p>
There are no problems with this alarm.
</p>
</body>
</html>

View File

@ -3,5 +3,28 @@
<file>html/Actuator-Critical.html</file>
<file>html/ManualControl-Critical.html</file>
<file>html/ManualControl-Warning.html</file>
<file>html/CPU-Critical.html</file>
<file>html/CPU-Warning.html</file>
<file>html/FlightTime-Error.html</file>
<file>html/Battery-Warning.html</file>
<file>html/BootFault-Critical.html</file>
<file>html/EventSystem-Warning.html</file>
<file>html/FlightTime-Critical.html</file>
<file>html/AlarmOK.html</file>
<file>html/Attitude-Critical.html</file>
<file>html/Attitude-Error.html</file>
<file>html/Battery-Critical.html</file>
<file>html/Battery-Error.html</file>
<file>html/FlightTime-Warning.html</file>
<file>html/GPS-Critical.html</file>
<file>html/GPS-Error.html</file>
<file>html/GPS-Warning.html</file>
<file>html/Guidance-Warning.html</file>
<file>html/Memory-Critical.html</file>
<file>html/Memory-Warning.html</file>
<file>html/Sensors-Critical.html</file>
<file>html/Stabilization-Warning.html</file>
<file>html/Stack-Critical.html</file>
<file>html/Telemetry-Error.html</file>
</qresource>
</RCC>

View File

@ -63,6 +63,7 @@ SystemHealthGadgetWidget::SystemHealthGadgetWidget(QWidget *parent) : QGraphicsV
connect(telMngr, SIGNAL(connected()), this, SLOT(onAutopilotConnect()));
connect(telMngr, SIGNAL(disconnected()), this, SLOT(onAutopilotDisconnect()));
setToolTip(tr("Displays flight system errors. Click on an alarm for more information."));
}
/**
@ -206,12 +207,31 @@ void SystemHealthGadgetWidget::mousePressEvent ( QMouseEvent * event )
QGraphicsSvgItem *clickedItem = dynamic_cast<QGraphicsSvgItem*>(sceneItem);
if(clickedItem && (clickedItem != foreground) && clickedItem != background){
QFile alarmDescription(":/systemhealth/html/" + clickedItem->elementId() + ".html");
if(alarmDescription.open(QIODevice::ReadOnly | QIODevice::Text)){
QTextStream textStream(&alarmDescription);
QWhatsThis::showText(event->globalPos(), textStream.readAll());
// Clicked an actual alarm
QString itemId = clickedItem->elementId();
if(itemId.contains("OK")){
// No alarm set for this item
showAlarmDescriptionForItemId("AlarmOK", event->globalPos());
}else{
// Warning, error or critical alarm
showAlarmDescriptionForItemId(itemId, event->globalPos());
}
}else if(clickedItem){
// Clicked foreground or background
showAllAlarmDescriptions();
}
}
}
}
void SystemHealthGadgetWidget::showAlarmDescriptionForItemId(const QString itemId, const QPoint& location){
QFile alarmDescription(":/systemhealth/html/" + itemId + ".html");
if(alarmDescription.open(QIODevice::ReadOnly | QIODevice::Text)){
QTextStream textStream(&alarmDescription);
QWhatsThis::showText(location, textStream.readAll());
}
}
void SystemHealthGadgetWidget::showAllAlarmDescriptions(){
}

View File

@ -69,5 +69,8 @@ private:
// Simple flag to skip rendering if the
bool fgenabled; // layer does not exist.
void showAlarmDescriptionForItemId(const QString itemId, const QPoint& location);
void showAllAlarmDescriptions();
};
#endif /* SYSTEMHEALTHGADGETWIDGET_H_ */