]> git.vomp.tv Git - vompclient.git/commitdiff
Extended recordings menu, including artwork from tvscraper
authorMarten Richter <marten.richter@freenet.de>
Sun, 31 Aug 2014 15:16:59 +0000 (17:16 +0200)
committerMarten Richter <marten.richter@freenet.de>
Sun, 31 Aug 2014 15:16:59 +0000 (17:16 +0200)
22 files changed:
boxx.cc
boxx.h
command.cc
command.h
defines.h
objects.mk
osdvector.cc
recording.cc
region.h
tvmedia.cc
tvmedia.h
vdr.cc
vdr.h
vdrcommand.h
vopts.cc
vrecordinglist.cc
vrecordinglist.h
vwelcome.cc
wselectlist.cc
wselectlist.h
wtvmedia.cc [new file with mode: 0644]
wtvmedia.h [new file with mode: 0644]

diff --git a/boxx.cc b/boxx.cc
index 2222086f87c5dd05c696af3e67a020e8b2ba2bc8..16b8e2556690584478887d52013b6fb8c7da1030 100644 (file)
--- a/boxx.cc
+++ b/boxx.cc
@@ -111,6 +111,18 @@ void Boxx::remove(Boxx* oldChild)
   Log::getInstance()->log("Boxx", Log::ERR, "Remove child box called, child %p not found", oldChild);
 }
 
+bool Boxx::overlapsVisibleChilds(Region & r)
+{
+       for(vector<Boxx*>::iterator i = children.begin(); i != children.end(); i++)
+         {
+           if ((*i)->getVisible() && r.intersects((*i)->getRegionR()))
+           {
+             return true;
+           }
+         }
+       return false;
+}
+
 void Boxx::setParent(Boxx* newParent)
 {
   parent = newParent;
@@ -259,11 +271,17 @@ int Boxx::drawPara(const char* text, int x, int y, const DrawStyle& colour,unsig
 
   textPos = 0;
   ypos = y;
+  Region tester;
+  tester.h = lineHeight;
+
+  bool haschildren = true;
+  if ( children.size() == 0) haschildren = false;
 
   while(1)
   {
     linePos = 0;
     lineWidth = 0;
+    tester.y=ypos;
     while(1)
     {
       printLine = 0;
@@ -279,7 +297,11 @@ int Boxx::drawPara(const char* text, int x, int y, const DrawStyle& colour,unsig
         break;
       }
       thisCharWidth = charWidth(cur_char);
-      if ((lineWidth + thisCharWidth) > (int)(area.w - (2 * paraMargin)))
+      tester.x = lineWidth;
+      tester.w = thisCharWidth + 10;
+
+      if ((lineWidth + thisCharWidth) > (int)(area.w - (2 * paraMargin))
+                 || (haschildren && overlapsVisibleChilds(tester)))
       {
         // this character would break the right margin
         if (cur_char == ' ')
diff --git a/boxx.h b/boxx.h
index 1b768664e8b5e6aac862fa86cde1435684b12ba4..76342e42d33aa4c8f10b676032b268779b1ab99a 100644 (file)
--- a/boxx.h
+++ b/boxx.h
@@ -147,6 +147,7 @@ class Boxx
 
     void setParent(Boxx*);    
     void blt(Region& r);
+    bool overlapsVisibleChilds(Region & r);
 
     static const int paraMargin = 10;
     UINT paraVSpace;
index ef50069268cf00ab84f2b6358a27d6659b76a761..eb7a4ea2d9f3cc048b7b09a578a81c051eb0b86f 100644 (file)
@@ -965,7 +965,6 @@ void Command::doJustConnected(VConnect* vconnect)
 
 
 
-
   // Get TV aspect ratio
 
   config = vdr->configLoad("TV", "Aspect");
@@ -1040,6 +1039,34 @@ void Command::doJustConnected(VConnect* vconnect)
   }
 
 
+  // Set recording list type
+
+  advmenues=false;
+#ifdef   ADVANCED_MENUES
+  config = vdr->configLoad("Advanced", "Menu type");
+
+  if (config)
+  {
+         if (!STRCASECMP(config, "Advanced"))
+         {
+                 logger->log("Command", Log::INFO, "Switching to Advanced menu");
+                 advmenues=true;
+
+         }
+         else
+         {
+                 logger->log("Command", Log::INFO, "Switching to Classic menu");
+                 advmenues=false;
+         }
+         delete[] config;
+  }
+  else
+  {
+         logger->log("Command", Log::INFO, "Config General/menu type not found");
+         advmenues=true;
+  }
+#endif
+
   config = vdr->configLoad("Advanced", "Disable WOL");
   if (config)
   {
index 746b01121d64d9c7bf71977dd4b237d2049b086c..22f27e7fedce57e2df030fcd0e2e88020d3e2f4d 100644 (file)
--- a/command.h
+++ b/command.h
@@ -65,6 +65,9 @@ class Command : public MessageQueue
     void sig1();
     void connectionLost();
 
+    void setAdvMenues(bool adv) {advmenues=adv;};
+    bool advMenues() { return advmenues;};
+
   private:
     void handleCommand(int);
     void doStandby();
@@ -95,6 +98,8 @@ class Command : public MessageQueue
     VInfo* connLost;
     bool crashed;
     char* server;
+
+    bool  advmenues;
         
     UDP udp;
 
index 14d0e4c680f26e8a2116c61ee17ef6b194b3c7c0..3d975e57d6934ebc209e5b1464a3d3586b05103a 100644 (file)
--- a/defines.h
+++ b/defines.h
@@ -123,6 +123,7 @@ long long getTimeMS();
   #define TV_NORM_SWITCHABLE
   #define HANDLE_VT_SWITCHING
   #define GRADIENT_DRAWING
+  #define ADVANCED_MENUES // This is for special HD versions of our menus
 
   #define PICTURE_DECODER_MAGICK
   #define PICTURE_DECODER_OMX
index 992ed97e7b8fba362fd99d2613bec6f9f185f5f4..a6dee51aed055ecb6e6750973d0de038ad2aee69 100644 (file)
@@ -5,7 +5,7 @@ OBJECTS1 = command.o  tcp.o dsock.o thread.o timers.o i18n.o       \
            player.o playerradio.o vfeed.o afeed.o                                \
            demuxer.o demuxervdr.o demuxerts.o stream.o            \
            region.o colour.o boxstack.o boxx.o tbboxx.o                          \
-           vinfo.o vquestion.o vrecordinglist.o vrecording.o                     \
+           vinfo.o vquestion.o vrecordinglist.o vrecordinglistclassic.o vrecordinglistadvanced.o vrecording.o \
            vmute.o vvolume.o vtimerlist.o vtimeredit.o vrecordingmenu.o          \
            vchannellist.o vwelcome.o vvideorec.o vepgsettimer.o                  \
            vchannelselect.o vserverselect.o vconnect.o vepg.o vrecmove.o         \
@@ -24,7 +24,7 @@ OBJECTS1 = command.o  tcp.o dsock.o thread.o timers.o i18n.o       \
            imagereader.o  mediaoptions.o mediaplayer.o  \
            serialize.o localmediafile.o   playermedia.o \
            demuxermedia.o tfeed.o vteletextview.o teletextdecodervbiebu.o        \
-           teletxt/txtfont.o mediafile.o movieinfo.o seriesinfo.o wmovieview.o wseriesview.o tvmedia.o \
+           teletxt/txtfont.o mediafile.o movieinfo.o seriesinfo.o wmovieview.o wseriesview.o tvmedia.o wtvmedia.o\
            wpictureview.o
            
 
index bacb245c25503a7f1e5ff2b9ca80685587210386..d315c081b6c3599bcf34aeed1430df33c8bcbf4a 100644 (file)
@@ -533,7 +533,15 @@ LoadIndex OsdVector::loadTVMedia(TVMediaInfo& tvmedia)
        LoadIndex index=0;
        if (tvmedias_load.find(tvmedia)==tvmedias_load.end())
        {
-               index=VDR::getInstance()->loadTVMedia(tvmedia);
+               switch (tvmedia.getType()) {
+               case 3:
+                       index=VDR::getInstance()->loadTVMediaRecThumb(tvmedia);
+                       break;
+               default:
+                       index=VDR::getInstance()->loadTVMedia(tvmedia);
+                       break;
+               }
+
                tvmedias_load[tvmedia]=index;
                tvmedias_load_inv[index]=tvmedia;
        } else {
index 5bec001e62fed94dbe14f6434f1baccaba7bfb5f..83e8ee3a852e5938d4d2402d995c0dd3f8097dec 100644 (file)
@@ -126,6 +126,8 @@ void Recording::loadRecInfo()
 
   movieInfo = NULL;
   seriesInfo = NULL;
+  movieID = 0;
+  seriesID =0;
 
   vdr->getScraperEventType(fileName, movieID, seriesID, episodeID);
   Log::getInstance()->log("Recording", Log::DEBUG, "Got Scraper EventType %d %d %d",
index 44f172df12fa411a5c99e2fe0faf3e3738aa5dfe..ad231130760e161159d1d392558c249bf264d70d 100644 (file)
--- a/region.h
+++ b/region.h
@@ -11,6 +11,11 @@ class Region
     bool overlappedBy(Region& doesthisOverlap);
 //    Region subtract(Region& other);
     Region operator + (Region& other);
+    inline bool intersects(Region  test) {
+       return  !((test.x+test.w) < x || (x + w) < test.x
+                       || (test.y+test.h) < y || (y+h) < test.y);
+    }
+
     UINT x2();
     UINT y2();
 
index 8460b5645c57bfffb8dcca59163ad648e8ed0c7c..b02ebdd4538704a5ba82f4fb3bca80b767613932 100644 (file)
@@ -31,10 +31,10 @@ TVMediaInfo::TVMediaInfo()
        type_pict=-1; // 0 full info, 1 poster, 2 poster banner, 3 poster thumb
        container=-1; // indices the dataelements with picture in movieinfo or seriesinfo
        container_member=-1; // index into the container
+       primary_name="";
 }
 
 
-
 TVMediaInfo::TVMediaInfo(const TVMediaInfo& info)
 {
        type=info.type; // movie or series
@@ -43,6 +43,7 @@ TVMediaInfo::TVMediaInfo(const TVMediaInfo& info)
        type_pict=info.type_pict; // 0 full info, 1 poster, 2 poster banner, 3 poster thumb
        container=info.container; // indices the dataelements with picture in movieinfo or seriesinfo
        container_member=info.container_member; // index into the container
+       primary_name=info.primary_name;
 
 }
 
@@ -60,6 +61,12 @@ void TVMediaInfo::setSeriesInfo(const SeriesInfo *  si)
        secondary_id=si->episode.episodeid;  //0 or episode id
 }
 
+void TVMediaInfo::setPosterThumb(const char* recname)
+{
+       type=3;
+       primary_name=recname;
+}
+
 bool operator<(const TVMediaInfo& rhs, const TVMediaInfo& lhs)
 {
        if (rhs.type==lhs.type) {
@@ -67,7 +74,11 @@ bool operator<(const TVMediaInfo& rhs, const TVMediaInfo& lhs)
                        if (rhs.secondary_id==lhs.secondary_id) {
                                if (rhs.type_pict==lhs.type_pict) {
                                        if (rhs.container==lhs.container) {
-                                               return rhs.container_member<lhs.container_member;
+                                               if (rhs.primary_name== lhs.primary_name) {
+                                                       return rhs.container_member < lhs.container_member;
+                                               } else {
+                                                       return rhs.primary_name < lhs.primary_name;
+                                               }
                                        } else {
                                                return rhs.container<lhs.container;
                                        }
@@ -85,7 +96,16 @@ bool operator<(const TVMediaInfo& rhs, const TVMediaInfo& lhs)
                        return rhs.primary_id<lhs.primary_id;
                }
 
+
        } else {
                return rhs.type < lhs.type;
        }
 }
+
+bool operator==(const TVMediaInfo& rhs, const TVMediaInfo& lhs)
+{
+       return (rhs.type==lhs.type)  && (rhs.primary_id==lhs.primary_id) &&
+            (rhs.secondary_id==lhs.secondary_id) && (rhs.type_pict==lhs.type_pict) &&
+               (rhs.container==lhs.container)  && (rhs.primary_name== lhs.primary_name)
+                                               && (rhs.container_member == lhs.container_member);
+}
index 714f30e7c200cc14f2ad68c185f8ba0f709564e8..a1cebc9857c87cf458b80fb38eaf45ac289e011f 100644 (file)
--- a/tvmedia.h
+++ b/tvmedia.h
@@ -36,20 +36,24 @@ public:
        TVMediaInfo(const TVMediaInfo& info);
 
        friend bool operator<(const TVMediaInfo& rhs, const TVMediaInfo& lhs);
+       friend bool operator==(const TVMediaInfo& rhs, const TVMediaInfo& lhs);
 
        void setSeasonThumb() { type_pict=2; container=0; container_member=0;};
        void setPosterThumb() { type_pict=1; container=0; container_member=0;};
        void setElement(int cont,int memb) { type_pict=0; container=cont; container_member=memb;};
        void setMovieInfo(const MovieInfo * mi);
        void setSeriesInfo(const SeriesInfo * si);
+       void setPosterThumb(const char* recname);
+       int getType() {return type;};
 
 private:
-       int type; // movie or series
+       int type; // movie or series or unknown recording
        int primary_id; //movie or series_id
        int secondary_id;  //0 or episode id
        int type_pict; // 0 full info, 1 poster thumb, 2 season thumb
        int container; // indices the dataelements with picture in movieinfo or seriesinfo
        int container_member; // index into the container
+       std::string primary_name;
 };
 
 struct TVMedia
diff --git a/vdr.cc b/vdr.cc
index 4d5fb9ec3e1a75d75e0d75a6408e2b5f12ec296e..7f879693ee78915f55fa1b3e56872a741bf1ecf3 100644 (file)
--- a/vdr.cc
+++ b/vdr.cc
@@ -1790,6 +1790,28 @@ ULONG VDR::loadTVMedia(TVMediaInfo& tvmedia)
        edRegister(vdrpr);
 
 
+       VDR_ResponsePacket* vresp = RequestResponse(&vrp);
+       //if (vresp->noResponse()) { delete vresp; return -1; }
+       delete vresp;
+
+       return vrp.getSerial();
+}
+
+ULONG VDR::loadTVMediaRecThumb(TVMediaInfo & media)
+{
+
+       VDR_RequestPacket vrp;
+
+       if (!vrp.init(VDR_LOADTVMEDIARECTHUMB, false, 0)) return -1;
+       if (!vrp.addString(media.primary_name.c_str())) return NULL;
+
+       VDR_PacketReceiver* vdrpr = new VDR_PacketReceiver();
+       vdrpr->receiverChannel = VDR::CHANNEL_TVMEDIA;
+       vdrpr->streamID = vrp.getSerial();
+       vdrpr->streamReceiver = NULL;
+       edRegister(vdrpr);
+
+
        VDR_ResponsePacket* vresp = RequestResponse(&vrp);
        //if (vresp->noResponse()) { delete vresp; return -1; }
        delete vresp;
diff --git a/vdr.h b/vdr.h
index cd46f1866785dfe26fae683fd0b9bc395f513dda..1aec760f33b747851c7c04a351503c7c64596e70 100644 (file)
--- a/vdr.h
+++ b/vdr.h
@@ -209,6 +209,7 @@ class VDR : public Thread_TYPE, public EventDispatcher, public MediaProvider, pu
     MovieInfo *getScraperMovieInfo(int movieID);
     SeriesInfo *getScraperSeriesInfo(int seriesID, int episodeID);
     ULONG loadTVMedia(TVMediaInfo& tvmedia);
+    ULONG loadTVMediaRecThumb(TVMediaInfo& tvmedia);
     void invalidateTVMedia(ULONG loadindex);
 
 
index d0a8af86160f123be3562cc57b24d23ddda1148a..9991b1d8cf197c0ece946e8659253b596ec83e65 100644 (file)
@@ -73,6 +73,7 @@ const static ULONG VDR_GETRECSCRAPEREVENTTYPE = 38;
 const static ULONG VDR_GETSCRAPERMOVIEINFO = 39;
 const static ULONG VDR_GETSCRAPERSERIESINFO = 40;
 const static ULONG VDR_LOADTVMEDIA = 41;
+const static ULONG VDR_LOADTVMEDIARECTHUMB = 42;
 const static ULONG VDR_SHUTDOWN            = 666;
 
 class VDR_Command : public SerializableList {
index 0893b7bf406b0a595600b55ece2011c6fa8c0d45..cfa700e687b601db142a3edc2e678679914336d4 100644 (file)
--- a/vopts.cc
+++ b/vopts.cc
@@ -72,6 +72,9 @@ VOpts::VOpts()
   static const char* options13[] = {"Auto","1024", "2048", "4096", "8192", "16384", "32768", "65536"};
   static const char* options14[] = {"No", "Yes"};
   static const char* options18[] = {"Off", "On"};
+#ifdef ADVANCED_MENUES
+  static const char* options19[] = { "Advanced","Classic"};
+#endif
   // Get list of languages from VDR and construct options table
   LangCode = VDR::getInstance()->getLanguageList();
   options2 = new const char*[LangCode.size()];
@@ -99,7 +102,6 @@ VOpts::VOpts()
   options.push_back(option);
   wop->addOptionLine(option);
 
-
   UINT suppconn = Video::getInstance()->getSupportedFormats();
   if (suppconn) {
          int defaultch = 0;
@@ -256,6 +258,12 @@ VOpts::VOpts()
          wop->addOptionLine(option);
   }
 
+#ifdef ADVANCED_MENUES
+  option = new Option(19, "Advanced Menu", "General", "Menu type",Option::TYPE_TEXT, 2, 0, 0, options19);
+  options.push_back(option);
+  wop->addOptionLine(option);
+#endif
+
   Remote::getInstance()->addOptionsToPanes(2,&options,wop);
   Video::getInstance()->addOptionsToPanes(2,&options,wop);
   Audio::getInstance()->addOptionsToPanes(2,&options,wop);
@@ -464,6 +472,20 @@ void VOpts::doSave()
           }
           break;
         }
+        case 19:
+        {
+               if (options[i]->userSetChoice == 1)
+               {
+                       Log::getInstance()->log("Options", Log::DEBUG, "Setting classic menu");
+                       Command::getInstance()->setAdvMenues(false);
+               }
+               else
+               {
+                       Log::getInstance()->log("Options", Log::DEBUG, "Setting advanced menu");
+                       Command::getInstance()->setAdvMenues(true);
+               }
+               break;
+        }
       }
     }
     else
index 65dd57200d0ec7108a46ae0da4665174f5656e48..71f53a54039095505bf73efd0ee22f0d18e33207 100644 (file)
@@ -44,23 +44,6 @@ VRecordingList::VRecordingList()
   recman = NULL;
   loading = true;
 
-  setSize(570, 420);
-  createBuffer();
-  if (Video::getInstance()->getFormat() == Video::PAL)
-  {
-    setPosition(80, 70);
-  }
-  else
-  {
-    setPosition(70, 35);
-  }
-
-  setTitleBarOn(1);
-  setTitleBarColour(DrawStyle::TITLEBARBACKGROUND);
-
-  sl.setPosition(10, 30 + 5);
-  sl.setSize(area.w - 20, area.h - 30 - 15 - 30);
-  add(&sl);
 }
 
 VRecordingList::~VRecordingList()
@@ -68,142 +51,6 @@ VRecordingList::~VRecordingList()
   delete recman;
 }
 
-void VRecordingList::drawData(bool doIndexPop)
-{
-  int saveIndex = sl.getCurrentOption();
-  int saveTop = sl.getTopOption();
-  sl.clear();
-  sl.addColumn(0);
-  sl.addColumn(102);
-  sl.addColumn(118);
-
-  int first = 1;
-
-  char tempA[300]; // FIXME  this is guesswork!
-  char tempB[300]; // FIXME
-  struct tm* btime;
-
-  Directory* currentSubDir;
-  DirectoryList::iterator i;
-  DirectoryList* dirList = recman->getDirectories();
-  for (i = dirList->begin(); i != dirList->end(); i++)
-  {
-    currentSubDir = *i;
-    SNPRINTF(tempA, 299, tr("<dir> %lu/%lu\t \t%s"), currentSubDir->getNumNewRecordings(), currentSubDir->getNumRecordings(), currentSubDir->name);
-    currentSubDir->index = sl.addOption(tempA, 0, first);
-    first = 0;
-  }
-  // FIXME convert the whole program to time_t's
-
-  Recording* currentRec;
-  RecordingList::iterator j;
-  RecordingList* recList = recman->getRecordings();
-  for (j = recList->begin(); j != recList->end(); j++)
-  {
-    currentRec = *j;
-    time_t recStartTime = (time_t)currentRec->getStartTime();
-    btime = localtime(&recStartTime);
-//NMT does not like this too!
-       //#ifndef _MSC_VER
-//    strftime(tempA, 299, "%0d/%0m %0H:%0M ", btime);
-//#else
-    strftime(tempA, 299, "%d/%m %H:%M ", btime);
-//#endif
-    sprintf(tempB, "%s\t%c\t%s", tempA, (currentRec->getNew() ? '*': ' '), currentRec->getProgName());
-      
-    currentRec->index = sl.addOption(tempB, 0, first);
-    first = 0;
-  }
-
-  if (doIndexPop)
-  {
-    sl.hintSetCurrent(slIndexStack.top());
-    slIndexStack.pop();
-  }
-  else
-  {
-    sl.hintSetCurrent(saveIndex);
-    sl.hintSetTop(saveTop);
-  }
-  sl.draw();
-  doShowingBar();
-}
-
-void VRecordingList::draw(bool doIndexPop)
-{
-  if (!loading)
-  {
-    if (recman->isSubDir())
-    {
-      char title[300];
-      SNPRINTF(title, 299, tr("Recordings - %s"), recman->getCurDirName());
-      setTitleText(title, 364);
-    }
-    else
-    {
-      setTitleText(tr("Recordings"));
-    }
-  }
-
-  TBBoxx::draw();
-
-  if (loading)
-  {
-    drawText(tr("Loading..."), 240, 180, DrawStyle::LIGHTTEXT);
-  }
-  else
-  {
-    char freeSpace[50];
-    int gigFree = recman->getFreeSpace() / 1024;
-    SNPRINTF(freeSpace, 49, tr("%lu%% used, %iGB free"), recman->getUsedPercent(), gigFree);
-    drawTextRJ(freeSpace, 560, 5, DrawStyle::LIGHTTEXT);
-    // Symbols
-
-    WSymbol w;
-    TEMPADD(&w);
-    w.nextSymbol = WSymbol::UP;
-    w.setPosition(20, 385);
-    w.draw();
-    w.nextSymbol = WSymbol::DOWN;
-    w.setPosition(50, 385);
-    w.draw();
-    w.nextSymbol = WSymbol::SKIPBACK;
-    w.setPosition(85, 385);
-    w.draw();
-    w.nextSymbol = WSymbol::SKIPFORWARD;
-    w.setPosition(115, 385);
-    w.draw();
-    w.nextSymbol = WSymbol::PLAY;
-    w.setPosition(150, 385);
-    w.draw();
-    drawTextRJ(tr("[ok] = menu"), 560, 385, DrawStyle::LIGHTTEXT);
-
-    // All static stuff done
-    drawData(doIndexPop);
-  }
-}
-
-void VRecordingList::doShowingBar()
-{
-  int topOption = sl.getTopOption() + 1;
-  if (sl.getNumOptions() == 0) topOption = 0;
-#ifndef GRADIENT_DRAWING
-  rectangle(220, 385, 180, 25, DrawStyle::VIEWBACKGROUND);
-#endif
-  char showing[200];
-  sprintf(showing, tr("%i to %i of %i"), topOption, sl.getBottomOption(), sl.getNumOptions());
-  drawText(showing, 220, 385, DrawStyle::LIGHTTEXT);
-}
-
-void VRecordingList::quickUpdate() { //only quick for plattform that need it!
-#ifdef GRADIENT_DRAWING
-      draw();
-#else
-      sl.draw();
-      doShowingBar();
-#endif
-}
-
 void VRecordingList::processMessage(Message* m)
 {
   Log::getInstance()->log("VRecordingList", Log::DEBUG, "Got message value %lu", m->message);
@@ -426,6 +273,24 @@ Recording* VRecordingList::getCurrentOptionRecording()
   return NULL;
 }
 
+Directory* VRecordingList::getCurrentOptionDirectory()
+{
+       Directory* currentSubDir;
+       DirectoryList::iterator i;
+       DirectoryList* dirList = recman->getDirectories();
+       for (i = dirList->begin(); i != dirList->end(); i++)
+       {
+               currentSubDir = *i;
+               if (currentSubDir->index == sl.getCurrentOption())
+               {
+
+                       return currentSubDir;
+               }
+       }
+
+       return NULL;
+}
+
 int VRecordingList::handleCommand(int command)
 {
   switch(command)
@@ -469,25 +334,21 @@ int VRecordingList::handleCommand(int command)
       if (sl.getNumOptions() == 0) return 2;
 
       // Check to see if it is a sub directory
-      Directory* currentSubDir;
-      DirectoryList::iterator i;
-      DirectoryList* dirList = recman->getDirectories();
-      for (i = dirList->begin(); i != dirList->end(); i++)
+      Directory* currentSubDir=getCurrentOptionDirectory();
+
+      if (currentSubDir)
       {
-        currentSubDir = *i;
-        if (currentSubDir->index == sl.getCurrentOption())
-        {
-          if (recman->down(currentSubDir))
-          {
-            slIndexStack.push(sl.getCurrentOption());
-            sl.clear();
-            draw();
-            boxstack->update(this);
-          }
-          return 2;
-        }
+         if (recman->down(currentSubDir))
+         {
+                 slIndexStack.push(sl.getCurrentOption());
+                 sl.clear();
+                 draw();
+                 boxstack->update(this);
+         }
+         return 2;
       }
 
+
       // check to see if it's a recording
       Recording* current = getCurrentOptionRecording();
       if (current)
index d2f11db6652b6c8b1e253416afab047c0062c41c..8db32bc04e3ab953c84efe9d3bbe305d33a62014 100644 (file)
@@ -42,13 +42,13 @@ class VRecordingList : public TBBoxx
     VRecordingList();
     virtual ~VRecordingList();
 
+
+    virtual void draw(bool doIndexPop = false)=0;
     int handleCommand(int command);
     void processMessage(Message* m);
-    void draw(bool doIndexPop = false);
     bool load();
-    void drawData(bool doIndexPop = false);
 
-  private:
+  protected:
     BoxStack* boxstack;
     bool loading;
     RecMan* recman;
@@ -56,14 +56,15 @@ class VRecordingList : public TBBoxx
 
     WSelectList sl;
 
-    void quickUpdate();
-    void doShowingBar();
     void doDeleteSelected();
     int doPlay(bool resume);
     void doMoveRecording(Directory* toDir);
     Recording* getCurrentOptionRecording();
+    Directory* getCurrentOptionDirectory();
     void reSort();
 
+    virtual void quickUpdate()=0;
+
     stack<int> slIndexStack;
 };
 
index ee6e044faa4fb85a8036a27e8fbdb4b1172cdad9..144bc28bf99ae001c85c911550252961f9fffb9e 100644 (file)
@@ -23,7 +23,8 @@
 #include "remote.h"
 #include "vdr.h"
 #include "vchannellist.h"
-#include "vrecordinglist.h"
+#include "vrecordinglistclassic.h"
+#include "vrecordinglistadvanced.h"
 #include "vtimerlist.h"
 #include "command.h"
 #include "message.h"
@@ -290,15 +291,20 @@ void VWelcome::doRadioList()
 
 void VWelcome::doRecordingsList()
 {
-  VRecordingList* vrec = new VRecordingList();
-  vrec->draw();
-  boxstack->add(vrec);
-  boxstack->update(vrec);
-
-  if (!vrec->load())
-  {
-    Command::getInstance()->connectionLost();
-  }
+       VRecordingList* vrec;
+       if (Command::getInstance()->advMenues()) {
+          vrec =  new VRecordingListAdvanced();
+       } else {
+          vrec = new VRecordingListClassic();
+       }
+       vrec->draw();
+       boxstack->add(vrec);
+       boxstack->update(vrec);
+
+       if (!vrec->load())
+       {
+               Command::getInstance()->connectionLost();
+       }
 }
 
 void VWelcome::doMediaList()
index 1c5e2d7f0e627fb10344711fadc96c62b098986a..27996392438732c25d8278d87fd9c6d1925c3168 100644 (file)
@@ -23,6 +23,8 @@
 #include "colour.h"
 #include "log.h"
 
+#include <math.h>
+
 WSelectList::WSelectList():
 backgroundColour(DrawStyle::VIEWBACKGROUND)
 {
@@ -34,6 +36,7 @@ backgroundColour(DrawStyle::VIEWBACKGROUND)
   gap = 1;
   showseloption = true;
   darkseloption = false;
+  linesPerOption = 1;
 
 }
 
@@ -48,6 +51,7 @@ void WSelectList::clear()
   for (int i = 0; i < vsize; i++)
   {
     delete[] options[i].text;
+    if (options[i].pict) delete options[i].pict;
   }
   options.clear();
 
@@ -78,7 +82,7 @@ void WSelectList::hintSetTop(int idx)
   topOption = idx;
 }
 
-int WSelectList::addOption(const char* text, ULONG data, int selected)
+int WSelectList::addOption(const char* text, ULONG data, int selected, TVMediaInfo * pict)
 {
   int thisNewOption = options.size();
 
@@ -86,6 +90,7 @@ int WSelectList::addOption(const char* text, ULONG data, int selected)
   wslo.text = new char[strlen(text) + 1];
   strcpy(wslo.text, text);
   wslo.data = data;
+  wslo.pict = pict;
   options.push_back(wslo);
   if (selected) selectedOption = thisNewOption;
   return thisNewOption;
@@ -94,7 +99,7 @@ int WSelectList::addOption(const char* text, ULONG data, int selected)
 void WSelectList::draw()
 {
   int fontHeight = getFontHeight();
-  int ySeperation = fontHeight + gap;
+  int ySeperation = fontHeight * linesPerOption + gap;
 
   numOptionsDisplayable = (area.h - 5) / ySeperation;
 
@@ -120,14 +125,14 @@ void WSelectList::draw()
     if (i == selectedOption && showseloption)
     {
 
-      rectangle(0, ypos, area.w, fontHeight, darkseloption ? DrawStyle::SELECTDARKHIGHLIGHT: DrawStyle::SELECTHIGHLIGHT);
+      rectangle(0, ypos, area.w, fontHeight * linesPerOption, darkseloption ? DrawStyle::SELECTDARKHIGHLIGHT: DrawStyle::SELECTHIGHLIGHT);
 
-      drawOptionLine(options[i].text, 5, ypos, area.w - 5, DrawStyle::DARKTEXT);
+      drawOptionLine(options[i].text, 5, ypos, area.w - 5, DrawStyle::DARKTEXT, options[i].pict);
     }
     else
     {
 
-      drawOptionLine(options[i].text, 5, ypos, area.w - 5, DrawStyle::LIGHTTEXT);
+      drawOptionLine(options[i].text, 5, ypos, area.w - 5, DrawStyle::LIGHTTEXT, options[i].pict);
     }
     ypos += ySeperation;
   }
@@ -140,9 +145,20 @@ void WSelectList::addColumn(int x)
   columns[numColumns++] = x;
 }
 
-void WSelectList::drawOptionLine(char* text, int xpos, int ypos, int width, const DrawStyle& colour)
+void WSelectList::drawOptionLine(char* text, int xpos, int ypos, int width, const DrawStyle& colour, TVMediaInfo* pict)
 {
-  if (!numColumns)
+  UINT curline = 0;
+  UINT taboffset = 0;
+  int fontHeight = getFontHeight();
+  float ypos_mod= ypos + (linesPerOption-floor(linesPerOption))*((float)fontHeight)*0.5f;
+
+  if (pict)
+  {
+         drawTVMedia(*pict, xpos,ypos,0,fontHeight*linesPerOption,TopLeft);
+         taboffset++;
+  }
+
+  if (!numColumns && linesPerOption == 1)
   {
 
     drawText(text, xpos, ypos, width, colour);
@@ -151,18 +167,26 @@ void WSelectList::drawOptionLine(char* text, int xpos, int ypos, int width, cons
   {
     char buffer[200];
     strncpy(buffer, text, 199);
-    int currentColumn = 0;
+    int currentColumn = taboffset;
     char* pointer;
 
-    pointer = strtok(buffer, "\t");
+    pointer = strtok(buffer, "\t\n");
     while(pointer)
     {
+      drawText(pointer, xpos + columns[currentColumn], ypos_mod + curline * fontHeight, width - columns[currentColumn], colour);
+
+      pointer = strtok(NULL, "\t\n");
+      if (pointer) {
+         char delimiter = text[pointer - buffer-1];
+         if (delimiter == '\t') currentColumn++;
+         else if (delimiter == '\n' ){
+                 currentColumn = taboffset;
+                 curline++;
+         }
+      }
+      if (curline >= linesPerOption) return;
 
-      drawText(pointer, xpos + columns[currentColumn], ypos, width - columns[currentColumn], colour);
-
-      currentColumn++;
       if (currentColumn == 10) return;
-      pointer = strtok(NULL, "\t");
     }
   }
 }
index bb981311cc9e3364790d8d9d9e93baf4d5bd919b..212f21e3bbf5b320c845a0fdae8a25d293b72155 100644 (file)
@@ -35,6 +35,7 @@ typedef struct
 {
   char* text;
   ULONG data;
+  TVMediaInfo *pict;
 } wsloption;
 
 class WSelectList : public Boxx
@@ -48,9 +49,10 @@ class WSelectList : public Boxx
     void setNoLoop();
     void setShowSelOption(bool set) { showseloption = set; };
     void setDarkSelOption(bool set) { darkseloption = set; };
-    int addOption(const char* text, ULONG data, int selected);
+    int addOption(const char* text, ULONG data, int selected, TVMediaInfo * pict=NULL);
     void draw();
     void setBackgroundColour(const DrawStyle& colour);
+    void setLinesPerOption(float lines) {linesPerOption=lines;};
 
     void down();
     void up();
@@ -71,7 +73,7 @@ class WSelectList : public Boxx
     virtual bool mouseAndroidScroll(int x, int y,int sx, int sy);
 
   private:
-    void drawOptionLine(char* text, int xpos, int ypos, int width, const DrawStyle& colour);
+    void drawOptionLine(char* text, int xpos, int ypos, int width, const DrawStyle& colour, TVMediaInfo* pict);
     int getMouseLine(int x, int y);
 
     vector<wsloption> options;
@@ -82,6 +84,7 @@ class WSelectList : public Boxx
     int numColumns;
     int noLoop;
     bool showseloption, darkseloption;
+    float linesPerOption;
     
     UINT gap;
     DrawStyle backgroundColour;
diff --git a/wtvmedia.cc b/wtvmedia.cc
new file mode 100644 (file)
index 0000000..4e16e6c
--- /dev/null
@@ -0,0 +1,63 @@
+/*
+    Copyright 2004-2005 Chris Tallon, 2014 Marten Richter
+
+    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., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+*/
+#include "boxx.h"
+#include "wtvmedia.h"
+
+
+
+
+ WTVMedia::WTVMedia()
+ {
+        media = false;
+        scale=NoZoom;
+ }
+
+ WTVMedia::~WTVMedia()
+ {
+
+ }
+
+
+
+ void WTVMedia::setTVMedia(TVMediaInfo & ninfo, Scaling nscale)
+ {
+        info = ninfo;
+        scale = nscale;
+        media =true;
+ }
+
+ void  WTVMedia::draw()
+ {
+        if (!media) return;
+        float w=0;
+        float h=0;
+        switch (scale)
+        {
+        case ZoomHorizontal:
+                w = area.w; break;
+        case ZoomVertical:
+                h = area.h; break;
+        case ZoomBoth:
+                w = area.w;
+                h = area.h; break;
+        }
+        drawTVMedia(info,0.f,0.f,w,h,TopLeft);
+
+ }
diff --git a/wtvmedia.h b/wtvmedia.h
new file mode 100644 (file)
index 0000000..17708be
--- /dev/null
@@ -0,0 +1,55 @@
+/*
+    Copyright 2004-2005 Chris Tallon, 2014 Marten Richter
+
+    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., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+*/
+
+#ifndef WTVMEDIA_H
+#define WTVMEDIA_H
+
+#include <stdio.h>
+#include <malloc.h>
+#include "boxx.h"
+
+
+
+
+class WTVMedia : public Boxx
+{
+  public:
+    WTVMedia();
+    virtual ~WTVMedia();
+
+    enum Scaling {
+               NoZoom,
+               ZoomHorizontal,
+               ZoomVertical,
+               ZoomBoth
+    };
+
+    void setTVMedia(TVMediaInfo & info, Scaling scale);
+    void draw();
+
+  protected:
+    TVMediaInfo info;
+    Scaling scale;
+    bool media;
+};
+
+
+
+#endif