summaryrefslogtreecommitdiff
path: root/setup.c
diff options
context:
space:
mode:
authorlouis <louis.braun@gmx.de>2015-06-04 16:29:25 +0200
committerlouis <louis.braun@gmx.de>2015-06-04 16:29:25 +0200
commit872320b921bbfd735e980b3960ccc0a74f69fcf6 (patch)
treea399e9ab52ece50bc32455dd57e4ce97a2c824d9 /setup.c
parentecf8c75323281816ddc282437dcaa8a216e70ae4 (diff)
downloadvdr-plugin-skindesigner-872320b921bbfd735e980b3960ccc0a74f69fcf6.tar.gz
vdr-plugin-skindesigner-872320b921bbfd735e980b3960ccc0a74f69fcf6.tar.bz2
implemented possibility to delete skins
Diffstat (limited to 'setup.c')
-rw-r--r--setup.c48
1 files changed, 41 insertions, 7 deletions
diff --git a/setup.c b/setup.c
index bd53a06..f14b378 100644
--- a/setup.c
+++ b/setup.c
@@ -1,3 +1,4 @@
+#include <vdr/interface.h>
#include "libcore/curlfuncs.h"
#include "setup.h"
@@ -115,7 +116,6 @@ eOSState cInstallManager::ProcessInstallationStatus(void) {
return osContinue;
}
-
// --- cSkinDesignerSetup -----------------------------------------------------------
cSkinDesignerSetup::cSkinDesignerSetup() {
numLogosPerSizeInitial = config.numLogosPerSizeInitial;
@@ -161,7 +161,7 @@ eOSState cSkinDesignerSetup::ProcessKey(eKeys Key) {
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 || Key == kYellow)) {
SetHelp(NULL, NULL, NULL, NULL);
cOsdItem *current = Get(Current());
cSkinMenuItem *skinMenuItem = dynamic_cast<cSkinMenuItem*>(current);
@@ -188,8 +188,11 @@ eOSState cSkinDesignerSetup::ProcessKey(eKeys Key) {
SetHelp(tr("Install Skin"), NULL, NULL, NULL);
} else if (type == itSkinSetup || type == itNoSkinSetup) {
cSkinRepo *repo = config.GetSkinRepo(currentSkin);
- if (repo && repo->Type() == rtGit) {
- SetHelp(tr("Update from Git"), NULL, NULL, NULL);
+ if (repo) {
+ if (repo->Type() == rtGit)
+ SetHelp(tr("Update from Git"), NULL, tr("Delete Skin"), NULL);
+ else
+ SetHelp(NULL, NULL, tr("Delete Skin"), NULL);
}
}
}
@@ -207,6 +210,20 @@ eOSState cSkinDesignerSetup::ProcessKey(eKeys Key) {
}
}
}
+ // KEY YELLOW
+ if (Key == kYellow) {
+ if (type == itSkinSetup || type == itNoSkinSetup) {
+ if (config.SkinActive(currentSkin)) {
+ Skins.Message(mtError, tr("Skin is running and can't be deleted"));
+ } else if (Interface->Confirm(*cString::sprintf("%s?", tr("Really delete skin")))) {
+ config.DeleteSkin(currentSkin);
+ Skins.Message(mtStatus, tr("Skin deleted"));
+ cCondWait::SleepMs(1000);
+ return osEnd;
+ }
+ state = osContinue;
+ }
+ }
}
return state;
}
@@ -366,7 +383,7 @@ eOSState cSkindesignerSkinSetup::ProcessKey(eKeys Key) {
break;
} else {
return osBack;
- }
+ }
}
case kRed: {
bool gitAvailable = StartUpdate(skin);
@@ -375,6 +392,20 @@ eOSState cSkindesignerSkinSetup::ProcessKey(eKeys Key) {
} else {
Skins.Message(mtStatus, tr("No Git Repsoitory available"));
}
+ break;
+ }
+ // KEY YELLOW
+ case kYellow: {
+ if (config.SkinActive(skin)) {
+ Skins.Message(mtError, tr("Skin is running and can't be deleted"));
+ } else if (Interface->Confirm(*cString::sprintf("%s?", tr("Really delete skin")))) {
+ config.DeleteSkin(skin);
+ Skins.Message(mtStatus, tr("Skin deleted"));
+ cCondWait::SleepMs(1000);
+ return osEnd;
+ }
+ state = osContinue;
+ break;
}
default:
break;
@@ -390,8 +421,11 @@ void cSkindesignerSkinSetup::Set(void) {
}
cSkinRepo *repo = config.GetSkinRepo(skin);
- if (repo && repo->Type() == rtGit) {
- SetHelp(tr("Update from Git"), NULL, NULL, NULL);
+ if (repo) {
+ if (repo->Type() == rtGit)
+ SetHelp(tr("Update from Git"), NULL, tr("Delete Skin"), NULL);
+ else
+ SetHelp(NULL, NULL, tr("Delete Skin"), NULL);
}
menu->InitParameterIterator();