1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-03-16 08:29:15 +01:00

OP-1685 Simplifying the warning label code and layout.

This commit is contained in:
m_thread 2015-02-18 10:26:59 +01:00
parent 1b842ec322
commit 6c33fb8185
2 changed files with 12 additions and 47 deletions

View File

@ -52,7 +52,6 @@ ConfigOutputWidget::ConfigOutputWidget(QWidget *parent) : ConfigTaskWidget(paren
ui = new Ui_OutputWidget(); ui = new Ui_OutputWidget();
ui->setupUi(this); ui->setupUi(this);
ui->gvWarning->setScene(new QGraphicsScene(this));
ui->gvFrame->setVisible(false); ui->gvFrame->setVisible(false);
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance(); ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
@ -453,7 +452,8 @@ void ConfigOutputWidget::updateWarnings(UAVObject *)
if (systemAlarms.Alarm[SystemAlarms::ALARM_SYSTEMCONFIGURATION] > SystemAlarms::ALARM_WARNING) { if (systemAlarms.Alarm[SystemAlarms::ALARM_SYSTEMCONFIGURATION] > SystemAlarms::ALARM_WARNING) {
switch (systemAlarms.ExtendedAlarmStatus[SystemAlarms::EXTENDEDALARMSTATUS_SYSTEMCONFIGURATION]) { switch (systemAlarms.ExtendedAlarmStatus[SystemAlarms::EXTENDEDALARMSTATUS_SYSTEMCONFIGURATION]) {
case SystemAlarms::EXTENDEDALARMSTATUS_UNSUPPORTEDCONFIG_ONESHOT: case SystemAlarms::EXTENDEDALARMSTATUS_UNSUPPORTEDCONFIG_ONESHOT:
setWarning(tr("OneShot only works with MainPort settings marked with \"+OneShot\"\nUsing \"PPM_PIN6+OneShot\" bank 4 (output 6) must be set to PWM")); setWarning(tr("OneShot only works with Receiver Port settings marked with '+OneShot'\n"
"When using Receiver Port setting 'PPM_PIN6+OneShot' Bank 4 (output 6,9-10) must be set to PWM"));
return; return;
} }
} }
@ -462,18 +462,7 @@ void ConfigOutputWidget::updateWarnings(UAVObject *)
void ConfigOutputWidget::setWarning(QString message) void ConfigOutputWidget::setWarning(QString message)
{ {
QPixmap warningPic; ui->gvFrame->setVisible(!message.isNull());
ui->picWarning->setPixmap(message.isNull() ? QPixmap() : QPixmap(":/configgadget/images/error.svg"));
ui->gvWarning->scene()->clear();
if (!message.isNull()) {
warningPic.load(":/configgadget/images/error.svg");
ui->gvFrame->setVisible(true);
} else {
warningPic.load("");
ui->gvFrame->setVisible(false);
}
ui->gvWarning->scene()->addPixmap(warningPic);
ui->gvWarning->setSceneRect(warningPic.rect());
ui->gvWarning->fitInView(warningPic.rect(), Qt::KeepAspectRatio);
ui->txtWarning->setText(message); ui->txtWarning->setText(message);
} }

View File

@ -972,50 +972,26 @@ When using OneShot125 all values set in min/max and idle are divided by eight be
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
</property> </property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0"> <property name="sizeHint" stdset="0">
<size> <size>
<width>40</width> <width>70</width>
<height>20</height> <height>20</height>
</size> </size>
</property> </property>
</spacer> </spacer>
</item> </item>
<item alignment="Qt::AlignTop"> <item>
<widget class="QGraphicsView" name="gvWarning"> <widget class="QLabel" name="picWarning">
<property name="minimumSize"> <property name="text">
<size> <string/>
<width>32</width>
<height>32</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>32</width>
<height>32</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">background: transparent</string>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="renderHints">
<set>QPainter::HighQualityAntialiasing</set>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QLabel" name="txtWarning"> <widget class="QLabel" name="txtWarning">
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="text"> <property name="text">
<string/> <string/>
</property> </property>