mirror of
https://projects.vdr-developer.org/git/vdr-plugin-skindesigner.git
synced 2023-10-19 17:58:31 +02:00
changed skin installation that VDR main loop is not blocked
This commit is contained in:
parent
d2947bfcfd
commit
664b71daee
4
HISTORY
4
HISTORY
@ -354,3 +354,7 @@ Version 0.5.0
|
|||||||
- adapted README
|
- adapted README
|
||||||
|
|
||||||
Version 0.5.1
|
Version 0.5.1
|
||||||
|
|
||||||
|
- changed skin installation that VDR main loop is not blocked
|
||||||
|
- use shallow clone when cloning git
|
||||||
|
|
||||||
|
@ -195,6 +195,7 @@ bool cSDDisplayMenu::SetItemPlugin(map<string,string> *stringTokens, map<string,
|
|||||||
void cSDDisplayMenu::SetItem(const char *Text, int Index, bool Current, bool Selectable) {
|
void cSDDisplayMenu::SetItem(const char *Text, int Index, bool Current, bool Selectable) {
|
||||||
if (!doOutput)
|
if (!doOutput)
|
||||||
return;
|
return;
|
||||||
|
//esyslog("skindesigner: %s %d - %s", Current ? "----->" : "", Index, Text);
|
||||||
cDisplayMenuListView *list = rootView->GetListView();
|
cDisplayMenuListView *list = rootView->GetListView();
|
||||||
if (!list) {
|
if (!list) {
|
||||||
return;
|
return;
|
||||||
|
@ -32,7 +32,7 @@ void cSkinRepo::Install(string path, string themesPath) {
|
|||||||
this->themesPath = themesPath;
|
this->themesPath = themesPath;
|
||||||
if (repoType == rtGit) {
|
if (repoType == rtGit) {
|
||||||
|
|
||||||
command = *cString::sprintf("git clone --progress %s %s", url.c_str(), skinPath.c_str());
|
command = *cString::sprintf("git clone --depth=1 --progress %s %s", url.c_str(), skinPath.c_str());
|
||||||
tempfile = *cString::sprintf("gitclone_%s_%ld.out", name.c_str(), time(0));
|
tempfile = *cString::sprintf("gitclone_%s_%ld.out", name.c_str(), time(0));
|
||||||
|
|
||||||
dsyslog("skindesigner: installing skin from Git, command: %s, logfile: %s", command.c_str(), tempfile.c_str());
|
dsyslog("skindesigner: installing skin from Git, command: %s, logfile: %s", command.c_str(), tempfile.c_str());
|
||||||
|
50
po/de_DE.po
50
po/de_DE.po
@ -6,7 +6,7 @@ msgid ""
|
|||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: vdr-skindesigner 0.0.1\n"
|
"Project-Id-Version: vdr-skindesigner 0.0.1\n"
|
||||||
"Report-Msgid-Bugs-To: <see README>\n"
|
"Report-Msgid-Bugs-To: <see README>\n"
|
||||||
"POT-Creation-Date: 2015-05-29 18:13+0200\n"
|
"POT-Creation-Date: 2015-06-04 10:40+0200\n"
|
||||||
"PO-Revision-Date: 2014-09-27 11:02+0200\n"
|
"PO-Revision-Date: 2014-09-27 11:02+0200\n"
|
||||||
"Last-Translator: Louis Braun <louis.braun@gmx.de>\n"
|
"Last-Translator: Louis Braun <louis.braun@gmx.de>\n"
|
||||||
"Language-Team: \n"
|
"Language-Team: \n"
|
||||||
@ -15,6 +15,30 @@ msgstr ""
|
|||||||
"Content-Type: text/plain; charset=utf-8\n"
|
"Content-Type: text/plain; charset=utf-8\n"
|
||||||
"Content-Transfer-Encoding: 8bit\n"
|
"Content-Transfer-Encoding: 8bit\n"
|
||||||
|
|
||||||
|
msgid "Skin successfully installed"
|
||||||
|
msgstr "Skin installiert"
|
||||||
|
|
||||||
|
msgid "Skin NOT successfully installed"
|
||||||
|
msgstr "Skin NICHT installiert"
|
||||||
|
|
||||||
|
msgid "Timeout"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Installing Skin"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "sec"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Skin successfully updated"
|
||||||
|
msgstr "Skin erfolgreich aktualisiert"
|
||||||
|
|
||||||
|
msgid "Skin already up to date"
|
||||||
|
msgstr "Skin ist auf aktuellem Stand"
|
||||||
|
|
||||||
|
msgid "Updating Skin from Git"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
msgid "after one another"
|
msgid "after one another"
|
||||||
msgstr "eines nach dem anderen"
|
msgstr "eines nach dem anderen"
|
||||||
|
|
||||||
@ -30,27 +54,9 @@ msgstr "Installiere Skin"
|
|||||||
msgid "Update from Git"
|
msgid "Update from Git"
|
||||||
msgstr "Aus Git aktualisieren"
|
msgstr "Aus Git aktualisieren"
|
||||||
|
|
||||||
msgid "Installing Skin..."
|
|
||||||
msgstr "Installiere Skin..."
|
|
||||||
|
|
||||||
msgid "Skin successfully installed"
|
|
||||||
msgstr "Skin installiert"
|
|
||||||
|
|
||||||
msgid "Skin NOT successfully installed"
|
|
||||||
msgstr "Skin NICHT installiert"
|
|
||||||
|
|
||||||
msgid "No Git Repsoitory available"
|
msgid "No Git Repsoitory available"
|
||||||
msgstr "Kein Git Repository verfügbar"
|
msgstr "Kein Git Repository verfügbar"
|
||||||
|
|
||||||
msgid "Updating Skin from Git..."
|
|
||||||
msgstr "Aktualisiere Skin aus Git..."
|
|
||||||
|
|
||||||
msgid "Skin successfully updated"
|
|
||||||
msgstr "Skin erfolgreich aktualisiert"
|
|
||||||
|
|
||||||
msgid "Skin already up to date"
|
|
||||||
msgstr "Skin ist auf aktuellem Stand"
|
|
||||||
|
|
||||||
msgid "Plugin Setup"
|
msgid "Plugin Setup"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
@ -137,3 +143,9 @@ msgstr "Unterstützte Plugins"
|
|||||||
|
|
||||||
msgid "Skin Designer"
|
msgid "Skin Designer"
|
||||||
msgstr "Skin Designer"
|
msgstr "Skin Designer"
|
||||||
|
|
||||||
|
#~ msgid "Updating Skin from Git..."
|
||||||
|
#~ msgstr "Aktualisiere Skin aus Git..."
|
||||||
|
|
||||||
|
#~ msgid "Installing Skin..."
|
||||||
|
#~ msgstr "Installiere Skin..."
|
||||||
|
44
po/fi_FI.po
44
po/fi_FI.po
@ -6,7 +6,7 @@ msgid ""
|
|||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: vdr-skindesigner 0.2.0\n"
|
"Project-Id-Version: vdr-skindesigner 0.2.0\n"
|
||||||
"Report-Msgid-Bugs-To: <see README>\n"
|
"Report-Msgid-Bugs-To: <see README>\n"
|
||||||
"POT-Creation-Date: 2015-05-29 18:13+0200\n"
|
"POT-Creation-Date: 2015-06-04 10:40+0200\n"
|
||||||
"PO-Revision-Date: 2015-01-25 01:25+0200\n"
|
"PO-Revision-Date: 2015-01-25 01:25+0200\n"
|
||||||
"Last-Translator: Rolf Ahrenberg\n"
|
"Last-Translator: Rolf Ahrenberg\n"
|
||||||
"Language-Team: Finnish\n"
|
"Language-Team: Finnish\n"
|
||||||
@ -15,6 +15,30 @@ msgstr ""
|
|||||||
"Content-Type: text/plain; charset=UTF-8\n"
|
"Content-Type: text/plain; charset=UTF-8\n"
|
||||||
"Content-Transfer-Encoding: 8bit\n"
|
"Content-Transfer-Encoding: 8bit\n"
|
||||||
|
|
||||||
|
msgid "Skin successfully installed"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Skin NOT successfully installed"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Timeout"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Installing Skin"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "sec"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Skin successfully updated"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Skin already up to date"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Updating Skin from Git"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
msgid "after one another"
|
msgid "after one another"
|
||||||
msgstr "yksi kerrallaan"
|
msgstr "yksi kerrallaan"
|
||||||
|
|
||||||
@ -30,27 +54,9 @@ msgstr ""
|
|||||||
msgid "Update from Git"
|
msgid "Update from Git"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
msgid "Installing Skin..."
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
msgid "Skin successfully installed"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
msgid "Skin NOT successfully installed"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
msgid "No Git Repsoitory available"
|
msgid "No Git Repsoitory available"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
msgid "Updating Skin from Git..."
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
msgid "Skin successfully updated"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
msgid "Skin already up to date"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
msgid "Plugin Setup"
|
msgid "Plugin Setup"
|
||||||
msgstr "Yleiset"
|
msgstr "Yleiset"
|
||||||
|
|
||||||
|
247
setup.c
247
setup.c
@ -1,6 +1,122 @@
|
|||||||
#include "libcore/curlfuncs.h"
|
#include "libcore/curlfuncs.h"
|
||||||
#include "setup.h"
|
#include "setup.h"
|
||||||
|
|
||||||
|
// --- cInstallManager -----------------------------------------------------------
|
||||||
|
cInstallManager::cInstallManager(void) {
|
||||||
|
installing = false;
|
||||||
|
updating = false;
|
||||||
|
runningInst = NULL;
|
||||||
|
installationStart = 0;
|
||||||
|
lastInstallDuration = -1;
|
||||||
|
timeout = 120; //2 Minutes timeout
|
||||||
|
currentSkin = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
cInstallManager::~cInstallManager(void) {
|
||||||
|
}
|
||||||
|
|
||||||
|
bool cInstallManager::StartInstallation(string skin) {
|
||||||
|
runningInst = config.GetSkinRepo(skin);
|
||||||
|
if (!runningInst) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
installing = true;
|
||||||
|
installationStart = cTimeMs::Now();
|
||||||
|
runningInst->Install(*config.installerSkinPath, config.vdrThemesPath);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool cInstallManager::StartUpdate(string skin) {
|
||||||
|
runningInst = config.GetSkinRepo(skin);
|
||||||
|
if (!runningInst || runningInst->Type() != rtGit) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
updating = true;
|
||||||
|
installationStart = cTimeMs::Now();
|
||||||
|
runningInst->Update(*config.installerSkinPath);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool cInstallManager::Finished(void) {
|
||||||
|
if (!runningInst)
|
||||||
|
return true;
|
||||||
|
if (runningInst->InstallationFinished()) {
|
||||||
|
installing = false;
|
||||||
|
updating = false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool cInstallManager::SuccessfullyInstalled(void) {
|
||||||
|
if (!runningInst)
|
||||||
|
return false;
|
||||||
|
bool ok = runningInst->SuccessfullyInstalled();
|
||||||
|
runningInst = NULL;
|
||||||
|
return ok;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool cInstallManager::SuccessfullyUpdated(void) {
|
||||||
|
if (!runningInst)
|
||||||
|
return false;
|
||||||
|
bool ok = runningInst->SuccessfullyUpdated();
|
||||||
|
runningInst = NULL;
|
||||||
|
return ok;
|
||||||
|
}
|
||||||
|
|
||||||
|
int cInstallManager::Duration(void) {
|
||||||
|
return (cTimeMs::Now() - installationStart) / 1000;
|
||||||
|
}
|
||||||
|
|
||||||
|
eOSState cInstallManager::ProcessInstallationStatus(void) {
|
||||||
|
if (Installing()) {
|
||||||
|
if (Finished()) {
|
||||||
|
if (SuccessfullyInstalled()) {
|
||||||
|
config.AddNewSkinRef(currentSkin);
|
||||||
|
Skins.Message(mtStatus, tr("Skin successfully installed"));
|
||||||
|
} else {
|
||||||
|
Skins.Message(mtError, tr("Skin NOT successfully installed"));
|
||||||
|
}
|
||||||
|
cCondWait::SleepMs(1000);
|
||||||
|
return osEnd;
|
||||||
|
} else {
|
||||||
|
int duration = Duration();
|
||||||
|
if (duration > timeout) {
|
||||||
|
Skins.Message(mtError, tr("Timeout"));
|
||||||
|
cCondWait::SleepMs(1000);
|
||||||
|
return osEnd;
|
||||||
|
} else if (duration != lastInstallDuration) {
|
||||||
|
Skins.Message(mtStatus, *cString::sprintf("%s (%d %s)...", tr("Installing Skin"), duration, tr("sec")));
|
||||||
|
lastInstallDuration = duration;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (Updating()) {
|
||||||
|
if (Finished()) {
|
||||||
|
if (SuccessfullyUpdated()) {
|
||||||
|
Skins.Message(mtStatus, tr("Skin successfully updated"));
|
||||||
|
} else {
|
||||||
|
Skins.Message(mtStatus, tr("Skin already up to date"));
|
||||||
|
}
|
||||||
|
cCondWait::SleepMs(1000);
|
||||||
|
return osEnd;
|
||||||
|
} else {
|
||||||
|
int duration = Duration();
|
||||||
|
if (duration > timeout) {
|
||||||
|
Skins.Message(mtError, tr("Timeout"));
|
||||||
|
cCondWait::SleepMs(1000);
|
||||||
|
return osEnd;
|
||||||
|
} else if (duration != lastInstallDuration) {
|
||||||
|
Skins.Message(mtStatus, *cString::sprintf("%s (%d %s)...", tr("Updating Skin from Git"), duration, tr("sec")));
|
||||||
|
lastInstallDuration = duration;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return osContinue;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// --- cSkinDesignerSetup -----------------------------------------------------------
|
||||||
cSkinDesignerSetup::cSkinDesignerSetup() {
|
cSkinDesignerSetup::cSkinDesignerSetup() {
|
||||||
numLogosPerSizeInitial = config.numLogosPerSizeInitial;
|
numLogosPerSizeInitial = config.numLogosPerSizeInitial;
|
||||||
limitLogoCache = config.limitLogoCache;
|
limitLogoCache = config.limitLogoCache;
|
||||||
@ -16,7 +132,7 @@ cSkinDesignerSetup::cSkinDesignerSetup() {
|
|||||||
Setup();
|
Setup();
|
||||||
}
|
}
|
||||||
|
|
||||||
cSkinDesignerSetup::~cSkinDesignerSetup() {
|
cSkinDesignerSetup::~cSkinDesignerSetup(void) {
|
||||||
config.setupCloseDoReload = true;
|
config.setupCloseDoReload = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -35,11 +151,16 @@ void cSkinDesignerSetup::Setup(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
eOSState cSkinDesignerSetup::ProcessKey(eKeys Key) {
|
eOSState cSkinDesignerSetup::ProcessKey(eKeys Key) {
|
||||||
|
eOSState state = ProcessInstallationStatus();
|
||||||
|
if (state == osEnd)
|
||||||
|
return osEnd;
|
||||||
|
|
||||||
bool hadSubMenu = HasSubMenu();
|
bool hadSubMenu = HasSubMenu();
|
||||||
eOSState state = cMenuSetupPage::ProcessKey(Key);
|
state = cMenuSetupPage::ProcessKey(Key);
|
||||||
if (hadSubMenu && Key == kOk) {
|
if (hadSubMenu && Key == kOk) {
|
||||||
Store();
|
Store();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!hadSubMenu && (Key == kOk || Key == kUp || Key == kDown || Key == kLeft || Key == kRight || Key == kRed)) {
|
if (!hadSubMenu && (Key == kOk || Key == kUp || Key == kDown || Key == kLeft || Key == kRight || Key == kRed)) {
|
||||||
SetHelp(NULL, NULL, NULL, NULL);
|
SetHelp(NULL, NULL, NULL, NULL);
|
||||||
cOsdItem *current = Get(Current());
|
cOsdItem *current = Get(Current());
|
||||||
@ -47,16 +168,16 @@ eOSState cSkinDesignerSetup::ProcessKey(eKeys Key) {
|
|||||||
if (!skinMenuItem)
|
if (!skinMenuItem)
|
||||||
return state;
|
return state;
|
||||||
eItemType type = skinMenuItem->Type();
|
eItemType type = skinMenuItem->Type();
|
||||||
string skinName = skinMenuItem->GetSkinName();
|
currentSkin = skinMenuItem->GetSkinName();
|
||||||
// KEY OK
|
// KEY OK
|
||||||
if ((Key == kOk)) {
|
if ((Key == kOk)) {
|
||||||
if (type == itSkinSetup) {
|
if (type == itSkinSetup) {
|
||||||
state = AddSubMenu(new cSkindesignerSkinSetup(skinName, ""));
|
state = AddSubMenu(new cSkindesignerSkinSetup(currentSkin, ""));
|
||||||
} else if (type == itNoSkinSetup) {
|
} else if (type == itNoSkinSetup) {
|
||||||
state = osContinue;
|
state = osContinue;
|
||||||
} else if (type == itSkinRepo) {
|
} else if (type == itSkinRepo) {
|
||||||
Skins.Message(mtStatus, tr("Downloading Skin Screenshots..."));
|
Skins.Message(mtStatus, tr("Downloading Skin Screenshots..."));
|
||||||
cSkindesignerSkinPreview *prev = new cSkindesignerSkinPreview(skinName);
|
cSkindesignerSkinPreview *prev = new cSkindesignerSkinPreview(currentSkin);
|
||||||
Skins.Message(mtStatus, NULL);
|
Skins.Message(mtStatus, NULL);
|
||||||
state = AddSubMenu(prev);
|
state = AddSubMenu(prev);
|
||||||
}
|
}
|
||||||
@ -66,7 +187,7 @@ eOSState cSkinDesignerSetup::ProcessKey(eKeys Key) {
|
|||||||
if (type == itSkinRepo) {
|
if (type == itSkinRepo) {
|
||||||
SetHelp(tr("Install Skin"), NULL, NULL, NULL);
|
SetHelp(tr("Install Skin"), NULL, NULL, NULL);
|
||||||
} else if (type == itSkinSetup || type == itNoSkinSetup) {
|
} else if (type == itSkinSetup || type == itNoSkinSetup) {
|
||||||
cSkinRepo *repo = config.GetSkinRepo(skinName);
|
cSkinRepo *repo = config.GetSkinRepo(currentSkin);
|
||||||
if (repo && repo->Type() == rtGit) {
|
if (repo && repo->Type() == rtGit) {
|
||||||
SetHelp(tr("Update from Git"), NULL, NULL, NULL);
|
SetHelp(tr("Update from Git"), NULL, NULL, NULL);
|
||||||
}
|
}
|
||||||
@ -75,44 +196,14 @@ eOSState cSkinDesignerSetup::ProcessKey(eKeys Key) {
|
|||||||
// KEY RED
|
// KEY RED
|
||||||
if (Key == kRed) {
|
if (Key == kRed) {
|
||||||
if (type == itSkinRepo) {
|
if (type == itSkinRepo) {
|
||||||
Skins.Message(mtStatus, tr("Installing Skin..."));
|
Skins.Message(mtStatus, *cString::sprintf("%s ...", tr("Installing Skin")));
|
||||||
cSkinRepo *skinRepo = config.GetSkinRepo(skinName);
|
StartInstallation(currentSkin);
|
||||||
if (!skinRepo) {
|
|
||||||
return state;
|
|
||||||
}
|
|
||||||
skinRepo->Install(*config.installerSkinPath, config.vdrThemesPath);
|
|
||||||
while (!skinRepo->InstallationFinished()) {
|
|
||||||
cCondWait::SleepMs(50);
|
|
||||||
}
|
|
||||||
bool ok = skinRepo->SuccessfullyInstalled();
|
|
||||||
if (ok) {
|
|
||||||
config.AddNewSkinRef(skinName);
|
|
||||||
Skins.Message(mtStatus, tr("Skin successfully installed"));
|
|
||||||
cCondWait::SleepMs(1000);
|
|
||||||
state = osEnd;
|
|
||||||
} else {
|
|
||||||
Skins.Message(mtStatus, tr("Skin NOT successfully installed"));
|
|
||||||
state = osContinue;
|
|
||||||
}
|
|
||||||
} else if (type == itSkinSetup || type == itNoSkinSetup) {
|
} else if (type == itSkinSetup || type == itNoSkinSetup) {
|
||||||
cSkinRepo *skinRepo = config.GetSkinRepo(skinName);
|
bool gitAvailable = StartUpdate(currentSkin);
|
||||||
if (!skinRepo || skinRepo->Type() != rtGit) {
|
if (gitAvailable) {
|
||||||
Skins.Message(mtStatus, tr("No Git Repsoitory available"));
|
Skins.Message(mtStatus, *cString::sprintf("%s ...", tr("Updating Skin from Git")));
|
||||||
return state;
|
|
||||||
}
|
|
||||||
Skins.Message(mtStatus, tr("Updating Skin from Git..."));
|
|
||||||
skinRepo->Update(*config.installerSkinPath);
|
|
||||||
while (!skinRepo->InstallationFinished()) {
|
|
||||||
cCondWait::SleepMs(50);
|
|
||||||
}
|
|
||||||
bool ok = skinRepo->SuccessfullyUpdated();
|
|
||||||
if (ok) {
|
|
||||||
Skins.Message(mtStatus, tr("Skin successfully updated"));
|
|
||||||
cCondWait::SleepMs(1000);
|
|
||||||
state = osEnd;
|
|
||||||
} else {
|
} else {
|
||||||
Skins.Message(mtStatus, tr("Skin already up to date"));
|
Skins.Message(mtStatus, tr("No Git Repsoitory available"));
|
||||||
state = osContinue;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -261,7 +352,10 @@ cSkindesignerSkinSetup::~cSkindesignerSkinSetup() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
eOSState cSkindesignerSkinSetup::ProcessKey(eKeys Key) {
|
eOSState cSkindesignerSkinSetup::ProcessKey(eKeys Key) {
|
||||||
eOSState state = cOsdMenu::ProcessKey(Key);
|
eOSState state = ProcessInstallationStatus();
|
||||||
|
if (state == osEnd)
|
||||||
|
return osEnd;
|
||||||
|
state = cOsdMenu::ProcessKey(Key);
|
||||||
if (state == osUnknown) {
|
if (state == osUnknown) {
|
||||||
switch (Key) {
|
switch (Key) {
|
||||||
case kOk: {
|
case kOk: {
|
||||||
@ -275,24 +369,11 @@ eOSState cSkindesignerSkinSetup::ProcessKey(eKeys Key) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
case kRed: {
|
case kRed: {
|
||||||
cSkinRepo *skinRepo = config.GetSkinRepo(skin);
|
bool gitAvailable = StartUpdate(skin);
|
||||||
if (!skinRepo) {
|
if (gitAvailable) {
|
||||||
Skins.Message(mtStatus, tr("No Git Repsoitory available"));
|
Skins.Message(mtStatus, *cString::sprintf("%s ...", tr("Updating Skin from Git")));
|
||||||
return state;
|
|
||||||
}
|
|
||||||
Skins.Message(mtStatus, tr("Updating Skin from Git..."));
|
|
||||||
skinRepo->Update(*config.installerSkinPath);
|
|
||||||
while (!skinRepo->InstallationFinished()) {
|
|
||||||
cCondWait::SleepMs(50);
|
|
||||||
}
|
|
||||||
bool ok = skinRepo->SuccessfullyUpdated();
|
|
||||||
if (ok) {
|
|
||||||
Skins.Message(mtStatus, tr("Skin successfully updated"));
|
|
||||||
cCondWait::SleepMs(1000);
|
|
||||||
state = osEnd;
|
|
||||||
} else {
|
} else {
|
||||||
Skins.Message(mtStatus, tr("Skin already up to date"));
|
Skins.Message(mtStatus, tr("No Git Repsoitory available"));
|
||||||
state = osContinue;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
@ -334,7 +415,7 @@ void cSkindesignerSkinSetup::Set(void) {
|
|||||||
|
|
||||||
cSkindesignerSkinPreview::cSkindesignerSkinPreview(string skinName) :
|
cSkindesignerSkinPreview::cSkindesignerSkinPreview(string skinName) :
|
||||||
cSkindesignerOsdMenu(*cString::sprintf("%s: %s \"%s\"", trVDR("Preview"), tr("Skin"), skinName.c_str())) {
|
cSkindesignerOsdMenu(*cString::sprintf("%s: %s \"%s\"", trVDR("Preview"), tr("Skin"), skinName.c_str())) {
|
||||||
this->skinName = skinName;
|
currentSkin = skinName;
|
||||||
SetPluginName("setup");
|
SetPluginName("setup");
|
||||||
FirstCallCleared();
|
FirstCallCleared();
|
||||||
Set();
|
Set();
|
||||||
@ -344,7 +425,10 @@ cSkindesignerSkinPreview::~cSkindesignerSkinPreview() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
eOSState cSkindesignerSkinPreview::ProcessKey(eKeys Key) {
|
eOSState cSkindesignerSkinPreview::ProcessKey(eKeys Key) {
|
||||||
eOSState state = cOsdMenu::ProcessKey(Key);
|
eOSState state = ProcessInstallationStatus();
|
||||||
|
if (state == osEnd)
|
||||||
|
return osEnd;
|
||||||
|
state = cOsdMenu::ProcessKey(Key);
|
||||||
switch (Key) {
|
switch (Key) {
|
||||||
case kOk:
|
case kOk:
|
||||||
case kBack:
|
case kBack:
|
||||||
@ -367,14 +451,8 @@ eOSState cSkindesignerSkinPreview::ProcessKey(eKeys Key) {
|
|||||||
state = osContinue;
|
state = osContinue;
|
||||||
break;
|
break;
|
||||||
} case kRed: {
|
} case kRed: {
|
||||||
Skins.Message(mtStatus, tr("Installing Skin..."));
|
StartInstallation(currentSkin);
|
||||||
bool ok = InstallSkin();
|
state = osContinue;
|
||||||
if (ok)
|
|
||||||
Skins.Message(mtStatus, tr("Skin successfully installed"));
|
|
||||||
else
|
|
||||||
Skins.Message(mtStatus, tr("Skin NOT successfully installed"));
|
|
||||||
cCondWait::SleepMs(1000);
|
|
||||||
state = osEnd;
|
|
||||||
break;
|
break;
|
||||||
} default:
|
} default:
|
||||||
break;
|
break;
|
||||||
@ -392,18 +470,18 @@ void cSkindesignerSkinPreview::Set(void) {
|
|||||||
ClearTokens();
|
ClearTokens();
|
||||||
Clear();
|
Clear();
|
||||||
|
|
||||||
cSkinRepo *skinRepo = config.GetSkinRepo(skinName);
|
cSkinRepo *skinRepo = config.GetSkinRepo(currentSkin);
|
||||||
if (!skinRepo) {
|
if (!skinRepo) {
|
||||||
esyslog("skindesigner: no valid skin repository found for skin %s", skinName.c_str());
|
esyslog("skindesigner: no valid skin repository found for skin %s", currentSkin.c_str());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
AddStringToken("menuheader", *cString::sprintf("%s: %s \"%s\"", trVDR("Preview"), tr("Skin"), skinName.c_str()));
|
AddStringToken("menuheader", *cString::sprintf("%s: %s \"%s\"", trVDR("Preview"), tr("Skin"), currentSkin.c_str()));
|
||||||
AddStringToken("skinname", skinName);
|
AddStringToken("skinname", currentSkin);
|
||||||
AddStringToken("author", skinRepo->Author());
|
AddStringToken("author", skinRepo->Author());
|
||||||
|
|
||||||
stringstream plainText;
|
stringstream plainText;
|
||||||
plainText << *cString::sprintf("%s: %s \"%s\"", trVDR("Preview"), tr("Skin"), skinName.c_str()) << "\n\n";
|
plainText << *cString::sprintf("%s: %s \"%s\"", trVDR("Preview"), tr("Skin"), currentSkin.c_str()) << "\n\n";
|
||||||
plainText << tr("Author") << ": " << skinRepo->Author() << "\n";
|
plainText << tr("Author") << ": " << skinRepo->Author() << "\n";
|
||||||
|
|
||||||
plainText << tr("Used Fonts") << ": \n";
|
plainText << tr("Used Fonts") << ": \n";
|
||||||
@ -435,7 +513,7 @@ void cSkindesignerSkinPreview::Set(void) {
|
|||||||
if (url.find(".png") != string::npos)
|
if (url.find(".png") != string::npos)
|
||||||
imgType = ".png";
|
imgType = ".png";
|
||||||
stringstream tempName;
|
stringstream tempName;
|
||||||
tempName << "/tmp/screenshot_" << skinName << "_" << i++ << imgType;
|
tempName << "/tmp/screenshot_" << currentSkin << "_" << i++ << imgType;
|
||||||
dsyslog("skindesigner: download screenshot name %s url %s", tempName.str().c_str(), url.c_str());
|
dsyslog("skindesigner: download screenshot name %s url %s", tempName.str().c_str(), url.c_str());
|
||||||
CurlGetUrlFile(url.c_str(), tempName.str().c_str());
|
CurlGetUrlFile(url.c_str(), tempName.str().c_str());
|
||||||
map<string,string> img;
|
map<string,string> img;
|
||||||
@ -445,23 +523,6 @@ void cSkindesignerSkinPreview::Set(void) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cSkindesignerSkinPreview::InstallSkin(void) {
|
|
||||||
cSkinRepo *skinRepo = config.GetSkinRepo(skinName);
|
|
||||||
if (!skinRepo) {
|
|
||||||
esyslog("skindesigner: no valid skin repository found for skin %s", skinName.c_str());
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
skinRepo->Install(*config.installerSkinPath, config.vdrThemesPath);
|
|
||||||
while (!skinRepo->InstallationFinished()) {
|
|
||||||
cCondWait::SleepMs(50);
|
|
||||||
}
|
|
||||||
bool ok = skinRepo->SuccessfullyInstalled();
|
|
||||||
if (ok) {
|
|
||||||
config.AddNewSkinRef(skinName);
|
|
||||||
}
|
|
||||||
return ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
string cSkindesignerSkinPreview::CheckFontInstalled(string fontName) {
|
string cSkindesignerSkinPreview::CheckFontInstalled(string fontName) {
|
||||||
if (fontManager->FontInstalled(fontName))
|
if (fontManager->FontInstalled(fontName))
|
||||||
return "1";
|
return "1";
|
||||||
|
38
setup.h
38
setup.h
@ -10,9 +10,33 @@ enum eItemType {
|
|||||||
itSkinRepo
|
itSkinRepo
|
||||||
};
|
};
|
||||||
|
|
||||||
// --- cSkinDesignerSetup -----------------------------------------------------------
|
// --- cInstallManager -----------------------------------------------------------
|
||||||
|
class cInstallManager {
|
||||||
|
private:
|
||||||
|
uint64_t installationStart;
|
||||||
|
int lastInstallDuration;
|
||||||
|
int timeout;
|
||||||
|
bool installing;
|
||||||
|
bool updating;
|
||||||
|
cSkinRepo *runningInst;
|
||||||
|
protected:
|
||||||
|
string currentSkin;
|
||||||
|
bool StartInstallation(string skin);
|
||||||
|
bool StartUpdate(string skin);
|
||||||
|
bool Installing(void) { return installing; };
|
||||||
|
bool Updating(void) { return updating; };
|
||||||
|
bool Finished(void);
|
||||||
|
bool SuccessfullyInstalled(void);
|
||||||
|
bool SuccessfullyUpdated(void);
|
||||||
|
int Duration(void);
|
||||||
|
eOSState ProcessInstallationStatus(void);
|
||||||
|
public:
|
||||||
|
cInstallManager(void);
|
||||||
|
virtual ~cInstallManager(void);
|
||||||
|
};
|
||||||
|
|
||||||
class cSkinDesignerSetup : public cMenuSetupPage {
|
// --- cSkinDesignerSetup -----------------------------------------------------------
|
||||||
|
class cSkinDesignerSetup : public cMenuSetupPage, cInstallManager {
|
||||||
private:
|
private:
|
||||||
int numLogosPerSizeInitial;
|
int numLogosPerSizeInitial;
|
||||||
int limitLogoCache;
|
int limitLogoCache;
|
||||||
@ -24,7 +48,6 @@ private:
|
|||||||
int blockFlush;
|
int blockFlush;
|
||||||
int framesPerSecond;
|
int framesPerSecond;
|
||||||
const char *menuDisplayStyle[2];
|
const char *menuDisplayStyle[2];
|
||||||
|
|
||||||
void Setup(void);
|
void Setup(void);
|
||||||
virtual void Store(void);
|
virtual void Store(void);
|
||||||
virtual eOSState ProcessKey(eKeys Key);
|
virtual eOSState ProcessKey(eKeys Key);
|
||||||
@ -35,7 +58,7 @@ private:
|
|||||||
void InstallSkins(void);
|
void InstallSkins(void);
|
||||||
public:
|
public:
|
||||||
cSkinDesignerSetup(void);
|
cSkinDesignerSetup(void);
|
||||||
virtual ~cSkinDesignerSetup();
|
virtual ~cSkinDesignerSetup(void);
|
||||||
};
|
};
|
||||||
|
|
||||||
// --- cSkinMenuItem -----------------------------------------------------------
|
// --- cSkinMenuItem -----------------------------------------------------------
|
||||||
@ -64,7 +87,7 @@ public:
|
|||||||
|
|
||||||
// --- cSkindesignerSkinSetup -----------------------------------------------------------
|
// --- cSkindesignerSkinSetup -----------------------------------------------------------
|
||||||
|
|
||||||
class cSkindesignerSkinSetup : public cOsdMenu {
|
class cSkindesignerSkinSetup : public cOsdMenu, cInstallManager {
|
||||||
private:
|
private:
|
||||||
string skin;
|
string skin;
|
||||||
string name;
|
string name;
|
||||||
@ -78,13 +101,10 @@ public:
|
|||||||
|
|
||||||
// --- cSkindesignerSkinPreview -----------------------------------------------------------
|
// --- cSkindesignerSkinPreview -----------------------------------------------------------
|
||||||
|
|
||||||
class cSkindesignerSkinPreview : public skindesignerapi::cSkindesignerOsdMenu {
|
class cSkindesignerSkinPreview : public skindesignerapi::cSkindesignerOsdMenu, cInstallManager {
|
||||||
private:
|
|
||||||
string skinName;
|
|
||||||
protected:
|
protected:
|
||||||
virtual eOSState ProcessKey(eKeys Key);
|
virtual eOSState ProcessKey(eKeys Key);
|
||||||
void Set(void);
|
void Set(void);
|
||||||
bool InstallSkin(void);
|
|
||||||
string CheckFontInstalled(string fontName);
|
string CheckFontInstalled(string fontName);
|
||||||
public:
|
public:
|
||||||
cSkindesignerSkinPreview(string skin);
|
cSkindesignerSkinPreview(string skin);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user