Date:2014-07-16 21:02:50 (2 months 4 days ago)
Author:zear
Commit:cdf4ef1bf4c0f28cf81c58132162f89e6f9d4b3d
Message:Introduced custom application launch text

This can be used to override weird automatically constructed messages
such as "Launching Power Off".
Files: data/platform/gcw0/sections/settings/10_poweroff (1 diff)
data/platform/gcw0/sections/settings/20_reboot (1 diff)
src/link.cpp (1 diff)
src/link.h (2 diffs)
src/linkapp.cpp (3 diffs)

Change Details

data/platform/gcw0/sections/settings/10_poweroff
11title=Power Off
22description=Shut down the system
3launchmsg=Powering off
34icon=skin:icons/poweroff.png
45exec=/sbin/poweroff
56editable=false
data/platform/gcw0/sections/settings/20_reboot
11title=Reboot
22description=Reboot the system
3launchmsg=Rebooting
34icon=skin:icons/reboot.png
45exec=/sbin/reboot
56editable=false
src/link.cpp
103103    edited = true;
104104}
105105
106const string &Link::getLaunchMsg() {
107    return launchMsg;
108}
109
106110const string &Link::getIcon() {
107111    return icon;
108112}
src/link.h
5656    void setTitle(const std::string &title);
5757    const std::string &getDescription();
5858    void setDescription(const std::string &description);
59    const std::string &getLaunchMsg();
5960    const std::string &getIcon();
6061    void setIcon(const std::string &icon);
6162    const std::string &getIconPath();
...... 
6566protected:
6667    GMenu2X *gmenu2x;
6768    bool edited;
68    std::string title, description, icon, iconPath;
69    std::string title, description, launchMsg, icon, iconPath;
6970
7071    Surface *iconSurface;
7172    Surface *icon_hover;
src/linkapp.cpp
213213                title = value;
214214            } else if (name == "description") {
215215                description = value;
216            } else if (name == "launchmsg") {
217                launchMsg = value;
216218            } else if (name == "icon") {
217219                setIcon(value);
218220            } else if (name == "exec") {
...... 
311313        if (!isOpk()) {
312314            if (!title.empty() ) f << "title=" << title << endl;
313315            if (!description.empty() ) f << "description=" << description << endl;
316            if (!launchMsg.empty() ) f << "launchmsg=" << launchMsg << endl;
314317            if (!icon.empty() ) f << "icon=" << icon << endl;
315318            if (!exec.empty() ) f << "exec=" << exec << endl;
316319            if (!params.empty() ) f << "params=" << params << endl;
...... 
335338    //Darkened background
336339    gmenu2x->s->box(0, 0, gmenu2x->resX, gmenu2x->resY, 0,0,0,150);
337340
338    string text = gmenu2x->tr.translate("Launching $1",getTitle().c_str(),NULL);
341    string text = getLaunchMsg().empty()
342        ? gmenu2x->tr.translate("Launching $1", getTitle().c_str(), nullptr)
343        : gmenu2x->tr.translate(getLaunchMsg().c_str(), nullptr);
344
339345    int textW = gmenu2x->font->getTextWidth(text);
340346    int boxW = 62+textW;
341347    int halfBoxW = boxW/2;

Archive Download the corresponding diff file



interactive