mirror of
git://projects.qi-hardware.com/gmenu2x.git
synced 2024-11-25 18:05:20 +02:00
Introduced custom application launch text
This can be used to override weird automatically constructed messages such as "Launching Power Off".
This commit is contained in:
parent
9d0a49524f
commit
cdf4ef1bf4
@ -1,5 +1,6 @@
|
||||
title=Power Off
|
||||
description=Shut down the system
|
||||
launchmsg=Powering off
|
||||
icon=skin:icons/poweroff.png
|
||||
exec=/sbin/poweroff
|
||||
editable=false
|
||||
|
@ -1,5 +1,6 @@
|
||||
title=Reboot
|
||||
description=Reboot the system
|
||||
launchmsg=Rebooting
|
||||
icon=skin:icons/reboot.png
|
||||
exec=/sbin/reboot
|
||||
editable=false
|
||||
|
@ -103,6 +103,10 @@ void Link::setDescription(const string &description) {
|
||||
edited = true;
|
||||
}
|
||||
|
||||
const string &Link::getLaunchMsg() {
|
||||
return launchMsg;
|
||||
}
|
||||
|
||||
const string &Link::getIcon() {
|
||||
return icon;
|
||||
}
|
||||
|
@ -56,6 +56,7 @@ public:
|
||||
void setTitle(const std::string &title);
|
||||
const std::string &getDescription();
|
||||
void setDescription(const std::string &description);
|
||||
const std::string &getLaunchMsg();
|
||||
const std::string &getIcon();
|
||||
void setIcon(const std::string &icon);
|
||||
const std::string &getIconPath();
|
||||
@ -65,7 +66,7 @@ public:
|
||||
protected:
|
||||
GMenu2X *gmenu2x;
|
||||
bool edited;
|
||||
std::string title, description, icon, iconPath;
|
||||
std::string title, description, launchMsg, icon, iconPath;
|
||||
|
||||
Surface *iconSurface;
|
||||
Surface *icon_hover;
|
||||
|
@ -213,6 +213,8 @@ LinkApp::LinkApp(GMenu2X *gmenu2x_, const char* linkfile)
|
||||
title = value;
|
||||
} else if (name == "description") {
|
||||
description = value;
|
||||
} else if (name == "launchmsg") {
|
||||
launchMsg = value;
|
||||
} else if (name == "icon") {
|
||||
setIcon(value);
|
||||
} else if (name == "exec") {
|
||||
@ -311,6 +313,7 @@ bool LinkApp::save() {
|
||||
if (!isOpk()) {
|
||||
if (!title.empty() ) f << "title=" << title << endl;
|
||||
if (!description.empty() ) f << "description=" << description << endl;
|
||||
if (!launchMsg.empty() ) f << "launchmsg=" << launchMsg << endl;
|
||||
if (!icon.empty() ) f << "icon=" << icon << endl;
|
||||
if (!exec.empty() ) f << "exec=" << exec << endl;
|
||||
if (!params.empty() ) f << "params=" << params << endl;
|
||||
@ -335,7 +338,10 @@ void LinkApp::drawRun() {
|
||||
//Darkened background
|
||||
gmenu2x->s->box(0, 0, gmenu2x->resX, gmenu2x->resY, 0,0,0,150);
|
||||
|
||||
string text = gmenu2x->tr.translate("Launching $1",getTitle().c_str(),NULL);
|
||||
string text = getLaunchMsg().empty()
|
||||
? gmenu2x->tr.translate("Launching $1", getTitle().c_str(), nullptr)
|
||||
: gmenu2x->tr.translate(getLaunchMsg().c_str(), nullptr);
|
||||
|
||||
int textW = gmenu2x->font->getTextWidth(text);
|
||||
int boxW = 62+textW;
|
||||
int halfBoxW = boxW/2;
|
||||
|
Loading…
Reference in New Issue
Block a user