mirror of
git://projects.qi-hardware.com/gmenu2x.git
synced 2024-11-22 13:22:28 +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
|
title=Power Off
|
||||||
description=Shut down the system
|
description=Shut down the system
|
||||||
|
launchmsg=Powering off
|
||||||
icon=skin:icons/poweroff.png
|
icon=skin:icons/poweroff.png
|
||||||
exec=/sbin/poweroff
|
exec=/sbin/poweroff
|
||||||
editable=false
|
editable=false
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
title=Reboot
|
title=Reboot
|
||||||
description=Reboot the system
|
description=Reboot the system
|
||||||
|
launchmsg=Rebooting
|
||||||
icon=skin:icons/reboot.png
|
icon=skin:icons/reboot.png
|
||||||
exec=/sbin/reboot
|
exec=/sbin/reboot
|
||||||
editable=false
|
editable=false
|
||||||
|
@ -103,6 +103,10 @@ void Link::setDescription(const string &description) {
|
|||||||
edited = true;
|
edited = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const string &Link::getLaunchMsg() {
|
||||||
|
return launchMsg;
|
||||||
|
}
|
||||||
|
|
||||||
const string &Link::getIcon() {
|
const string &Link::getIcon() {
|
||||||
return icon;
|
return icon;
|
||||||
}
|
}
|
||||||
|
@ -56,6 +56,7 @@ public:
|
|||||||
void setTitle(const std::string &title);
|
void setTitle(const std::string &title);
|
||||||
const std::string &getDescription();
|
const std::string &getDescription();
|
||||||
void setDescription(const std::string &description);
|
void setDescription(const std::string &description);
|
||||||
|
const std::string &getLaunchMsg();
|
||||||
const std::string &getIcon();
|
const std::string &getIcon();
|
||||||
void setIcon(const std::string &icon);
|
void setIcon(const std::string &icon);
|
||||||
const std::string &getIconPath();
|
const std::string &getIconPath();
|
||||||
@ -65,7 +66,7 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
GMenu2X *gmenu2x;
|
GMenu2X *gmenu2x;
|
||||||
bool edited;
|
bool edited;
|
||||||
std::string title, description, icon, iconPath;
|
std::string title, description, launchMsg, icon, iconPath;
|
||||||
|
|
||||||
Surface *iconSurface;
|
Surface *iconSurface;
|
||||||
Surface *icon_hover;
|
Surface *icon_hover;
|
||||||
|
@ -213,6 +213,8 @@ LinkApp::LinkApp(GMenu2X *gmenu2x_, const char* linkfile)
|
|||||||
title = value;
|
title = value;
|
||||||
} else if (name == "description") {
|
} else if (name == "description") {
|
||||||
description = value;
|
description = value;
|
||||||
|
} else if (name == "launchmsg") {
|
||||||
|
launchMsg = value;
|
||||||
} else if (name == "icon") {
|
} else if (name == "icon") {
|
||||||
setIcon(value);
|
setIcon(value);
|
||||||
} else if (name == "exec") {
|
} else if (name == "exec") {
|
||||||
@ -311,6 +313,7 @@ bool LinkApp::save() {
|
|||||||
if (!isOpk()) {
|
if (!isOpk()) {
|
||||||
if (!title.empty() ) f << "title=" << title << endl;
|
if (!title.empty() ) f << "title=" << title << endl;
|
||||||
if (!description.empty() ) f << "description=" << description << endl;
|
if (!description.empty() ) f << "description=" << description << endl;
|
||||||
|
if (!launchMsg.empty() ) f << "launchmsg=" << launchMsg << endl;
|
||||||
if (!icon.empty() ) f << "icon=" << icon << endl;
|
if (!icon.empty() ) f << "icon=" << icon << endl;
|
||||||
if (!exec.empty() ) f << "exec=" << exec << endl;
|
if (!exec.empty() ) f << "exec=" << exec << endl;
|
||||||
if (!params.empty() ) f << "params=" << params << endl;
|
if (!params.empty() ) f << "params=" << params << endl;
|
||||||
@ -335,7 +338,10 @@ void LinkApp::drawRun() {
|
|||||||
//Darkened background
|
//Darkened background
|
||||||
gmenu2x->s->box(0, 0, gmenu2x->resX, gmenu2x->resY, 0,0,0,150);
|
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 textW = gmenu2x->font->getTextWidth(text);
|
||||||
int boxW = 62+textW;
|
int boxW = 62+textW;
|
||||||
int halfBoxW = boxW/2;
|
int halfBoxW = boxW/2;
|
||||||
|
Loading…
Reference in New Issue
Block a user