1
0
mirror of git://projects.qi-hardware.com/gmenu2x.git synced 2024-07-04 21:05:27 +03:00
Commit Graph

123 Commits

Author SHA1 Message Date
Maarten ter Huurne
3df841c150 Handle labelless icon positioning in GMenu2X::drawButton(Right)
Instead of correcting the returned coordinate with "- 10" externally,
omit the white space inside the methods.

Note that Font::getTextWidth, which was used until recently, considers
an empty string to have width 1, so 3 + getTextWidth("") + 6 == 10.

There is a difference in how buttons that have neither a label nor an
icon are positioned in the new code, but that is a situation that
should not occur in practice. Plus I'd argue that the new behavior is
actually better in that case.
2014-08-15 18:49:58 +02:00
Maarten ter Huurne
60aaf5954a Show a file selector in OPK links only if Exec requires a file
Previously, if a user installed a new version of an OPK with the same
name as one that had a link configuration file, GMenu2X could request
a file for an application whose new version required no files to
launch.

In practice, this transition would occur only once per OPK application,
when its developer decided to use a custom browser after having used
GMenu2X's file browser. This bug would then show GMenu2X's file browser
to request a file that would not even be passed to the application.

Thanks to Nebuleon for analyzing the problem and the above description.
2014-08-14 02:08:51 +02:00
Nebuleon Fumika
82ac7ef44b Set the clock to 0 before reading application link files
0 is the default clock value, which doesn't get written to link files
if it's not changed. The clock was previously uninitialised before
reading link files, so it would get written with a random value if
there was none before.
2014-08-13 07:39:37 +02:00
Maarten ter Huurne
60183e539d Removed most uses of naked Surface pointers
However, SurfaceCollection remains a very important user.
2014-08-10 14:21:14 +02:00
Maarten ter Huurne
4bd1c799bd Created separate subclasses for output and off-screen surfaces
There are a few exclusive operations for each type. Also we no longer
need the freeWhenDone flag since the class now determines whether the
surface should be freed or not.
2014-08-10 13:25:54 +02:00
Maarten ter Huurne
aff5f53f7d Don't pass around naked Surface pointers when drawing
Use references instead.
2014-08-10 04:26:59 +02:00
Maarten ter Huurne
7c4fa5d77a Launch application after destructing menu
This allows all destructors to do their job before we pass control to
a new process.
2014-08-10 02:09:34 +02:00
Maarten ter Huurne
303ecf298a Moved console bind+activate code into Launcher
This way, we can launch console applications from the Explorer.
2014-08-08 02:04:05 +02:00
Maarten ter Huurne
dc23718f7f Enable "Display Console" flag for all platforms
Applications with this flag will not have their stdout/stderr
redirected to a log file when logging is enabled. That is a useful
feature also on platforms where we don't micromanage the console.
2014-08-08 01:35:51 +02:00
Maarten ter Huurne
3e34124e68 Added Launcher class
Currently the launched application is exec-ed from deep within the menu
code. This means a lot of destructors are never run and as a result
for example file descriptors from the menu remain open in the launched
process.

This is a first step to move the launch invocation from a deep call
stack to the top level.
2014-08-07 16:48:30 +02:00
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
Zear
cdf4ef1bf4 Introduced custom application launch text
This can be used to override weird automatically constructed messages
such as "Launching Power Off".
2014-07-19 01:09:16 +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
Maarten ter Huurne
bb7a30d697 Simplify iteration over tokens using std::array 2014-07-17 01:19:18 +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
92a6453ff8 Re-insert proper detection of the %f tokens for OPK apps 2014-04-18 09:10:01 +02:00
Paul Cercueil
c19e78951d Fix launching non-OPK apps with files with special characters 2014-02-23 16:55:14 +01:00
Paul Cercueil
55a6528cde Revert to launching in the shell for non-OPK apps 2014-02-05 16:26:00 +01:00
Paul Cercueil
a7f0fef059 linkapp.cpp: remove dead/useless code 2014-02-05 14:53:46 +01:00
Paul Cercueil
1a1f891a4d Fix launching OPKs with a file containing spaces 2014-02-05 14:33:45 +01:00
Paul Cercueil
2ab44489a1 Execute the links directly, don't use the shell
This breaks one thing: the "params" option of the links must be
only one parameter (without spaces). The only way to actually
set this option being to edit the config files manually, it is
pretty safe to assume it will never contain two parameters.
2013-12-11 12:34:01 +01:00
Paul Cercueil
6ef3f3b190 Redirect to log by redefining stdout and stderr 2013-12-11 12:34:01 +01:00
Paul Cercueil
7c1af3a03b Use 'opkrun' to execute OPK files 2013-12-11 12:34:01 +01:00
Paul Cercueil
53ba01c40a Don't set called programs as group leaders
The comment of this code indicates that it is needed for
SDL apps to work correctly.

However, I don't see any valid reason for the apps we
launch to be running in a different group.

Removing it didn't make any apparent difference, so unless
I'm proven wrong, it'll stay gone from now on.
2013-12-11 12:31:47 +01:00
Paul Cercueil
31ad27f2bd Do not try to change the permissions of the executables 2013-12-11 12:31:29 +01:00
Paul Cercueil
246fd8630c Output log to /var/log/gmenu2x.log 2013-11-08 11:27:34 +01:00
Paul Cercueil
b73391486f Simplify again the prototype of LinkApp as gmenu2x->input is public 2013-09-05 19:20:54 -04:00
Paul Cercueil
1ff17d83c9 Add function GMenu2X::getTouchscreen(), to simplify Link and LinkApp prototypes 2013-09-05 19:19:16 -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
8d38decc82 Pass full path to LinkApp::launch 2013-08-16 09:46:16 +02:00
Maarten ter Huurne
d6deb29ba0 Eliminated selectedDir argument to LinkApp::launch() 2013-08-16 09:38: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
8472acc26c Removed checks for manuals and screenshots in JPEG and BMP format
Support for loading JPEG and BMP images was removed a long time ago,
so there is no point in looking for files in those formats.
2013-08-14 13:30:17 +02:00
Maarten ter Huurne
1ffae36004 Made Surface argument to drawTopBar/drawBottomBar() mandatory 2013-08-14 11:47:29 +02:00
Maarten ter Huurne
ea85b10d31 Reduce use of HAVE_LIBOPK inside LinkApp class as well
In commit de30b3f9 several outside uses were removed by always defining
isOpk(), this commit does the same for LinkApp itself.
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
724aefe482 Renamed ASFont class to just Font
Originally the font implementation was based on SFont, but it was
recently replaced by an SDL_ttf based implementation, so the name
no longer made sense.
2013-08-03 22:30:12 +02:00
Maarten ter Huurne
a9b5d8bd19 Moved most Menu::loadIcons() code into Link/LinkApp classes
The code still has a lot of overlap with the other methods of Link and
LinkApp, but at least it is in the same place now.

Since this was the last outside use, setIconPath() could be declared
as 'protected'.
2013-08-02 21:24:20 +02:00
Paul Cercueil
88f54e1ccc Drop incredibly dirty and huge file FastDelegate.h
It's way too over-engineered for what we need to do, and we can
do much simpler using C++11.
2013-07-29 12:58:25 -04:00
Paul Cercueil
a0515ad356 Make the file selector accept all files by default 2013-07-21 15:43:41 -04:00
Paul Cercueil
a682d10657 Load the localized title and description of an OPK if available 2013-07-20 21:21:36 -04:00
Paul Cercueil
bec8d8756f Don't prepend the mounpoint to the binary path if not inside the OPK 2013-07-19 15:25:54 -04:00
Paul Cercueil
91f381fa07 Allow an OPK to use an icon provided by the theme 2013-07-18 17:49:33 -04:00
Paul Cercueil
c58b3a535e Update GMenu2X to use the latest libopk v1.0 API 2013-05-26 19:06:53 -04:00
Paul Cercueil
2cef732602 Fix crash occuring when an unknown MIME type is specified in OPK 2013-04-19 14:25:23 -03:00
Maarten ter Huurne
bcbedc8f40 Updated code calling opk_extract_file().
I changed the return type from char* to void* in libopk, now updating
the gmenu2x code to match.
2013-02-05 19:05:44 +01:00
Maarten ter Huurne
e4d78bee60 Made GMenu2X::menu private
There was only one outside use; turned that into a new public method
on the GMenu2X class.
2012-12-20 22:01:30 +01:00
Paul Cercueil
610b489d51 Add support of text manuals (.man.txt files) inside OPK archives 2012-12-08 04:26:48 -03:00