/*
Copyright 2004-2005 Chris Tallon
+ Copyright 2014 Marten Richter
This file is part of VOMP.
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.
+ along with VOMP. If not, see <https://www.gnu.org/licenses/>.
*/
#include "event.h"
MovieInfo* Event::movieInfo = NULL;
SeriesInfo* Event::seriesInfo = NULL;
-Event::Event()
-{
- id = 0;
- time = 0;
- duration = 0;
-
- title = NULL;
- subtitle = NULL;
- description = NULL;
- index = -1;
- movieID = 0;
- seriesID =0;
- epgImage = 0;
-}
-
-Event::~Event()
-{
- if (title) delete[] title;
- if (subtitle) delete[] subtitle;
- if (description) delete[] description;
-}
-
-void Event::settitle(const char* s)
-{
- delete title;
- title = new char[strlen(s) + 1];
- strcpy(title, s);
-}
-
-void Event::setdescription(const char* s)
-{
- delete description;
- description = new char[strlen(s) + 1];
- strcpy(description, s);
-}
-
-void Event::setsubtitle(const char* s)
-{
- delete subtitle;
- subtitle = new char[strlen(s) + 1];
- strcpy(subtitle, s);
-}
-
-
void Event::loadinfos(UINT channelid)
{
- VDR *vdr=VDR::getInstance();
- if (movieInfo) delete movieInfo;
- if (seriesInfo) delete seriesInfo;
-
- movieInfo = NULL;
- seriesInfo = NULL;
-
-
- if (movieID == 0 && seriesID == 0) {
- vdr->getScraperEventType(channelid, id, movieID, seriesID, episodeID, epgImage);
- Log::getInstance()->log("Event", Log::DEBUG, "Got Scraper EventType %d %d, %d %d %d %d",
- id, channelid,
- movieID, seriesID, episodeID);
- }
-
- if (!vdr->isConnected()) Command::getInstance()->connectionLost();
-
- if (movieID != 0)
- {
- movieInfo = vdr->getScraperMovieInfo(movieID);
- Log::getInstance()->log("Event", Log::DEBUG, "Got Scraper MovieInfo ");
- }
- else if (seriesID != 0)
- {
- seriesInfo = vdr->getScraperSeriesInfo(seriesID, episodeID);
- Log::getInstance()->log("Event", Log::DEBUG, "Got Scraper SeriesInfo ");
- }
-
-
- if (!vdr->isConnected()) Command::getInstance()->connectionLost();
+ VDR* vdr = VDR::getInstance();
+ if (movieInfo) delete movieInfo;
+ if (seriesInfo) delete seriesInfo;
+
+ movieInfo = NULL;
+ seriesInfo = NULL;
+
+ if (movieID == 0 && seriesID == 0)
+ {
+ vdr->getScraperEventType(channelid, id, movieID, seriesID, episodeID, epgImage);
+ Log::getInstance()->log("Event", Log::DEBUG, "Got Scraper EventType %d %d, %d %d %d %d",
+ id, channelid, movieID, seriesID, episodeID);
+ }
+
+ if (!vdr->isConnected()) Command::getInstance()->connectionLost();
+
+ if (movieID != 0)
+ {
+ movieInfo = vdr->getScraperMovieInfo(movieID);
+ Log::getInstance()->log("Event", Log::DEBUG, "Got Scraper MovieInfo");
+ }
+ else if (seriesID != 0)
+ {
+ seriesInfo = vdr->getScraperSeriesInfo(seriesID, episodeID);
+ Log::getInstance()->log("Event", Log::DEBUG, "Got Scraper SeriesInfo");
+ }
+
+ if (!vdr->isConnected()) Command::getInstance()->connectionLost();
}
-
-
/*
- Copyright 2004-2005 Chris Tallon
+ Copyright 2004-2020 Chris Tallon
This file is part of VOMP.
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.
+ along with VOMP. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef EVENT_H
#define EVENT_H
-#include <stdio.h>
-#include <string.h>
-#include <time.h>
+#include <string>
#include "defines.h"
class Event
{
public:
- Event();
- ~Event();
-
- void settitle(const char* title);
- void setsubtitle(const char* subtitle);
- void setdescription(const char* description);
-
void loadinfos(UINT channelid);
- ULONG id;
+ ULONG id{};
+ ULONG time{};
+ ULONG duration{};
- ULONG time;
- ULONG duration;
+ std::string title;
+ std::string subtitle;
+ std::string description;
- char* title;
- char* subtitle;
- char* description;
+ int index{-1};
- int index;
+ int movieID{};
+ int seriesID{};
+ int episodeID{};
+ int epgImage{};
static MovieInfo *movieInfo;
static SeriesInfo *seriesInfo;
- int movieID;
- int seriesID;
- int episodeID;
- int epgImage;
};
-class EventSorter
+struct EventSorter
{
- public:
- bool operator()(const Event* e1, const Event* e2)
- {
- return e1->time < e2->time;
- }
+ bool operator()(const Event* e1, const Event* e2)
+ {
+ return e1->time < e2->time;
+ }
};
#endif
time_t t;
struct tm btime; // to hold programme start and end time
char timeString[9]; // to hold programme start and end time
- int length = strlen(event->title); // calculate length of programme title string
+ int length = strlen(event->title.c_str()); // calculate length of programme title string
char* title = new char[length + 15]; // create string to hold start time, end time and programme title
time_t eventtime = event->time;
LOCALTIME_R(&eventtime, &btime); //get programme start time
#endif
strcat(title, timeString); // put it in our buffer
- strcat(title, event->title); // then add the programme title
+ strcat(title, event->title.c_str()); // then add the programme title
progTitle.setText(title); // sput this sring in our text box
- length = strlen(event->description);
+ length = event->description.length();
char* info = new char[length + 1]; // create programme detail string
- strcpy(info, event->description);
+ strcpy(info, event->description.c_str());
progInfo.setText(info); // show programme detail string
// destroy dynamically allocated memory
delete[] info;
// TODO should the above two comditional statements be combined to avoid calling updateEventList() twice?
Event* event;
Event noevent; // an event to use if there are gaps in the epg
- thisEvent.setdescription(tr("There are no programme details available for this period"));
+ thisEvent.description = tr("There are no programme details available for this period");
thisEvent.duration = window_width * 60;
thisEvent.time = ltime;
- thisEvent.settitle(tr("No programme details"));
+ thisEvent.title = tr("No programme details");
thisEvent.id = 0;
bool swapColour = false; // alternate cell colour
bool currentRow = false;
currentRow = (listTop + (int)listIndex == chanListbox.getCurrentOption());
noevent.time = ltime;
noevent.duration = window_width * 60;
- noevent.settitle("");
+ noevent.title = "";
paintCell(&noevent, y, DrawStyle::NOPROGRAMME, DrawStyle::LIGHTTEXT); // fill row with no programme colour to be painted ove with valid programmes
if (currentRow)
{
- thisEvent.setdescription(tr("There are no programme details available for this period"));
+ thisEvent.description = tr("There are no programme details available for this period");
thisEvent.duration = window_width * 60;
thisEvent.time = ltime;
- thisEvent.settitle(tr("No programme details"));
+ thisEvent.title = tr("No programme details");
thisEvent.id = 0;
}
if (eventLista[listIndex])
if(event->time <= UINT(selTime) && end > UINT(selTime) && currentRow)
{
// this is the selected programme
- thisEvent.setdescription(event->description);
+ thisEvent.description = event->description;
thisEvent.duration = event->duration;
thisEvent.time = event->time;
- thisEvent.settitle(event->title);
+ thisEvent.title = event->title;
thisEvent.id = event->id;
if(thisEvent.id == 0)
thisEvent.id = 1;
{
bg = DrawStyle::NOPROGRAMME;
fg = DrawStyle::LIGHTTEXT;
- noevent.settitle(tr("No programme details"));
+ noevent.title = tr("No programme details");
paintCell(&noevent, y, bg, fg);
}
}
if (w > 155 + (int)window_width * MINUTE_SCALE - x)
w = 155 + window_width * MINUTE_SCALE -x; // limit cells to RHS of window
rectangle(x, y, w, h, bg);
- char* tt = new char[strlen(event->title) + 1];
- strcpy (tt, event->title);
+ char* tt = new char[strlen(event->title.c_str()) + 1];
+ strcpy (tt, event->title.c_str());
float textWidth = 0;
unsigned int cur_length=1;
unsigned int text_max=strlen(tt);
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.
+ along with VOMP. If not, see <https://www.gnu.org/licenses/>.
*/
-#include "vepgsettimer.h"
+#include <time.h>
#include "event.h"
#include "channel.h"
#include "input.h"
#include "i18n.h"
+#include "vepgsettimer.h"
+
VEpgSetTimer::VEpgSetTimer(Event* tevent, Channel* tchannel)
{
boxstack = BoxStack::getInstance();
}
else strcpy(lifetime, "99");
- eventTitle = new char[strlen(event->title) + 1];
- strcpy(eventTitle, event->title);
+ eventTitle = new char[strlen(event->title.c_str()) + 1];
+ strcpy(eventTitle, event->title.c_str());
for(UINT i=0; i < strlen(eventTitle); i++) if (eventTitle[i] == ':') eventTitle[i] = '|';
SNPRINTF(timerString, 1023, "%i:%lu:%s:%s:%s:%s:%s:%s:",
void VEpgSetTimer::draw()
{
TBBoxx::draw();
- drawPara(event->title, 10, 40, DrawStyle::LIGHTTEXT);
+ drawPara(event->title.c_str(), 10, 40, DrawStyle::LIGHTTEXT);
drawText(channel->name, 10, 40 + (2 * getFontHeight()), DrawStyle::LIGHTTEXT);
char fullString[20];
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.
+ along with VOMP. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef VEPGSETTIMER_H
#define VEPGSETTIMER_H
-#include <time.h>
-
#include "tbboxx.h"
#include "wbutton.h"
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.
+ along with VOMP. If not, see <https://www.gnu.org/licenses/>.
*/
-#include "vepgsummary.h"
+#include <string>
#include "input.h"
#include "vquestion.h"
#include "wseriesview.h"
#include "wpictureview.h"
-#include <string>
+#include "vepgsummary.h"
VEpgSummary::VEpgSummary(Event *tevent, Channel* tchannel)
{
setTitleBarOn(1);
setBorderOn(1);
- setTitleText(event->title);
+ setTitleText(event->title.c_str());
setTitleBarColour(DrawStyle::TITLEBARBACKGROUND);
WTextbox * summary=new WTextbox();
summary->setParaMode(true);
- std::string summary_text = std::string(event->subtitle)+ "\n" +std::string(event->description);
+ std::string summary_text = event->subtitle + "\n" + event->description;
summary->setText(summary_text.c_str());
OsdVector *osdv=dynamic_cast<OsdVector*>(Osd::getInstance());
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.
+ along with VOMP. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef VEPGSUMMARY_H