1
0
mirror of git://projects.qi-hardware.com/gmenu2x.git synced 2024-06-28 12:27:37 +03:00

Pass C++ string to LinkApp constructor

All callers already had C++ strings and LinkApp wants a C++ string,
but because of the argument type the strings had to be converted.
This commit is contained in:
Maarten ter Huurne 2014-08-17 18:49:39 +02:00
parent 79ef176831
commit 7992d83e10
3 changed files with 10 additions and 9 deletions

View File

@ -81,10 +81,10 @@ private:
#ifdef HAVE_LIBOPK
LinkApp::LinkApp(GMenu2X *gmenu2x_, const char* linkfile, bool deletable,
LinkApp::LinkApp(GMenu2X *gmenu2x_, string const& linkfile, bool deletable,
struct OPK *opk, const char *metadata_)
#else
LinkApp::LinkApp(GMenu2X *gmenu2x_, const char* linkfile, bool deletable)
LinkApp::LinkApp(GMenu2X *gmenu2x_, string const& linkfile, bool deletable)
#endif
: Link(gmenu2x_, bind(&LinkApp::start, this))
, deletable(deletable)
@ -161,8 +161,9 @@ LinkApp::LinkApp(GMenu2X *gmenu2x_, const char* linkfile, bool deletable)
/* Read the icon from the OPK only
* if it doesn't exist on the skin */
this->icon = gmenu2x->sc.getSkinFilePath("icons/" + (string) buf + ".png");
if (this->icon.empty())
this->icon = (string) linkfile + '#' + buf + ".png";
if (this->icon.empty()) {
this->icon = linkfile + '#' + buf + ".png";
}
iconPath = this->icon;
updateSurfaces();

View File

@ -61,10 +61,10 @@ public:
bool isOpk() { return isOPK; }
const std::string &getOpkFile() { return opkFile; }
LinkApp(GMenu2X *gmenu2x, const char* linkfile, bool deletable,
LinkApp(GMenu2X *gmenu2x, std::string const& linkfile, bool deletable,
struct OPK *opk = NULL, const char *metadata = NULL);
#else
LinkApp(GMenu2X *gmenu2x, const char* linkfile, bool deletable);
LinkApp(GMenu2X *gmenu2x, std::string const& linkfile, bool deletable);
bool isOpk() { return false; }
#endif

View File

@ -495,7 +495,7 @@ bool Menu::addLink(string path, string file, string section) {
INFO("Section: '%s(%i)'\n", sections[isection].c_str(), isection);
LinkApp* link = new LinkApp(gmenu2x, linkpath.c_str(), true);
LinkApp* link = new LinkApp(gmenu2x, linkpath, true);
link->setSize(gmenu2x->skinConfInt["linkWidth"],gmenu2x->skinConfInt["linkHeight"]);
links[isection].push_back( link );
}
@ -701,7 +701,7 @@ void Menu::openPackage(std::string path, bool order)
// Note: OPK links can only be deleted by removing the OPK itself,
// but that is not something we want to do in the menu,
// so consider this link undeletable.
link = new LinkApp(gmenu2x, path.c_str(), false, opk, name);
link = new LinkApp(gmenu2x, path, false, opk, name);
link->setSize(gmenu2x->skinConfInt["linkWidth"], gmenu2x->skinConfInt["linkHeight"]);
addSection(link->getCategory());
@ -851,7 +851,7 @@ void Menu::readLinks() {
// Check whether the link file could be deleted.
bool deletable = access(parentDir(linkfile).c_str(), W_OK) == 0;
LinkApp *link = new LinkApp(gmenu2x, linkfile.c_str(), deletable);
LinkApp *link = new LinkApp(gmenu2x, linkfile, deletable);
link->setSize(gmenu2x->skinConfInt["linkWidth"], gmenu2x->skinConfInt["linkHeight"]);
if (link->targetExists())
links[i].push_back(link);