mirror of
https://github.com/tumic0/GPXSee.git
synced 2024-11-28 05:34:47 +01:00
Better Time/Moving Time display approach.
This commit is contained in:
parent
214d7c40dc
commit
e6a0eeefcc
@ -76,7 +76,8 @@ HEADERS += src/config.h \
|
||||
src/optionsdialog.h \
|
||||
src/colorbox.h \
|
||||
src/stylecombobox.h \
|
||||
src/opengl.h
|
||||
src/opengl.h \
|
||||
src/fliplabel.h
|
||||
SOURCES += src/main.cpp \
|
||||
src/gui.cpp \
|
||||
src/poi.cpp \
|
||||
@ -130,7 +131,8 @@ SOURCES += src/main.cpp \
|
||||
src/nmeaparser.cpp \
|
||||
src/optionsdialog.cpp \
|
||||
src/colorbox.cpp \
|
||||
src/stylecombobox.cpp
|
||||
src/stylecombobox.cpp \
|
||||
src/fliplabel.cpp
|
||||
RESOURCES += gpxsee.qrc
|
||||
TRANSLATIONS = lang/gpxsee_cs.ts \
|
||||
lang/gpxsee_sv.ts
|
||||
|
28
src/fliplabel.cpp
Normal file
28
src/fliplabel.cpp
Normal file
@ -0,0 +1,28 @@
|
||||
#include "fliplabel.h"
|
||||
|
||||
|
||||
void FlipLabel::addItem(const QString &key, const QString &value)
|
||||
{
|
||||
_labels.insert(key, value);
|
||||
|
||||
if (_labels.size() == 1)
|
||||
_it = _labels.constBegin();
|
||||
|
||||
QLabel::setText(_it.value());
|
||||
QLabel::setToolTip(_it.key());
|
||||
}
|
||||
|
||||
void FlipLabel::mousePressEvent(QMouseEvent *event)
|
||||
{
|
||||
Q_UNUSED(event);
|
||||
|
||||
if (!_labels.count())
|
||||
return;
|
||||
|
||||
_it++;
|
||||
if (_it == _labels.constEnd())
|
||||
_it = _labels.constBegin();
|
||||
|
||||
QLabel::setText(_it.value());
|
||||
QLabel::setToolTip(_it.key());
|
||||
}
|
22
src/fliplabel.h
Normal file
22
src/fliplabel.h
Normal file
@ -0,0 +1,22 @@
|
||||
#ifndef FLIPLABEL_H
|
||||
#define FLIPLABEL_H
|
||||
|
||||
#include <QLabel>
|
||||
#include <QMap>
|
||||
|
||||
class FlipLabel : public QLabel
|
||||
{
|
||||
public:
|
||||
FlipLabel(QWidget *parent = 0) : QLabel(parent) {}
|
||||
|
||||
void addItem(const QString &key, const QString &value);
|
||||
|
||||
protected:
|
||||
void mousePressEvent(QMouseEvent *event);
|
||||
|
||||
private:
|
||||
QMap<QString, QString> _labels;
|
||||
QMap<QString, QString>::const_iterator _it;
|
||||
};
|
||||
|
||||
#endif // FLIPLABEL_H
|
16
src/gui.cpp
16
src/gui.cpp
@ -40,6 +40,7 @@
|
||||
#include "cpuarch.h"
|
||||
#include "graphtab.h"
|
||||
#include "format.h"
|
||||
#include "fliplabel.h"
|
||||
#include "gui.h"
|
||||
|
||||
|
||||
@ -530,7 +531,7 @@ void GUI::createStatusBar()
|
||||
{
|
||||
_fileNameLabel = new QLabel();
|
||||
_distanceLabel = new QLabel();
|
||||
_timeLabel = new QLabel();
|
||||
_timeLabel = new FlipLabel();
|
||||
_distanceLabel->setAlignment(Qt::AlignHCenter);
|
||||
_timeLabel->setAlignment(Qt::AlignHCenter);
|
||||
|
||||
@ -1072,15 +1073,12 @@ void GUI::updateStatusBarInfo()
|
||||
else
|
||||
_distanceLabel->clear();
|
||||
|
||||
if (time() > 0)
|
||||
_timeLabel->setText(Format::timeSpan(time()));
|
||||
else
|
||||
if (time() > 0) {
|
||||
_timeLabel->addItem(tr("Total time"), Format::timeSpan(time()));
|
||||
_timeLabel->addItem(tr("Moving time"), Format::timeSpan(movingTime())
|
||||
+ "<sub>M</sub>");
|
||||
} else
|
||||
_timeLabel->clear();
|
||||
|
||||
if (movingTime() > 0)
|
||||
_timeLabel->setToolTip(Format::timeSpan(movingTime()));
|
||||
else
|
||||
_timeLabel->setToolTip(QString());
|
||||
}
|
||||
|
||||
void GUI::updateWindowTitle()
|
||||
|
@ -18,6 +18,7 @@ class QTabWidget;
|
||||
class QActionGroup;
|
||||
class QAction;
|
||||
class QLabel;
|
||||
class FlipLabel;
|
||||
class QSignalMapper;
|
||||
class QPrinter;
|
||||
class FileBrowser;
|
||||
@ -171,7 +172,7 @@ private:
|
||||
|
||||
QLabel *_fileNameLabel;
|
||||
QLabel *_distanceLabel;
|
||||
QLabel *_timeLabel;
|
||||
FlipLabel *_timeLabel;
|
||||
|
||||
PathView *_pathView;
|
||||
QTabWidget *_graphTabWidget;
|
||||
|
Loading…
Reference in New Issue
Block a user