1
0
mirror of git://projects.qi-hardware.com/gmenu2x.git synced 2024-07-02 18:32:20 +03:00

Give LinkApp a direct reference to the InputManager object instead of fetching it from the GMenu2X object.

This commit is contained in:
Maarten ter Huurne 2010-07-27 23:22:46 +02:00
parent 0ce743426a
commit 9fcaa2b8fa
3 changed files with 12 additions and 8 deletions

View File

@ -30,8 +30,10 @@
using namespace std;
LinkApp::LinkApp(GMenu2X *gmenu2x_, const char* linkfile)
LinkApp::LinkApp(GMenu2X *gmenu2x_, InputManager &inputMgr_,
const char* linkfile)
: Link(gmenu2x_)
, inputMgr(inputMgr_)
{
manual = "";
file = linkfile;
@ -329,10 +331,10 @@ void LinkApp::showManual() {
repaint = false;
}
gmenu2x->input.update();
if ( gmenu2x->input[ACTION_Y] || gmenu2x->input[ACTION_X] || gmenu2x->input[ACTION_START] ) close = true;
if ( gmenu2x->input[ACTION_LEFT] && page>0 ) { page--; repaint=true; }
if ( gmenu2x->input[ACTION_RIGHT] && page<pagecount-1 ) { page++; repaint=true; }
inputMgr.update();
if ( inputMgr[ACTION_Y] || inputMgr[ACTION_X] || inputMgr[ACTION_START] ) close = true;
if ( inputMgr[ACTION_LEFT] && page>0 ) { page--; repaint=true; }
if ( inputMgr[ACTION_RIGHT] && page<pagecount-1 ) { page++; repaint=true; }
}
return;
}

View File

@ -28,6 +28,7 @@
using std::string;
class GMenu2X;
class InputManager;
/**
Parses links files.
@ -36,6 +37,7 @@ Parses links files.
*/
class LinkApp : public Link {
private:
InputManager &inputMgr;
string sclock, svolume;
int iclock, ivolume;
//G
@ -55,7 +57,7 @@ private:
bool dontleave;
public:
LinkApp(GMenu2X *gmenu2x, const char* linkfile);
LinkApp(GMenu2X *gmenu2x, InputManager &inputMgr, const char* linkfile);
virtual const string &searchIcon();
const string &getExec();

View File

@ -269,7 +269,7 @@ bool Menu::addLink(string path, string file, string section) {
#ifdef DEBUG
cout << "\033[0;34mGMENU2X:\033[0m Section: " << sections[isection] << "(" << isection << ")" << endl;
#endif
LinkApp* link = new LinkApp(gmenu2x, linkpath.c_str());
LinkApp* link = new LinkApp(gmenu2x, gmenu2x->input, linkpath.c_str());
link->setSize(gmenu2x->skinConfInt["linkWidth"],gmenu2x->skinConfInt["linkHeight"]);
links[isection].push_back( link );
}
@ -425,7 +425,7 @@ void Menu::readLinks() {
sort(linkfiles.begin(), linkfiles.end(),case_less());
for (uint x=0; x<linkfiles.size(); x++) {
LinkApp *link = new LinkApp(gmenu2x, linkfiles[x].c_str());
LinkApp *link = new LinkApp(gmenu2x, gmenu2x->input, linkfiles[x].c_str());
link->setSize(gmenu2x->skinConfInt["linkWidth"],gmenu2x->skinConfInt["linkHeight"]);
if (link->targetExists())
links[i].push_back( link );