summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2012-03-11 13:29:06 +0100
committerKlaus Schmidinger <vdr@tvdr.de>2012-03-11 13:29:06 +0100
commitc174dc0f5bd839d96e0e3d43de3e26d49c87a235 (patch)
treec315b1781fd622ed23d664a80244e36fe11206de
parent2be049f5f7951be9152531a46849712a147f68d6 (diff)
downloadvdr-c174dc0f5bd839d96e0e3d43de3e26d49c87a235.tar.gz
vdr-c174dc0f5bd839d96e0e3d43de3e26d49c87a235.tar.bz2
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
-rw-r--r--CONTRIBUTORS2
-rw-r--r--HISTORY2
-rw-r--r--channels.c27
-rw-r--r--channels.h6
-rw-r--r--menu.c13
5 files changed, 42 insertions, 8 deletions
diff --git a/CONTRIBUTORS b/CONTRIBUTORS
index b17f730b..e6224e80 100644
--- a/CONTRIBUTORS
+++ b/CONTRIBUTORS
@@ -2836,6 +2836,8 @@ Chris Mayo <aklhfex@gmail.com>
Dominic Evans <oldmanuk@gmail.com>
for making the SVDRP command LSTC accepts channel IDs
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>
for reporting a problem with newline characters in stream component descriptions
diff --git a/HISTORY b/HISTORY
index 18a7486f..87ffb9b1 100644
--- a/HISTORY
+++ b/HISTORY
@@ -7016,3 +7016,5 @@ Video Disk Recorder Revision History
- Changed the Green button in the "Edit timer" menu from "Once" to "Single"
(suggested by Rolf Ahrenberg).
- 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).
diff --git a/channels.c b/channels.c
index 04e1e378..4108b7b4 100644
--- a/channels.c
+++ b/channels.c
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* 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"
@@ -760,6 +760,8 @@ cChannels Channels;
cChannels::cChannels(void)
{
maxNumber = 0;
+ maxChannelNameLength = 0;
+ maxShortChannelNameLength = 0;
modified = CHANNELSMOD_NONE;
}
@@ -937,9 +939,32 @@ bool cChannels::SwitchTo(int Number)
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)
{
modified = ByUser ? CHANNELSMOD_USER : !modified ? CHANNELSMOD_AUTO : modified;
+ maxChannelNameLength = maxShortChannelNameLength = 0;
}
int cChannels::Modified(void)
diff --git a/channels.h b/channels.h
index 51f9830e..203a4c94 100644
--- a/channels.h
+++ b/channels.h
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* 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
@@ -200,6 +200,8 @@ public:
class cChannels : public cRwLock, public cConfig<cChannel> {
private:
int maxNumber;
+ int maxChannelNameLength;
+ int maxShortChannelNameLength;
int modified;
int beingEdited;
cHash<cChannel> channelsHashSid;
@@ -224,6 +226,8 @@ public:
bool HasUniqueChannelID(cChannel *NewChannel, cChannel *OldChannel = NULL);
bool SwitchTo(int Number);
int MaxNumber(void) { return maxNumber; }
+ int MaxChannelNameLength(void);
+ int MaxShortChannelNameLength(void);
void SetModified(bool ByUser = false);
int Modified(void);
///< Returns 0 if no channels have been modified, 1 if an automatic
diff --git a/menu.c b/menu.c
index 2e369f46..e3fd5055 100644
--- a/menu.c
+++ b/menu.c
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* 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"
@@ -49,6 +49,7 @@
#define NODISKSPACEDELTA 300 // seconds between "Not enough disk space to start recording!" messages
#define CHNUMWIDTH (numdigits(Channels.MaxNumber()) + 1)
+#define CHNAMWIDTH (Channels.MaxShortChannelNameLength() + 1)
// --- cFreeDiskSpace --------------------------------------------------------
@@ -1347,9 +1348,9 @@ bool cMenuScheduleItem::Update(bool Force)
const char *csn = channel ? channel->ShortName(true) : NULL;
cString eds = event->GetDateString();
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)
- 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
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);
@@ -1383,7 +1384,7 @@ int cMenuWhatsOn::currentChannel = 0;
const cEvent *cMenuWhatsOn::scheduleEvent = NULL;
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;
helpKeys = -1;
@@ -1607,7 +1608,7 @@ void cMenuSchedule::PrepareScheduleThisThis(const cEvent *Event, const cChannel
void cMenuSchedule::PrepareScheduleThisAll(const cEvent *Event, const cChannel *Channel)
{
Clear();
- SetCols(CHNUMWIDTH, 7, 7, 6, 4);
+ SetCols(CHNUMWIDTH, CHNAMWIDTH, 7, 6, 4);
SetTitle(tr("This event - all channels"));
if (schedules && Event) {
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)
{
Clear();
- SetCols(CHNUMWIDTH, 7, 7, 6, 4);
+ SetCols(CHNUMWIDTH, CHNAMWIDTH, 7, 6, 4);
SetTitle(tr("All events - all channels"));
if (schedules) {
for (cChannel *ch = Channels.First(); ch; ch = Channels.Next(ch)) {