Commit graph

19 commits

Author SHA1 Message Date
Dirk Hohndel
323e97c603 mobile/UI: remember the system default font size
We need to do this before the preferences are loaded, or the system
default size is lost. Given that our other sizes are all relative to
this value, that would be a problem.

With this we can now ensure that we always have the right font size for
smaller, regular, and larger theme settings.

Also removes some obsolete commented out code.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-01-19 12:35:29 -08:00
Dirk Hohndel
2c3d927a42 mobile/UI: don't double apply the font scale factor
The mobile scale code had a fundamental flaw: we applied the scale
factor once to gridUnit, but twice to the font size. So effectively we
had font sizes of 72% and 132% (all of course then rounded to integers
for no good reason) instead of the intended 85% and 115%.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-01-19 12:35:29 -08:00
Dirk Hohndel
7ed861fb9f mobile/UI: better dive list color for dark theme
While the text name is 'light primary color' it really has to be a dark
blueish color to fit with the theme.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-12-20 10:51:18 -08:00
Berthold Stoeger
da740dfc19 cleanup: use setPointSizeF() in themeInterface::set_currentScale()
The compiler complained that we were passing a float to the
QFont::setPointSize() function, which expects an integer.
Solve this by using the QFont::setPointSizeF() function.

This might introduce a user-visible change, albeit very unlikely:
We now may set the point-size to a non-integer number.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-30 13:58:10 -07:00
Berthold Stoeger
9d485f9626 cleanup: fold ThemeInterface::setup() into constructor
There appears to be no reason for two-phase initialization.
Let's keep things simple: let the constructor produce a
functioning object.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-30 13:54:12 -07:00
Berthold Stoeger
0e9bd27bae cleanup: don't send values in changed-signals of ThemeInterface
According to the Qt-docs you *may* send the new values in the
NOTIFY signal of Q_PROPERTYs. However, since changes will lead
to a reevaluation of a whole expression, this argument will be
unused. All it does is make the code more verbose and brittle:
What happens if you send the wrong value?

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-30 13:54:12 -07:00
Berthold Stoeger
ce1629ccce coding style: rename themeInterface to ThemeInterface
As per coding style, class names are PascalCase.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-30 13:54:12 -07:00
Berthold Stoeger
1702747459 cleanup: make color-constants in themeinterface.cpp static
There were no outside users - no point in exporting them.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-30 13:54:12 -07:00
Berthold Stoeger
79bf243ec0 cleanup: make members of ThemeInterface non-static
We have a singleton class ThemeInterface, which means that it
is global and exists only once. It's members are static, i.e.
also global. A message from the department of redundancy department?
In any case, that makes no sense. Let's just make these members
local to the class.

I would even rip out the whole singleton thing, since the object
is not accessed anywhere outside from QML. Let's keep it for now.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-30 13:54:12 -07:00
Dirk Hohndel
98ef01b2e4 mobile UI: stop the use of dark icon theme
This was used very inconsistently and had more bugs than positive
impact.

See #2686

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-21 13:27:00 -07:00
Dirk Hohndel
a7d1dbd013 mobile UI: fix font size breakage on Android
The pointSize() of a font can return -1 if the font was originally specificied
with a pixelSize. Work around this by using QFontInfo to calculate the correct
value.

Additionally, don't use the pointSize() of a font when we can instead use the
calculated size.

This fixes the problem with the missing star ratings on Android.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-02-09 16:45:04 -08:00
jan Iversen
35de9c49a4 mobile-widgets: switch to new subsurfaceTheme
Remove subsurfaceTheme from main.qml
Replace ThemeNew -> subsurfaceTheme
change registration ThemeNew -> subsurfaceTheme

Signed-off-by: jan Iversen <jan@casacondor.com>
2020-02-03 17:30:35 -08:00
jan Iversen
15fbcb655a mobile-widgets/themeinterface: make most part static
Make variables and functions static where possible, this is done
to prevent different versions of theme with different values.

Signed-off-by: jan Iversen <jan@casacondor.com>
2020-02-03 17:30:15 -08:00
jan Iversen
906cce9e88 mobile-widgets: emit signals for each color
Emit signals for each standard color when theme changes.

The iconStyle property was changed from being a constant, because it can
change, and thus a signal was added.

Signed-off-by: jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-30 07:53:34 +02:00
jan Iversen
5a7ebe15a5 mobile-widgets: correct empty lines
Remove extra empty lines in themeinterface.cpp just a cleanup, no functionality
change.

Signed-off-by: jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-30 07:53:12 +02:00
jan Iversen
2cc215d3f2 mobile-widgets: move font property to themeInterface
Move setting of font properties used throughout to themeInterface.
Add new settings "currentScale".

The properties are kept in main (subsurfaceTheme) in order not to do
a big search/replace.

Update settings to use currectScale and signal changes in themeinterface.

Signed-off-by: jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-30 07:52:14 +02:00
jan Iversen
a3e3a30b70 mobile-widgets: move basePointSize to themeinterface
Check defaultfont and calculate basepointsize in themeinterface instead
of in QML.

Signed-off-by: jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-30 07:51:05 +02:00
jan Iversen
1d35942249 themeinterface: move registration to themeinterface
Move setup call and registration from subsurface-helper
to themeInterface, in order to keep the registration where the code
are.

Signed-off-by: jan Iversen <jan@casacondor.com>
2020-01-28 11:05:45 -08:00
jan Iversen
9de296f3dd mobile-widgets: add themeInterface
Currently subsurfaceTheme resides in main.qml, where it does not naturally
belong.

Add C++ class that will replace subsurfaceTheme in main.qml in a 1-1 manner.

This opens future posibilities
- on top of the 3 themes, allow users to select colors/fonts
- add stylesheets to Template* components
- make day/night shift automatically.

Signed-off-by: jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-26 16:42:35 -08:00