list.o queue.o node.o recording.o channel.o message.o playerradio.o messagequeue.o \
view.o vinfo.o vwallpaper.o vvolume.o vrecordinglist.o vlivebanner.o vmute.o \
vrecordingmenu.o vquestion.o vchannellist.o vwelcome.o vvideolive.o vvideorec.o vradiolive.o \
- vchannelselect.o vserverselect.o colour.o vconnect.o \
- wselectlist.o wjpeg.o wsymbol.o wbutton.o \
+ vchannelselect.o vserverselect.o colour.o vconnect.o voptions.o \
+ wselectlist.o wjpeg.o wsymbol.o wbutton.o woptionbox.o \
fonts/helvB24.o fonts/helvB18.o
.PHONY: clean fresh all install strip
while(irun)
{
button = remote->getButtonPress(2); // FIXME why is this set to 2 and not 0? so it can quit
- if ((button == Remote::NONE) || (button == Remote::UNKNOWN)) continue;
+ if ((button == Remote::NA_NONE) || (button == Remote::NA_UNKNOWN)) continue;
- if (button != Remote::SIGNAL) handleCommand(button);
+ if (button != Remote::NA_SIGNAL) handleCommand(button);
processMessageQueue();
}
}
switch(button)
{
- case Remote::LEFT:
- case Remote::RIGHT:
+ case Remote::DF_LEFT:
+ case Remote::DF_RIGHT:
+ case Remote::VOLUMEUP:
+ case Remote::VOLUMEDOWN:
{
VVolume* v = new VVolume();
v->handleCommand(button); // this will draw+show
}
}
- // Save power state = on
-
- vdr->configSave("General", "Last Power State", "On");
-
// Go S-Video if config says so
logger->log("Command", Log::INFO, "Config TV/S-Video not found");
}
- // s video done
+ // Set remote type
+
+ char* remoteType = vdr->configLoad("General", "Remote type");
+
+ if (remoteType)
+ {
+ if (!strcasecmp(remoteType, "New"))
+ {
+ logger->log("Command", Log::INFO, "Switching to New remote type");
+ remote->setRemoteType(Remote::NEWREMOTE);
+ }
+ else
+ {
+ logger->log("Command", Log::INFO, "Switching to Old remote type");
+ remote->setRemoteType(Remote::OLDREMOTE);
+ }
+ }
+ else
+ {
+ logger->log("Command", Log::INFO, "Config General/Remote type not found");
+ remote->setRemoteType(Remote::OLDREMOTE);
+ }
+
+ // Save power state = on
+
+ vdr->configSave("General", "Last Power State", "On");
+
+ // config done
VWelcome* vw = new VWelcome();
viewman->add(vw);
viewman->redrawAll();
+
+/*
+ handleCommand(Remote::DOWN);
+ handleCommand(Remote::DOWN);
+ handleCommand(Remote::DOWN);
+ handleCommand(Remote::OK);
+*/
}
if (!initted) return 0;
int result = ioctl(device, IR_SET_LED, 0);
+ Log::getInstance()->log("LED", Log::DEBUG, "led on %i %i", device, result);
if (result >= 0) return 1;
else return 0;
}
if (!initted) return 0;
int result = ioctl(device, IR_SET_LED, 1);
+ Log::getInstance()->log("LED", Log::DEBUG, "led off %i %i", device, result);
if (result >= 0) return 1;
else return 0;
}
#include "stb.h"
+#include "log.h" // temp while fix led on bug!
+
class Led
{
public:
}
playing = 0;
+ paused = 0;
threadStop();
video->stop();
video->blank();
audio->stop();
+ audio->unPause();
vfeed.stop();
afeed.stop();
video->reset();
device = 0;
tv.tv_sec = 0;
tv.tv_usec = 0;
+ remoteType = OLDREMOTE;
}
Remote::~Remote()
return device;
}
+void Remote::setRemoteType(UCHAR newType)
+{
+ if ((newType != OLDREMOTE) && (newType != NEWREMOTE)) return;
+ remoteType = newType;
+}
+
UCHAR Remote::getButtonPress(int waitType)
{
/* how = 0 - block
// 0 = nothing happened
// 1 = data arrived (actually num of descriptors that changed)
// other value = signal or error
- if (retval == 0) return NONE;
- if (retval == -1) return SIGNAL;
+ if (retval == 0) return NA_NONE;
+ if (retval == -1) return NA_SIGNAL;
int count = read(device, &input, 4);
if (count == 4)
{
input = (0X00FF0000 & input) >> 16;
Log::getInstance()->log("Remote", Log::DEBUG, "Button %i", input);
+
+ if (remoteType == OLDREMOTE)
+ {
+ if (input == VOLUMEDOWN) return DF_LEFT;
+ if (input == VOLUMEUP) return DF_RIGHT;
+ if (input == CHANNELUP) return DF_UP;
+ if (input == CHANNELDOWN) return DF_DOWN;
+ }
+
return (UCHAR) input;
}
- return UNKNOWN;
+ return NA_UNKNOWN;
}
int init(char *devName);
int shutdown();
int getDevice();
+ void setRemoteType(UCHAR type);
UCHAR getButtonPress(int how);
+ // Not buttons
+ const static UCHAR NA_NONE = 98;
+ const static UCHAR NA_UNKNOWN = 99;
+ const static UCHAR NA_SIGNAL = 100;
+ const static UCHAR DF_UP = 94;
+ const static UCHAR DF_DOWN = 95;
+ const static UCHAR DF_LEFT = 96;
+ const static UCHAR DF_RIGHT = 97;
+
+ // Problem common buttons
+ const static UCHAR VOLUMEUP = 16;
+ const static UCHAR VOLUMEDOWN = 17;
+ const static UCHAR CHANNELUP = 32;
+ const static UCHAR CHANNELDOWN = 33;
+
+ // Common buttons
const static UCHAR ZERO = 0;
const static UCHAR ONE = 1;
const static UCHAR TWO = 2;
const static UCHAR GREEN = 46;
const static UCHAR YELLOW = 56;
const static UCHAR BLUE = 41;
- const static UCHAR LEFT = 17;
- const static UCHAR RIGHT = 16;
- const static UCHAR UP = 32;
- const static UCHAR DOWN = 33;
const static UCHAR MUTE = 15;
- const static UCHAR OSD = 12;
- const static UCHAR FULL = 60;
+ const static UCHAR RADIO = 12; // The unlabelled button on old
const static UCHAR REVERSE = 50;
const static UCHAR PLAY = 53;
const static UCHAR FORWARD = 52;
const static UCHAR SKIPBACK = 36;
const static UCHAR SKIPFORWARD = 30;
const static UCHAR OK = 37;
- const static UCHAR NONE = 98;
- const static UCHAR UNKNOWN = 99;
- const static UCHAR SIGNAL = 100;
+
+ // Old remote only
+ const static UCHAR FULL = 60;
+
+ // New remote only
+ const static UCHAR TV = 28;
+ const static UCHAR VIDEOS = 24;
+ const static UCHAR MUSIC = 25;
+ const static UCHAR PICTURES = 26;
+ const static UCHAR GUIDE = 27;
+ const static UCHAR UP = 20;
+ const static UCHAR DOWN = 21;
+ const static UCHAR LEFT = 22;
+ const static UCHAR RIGHT = 23;
+ const static UCHAR PREVCHANNEL = 18;
+ const static UCHAR STAR = 10;
+ const static UCHAR HASH = 14;
+
+ // Remote types
+ const static UCHAR OLDREMOTE = 1;
+ const static UCHAR NEWREMOTE = 2;
private:
static Remote* instance;
int initted;
int device;
struct timeval tv;
+ UCHAR remoteType;
};
#endif
int VChannelList::handleCommand(int command)
{
- if (command == Remote::UP)
+ switch(command)
{
- sl.up();
- sl.draw();
-
- doShowingBar();
- show();
- return 2;
- }
- else if (command == Remote::DOWN)
- {
- sl.down();
- sl.draw();
+ case Remote::DF_UP:
+ case Remote::UP:
+ {
+ sl.up();
+ sl.draw();
- doShowingBar();
- show();
- return 2;
- }
- else if (command == Remote::SKIPBACK)
- {
- sl.pageUp();
- sl.draw();
+ doShowingBar();
+ show();
+ return 2;
+ }
+ case Remote::DF_DOWN:
+ case Remote::DOWN:
+ {
+ sl.down();
+ sl.draw();
- doShowingBar();
- show();
- return 2;
- }
- else if (command == Remote::SKIPFORWARD)
- {
- sl.pageDown();
- sl.draw();
+ doShowingBar();
+ show();
+ return 2;
+ }
+ case Remote::SKIPBACK:
+ {
+ sl.pageUp();
+ sl.draw();
- doShowingBar();
- show();
- return 2;
- }
- else if (command == Remote::OK)
- {
- Channel* chan = NULL;
- if (chanList)
+ doShowingBar();
+ show();
+ return 2;
+ }
+ case Remote::SKIPFORWARD:
{
- int currentOption = sl.getCurrentOption();
- chanList->reset();
+ sl.pageDown();
+ sl.draw();
- while((chan = (Channel*)chanList->getCurrent()))
+ doShowingBar();
+ show();
+ return 2;
+ }
+ case Remote::OK:
+ {
+ Channel* chan = NULL;
+ if (chanList)
{
- if (currentOption == chan->index) break;
- chanList->next();
+ int currentOption = sl.getCurrentOption();
+ chanList->reset();
+
+ while((chan = (Channel*)chanList->getCurrent()))
+ {
+ if (currentOption == chan->index) break;
+ chanList->next();
+ }
}
- }
- if (chan == NULL) return 2;
+ if (chan == NULL) return 2;
- View* v = NULL;
+ View* v = NULL;
-// stop radio
-// if (chan->type == VDR::RADIO) return 2;
+ // stop radio
+ // if (chan->type == VDR::RADIO) return 2;
- if (chan->type == VDR::VIDEO)
- {
- v = new VVideoLive(chanList);
- ((VVideoLive*)v)->setChannel(chan->number);
+ if (chan->type == VDR::VIDEO)
+ {
+ v = new VVideoLive(chanList);
+ ((VVideoLive*)v)->setChannel(chan->number);
+ }
+ else if (chan->type == VDR::RADIO)
+ {
+ v = new VRadioLive(chanList);
+ ((VRadioLive*)v)->setChannel(chan->number);
+ }
+
+ ViewMan::getInstance()->addNoLock(v);
+ v->draw();
+ v->show();
+
+ return 2;
}
- else if (chan->type == VDR::RADIO)
+ case Remote::BACK:
{
- v = new VRadioLive(chanList);
- ((VRadioLive*)v)->setChannel(chan->number);
+ return 4;
}
-
- ViewMan::getInstance()->addNoLock(v);
- v->draw();
- v->show();
-
- return 2;
- }
- else if (command == Remote::BACK)
- {
- return 4;
}
// stop command getting to any more views
return 1;
threadWaitForSignal();
}
- printf("server selected %i\n", selectedServer);
-
+ logger->log("Command", Log::NOTICE, "Connecting to server at %s", serverIPs[selectedServer]);
vdr->setServerIP(serverIPs[selectedServer]);
// Clear the serverIPs vector
}
serverIPs.clear();
- logger->log("Command", Log::NOTICE, "Connecting to server at %s", serverIPs[selectedServer]);
setMainText("\n Connecting to VDR");
draw();
show();
{
return 4;
}
+ case Remote::DF_UP:
case Remote::UP:
{
sl.up();
show();
return 2;
}
+ case Remote::DF_DOWN:
case Remote::DOWN:
{
sl.down();
--- /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 "voptions.h"
+
+VOptions::VOptions()
+{
+ setDimensions(190, 460);
+
+ if (Video::getInstance()->getFormat() == Video::PAL)
+ {
+ setScreenPos(140, 170);
+ }
+ else
+ {
+ setScreenPos(130, 140);
+ }
+
+ setBackgroundColour(Colour::VIEWBACKGROUND);
+ setTitleBarOn(1);
+ setTitleBarColour(Colour::TITLEBARBACKGROUND);
+ setTitleText("Options");
+
+ int fontHeight = surface->getFontHeight();
+
+ optionBox[0].setScreenPos(screenX + 290, screenY + 45);
+ optionBox[0].setDimensions(fontHeight, 150);
+ optionBox[0].addOption("Old");
+ optionBox[0].addOption("New");
+
+ optionBox[1].setScreenPos(screenX + 290, screenY + 75);
+ optionBox[1].setDimensions(fontHeight, 150);
+ optionBox[1].addOption("RGB+composite");
+ optionBox[1].addOption("S-Video");
+
+ optionBox[2].setScreenPos(screenX + 290, screenY + 105);
+ optionBox[2].setDimensions(fontHeight, 150);
+ optionBox[2].addOption("On");
+ optionBox[2].addOption("Off");
+ optionBox[2].addOption("Last state");
+
+
+ char* config;
+ vdr = VDR::getInstance();
+
+
+ config = vdr->configLoad("General", "Remote type");
+ if (!config)
+ {
+ optionBox[0].setSelected("Old");
+ }
+ else if (!strcasecmp(config, "New"))
+ {
+ optionBox[0].setSelected("New");
+ }
+ else
+ {
+ optionBox[0].setSelected("Old");
+ }
+
+
+ config = vdr->configLoad("TV", "S-Video");
+ if (!config)
+ {
+ optionBox[1].setSelected("RGB+composite");
+ }
+ else if (!strcasecmp(config, "Yes"))
+ {
+ optionBox[1].setSelected("S-Video");
+ }
+ else
+ {
+ optionBox[1].setSelected("RGB+composite");
+ }
+
+
+ config = vdr->configLoad("General", "Power After Boot");
+ if (!config)
+ {
+ optionBox[2].setSelected("On");
+ }
+ else if (!strcasecmp(config, "On")) // just for completeness
+ {
+ optionBox[2].setSelected("On");
+ }
+ else if (!strcasecmp(config, "Off"))
+ {
+ optionBox[2].setSelected("Off");
+ }
+ else if (!strcasecmp(config, "Last state"))
+ {
+ optionBox[2].setSelected("Last state");
+ }
+ else
+ {
+ optionBox[2].setSelected("On");
+ }
+
+
+ selectedOption = 0;
+ optionBox[0].setActive(1);
+}
+
+VOptions::~VOptions()
+{
+}
+
+void VOptions::draw()
+{
+ View::draw();
+
+ WSymbol ws;
+ Colour cl;
+
+ drawText("Remote control type", 10, 45, Colour::LIGHTTEXT);
+ drawText("TV connection type", 10, 75, Colour::LIGHTTEXT);
+ drawText("Power state after bootup", 10, 105, Colour::LIGHTTEXT);
+
+ drawText("Press back to exit, <, > or [ok] to change", 10, 160, Colour::LIGHTTEXT);
+
+ for (UINT i = 0; i < numOptions; i++)
+ {
+ if (i == selectedOption) cl = Colour::SELECTHIGHLIGHT;
+ else cl = Colour::BUTTONBACKGROUND;
+
+ ws.nextSymbol = WSymbol::LEFTARROW;
+ ws.setScreenPos(screenX + 272, screenY + 47 + (i * 30));
+ ws.draw(cl);
+ ws.nextSymbol = WSymbol::RIGHTARROW;
+ ws.setScreenPos(screenX + 442, screenY + 47 + (i * 30));
+ ws.draw(cl);
+ optionBox[i].draw();
+ optionBox[i].show();
+ }
+
+}
+
+int VOptions::handleCommand(int command)
+{
+ switch(command)
+ {
+ case Remote::DF_UP:
+ case Remote::UP:
+ {
+ if (selectedOption > 0)
+ {
+ optionBox[selectedOption].setActive(0);
+ --selectedOption;
+ optionBox[selectedOption].setActive(1);
+ draw();
+ show();
+ }
+ return 2;
+ }
+ case Remote::DF_DOWN:
+ case Remote::DOWN:
+ {
+ if (selectedOption < (numOptions - 1))
+ {
+ optionBox[selectedOption].setActive(0);
+ ++selectedOption;
+ optionBox[selectedOption].setActive(1);
+ draw();
+ show();
+ }
+ return 2;
+ }
+ case Remote::DF_LEFT:
+ case Remote::LEFT:
+ {
+ optionBox[selectedOption].left();
+ draw();
+ show();
+ return 2;
+ }
+ case Remote::DF_RIGHT:
+ case Remote::RIGHT:
+ {
+ optionBox[selectedOption].right();
+ draw();
+ show();
+ return 2;
+ }
+ case Remote::BACK:
+ {
+ doSave();
+ return 4;
+ }
+ case Remote::OK:
+ {
+ optionBox[selectedOption].cycle();
+ draw();
+ show();
+ }
+ }
+
+ return 1;
+}
+
+void VOptions::doSave()
+{
+ char* remoteType = optionBox[0].getSelected();
+ vdr->configSave("General", "Remote type", remoteType);
+ if (!strcmp(remoteType, "New"))
+ {
+ Remote::getInstance()->setRemoteType(Remote::NEWREMOTE);
+ }
+ else
+ {
+ Remote::getInstance()->setRemoteType(Remote::OLDREMOTE);
+ }
+
+ char* tvconnection = optionBox[1].getSelected();
+ if (!strcmp(tvconnection, "S-Video"))
+ {
+ vdr->configSave("TV", "S-Video", "Yes");
+ Video::getInstance()->setConnection(Video::SVIDEO);
+ }
+ else
+ {
+ vdr->configSave("TV", "S-Video", "No");
+ Video::getInstance()->setConnection(Video::COMPOSITERGB);
+ }
+
+ char* powerState = optionBox[2].getSelected();
+ vdr->configSave("General", "Power After Boot", powerState);
+}
--- /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 VOPTIONS_H
+#define VOPTIONS_H
+
+#include "view.h"
+#include "remote.h"
+#include "viewman.h"
+#include "vdr.h"
+#include "colour.h"
+#include "video.h"
+#include "woptionbox.h"
+#include "wsymbol.h"
+
+class VOptions : public View
+{
+ public:
+ VOptions();
+ ~VOptions();
+
+ int handleCommand(int command);
+ void draw();
+
+ private:
+ void doSave();
+
+ const static UINT numOptions = 3;
+ UINT selectedOption;
+ WOptionBox optionBox[numOptions];
+ VDR* vdr;
+
+};
+
+#endif
int VQuestion::handleCommand(int command)
{
- if (command == Remote::LEFT)
+ switch(command)
{
- swap();
- draw();
- show();
- return 2;
+ case Remote::DF_LEFT:
+ case Remote::LEFT:
+ {
+ swap();
+ draw();
+ show();
+ return 2;
+ }
+ case Remote::DF_RIGHT:
+ case Remote::RIGHT:
+ {
+ swap();
+ draw();
+ show();
+ return 2;
+ }
+ case Remote::BACK:
+ {
+ return 4;
+ }
+ case Remote::OK:
+ {
+ if (selectedOption != YES) return 4;
+
+ Message* m = new Message();
+ m->from = this;
+ m->to = parent;
+ m->message = Message::QUESTION_YES;
+ ViewMan::getInstance()->postMessage(m);
+
+ return 4;
+ }
}
- else if (command == Remote::RIGHT)
- {
- swap();
- draw();
- show();
- return 2;
- }
- else if (command == Remote::BACK)
- {
- return 4;
- }
- else if (command == Remote::OK)
- {
- if (selectedOption != YES) return 4;
-
- Message* m = new Message();
- m->from = this;
- m->to = parent;
- m->message = Message::QUESTION_YES;
- ViewMan::getInstance()->postMessage(m);
-
- return 4;
- }
-
return 1;
}
vdr->stopStreaming();
return 4;
}
+ case Remote::DF_UP:
case Remote::UP:
{
player->stop();
player->play();
return 2;
}
+ case Remote::DF_DOWN:
case Remote::DOWN:
{
player->stop();
int VRecordingList::handleCommand(int command)
{
- if (command == Remote::UP)
+ switch(command)
{
- sl.up();
- sl.draw();
-
- doShowingBar();
- show();
- return 2;
- }
- else if (command == Remote::DOWN)
- {
- sl.down();
- sl.draw();
+ case Remote::DF_UP:
+ case Remote::UP:
+ {
+ sl.up();
+ sl.draw();
- doShowingBar();
- show();
- return 2;
- }
- else if (command == Remote::SKIPBACK)
- {
- sl.pageUp();
- sl.draw();
+ doShowingBar();
+ show();
+ return 2;
+ }
+ case Remote::DF_DOWN:
+ case Remote::DOWN:
+ {
+ sl.down();
+ sl.draw();
- doShowingBar();
- show();
- return 2;
- }
- else if (command == Remote::SKIPFORWARD)
- {
- sl.pageDown();
- sl.draw();
+ doShowingBar();
+ show();
+ return 2;
+ }
+ case Remote::SKIPBACK:
+ {
+ sl.pageUp();
+ sl.draw();
- doShowingBar();
- show();
- return 2;
- }
- else if (command == Remote::OK)
- {
- if (sl.getNumOptions() == 0) return 2;
+ doShowingBar();
+ show();
+ return 2;
+ }
+ case Remote::SKIPFORWARD:
+ {
+ sl.pageDown();
+ sl.draw();
- // Check to see if it is a sub directory
- Directory* curDir;
- for(recDir->dirList->reset(); (curDir = (Directory*)recDir->dirList->getCurrent()); recDir->dirList->next())
+ doShowingBar();
+ show();
+ return 2;
+ }
+ case Remote::OK:
{
- if (curDir->index == sl.getCurrentOption())
+ if (sl.getNumOptions() == 0) return 2;
+
+ // Check to see if it is a sub directory
+ Directory* curDir;
+ for(recDir->dirList->reset(); (curDir = (Directory*)recDir->dirList->getCurrent()); recDir->dirList->next())
{
- VRecordingList* sub = new VRecordingList();
- sub->setDir(curDir);
- ViewMan::getInstance()->addNoLock(sub);
+ if (curDir->index == sl.getCurrentOption())
+ {
+ VRecordingList* sub = new VRecordingList();
+ sub->setDir(curDir);
+ ViewMan::getInstance()->addNoLock(sub);
- sub->draw();
- sub->show();
+ sub->draw();
+ sub->show();
- return 2;
+ return 2;
+ }
}
- }
- // check to see if it's a recording
- Recording* current;
- for(recDir->recList->reset(); (current = (Recording*)recDir->recList->getCurrent()); recDir->recList->next())
- {
- if (current->index == sl.getCurrentOption())
+ // check to see if it's a recording
+ Recording* current;
+ for(recDir->recList->reset(); (current = (Recording*)recDir->recList->getCurrent()); recDir->recList->next())
{
- Log::getInstance()->log("VRecordingList", Log::DEBUG, "Found the option you pointed at. %s %s", current->getProgName(), current->fileName);
-
- VRecordingMenu* v = new VRecordingMenu();
- v->setParent(this);
- v->setRecording(current);
- ViewMan::getInstance()->addNoLock(v);
- v->draw();
- v->show();
- return 2;
+ if (current->index == sl.getCurrentOption())
+ {
+ Log::getInstance()->log("VRecordingList", Log::DEBUG, "Found the option you pointed at. %s %s", current->getProgName(), current->fileName);
+
+ VRecordingMenu* v = new VRecordingMenu();
+ v->setParent(this);
+ v->setRecording(current);
+ ViewMan::getInstance()->addNoLock(v);
+ v->draw();
+ v->show();
+ return 2;
+ }
}
+ // should not get to here
+ return 1;
+ }
+ case Remote::BACK:
+ {
+ return 4;
+ }
+ case Remote::PLAY:
+ {
+ if (doPlay()) return 2;
+ return 1;
}
- // should not get to here
- return 1;
- }
- else if (command == Remote::BACK)
- {
- return 4;
- }
- else if (command == Remote::PLAY)
- {
- if (doPlay()) return 2;
- return 1;
- }
+ }
// stop command getting to any more views
return 1;
}
int VRecordingMenu::handleCommand(int command)
{
- if (command == Remote::UP)
+ switch(command)
{
- sl.up();
- sl.draw();
- show();
- return 2;
- }
- else if (command == Remote::DOWN)
- {
- sl.down();
- sl.draw();
- show();
- return 2;
- }
- else if (command == Remote::OK)
- {
- if (sl.getCurrentOption() == 0)
+ case Remote::DF_UP:
+ case Remote::UP:
{
- Message* m = new Message();
- m->from = this;
- m->to = vRecList;
- m->message = Message::PLAY_SELECTED_RECORDING;
- ViewMan::getInstance()->postMessage(m);
- return 4;
+ sl.up();
+ sl.draw();
+ show();
+ return 2;
}
-
- if (sl.getCurrentOption() == 1)
+ case Remote::DF_DOWN:
+ case Remote::DOWN:
{
- Message* m = new Message();
- m->from = this;
- m->to = vRecList;
- m->message = Message::RESUME_SELECTED_RECORDING;
- ViewMan::getInstance()->postMessage(m);
- return 4;
+ sl.down();
+ sl.draw();
+ show();
+ return 2;
}
-
- if (sl.getCurrentOption() == 2)
+ case Remote::OK:
{
- char* summary = VDR::getInstance()->getRecordingSummary(rec->fileName);
-
- VInfo* vi = new VInfo();
- vi->setTitleText("Programme summary");
- vi->setBorderOn(1);
- vi->setExitable();
- if (summary) vi->setMainText(summary);
- else vi->setMainText("Summary unavailable");
- if (Video::getInstance()->getFormat() == Video::PAL)
+ if (sl.getCurrentOption() == 0)
{
- vi->setScreenPos(120, 130);
+ Message* m = new Message();
+ m->from = this;
+ m->to = vRecList;
+ m->message = Message::PLAY_SELECTED_RECORDING;
+ ViewMan::getInstance()->postMessage(m);
+ return 4;
}
- else
+
+ if (sl.getCurrentOption() == 1)
{
- vi->setScreenPos(110, 90);
+ Message* m = new Message();
+ m->from = this;
+ m->to = vRecList;
+ m->message = Message::RESUME_SELECTED_RECORDING;
+ ViewMan::getInstance()->postMessage(m);
+ return 4;
}
- vi->setDimensions(300, 490);
-
- ViewMan::getInstance()->addNoLock(vi);
- vi->draw();
- vi->show();
- if (summary) delete[] summary;
-
- return 2;
- }
- else if (sl.getCurrentOption() == 3)
- {
- VQuestion* v = new VQuestion();
- v->setParent(this);
- v->setBackgroundColour(Colour::VIEWBACKGROUND);
- v->setTitleBarColour(Colour::DANGER);
- v->setTitleBarOn(1);
- v->setBorderOn(1);
- v->setTitleText("Delete recording");
- v->setMainText("Are you sure you want to delete this recording?");
- v->setDefault(VQuestion::NO);
- if (Video::getInstance()->getFormat() == Video::PAL)
+ if (sl.getCurrentOption() == 2)
{
- v->setScreenPos(230, 160);
+ char* summary = VDR::getInstance()->getRecordingSummary(rec->fileName);
+
+ VInfo* vi = new VInfo();
+ vi->setTitleText("Programme summary");
+ vi->setBorderOn(1);
+ vi->setExitable();
+ if (summary) vi->setMainText(summary);
+ else vi->setMainText("Summary unavailable");
+ if (Video::getInstance()->getFormat() == Video::PAL)
+ {
+ vi->setScreenPos(120, 130);
+ }
+ else
+ {
+ vi->setScreenPos(110, 90);
+ }
+ vi->setDimensions(300, 490);
+
+ ViewMan::getInstance()->addNoLock(vi);
+ vi->draw();
+ vi->show();
+
+ if (summary) delete[] summary;
+
+ return 2;
}
- else
+ else if (sl.getCurrentOption() == 3)
{
- v->setScreenPos(220, 140);
+ VQuestion* v = new VQuestion();
+ v->setParent(this);
+ v->setBackgroundColour(Colour::VIEWBACKGROUND);
+ v->setTitleBarColour(Colour::DANGER);
+ v->setTitleBarOn(1);
+ v->setBorderOn(1);
+ v->setTitleText("Delete recording");
+ v->setMainText("Are you sure you want to delete this recording?");
+ v->setDefault(VQuestion::NO);
+ if (Video::getInstance()->getFormat() == Video::PAL)
+ {
+ v->setScreenPos(230, 160);
+ }
+ else
+ {
+ v->setScreenPos(220, 140);
+ }
+ v->setDimensions(180, 260);
+
+ ViewMan::getInstance()->addNoLock(v);
+ v->draw();
+ v->show();
+ return 2;
}
- v->setDimensions(180, 260);
-
- ViewMan::getInstance()->addNoLock(v);
- v->draw();
- v->show();
- return 2;
+ }
+ case Remote::BACK:
+ {
+ return 4;
}
}
- else if (command == Remote::BACK)
- {
- return 4;
- }
-
// stop command getting to any more views
return 1;
}
int VServerSelect::handleCommand(int command)
{
- if (command == Remote::UP)
+ switch(command)
{
- sl.up();
- sl.draw();
- show();
- return 2;
- }
- else if (command == Remote::DOWN)
- {
- sl.down();
- sl.draw();
- show();
- return 2;
- }
- else if (command == Remote::OK)
- {
- Message* m = new Message();
- m->to = parent;
- m->message = Message::SERVER_SELECTED;
- m->parameter = sl.getCurrentOption();
- ViewMan::getInstance()->postMessage(m);
- return 4;
+ case Remote::DF_UP:
+ case Remote::UP:
+ {
+ sl.up();
+ sl.draw();
+ show();
+ return 2;
+ }
+ case Remote::DF_DOWN:
+ case Remote::DOWN:
+ {
+ sl.down();
+ sl.draw();
+ show();
+ return 2;
+ }
+ case Remote::OK:
+ {
+ Message* m = new Message();
+ m->to = parent;
+ m->message = Message::SERVER_SELECTED;
+ m->parameter = sl.getCurrentOption();
+ ViewMan::getInstance()->postMessage(m);
+ return 4;
+ }
}
return 1;
vdr->stopStreaming();
return 4;
}
+ case Remote::DF_UP:
case Remote::UP:
{
player->stop();
player->play();
return 2;
}
+ case Remote::DF_DOWN:
case Remote::DOWN:
{
player->stop();
{
switch(command)
{
- case Remote::LEFT:
+ case Remote::DF_LEFT:
+ case Remote::VOLUMEDOWN:
{
displayVolume = Audio::getInstance()->volumeDown();
draw();
// handled
return 2;
}
- case Remote::RIGHT:
+ case Remote::DF_RIGHT:
+ case Remote::VOLUMEUP:
{
displayVolume = Audio::getInstance()->volumeUp();
draw();
VWelcome::VWelcome()
{
- setDimensions(190, 460);
+ setDimensions(200, 460);
if (Video::getInstance()->getFormat() == Video::PAL)
{
setTitleText("Welcome");
sl.setScreenPos(screenX + 20, screenY + 40);
- sl.setDimensions(130, 170);
+ sl.setDimensions(140, 170);
sl.addOption("1. Live TV", 1);
sl.addOption("2. Radio", 0);
sl.addOption("3. Recordings", 0);
- sl.addOption("4. Stand by", 0);
- sl.addOption("5. Reboot", 0);
+ sl.addOption("4. Options", 0);
+ sl.addOption("5. Stand by", 0);
+ sl.addOption("6. Reboot", 0);
- jpeg.setScreenPos(screenX + 240, screenY + 50);
+ jpeg.setScreenPos(screenX + 240, screenY + 60);
}
VWelcome::~VWelcome()
int VWelcome::handleCommand(int command)
{
- if (command == Remote::UP)
+ switch(command)
{
- sl.up();
- sl.draw();
- show();
- return 2;
- }
- else if (command == Remote::DOWN)
- {
- sl.down();
- sl.draw();
- show();
- return 2;
- }
- else if (command == Remote::ONE)
- {
- doChannelsList();
- return 2;
- }
- else if (command == Remote::TWO)
- {
- doRadioList();
- return 2;
- }
- else if (command == Remote::THREE)
- {
- doRecordingsList();
- return 2;
- }
- else if (command == Remote::FOUR)
- {
- Message* m = new Message();
- m->message = Message::STANDBY;
- Command::getInstance()->postMessage(m);
- return 4;
- }
- else if (command == Remote::FIVE)
- {
- Command::getInstance()->doReboot();
- }
- else if (command == Remote::OK)
- {
- int option = sl.getCurrentOption();
- if (option == 0)
+ case Remote::DF_UP:
+ case Remote::UP:
+ {
+ sl.up();
+ sl.draw();
+ show();
+ return 2;
+ }
+ case Remote::DF_DOWN:
+ case Remote::DOWN:
+ {
+ sl.down();
+ sl.draw();
+ show();
+ return 2;
+ }
+ case Remote::ONE:
{
doChannelsList();
return 2;
}
- else if (option == 1)
+ case Remote::TWO:
{
doRadioList();
return 2;
}
- else if (option == 2)
+ case Remote::THREE:
{
doRecordingsList();
return 2;
}
- else if (option == 3)
+ case Remote::FOUR:
+ {
+ doOptions();
+ return 2;
+ }
+ case Remote::FIVE:
{
Message* m = new Message();
m->message = Message::STANDBY;
Command::getInstance()->postMessage(m);
return 4;
}
- else if (option == 4)
+ case Remote::SIX:
{
Command::getInstance()->doReboot();
- return 2;
+ }
+ case Remote::OK:
+ {
+ int option = sl.getCurrentOption();
+ if (option == 0)
+ {
+ doChannelsList();
+ return 2;
+ }
+ else if (option == 1)
+ {
+ doRadioList();
+ return 2;
+ }
+ else if (option == 2)
+ {
+ doRecordingsList();
+ return 2;
+ }
+ else if (option == 3)
+ {
+ doOptions();
+ return 2;
+ }
+ else if (option == 4)
+ {
+ Message* m = new Message();
+ m->message = Message::STANDBY;
+ Command::getInstance()->postMessage(m);
+ return 4;
+ }
+ else if (option == 5)
+ {
+ Command::getInstance()->doReboot();
+ return 2;
+ }
+ return 2; // never gets here
}
}
viewman->removeView(viewWait, 1, 1);
Log::getInstance()->log("VWelcome", Log::DEBUG, "possible delay end");
}
+
+void VWelcome::doOptions()
+{
+ VOptions* voptions = new VOptions();
+ ViewMan::getInstance()->addNoLock(voptions);
+ voptions->draw();
+ voptions->show();
+}
#include "message.h"
#include "colour.h"
#include "video.h"
+#include "voptions.h"
class VWelcome : public View
{
void doChannelsList();
void doRadioList();
void doRecordingsList();
+ void doOptions();
};
#endif
{
Log* logger = Log::getInstance();
- logger->log("BJpeg", Log::DEBUG, "Here1");
-
FILE* infile = fopen(fileName, "r");
if (infile == NULL)
{
--- /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 "woptionbox.h"
+
+WOptionBox::WOptionBox()
+{
+ numOptions = 0;
+ options = NULL;
+ active = 0;
+ currentOption = 0;
+}
+
+WOptionBox::~WOptionBox()
+{
+ if (!options) return;
+
+ for(UINT i = 0; i < numOptions; i++) delete[] options[i];
+ free(options);
+}
+
+void WOptionBox::addOption(char* takeText)
+{
+ int length = strlen(takeText);
+ char* newOption = new char[length + 1];
+ strcpy(newOption, takeText);
+
+ options = (char**)realloc(options, numOptions * sizeof(char*));
+ options[numOptions] = newOption;
+
+ numOptions++;
+}
+
+void WOptionBox::setActive(UCHAR tactive)
+{
+ active = tactive;
+}
+
+void WOptionBox::draw()
+{
+ if (active)
+ {
+ fillColour(Colour::SELECTHIGHLIGHT);
+ drawText(options[currentOption], 0, 0, Colour::DARKTEXT);
+ }
+ else
+ {
+ fillColour(Colour::BUTTONBACKGROUND);
+ drawText(options[currentOption], 0, 0, Colour::LIGHTTEXT);
+ }
+}
+
+void WOptionBox::left()
+{
+ if (currentOption == 0) return;
+ --currentOption;
+}
+
+void WOptionBox::right()
+{
+ if (currentOption == (numOptions - 1)) return;
+ ++currentOption;
+}
+
+void WOptionBox::cycle()
+{
+ if (currentOption == (numOptions - 1))
+ {
+ currentOption = 0;
+ }
+ else
+ {
+ ++currentOption;
+ }
+}
+
+void WOptionBox::setSelected(char* toSelect)
+{
+ for(UINT i = 0; i < numOptions; i++)
+ {
+ if (!strcmp(toSelect, options[i]))
+ {
+ currentOption = i;
+ return;
+ }
+ }
+ currentOption = 0;
+}
+
+char* WOptionBox::getSelected()
+{
+ return options[currentOption];
+}
--- /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 WOPTIONBOX_H
+#define WOPTIONBOX_H
+
+#include <stdlib.h>
+
+#include "defines.h"
+#include "box.h"
+#include "colour.h"
+
+class WOptionBox : public Box
+{
+ public:
+ WOptionBox();
+ ~WOptionBox();
+ void addOption(char* newOption);
+ void setSelected(char* selectedOption);
+ char* getSelected();
+ void setActive(UCHAR tactive);
+ void left();
+ void right();
+ void cycle();
+ void draw();
+
+ private:
+ UCHAR active;
+ UINT numOptions;
+ char** options;
+ UINT currentOption;
+};
+
+#endif
#include "wsymbol.h"
-UCHAR WSymbol::widths[] = { 2, 2, 4, 4, 1, 1, 3, 3, 3, 3, 3, 4, 4 };
-UCHAR WSymbol::heights[] = { 8, 8, 12, 12, 24, 4, 18, 18, 18, 18, 18, 30, 30 };
+UCHAR WSymbol::widths[] = { 2, 2, 4, 4, 1, 1, 3, 3, 3, 3, 3, 4, 4, 2, 2};
+UCHAR WSymbol::heights[] = { 8, 8, 12, 12, 24, 4, 18, 18, 18, 18, 18, 30, 30, 16, 16};
UCHAR WSymbol::symbols[] = {
0x00, 0x01, 0xC0, 0x00,
0x00, 0x00, 0xC0, 0x00,
0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00
+0x00, 0x00, 0x00, 0x00,
+
+/*
+00000000 00000011
+00000000 00001111
+00000000 00111111
+00000000 11111111
+00000011 11111111
+00001111 11111111
+00111111 11111111
+11111111 11111111
+11111111 11111111
+00111111 11111111
+00001111 11111111
+00000011 11111111
+00000000 11111111
+00000000 00111111
+00000000 00001111
+00000000 00000011
+*/
+
+0x00, 0x03,
+0x00, 0x07,
+0x00, 0x3F,
+0x00, 0xFF,
+0x03, 0xFF,
+0x07, 0xFF,
+0x3F, 0xFF,
+0xFF, 0xFF,
+0xFF, 0xFF,
+0x3F, 0xFF,
+0x07, 0xFF,
+0x03, 0xFF,
+0x00, 0xFF,
+0x00, 0x3F,
+0x00, 0x07,
+0x00, 0x03,
+
+/*
+11000000 00000000
+11110000 00000000
+11111100 00000000
+11111111 00000000
+11111111 11000000
+11111111 11110000
+11111111 11111100
+11111111 11111111
+11111111 11111111
+11111111 11111100
+11111111 11110000
+11111111 11000000
+11111111 00000000
+11111100 00000000
+11110000 00000000
+11000000 00000000
+*/
+
+0xC0, 0x00,
+0xF0, 0x00,
+0xFC, 0x00,
+0xFF, 0x00,
+0xFF, 0xC0,
+0xFF, 0xF0,
+0xFF, 0xFC,
+0xFF, 0xFF,
+0xFF, 0xFF,
+0xFF, 0xFC,
+0xFF, 0xF0,
+0xFF, 0xC0,
+0xFF, 0x00,
+0xFC, 0x00,
+0xF0, 0x00,
+0xC0, 0x00
};
nextSymbol = 0;
}
-void WSymbol::draw()
+void WSymbol::draw(Colour& colour)
{
int offset = 0;
for(int i = 0; i < nextSymbol; i++)
if ((base[bytesIn] >> (7 - bitsIn)) & 0x01)
{
- drawPixel(x, y, Colour::LIGHTTEXT);
+ drawPixel(x, y, colour);
}
}
}
public:
WSymbol();
- void draw();
+ void draw(Colour& colour = Colour::LIGHTTEXT);
UCHAR nextSymbol;
const static UCHAR VOLUME = 0;
const static UCHAR PLAY = 10;
const static UCHAR MUTE = 11;
const static UCHAR UNMUTE = 12;
+ const static UCHAR LEFTARROW = 13;
+ const static UCHAR RIGHTARROW = 14;
private:
static UCHAR symbols[];