Commit 2f608734 authored by lm's avatar lm

Minor edits

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