Commit graph

13 commits

Author SHA1 Message Date
Stefan Fuchs
5e67a932cf More strict filter for URL handling in dive notes
Applie a more strict filter to URL handling in dive notes:
The URL needs to have:
- Scheme like "http:" or "mailto:"
- Host name like "www.test.de" or path like "/pathtosomewhere/"

Otherwise strings like "OTU:" or "Runtime:" are treated as URL.

Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-04-18 18:13:52 -07:00
Stefan Fuchs
c257144bab Fix a crash in the URL handling for the dive notes
URLs in the dive notes are detected today. A tooltip is displayed and
one can follow the URL by Ctrl-click.

In the function fromCursorTilWhitespace there is an issue with incorrect
return value of Qt (5.7?!) function cursor->movePosition(). This value is
erroneous true in some condition e.g. if the cursor is inside a table at
the very beginning or the very end of a table line and not moving any more.
This can cause the function end up in an infinite loop.

Bugfix adds an additional exit criteria for the loop if the string is
not growing any more.

Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-04-18 18:13:52 -07:00
Martin Měřinský
2b5a2352ea Remove unused DateWidget with its icon. 2017-03-13 10:25:51 -07:00
Stefan Fuchs
b39b641a05 Translate names of additional dive events and nicer format info box text
Enable translation for a few additional internal dive events.
Ensure that all event names in datatrak.c are collected for translation.
Ensure that for gaschange in profile info box the "cyl." string is also translated.

Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-02-21 13:11:19 -08:00
Robert C. Helling
db17adfb28 Make the URL dialog contain QLineEdit
as otherwise pressing RETURN does unexpected things.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-01-12 14:06:54 -08:00
Dirk Hohndel
754112beb4 Renumber ui: make it obvious which dives get renumbered
Using the menu entry or Ctrl-R is designed to renumber all dives, but
using the context menu renumbers only the selected dives. With this
change it becomes more obvious to the user what's happening.

Fixes #942

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-12-27 13:10:18 -08:00
Robert C. Helling
2c715542fd Unify handling of QDateTime time zone information
Subsurface uses "local time" which in particular means we never
display time zone information to the user. The user (and our file
format) only sees times like 5pm or 17:00. A better name than
local time (which could mean "local at the dive spot) would
be "watch time", the time displayed by the diver's watch when
she entered the water.

Internally, we store times as time_t, seconds since Jan 1 1970 0:00
UTC. Our convention for conversion between 5pm and time_t as always
been to treat 5pm as if it were UTC.

Then confusion arose since Qt's QDateTime (which is tied to UI elements
like QTimeEdit and similar) is time zone aware and by default assumes
the system time zone. So when we set a QDateTime to 5pm and then later
convert it to time_t we have to take care about the difference between
UTC and the system time zone.

This patch unifies our solution to this problem: With it, we set all
QDateTime's time zone to UTC. This means we don't have to correct for
a time zone anymore when converting to time_t (note, however, the
signedness issue: Qt's idea of time_t is broken since it assumes it
to be unsigned thus not allowing for dates before 1970. Better use the
millisecont variants).

We only need to be careful about time zones when using the current time.
With this convention, when assigning the current time to a QDateTime, we
need to shift for the time zone since its value in UTC should actually be
the watch time of the user who is most likely used to the system time zone.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-08-10 15:04:39 -07:00
Dirk Hohndel
7be962bfc2 Move subsurface-core to core and qt-mobile to mobile-widgets
Having subsurface-core as a directory name really messes with
autocomplete and is obviously redundant. Simmilarly, qt-mobile caused an
autocomplete conflict and also was inconsistent with the desktop-widget
name for the directory containing the "other" UI.

And while cleaning up the resulting change in the path name for include
files, I decided to clean up those even more to make them consistent
overall.

This could have been handled in more commits, but since this requires a
make clean before the build, it seemed more sensible to do it all in one.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-04 22:33:58 -07:00
Linus Torvalds
2d760a7bff Don't write back dive data that hasn't changed in git
This caches the git ID for the dive on load, and avoids building the
dive directory and hashing it on save as long as nothing has invalidated
the git ID cache.

That should make it much faster to write back data to the git
repository, since the dive tree structure and the divecomputer blobs in
particular are the bulk of it (due to all the sample data).  It's not
actually the git operations that are all that expensive, it's literally
generating the big blob with all the snprintf() calls for the data.

The git save used to be a fairly expensive with large data sets,
especially noticeable on mobile with much weaker CPU's.  This should
speed things up by at least a factor of two.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-04 17:27:10 -07:00
Dirk Hohndel
a670181ed2 Silence warnings in simplewidgets.cpp
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-03-09 21:50:27 -08:00
K. \"pestophagous\" Heller
0a2f5d25c0 Parse html links in the Notes section.
In the spirit of "Do the simplest thing that could
possibly work": capture Ctrl+leftclick mouse events
in the Notes area. If the string under the clicked
position is a valid url, then launch it.

Many common URI schemes will work. Typing a url that
starts with https:// will work. So will mailto: and
file://

See #733

Signed-off-by: K. Heller <pestophagous@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-11-15 22:22:53 -08:00
Tomaz Canabrava
1d6683f3e0 Move Profile widget out of desktop-widgets
The reason for that is, even if profile widget is made with qpainter
and for that reason it should be a desktop widget, it's being used
on the mobile version because of a lack of QML plotting library that
is fast and reliable.

We discovered that it was faster just to encapsulate our Profile in
a QML class and call it directly.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-10-30 10:36:49 -07:00
Tomaz Canabrava
e49d6213ad Move qt-ui to desktop-widgets
Since we have now destkop and mobile versions, 'qt-ui' was a very
poor name choice for a folder that contains only destkop-enabled
widgets.

Also, move the graphicsview-common.h/cpp to subsurface-core because
it doesn't depend on qgraphicsview, it merely implements all the
colors that we use throughout Subsurface, and we will use colors on both
desktop and mobile versions

Same thing applies for metrics.h/cpp

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-10-30 10:36:49 -07:00
Renamed from qt-ui/simplewidgets.cpp (Browse further)