--- a/i18n/igc.de_DE.ts Sat Jan 28 13:03:19 2012 +0100
+++ b/i18n/igc.de_DE.ts Sun Jan 29 00:38:40 2012 +0100
@@ -39,6 +39,7 @@
</message>
<message>
<location filename="../ui/mainwindow.ui" line="107"/>
+ <location filename="../mainwindow.cc" line="12"/>
<source>Altitude</source>
<translation>Höhenprofil</translation>
</message>
@@ -73,49 +74,54 @@
<translation>Über Qt</translation>
</message>
<message>
- <location filename="../mainwindow.cc" line="37"/>
+ <location filename="../mainwindow.cc" line="44"/>
<source>Open IGC file</source>
<translation>IGC Datei Öffnen</translation>
</message>
<message>
- <location filename="../mainwindow.cc" line="38"/>
+ <location filename="../mainwindow.cc" line="45"/>
<source>IGC files (*.igc);; All files (*)</source>
<translation>IGC Dateien (*.igc);; Alle Dateien (*)</translation>
</message>
<message>
- <location filename="../mainwindow.cc" line="51"/>
+ <location filename="../mainwindow.cc" line="58"/>
<source>Ooops!</source>
<translation>Ooops!</translation>
</message>
<message>
- <location filename="../mainwindow.cc" line="52"/>
+ <location filename="../mainwindow.cc" line="59"/>
<source>The file %1 cannot be opened: %2!</source>
<translation>Die Datei %1 kann nicht geöffnet werden: %2!</translation>
</message>
<message>
- <location filename="../mainwindow.cc" line="58"/>
+ <location filename="../mainwindow.cc" line="65"/>
<source>opening %1</source>
<translation>Öffnen von %1</translation>
</message>
<message>
- <location filename="../mainwindow.cc" line="75"/>
+ <location filename="../mainwindow.cc" line="82"/>
<source>Pilot</source>
<translation>Pilot</translation>
</message>
<message>
- <location filename="../mainwindow.cc" line="80"/>
+ <location filename="../mainwindow.cc" line="87"/>
<source>Date</source>
<translation>Datum</translation>
</message>
<message>
- <location filename="../mainwindow.cc" line="87"/>
+ <location filename="../mainwindow.cc" line="94"/>
<source>Glider</source>
<translation>Schirmtyp</translation>
</message>
<message>
- <location filename="../mainwindow.cc" line="92"/>
+ <location filename="../mainwindow.cc" line="99"/>
<source>Place</source>
<translation>Ort</translation>
</message>
+ <message>
+ <location filename="../mainwindow.cc" line="124"/>
+ <source>Weiter�</source>
+ <translation type="unfinished">Weiter...?</translation>
+ </message>
</context>
</TS>
--- a/igc.h Sat Jan 28 13:03:19 2012 +0100
+++ b/igc.h Sun Jan 29 00:38:40 2012 +0100
@@ -62,7 +62,7 @@
QString glider() const { return glider_; } //!< type of glider
QDate date() const { return date_; } //!< date of the record (start date?)
- Fixes fixes() const { return fixes_; } //!< list of fixes
+ const Fixes& fixes() const { return fixes_; } //!< list of fixes
Fix start() const { return start_; } //!< the very first fix
Fix landing() const { return landing_; } //!< the very last fix
--- a/igc.pro Sat Jan 28 13:03:19 2012 +0100
+++ b/igc.pro Sun Jan 29 00:38:40 2012 +0100
@@ -2,7 +2,8 @@
# Automatically generated by qmake (2.01a) Sat Jan 21 23:39:20 2012
######################################################################
-CONFIG += release precompile_header
+CONFIG += debug precompile_header \
+ qwt
QT += webkit network
QMAKE_EXTRA_TARGETS += doxy doc
--- a/igc.pro.user Sat Jan 28 13:03:19 2012 +0100
+++ b/igc.pro.user Sun Jan 29 00:38:40 2012 +0100
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
-<!-- Written by Qt Creator 2.4.0, 2012-01-28T12:29:06. -->
+<!-- Written by Qt Creator 2.4.0, 2012-01-28T22:38:13. -->
<qtcreator>
<data>
<variable>ProjectExplorer.Project.ActiveTarget</variable>
--- a/main.cc Sat Jan 28 13:03:19 2012 +0100
+++ b/main.cc Sun Jan 29 00:38:40 2012 +0100
@@ -4,6 +4,8 @@
int main(int argc, char** argv)
{
+ QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8"));
+ QTextCodec::setCodecForTr(QTextCodec::codecForCStrings());
QApplication app(argc, argv);
QTranslator translator;
--- a/mainwindow.cc Sat Jan 28 13:03:19 2012 +0100
+++ b/mainwindow.cc Sun Jan 29 00:38:40 2012 +0100
@@ -1,22 +1,38 @@
#include "mainwindow.h"
+#include <qwt_plot_curve.h>
+
#include "ui_mainwindow.h"
#include "plot.h"
+
using Qt::DefaultLocaleLongDate;
MainWindow::MainWindow(QWidget *parent)
- : QMainWindow(parent), ui(new Ui::MainWindow)
+ : QMainWindow(parent), ui_(new Ui::MainWindow),
+ plot_(new QwtPlot(tr("Altitude"), this))
{
- ui->setupUi(this);
- connect(ui->actionAboutQt, SIGNAL(triggered()), qApp, SLOT(aboutQt()));
- connect(ui->actionExit, SIGNAL(triggered()), qApp, SLOT(quit()));
- connect(ui->actionOpen, SIGNAL(triggered()), this, SLOT(open()));
+ ui_->setupUi(this);
+ ui_->tabs->setCurrentIndex(0); // avoid changes done in the designer!
+
+ // prepare the Qwt tab
+ plot_->setAxisTitle(plot_->yLeft, tr("Altitude"));
+ plot_->setAxisTitle(plot_->xBottom, tr("Time"));
+ ui_->qwt->setLayout(new QGridLayout);
+ ui_->qwt->layout()->addWidget(plot_);
+
+#ifndef MYPLOT
+ ui_->tabs->removeTab(1); // altitude
+#endif
+
+ connect(ui_->actionAboutQt, SIGNAL(triggered()), qApp, SLOT(aboutQt()));
+ connect(ui_->actionExit, SIGNAL(triggered()), qApp, SLOT(quit()));
+ connect(ui_->actionOpen, SIGNAL(triggered()), this, SLOT(open()));
/*
QNetworkProxy::setApplicationProxy(QNetworkProxy(QNetworkProxy::HttpProxy, "localhost", 3128));
- ui->view->load(QUrl("http://maps.google.com/"));
+ ui_->view->load(QUrl("http://maps.google.com/"));
*/
@@ -24,7 +40,7 @@
MainWindow::~MainWindow()
{
- delete ui;
+ delete ui_;
}
void MainWindow::open(const QString &s)
@@ -60,7 +76,7 @@
// now let's fill the table
- QTableWidget *t = ui->table;
+ QTableWidget *t = ui_->table;
int r = 0;
const int K = 0;
const int V = 1;
@@ -92,42 +108,47 @@
t->setItem(r, V, new QTableWidgetItem(igc_.start().longitude() + " / " + igc_.start().latitude()));
++r;
-
showProfile();
}
void MainWindow::showProfile()
{
- Plot *plot = new Plot(this);
+ const Fixes f = igc_.fixes();
+#ifdef MYPLOT
+ QList< QPair<QTime, int> > altitudesBaro;
+ QList< QPair<QTime, int> > altitudesGPS;
+#endif
+ QVector<QPointF> pointsGPS;
+ QVector<QPointF> pointsBaro;
- /*
- for (IGC::Iterator i = igc_.begin()
- i != igc_.end();
- ++i) {
- qDebug() << *i;
- }
- */
-
- // get all the altitudes
- const Fixes f = igc_.fixes();
- QList< QPair<QTime, int> > altitudesBaro;
- QList< QPair<QTime, int> > altitudesGPS;
- for (Fixes::const_iterator i = f.begin();
- i != f.end();
- i++) {
- altitudesBaro << i->altitudeFix(Fix::baro);
- altitudesGPS << i->altitudeFix(Fix::gps);
- }
+ for (Fixes::const_iterator i = f.begin();
+ i != f.end();
+ i++) {
+#ifdef MYPLOT
+ altitudesBaro << i->altitudeFix(Fix::baro);
+ altitudesGPS << i->altitudeFix(Fix::gps);
+#endif
+ pointsGPS << QPointF(QTime().secsTo(i->time()), i->altitude(Fix::gps));
+ pointsBaro << QPointF(QTime().secsTo(i->time()), i->altitude(Fix::baro));
+ }
- /*
- plot->setXAxis(0, 100, 10);
- plot->setYAxis(0, 200, 10);
- */
- plot->draw(altitudesBaro.begin(), altitudesBaro.end());
- plot->draw(altitudesGPS.begin(), altitudesGPS.end());
- ui->altitude->setScene(plot);
+#ifdef MYPLOT
+ myPlot_.draw(altitudesBaro.begin(), altitudesBaro.end());
+ myPlot_.draw(altitudesGPS.begin(), altitudesGPS.end());
+ ui_->altitude->setScene(&myPlot_);
+#endif
- // ui->altitude->show();
+ QwtPlotCurve *gps = new QwtPlotCurve(tr("Altitude GPS"));
+ QwtPlotCurve *baro = new QwtPlotCurve(tr("Altitude barometric"));
+ QwtPointSeriesData *dataGPS = new QwtPointSeriesData(pointsGPS);
+ QwtPointSeriesData *dataBaro = new QwtPointSeriesData(pointsBaro);
+
+ gps->setData(dataGPS);
+ baro->setData(dataBaro);
+ gps->attach(plot_);
+ baro->attach(plot_);
+
+ // ui_->altitude->show();
}
--- a/mainwindow.h Sat Jan 28 13:03:19 2012 +0100
+++ b/mainwindow.h Sun Jan 29 00:38:40 2012 +0100
@@ -2,6 +2,9 @@
#define _mainwindow_h_
#include "pch.h"
+#include <qwt_plot.h>
+
+#include "plot.h"
#include "igc.h"
namespace Ui { class MainWindow; }
@@ -17,11 +20,15 @@
private:
void showProfile();
- Ui::MainWindow *ui;
+ Ui::MainWindow *ui_;
QFile currentFile_;
QTextStream input_;
- IGC igc_;
+ IGC igc_;
+#ifdef MYPLOT
+ Plot *myplot_;
+#endif
+ QwtPlot *plot_;
};
--- a/ui/mainwindow.ui Sat Jan 28 13:03:19 2012 +0100
+++ b/ui/mainwindow.ui Sun Jan 29 00:38:40 2012 +0100
@@ -17,6 +17,9 @@
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QTabWidget" name="tabs">
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
<property name="tabPosition">
<enum>QTabWidget::North</enum>
</property>
@@ -24,7 +27,7 @@
<enum>QTabWidget::Rounded</enum>
</property>
<property name="currentIndex">
- <number>0</number>
+ <number>1</number>
</property>
<widget class="QWidget" name="info">
<attribute name="title">
@@ -86,22 +89,6 @@
</item>
</layout>
</widget>
- <widget class="QWidget" name="web">
- <attribute name="title">
- <string>Web</string>
- </attribute>
- <layout class="QGridLayout" name="gridLayout_4">
- <item row="0" column="0">
- <widget class="QWebView" name="view">
- <property name="url">
- <url>
- <string>about:blank</string>
- </url>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
<widget class="QWidget" name="widget">
<attribute name="title">
<string>Altitude</string>
@@ -112,6 +99,11 @@
</item>
</layout>
</widget>
+ <widget class="QWidget" name="qwt">
+ <attribute name="title">
+ <string>Altitude by QWT</string>
+ </attribute>
+ </widget>
</widget>
</item>
</layout>
@@ -159,13 +151,6 @@
</property>
</action>
</widget>
- <customwidgets>
- <customwidget>
- <class>QWebView</class>
- <extends>QWidget</extends>
- <header>QtWebKit/QWebView</header>
- </customwidget>
- </customwidgets>
<resources/>
<connections/>
</ui>