mirror of
git://projects.qi-hardware.com/gmenu2x.git
synced 2024-11-25 20:25:54 +02:00
When started, load all OPKs in a thread to boost startup time
This commit is contained in:
parent
5d8fb6520f
commit
5c631d610e
36
src/menu.cpp
36
src/menu.cpp
@ -25,6 +25,7 @@
|
|||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
#include <thread>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#ifdef HAVE_LIBOPK
|
#ifdef HAVE_LIBOPK
|
||||||
@ -79,6 +80,26 @@ Menu::Menu(GMenu2X *gmenu2x, Touchscreen &ts)
|
|||||||
readLinks();
|
readLinks();
|
||||||
|
|
||||||
#ifdef HAVE_LIBOPK
|
#ifdef HAVE_LIBOPK
|
||||||
|
std::thread t(&Menu::openAllPackages, this);
|
||||||
|
t.detach();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
orderLinks();
|
||||||
|
|
||||||
|
btnContextMenu->setPosition(gmenu2x->resX - 38, gmenu2x->bottomBarIconY);
|
||||||
|
btnContextMenu->setAction(std::bind(&GMenu2X::showContextMenu, gmenu2x));
|
||||||
|
}
|
||||||
|
|
||||||
|
Menu::~Menu() {
|
||||||
|
freeLinks();
|
||||||
|
|
||||||
|
for (vector<Monitor *>::iterator it = monitors.begin();
|
||||||
|
it < monitors.end(); it++)
|
||||||
|
delete *it;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_LIBOPK
|
||||||
|
void Menu::openAllPackages(void)
|
||||||
{
|
{
|
||||||
struct dirent *dptr;
|
struct dirent *dptr;
|
||||||
DIR *dirp = opendir(CARD_ROOT);
|
DIR *dirp = opendir(CARD_ROOT);
|
||||||
@ -98,20 +119,6 @@ Menu::Menu(GMenu2X *gmenu2x, Touchscreen &ts)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
orderLinks();
|
|
||||||
|
|
||||||
btnContextMenu->setPosition(gmenu2x->resX - 38, gmenu2x->bottomBarIconY);
|
|
||||||
btnContextMenu->setAction(std::bind(&GMenu2X::showContextMenu, gmenu2x));
|
|
||||||
}
|
|
||||||
|
|
||||||
Menu::~Menu() {
|
|
||||||
freeLinks();
|
|
||||||
|
|
||||||
for (vector<Monitor *>::iterator it = monitors.begin();
|
|
||||||
it < monitors.end(); it++)
|
|
||||||
delete *it;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Menu::readSections(std::string parentDir)
|
void Menu::readSections(std::string parentDir)
|
||||||
{
|
{
|
||||||
DIR *dirp;
|
DIR *dirp;
|
||||||
@ -751,6 +758,7 @@ void Menu::readPackages(std::string parentDir)
|
|||||||
}
|
}
|
||||||
|
|
||||||
openPackage(parentDir + '/' + dptr->d_name, false);
|
openPackage(parentDir + '/' + dptr->d_name, false);
|
||||||
|
inject_user_event(); // Notify the InputManager for a repaint
|
||||||
}
|
}
|
||||||
|
|
||||||
closedir(dirp);
|
closedir(dirp);
|
||||||
|
@ -105,6 +105,7 @@ public:
|
|||||||
#ifdef HAVE_LIBOPK
|
#ifdef HAVE_LIBOPK
|
||||||
void openPackage(std::string path, bool order = true);
|
void openPackage(std::string path, bool order = true);
|
||||||
void openPackagesFromDir(std::string path);
|
void openPackagesFromDir(std::string path);
|
||||||
|
void openAllPackages(void);
|
||||||
#ifdef ENABLE_INOTIFY
|
#ifdef ENABLE_INOTIFY
|
||||||
void removePackageLink(std::string path);
|
void removePackageLink(std::string path);
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user