OBJECTS = main.o command.o log.o remote.o led.o mtd.o video.o audio.o tcp.o directory.o thread.o event.o \
player.o demuxer.o stream.o vfeed.o afeed.o afeedr.o osd.o surface.o viewman.o vdr.o dsock.o box.o \
- recording.o channel.o message.o playervideo.o messagequeue.o \
- view.o vinfo.o vwallpaper.o vvolume.o vrecordinglist.o vlivebanner.o vmute.o \
+ recording.o channel.o message.o playervideo.o messagequeue.o rectimer.o \
+ view.o vinfo.o vwallpaper.o vvolume.o vrecordinglist.o vlivebanner.o vmute.o vtimerlist.o \
vrecordingmenu.o vquestion.o vchannellist.o vwelcome.o vvideolive.o vvideorec.o \
vchannelselect.o vserverselect.o colour.o vconnect.o voptions.o vepg.o region.o \
widget.o wselectlist.o wjpeg.o wsymbol.o wbutton.o woptionbox.o wtextbox.o i18n.o timers.o \
-/*
+#/*
Copyright 2004-2005 Chris Tallon
This file is part of VOMP.
--- /dev/null
+/*
+ Copyright 2004-2005 Chris Tallon
+
+ This file is part of VOMP.
+
+ VOMP is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ VOMP is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with VOMP; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+*/
+
+#include "rectimer.h"
+
+RecTimer::RecTimer()
+{
+ active = 0;
+ recording = 0;
+ pending = 0;
+ priority = 0;
+ lifeTime = 0;
+ channelNumber = 0;
+ startTime = 0;
+ stopTime = 0;
+
+ file = NULL;
+ summary = NULL;
+
+ index = -1;
+}
+
+RecTimer::~RecTimer()
+{
+ if (file) delete[] file;
+ if (summary) delete[] summary;
+}
--- /dev/null
+/*
+ Copyright 2004-2005 Chris Tallon
+
+ This file is part of VOMP.
+
+ VOMP is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ VOMP is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with VOMP; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+*/
+
+#ifndef RECTIMER_H
+#define RECTIMER_H
+
+#include <stdio.h>
+
+#include "defines.h"
+
+class RecTimer
+{
+ public:
+ RecTimer();
+ ~RecTimer();
+
+ ULONG active;
+ ULONG recording;
+ ULONG pending;
+ ULONG priority;
+ ULONG lifeTime;
+ ULONG channelNumber;
+ ULONG startTime;
+ ULONG stopTime;
+
+ char* file;
+ char* summary;
+
+
+ int index;
+};
+
+#endif
return toReturn;
}
+
+RecTimerList* VDR::getRecTimersList()
+{
+ if (!connected) return NULL;
+
+ UCHAR buffer[8];
+
+ *(unsigned long*)&buffer[0] = htonl(4);
+ *(unsigned long*)&buffer[4] = htonl(VDR_GETTIMERS);
+
+ pthread_mutex_lock(&mutex);
+ int a = tcp->sendPacket(buffer, 8);
+ if (a != 8)
+ {
+ pthread_mutex_unlock(&mutex);
+ return NULL;
+ }
+
+ // reply
+
+ if (!getPacket())
+ {
+ pthread_mutex_unlock(&mutex);
+ return NULL;
+ }
+
+ RecTimerList* recTimerList = new RecTimerList();
+
+ RecTimer* newRecTimer;
+
+ while (packetPos < packetLength)
+ {
+ newRecTimer = new RecTimer();
+ newRecTimer->active = extractULONG();
+ newRecTimer->recording = extractULONG();
+ newRecTimer->pending = extractULONG();
+ newRecTimer->priority = extractULONG();
+ newRecTimer->lifeTime = extractULONG();
+ newRecTimer->channelNumber = extractULONG();
+ newRecTimer->startTime = extractULONG();
+ newRecTimer->stopTime = extractULONG();
+
+ newRecTimer->file = extractString();
+ newRecTimer->summary = extractString();
+
+ recTimerList->push_back(newRecTimer);
+ Log::getInstance()->log("VDR", Log::DEBUG, "TL: %lu %lu %lu %lu %lu %lu %lu %lu %s",
+ newRecTimer->active, newRecTimer->recording, newRecTimer->pending, newRecTimer->priority, newRecTimer->lifeTime,
+ newRecTimer->channelNumber, newRecTimer->startTime, newRecTimer->stopTime, newRecTimer->file);
+ }
+
+ freePacket();
+ pthread_mutex_unlock(&mutex);
+
+ return recTimerList;
+}
#include "recording.h"
#include "channel.h"
#include "event.h"
+#include "rectimer.h"
using namespace std;
typedef vector<Event*> EventList;
typedef vector<Channel*> ChannelList;
+typedef vector<RecTimer*> RecTimerList;
class VDR
{
int configSave(char* section, char* key, const char* value);
char* configLoad(char* section, char* key);
+ RecTimerList* getRecTimersList();
+
// end
const static ULONG VIDEO = 1;
const static ULONG VDR_CONFIGSAVE = 11;
const static ULONG VDR_CONFIGLOAD = 12;
const static ULONG VDR_RESCANRECORDING = 13;
+ const static ULONG VDR_GETTIMERS = 14;
int getPacket();
void freePacket();
--- /dev/null
+/*
+ Copyright 2004-2005 Chris Tallon
+
+ This file is part of VOMP.
+
+ VOMP is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ VOMP is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with VOMP; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+*/
+
+#include "vtimerlist.h"
+
+VTimerList::VTimerList(RecTimerList* trtl)
+{
+ recTimerList = trtl;
+
+ create(570, 420);
+ if (Video::getInstance()->getFormat() == Video::PAL)
+ {
+ setScreenPos(80, 70);
+ }
+ else
+ {
+ setScreenPos(70, 35);
+ }
+
+
+ setBackgroundColour(Colour::VIEWBACKGROUND);
+ setTitleBarOn(1);
+ setTitleText(tr("Timers"));
+ setTitleBarColour(Colour::TITLEBARBACKGROUND);
+
+ sl.setSurface(surface);
+ sl.setSurfaceOffset(10, 30 + 5);
+ sl.setDimensions(area.w - 20, area.h - 30 - 15 - 30);
+
+ drawData();
+}
+
+VTimerList::~VTimerList()
+{
+ if (recTimerList)
+ {
+ for (UINT i = 0; i < recTimerList->size(); i++)
+ {
+ delete (*recTimerList)[i];
+ }
+
+ recTimerList->clear();
+ delete recTimerList;
+ }
+}
+
+void VTimerList::drawData()
+{
+ char str[500];
+
+ sl.addColumn(0);
+ sl.addColumn(60);
+
+ RecTimer* recTimer;
+ int first = 1;
+
+ for (UINT i = 0; i < recTimerList->size(); i++)
+ {
+ recTimer = (*recTimerList)[i];
+ sprintf(str, "%u\t%s", i, recTimer->file);
+ recTimer->index = sl.addOption(str, first);
+ first = 0;
+ }
+}
+
+void VTimerList::draw()
+{
+ View::draw();
+ sl.draw();
+
+ // Put the status stuff at the bottom
+
+ WSymbol w;
+ w.setSurface(surface);
+
+ w.nextSymbol = WSymbol::UP;
+ w.setSurfaceOffset(20, 385);
+ w.draw();
+
+ w.nextSymbol = WSymbol::DOWN;
+ w.setSurfaceOffset(50, 385);
+ w.draw();
+
+ w.nextSymbol = WSymbol::SKIPBACK;
+ w.setSurfaceOffset(85, 385);
+ w.draw();
+
+ w.nextSymbol = WSymbol::SKIPFORWARD;
+ w.setSurfaceOffset(115, 385);
+ w.draw();
+
+// w.nextSymbol = WSymbol::PLAY;
+// w.setSurfaceOffset(150, 385);
+// w.draw();
+
+ doShowingBar();
+}
+
+void VTimerList::doShowingBar()
+{
+ int topOption = sl.getTopOption() + 1;
+ if (sl.getNumOptions() == 0) topOption = 0;
+
+ char showing[200];
+ sprintf(showing, tr("%i to %i of %i"), topOption, sl.getBottomOption(), sl.getNumOptions());
+
+ rectangle(220, 385, 220+160, 385+25, Colour::VIEWBACKGROUND);
+ drawText(showing, 220, 385, Colour::LIGHTTEXT);
+}
+
+int VTimerList::handleCommand(int command)
+{
+ switch(command)
+ {
+ case Remote::DF_UP:
+ case Remote::UP:
+ {
+ sl.up();
+ sl.draw();
+
+ doShowingBar();
+ ViewMan::getInstance()->updateView(this);
+ return 2;
+ }
+ case Remote::DF_DOWN:
+ case Remote::DOWN:
+ {
+ sl.down();
+ sl.draw();
+
+ doShowingBar();
+ ViewMan::getInstance()->updateView(this);
+ return 2;
+ }
+ case Remote::SKIPBACK:
+ {
+ sl.pageUp();
+ sl.draw();
+
+ doShowingBar();
+ ViewMan::getInstance()->updateView(this);
+ return 2;
+ }
+ case Remote::SKIPFORWARD:
+ {
+ sl.pageDown();
+ sl.draw();
+
+ doShowingBar();
+ ViewMan::getInstance()->updateView(this);
+ return 2;
+ }
+ case Remote::OK:
+ {
+ RecTimer* recTimer = NULL;
+ if (recTimerList)
+ {
+ int currentOption = sl.getCurrentOption();
+
+ for (UINT i = 0; i < recTimerList->size(); i++)
+ {
+ recTimer = (*recTimerList)[i];
+ if (currentOption == recTimer->index) break;
+ }
+ }
+
+ if (recTimer == NULL) return 2;
+
+ // recTimer is the one you want FIXME
+
+ return 2;
+ }
+ case Remote::BACK:
+ {
+ return 4;
+ }
+ }
+ // stop command getting to any more views
+ return 1;
+}
--- /dev/null
+/*
+ Copyright 2004-2005 Chris Tallon
+
+ This file is part of VOMP.
+
+ VOMP is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ VOMP is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with VOMP; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+*/
+
+#ifndef VTIMERLIST_H
+#define VTIMERLIST_H
+
+#include <stdio.h>
+#include <string.h>
+#include <vector>
+
+#include "view.h"
+#include "wselectlist.h"
+#include "remote.h"
+#include "wsymbol.h"
+#include "viewman.h"
+#include "vdr.h"
+#include "colour.h"
+#include "video.h"
+#include "i18n.h"
+
+class VTimerList : public View
+{
+ public:
+ VTimerList(RecTimerList* rtl);
+ ~VTimerList();
+
+ int handleCommand(int command);
+ void draw();
+
+ private:
+ RecTimerList* recTimerList;
+
+ WSelectList sl;
+
+ void doShowingBar();
+ void drawData();
+};
+
+#endif
}
return 2; // never gets here
}
+#ifdef DEV
+ case Remote::NINE:
+ {
+ doTimersList();
+ return 2;
+ }
+#endif
}
return 1;
Log::getInstance()->log("VWelcome", Log::DEBUG, "possible delay end");
}
+void VWelcome::doTimersList()
+{
+ RecTimerList* recTimerList = VDR::getInstance()->getRecTimersList();
+
+ if (recTimerList)
+ {
+ VTimerList* vtl = new VTimerList(recTimerList);
+
+ vtl->draw();
+ viewman->add(vtl);
+ viewman->updateView(vtl);
+ }
+}
+
void VWelcome::doOptions()
{
VOptions* voptions = new VOptions(this);
#include "directory.h"
#include "vchannellist.h"
#include "vrecordinglist.h"
+#include "vtimerlist.h"
#include "command.h"
#include "message.h"
#include "colour.h"
void doChannelsList();
void doRadioList();
void doRecordingsList();
+ void doTimersList();
void doOptions();
void drawClock();