From 772a9dd3cd137e2649a430f1e5f9293bba296850 Mon Sep 17 00:00:00 2001 From: Chris Tallon Date: Thu, 17 Jul 2008 19:57:56 +0000 Subject: [PATCH] Code cleaning --- vdr.cc | 28 ++++---------------------- vrecordinglist.cc | 5 ----- vremoteconfig.cc | 51 +++++++++++++++++++---------------------------- vvideolivetv.cc | 20 +++++++++---------- vvideorec.cc | 2 -- 5 files changed, 34 insertions(+), 72 deletions(-) diff --git a/vdr.cc b/vdr.cc index 57ef492..6b96c49 100644 --- a/vdr.cc +++ b/vdr.cc @@ -1,5 +1,5 @@ /* - Copyright 2004-2005 Chris Tallon + Copyright 2004-2008 Chris Tallon This file is part of VOMP. @@ -211,32 +211,12 @@ void VDR::threadMethod() if (!readSuccess) { - logger->log("VDR", Log::DEBUG, "Net read timeout"); + //logger->log("VDR", Log::DEBUG, "Net read timeout"); if (!tcp->isConnected()) { connectionDied(); return; } // return to stop this thread } // Error or timeout. - /* This is the simple version of timeout system until I work out how to make it better - e.g. different timeout lengths for different requests, a decent keepalive system - running in parallel etc etc. - - Ignore the stream channel - Start with lastPacketReceived = 0 - When a packet comes in, set lastPacketReceived = time(NULL) - loop - { - if last packet is over 20s ago - { - if lastKAsent is less than 20s ago, continue - - if lastKAsent = 0, send a KA, continue - - if lastKAsent is over 20s ago, connection is dead, kill it - } - } - */ - if (!lastKAsent) // have not sent a KA { if (lastKArecv < (timeNow - 5)) @@ -435,7 +415,7 @@ bool VDR::ed_cb_find(EDReceiver* edr, void* userTag) VDR_ResponsePacket* VDR::RequestResponse(VDR_RequestPacket* vrp) { - logger->log("VDR", Log::DEBUG, "RR %lu", vrp->getOpcode()); + //logger->log("VDR", Log::DEBUG, "RR %lu", vrp->getOpcode()); if (!connected) { @@ -466,7 +446,7 @@ VDR_ResponsePacket* VDR::RequestResponse(VDR_RequestPacket* vrp) } // Sleep and block this thread. The sleep unlocks the mutex - logger->log("VDR", Log::DEBUG, "RR sleep"); + logger->log("VDR", Log::DEBUG, "RR sleep - opcode %lu", vrp->getOpcode()); edSleepThisReceiver(&vdrpr); logger->log("VDR", Log::DEBUG, "RR unsleep"); diff --git a/vrecordinglist.cc b/vrecordinglist.cc index 363efc5..3894c34 100644 --- a/vrecordinglist.cc +++ b/vrecordinglist.cc @@ -392,16 +392,11 @@ int VRecordingList::handleCommand(int command) case Remote::DF_DOWN: case Remote::DOWN: { - Log::getInstance()->log("P", Log::DEBUG, "1"); sl.down(); - Log::getInstance()->log("P", Log::DEBUG, "1.5"); sl.draw(); - Log::getInstance()->log("P", Log::DEBUG, "2"); doShowingBar(); - Log::getInstance()->log("P", Log::DEBUG, "3"); boxstack->update(this); - Log::getInstance()->log("P", Log::DEBUG, "4"); return 2; } case Remote::SKIPBACK: diff --git a/vremoteconfig.cc b/vremoteconfig.cc index 8ff349a..8630e6a 100644 --- a/vremoteconfig.cc +++ b/vremoteconfig.cc @@ -157,33 +157,29 @@ void VRemoteConfig::processMessage(Message* m) } } } - } - void VRemoteConfig::doSave() { - Message* m = new Message(); - m->message = Message::CHANGED_REMOTECONTROL; - m->to = parent; - m->parameter = 0; - Command::getInstance()->postMessageNoLock(m); - + Message* m = new Message(); + m->message = Message::CHANGED_REMOTECONTROL; + m->to = parent; + m->parameter = 0; + Command::getInstance()->postMessageNoLock(m); } - int VRemoteConfig::handleCommand(int command) { if (learnmode) { - learnmode = false; - if (command == Remote::NA_LEARN) - { - initSelectList(false); - } - draw(); - viewman->updateView(this); - return 2; + learnmode = false; + if (command == Remote::NA_LEARN) + { + initSelectList(false); + } + draw(); + viewman->updateView(this); + return 2; } switch(command) { @@ -192,32 +188,25 @@ int VRemoteConfig::handleCommand(int command) { if (sl.getCurrentOption() != 0) { - sl.up(); - sl.setShowSelOption(true); - draw(); - viewman->updateView(this); - return 2; + sl.up(); + sl.setShowSelOption(true); + draw(); + viewman->updateView(this); + return 2; } else { - sl.setShowSelOption(false); - return 0; //Control to tab control + sl.setShowSelOption(false); + return 0; //Control to tab control } } case Remote::DF_DOWN: case Remote::DOWN: { - Log::getInstance()->log("P", Log::DEBUG, "1"); sl.down(); sl.setShowSelOption(true); - Log::getInstance()->log("P", Log::DEBUG, "1.5"); draw(); - Log::getInstance()->log("P", Log::DEBUG, "2"); - - - Log::getInstance()->log("P", Log::DEBUG, "3"); viewman->updateView(this); - Log::getInstance()->log("P", Log::DEBUG, "4"); return 2; } case Remote::SKIPBACK: diff --git a/vvideolivetv.cc b/vvideolivetv.cc index 9f67cb4..f18c33d 100644 --- a/vvideolivetv.cc +++ b/vvideolivetv.cc @@ -131,7 +131,7 @@ VVideoLiveTV::VVideoLiveTV(ChannelList* tchanList, ULONG initialChannelNumber, V osd.add(&clock); osdChanNum.setBackgroundColour(osdBack); - osdChanNum.setPosition(40, 4); + osdChanNum.setPosition(50, 4); osdChanNum.setSize((numberWidth*10) + 22, 30); // 10 px = width of number chars in font osd.add(&osdChanNum); @@ -141,7 +141,7 @@ VVideoLiveTV::VVideoLiveTV(ChannelList* tchanList, ULONG initialChannelNumber, V osd.add(&osdChanName); boxRed.setBackgroundColour(Colour::RED); - boxRed.setPosition(50, 104); + boxRed.setPosition(54, 104); boxRed.setSize(18, 16); osd.add(&boxRed); @@ -161,29 +161,29 @@ VVideoLiveTV::VVideoLiveTV(ChannelList* tchanList, ULONG initialChannelNumber, V osd.add(&boxBlue); textRed.setBackgroundColour(osdBack); - textRed.setPosition(boxRed.getX()+18, 98); - textRed.setSize(120, 30); + textRed.setPosition(boxRed.getX2(), 98); + textRed.setSize(boxGreen.getX() - boxRed.getX2(), 30); textRed.setText(tr("Summary")); osd.add(&textRed); if (streamType == VDR::VIDEO) { textGreen.setBackgroundColour(osdBack); - textGreen.setPosition(boxGreen.getX()+18, 98); - textGreen.setSize(120, 30); + textGreen.setPosition(boxGreen.getX2(), 98); + textGreen.setSize(boxYellow.getX() - boxGreen.getX2(), 30); textGreen.setText(tr("Audio")); osd.add(&textGreen); } textYellow.setBackgroundColour(osdBack); - textYellow.setPosition(boxYellow.getX()+18, 98); - textYellow.setSize(120, 30); + textYellow.setPosition(boxYellow.getX2(), 98); + textYellow.setSize(boxBlue.getX() - boxYellow.getX2(), 30); textYellow.setText(""); osd.add(&textYellow); textBlue.setBackgroundColour(osdBack); - textBlue.setPosition(boxBlue.getX()+18, 98); - textBlue.setSize(90, 30); + textBlue.setPosition(boxBlue.getX2(), 98); + textBlue.setSize(osd.getX2() - boxBlue.getX2(), 30); textBlue.setText(tr("EPG")); osd.add(&textBlue); diff --git a/vvideorec.cc b/vvideorec.cc index da60136..e9c0b21 100644 --- a/vvideorec.cc +++ b/vvideorec.cc @@ -826,9 +826,7 @@ void VVideoRec::removeBar() barScanHold = false; barVasHold = false; rectangle(barRegion, transparent); - Log::getInstance()->log("TEMP", Log::DEBUG, "A3"); boxstack->update(this, &barRegion); - Log::getInstance()->log("TEMP", Log::DEBUG, "A4"); } void VVideoRec::doSummary() -- 2.39.2