1
0
mirror of https://github.com/VDR4Arch/vdr.git synced 2023-10-10 13:36:52 +02:00

The channel name column in the "What's on now/next" menu now adjusts its width to display the full short name of each channel

This commit is contained in:
Klaus Schmidinger 2012-03-11 13:29:06 +01:00
parent 2be049f5f7
commit c174dc0f5b
5 changed files with 42 additions and 8 deletions

View File

@ -2836,6 +2836,8 @@ Chris Mayo <aklhfex@gmail.com>
Dominic Evans <oldmanuk@gmail.com> Dominic Evans <oldmanuk@gmail.com>
for making the SVDRP command LSTC accepts channel IDs for making the SVDRP command LSTC accepts channel IDs
for adding cap_net_raw to the capabilities that are not dropped for adding cap_net_raw to the capabilities that are not dropped
for suggesting to make the channel name column in the "What's on now/next" menu
adjust its width to display the full short name of each channel
Torsten Lang <info@torstenlang.de> Torsten Lang <info@torstenlang.de>
for reporting a problem with newline characters in stream component descriptions for reporting a problem with newline characters in stream component descriptions

View File

@ -7016,3 +7016,5 @@ Video Disk Recorder Revision History
- Changed the Green button in the "Edit timer" menu from "Once" to "Single" - Changed the Green button in the "Edit timer" menu from "Once" to "Single"
(suggested by Rolf Ahrenberg). (suggested by Rolf Ahrenberg).
- Fixed some typos in HISTORY and CONTRIBUTORS (thanks to Ville Skyttä). - Fixed some typos in HISTORY and CONTRIBUTORS (thanks to Ville Skyttä).
- The channel name column in the "What's on now/next" menu now adjusts its width
to display the full short name of each channel (suggested by Dominic Evans).

View File

@ -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: channels.c 2.20 2012/03/07 16:50:15 kls Exp $ * $Id: channels.c 2.21 2012/03/11 13:29:06 kls Exp $
*/ */
#include "channels.h" #include "channels.h"
@ -760,6 +760,8 @@ cChannels Channels;
cChannels::cChannels(void) cChannels::cChannels(void)
{ {
maxNumber = 0; maxNumber = 0;
maxChannelNameLength = 0;
maxShortChannelNameLength = 0;
modified = CHANNELSMOD_NONE; modified = CHANNELSMOD_NONE;
} }
@ -937,9 +939,32 @@ bool cChannels::SwitchTo(int Number)
return channel && cDevice::PrimaryDevice()->SwitchChannel(channel, true); return channel && cDevice::PrimaryDevice()->SwitchChannel(channel, true);
} }
int cChannels::MaxChannelNameLength(void)
{
if (!maxChannelNameLength) {
for (cChannel *channel = First(); channel; channel = Next(channel)) {
if (!channel->GroupSep())
maxChannelNameLength = max(Utf8StrLen(channel->Name()), maxChannelNameLength);
}
}
return maxChannelNameLength;
}
int cChannels::MaxShortChannelNameLength(void)
{
if (!maxShortChannelNameLength) {
for (cChannel *channel = First(); channel; channel = Next(channel)) {
if (!channel->GroupSep())
maxShortChannelNameLength = max(Utf8StrLen(channel->ShortName()), maxShortChannelNameLength);
}
}
return maxShortChannelNameLength;
}
void cChannels::SetModified(bool ByUser) void cChannels::SetModified(bool ByUser)
{ {
modified = ByUser ? CHANNELSMOD_USER : !modified ? CHANNELSMOD_AUTO : modified; modified = ByUser ? CHANNELSMOD_USER : !modified ? CHANNELSMOD_AUTO : modified;
maxChannelNameLength = maxShortChannelNameLength = 0;
} }
int cChannels::Modified(void) int cChannels::Modified(void)

View File

@ -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: channels.h 2.14 2011/08/06 09:56:13 kls Exp $ * $Id: channels.h 2.15 2012/03/11 11:46:39 kls Exp $
*/ */
#ifndef __CHANNELS_H #ifndef __CHANNELS_H
@ -200,6 +200,8 @@ public:
class cChannels : public cRwLock, public cConfig<cChannel> { class cChannels : public cRwLock, public cConfig<cChannel> {
private: private:
int maxNumber; int maxNumber;
int maxChannelNameLength;
int maxShortChannelNameLength;
int modified; int modified;
int beingEdited; int beingEdited;
cHash<cChannel> channelsHashSid; cHash<cChannel> channelsHashSid;
@ -224,6 +226,8 @@ public:
bool HasUniqueChannelID(cChannel *NewChannel, cChannel *OldChannel = NULL); bool HasUniqueChannelID(cChannel *NewChannel, cChannel *OldChannel = NULL);
bool SwitchTo(int Number); bool SwitchTo(int Number);
int MaxNumber(void) { return maxNumber; } int MaxNumber(void) { return maxNumber; }
int MaxChannelNameLength(void);
int MaxShortChannelNameLength(void);
void SetModified(bool ByUser = false); void SetModified(bool ByUser = false);
int Modified(void); int Modified(void);
///< Returns 0 if no channels have been modified, 1 if an automatic ///< Returns 0 if no channels have been modified, 1 if an automatic

13
menu.c
View File

@ -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 2.43 2012/03/11 10:44:32 kls Exp $ * $Id: menu.c 2.44 2012/03/11 13:20:45 kls Exp $
*/ */
#include "menu.h" #include "menu.h"
@ -49,6 +49,7 @@
#define NODISKSPACEDELTA 300 // seconds between "Not enough disk space to start recording!" messages #define NODISKSPACEDELTA 300 // seconds between "Not enough disk space to start recording!" messages
#define CHNUMWIDTH (numdigits(Channels.MaxNumber()) + 1) #define CHNUMWIDTH (numdigits(Channels.MaxNumber()) + 1)
#define CHNAMWIDTH (Channels.MaxShortChannelNameLength() + 1)
// --- cFreeDiskSpace -------------------------------------------------------- // --- cFreeDiskSpace --------------------------------------------------------
@ -1347,9 +1348,9 @@ bool cMenuScheduleItem::Update(bool Force)
const char *csn = channel ? channel->ShortName(true) : NULL; const char *csn = channel ? channel->ShortName(true) : NULL;
cString eds = event->GetDateString(); cString eds = event->GetDateString();
if (channel && withDate) if (channel && withDate)
buffer = cString::sprintf("%d\t%.*s\t%.*s\t%s\t%c%c%c\t%s", channel->Number(), Utf8SymChars(csn, 6), csn, Utf8SymChars(eds, 6), *eds, *event->GetTimeString(), t, v, r, event->Title()); buffer = cString::sprintf("%d\t%.*s\t%.*s\t%s\t%c%c%c\t%s", channel->Number(), Utf8SymChars(csn, 999), csn, Utf8SymChars(eds, 6), *eds, *event->GetTimeString(), t, v, r, event->Title());
else if (channel) else if (channel)
buffer = cString::sprintf("%d\t%.*s\t%s\t%c%c%c\t%s", channel->Number(), Utf8SymChars(csn, 6), csn, *event->GetTimeString(), t, v, r, event->Title()); buffer = cString::sprintf("%d\t%.*s\t%s\t%c%c%c\t%s", channel->Number(), Utf8SymChars(csn, 999), csn, *event->GetTimeString(), t, v, r, event->Title());
else else
buffer = cString::sprintf("%.*s\t%s\t%c%c%c\t%s", Utf8SymChars(eds, 6), *eds, *event->GetTimeString(), t, v, r, event->Title()); buffer = cString::sprintf("%.*s\t%s\t%c%c%c\t%s", Utf8SymChars(eds, 6), *eds, *event->GetTimeString(), t, v, r, event->Title());
SetText(buffer); SetText(buffer);
@ -1383,7 +1384,7 @@ int cMenuWhatsOn::currentChannel = 0;
const cEvent *cMenuWhatsOn::scheduleEvent = NULL; const cEvent *cMenuWhatsOn::scheduleEvent = NULL;
cMenuWhatsOn::cMenuWhatsOn(const cSchedules *Schedules, bool Now, int CurrentChannelNr) cMenuWhatsOn::cMenuWhatsOn(const cSchedules *Schedules, bool Now, int CurrentChannelNr)
:cOsdMenu(Now ? tr("What's on now?") : tr("What's on next?"), CHNUMWIDTH, 7, 6, 4) :cOsdMenu(Now ? tr("What's on now?") : tr("What's on next?"), CHNUMWIDTH, CHNAMWIDTH, 6, 4)
{ {
now = Now; now = Now;
helpKeys = -1; helpKeys = -1;
@ -1607,7 +1608,7 @@ void cMenuSchedule::PrepareScheduleThisThis(const cEvent *Event, const cChannel
void cMenuSchedule::PrepareScheduleThisAll(const cEvent *Event, const cChannel *Channel) void cMenuSchedule::PrepareScheduleThisAll(const cEvent *Event, const cChannel *Channel)
{ {
Clear(); Clear();
SetCols(CHNUMWIDTH, 7, 7, 6, 4); SetCols(CHNUMWIDTH, CHNAMWIDTH, 7, 6, 4);
SetTitle(tr("This event - all channels")); SetTitle(tr("This event - all channels"));
if (schedules && Event) { if (schedules && Event) {
for (cChannel *ch = Channels.First(); ch; ch = Channels.Next(ch)) { for (cChannel *ch = Channels.First(); ch; ch = Channels.Next(ch)) {
@ -1626,7 +1627,7 @@ void cMenuSchedule::PrepareScheduleThisAll(const cEvent *Event, const cChannel *
void cMenuSchedule::PrepareScheduleAllAll(const cEvent *Event, const cChannel *Channel) void cMenuSchedule::PrepareScheduleAllAll(const cEvent *Event, const cChannel *Channel)
{ {
Clear(); Clear();
SetCols(CHNUMWIDTH, 7, 7, 6, 4); SetCols(CHNUMWIDTH, CHNAMWIDTH, 7, 6, 4);
SetTitle(tr("All events - all channels")); SetTitle(tr("All events - all channels"));
if (schedules) { if (schedules) {
for (cChannel *ch = Channels.First(); ch; ch = Channels.Next(ch)) { for (cChannel *ch = Channels.First(); ch; ch = Channels.Next(ch)) {