mirror of
https://github.com/tumic0/GPXSee.git
synced 2024-11-27 21:24:47 +01:00
GUI polishing, bug fixing and code cleanup
This commit is contained in:
parent
2248b9b036
commit
1e28bdd108
12
src/config.h
12
src/config.h
@ -1,11 +1,13 @@
|
||||
#ifndef CONFIG_H
|
||||
#define CONFIG_H
|
||||
|
||||
#define APP_NAME "GPXSee"
|
||||
#define APP_HOMEPAGE "http://tumic.wz.cz/gpxsee"
|
||||
#define APP_VERSION "0.1"
|
||||
#define APP_NAME "GPXSee"
|
||||
#define APP_HOMEPAGE "http://tumic.wz.cz/gpxsee"
|
||||
#define APP_VERSION "0.1"
|
||||
|
||||
#define FONT_FAMILY "Arial"
|
||||
#define FONT_SIZE 12
|
||||
#define FONT_FAMILY "Arial"
|
||||
#define FONT_SIZE 12
|
||||
|
||||
#define THIN_SPACE QString::fromUtf8("\xE2\x80\x89")
|
||||
|
||||
#endif /* CONFIG_H */
|
||||
|
@ -1,4 +1,5 @@
|
||||
#include <float.h>
|
||||
#include "config.h"
|
||||
#include "elevationgraph.h"
|
||||
|
||||
ElevationGraph::ElevationGraph(QWidget *parent) : Graph(parent)
|
||||
@ -48,13 +49,13 @@ void ElevationGraph::loadGPX(const GPX &gpx)
|
||||
_min = qMin(_min, min);
|
||||
|
||||
addInfo(tr("Ascent"), QString::number(_ascent, 'f', 0)
|
||||
+ QString::fromUtf8("\u2009") + _yUnits);
|
||||
+ THIN_SPACE + _yUnits);
|
||||
addInfo(tr("Descent"), QString::number(_descent, 'f', 0)
|
||||
+ QString::fromUtf8("\u2009") + _yUnits);
|
||||
+ THIN_SPACE + _yUnits);
|
||||
addInfo(tr("Maximum"), QString::number(_max, 'f', 0)
|
||||
+ QString::fromUtf8("\u2009") + _yUnits);
|
||||
+ THIN_SPACE + _yUnits);
|
||||
addInfo(tr("Minimum"), QString::number(_min, 'f', 0)
|
||||
+ QString::fromUtf8("\u2009") + _yUnits);
|
||||
+ THIN_SPACE + _yUnits);
|
||||
|
||||
Graph::loadData(data);
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ static QVector<QPointF> eliminate(const QVector<QPointF> &v, int window)
|
||||
|
||||
QList<int>::const_iterator it = rm.begin();
|
||||
for (int i = 0; i < v.size(); i++) {
|
||||
if (*it != i)
|
||||
if (it == rm.end() || *it != i)
|
||||
ret.append(v.at(i));
|
||||
else
|
||||
it++;
|
||||
|
43
src/gui.cpp
43
src/gui.cpp
@ -88,7 +88,7 @@ void GUI::createActions()
|
||||
_aboutAction = new QAction(QIcon(QPixmap(APP_ICON)),
|
||||
tr("About GPXSee"), this);
|
||||
connect(_aboutAction, SIGNAL(triggered()), this, SLOT(about()));
|
||||
_aboutQtAction = new QAction(tr("About Qt"), this);
|
||||
_aboutQtAction = new QAction(QIcon(QPixmap(QT_ICON)), tr("About Qt"), this);
|
||||
connect(_aboutQtAction, SIGNAL(triggered()), qApp, SLOT(aboutQt()));
|
||||
|
||||
// File related actions
|
||||
@ -209,24 +209,37 @@ void GUI::createStatusBar()
|
||||
|
||||
void GUI::about()
|
||||
{
|
||||
QMessageBox::about(this, tr("About GPXSee"),
|
||||
QString("<h3>") + QString(APP_NAME" "APP_VERSION)
|
||||
+ QString("</h3><p>") + tr("GPX viewer and analyzer") + QString("<p/>")
|
||||
+ QString("<p>") + tr("GPXSee is distributed under the terms of the "
|
||||
"GNU General Public License version 3. For more info about GPXSee visit "
|
||||
"the project homepage at ")
|
||||
+ QString("<a href=\""APP_HOMEPAGE"\">"APP_HOMEPAGE"</a>.</p>"));
|
||||
QMessageBox msgBox(this);
|
||||
|
||||
msgBox.setWindowTitle(tr("About GPXSee"));
|
||||
msgBox.setText(QString("<h3>") + QString(APP_NAME" "APP_VERSION)
|
||||
+ QString("</h3><p>") + tr("GPX viewer and analyzer") + QString("<p/>"));
|
||||
msgBox.setInformativeText(QString("<table width=\"300\"><tr><td>")
|
||||
+ tr("GPXSee is distributed under the terms of the GNU General Public "
|
||||
"License version 3. For more info about GPXSee visit the project "
|
||||
"homepage at ") + QString("<a href=\""APP_HOMEPAGE"\">"APP_HOMEPAGE
|
||||
"</a>.</td></tr></table>"));
|
||||
|
||||
QIcon icon = msgBox.windowIcon();
|
||||
QSize size = icon.actualSize(QSize(64, 64));
|
||||
msgBox.setIconPixmap(icon.pixmap(size));
|
||||
|
||||
msgBox.exec();
|
||||
}
|
||||
|
||||
void GUI::keys()
|
||||
{
|
||||
QMessageBox msgBox(this);
|
||||
msgBox.setText(QString("<h3>") + tr("Keyboard controls") + QString("</h3>")
|
||||
+ QString("<div><table><tr><td width=\"120\">") + tr("Next file")
|
||||
|
||||
msgBox.setWindowTitle(tr("Keyboard controls"));
|
||||
msgBox.setText(QString("<h3>") + tr("Keyboard controls") + QString("</h3>"));
|
||||
msgBox.setInformativeText(
|
||||
QString("<div><table width=\"300\"><tr><td>") + tr("Next file")
|
||||
+ QString("</td><td><i>SPACE</i></td></tr><tr><td>") + tr("Previous file")
|
||||
+ QString("</td><td><i>BACKSPACE</i></td></tr><tr><td>")
|
||||
+ tr("Append modifier") + QString("</td><td><i>SHIFT</i></td></tr>"
|
||||
"</table></div>"));
|
||||
|
||||
msgBox.exec();
|
||||
}
|
||||
|
||||
@ -328,16 +341,16 @@ void GUI::saveFile(const QString &fileName)
|
||||
QGraphicsScene scene;
|
||||
InfoItem info;
|
||||
info.insert(tr("Distance"), QString::number(_distance / 1000, 'f', 1)
|
||||
+ QString::fromUtf8("\u2009") + tr("km"));
|
||||
+ THIN_SPACE + tr("km"));
|
||||
info.insert(tr("Time"), timeSpan(_time));
|
||||
info.insert(tr("Ascent"), QString::number(_elevationGraph->ascent(), 'f', 0)
|
||||
+ QString::fromUtf8("\u2009") + tr("m"));
|
||||
+ THIN_SPACE + tr("m"));
|
||||
info.insert(tr("Descent"), QString::number(_elevationGraph->descent(), 'f',
|
||||
0) + QString::fromUtf8("\u2009") + tr("m"));
|
||||
0) + THIN_SPACE + tr("m"));
|
||||
info.insert(tr("Maximum"), QString::number(_elevationGraph->max(), 'f', 0)
|
||||
+ QString::fromUtf8("\u2009") + tr("m"));
|
||||
+ THIN_SPACE + tr("m"));
|
||||
info.insert(tr("Minimum"), QString::number(_elevationGraph->min(), 'f', 0)
|
||||
+ QString::fromUtf8("\u2009") + tr("m"));
|
||||
+ THIN_SPACE + tr("m"));
|
||||
scene.addItem(&info);
|
||||
scene.render(&p, QRectF(0, 0, printer.width(), 200));
|
||||
|
||||
|
@ -1,6 +1,8 @@
|
||||
#ifndef ICONS_H
|
||||
#define ICONS_H
|
||||
|
||||
#include <QtGlobal>
|
||||
|
||||
#define APP_ICON ":/icons/gpxsee.png"
|
||||
#define OPEN_FILE_ICON ":/icons/document-open.png"
|
||||
#define SAVE_FILE_ICON ":/icons/document-save.png"
|
||||
@ -10,4 +12,10 @@
|
||||
#define QUIT_ICON ":/icons/application-exit.png"
|
||||
#define RELOAD_FILE_ICON ":/icons/view-refresh.png"
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
|
||||
#define QT_ICON ":/trolltech/qmessagebox/images/qtlogo-64.png"
|
||||
#else
|
||||
#define QT_ICON ":/qt-project.org/qmessagebox/images/qtlogo-64.png"
|
||||
#endif
|
||||
|
||||
#endif /* ICONS_H */
|
||||
|
@ -219,8 +219,6 @@ public:
|
||||
|
||||
StackElement m_stack[MAX_STACK]; ///< Stack as we are doing iteration instead of recursion
|
||||
int m_tos; ///< Top Of Stack index
|
||||
|
||||
friend RTree; // Allow hiding of non-public functions while allowing manipulation by logical owner
|
||||
};
|
||||
|
||||
/// Get 'first' for iteration
|
||||
|
@ -1,7 +1,9 @@
|
||||
#include "config.h"
|
||||
#include "speedgraph.h"
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
|
||||
SpeedGraph::SpeedGraph(QWidget *parent) : Graph(parent)
|
||||
{
|
||||
_max = 0;
|
||||
@ -33,9 +35,9 @@ void SpeedGraph::loadGPX(const GPX &gpx)
|
||||
|
||||
|
||||
addInfo(tr("Average"), QString::number(avg() * _yScale, 'f', 1)
|
||||
+ QString::fromUtf8("\u2009") + _yUnits);
|
||||
+ THIN_SPACE + _yUnits);
|
||||
addInfo(tr("Maximum"), QString::number(_max * _yScale, 'f', 1)
|
||||
+ QString::fromUtf8("\u2009") + _yUnits);
|
||||
+ THIN_SPACE + _yUnits);
|
||||
|
||||
Graph::loadData(data);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user