directories for timers and searchtimers can be edited

This commit is contained in:
louis 2014-01-26 09:42:27 +01:00
parent 2a3eecd99e
commit ba90eeecb9
13 changed files with 281 additions and 18 deletions

View File

@ -112,3 +112,6 @@ Version 1.1.0
- Improved favorites menu with whats on now / next and up to four user
defined times
- also check default paths when images and icons are loaded
- directory for timers can be edited in timer edit menu
- series recording can be configured in searchtimer menus
- directory for searchtimers can be set and edited in searchtimer menus

View File

@ -3,7 +3,7 @@ msgid ""
msgstr ""
"Project-Id-Version: vdr-tvguide 0.0.1\n"
"Report-Msgid-Bugs-To: <see README>\n"
"POT-Creation-Date: 2014-01-19 12:51+0100\n"
"POT-Creation-Date: 2014-01-26 09:25+0100\n"
"PO-Revision-Date: 2013-09-21 17:49+0200\n"
"Last-Translator: My friend <Sampep> Thanks David <Gabychan> <gbonich@gmail.com>\n"
"Language-Team: \n"
@ -54,6 +54,9 @@ msgstr ""
msgid "images"
msgstr ""
msgid "root video folder"
msgstr "Directori principal per a vídeo"
msgid "Transp."
msgstr "Transp."
@ -141,9 +144,6 @@ msgstr "Cerca a les gravacions"
msgid "Set Folder for"
msgstr "Programa carpeta per"
msgid "root video folder"
msgstr "Directori principal per a vídeo"
msgid "Timer created"
msgstr "Temporitzador creat"
@ -234,6 +234,9 @@ msgstr "Inici temporitzador"
msgid "Timer stop time"
msgstr "Final temporitzador"
msgid "Folder"
msgstr ""
msgid "Save"
msgstr "Desa"
@ -333,6 +336,9 @@ msgstr ""
msgid "Time margin for stop in minutes"
msgstr ""
msgid "Series Recording"
msgstr ""
msgid "Use VPS"
msgstr ""

View File

@ -3,7 +3,7 @@ msgid ""
msgstr ""
"Project-Id-Version: vdr-tvguide 0.0.1\n"
"Report-Msgid-Bugs-To: <see README>\n"
"POT-Creation-Date: 2014-01-19 12:51+0100\n"
"POT-Creation-Date: 2014-01-26 09:25+0100\n"
"PO-Revision-Date: 2012-08-25 17:49+0200\n"
"Last-Translator: Horst\n"
"Language-Team: \n"
@ -51,6 +51,9 @@ msgstr "Favoriten"
msgid "images"
msgstr "Bilder"
msgid "root video folder"
msgstr "Video Hauptverzeichnis"
msgid "Transp."
msgstr "Transp."
@ -138,9 +141,6 @@ msgstr "In Aufnahmen suchen"
msgid "Set Folder for"
msgstr "Verzeichnis festlegen für"
msgid "root video folder"
msgstr "Video Hauptverzeichnis"
msgid "Timer created"
msgstr "Timer angelegt"
@ -231,6 +231,9 @@ msgstr "Timer Start Zeit"
msgid "Timer stop time"
msgstr "Timer Stop Zeit"
msgid "Folder"
msgstr "Verzeichnis"
msgid "Save"
msgstr "Speichern"
@ -330,6 +333,9 @@ msgstr "Zeit vor Start in Minuten"
msgid "Time margin for stop in minutes"
msgstr "Zeit nach Ende in Minuten"
msgid "Series Recording"
msgstr "Serienaufnahme"
msgid "Use VPS"
msgstr "VPS benutzen"

View File

@ -3,7 +3,7 @@ msgid ""
msgstr ""
"Project-Id-Version: vdr-tvguide 1.0.0\n"
"Report-Msgid-Bugs-To: <see README>\n"
"POT-Creation-Date: 2014-01-19 12:51+0100\n"
"POT-Creation-Date: 2014-01-26 09:25+0100\n"
"PO-Revision-Date: 2013-09-25 17:49+0400\n"
"Last-Translator: AmiD, ilya\n"
"Language-Team: Russia-Cherepovets(wm.amid@gmail.com)\n"
@ -51,6 +51,9 @@ msgstr ""
msgid "images"
msgstr ""
msgid "root video folder"
msgstr "Главная видео директория"
msgid "Transp."
msgstr "Трансп."
@ -138,9 +141,6 @@ msgstr "Искать в записях"
msgid "Set Folder for"
msgstr "Укажите каталог для"
msgid "root video folder"
msgstr "Главная видео директория"
msgid "Timer created"
msgstr "Таймер создан"
@ -231,6 +231,9 @@ msgstr "Время c"
msgid "Timer stop time"
msgstr "Время до"
msgid "Folder"
msgstr ""
msgid "Save"
msgstr "Сохранить"
@ -330,6 +333,9 @@ msgstr ""
msgid "Time margin for stop in minutes"
msgstr ""
msgid "Series Recording"
msgstr ""
msgid "Use VPS"
msgstr ""

View File

@ -3,7 +3,7 @@ msgid ""
msgstr ""
"Project-Id-Version: vdr-tvguide 1.1.0\n"
"Report-Msgid-Bugs-To: <see README>\n"
"POT-Creation-Date: 2014-01-19 12:51+0100\n"
"POT-Creation-Date: 2014-01-26 09:25+0100\n"
"PO-Revision-Date: 2013-09-15 00:12+0100\n"
"Last-Translator: Milan Hrala <hrala.milan@gmail.com>\n"
"Language-Team: \n"
@ -51,6 +51,9 @@ msgstr ""
msgid "images"
msgstr ""
msgid "root video folder"
msgstr "Hlavný video adresár"
msgid "Transp."
msgstr "Transp."
@ -138,9 +141,6 @@ msgstr "Vyh
msgid "Set Folder for"
msgstr "Nastavi» adresár pre"
msgid "root video folder"
msgstr "Hlavný video adresár"
msgid "Timer created"
msgstr "Plán vytvorený"
@ -231,6 +231,9 @@ msgstr "Pl
msgid "Timer stop time"
msgstr "Plán konèí"
msgid "Folder"
msgstr ""
msgid "Save"
msgstr "Ulo¾i»"
@ -330,6 +333,9 @@ msgstr ""
msgid "Time margin for stop in minutes"
msgstr ""
msgid "Series Recording"
msgstr ""
msgid "Use VPS"
msgstr ""

View File

@ -187,12 +187,14 @@ void cRecManager::SaveTimer(cTimer *timer, cTimer newTimerSettings) {
time_t day = newTimerSettings.Day();
int start = newTimerSettings.Start();
int stop = newTimerSettings.Stop();
std::string fileName = newTimerSettings.File();
timer->SetDay(day);
timer->SetStart(start);
timer->SetStop(stop);
timer->SetPriority(prio);
timer->SetLifetime(lifetime);
timer->SetFile(fileName.c_str());
if (timer->HasFlags(tfActive) && !active)
timer->ClrFlags(tfActive);

View File

@ -588,6 +588,163 @@ eRecMenuState cRecMenuItemSelect::ProcessKey(eKeys Key) {
return rmsNotConsumed;
}
// --- cRecMenuItemSelectDirectory -------------------------------------------------------
cRecMenuItemSelectDirectory::cRecMenuItemSelectDirectory(cString text,
std::string originalFolder,
bool active,
char *callback,
eRecMenuState action) {
selectable = true;
this->text = text;
this->originalFolder = originalFolder;
seriesFolder = "";
this->active = active;
this->callback = callback;
this->action = action;
height = 3 * font->Height() / 2;
pixmapVal = NULL;
folders.push_back(tr("root video folder"));
ReadFolders(NULL, "");
numValues = folders.size();
this->currentVal = GetInitial();
}
cRecMenuItemSelectDirectory::~cRecMenuItemSelectDirectory(void) {
if (pixmapVal)
osdManager.releasePixmap(pixmapVal);
}
void cRecMenuItemSelectDirectory::SetPixmaps(void) {
if (!pixmap) {
pixmap = osdManager.requestPixmap(4, cRect(x, y, width, height));
pixmapVal = osdManager.requestPixmap(5, cRect(x, y, width, height));
} else {
pixmap->SetViewPort(cRect(x, y, width, height));
pixmapVal->SetViewPort(cRect(x, y, width, height));
}
}
void cRecMenuItemSelectDirectory::Hide(void) {
if (pixmap) pixmap->SetLayer(-1);
if (pixmapVal) pixmapVal->SetLayer(-1);
}
void cRecMenuItemSelectDirectory::Show(void) {
if (pixmap) pixmap->SetLayer(4);
if (pixmapVal) pixmapVal->SetLayer(5);
}
void cRecMenuItemSelectDirectory::Draw(void) {
int textY = (height - font->Height()) / 2;
pixmap->DrawText(cPoint(10, textY), *text, colorText, colorTextBack, font);
DrawValue();
}
void cRecMenuItemSelectDirectory::DrawValue(void) {
pixmapVal->Fill(clrTransparent);
int iconSize = min(128, height);
int textX = width - font->Width(folders[currentVal].c_str()) - iconSize;
int textY = (height - font->Height()) / 2;
pixmapVal->DrawText(cPoint(textX, textY), folders[currentVal].c_str(), colorText, clrTransparent, font);
int iconLeftX = textX - iconSize;
int iconRightX = width - iconSize;
int iconY = (height - iconSize) / 2;
cImage *imgLeft = imgCache.GetIcon("arrow_left", iconSize, iconSize);
if (imgLeft) {
pixmapVal->DrawImage(cPoint(iconLeftX, iconY), *imgLeft);
}
cImage *imgRight = imgCache.GetIcon("arrow_right", iconSize, iconSize);
if (imgRight) {
pixmapVal->DrawImage(cPoint(iconRightX, iconY), *imgRight);
}
}
eRecMenuState cRecMenuItemSelectDirectory::ProcessKey(eKeys Key) {
int oldValue = currentVal;
switch (Key & ~k_Repeat) {
case kLeft:
currentVal--;
if (currentVal<0)
currentVal = numValues - 1;
if (callback) {
SetCallback();
}
DrawValue();
return rmsConsumed;
break;
case kRight: {
currentVal = (currentVal+1)%numValues;
if (callback) {
SetCallback();
}
DrawValue();
return rmsConsumed;
break; }
case kOk:
return action;
default:
break;
}
return rmsNotConsumed;
}
void cRecMenuItemSelectDirectory::SetCallback(void) {
std::string newFolder = folders[currentVal];
if (!newFolder.compare(tr("root video folder")))
newFolder = "";
if (seriesFolder.size() > 0) {
if (newFolder.size() > 0)
newFolder = *cString::sprintf("%s/%s", folders[currentVal].c_str(), seriesFolder.c_str());
else
newFolder = seriesFolder;
}
strncpy(callback, newFolder.c_str(), TEXTINPUTLENGTH);
}
void cRecMenuItemSelectDirectory::ReadFolders(cList<cNestedItem> *rootFolders, cString path) {
cList<cNestedItem> *foldersLevel = NULL;
if (rootFolders) {
foldersLevel = rootFolders;
} else {
foldersLevel = &Folders;
}
for (cNestedItem *folder = foldersLevel->First(); folder; folder = foldersLevel->Next(folder)) {
cString strFolder = cString::sprintf("%s%s", *path, folder->Text());
folders.push_back(*strFolder);
cList<cNestedItem> *subItems = folder->SubItems();
if (subItems) {
cString newPath = cString::sprintf("%s%s/", *path, folder->Text());
ReadFolders(subItems, newPath);
}
}
}
int cRecMenuItemSelectDirectory::GetInitial(void) {
if (originalFolder.size() == 0)
return 0;
for (int i=0; i < numValues; i++) {
if (!folders[i].compare(originalFolder)) {
return i;
}
}
size_t found = originalFolder.find_last_of('/');
if (found != std::string::npos) {
std::string folderSet = originalFolder.substr(0, found);
seriesFolder = originalFolder.substr(found + 1);
for (int i=0; i < numValues; i++) {
if (!folders[i].compare(folderSet)) {
return i;
}
}
} else {
seriesFolder = originalFolder;
}
return 0;
}
// --- cRecMenuItemText -------------------------------------------------------
cRecMenuItemText::cRecMenuItemText(cString title,
char *initialVal,

View File

@ -267,6 +267,35 @@ public:
cString GetStringValue(void) { return strings[currentVal].c_str(); };
};
// --- cRecMenuItemSelectDirectory -------------------------------------------------------
class cRecMenuItemSelectDirectory : public cRecMenuItem {
private:
cString text;
std::string originalFolder;
std::string seriesFolder;
std::vector<std::string> folders;
int currentVal;
char *callback;
int numValues;
cPixmap *pixmapVal;
void DrawValue(void);
void ReadFolders(cList<cNestedItem> *rootFolders, cString path);
int GetInitial(void);
void SetCallback(void);
public:
cRecMenuItemSelectDirectory(cString text,
std::string originalFolder,
bool active = false,
char *callback = NULL,
eRecMenuState action = rmsNotConsumed);
virtual ~cRecMenuItemSelectDirectory(void);
void SetPixmaps(void);
void Hide(void);
void Show(void);
eRecMenuState ProcessKey(eKeys Key);
void Draw(void);
};
// --- cRecMenuItemText -------------------------------------------------------
class cRecMenuItemText : public cRecMenuItem {
private:

View File

@ -1,4 +1,5 @@
#include "services/remotetimers.h"
#include "tools.h"
#include "recmenumanager.h"
#include "recmenus.h"
@ -396,7 +397,7 @@ cRecMenuConfirmRerunUsed::cRecMenuConfirmRerunUsed(const cEvent *original, const
// --- cRecMenuEditTimer ---------------------------------------------------------
cRecMenuEditTimer::cRecMenuEditTimer(cTimer *timer, eRecMenuState nextState) {
SetWidthPercent(60);
SetWidthPercent(70);
if (!timer)
return;
originalTimer = timer;
@ -428,6 +429,7 @@ cRecMenuEditTimer::cRecMenuEditTimer(cTimer *timer, eRecMenuState nextState) {
stop = timer->Stop();
prio = timer->Priority();
lifetime = timer->Lifetime();
strncpy(folder, GetDirectoryFromTimer(timer->File()).c_str(), TEXTINPUTLENGTH);
AddMenuItem(new cRecMenuItemBool(tr("Timer Active"), timerActive, false, true, &timerActive));
AddMenuItem(new cRecMenuItemInt(tr("Priority"), prio, 0, MAXPRIORITY, false, &prio));
@ -435,6 +437,7 @@ cRecMenuEditTimer::cRecMenuEditTimer(cTimer *timer, eRecMenuState nextState) {
AddMenuItem(new cRecMenuItemDay(tr("Day"), day, false, &day));
AddMenuItem(new cRecMenuItemTime(tr("Timer start time"), start, false, &start));
AddMenuItem(new cRecMenuItemTime(tr("Timer stop time"), stop, false, &stop));
AddMenuItem(new cRecMenuItemSelectDirectory(tr("Folder"), std::string(folder), false, folder));
if (nextState == rmsTimelineTimerSave) {
AddMenuItem(new cRecMenuItemButton(tr("Delete Timer"), rmsTimelineTimerDelete, false, false));
AddMenuItem(new cRecMenuItemButtonYesNo(tr("Save"), tr("Cancel"), nextState, rmsTimeline, false));
@ -461,6 +464,19 @@ cTimer cRecMenuEditTimer::GetTimer(void) {
t.SetStop(stop);
t.SetPriority(prio);
t.SetLifetime(lifetime);
std::string newFolder(folder);
std::string newFile = originalTimer->File();
if (newFolder.size() > 0) {
size_t found = newFile.find_last_of('~');
if (found != std::string::npos) {
std::string fileName = newFile.substr(found+1);
newFile = *cString::sprintf("%s/%s", newFolder.c_str(), fileName.c_str());
} else {
newFile = *cString::sprintf("%s/%s", newFolder.c_str(), newFile.c_str());
}
}
std::replace(newFile.begin(), newFile.end(), '/', '~');
t.SetFile(newFile.c_str());
return t;
}
@ -693,6 +709,10 @@ cRecMenuSearchTimerEdit::cRecMenuSearchTimerEdit(cTVGuideSearchTimer searchTimer
dayOfWeek = searchTimer.DayOfWeek();
priority = searchTimer.Priority();
lifetime = searchTimer.Lifetime();
useEpisode = searchTimer.UseEpisode();
std::string dir = searchTimer.Directory();
std::replace(dir.begin(), dir.end(), '~', '/');
strncpy(directory, dir.c_str(), TEXTINPUTLENGTH);
marginStart = searchTimer.MarginStart();
marginStop = searchTimer.MarginStop();
useVPS = searchTimer.UseVPS();
@ -768,6 +788,8 @@ void cRecMenuSearchTimerEdit::InitMenuItems(void) {
mainMenuItems.push_back(new cRecMenuItemInt(tr("Lifetime"), lifetime, 0, 99, false, &lifetime, rmsSearchTimerSave));
mainMenuItems.push_back(new cRecMenuItemInt(tr("Time margin for start in minutes"), marginStart, 0, 30, false, &marginStart, rmsSearchTimerSave));
mainMenuItems.push_back(new cRecMenuItemInt(tr("Time margin for stop in minutes"), marginStop, 0, 30, false, &marginStop, rmsSearchTimerSave));
mainMenuItems.push_back(new cRecMenuItemBool(tr("Series Recording"), useEpisode, false, false, &useEpisode, rmsSearchTimerSave));
mainMenuItems.push_back(new cRecMenuItemSelectDirectory(tr("Folder"), std::string(directory), false, directory, rmsSearchTimerSave));
mainMenuItems.push_back(new cRecMenuItemBool(tr("Use VPS"), useVPS, false, false, &useVPS, rmsSearchTimerSave));
mainMenuItems.push_back(new cRecMenuItemBool(tr("Avoid Repeats"), avoidRepeats, true, false, &avoidRepeats, rmsSearchTimerSave));
mainMenuItems.push_back(new cRecMenuItemBool(tr("Use in Favorites"), useInFavorites, false, false, &useInFavorites, rmsSearchTimerSave));
@ -863,6 +885,10 @@ cTVGuideSearchTimer cRecMenuSearchTimerEdit::GetSearchTimer(void) {
}
searchTimer.SetPriority(priority);
searchTimer.SetLifetime(lifetime);
searchTimer.SetUseEpisode(useEpisode);
std::string dir(directory);
std::replace(dir.begin(), dir.end(), '/', '~');
searchTimer.SetDirectory(dir);
searchTimer.SetMarginStart(marginStart);
searchTimer.SetMarginStop(marginStop);
searchTimer.SetUseVPS(useVPS);

View File

@ -123,6 +123,7 @@ private:
int stop;
int prio;
int lifetime;
char folder[TEXTINPUTLENGTH];
public:
cRecMenuEditTimer(cTimer *timer, eRecMenuState nextState);
virtual ~cRecMenuEditTimer(void) {};
@ -236,6 +237,8 @@ private:
int dayOfWeek;
int priority;
int lifetime;
bool useEpisode;
char directory[TEXTINPUTLENGTH];
int marginStart;
int marginStop;
bool useVPS;

View File

@ -85,6 +85,7 @@ public:
bool UseDayOfWeek(void) { return useDayOfWeek; };
int DayOfWeek(void);
int UseEpisode(void) { return useEpisode; };
std::string Directory(void) { return directory; };
int Priority(void) { return priority; };
int Lifetime(void) { return lifetime; };
int MarginStart(void) { return marginStart; };
@ -111,6 +112,8 @@ public:
void SetStopTime(int stopTime) { this->stopTime = stopTime; };
void SetUseDayOfWeek(bool useDayOfWeek) { this->useDayOfWeek = useDayOfWeek; };
void SetDayOfWeek(int VDRDayOfWeek);
void SetUseEpisode(int useEpisode) { this->useEpisode = useEpisode; };
void SetDirectory(std::string directory) { this-> directory = directory; };
void SetPriority(int priority) { this->priority = priority; };
void SetLifetime(int lifetime) { this->lifetime = lifetime; };
void SetMarginStart(int marginStart) { this->marginStart = marginStart; };

15
tools.c
View File

@ -1,6 +1,7 @@
#include <string>
#include <vector>
#include <sstream>
#include <algorithm>
#include <ctype.h>
#include <string.h>
#include <stdlib.h>
@ -52,6 +53,20 @@ std::string StrToLowerCase(std::string str) {
return lowerCase;
}
/****************************************************************************************
* GetDirectoryFromTimer
****************************************************************************************/
std::string GetDirectoryFromTimer(std::string file) {
std::string dir = "";
size_t found = file.find_last_of('~');
if (found != std::string::npos) {
dir = file.substr(0, found);
std::replace(dir.begin(), dir.end(), '~', '/');
}
return dir;
}
/****************************************************************************************
* DrawRoundedCorners
****************************************************************************************/

View File

@ -8,6 +8,7 @@
std::string CutText(std::string text, int width, const cFont *font);
std::string StrToLowerCase(std::string str);
std::string GetDirectoryFromTimer(std::string file);
void DrawRoundedCorners(cPixmap *p, int posX, int posY, int width, int height, int radius, int borderWidth, tColor borderColor);
class splitstring : public std::string {