00001 #include <qdatetime.h>
00002 #include <qpixmap.h>
00003 #include <qimage.h>
00004 #include <qstring.h>
00005 #include <qfile.h>
00006 #include <qsqlquery.h>
00007 #include <qapplication.h>
00008
00009 #include "infostructs.h"
00010 #include "mythcontext.h"
00011
00012 void ChannelInfo::LoadChannelIcon(int width, int height)
00013 {
00014 QImage tempimage(iconpath);
00015
00016 if (!iconpath.isEmpty() && (tempimage.width() == 0))
00017 {
00018 QFile existtest(iconpath);
00019
00020
00021 if (existtest.exists())
00022 return;
00023
00024 QString url = gContext->GetMasterHostPrefix();
00025 if (url.length() < 1)
00026 return;
00027
00028 url += iconpath;
00029
00030 QImage *cached = gContext->CacheRemotePixmap(url);
00031 if (cached)
00032 tempimage = *cached;
00033 }
00034
00035 if (tempimage.width() > 0)
00036 {
00037 iconload = true;
00038 QImage tmp2;
00039
00040 if ((height == 0) && (tempimage.width() != width
00041 || tempimage.height() != width))
00042 {
00043 tmp2 = tempimage.smoothScale(width, width);
00044 icon.convertFromImage(tmp2);
00045 }
00046 else if ((height > 0) && (tempimage.width() != width
00047 || tempimage.height() != height))
00048 {
00049 tmp2 = tempimage.smoothScale(width, height);
00050 icon.convertFromImage(tmp2);
00051 }
00052 else
00053 icon.convertFromImage(tempimage);
00054 }
00055 }
00056
00057 QString ChannelInfo::Text(QString format)
00058 {
00059 format.replace("<num>", chanstr);
00060 format.replace("<sign>", callsign);
00061 format.replace("<name>", channame);
00062
00063 return format;
00064 }
00065