Commit 2f608734 authored by lm's avatar lm

Minor edits

parent 376aa04e
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
#include <QTextBrowser> #include <QTextBrowser>
#include <QMessageBox> #include <QMessageBox>
#include <QSettings> #include <QSettings>
#include <QDesktopServices>
#include "XMLCommProtocolWidget.h" #include "XMLCommProtocolWidget.h"
#include "ui_XMLCommProtocolWidget.h" #include "ui_XMLCommProtocolWidget.h"
...@@ -39,21 +40,26 @@ void XMLCommProtocolWidget::selectXMLFile() ...@@ -39,21 +40,26 @@ void XMLCommProtocolWidget::selectXMLFile()
dialog.setFilter(tr("MAVLink XML (*.xml)")); dialog.setFilter(tr("MAVLink XML (*.xml)"));
dialog.setViewMode(QFileDialog::Detail); dialog.setViewMode(QFileDialog::Detail);
QStringList fileNames; QStringList fileNames;
if (dialog.exec()) { if (dialog.exec())
{
fileNames = dialog.selectedFiles(); fileNames = dialog.selectedFiles();
} }
if (fileNames.size() > 0) { if (fileNames.size() > 0)
m_ui->fileNameLabel->setText(fileNames.first()); {
QFile file(fileNames.first()); QFile file(fileNames.first());
m_ui->fileNameLabel->setText(file.fileName());
if (file.open(QIODevice::ReadOnly | QIODevice::Text)) { if (file.open(QIODevice::ReadOnly | QIODevice::Text))
{
const QString instanceText(QString::fromUtf8(file.readAll())); const QString instanceText(QString::fromUtf8(file.readAll()));
setXML(instanceText); setXML(instanceText);
// Store filename for next time // Store filename for next time
settings.setValue(mavlinkXML, QFileInfo(file).absoluteFilePath()); settings.setValue(mavlinkXML, QFileInfo(file).absoluteFilePath());
settings.sync(); settings.sync();
} else { }
else
{
QMessageBox msgBox; QMessageBox msgBox;
msgBox.setText("Could not read XML file. Permission denied"); msgBox.setText("Could not read XML file. Permission denied");
msgBox.exec(); msgBox.exec();
...@@ -77,7 +83,7 @@ void XMLCommProtocolWidget::selectOutputDirectory() ...@@ -77,7 +83,7 @@ void XMLCommProtocolWidget::selectOutputDirectory()
{ {
QSettings settings("MAVLink Consortium", "MAVLink Generator"); QSettings settings("MAVLink Consortium", "MAVLink Generator");
const QString mavlinkOutputDir = "MAVLINK_OUTPUT_DIR"; const QString mavlinkOutputDir = "MAVLINK_OUTPUT_DIR";
QString dirPath = settings.value(mavlinkOutputDir, QCoreApplication::applicationDirPath() + "../").toString(); QString dirPath = settings.value(mavlinkOutputDir, QDesktopServices::DesktopLocation).toString();
QFileDialog dialog; QFileDialog dialog;
dialog.setDirectory(dirPath); dialog.setDirectory(dirPath);
dialog.setFileMode(QFileDialog::Directory); dialog.setFileMode(QFileDialog::Directory);
......
...@@ -13,19 +13,16 @@ ...@@ -13,19 +13,16 @@
<property name="windowTitle"> <property name="windowTitle">
<string>Form</string> <string>Form</string>
</property> </property>
<layout class="QGridLayout" name="gridLayout" rowstretch="1,0,0,0,0,0" columnstretch="1,0,0,0"> <layout class="QGridLayout" name="gridLayout" columnstretch="1,1,1,100">
<property name="topMargin"> <property name="horizontalSpacing">
<number>6</number> <number>8</number>
</property> </property>
<property name="rightMargin"> <property name="verticalSpacing">
<number>6</number>
</property>
<property name="bottomMargin">
<number>6</number>
</property>
<property name="spacing">
<number>12</number> <number>12</number>
</property> </property>
<property name="margin">
<number>8</number>
</property>
<item row="0" column="0"> <item row="0" column="0">
<widget class="QLabel" name="fileNameLabel"> <widget class="QLabel" name="fileNameLabel">
<property name="maximumSize"> <property name="maximumSize">
...@@ -40,9 +37,6 @@ ...@@ -40,9 +37,6 @@
<property name="scaledContents"> <property name="scaledContents">
<bool>true</bool> <bool>true</bool>
</property> </property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget> </widget>
</item> </item>
<item row="0" column="2"> <item row="0" column="2">
...@@ -56,12 +50,12 @@ ...@@ -56,12 +50,12 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="3" rowspan="6"> <item row="0" column="3" rowspan="7">
<widget class="QGCMAVLinkTextEdit" name="xmlTextView"> <widget class="QGCMAVLinkTextEdit" name="xmlTextView">
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>400</width> <width>200</width>
<height>300</height> <height>100</height>
</size> </size>
</property> </property>
<property name="baseSize"> <property name="baseSize">
...@@ -75,7 +69,7 @@ ...@@ -75,7 +69,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="0" colspan="2"> <item row="1" column="0">
<widget class="QLabel" name="outputDirNameLabel"> <widget class="QLabel" name="outputDirNameLabel">
<property name="maximumSize"> <property name="maximumSize">
<size> <size>
...@@ -102,31 +96,35 @@ ...@@ -102,31 +96,35 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="0" colspan="2"> <item row="4" column="0">
<widget class="QLabel" name="label"> <widget class="QLabel" name="label">
<property name="text"> <property name="text">
<string>Compile Output</string> <string>Compile Output</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="4" column="0" colspan="3"> <item row="5" column="0" colspan="3">
<widget class="QPlainTextEdit" name="compileLog"/> <widget class="QPlainTextEdit" name="compileLog">
<property name="tabStopWidth">
<number>40</number>
</property>
</widget>
</item> </item>
<item row="5" column="0"> <item row="6" column="0">
<widget class="QLabel" name="validXMLLabel"> <widget class="QLabel" name="validXMLLabel">
<property name="text"> <property name="text">
<string>No file loaded</string> <string>No file loaded</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="5" column="1"> <item row="6" column="1">
<widget class="QPushButton" name="saveButton"> <widget class="QPushButton" name="saveButton">
<property name="text"> <property name="text">
<string>Save file</string> <string>Save file</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="5" column="2"> <item row="6" column="2">
<widget class="QPushButton" name="generateButton"> <widget class="QPushButton" name="generateButton">
<property name="text"> <property name="text">
<string>Save and generate</string> <string>Save and generate</string>
...@@ -137,11 +135,14 @@ ...@@ -137,11 +135,14 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="0" colspan="2"> <item row="2" column="0">
<widget class="QLabel" name="label_2"> <widget class="QLabel" name="label_2">
<property name="text"> <property name="text">
<string>Select MAVLink Version</string> <string>Select MAVLink Version</string>
</property> </property>
<property name="alignment">
<set>Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft</set>
</property>
</widget> </widget>
</item> </item>
<item row="2" column="2"> <item row="2" column="2">
......
...@@ -82,7 +82,7 @@ isLocalPositionKnown(false), ...@@ -82,7 +82,7 @@ isLocalPositionKnown(false),
isGlobalPositionKnown(false) isGlobalPositionKnown(false)
{ {
color = UASInterface::getNextColor(); color = UASInterface::getNextColor();
setBattery(LIPOLY, 3); setBatterySpecs(QString("9V,9.5V,12.6V"));
connect(statusTimeout, SIGNAL(timeout()), this, SLOT(updateState())); connect(statusTimeout, SIGNAL(timeout()), this, SLOT(updateState()));
connect(this, SIGNAL(systemSpecsChanged(int)), this, SLOT(writeSettings())); connect(this, SIGNAL(systemSpecsChanged(int)), this, SLOT(writeSettings()));
statusTimeout->start(500); statusTimeout->start(500);
......
...@@ -67,6 +67,7 @@ QGCToolBar::QGCToolBar(QWidget *parent) : ...@@ -67,6 +67,7 @@ QGCToolBar::QGCToolBar(QWidget *parent) :
toolBarBatteryBar->setMaximum(100); toolBarBatteryBar->setMaximum(100);
toolBarBatteryBar->setMinimumWidth(20); toolBarBatteryBar->setMinimumWidth(20);
toolBarBatteryBar->setMaximumWidth(100); toolBarBatteryBar->setMaximumWidth(100);
toolBarBatteryBar->setToolTip(tr("Battery charge level"));
toolBarBatteryVoltageLabel = new QLabel("xx.x V"); toolBarBatteryVoltageLabel = new QLabel("xx.x V");
toolBarBatteryVoltageLabel->setStyleSheet(QString("QLabel { margin: 0px 0px 0px 4px; font: 14px; color: %1; }").arg(QColor(Qt::green).name())); toolBarBatteryVoltageLabel->setStyleSheet(QString("QLabel { margin: 0px 0px 0px 4px; font: 14px; color: %1; }").arg(QColor(Qt::green).name()));
symbolButton->setStyleSheet("QWidget { background-color: #050508; color: #DDDDDF; background-clip: border; } QToolButton { font-weight: bold; font-size: 12px; border: 0px solid #999999; border-radius: 5px; min-width:22px; max-width: 22px; min-height: 22px; max-height: 22px; padding: 0px; margin: 0px 0px 0px 20px; background-color: none; }"); symbolButton->setStyleSheet("QWidget { background-color: #050508; color: #DDDDDF; background-clip: border; } QToolButton { font-weight: bold; font-size: 12px; border: 0px solid #999999; border-radius: 5px; min-width:22px; max-width: 22px; min-height: 22px; max-height: 22px; padding: 0px; margin: 0px 0px 0px 20px; background-color: none; }");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment