vinfo.o vwallpaper.o vvolume.o vrecordinglist.o vlivebanner.o vmute.o \
vtimerlist.o vtimeredit.o voptionsmenu.o vrecordingmenu.o vquestion.o \
vchannellist.o vwelcome.o vvideolive.o vvideorec.o vepgsettimer.o \
- vchannelselect.o vserverselect.o vconnect.o voptions.o vepg.o \
+ vchannelselect.o vserverselect.o vconnect.o voptions.o vepg.o vrecmove.o \
widget.o wselectlist.o wjpeg.o wsymbol.o wbutton.o woptionbox.o wtextbox.o \
fonts/helvB24.o fonts/helvB18.o \
remote.o led.o mtd.o video.o audio.o osd.o surface.o
// handleCommand(Remote::SKIPFORWARD);
// handleCommand(Remote::OK);
// handleCommand(Remote::PLAY);
+// handleCommand(Remote::OK);
+// handleCommand(Remote::DOWN);
+// handleCommand(Remote::DOWN);
+// handleCommand(Remote::DOWN);
+// handleCommand(Remote::OK);
}
}
title = NULL;
subtitle = NULL;
description = NULL;
-
- index = -1;
}
Event::~Event()
char* title;
char* subtitle;
char* description;
-
- int index;
-
};
class EventSorter
const static ULONG EPG_CLOSE = 17;
const static ULONG CHANGED_OPTIONS = 18;
const static ULONG CONNECTION_LOST = 19;
+ const static ULONG MOVE_RECORDING = 20;
};
#endif
return success;
}
+void RecMan::constructPath(char* target, Directory* dir)
+{
+ if (dir->parent)
+ {
+ constructPath(target, dir->parent);
+ strcat(target, dir->name);
+ strcat(target, "/");
+ }
+}
+
+int RecMan::moveRecording(Recording* toMove, Directory* toDir)
+{
+ char newPath[PATH_MAX];
+ strcpy(newPath, "/");
+ constructPath(&newPath[1], toDir);
+ int success = 0;
+
+ for(RecordingList::iterator i = currentDir->recList.begin(); i != currentDir->recList.end(); i++)
+ {
+ if (*i == toMove)
+ {
+ success = VDR::getInstance()->moveRecording(toMove->getFileName(), newPath);
+ //success = 1;
+ if (success == 1)
+ {
+ currentDir->recList.erase(i);
+ toDir->recList.push_back(toMove);
+ toDir->sort();
+ }
+ break;
+ }
+ }
+
+
+ return success;
+}
+
bool RecMan::isSubDir()
{
return (currentDir != rootDir);
{
return ¤tDir->recList;
}
+
+Directory* RecMan::getRootDir()
+{
+ return rootDir;
+}
void setStats(ULONG totalSpace, ULONG freeSpace, ULONG usedPercent);
void addEntry(ULONG startTime, char* name, char* filename); // modifies name
int deleteRecording(Recording* rec);
+ int moveRecording(Recording* toMove, Directory* toDir);
+
+ Directory* getRootDir();
// State functions
bool isSubDir();
Directory* rootDir;
Directory* currentDir;
+
+ void constructPath(char* target, Directory* dir) ;
};
#endif
file = NULL;
- index = -1;
+// index = -1;
directory = NULL;
name = NULL;
}
ULONG startTime;
ULONG stopTime;
- int index;
+// int index;
bool operator< (const RecTimer& op2);
{
chan = (*chanList)[i];
sprintf(str, "%lu\t%s", chan->number, chan->name);
- chan->index = sl.addOption(str, first);
+ chan->index = sl.addOption(str, (ULONG)chan, first);
first = 0;
}
}
case Remote::PLAY:
{
Channel* chan = NULL;
- if (chanList)
- {
- int currentOption = sl.getCurrentOption();
-
- for (UINT i = 0; i < chanList->size(); i++)
- {
- chan = (*chanList)[i];
- if (currentOption == chan->index) break;
- }
- }
-
+ if (chanList) chan = (Channel*)sl.getCurrentOptionData();
if (chan == NULL) return 2;
VVideoLive* v = new VVideoLive(chanList, chan->type, this);
return toReturn;
}
+int VDR::moveRecording(char* fileName, char* newPath)
+{
+ unsigned long totalLength = 8 + strlen(fileName) + 1 + strlen(newPath) + 1;
+ UCHAR* buffer = new UCHAR[totalLength];
+
+ *(unsigned long*)&buffer[0] = htonl(totalLength - 4);
+ *(unsigned long*)&buffer[4] = htonl(VDR_MOVERECORDING);
+ strcpy((char*)&buffer[8], fileName);
+ strcpy((char*)&buffer[8 + strlen(fileName) + 1], newPath);
+
+ MUTEX_LOCK(&mutex);
+ if (!connected) { MUTEX_UNLOCK(&mutex); return 0; }
+
+ unsigned int a = tcp->sendPacket(buffer, totalLength);
+ delete []buffer;
+
+ if (a != totalLength)
+ {
+ disconnect();
+ MUTEX_UNLOCK(&mutex);
+ return 0;
+ }
+
+ if (!getPacket())
+ {
+ MUTEX_UNLOCK(&mutex);
+ return 0;
+ }
+
+ int toReturn = (int)extractULONG();
+ freePacket();
+ MUTEX_UNLOCK(&mutex);
+
+ return toReturn;
+}
+
char* VDR::getRecordingSummary(char* fileName)
{
unsigned long totalLength = 8 + strlen(fileName) + 1;
bool getRecordingsList(RecMan* recman);
char* getRecordingSummary(char* fileName);
int deleteRecording(char* fileName);
+ int moveRecording(char* fileName, char* newPath);
ULLONG streamRecording(char* fileName);
ULLONG rescanRecording();
ULLONG positionFromFrameNumber(ULONG frameNumber);
const static ULONG VDR_SETTIMER = 15;
const static ULONG VDR_POSFROMFRAME = 16;
const static ULONG VDR_FRAMEFROMPOS = 17;
+ const static ULONG VDR_MOVERECORDING = 18;
int getPacket();
void freePacket();
chan = (*chanList)[i];\r
if (i == currentChannel)\r
first = 1;\r
- chan->index = chanListbox.addOption(chan->name, first);\r
+ chan->index = chanListbox.addOption(chan->name, 0, first);\r
first = 0;\r
}\r
chanName.setText((*chanList)[chanListbox.getCurrentOption()]->name);
{
if (views[i] == m->to)
{
- Log::getInstance()->log("ViewMan", Log::DEBUG, "sending message to view %p %p %lu", m->from, m->to, m->message);
+ Log::getInstance()->log("ViewMan", Log::DEBUG, "sending message from view %p to view %p %lu", m->from, m->to, m->message);
views[i]->processMessage(m);
return;
}
if (!eventList)
{
- sl.addOption(tr("No channel data available"), 1);
+ sl.addOption(tr("No channel data available"), 0, 1);
}
else
{
strftime(tempString2, 299, "%H:%M ", btime);
#endif
SNPRINTF(tempString, 299, "%s %s", tempString2, event->title);
- event->index = sl.addOption(tempString, first);
+ sl.addOption(tempString, (ULONG)event, first);
first = 0;
}
}
case Remote::MENU:
{
if (!eventList) return 2;
- Event* event;
- int eventListSize = eventList->size();
- for(int i = 0; i < eventListSize; i++)
+ Event* event = (Event*)sl.getCurrentOptionData();
+ Log::getInstance()->log("VLiveBanner", Log::DEBUG, "Found the option you pointed at. %s", event->title);
+ // First, cancel my delete timer
+ Timers::getInstance()->cancelTimer(this, 1); // if it exists
+
+ VInfo* vi = new VInfo();
+ vi->setTitleText(event->title);
+ vi->setBorderOn(1);
+ vi->setExitable();
+ if (event->description) vi->setMainText(event->description);
+ else vi->setMainText(tr("Summary unavailable"));
+ if (Video::getInstance()->getFormat() == Video::PAL)
+ {
+ vi->setScreenPos(120, 130);
+ }
+ else
{
- event = (*eventList)[i];
- if (event->index == sl.getCurrentOption())
- {
- Log::getInstance()->log("VLiveBanner", Log::DEBUG, "Found the option you pointed at. %s", event->title);
- // First, cancel my delete timer
- Timers::getInstance()->cancelTimer(this, 1); // if it exists
-
- VInfo* vi = new VInfo();
- vi->setTitleText(event->title);
- vi->setBorderOn(1);
- vi->setExitable();
- if (event->description) vi->setMainText(event->description);
- else vi->setMainText(tr("Summary unavailable"));
- if (Video::getInstance()->getFormat() == Video::PAL)
- {
- vi->setScreenPos(120, 130);
- }
- else
- {
- vi->setScreenPos(110, 90);
- }
- vi->create(510, 270);
- vi->draw();
-
- ViewMan::getInstance()->add(vi);
- ViewMan::getInstance()->updateView(vi);
-
- return 2;
-
- }
+ vi->setScreenPos(110, 90);
}
- return 2; // should not get here
+ vi->create(510, 270);
+ vi->draw();
+
+ ViewMan::getInstance()->add(vi);
+ ViewMan::getInstance()->updateView(vi);
+
+ return 2;
}
case Remote::GUIDE:
case Remote::RED:
--- /dev/null
+/*
+ Copyright 2006 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 "vrecmove.h"
+
+VRecMove::VRecMove(RecMan* trecman)
+{
+ recman = trecman;
+
+ create(260, 210);
+ if (Video::getInstance()->getFormat() == Video::PAL)
+ {
+ setScreenPos(220, 160);
+ }
+ else
+ {
+ setScreenPos(210, 130);
+ }
+
+ setBackgroundColour(Colour::VIEWBACKGROUND);
+ setTitleBarOn(1);
+ setBorderOn(1);
+ setTitleText(tr("Move recording"));
+ setTitleBarColour(Colour::TITLEBARBACKGROUND);
+
+ sl.setSurface(surface);
+ sl.setSurfaceOffset(10, 30 + 5);
+ sl.setDimensions(area.w - 40, area.h - 30 - 15);
+
+ Directory* dir = recman->getRootDir();
+ sl.addOption("/", (ULONG)dir, 1);
+ addDirs(dir, "");
+}
+
+VRecMove::~VRecMove()
+{
+}
+
+void VRecMove::setParent(View* tparent)
+{
+ parent = tparent;
+}
+
+void VRecMove::addDirs(Directory* dir, char* prefix)
+{
+ Directory* currentDir;
+ for(DirectoryList::iterator i = dir->dirList.begin(); i != dir->dirList.end(); i++)
+ {
+ currentDir = *i;
+ char* title = new char[strlen(prefix) + strlen(currentDir->name) + 2]; // one for the null, one for '/'
+ sprintf(title, "%s%s", prefix, currentDir->name);
+ sl.addOption(title, (ULONG)currentDir, 0);
+
+ strcat(title, "/");
+ addDirs(*i, title);
+ delete[] title;
+ }
+}
+
+void VRecMove::draw()
+{
+ View::draw();
+ sl.draw();
+
+ rectangle(area.w - 30, 30 + 5, 20, area.h - 30 - 15, Colour::VIEWBACKGROUND);
+ WSymbol w;
+ w.setSurface(surface);
+
+ w.nextSymbol = WSymbol::SMALLUP;
+ w.setSurfaceOffset(area.w - 28, 30 + 7);
+ w.draw();
+
+ w.nextSymbol = WSymbol::SMALLDOWN;
+ w.setSurfaceOffset(area.w - 28, area.h - 26);
+ w.draw();
+}
+
+int VRecMove::handleCommand(int command)
+{
+ switch(command)
+ {
+ case Remote::DF_UP:
+ case Remote::UP:
+ {
+ sl.up();
+ sl.draw();
+ ViewMan::getInstance()->updateView(this);
+ return 2;
+ }
+ case Remote::DF_DOWN:
+ case Remote::DOWN:
+ {
+ sl.down();
+ sl.draw();
+ ViewMan::getInstance()->updateView(this);
+ return 2;
+ }
+ case Remote::OK:
+ {
+ Message* m = new Message();
+ m->message = Message::MOVE_RECORDING;
+ m->to = parent;
+ m->parameter = sl.getCurrentOptionData();
+ ViewMan::getInstance()->postMessage(m);
+
+ return 4;
+ }
+ case Remote::BACK:
+ {
+ return 4;
+ }
+ }
+ // stop command getting to any more views
+ return 1;
+}
--- /dev/null
+/*
+ Copyright 2006 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 VRECMOVE_H
+#define VRECMOVE_H
+
+#include <stdio.h>
+#include <string.h>
+
+#include "defines.h"
+#include "view.h"
+#include "recording.h"
+#include "wselectlist.h"
+#include "remote.h"
+#include "vinfo.h"
+#include "colour.h"
+#include "video.h"
+#include "i18n.h"
+#include "command.h"
+#include "directory.h"
+#include "message.h"
+#include "viewman.h"
+
+class VRecMove : public View
+{
+ public:
+ VRecMove(RecMan* recman);
+ ~VRecMove();
+ void setParent(View* parent);
+
+ int handleCommand(int command);
+ void draw();
+
+ private:
+ View* parent;
+ RecMan* recman;
+ WSelectList sl;
+ void addDirs(Directory* dir, char* prefix);
+};
+
+#endif
{
currentSubDir = *i;
SNPRINTF(tempA, 299, tr("<dir> %lu\t%s"), currentSubDir->getNumRecordings(), currentSubDir->name);
- currentSubDir->index = sl.addOption(tempA, first);
+ currentSubDir->index = sl.addOption(tempA, 0, first);
first = 0;
}
strftime(tempA, 299, "%d/%m %H:%M ", btime);
#endif
sprintf(tempB, "%s\t%s", tempA, currentRec->getProgName());
- currentRec->index = sl.addOption(tempB, first);
+ currentRec->index = sl.addOption(tempB, 0, first);
first = 0;
}
return;
}
+ if (m->message == Message::MOVE_RECORDING)
+ {
+ Log::getInstance()->log("VRecordingList", Log::DEBUG, "Doing move recording");
+ doMoveRecording((Directory*)m->parameter);
+ return;
+ }
+
if (m->message == Message::PLAY_SELECTED_RECORDING)
{
doPlay();
{
Recording* toDelete = getCurrentOptionRecording();
- if (toDelete)
+ if (!toDelete) return;
+
+ Log::getInstance()->log("VRecordingList", Log::DEBUG, "FOUND: %i %s %s", toDelete->index, toDelete->getProgName(), toDelete->getFileName());
+
+ int success = recman->deleteRecording(toDelete);
+ if (!VDR::getInstance()->isConnected())
{
- Log::getInstance()->log("VRecordingList", Log::DEBUG, "FOUND: %i %s %s", toDelete->index, toDelete->getProgName(), toDelete->getFileName());
+ Command::getInstance()->connectionLost();
+ return;
+ }
- int success = recman->deleteRecording(toDelete);
- if (!VDR::getInstance()->isConnected())
- {
- Command::getInstance()->connectionLost();
- return;
- }
+ if (success != 1)
+ {
+ VInfo* vi = new VInfo();
+ vi->create(360, 200);
+ if (Video::getInstance()->getFormat() == Video::PAL)
+ vi->setScreenPos(190, 170);
+ else
+ vi->setScreenPos(180, 120);
+ vi->setOneLiner(tr("Failed to delete recording"));
+ vi->setExitable();
+ vi->setBorderOn(1);
+ vi->setTitleBarColour(Colour::DANGER);
+ vi->okButton();
+ vi->draw();
+ viewman->add(vi);
+ viewman->updateView(vi);
+ }
+ else
+ {
+ draw();
+ viewman->updateView(this);
+ }
- if (success != 1)
- {
- VInfo* vi = new VInfo();
- vi->create(360, 200);
- if (Video::getInstance()->getFormat() == Video::PAL)
- vi->setScreenPos(190, 170);
- else
- vi->setScreenPos(180, 120);
- vi->setOneLiner(tr("Failed to delete recording"));
- vi->setExitable();
- vi->setBorderOn(1);
- vi->setTitleBarColour(Colour::DANGER);
- vi->okButton();
- vi->draw();
- viewman->add(vi);
- viewman->updateView(vi);
- }
+}
+
+void VRecordingList::doMoveRecording(Directory* toDir)
+{
+ Recording* toMove = getCurrentOptionRecording();
+ if (!toMove || !toDir) return;
+
+ Log::getInstance()->log("VRecordingList", Log::DEBUG, "MOVE: %s %s", toMove->getProgName(), toDir->name);
+
+ int success = recman->moveRecording(toMove, toDir);
+ if (!VDR::getInstance()->isConnected())
+ {
+ Command::getInstance()->connectionLost();
+ return;
+ }
+
+ if (success != 1)
+ {
+ VInfo* vi = new VInfo();
+ vi->create(360, 200);
+ if (Video::getInstance()->getFormat() == Video::PAL)
+ vi->setScreenPos(190, 170);
else
- {
- draw();
- viewman->updateView(this);
- }
+ vi->setScreenPos(180, 120);
+ vi->setOneLiner(tr("Failed to move recording"));
+ vi->setExitable();
+ vi->setBorderOn(1);
+ vi->setTitleBarColour(Colour::DANGER);
+ vi->okButton();
+ vi->draw();
+ viewman->add(vi);
+ viewman->updateView(vi);
+ }
+ else
+ {
+ draw();
+ viewman->updateView(this);
}
}
{
Log::getInstance()->log("VRecordingList", Log::DEBUG, "Found the option you pointed at. %s %s", current->getProgName(), current->getFileName());
- VRecordingMenu* v = new VRecordingMenu();
+ VRecordingMenu* v = new VRecordingMenu(recman);
v->setParent(this);
v->setRecording(current);
v->draw();
void doDeleteSelected();
int doPlay();
int doResume();
+ void doMoveRecording(Directory* toDir);
Recording* getCurrentOptionRecording();
stack<int> slIndexStack;
#include "vrecordingmenu.h"
-VRecordingMenu::VRecordingMenu()
+VRecordingMenu::VRecordingMenu(RecMan* trecman)
{
rec = NULL;
+ recman = trecman;
- create(200, 140);
+ create(200, 164);
if (Video::getInstance()->getFormat() == Video::PAL)
{
setScreenPos(260, 190);
sl.setSurface(surface);
sl.setSurfaceOffset(10, 30 + 5);
sl.setDimensions(area.w - 20, area.h - 30 - 15);
- sl.addOption(tr("Play"), 1);
- sl.addOption(tr("Resume"), 0);
- sl.addOption(tr("Summary"), 0);
- sl.addOption(tr("Delete"), 0);
+ sl.addOption(tr("Play"), 1, 1);
+ sl.addOption(tr("Resume"), 2, 0);
+ sl.addOption(tr("Summary"), 3, 0);
+ sl.addOption(tr("Move"), 4, 0);
+ sl.addOption(tr("Delete"), 5, 0);
}
VRecordingMenu::~VRecordingMenu()
}
case Remote::OK:
{
- if (sl.getCurrentOption() == 0)
+ if (sl.getCurrentOptionData() == 1)
{
Message* m = new Message(); // Must be done after this view deleted
m->from = this;
return 4;
}
- if (sl.getCurrentOption() == 1)
+ if (sl.getCurrentOptionData() == 2)
{
Message* m = new Message(); // Must be done after this view deleted
m->from = this;
return 4;
}
- if (sl.getCurrentOption() == 2)
+ if (sl.getCurrentOptionData() == 3)
{
char* summary = VDR::getInstance()->getRecordingSummary(rec->getFileName());
if (!summary && !VDR::getInstance()->isConnected())
return 2;
}
- else if (sl.getCurrentOption() == 3)
+
+ if (sl.getCurrentOptionData() == 4)
+ {
+ VRecMove* vrm = new VRecMove(recman);
+ vrm->setParent(this);
+ vrm->draw();
+ ViewMan::getInstance()->add(vrm);
+ ViewMan::getInstance()->updateView(vrm);
+ return 2;
+ }
+
+ if (sl.getCurrentOptionData() == 5)
{
VQuestion* v = new VQuestion(this);
v->create(260, 180);
ViewMan::getInstance()->postMessage(m2);
}
}
+ else if (m->message == Message::MOVE_RECORDING)
+ {
+ Message* m2 = new Message(); // Delete self
+ m2->from = this;
+ m2->to = ViewMan::getInstance();
+ m2->message = Message::CLOSE_ME;
+ ViewMan::getInstance()->postMessage(m2);
+
+ m2 = new Message();
+ m2->from = this;
+ m2->to = vRecList;
+ m2->message = Message::MOVE_RECORDING;
+ m2->parameter = m->parameter;
+ ViewMan::getInstance()->postMessage(m2);
+ }
}
#include "video.h"
#include "i18n.h"
#include "command.h"
+#include "vrecmove.h"
class VRecordingList;
class VRecordingMenu : public View
{
public:
- VRecordingMenu();
+ VRecordingMenu(RecMan* recman);
~VRecordingMenu();
void setParent(VRecordingList* tvRecList);
void setRecording(Recording* rec);
void draw();
private:
-
+ RecMan* recman;
WSelectList sl;
VRecordingList* vRecList;
Recording* rec;
sl.setSurfaceOffset(10, 30 + 5);
sl.setDimensions(area.w - 20, area.h - 30 - 15);
- sl.addOption(servers[0].name, 1);
+ sl.addOption(servers[0].name, 0, 1);
for(UINT k = 1; k < servers.size(); k++)
{
- sl.addOption(servers[k].name, 0);
+ sl.addOption(servers[k].name, 0, 0);
}
replyTo = treplyTo;
btime = localtime((time_t*)&recTimer->startTime);
strftime(strA, 299, "%d/%m %H:%M ", btime);
SNPRINTF(strB, 299, "%s\t%s", strA, recTimer->getName());
- recTimer->index = sl.addOption(strB, first);
+ sl.addOption(strB, (ULONG)recTimer, first);
first = 0;
}
}
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 (recTimerList) recTimer = (RecTimer*)sl.getCurrentOptionData();
+// {
+// 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;
{
sl.clear();
setTitleText(tr("Welcome"));
- sl.addOption(tr("1. Live TV"), 1);
- sl.addOption(tr("2. Radio"), 0);
- sl.addOption(tr("3. Recordings"), 0);
- sl.addOption(tr("4. Timers"), 0);
- sl.addOption(tr("5. Options"), 0);
- sl.addOption(tr("6. Reboot"), 0);
+ sl.addOption(tr("1. Live TV"), 1, 1);
+ sl.addOption(tr("2. Radio"), 2, 0);
+ sl.addOption(tr("3. Recordings"), 3, 0);
+ sl.addOption(tr("4. Timers"), 4, 0);
+ sl.addOption(tr("5. Options"), 5, 0);
+ sl.addOption(tr("6. Reboot"), 6, 0);
}
void VWelcome::draw()
}
case Remote::OK:
{
- int option = sl.getCurrentOption();
- if (option == 0)
+ ULONG option = sl.getCurrentOptionData();
+ if (option == 1)
{
doChannelsList();
return 2;
}
- else if (option == 1)
+ else if (option == 2)
{
doRadioList();
return 2;
}
- else if (option == 2)
+ else if (option == 3)
{
doRecordingsList();
return 2;
}
- else if (option == 3)
+ else if (option == 4)
{
doTimersList();
return 2;
}
- else if (option == 4)
+ else if (option == 5)
{
doOptions();
return 2;
}
- else if (option == 5)
+ else if (option == 6)
{
Command::getInstance()->doReboot();
return 2;
int vsize = options.size();
for (int i = 0; i < vsize; i++)
{
- delete[] options[i];
+ delete[] options[i].text;
}
options.clear();
topOption = idx;
}
-int WSelectList::addOption(char* text, int selected)
+int WSelectList::addOption(char* text, ULONG data, int selected)
{
int thisNewOption = options.size();
- int length = strlen(text);
- options.push_back(new char[length + 1]);
- strcpy(options[thisNewOption], text);
+
+ wsloption wslo;
+ wslo.text = new char[strlen(text) + 1];
+ strcpy(wslo.text, text);
+ wslo.data = data;
+ options.push_back(wslo);
if (selected) selectedOption = thisNewOption;
return thisNewOption;
}
if (i == selectedOption)
{
rectangle(0, ypos, area.w, fontHeight, Colour::SELECTHIGHLIGHT);
- drawOptionLine(options[i], 5, ypos, Colour::DARKTEXT);
+ drawOptionLine(options[i].text, 5, ypos, Colour::DARKTEXT);
}
else
{
- drawOptionLine(options[i], 5, ypos, Colour::LIGHTTEXT);
+ drawOptionLine(options[i].text, 5, ypos, Colour::LIGHTTEXT);
}
ypos += ySeperation;
}
{
return selectedOption;
}
+
+ULONG WSelectList::getCurrentOptionData()
+{
+ return options[selectedOption].data;
+}
using namespace std;
+typedef struct
+{
+ char* text;
+ ULONG data;
+} wsloption;
+
class WSelectList : public Widget
{
public:
void addColumn(int x);
void setNoLoop();
- int addOption(char* text, int selected);
+ int addOption(char* text, ULONG data, int selected);
void draw();
void down();
int getNumOptions();
int getBottomOption(); // actually returns bottom + 1 i.e. the one just past display ?!
int getCurrentOption();
+ ULONG getCurrentOptionData();
void hintSetCurrent(int index);
void hintSetTop(int index);
private:
void drawOptionLine(char* text, int xpos, int ypos, Colour& colour);
- vector<char*> options;
+ vector<wsloption> options;
UINT selectedOption;
int topOption;
UINT numOptionsDisplayable;
#include "wsymbol.h"
-UCHAR WSymbol::widths[] = { 2, 2, 4, 4, 1, 1, 3, 3, 3, 3, 3, 4, 4, 2, 2, 3, 5, 5, 4, 4};
-UCHAR WSymbol::heights[] = { 8, 8, 12, 12, 24, 4, 18, 18, 18, 18, 18, 30, 30, 16, 16, 18, 18, 18, 16, 16};
+UCHAR WSymbol::widths[] = { 2, 2, 4, 4, 1, 1, 3, 3, 3, 3, 3, 4, 4, 2, 2, 3, 5, 5, 4, 4, 2, 2};
+UCHAR WSymbol::heights[] = { 8, 8, 12, 12, 24, 4, 18, 18, 18, 18, 18, 30, 30, 16, 16, 18, 18, 18, 16, 16, 8, 8};
UCHAR WSymbol::symbols[] = {
0xF0, 0x00, 0xF0, 0x00,
0xC0, 0x00, 0xC0, 0x00,
+/*
+00000001 10000000
+00000011 11000000
+00000110 01100000
+00001100 00110000
+00011000 00011000
+00110000 00001100
+01100000 00000110
+11000000 00000011
+*/
+
+0x01, 0x80,
+0x03, 0xC0,
+0x06, 0x60,
+0x0C, 0x30,
+0x18, 0x18,
+0x30, 0x0C,
+0x60, 0x06,
+0xC0, 0x03,
+
+/*
+11000000 00000011
+01100000 00000110
+00110000 00001100
+00011000 00011000
+00001100 00110000
+00000110 01100000
+00000011 11000000
+00000001 10000000
+*/
+
+0xC0, 0x03,
+0x60, 0x06,
+0x30, 0x0C,
+0x18, 0x18,
+0x0C, 0x30,
+0x06, 0x60,
+0x03, 0xC0,
+0x01, 0x80,
+
};
WSymbol::WSymbol()
const static UCHAR SKIPFORWARD2 = 17;
const static UCHAR FBWD = 18;
const static UCHAR FFWD = 19;
+ const static UCHAR SMALLUP = 20;
+ const static UCHAR SMALLDOWN = 21;
private:
static UCHAR symbols[];