From dfc5d342b351eb29cc82f0ad1b1f6f5bc738bf42 Mon Sep 17 00:00:00 2001 From: Chris Tallon Date: Wed, 7 Dec 2005 23:03:00 +0000 Subject: [PATCH] Switch over to updateView rather than show, EPG tweaks --- box.cc | 4 +-- box.h | 8 ++--- command.cc | 15 +++++---- vchannellist.cc | 12 +++---- vchannelselect.cc | 2 +- vconnect.cc | 9 +++--- vepg.cc | 80 ++++++++++++++++++++++++++++++++--------------- vepg.h | 2 ++ view.h | 2 +- viewman.cc | 7 +++-- vlivebanner.cc | 12 +++---- vmute.cc | 2 +- voptions.cc | 14 +++++---- voptions.h | 1 + vquestion.cc | 4 +-- vrecordinglist.cc | 25 ++++++++------- vrecordinglist.h | 1 + vrecordingmenu.cc | 13 ++++---- vserverselect.cc | 4 +-- vvideolive.cc | 8 ++--- vvolume.cc | 4 +-- vwelcome.cc | 49 +++++++++-------------------- vwelcome.h | 2 ++ 23 files changed, 149 insertions(+), 131 deletions(-) diff --git a/box.cc b/box.cc index 3c7a5d5..2a72bc5 100644 --- a/box.cc +++ b/box.cc @@ -62,10 +62,10 @@ void Box::setSurfaceOffset(UINT x, UINT y) void Box::show() { - show(area); + blt(area); } -void Box::show(Region& r) +void Box::blt(Region& r) { Log::getInstance()->log("Box", Log::DEBUG, "Show region %p %u %u %u %u", surface, r.x, r.y, r.w, r.h); // surface->updateToScreen(area.x, area.y, area.w, area.h); diff --git a/box.h b/box.h index 50d5598..b9ea1a3 100644 --- a/box.h +++ b/box.h @@ -35,11 +35,11 @@ class Box Box(); virtual ~Box(); - void setScreenPos(int x, int y); + void setScreenPos(int x, int y); // Even numbers only!!! void setSurfaceOffset(UINT x, UINT y); - void show(); - void show(Region& r); + void show(); // Obselete + void blt(Region& r); // For use only by ViewMan virtual void draw(); @@ -48,7 +48,7 @@ class Box void drawPara(char* text, int x, int y, Colour& colour); // Drawing functions level 0 - void rectangle(int x1, int y1, int x2, int y2, Colour& colour); + void rectangle(int x1, int y1, int w, int h, Colour& colour); void drawText(char* text, int x, int y, Colour& colour); void drawTextRJ(char* text, int x, int y, Colour& colour); void drawTextCentre(char* text, int x, int y, Colour& colour); diff --git a/command.cc b/command.cc index b44106d..2ac60ad 100644 --- a/command.cc +++ b/command.cc @@ -96,8 +96,8 @@ void Command::run() v->create(video->getScreenWidth(), video->getScreenHeight()); v->setBackgroundColour(Colour::VIDEOBLUE); v->draw(); - v->show(); viewman->add(v); + viewman->updateView(v); viewman->removeView(v); // Wallpaper @@ -113,8 +113,8 @@ void Command::run() wallpaper->init("/wallpaperNTSC.jpg"); } wallpaper->draw(); - wallpaper->show(); viewman->add(wallpaper); + viewman->updateView(wallpaper); // End of startup. Lock the mutex and put the first view up @@ -246,16 +246,16 @@ void Command::handleCommand(int button) case Remote::VOLUMEDOWN: { VVolume* v = new VVolume(); - v->handleCommand(button); // this will draw+show viewman->add(v); + v->handleCommand(button); // this will draw+show return; } case Remote::MUTE: { VMute* v = new VMute(); v->draw(); - v->show(); viewman->add(v); + viewman->updateView(v); return; } case Remote::POWER: @@ -290,7 +290,7 @@ void Command::doStandby() { Video::getInstance()->signalOff(); viewman->removeAll(); - wallpaper->show(); + viewman->updateView(wallpaper); VDR::getInstance()->configSave("General", "Last Power State", "Off"); VDR::getInstance()->disconnect(); @@ -322,9 +322,8 @@ void Command::doJustConnected(VConnect* vconnect) vi->setOneLiner(tr("Connected, loading config")); vi->draw(); - vi->show(); viewman->add(vi); - + viewman->updateView(vi); VDR* vdr = VDR::getInstance(); char* config; @@ -492,6 +491,6 @@ void Command::doJustConnected(VConnect* vconnect) VWelcome* vw = new VWelcome(); vw->draw(); - vw->show(); viewman->add(vw); + viewman->updateView(vw); } diff --git a/vchannellist.cc b/vchannellist.cc index 69d2ce0..3648561 100644 --- a/vchannellist.cc +++ b/vchannellist.cc @@ -150,7 +150,7 @@ int VChannelList::handleCommand(int command) sl.draw(); doShowingBar(); - show(); + ViewMan::getInstance()->updateView(this); return 2; } case Remote::DF_DOWN: @@ -160,7 +160,7 @@ int VChannelList::handleCommand(int command) sl.draw(); doShowingBar(); - show(); + ViewMan::getInstance()->updateView(this); return 2; } case Remote::SKIPBACK: @@ -169,7 +169,7 @@ int VChannelList::handleCommand(int command) sl.draw(); doShowingBar(); - show(); + ViewMan::getInstance()->updateView(this); return 2; } case Remote::SKIPFORWARD: @@ -178,7 +178,7 @@ int VChannelList::handleCommand(int command) sl.draw(); doShowingBar(); - show(); + ViewMan::getInstance()->updateView(this); return 2; } case Remote::OK: @@ -203,9 +203,9 @@ int VChannelList::handleCommand(int command) VVideoLive* v = new VVideoLive(chanList, chan->type); v->channelChange(VVideoLive::NUMBER, chan->number); - ViewMan::getInstance()->add(v); v->draw(); - v->show(); + ViewMan::getInstance()->add(v); + ViewMan::getInstance()->updateView(v); return 2; } diff --git a/vchannelselect.cc b/vchannelselect.cc index 14b4e01..bd77315 100644 --- a/vchannelselect.cc +++ b/vchannelselect.cc @@ -111,7 +111,7 @@ int VChannelSelect::handleCommand(int command) ++numGot; draw(); - show(); + ViewMan::getInstance()->updateView(this); if (numGot == 3) { diff --git a/vconnect.cc b/vconnect.cc index dbcbb4b..eab08b1 100644 --- a/vconnect.cc +++ b/vconnect.cc @@ -74,7 +74,7 @@ void VConnect::threadMethod() { setOneLiner(tr("Locating server")); draw(); - show(); + viewman->updateView(this); vdr->findServers(serverIPs); if (!irun) @@ -94,9 +94,10 @@ void VConnect::threadMethod() VServerSelect* vs = new VServerSelect(&serverIPs); vs->setParent(this); vs->draw(); - vs->show(); viewman->add(vs); // FIXME - do this better - perhaps post message to Command // Otherwise it will be using ViewMan without the Command mutex locked + viewman->updateView(vs); + threadLock(); threadWaitForSignal(); threadUnlock(); @@ -118,7 +119,7 @@ void VConnect::threadMethod() setOneLiner(tr("Connecting to VDR")); draw(); - show(); + viewman->updateView(this); success = vdr->connect(); if (success) @@ -147,7 +148,7 @@ void VConnect::threadMethod() } draw(); - show(); + viewman->updateView(this); nanosleep(&ts, NULL); } while(!success); diff --git a/vepg.cc b/vepg.cc index 0f16515..88e38a2 100644 --- a/vepg.cc +++ b/vepg.cc @@ -35,6 +35,8 @@ VEpg::VEpg(VVideoLive* v, UINT currentChannel) { + viewman = ViewMan::getInstance(); + for(UINT listIndex = 0; listIndex < 7; listIndex++) { // initialise array of pointers to eventlist structures @@ -145,13 +147,12 @@ void VEpg::setInfo(Event* event) void VEpg::draw() { View::draw(); // draw pallet - chanListbox.draw(); - drawgrid(); - chanName.draw(); // TODO this should be dealt with by vvideolive - progTitle.draw(); - progInfo.draw(); -// Display the status and key stuff at the bottom + // Moved all the dynamic data drawing to a seperate function + + + Log::getInstance()->log("EPG", Log::DEBUG, "START TIME"); + // Display the status and key stuff at the bottom int keyx = chanListbox.getOffsetX(); int keyy = chanListbox.getOffsetY() + chanListbox.getHeight() + 2; surface->fillblt(keyx, keyy, 610, Surface::getFontHeight() * 2 + 14, surface->rgba(100, 100, 100, 255)); @@ -193,8 +194,8 @@ void VEpg::draw() drawText(tr("Guide / Back: Close"), keyx + 292 , keyy + 5, Colour::LIGHTTEXT); surface->fillblt(keyx + 290, keyy + Surface::getFontHeight() + 8, 180, Surface::getFontHeight() + 2, surface->rgba( 180, 180, 180, 255)); - Colour red = Colour(130, 0, 0); - drawText(tr("Rec: Set timer"), keyx + 292, keyy + Surface::getFontHeight() + 9, red); +// Colour red = Colour(130, 0, 0); +// drawText(tr("Rec: Set timer"), keyx + 292, keyy + Surface::getFontHeight() + 9, red); surface->fillblt(keyx + 474, keyy + 4, 128, Surface::getFontHeight() + 2, surface->rgba( 180, 180, 180, 255)); w.nextSymbol = WSymbol::PLAY; @@ -204,8 +205,35 @@ void VEpg::draw() surface->fillblt(keyx + 474, keyy + Surface::getFontHeight() + 8, 128, Surface::getFontHeight() + 2, surface->rgba( 180, 180, 180, 255)); drawText(tr("Go: Preview"), keyx + 476, keyy + Surface::getFontHeight() + 9, Colour::LIGHTTEXT); + + + Log::getInstance()->log("EPG", Log::DEBUG, "END TIME"); + + // Draw all the dynamic data + drawData(); } +void VEpg::drawData() +{ + // Not doing View::draw() every time causes + // things not to be cleared off the surface properly + // So, blank out the data area first + + rectangle( + chanListbox.getOffsetX(), + chanListbox.getOffsetY() - Surface::getFontHeight() - 3, + 610, // FIXME make this dynamic + chanListbox.getHeight() + Surface::getFontHeight() + 3, + Colour::BLACK); + + chanListbox.draw(); + drawgrid(); + chanName.draw(); // TODO this should be dealt with by vvideolive + progTitle.draw(); + progInfo.draw(); +} + + int VEpg::handleCommand(int command) { switch(command) @@ -214,24 +242,24 @@ int VEpg::handleCommand(int command) case Remote::UP: { // cursor up the channel list chanListbox.up(); - draw(); - show(); + drawData(); + viewman->updateView(this); return 2; } case Remote::DF_DOWN: case Remote::DOWN: { // cursor down the channel list chanListbox.down(); - draw(); - show(); + drawData(); + viewman->updateView(this); return 2; } case Remote::DF_LEFT: case Remote::LEFT: { // cursor left through time selTime = thisEvent.time - 1; - draw(); - show(); + drawData(); + viewman->updateView(this); return 2; } case Remote::DF_RIGHT: @@ -239,40 +267,40 @@ int VEpg::handleCommand(int command) { // cursor right through time selTime = thisEvent.time + thisEvent.duration; - draw(); - show(); + drawData(); + viewman->updateView(this); return 2; } case Remote::RED: { // cursor up one page chanListbox.pageUp(); - draw(); - show(); + drawData(); + viewman->updateView(this); return 2; } case Remote::GREEN: { // cursor down one page chanListbox.pageDown(); - draw(); - show(); + drawData(); + viewman->updateView(this); return 2; } case Remote::BLUE: { // step forward 24 hours selTime += 24 * 60 * 60; - draw(); - show(); + drawData(); + viewman->updateView(this); return 2; } case Remote::YELLOW: { // step forward 24 hours selTime -= 24 * 60 * 60; - draw(); - show(); + drawData(); + viewman->updateView(this); return 2; } case Remote::RECORD: @@ -327,7 +355,7 @@ int VEpg::handleCommand(int command) void VEpg::drawgrid() // redraws grid and select programme { -// draw the grid of programmes + // draw the grid of programmes char timeString[20]; time_t t; time(&t); // set t = now @@ -487,7 +515,7 @@ void VEpg::setCurrentChannel(char* chname) { chanName.setText(chname); chanName.draw(); - show(); + viewman->updateView(this); } void VEpg::paintCell(Event* event, int yOffset, Colour bg, Colour fg) diff --git a/vepg.h b/vepg.h index d017015..d9c786f 100644 --- a/vepg.h +++ b/vepg.h @@ -55,6 +55,7 @@ class VEpg : public View private: void setInfo(Event* event); // display details of selected programme void drawgrid(); // redraws grid and select programme + void drawData(); WSelectList chanListbox; // listbox to display available channels WTextbox progTitle; // area to display time and title of selected programme @@ -77,6 +78,7 @@ class VEpg : public View void paintCell(Event* event, int yOffset, Colour bg, Colour fg); time_t prevHour(time_t* t); VVideoLive* videoLive; + ViewMan* viewman; }; #endif diff --git a/view.h b/view.h index 430e9b0..ce97743 100644 --- a/view.h +++ b/view.h @@ -34,7 +34,7 @@ class View : public Box public: View(); virtual ~View(); - bool create(UINT width, UINT height); + bool create(UINT width, UINT height); // Even numbers only ? virtual void draw(); virtual int handleCommand(int command); diff --git a/viewman.cc b/viewman.cc index ab5ab97..f818058 100644 --- a/viewman.cc +++ b/viewman.cc @@ -132,6 +132,7 @@ void ViewMan::deleteView(int z) void ViewMan::updateView(View* toUpdate, Region* regionToUpdate) { + Log::getInstance()->log("ViewMan", Log::DEBUG, "UpdateView called"); // Get the z index of the view int z; @@ -170,7 +171,7 @@ void ViewMan::updateView(View* toUpdate, Region* regionToUpdate) { r2 = rl.front(); r2.z = z; - views[z]->show(r2); + views[z]->blt(r2); rl.pop_front(); } } @@ -184,7 +185,7 @@ void ViewMan::repaintRevealed(int x, Region r) while(!rl.empty()) { r2 = rl.front(); - views[r2.z]->show(r2); + views[r2.z]->blt(r2); rl.pop_front(); } } @@ -434,7 +435,7 @@ void ViewMan::processMessage(Message* m) View* toAdd = (View*)m->parameter; add(toAdd); toAdd->draw(); - toAdd->show(); + updateView(toAdd); } } } diff --git a/vlivebanner.cc b/vlivebanner.cc index 9b27599..fd48254 100644 --- a/vlivebanner.cc +++ b/vlivebanner.cc @@ -37,11 +37,11 @@ VLiveBanner::VLiveBanner(View* tparent, Channel* channel, bool bannerTakesComman create(500, 120); if (Video::getInstance()->getFormat() == Video::PAL) { - setScreenPos(125, 410); + setScreenPos(124, 410); } else { - setScreenPos(115, 320); + setScreenPos(114, 320); } @@ -165,7 +165,7 @@ int VLiveBanner::handleCommand(int command) sl.up(); sl.draw(); - show(); + ViewMan::getInstance()->updateView(this); // Arrows pressed, go to an 8s timer Timers::getInstance()->setTimer(this, 1, (struct timespec){8, 0}); @@ -181,7 +181,7 @@ int VLiveBanner::handleCommand(int command) sl.down(); sl.draw(); - show(); + ViewMan::getInstance()->updateView(this); // Arrows pressed, go to an 8s timer Timers::getInstance()->setTimer(this, 1, (struct timespec){8, 0}); @@ -242,10 +242,10 @@ int VLiveBanner::handleCommand(int command) vi->setScreenPos(110, 90); } vi->create(510, 270); + vi->draw(); ViewMan::getInstance()->add(vi); - vi->draw(); - vi->show(); + ViewMan::getInstance()->updateView(vi); return 2; diff --git a/vmute.cc b/vmute.cc index 46d6b1f..d4444b3 100644 --- a/vmute.cc +++ b/vmute.cc @@ -75,7 +75,7 @@ int VMute::handleCommand(int command) { isMuted = Audio::getInstance()->toggleUserMute(); draw(); - show(); + ViewMan::getInstance()->updateView(this); // handled return 2; } diff --git a/voptions.cc b/voptions.cc index 74e6827..ca26fd4 100644 --- a/voptions.cc +++ b/voptions.cc @@ -22,6 +22,8 @@ VOptions::VOptions() { + viewman = ViewMan::getInstance(); + create(530, 85+(NUM_OPTIONS*30)); if (Video::getInstance()->getFormat() == Video::PAL) { @@ -132,7 +134,7 @@ int VOptions::handleCommand(int command) --selectedOption; optionBox[selectedOption].setActive(1); draw(); - show(); + viewman->updateView(this); } return 2; } @@ -145,7 +147,7 @@ int VOptions::handleCommand(int command) ++selectedOption; optionBox[selectedOption].setActive(1); draw(); - show(); + viewman->updateView(this); } return 2; } @@ -154,7 +156,7 @@ int VOptions::handleCommand(int command) { optionBox[selectedOption].left(); draw(); - show(); + viewman->updateView(this); return 2; } case Remote::DF_RIGHT: @@ -162,7 +164,7 @@ int VOptions::handleCommand(int command) { optionBox[selectedOption].right(); draw(); - show(); + viewman->updateView(this); return 2; } case Remote::BACK: @@ -174,7 +176,7 @@ int VOptions::handleCommand(int command) { optionBox[selectedOption].cycle(); draw(); - show(); + viewman->updateView(this); } } @@ -221,7 +223,7 @@ void VOptions::doSave() Message *m = new Message(); m->to = VWelcome::getInstance(); m->message = Message::REDRAW_LANG; - ViewMan::getInstance()->postMessage(m); + viewman->postMessage(m); } if (result[2] != optionsAtStart[2]) diff --git a/voptions.h b/voptions.h index 5745110..918d4c2 100644 --- a/voptions.h +++ b/voptions.h @@ -80,6 +80,7 @@ class VOptions : public View WOptionBox optionBox[numOptions]; VDR* vdr; int* optionsAtStart; + ViewMan* viewman; }; #endif diff --git a/vquestion.cc b/vquestion.cc index de8f6ff..2b792ec 100644 --- a/vquestion.cc +++ b/vquestion.cc @@ -82,7 +82,7 @@ int VQuestion::handleCommand(int command) { swap(); draw(); - show(); + ViewMan::getInstance()->updateView(this); return 2; } case Remote::DF_RIGHT: @@ -90,7 +90,7 @@ int VQuestion::handleCommand(int command) { swap(); draw(); - show(); + ViewMan::getInstance()->updateView(this); return 2; } case Remote::BACK: diff --git a/vrecordinglist.cc b/vrecordinglist.cc index 8b5ba14..ce14abe 100644 --- a/vrecordinglist.cc +++ b/vrecordinglist.cc @@ -24,6 +24,7 @@ VRecordingList::VRecordingList(VRecordingList* tparent) { myParent = tparent; dataInvalid = 0; + viewman = ViewMan::getInstance(); create(570, 420); if (Video::getInstance()->getFormat() == Video::PAL) @@ -52,7 +53,7 @@ VRecordingList::~VRecordingList() Message* m = new Message(); m->to = myParent; m->message = Message::CHILD_CLOSE; - ViewMan::getInstance()->postMessage(m); + viewman->postMessage(m); } // only delete the list if this is not a sub dir window @@ -280,7 +281,7 @@ void VRecordingList::doDeleteSelected() Message* m1 = new Message(); m1->to = myParent; m1->message = Message::REDRAW_DATA; - ViewMan::getInstance()->postMessage(m1); + viewman->postMessage(m1); } show(); @@ -292,9 +293,9 @@ int VRecordingList::doPlay() if (toPlay) { VVideoRec* vidrec = new VVideoRec(toPlay); - ViewMan::getInstance()->add(vidrec); vidrec->draw(); - vidrec->show(); + viewman->add(vidrec); + viewman->updateView(vidrec); vidrec->go(0); return 1; } @@ -310,9 +311,9 @@ int VRecordingList::doResume() ULLONG position = VDR::getInstance()->getResumePoint(toResume->fileName); VVideoRec* vidrec = new VVideoRec(toResume); - ViewMan::getInstance()->add(vidrec); vidrec->draw(); - vidrec->show(); + viewman->add(vidrec); + viewman->updateView(vidrec); vidrec->go(position); return 1; } @@ -342,7 +343,7 @@ int VRecordingList::handleCommand(int command) sl.draw(); doShowingBar(); - show(); + viewman->updateView(this); return 2; } case Remote::DF_DOWN: @@ -352,7 +353,7 @@ int VRecordingList::handleCommand(int command) sl.draw(); doShowingBar(); - show(); + viewman->updateView(this); return 2; } case Remote::SKIPBACK: @@ -361,7 +362,7 @@ int VRecordingList::handleCommand(int command) sl.draw(); doShowingBar(); - show(); + viewman->updateView(this); return 2; } case Remote::SKIPFORWARD: @@ -370,7 +371,7 @@ int VRecordingList::handleCommand(int command) sl.draw(); doShowingBar(); - show(); + viewman->updateView(this); return 2; } case Remote::OK: @@ -386,7 +387,7 @@ int VRecordingList::handleCommand(int command) { VRecordingList* sub = new VRecordingList(this); sub->setDir(curDir); - ViewMan::getInstance()->add(sub); + viewman->add(sub); sub->draw(); sub->show(); @@ -404,7 +405,7 @@ int VRecordingList::handleCommand(int command) VRecordingMenu* v = new VRecordingMenu(); v->setParent(this); v->setRecording(current); - ViewMan::getInstance()->add(v); + viewman->add(v); v->draw(); v->show(); return 2; diff --git a/vrecordinglist.h b/vrecordinglist.h index 817901f..f3a39d9 100644 --- a/vrecordinglist.h +++ b/vrecordinglist.h @@ -55,6 +55,7 @@ class VRecordingList : public View private: VRecordingList* myParent; Directory* recDir; + ViewMan* viewman; WSelectList sl; int dataInvalid; diff --git a/vrecordingmenu.cc b/vrecordingmenu.cc index 3335ac9..23494fc 100644 --- a/vrecordingmenu.cc +++ b/vrecordingmenu.cc @@ -79,7 +79,7 @@ int VRecordingMenu::handleCommand(int command) { sl.up(); sl.draw(); - show(); + ViewMan::getInstance()->updateView(this); return 2; } case Remote::DF_DOWN: @@ -87,7 +87,7 @@ int VRecordingMenu::handleCommand(int command) { sl.down(); sl.draw(); - show(); + ViewMan::getInstance()->updateView(this); return 2; } case Remote::OK: @@ -131,10 +131,9 @@ int VRecordingMenu::handleCommand(int command) vi->setScreenPos(110, 90); } vi->create(490, 300); - - ViewMan::getInstance()->add(vi); vi->draw(); - vi->show(); + ViewMan::getInstance()->add(vi); + ViewMan::getInstance()->updateView(vi); if (summary) delete[] summary; @@ -161,9 +160,9 @@ int VRecordingMenu::handleCommand(int command) v->setScreenPos(220, 140); } - ViewMan::getInstance()->add(v); v->draw(); - v->show(); + ViewMan::getInstance()->add(v); + ViewMan::getInstance()->updateView(v); return 2; } } diff --git a/vserverselect.cc b/vserverselect.cc index 9ade764..d0dc172 100644 --- a/vserverselect.cc +++ b/vserverselect.cc @@ -72,7 +72,7 @@ int VServerSelect::handleCommand(int command) { sl.up(); sl.draw(); - show(); + ViewMan::getInstance()->updateView(this); return 2; } case Remote::DF_DOWN: @@ -80,7 +80,7 @@ int VServerSelect::handleCommand(int command) { sl.down(); sl.draw(); - show(); + ViewMan::getInstance()->updateView(this); return 2; } case Remote::OK: diff --git a/vvideolive.cc b/vvideolive.cc index 1b87978..082e7f6 100644 --- a/vvideolive.cc +++ b/vvideolive.cc @@ -135,9 +135,9 @@ int VVideoLive::handleCommand(int command) case Remote::ZERO ... Remote::NINE: { VChannelSelect* v = new VChannelSelect(this, command); - viewman->add(v); v->draw(); - v->show(); + viewman->add(v); + viewman->updateView(v); } } @@ -196,7 +196,7 @@ void VVideoLive::processMessage(Message* m) VLiveBanner* vlb = VLiveBanner::getInstance(); // guaranteed to be one vlb->setChannel((*chanList)[currentChannel]); vlb->draw(); - vlb->show(); + viewman->updateView(vlb); } } else if (m->message == Message::CHANNEL_DOWN) @@ -208,7 +208,7 @@ void VVideoLive::processMessage(Message* m) VLiveBanner* vlb = VLiveBanner::getInstance(); // guaranteed to be one vlb->setChannel((*chanList)[currentChannel]); vlb->draw(); - vlb->show(); + viewman->updateView(vlb); } } else if (m->message == Message::STREAM_END) diff --git a/vvolume.cc b/vvolume.cc index c6adf7d..b67039e 100644 --- a/vvolume.cc +++ b/vvolume.cc @@ -91,7 +91,7 @@ int VVolume::handleCommand(int command) { displayVolume = Audio::getInstance()->volumeDown(); draw(); - show(); + ViewMan::getInstance()->updateView(this); // handled return 2; } @@ -100,7 +100,7 @@ int VVolume::handleCommand(int command) { displayVolume = Audio::getInstance()->volumeUp(); draw(); - show(); + ViewMan::getInstance()->updateView(this); // handled return 2; } diff --git a/vwelcome.cc b/vwelcome.cc index cd2ebca..d18a0ce 100644 --- a/vwelcome.cc +++ b/vwelcome.cc @@ -25,6 +25,7 @@ VWelcome* VWelcome::instance = NULL; VWelcome::VWelcome() { instance = this; + viewman = ViewMan::getInstance(); clockRegion.x = 400; clockRegion.y = 0; @@ -110,33 +111,19 @@ void VWelcome::drawClock() void VWelcome::timercall(int clientReference) { drawClock(); - ViewMan::getInstance()->updateView(this, &clockRegion); + viewman->updateView(this, &clockRegion); } int VWelcome::handleCommand(int command) { switch(command) { - case Remote::NINE: - { - VInfo* viewWait = new VInfo(); - viewWait->create(100, 100); - viewWait->setScreenPos(485, 185); - viewWait->setTitleBarOn(0); - viewWait->setBackgroundColour(Colour::DANGER); - viewWait->draw(); - viewWait->show(); - ViewMan::getInstance()->add(viewWait); - - return 2; - } - case Remote::DF_UP: case Remote::UP: { sl.up(); sl.draw(); - show(); + viewman->updateView(this); return 2; } case Remote::DF_DOWN: @@ -144,7 +131,7 @@ int VWelcome::handleCommand(int command) { sl.down(); sl.draw(); - show(); + viewman->updateView(this); return 2; } case Remote::ONE: @@ -230,9 +217,9 @@ void VWelcome::doChannelsList() VChannelList* vchan = new VChannelList(VDR::VIDEO); vchan->setList(chanList); - ViewMan::getInstance()->add(vchan); vchan->draw(); - vchan->show(); + viewman->add(vchan); + viewman->updateView(vchan); // Message* m = new Message(); @@ -253,16 +240,14 @@ void VWelcome::doRadioList() VChannelList* vchan = new VChannelList(VDR::RADIO); vchan->setList(chanList); - ViewMan::getInstance()->add(vchan); vchan->draw(); - vchan->show(); + viewman->add(vchan); + viewman->updateView(vchan); } } void VWelcome::doRecordingsList() { - ViewMan* viewman = ViewMan::getInstance(); - VInfo* viewWait = new VInfo(); viewWait->create(460, 190); if (Video::getInstance()->getFormat() == Video::PAL) @@ -275,9 +260,8 @@ void VWelcome::doRecordingsList() } viewWait->setOneLiner(tr("Downloading recordings list")); viewWait->draw(); - viewWait->show(); viewman->add(viewWait); - + viewman->updateView(viewWait); VDR* vdr = VDR::getInstance(); Directory* recDir = vdr->getRecordingsList(); @@ -286,11 +270,10 @@ void VWelcome::doRecordingsList() { VRecordingList* vrec = new VRecordingList(NULL); vrec->setDir(recDir); - - ViewMan::getInstance()->add(vrec); - vrec->draw(); - vrec->show(); + + viewman->add(vrec); + viewman->updateView(vrec); } Log::getInstance()->log("VWelcome", Log::DEBUG, "possible delay start"); @@ -301,9 +284,9 @@ void VWelcome::doRecordingsList() void VWelcome::doOptions() { VOptions* voptions = new VOptions(); - ViewMan::getInstance()->add(voptions); voptions->draw(); - voptions->show(); + viewman->add(voptions); + viewman->updateView(voptions); } void VWelcome::processMessage(Message* m) @@ -313,8 +296,6 @@ void VWelcome::processMessage(Message* m) Log::getInstance()->log("VWelcome", Log::DEBUG, "Got redraw lang message"); setup(); draw(); - show(); // careful, this only works properly because the only place - // this is called from is voptions and that disappears before - // this message is delivered + viewman->updateView(this); } } diff --git a/vwelcome.h b/vwelcome.h index fb788a8..97d0b2c 100644 --- a/vwelcome.h +++ b/vwelcome.h @@ -58,6 +58,8 @@ class VWelcome : public View, public TimerReceiver WSelectList sl; WJpeg jpeg; + ViewMan* viewman; + void doChannelsList(); void doRadioList(); void doRecordingsList(); -- 2.39.5