1
0
mirror of git://projects.qi-hardware.com/gmenu2x.git synced 2024-07-07 13:48:54 +03:00
Commit Graph

223 Commits

Author SHA1 Message Date
Maarten ter Huurne
902145b698 Removed Surface::write method
All it did was redirect to Font::write, so it's better to call that
method directly.
2014-07-31 23:16:51 +02:00
Maarten ter Huurne
485bab3b48 Made text file reading more efficient and robust
Instead of reading the file line by line and then concatenating those
lines, just load the entire thing in one go. And pay more attention to
error conditions.
2014-07-24 10:41:20 +02:00
Nebuleon Fumika
d0de870180 Use Font::wordWrap in TextDialog and TextManualDialog
The constructors of those classes now accept a string to be wrapped, instead
of a vector to be modified with split lines inserted into its middle.

Along with this conversion, manuals for applications stored in OPK packages
are now transferred into a string without garbage at the end.
2014-07-24 09:00:22 +02:00
Maarten ter Huurne
79dcc8a146 Implemented stream output for RGBAColor
In commit 950518f3 I changed the component type of RGBAColor from
16-bit to 8-bit integers. Unfortunately, in C++ 8-bit integers are
identical to characters, so this broke the writing of colors to
output streams.
2014-07-19 12:06:09 +02:00
Maarten ter Huurne
dd27cb2e07 Add constructors for RGBAColor 2014-07-19 00:43:06 +02:00
Maarten ter Huurne
5f454a8569 Made strtorgba into a factory method of RGBAColor
The method is RGBAColor::fromString.
2014-07-19 00:43:06 +02:00
Maarten ter Huurne
0810a26589 Removed unnecessary includes of SDL_gfx header
Only surface.cpp actually uses SDL_gfx functions.
2014-07-19 00:43:05 +02:00
Nebuleon Fumika
9c4e97c839 Make the button repeat rate (after the first repetition) a user setting.
This allows for faster scrolling between section links, in file and directory
selectors, and in manuals, without repeatedly pressing buttons.

The setting's unit is repetitions per second. Its default value is set to
10, and anything between 0 (disabled) and 20 (50 ms) is acceptable.

Grabbing &(instance of GMenu2X).confInt["buttonRepeatRate"] is unsafe, because
the storage for the slot may move as the slot is deleted or added. Instead, a
callback jumps back into the context of an InputManager so the value can be
read from a GMenu2X object's configuration.

A GMenu2X object is also passed to InputManager::init.
2014-07-19 00:43:05 +02:00
Nebuleon Fumika
98a63e2940 Fix setting default values for configuration entries.
Previously, one would check the value in &confInt["someKey"] by passing a
reference to it to evalIntConf. However, because this passing of the reference
went through std::unordered_map::operator[], it created a slot with the named
key and initialised its value with the default constructor of int, which
placed 0 there, if it didn't exist. If the value of 0 was acceptable for the
setting, then 0 as the value selected by the user was indistinguishable from
a slot that had been just created and had to be set to its default.

Now, the std::unordered_map is passed along with the key so that evalIntConf
can check whether the key exists and, if it doesn't exist, set the value to
its default.

Include utilities.h in gmenu2x.h instead of the reverse. One type definition
used by utilities.cpp is moved there (ConfIntHash) and for consistency
ConfStrHash is moved there as well.
2014-07-19 00:43:05 +02:00
Nebuleon Fumika
349e758b3b Load previews from the previews/ subdir of the current dir in selectors.
This does away with per-link selector directories in link files. It is assumed
that, if a user has access to write files to be launched by an application at
some location, he or she also has access to write files in the previews/
subdirectory under it.
2014-07-17 02:02:23 +02:00
Paul Cercueil
917cbf7208 Various changes related to translations 2014-07-15 14:25:17 +02:00
Paul Cercueil
5e22dd5941 Remove the 'Show root' option, which didn't do anything 2014-07-15 14:25:17 +02:00
Paul Cercueil
c72266d771 Remove the 'Selector alias file' feature
Who seriously used that?
2014-07-15 14:25:17 +02:00
Paul Cercueil
fe1a586fb3 Don't consider *.dge files as being executables 2014-05-17 13:56:16 +02:00
Paul Cercueil
dac1e49238 Show the background while loading the menu
This is better than showing an empty black screen, I think.
2014-04-29 00:22:04 +02:00
Paul Cercueil
b1eedf6992 Init SDL timers before creating the menu 2014-04-14 00:28:11 +02:00
Paul Cercueil
9fba35feed Init the Menu before initializing SDL
This avoids seeing a black screen for a few seconds while GMenu2X
is loading.
2014-03-23 12:48:30 +01:00
Paul Cercueil
7777b9edde Added key repeat on analog sticks and hats 2014-02-23 17:00:12 +01:00
Paul Cercueil
b0846812b8 Show disk usage of the home partition, not the one mounted on /boot 2014-02-07 13:43:46 +01:00
Paul Cercueil
8bb58f6270 Sort links once they have all been added to the menu 2014-01-19 23:07:54 +01:00
Paul Cercueil
cb82d55350 Set default link size to 80x50 2014-01-16 16:23:26 +01:00
Paul Cercueil
ad30fae321 Remove "scan for applications and games" feature
It's been broken for a long time now.
2014-01-16 16:07:06 +01:00
Paul Cercueil
cfb96dd697 Pass a Surface to ButtonBox' and IconButton's paint function 2014-01-16 01:19:34 +01:00
Paul Cercueil
67ac54e970 Handle the skin: prefix on the font path 2014-01-15 22:02:30 +01:00
Paul Cercueil
af258530db Allow the skin to change the font and font size 2014-01-15 20:32:17 +01:00
Paul Cercueil
246fd8630c Output log to /var/log/gmenu2x.log 2013-11-08 11:27:34 +01:00
Paul Cercueil
8452c037ac Remove calls to sync()
This is not a low-level tool to deal with the filesystem, using
sync() here is nonsense and just bogs down the system for nuts.
2013-09-26 18:58:12 -03:00
Paul Cercueil
6947997d44 Fix build for platforms without libopk 2013-09-19 17:26:32 +02:00
Paul Cercueil
0e4180460b Recover last session from main() instead of constructor
This fixes a bug where the apps using the file selector wouldn't be
launched at all when selecting a new file after a session recover.
2013-09-07 17:02:38 -04:00
Paul Cercueil
dba6c32109 Change API of InputManager: we don't care about key release events 2013-09-07 11:00:57 -04:00
Maarten ter Huurne
965340a39c Fixed bug with launch screen and double buffering
LinkApp::drawRun() assumes the layers below are already painted when
it is called, but this was not the case. With single buffering, the
previous frame was still there so it still looked good, but with
double buffering the buffer typically contains an outdated screen.

Long term I think the launch should happen at the outermost scope,
so all destructors get a chance to run. This commit is a small step
in that direction, by exiting the main loop before launching.
2013-08-16 10:41:16 +02:00
Maarten ter Huurne
6c80a663e1 Check for empty strings using empty() instead of comparing to "" 2013-08-16 09:16:04 +02:00
Maarten ter Huurne
91dd708476 Added method GMenu2X::getContentArea() 2013-08-14 12:56:15 +02:00
Maarten ter Huurne
19fc3cb4d1 Added "bottomBarHeight" item to skin
There was already "topBarHeight", but the height of the bottom bar was
still hardcoded.
2013-08-14 12:23:15 +02:00
Maarten ter Huurne
1ffae36004 Made Surface argument to drawTopBar/drawBottomBar() mandatory 2013-08-14 11:47:29 +02:00
Maarten ter Huurne
b18e3fa6a8 Don't pass screen coordinates to drawScrollBar()
The scroll bar always spans the content area of the screen: the
position and height depend only on the theme and not on who is
drawing it.

Note that the coordinates passed were wrong in most cases, so this
commit fixes the scroll bar positioning for several dialogs.
2013-08-14 11:47:29 +02:00
Maarten ter Huurne
9c497e7867 Remove "don't leave" feature
If the application in question daemonizes, it will continue running
no matter whether we start it with system() or execlp(). So I don't
see a reason for this feature to exist and removing it means less
code paths to worry about.
2013-08-14 11:47:28 +02:00
Maarten ter Huurne
dfa5413b5b Removed the word "Color" from the labels in the skin settings menu
The labels were longer than the space before the RGBA controls and
the fact that these are colors is already clear from the context
(such as having an RGBA control after it ;).

I tried to update the translated versions of these labels as well.
However, since I don't speak most of these languages, it is possible
the result is grammatically incorrect. If this is the case, please
mail me a correction.
2013-08-14 11:47:28 +02:00
Maarten ter Huurne
06ee35bb7a Make ButtonBox deal with IconButtons instead of generic Buttons
Nowhere in the code do we actually mix IconButtons and Links (the other
Button subclass), so I'm thinking of breaking up this class hierarchy
or at least making the inheritance private.

Also switched to C++11 style loops.
2013-08-13 00:34:04 +02:00
Maarten ter Huurne
90afa096e7 Query animation status instead of storing it
This makes it a lot easier to support more than one possible animation
in the same layer.
2013-08-12 19:41:56 +02:00
Maarten ter Huurne
de30b3f98f Define LinkApp::isOpk() also when OPK support is disabled
This reduces the number of required preprocessor directives, leading to
more readable code and more code being examined by the compiler (useful
to spot problems). Since the method is inlined, the compiler should be
able to eliminate the same amount of code that the preprocessor would,
only at a later stage of the compilation.
2013-08-12 00:13:18 +02:00
Maarten ter Huurne
271ef00c18 Call Menu::selLinkApp() only once in GMenu2X::editLink() 2013-08-12 00:08:28 +02:00
Maarten ter Huurne
76117663ff Converted the context menu to a Layer
This fixes a bug with the captured background being wrong when using
double buffering. Also it ensures that for example the clock in the
status bar is updated when the context menu is open.
2013-08-11 23:46:04 +02:00
Maarten ter Huurne
945e29986a Cleaned up GMenu2X::contextMenu() 2013-08-11 20:57:13 +02:00
Maarten ter Huurne
f414ce4685 Allow layers to play animations 2013-08-11 01:35:43 +02:00
Maarten ter Huurne
71f4391cda Moved all code for opening the context menu into the Menu class
All of the entries in the context menu affect sections and links, so
the context menu should be considered part of the main menu, not of
the global / background context.
2013-08-09 19:09:57 +02:00
Maarten ter Huurne
3f299f62b6 Set initial key repeat delay to a more sensible value
Previously it was set to 1 ms, which in practice means "as fast as
you can" and leads to a lot of unintended repeats.
2013-08-09 18:18:51 +02:00
Maarten ter Huurne
346067896a Put background painting and global keys in new Background layer
The battery status was put into a separate class instead of directly
into the Background class.
2013-08-09 18:01:51 +02:00
Maarten ter Huurne
a15339d425 Cleanups of Clock class
Don't make Clock a singleton. While there should be no reason to
instantiate this class more than once, there is no problem with doing
that either. Removing the singleton makes it easier to control access
to the instance. It also avoids the rather nasty construct that was
used to delete it.

Make sure the timer callback function is a proper C function, since
SDL is a C library. This requires some trickery to be able to call
a private method from the callback, but I found a way using an
intermediate nested class. The compiler should be able to inline this
to eliminate any overhead.

Also some minor cleanups.
2013-08-07 02:55:23 +02:00
Maarten ter Huurne
f71ea3bcee Call Menu::skinUpdated() earlier in initMenu()
That method initializes linkColumns, which is divided by in
setLinkIndex().
2013-08-06 19:59:35 +02:00