00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #include "multiplexsetting.h"
00031 #include "frequencies.h"
00032
00033 void MultiplexSetting::Load(void)
00034 {
00035 clearSelections();
00036
00037 if (!sourceid)
00038 return;
00039
00040 MSqlQuery query(MSqlQuery::InitCon());
00041
00042 query.prepare(
00043 "SELECT mplexid, networkid, transportid, "
00044 " frequency, symbolrate, modulation "
00045 "FROM dtv_multiplex "
00046 "WHERE sourceid = :SOURCEID "
00047 "ORDER by frequency, networkid, transportid");
00048 query.bindValue(":SOURCEID", sourceid);
00049
00050 if (!query.exec() || !query.isActive() || query.size() <= 0)
00051 return;
00052
00053 while (query.next())
00054 {
00055 QString DisplayText;
00056 if (query.value(5).toString() == "8vsb")
00057 {
00058 QString ChannelNumber =
00059 QString("Freq %1").arg(query.value(3).toInt());
00060 struct CHANLIST* curList = chanlists[0].list;
00061 int totalChannels = chanlists[0].count;
00062 int findFrequency = (query.value(3).toInt() / 1000) - 1750;
00063 for (int x = 0 ; x < totalChannels ; x++)
00064 {
00065 if ((curList[x].freq <= findFrequency + 200) &&
00066 (curList[x].freq >= findFrequency - 200))
00067 {
00068 ChannelNumber = QString("%1").arg(curList[x].name);
00069 }
00070 }
00071 DisplayText = QObject::tr("ATSC Channel %1").arg(ChannelNumber);
00072 }
00073 else
00074 {
00075 DisplayText = QString("%1 Hz (%2) (%3) (%4)")
00076 .arg(query.value(3).toString())
00077 .arg(query.value(4).toString())
00078 .arg(query.value(1).toInt())
00079 .arg(query.value(2).toInt());
00080 }
00081 addSelection(DisplayText, query.value(0).toString());
00082 }
00083 }
00084
00085 void MultiplexSetting::SetSourceID(uint _sourceid)
00086 {
00087 sourceid = _sourceid;
00088 Load();
00089 }