mirror of
https://github.com/VDR4Arch/vdr.git
synced 2023-10-10 13:36:52 +02:00
Now staying in the source folder when moving a recording or a folder to a different folder
This commit is contained in:
parent
7455fbd2ad
commit
c3af5a69da
@ -3289,6 +3289,8 @@ Matthias Senzel <matthias.senzel@t-online.de>
|
|||||||
for fixing a lengthy write lock on the Recordings list in case of moving a folder with
|
for fixing a lengthy write lock on the Recordings list in case of moving a folder with
|
||||||
more than one recording
|
more than one recording
|
||||||
for implementing the parameter "OSD/Sorting direction for recordings"
|
for implementing the parameter "OSD/Sorting direction for recordings"
|
||||||
|
for suggesting to stay in the original folder when moving a recording to a different
|
||||||
|
folder
|
||||||
|
|
||||||
Marek Nazarko <mnazarko@gmail.com>
|
Marek Nazarko <mnazarko@gmail.com>
|
||||||
for translating OSD texts to the Polish language
|
for translating OSD texts to the Polish language
|
||||||
|
6
HISTORY
6
HISTORY
@ -9162,7 +9162,7 @@ Video Disk Recorder Revision History
|
|||||||
a subdirectory.
|
a subdirectory.
|
||||||
- SVDRP peering can now be limited to the default SVDRP host (see MANUAL for details).
|
- SVDRP peering can now be limited to the default SVDRP host (see MANUAL for details).
|
||||||
|
|
||||||
2017-12-11: Version 2.3.9
|
2017-12-14: Version 2.3.9
|
||||||
|
|
||||||
- Updated the Italian OSD texts (thanks to Diego Pierotto).
|
- Updated the Italian OSD texts (thanks to Diego Pierotto).
|
||||||
- Updated the Finnish OSD texts (thanks to Rolf Ahrenberg).
|
- Updated the Finnish OSD texts (thanks to Rolf Ahrenberg).
|
||||||
@ -9230,3 +9230,7 @@ Video Disk Recorder Revision History
|
|||||||
that have not yet been moved completely as non-selectable. This avoids situations
|
that have not yet been moved completely as non-selectable. This avoids situations
|
||||||
where trying to play such a recording might fail.
|
where trying to play such a recording might fail.
|
||||||
- Fixed canceling moving a folder with several recordings between volumes.
|
- Fixed canceling moving a folder with several recordings between volumes.
|
||||||
|
- When moving a recording to a different folder, the cursor is no longer placed on the
|
||||||
|
new location of the recording, but rather stays in the original folder (suggested by
|
||||||
|
Matthias Senzel). If the original folder got empty by moving away the last recording
|
||||||
|
it contained, the cursor is moved up until a non empty folder is found.
|
||||||
|
79
menu.c
79
menu.c
@ -4,7 +4,7 @@
|
|||||||
* See the main source file 'vdr.c' for copyright information and
|
* See the main source file 'vdr.c' for copyright information and
|
||||||
* how to reach the author.
|
* how to reach the author.
|
||||||
*
|
*
|
||||||
* $Id: menu.c 4.51 2017/12/10 12:50:23 kls Exp $
|
* $Id: menu.c 4.52 2017/12/14 10:32:41 kls Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "menu.h"
|
#include "menu.h"
|
||||||
@ -2407,9 +2407,15 @@ bool CamMenuActive(void)
|
|||||||
|
|
||||||
// --- cMenuPathEdit ---------------------------------------------------------
|
// --- cMenuPathEdit ---------------------------------------------------------
|
||||||
|
|
||||||
|
#define osUserRecRenamed osUser1
|
||||||
|
#define osUserRecMoved osUser2
|
||||||
|
#define osUserRecRemoved osUser3
|
||||||
|
#define osUserRecEmpty osUser4
|
||||||
|
|
||||||
class cMenuPathEdit : public cOsdMenu {
|
class cMenuPathEdit : public cOsdMenu {
|
||||||
private:
|
private:
|
||||||
cString path;
|
cString path;
|
||||||
|
cString oldFolder;
|
||||||
char folder[PATH_MAX];
|
char folder[PATH_MAX];
|
||||||
char name[NAME_MAX];
|
char name[NAME_MAX];
|
||||||
cMenuEditStrItem *folderItem;
|
cMenuEditStrItem *folderItem;
|
||||||
@ -2441,6 +2447,7 @@ cMenuPathEdit::cMenuPathEdit(const char *Path)
|
|||||||
LOCK_RECORDINGS_READ;
|
LOCK_RECORDINGS_READ;
|
||||||
pathIsInUse = Recordings->PathIsInUse(path);
|
pathIsInUse = Recordings->PathIsInUse(path);
|
||||||
}
|
}
|
||||||
|
oldFolder = folder;
|
||||||
cOsdItem *p;
|
cOsdItem *p;
|
||||||
Add(p = folderItem = new cMenuEditStrItem(tr("Folder"), folder, sizeof(folder)));
|
Add(p = folderItem = new cMenuEditStrItem(tr("Folder"), folder, sizeof(folder)));
|
||||||
p->SetSelectable(!pathIsInUse);
|
p->SetSelectable(!pathIsInUse);
|
||||||
@ -2492,9 +2499,10 @@ eOSState cMenuPathEdit::ApplyChanges(void)
|
|||||||
Skins.Message(mtError, tr("Error while moving folder!"));
|
Skins.Message(mtError, tr("Error while moving folder!"));
|
||||||
return osContinue;
|
return osContinue;
|
||||||
}
|
}
|
||||||
cMenuRecordings::SetPath(NewPath); // makes sure the Recordings menu will reposition to the new path
|
|
||||||
Recordings->SetModified();
|
Recordings->SetModified();
|
||||||
return osUser1;
|
if (strcmp(folder, oldFolder))
|
||||||
|
return osUserRecMoved;
|
||||||
|
return osUserRecRenamed;
|
||||||
}
|
}
|
||||||
return osBack;
|
return osBack;
|
||||||
}
|
}
|
||||||
@ -2713,6 +2721,7 @@ eOSState cMenuRecordingEdit::ApplyChanges(void)
|
|||||||
*name = ' '; // name must not be empty!
|
*name = ' '; // name must not be empty!
|
||||||
name[1] = 0;
|
name[1] = 0;
|
||||||
}
|
}
|
||||||
|
cString OldFolder = Recording->Folder();
|
||||||
cString NewName = *folder ? cString::sprintf("%s%c%s", folder, FOLDERDELIMCHAR, name) : name;
|
cString NewName = *folder ? cString::sprintf("%s%c%s", folder, FOLDERDELIMCHAR, name) : name;
|
||||||
NewName.CompactChars(FOLDERDELIMCHAR);
|
NewName.CompactChars(FOLDERDELIMCHAR);
|
||||||
if (strcmp(NewName, Recording->Name())) {
|
if (strcmp(NewName, Recording->Name())) {
|
||||||
@ -2724,10 +2733,12 @@ eOSState cMenuRecordingEdit::ApplyChanges(void)
|
|||||||
Modified = true;
|
Modified = true;
|
||||||
}
|
}
|
||||||
if (Modified) {
|
if (Modified) {
|
||||||
cMenuRecordings::SetRecording(Recording->FileName()); // makes sure the Recordings menu will reposition to the renamed recording
|
eOSState state = osUserRecRenamed;
|
||||||
|
if (strcmp(Recording->Folder(), OldFolder))
|
||||||
|
state = osUserRecMoved;
|
||||||
Recordings->TouchUpdate();
|
Recordings->TouchUpdate();
|
||||||
StateKey.Remove(Modified);
|
StateKey.Remove(Modified);
|
||||||
return osUser1;
|
return state;
|
||||||
}
|
}
|
||||||
StateKey.Remove(Modified);
|
StateKey.Remove(Modified);
|
||||||
return osBack;
|
return osBack;
|
||||||
@ -3133,8 +3144,8 @@ eOSState cMenuRecordings::Delete(void)
|
|||||||
recordingsStateKey.Remove();
|
recordingsStateKey.Remove();
|
||||||
Display();
|
Display();
|
||||||
if (!Count())
|
if (!Count())
|
||||||
return osBack;
|
return osUserRecEmpty;
|
||||||
return osUser2;
|
return osUserRecRemoved;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
Skins.Message(mtError, tr("Error while deleting recording!"));
|
Skins.Message(mtError, tr("Error while deleting recording!"));
|
||||||
@ -3186,7 +3197,6 @@ eOSState cMenuRecordings::Sort(void)
|
|||||||
|
|
||||||
eOSState cMenuRecordings::ProcessKey(eKeys Key)
|
eOSState cMenuRecordings::ProcessKey(eKeys Key)
|
||||||
{
|
{
|
||||||
bool HadSubMenu = HasSubMenu();
|
|
||||||
eOSState state = cOsdMenu::ProcessKey(Key);
|
eOSState state = cOsdMenu::ProcessKey(Key);
|
||||||
|
|
||||||
if (state == osUnknown) {
|
if (state == osUnknown) {
|
||||||
@ -3204,37 +3214,46 @@ eOSState cMenuRecordings::ProcessKey(eKeys Key)
|
|||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (state == osUser1) {
|
else if (state == osUserRecRenamed) {
|
||||||
// a recording or path was renamed, so let's refresh the menu
|
// a recording was renamed (within the same folder), so let's refresh the menu
|
||||||
CloseSubMenu(false);
|
CloseSubMenu(false); // this is the cMenuRecordingEdit/cMenuPathEdit
|
||||||
if (base)
|
|
||||||
return state; // closes all recording menus except for the top one
|
|
||||||
Set(); // this is the top level menu, so we refresh it...
|
|
||||||
Open(true); // ...and open any necessary submenus to show the new name
|
|
||||||
if (!HasSubMenu()) {
|
|
||||||
LOCK_RECORDINGS_READ;
|
|
||||||
Display();
|
|
||||||
}
|
|
||||||
path = NULL;
|
path = NULL;
|
||||||
fileName = NULL;
|
fileName = NULL;
|
||||||
|
state = osContinue;
|
||||||
}
|
}
|
||||||
else if (state == osUser2) {
|
else if (state == osUserRecMoved) {
|
||||||
// a recording in a sub folder was deleted, so update the current item
|
// a recording was moved to a different folder, so let's delete the old item
|
||||||
cOsdMenu *m = HasSubMenu() ? SubMenu() : this;
|
CloseSubMenu(false); // this is the cMenuRecordingEdit/cMenuPathEdit
|
||||||
|
path = NULL;
|
||||||
|
fileName = NULL;
|
||||||
|
cOsdMenu::Del(Current());
|
||||||
|
Set(); // the recording might have been moved into a new subfolder of this folder
|
||||||
|
if (!Count())
|
||||||
|
return osUserRecEmpty;
|
||||||
|
Display();
|
||||||
|
state = osUserRecRemoved;
|
||||||
|
}
|
||||||
|
else if (state == osUserRecRemoved) {
|
||||||
|
// a recording was removed from a sub folder, so update the current item
|
||||||
|
if (cOsdMenu *m = SubMenu()) {
|
||||||
if (cMenuRecordingItem *ri = (cMenuRecordingItem *)Get(Current())) {
|
if (cMenuRecordingItem *ri = (cMenuRecordingItem *)Get(Current())) {
|
||||||
if (cMenuRecordingItem *riSub = (cMenuRecordingItem *)m->Get(m->Current()))
|
if (cMenuRecordingItem *riSub = (cMenuRecordingItem *)m->Get(m->Current()))
|
||||||
ri->SetRecording(riSub->Recording());
|
ri->SetRecording(riSub->Recording());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// no state change here, this report goes upstream!
|
||||||
|
}
|
||||||
|
else if (state == osUserRecEmpty) {
|
||||||
|
// a subfolder became empty, so let's go back up
|
||||||
|
CloseSubMenu(false); // this is the now empty submenu
|
||||||
|
cOsdMenu::Del(Current()); // the menu entry of the now empty subfolder
|
||||||
|
Set(); // in case a recording was moved into a new subfolder of this folder
|
||||||
|
if (base && !Count()) // base: don't go up beyond the top level Recordings menu
|
||||||
|
return state;
|
||||||
|
Display();
|
||||||
|
state = osContinue;
|
||||||
|
}
|
||||||
if (!HasSubMenu()) {
|
if (!HasSubMenu()) {
|
||||||
if (HadSubMenu) {
|
|
||||||
if (Key == kYellow) {
|
|
||||||
// the last recording in a subdirectory was deleted, so let's go back up
|
|
||||||
cOsdMenu::Del(Current());
|
|
||||||
if (!Count())
|
|
||||||
return osBack;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Set(true);
|
Set(true);
|
||||||
if (Key != kNone)
|
if (Key != kNone)
|
||||||
SetHelpKeys();
|
SetHelpKeys();
|
||||||
|
Loading…
Reference in New Issue
Block a user