15 #include <QTextStream>
16 #include <QElapsedTimer>
26 #define LOC QString("ChanImport: ")
56 "WHERE videosource.sourceid = :SOURCEID");
62 else if (query.
next())
64 lcnOffset = query.
value(0).toUInt();
67 LOG(VB_CHANSCAN, LOG_INFO,
LOC +
68 QString(
"Logical Channel Number offset:%1")
75 bool _delete,
bool insert,
bool save,
76 bool fta_only,
bool lcn_only,
bool complete_only,
77 bool full_channel_search,
78 bool remove_duplicates,
82 m_isInteractive(interactive),
88 m_completeOnly(complete_only),
89 m_fullChannelSearch(full_channel_search),
90 m_removeDuplicates(remove_duplicates),
92 m_serviceRequirements(service_requirements)
106 if (_transports.empty())
112 LOG(VB_GENERAL, LOG_INFO,
LOC + (channels ?
114 QString(
"Found %1 channels")
116 "No new channels to process") :
117 "No channels to process.."));
121 msg = tr(
"Failed to find any channels.");
123 msg = tr(
"Found %n channel(s)",
"", channels);
125 msg = tr(
"Failed to find any new channels!");
136 "No new channels to process" :
137 "No channels to process..");
151 QTextStream ssMsg(&msg);
157 const char *desired {
"all" };
161 desired =
"tv+radio";
162 ssMsg << Qt::endl << Qt::endl;
163 ssMsg <<
"Scan parameters:" << Qt::endl;
164 ssMsg <<
"Desired Services : " << desired << Qt::endl;
165 ssMsg <<
"Unencrypted Only : " << (
m_ftaOnly ?
"yes" :
"no") << Qt::endl;
166 ssMsg <<
"Logical Channel Numbers only: " << (
m_lcnOnly ?
"yes" :
"no") << Qt::endl;
167 ssMsg <<
"Complete scan data required : " << (
m_completeOnly ?
"yes" :
"no") << Qt::endl;
168 ssMsg <<
"Full search for old channels: " << (
m_fullChannelSearch ?
"yes" :
"no") << Qt::endl;
173 if (!transports.empty())
176 ssMsg <<
"Transport list before processing (" << transports.size() <<
"):" << Qt::endl;
181 ssMsg <<
"Channel list before processing (";
185 LOG(VB_GENERAL, LOG_INFO,
LOC + msg);
199 if (!duplicates.empty())
203 ssMsg <<
"Discarded duplicate transports (" << duplicates.size() <<
"):" << Qt::endl;
205 ssMsg <<
"Discarded duplicate channels (" <<
SimpleCountChannels(duplicates) <<
"):" << Qt::endl;
206 ssMsg <<
FormatChannels(duplicates).toLatin1().constData() << Qt::endl;
207 LOG(VB_CHANSCAN, LOG_INFO,
LOC + msg);
231 if (!db_trans.empty())
234 ssMsg <<
"Transports with channels in DB but not in scan (";
235 ssMsg << db_trans.size() <<
"):" << Qt::endl;
246 ssMsg <<
"Channel list after compare with database (";
256 std::copy(db_trans.cbegin(), db_trans.cend(), std::back_inserter(trans));
278 LOG(VB_GENERAL, LOG_INFO,
LOC + msg);
315 std::vector<uint> off_air_list;
316 QMap<uint,bool> deleted;
319 for (
size_t i = 0; i < transports.size(); ++i)
322 for (
size_t j = 0; j < transports[i].m_channels.size(); ++j)
331 off_air_list.push_back(i<<16|j);
336 off_air_transports.push_back(transport_copy);
339 if (off_air_list.empty())
343 std::cout << std::endl <<
"Off-air channels (" <<
SimpleCountChannels(off_air_transports) <<
"):" << std::endl;
345 std::cout <<
FormatChannels(off_air_transports, &infoA).toLatin1().constData() << std::endl;
350 QString msg = tr(
"Found %n off-air channel(s).",
"", off_air_list.size());
359 for (
uint item : off_air_list)
362 int j = item & 0xFFFF;
364 transports[i].m_channels[j].m_channelId);
365 deleted[item] =
true;
370 for (
uint item : off_air_list)
373 int j = item & 0xFFFF;
374 int chanid = transports[i].m_channels[j].m_channelId;
393 for (
size_t i = 0; i < transports.size(); ++i)
395 newlist.push_back(transports[i]);
396 newlist.back().m_channels.clear();
397 for (
size_t j = 0; j < transports[i].m_channels.size(); ++j)
399 if (!deleted.contains(i<<16|j))
401 newlist.back().m_channels.push_back(
402 transports[i].m_channels[j]);
407 transports = newlist;
408 return deleted.size();
415 "SELECT mplexid FROM dtv_multiplex "
416 "WHERE sourceid = :SOURCEID1 AND "
420 " WHERE sourceid = :SOURCEID2)");
429 QString msg = tr(
"Found %n unused transport(s).",
"", query.
size());
430 LOG(VB_GENERAL, LOG_INFO,
LOC + msg);
434 if (query.
size() == 0)
444 "DELETE FROM dtv_multiplex "
445 "WHERE sourceid = :SOURCEID1 AND "
449 " WHERE sourceid = :SOURCEID2)");
461 LOG(VB_GENERAL, LOG_INFO,
LOC +
"Manual delete of transport not implemented");
492 QString msg = tr(
"Found %n old %1 channel(s).",
"", old_chan)
501 QString msg = tr(
"Found %n new %1 channel(s).",
"", new_chan)
529 QString msg = tr(
"Found %n conflicting old %1 channel(s).",
538 QString msg = tr(
"Found %n new conflicting %1 channel(s).",
547 QTextStream ssMsg(&msg);
549 if (!updated.empty())
551 ssMsg << Qt::endl << Qt::endl;
552 ssMsg <<
"Updated old transports (" << updated.size() <<
"):" << Qt::endl;
559 if (!skipped_updates.empty())
562 ssMsg <<
"Skipped old channels (" <<
SimpleCountChannels(skipped_updates) <<
"):" << Qt::endl;
565 if (!inserted.empty())
571 if (!skipped_inserts.empty())
574 ssMsg <<
"Skipped new channels (" <<
SimpleCountChannels(skipped_inserts) <<
"):" << Qt::endl;
586 ssMsg <<
GetSummary(ninfo, nstats).toLatin1().constData();
588 LOG(VB_GENERAL, LOG_INFO,
LOC + msg);
612 bool cancel_all =
false;
617 for (
const auto & transport : transports)
623 for (
size_t j = 0; j < transport.m_channels.size(); ++j)
665 bool conflicting =
false;
674 bool ok_done =
false;
714 bool inserted =
false;
756 if (!transport.m_iptvTuning.GetDataURL().isEmpty())
758 transport.m_iptvTuning);
781 next_list.push_back(new_transport);
784 skipped_list.push_back(skipped_transport);
787 inserted_list.push_back(inserted_transport);
816 for (
const auto & transport : transports)
822 for (
size_t j = 0; j < transport.m_channels.size(); ++j)
840 bool conflicting =
false;
859 bool updated =
false;
921 next_list.push_back(new_transport);
924 skipped_list.push_back(skipped_transport);
927 updated_list.push_back(updated_transport);
950 transport_copy = transport;
966 if (!transports.empty())
967 tuner_type = transports[0].m_tunerType;
972 uint freq_mult = (is_dvbs) ? 1 : 1000;
974 std::vector<bool> ignore;
975 ignore.resize(transports.size());
976 for (
size_t i = 0; i < transports.size(); ++i)
981 for (
size_t j = i+1; j < transports.size(); ++j)
983 if (!transports[i].IsEqual(
984 tuner_type, transports[j], 500 * freq_mult))
989 for (
size_t k = 0; k < transports[j].m_channels.size(); ++k)
991 bool found_same =
false;
992 for (
size_t l = 0; l < transports[i].m_channels.size(); ++l)
994 if (transports[j].m_channels[k].IsSameChannel(
995 transports[i].m_channels[l]))
998 transports[i].m_channels[l].ImportExtraInfo(
999 transports[j].m_channels[k]);
1003 transports[i].m_channels.push_back(transports[j].m_channels[k]);
1005 LOG(VB_CHANSCAN, LOG_INFO,
LOC +
1006 QString(
"Transport on same frequency:") +
FormatTransport(transports[j]));
1009 no_dups.push_back(transports[i]);
1011 transports = no_dups;
1026 LOG(VB_CHANSCAN, LOG_INFO,
LOC +
1027 QString(
"Number of transports:%1").arg(transports.size()));
1030 std::vector<bool> ignore;
1031 ignore.resize(transports.size());
1032 for (
size_t i = 0; i < transports.size(); ++i)
1035 LOG(VB_CHANSCAN, LOG_INFO,
LOC +
"Transport " +
1040 for (
size_t j = i+1; j < transports.size(); ++j)
1043 bool found_same =
true;
1044 bool found_diff =
true;
1047 LOG(VB_CHANSCAN, LOG_DEBUG,
LOC +
"Comparing transport A " +
1049 LOG(VB_CHANSCAN, LOG_DEBUG,
LOC +
"Comparing transport B " +
1052 for (
size_t k = 0; found_same && k < tb.
m_channels.size(); ++k)
1066 if (found_same && !found_diff)
1068 size_t lowss = transports[i].m_signalStrength < transports[j].m_signalStrength ? i : j;
1069 ignore[lowss] =
true;
1070 duplicates.push_back(transports[lowss]);
1072 LOG(VB_CHANSCAN, LOG_INFO,
LOC +
"Duplicate transports found:");
1081 no_dups.push_back(transports[i]);
1085 transports = no_dups;
1093 for (
auto & transport : transports)
1096 for (
auto & channel : transport.m_channels)
1098 if (
m_ftaOnly && channel.m_isEncrypted &&
1102 if (require_a && channel.m_isDataService)
1105 if (require_av && channel.m_isAudioService)
1109 if (
m_lcnOnly && channel.m_chanNum.isEmpty())
1112 LOG(VB_CHANSCAN, LOG_INFO,
LOC + QString(
"No LCN: %1").arg(msg));
1118 !(channel.m_inPat &&
1122 LOG(VB_CHANSCAN, LOG_INFO,
LOC + QString(
"Not in PAT/PMT: %1").arg(msg));
1128 channel.m_atscMajorChannel == 0 &&
1129 channel.m_atscMinorChannel == 0 &&
1130 (!channel.m_inPat ||
1133 (channel.m_patTsId !=
1134 channel.m_sdtTsId)))
1137 LOG(VB_CHANSCAN, LOG_INFO,
LOC + QString(
"Not in PAT/PMT/SDT: %1").arg(msg));
1145 LOG(VB_CHANSCAN, LOG_INFO,
LOC + QString(
"No name: %1").arg(msg));
1150 if (channel.m_inChannelsConf &&
1151 !(channel.m_inPat ||
1158 filtered.push_back(channel);
1160 transport.m_channels = filtered;
1166 QMap<uint64_t, bool> rs;
1169 for (
auto & transport : transports)
1171 for (
auto & channel : transport.m_channels)
1173 if (channel.m_oldOrigNetId > 0)
1175 uint64_t key = ((uint64_t)channel.m_oldOrigNetId << 32) | (channel.m_oldTsId << 16) | channel.m_oldServiceId;
1182 for (
auto & transport : transports)
1185 for (
auto & channel : transport.m_channels)
1187 uint64_t key = ((uint64_t)channel.m_origNetId << 32) | (channel.m_sdtTsId << 16) | channel.m_serviceId;
1188 if (rs.value(key,
false))
1191 LOG(VB_CHANSCAN, LOG_INFO,
LOC + QString(
"Relocated: %1").arg(msg));
1194 filtered.push_back(channel);
1196 transport.m_channels = filtered;
1203 QMap<qlonglong, uint> map_sid_scn;
1204 QMap<qlonglong, uint> map_sid_lcn;
1205 QMap<uint, qlonglong> map_lcn_sid;
1207 LOG(VB_CHANSCAN, LOG_INFO,
LOC + QString(
"Process DVB Channel Numbers"));
1208 for (
auto & transport : transports)
1210 for (
auto & channel : transport.m_channels)
1212 LOG(VB_CHANSCAN, LOG_DEBUG,
LOC + QString(
"Channel onid:%1 sid:%2 lcn:%3 scn:%4")
1213 .arg(channel.m_origNetId).arg(channel.m_serviceId).arg(channel.m_logicalChannel)
1214 .arg(channel.m_simulcastChannel));
1215 qlonglong key = ((qlonglong)channel.m_origNetId<<32) | channel.m_serviceId;
1216 if (channel.m_logicalChannel > 0)
1218 map_sid_lcn[key] = channel.m_logicalChannel;
1219 map_lcn_sid[channel.m_logicalChannel] = key;
1221 if (channel.m_simulcastChannel > 0)
1223 map_sid_scn[key] = channel.m_simulcastChannel;
1241 LOG(VB_CHANSCAN, LOG_INFO,
LOC + QString(
"Process Simulcast Channel Numbers"));
1243 QMap<qlonglong, uint>::iterator it;
1244 for (it = map_sid_scn.begin(); it != map_sid_scn.end(); ++it)
1247 qlonglong key_hd = it.key();
1249 uint lcn_sd = scn_hd;
1250 uint lcn_hd = map_sid_lcn[key_hd];
1252 qlonglong key_sd = map_lcn_sid[lcn_sd];
1254 map_sid_lcn[key_sd] = lcn_hd;
1255 map_sid_lcn[key_hd] = lcn_sd;
1256 map_lcn_sid[lcn_hd] = key_sd;
1257 map_lcn_sid[lcn_sd] = key_hd;
1262 LOG(VB_CHANSCAN, LOG_INFO,
LOC + QString(
"Process Logical Channel Numbers"));
1263 for (
auto & transport : transports)
1265 for (
auto & channel : transport.m_channels)
1267 if (channel.m_chanNum.isEmpty())
1269 qlonglong key = ((qlonglong)channel.m_origNetId<<32) | channel.m_serviceId;
1270 QMap<qlonglong, uint>::const_iterator it = map_sid_lcn.constFind(key);
1271 if (it != map_sid_lcn.cend())
1273 channel.m_chanNum = QString::number(*it +
m_lcnOffset);
1274 LOG(VB_CHANSCAN, LOG_DEBUG,
LOC +
1275 QString(
"Final channel sid:%1 channel %2")
1276 .arg(channel.m_serviceId).arg(channel.m_chanNum));
1280 LOG(VB_CHANSCAN, LOG_DEBUG,
LOC +
1281 QString(
"Final channel sid:%1 NO channel number")
1282 .arg(channel.m_serviceId));
1287 LOG(VB_CHANSCAN, LOG_DEBUG,
LOC +
1288 QString(
"Final channel sid:%1 has already channel number %2")
1289 .arg(channel.m_serviceId).arg(channel.m_chanNum));
1306 int found_in_same_transport = 0;
1307 int found_in_other_transport = 0;
1308 int found_nowhere = 0;
1311 if (!transports.empty())
1312 tuner_type = transports[0].m_tunerType;
1318 uint freq_mult = (is_dvbs) ? 1 : 1000;
1323 "FROM dtv_multiplex "
1324 "WHERE sourceid = :SOURCEID "
1326 "ORDER BY mplexid");
1335 QMap<uint,bool> found_in_scan;
1336 while (query.
next())
1340 if (db_transport.
FillFromDB(tuner_type, mplexid))
1348 bool found_transport =
false;
1349 QMap<uint,bool> found_in_database;
1352 for (
size_t ist = 0; ist < transports.size(); ++ist)
1355 if (scan_transport.
IsEqual(tuner_type, db_transport, 500 * freq_mult,
true))
1357 found_transport =
true;
1359 for (
size_t jdc = 0; jdc < db_transport.
m_channels.size(); ++jdc)
1361 if (!found_in_database[jdc])
1364 for (
size_t ksc = 0; ksc < scan_transport.
m_channels.size(); ++ksc)
1366 if (!found_in_scan[(ist<<16)+ksc])
1371 found_in_same_transport++;
1372 found_in_database[jdc] =
true;
1373 found_in_scan[(ist<<16)+ksc] =
true;
1390 for (
size_t ist = 0; ist < transports.size(); ++ist)
1393 for (
size_t jdc = 0; jdc < db_transport.
m_channels.size(); ++jdc)
1395 if (!found_in_database[jdc])
1398 for (
size_t ksc = 0; ksc < scan_transport.
m_channels.size(); ++ksc)
1400 if (!found_in_scan[(ist<<16)+ksc])
1405 found_in_other_transport++;
1406 found_in_database[jdc] =
true;
1407 found_in_scan[(ist<<16)+ksc] =
true;
1421 if (found_transport)
1424 tmp.m_channels.clear();
1426 for (
size_t idc = 0; idc < db_transport.
m_channels.size(); ++idc)
1428 if (!found_in_database[idc])
1435 if (!
tmp.m_channels.empty())
1436 not_in_scan.push_back(
tmp);
1439 LOG(VB_GENERAL, LOG_INFO,
LOC +
1440 QString(
"Old channels found in same transport: %1")
1441 .arg(found_in_same_transport));
1442 LOG(VB_GENERAL, LOG_INFO,
LOC +
1443 QString(
"Old channels found in other transport: %1")
1444 .arg(found_in_other_transport));
1445 LOG(VB_GENERAL, LOG_INFO,
LOC +
1446 QString(
"Old channels not found (off-air): %1")
1447 .arg(found_nowhere));
1455 for (
auto & transport : transports)
1457 for (
auto & chan : transport.m_channels)
1459 if (((chan.m_couldBeOpencable && (chan.m_siStandard ==
"mpeg")) ||
1460 chan.m_isOpencable) && !chan.m_inVct)
1462 chan.m_siStandard =
"opencable";
1472 for (
const auto & transport : transports)
1474 for (
const auto & chan : transport.m_channels)
1477 if (chan.m_isEncrypted)
1479 if (chan.m_siStandard ==
"atsc")
info.m_atscChannels[enc] += 1;
1480 if (chan.m_siStandard ==
"dvb")
info.m_dvbChannels[enc] += 1;
1481 if (chan.m_siStandard ==
"mpeg")
info.m_mpegChannels[enc] += 1;
1482 if (chan.m_siStandard ==
"opencable")
info.m_scteChannels[enc] += 1;
1483 if (chan.m_siStandard ==
"ntsc")
info.m_ntscChannels[enc] += 1;
1484 if (chan.m_siStandard !=
"ntsc")
1486 ++
info.m_progNumCnt[chan.m_serviceId];
1489 if (chan.m_siStandard ==
"atsc")
1491 ++
info.m_atscNumCnt[(chan.m_atscMajorChannel << 16) |
1492 (chan.m_atscMinorChannel)];
1493 ++
info.m_atscMinCnt[chan.m_atscMinorChannel];
1494 ++
info.m_atscMajCnt[chan.m_atscMajorChannel];
1496 if (chan.m_siStandard ==
"ntsc")
1498 ++
info.m_atscNumCnt[(chan.m_atscMajorChannel << 16) |
1499 (chan.m_atscMinorChannel)];
1513 for (
const auto & transport : transports)
1515 for (
const auto & chan : transport.m_channels)
1518 (
info.m_progNumCnt[chan.m_serviceId] == 1) ? 1 : 0;
1520 (
info.m_chanNumCnt[
map_str(chan.m_chanNum)] == 1) ? 1 : 0;
1522 if (chan.m_siStandard ==
"atsc")
1525 (
info.m_atscNumCnt[(chan.m_atscMajorChannel << 16) |
1526 (chan.m_atscMinorChannel)] == 1) ? 1 : 0;
1528 (
info.m_atscMinCnt[(chan.m_atscMinorChannel)] == 1) ? 1 : 0;
1531 info.m_atscMajCnt[chan.m_atscMajorChannel]);
1549 QTextStream ssMsg(&msg);
1553 QString si_standard = (chan.
m_siStandard==
"opencable") ?
1556 if (si_standard ==
"atsc" || si_standard ==
"scte")
1558 ssMsg << (QString(
"%1:%2:%3-%4:%5:%6=%7=%8:%9")
1566 .arg(si_standard)).toLatin1().constData();
1568 else if (si_standard ==
"dvb")
1570 ssMsg << (QString(
"%1:%2:%3:%4:%5:%6=%7:%8")
1576 .arg(si_standard)).toLatin1().constData();
1580 ssMsg << (QString(
"%1:%2:%3:%4:%5")
1584 .arg(si_standard)).toLatin1().constData();
1590 msg = msg.leftJustified(72);
1595 << (QString(
"cnt(pnum:%1,channum:%2)")
1598 ).toLatin1().constData();
1603 (QString(
":atsc_cnt(tot:%1,minor:%2)")
1604 .arg(
info->m_atscNumCnt[
1608 ).toLatin1().constData();
1631 QTextStream ssMsg(&msg);
1633 QString si_standard = (chan.
m_siStandard==
"opencable") ?
1636 if (si_standard ==
"atsc" || si_standard ==
"scte")
1638 if (si_standard ==
"atsc")
1646 ssMsg << (QString(
"%1-%2")
1652 ssMsg << (QString(
"%1-%2")
1658 ssMsg << (QString(
" (%1)")
1659 .arg(chan.
m_callSign)).toLatin1().constData();
1661 else if (si_standard ==
"dvb")
1663 ssMsg << (QString(
"%1 (%2 %3)")
1665 .arg(chan.
m_netId)).toLatin1().constData();
1669 ssMsg << (QString(
"%1-%2")
1671 .toLatin1().constData();
1675 ssMsg << (QString(
"%1-%2")
1677 .toLatin1().constData();
1688 struct less_than_key
1696 std::sort(transports.begin(), transports.end(), less_than_key());
1700 for (
auto & transport : transports)
1702 auto fmt_chan = [transport,
info](
const QString & m,
const auto & chan)
1704 msg = std::accumulate(transport.m_channels.cbegin(), transport.m_channels.cend(),
1715 QTextStream ssMsg(&msg);
1717 ssMsg << QString(
" onid:%1").arg(transport.
m_networkID);
1727 struct less_than_key
1735 std::sort(transports.begin(), transports.end(), less_than_key());
1737 auto fmt_trans = [](
const QString& msg,
const auto & transport)
1739 return std::accumulate(transports.cbegin(), transports.cend(),
1740 QString(), fmt_trans);
1747 QString msg = tr(
"Channels: FTA Enc Dec\n") +
1748 QString(
"ATSC %1 %2 %3\n")
1749 .arg(
info.m_atscChannels[0],3)
1750 .arg(
info.m_atscChannels[1],3)
1751 .arg(
info.m_atscChannels[2],3) +
1752 QString(
"DVB %1 %2 %3\n")
1753 .arg(
info.m_dvbChannels [0],3)
1754 .arg(
info.m_dvbChannels [1],3)
1755 .arg(
info.m_dvbChannels [2],3) +
1756 QString(
"SCTE %1 %2 %3\n")
1757 .arg(
info.m_scteChannels[0],3)
1758 .arg(
info.m_scteChannels[1],3)
1759 .arg(
info.m_scteChannels[2],3) +
1760 QString(
"MPEG %1 %2 %3\n")
1761 .arg(
info.m_mpegChannels[0],3)
1762 .arg(
info.m_mpegChannels[1],3)
1763 .arg(
info.m_mpegChannels[2],3) +
1764 QString(
"NTSC %1\n")
1765 .arg(
info.m_ntscChannels[0],3) +
1766 tr(
"Unique: prog %1 atsc %2 atsc minor %3 channum %4\n")
1769 tr(
"Max atsc major count: %1")
1835 new_chan = old_chan = 0;
1836 for (
const auto & transport : transports)
1838 for (
const auto& chan : transport.m_channels)
1842 if (chan.m_channelId)
1854 auto add_count = [](
int count,
const auto & transport)
1855 {
return count + transport.m_channels.size(); };
1856 return std::accumulate(transports.cbegin(), transports.cend(),
1877 static QMutex s_lastFreeLock;
1878 static QMap<uint,uint> s_lastFreeChanNumMap;
1886 for (
char suffix =
'A'; suffix <=
'Z'; ++suffix)
1894 QMutexLocker locker(&s_lastFreeLock);
1896 for (last_free_chan_num++; ; ++last_free_chan_num)
1898 chanNum = QString::number(last_free_chan_num);
1902 s_lastFreeChanNumMap[chan.
m_sourceId] = last_free_chan_num;
1930 auto *deleteDialog =
1933 if (deleteDialog->Create())
1935 deleteDialog->AddButton(tr(
"Delete All"));
1936 deleteDialog->AddButton(tr(
"Set all invisible"));
1938 deleteDialog->AddButton(tr(
"Ignore All"));
1940 [
this](
const QString & ,
int result)
1960 std::cout << msg.toLatin1().constData()
1962 << tr(
"Do you want to:").toLatin1().constData()
1964 << tr(
"1. Delete All").toLatin1().constData()
1966 << tr(
"2. Set all invisible").toLatin1().constData()
1969 << tr(
"4. Ignore All").toLatin1().constData()
1976 uint val = QString(ret.c_str()).toUInt(&ok);
1977 if (ok && (val == 1 || val == 2 || val == 4))
1987 std::cout << tr(
"Please enter either 1, 2 or 4:")
1988 .toLatin1().constData() << std::endl;
2018 auto *insertDialog =
2021 if (insertDialog->Create())
2023 insertDialog->AddButton(tr(
"Insert All"));
2024 insertDialog->AddButton(tr(
"Insert Manually"));
2025 insertDialog->AddButton(tr(
"Ignore All"));
2027 [
this](
const QString & ,
int result)
2047 std::cout << msg.toLatin1().constData()
2049 << tr(
"Do you want to:").toLatin1().constData()
2051 << tr(
"1. Insert All").toLatin1().constData()
2053 << tr(
"2. Insert Manually").toLatin1().constData()
2055 << tr(
"3. Ignore All").toLatin1().constData()
2062 uint val = QString(ret.c_str()).toUInt(&ok);
2063 if (ok && (1 <= val) && (val <= 3))
2071 std::cout << tr(
"Please enter either 1, 2, or 3:")
2072 .toLatin1().constData() << std::endl;
2103 auto *updateDialog =
2106 if (updateDialog->Create())
2108 updateDialog->AddButton(tr(
"Update All"));
2109 updateDialog->AddButton(tr(
"Ignore All"));
2111 [
this](
const QString& ,
int result)
2130 std::cout << msg.toLatin1().constData()
2132 << tr(
"Do you want to:").toLatin1().constData()
2134 << tr(
"1. Update All").toLatin1().constData()
2136 << tr(
"2. Update Manually").toLatin1().constData()
2138 << tr(
"3. Ignore All").toLatin1().constData()
2145 uint val = QString(ret.c_str()).toUInt(&ok);
2146 if (ok && (1 <= val) && (val <= 3))
2154 std::cout << tr(
"Please enter either 1, 2, or 3:")
2155 .toLatin1().constData() << std::endl;
2163 const QString& title,
2164 const QString& message, QString &text)
2184 popupStack = parent->
GetStack(
"popup stack");
2186 "manualchannelpopup");
2188 if (popup->Create())
2190 popup->AddButtonD(QCoreApplication::translate(
"(Common)",
"OK"), 0 == dmc);
2191 popup->AddButtonD(tr(
"Edit"), 1 == dmc);
2192 popup->AddButtonD(QCoreApplication::translate(
"(Common)",
"Cancel"), 2 == dmc);
2193 popup->AddButtonD(QCoreApplication::translate(
"(Common)",
"Cancel All"), 3 == dmc);
2195 [
this](
const QString & ,
int result)
2226 tr(
"Please enter a unique channel number."),
2228 if (textEdit->Create())
2231 [
this,&text](QString result)
2234 text = std::move(result);
2253 case 0: rval =
kOCTOk;
break;
2263 const QString& title,
2264 const QString& message, QString &text)
2285 popupStack = parent->
GetStack(
"popup stack");
2287 "resolvechannelpopup");
2289 if (popup->Create())
2291 popup->AddButtonD(QCoreApplication::translate(
"(Common)",
"OK"), 0 == dmc);
2292 popup->AddButtonD(QCoreApplication::translate(
"(Common)",
"OK All"), 1 == dmc);
2293 popup->AddButtonD(tr(
"Edit"), 2 == dmc);
2294 popup->AddButtonD(QCoreApplication::translate(
"(Common)",
"Cancel"), 3 == dmc);
2295 popup->AddButtonD(QCoreApplication::translate(
"(Common)",
"Cancel All"), 4 == dmc);
2297 [
this](
const QString & ,
int result)
2327 tr(
"Please enter a unique channel number."),
2329 if (textEdit->Create())
2332 [
this,&text](QString result)
2335 text = std::move(result);
2355 case 0: rval =
kOCTOk;
break;
2369 QString msg = tr(
"Channel %1 has channel number %2 but that is already in use.")
2381 msg2 += tr(
"Please enter a unique channel number.");
2385 msg2 += tr(
"Default value is %1.").arg(val);
2387 tr(
"Channel Importer"),
2403 std::cout << msg.toLatin1().constData() << std::endl;
2405 QString cancelStr = QCoreApplication::translate(
"(Common)",
2406 "Cancel").toLower();
2407 QString cancelAllStr = QCoreApplication::translate(
"(Common)",
2408 "Cancel All").toLower();
2409 QString msg2 = tr(
"Please enter a non-conflicting channel number "
2410 "(or type '%1' to skip, '%2' to skip all):")
2411 .arg(cancelStr, cancelAllStr);
2415 std::cout << msg2.toLatin1().constData() << std::endl;
2418 QString val = QString(sret.c_str());
2419 if (val.toLower() == cancelStr)
2424 if (val.toLower() == cancelAllStr)
2447 QString msg = tr(
"You chose to manually insert channel %1.")
2458 msg2 += tr(
"Please enter a unique channel number.");
2462 msg2 += tr(
"Default value is %1").arg(val);
2464 tr(
"Channel Importer"),
2481 std::cout << msg.toLatin1().constData() << std::endl;
2483 QString cancelStr = QCoreApplication::translate(
"(Common)",
"Cancel").toLower();
2484 QString cancelAllStr = QCoreApplication::translate(
"(Common)",
"Cancel All").toLower();
2487 QString msg2 = tr(
"Please enter a non-conflicting channel number "
2488 "(or type '%1' to skip, '%2' to skip all): ")
2489 .arg(cancelStr, cancelAllStr);
2493 std::cout << msg2.toLatin1().constData() << std::endl;
2496 QString val = QString(sret.c_str());
2497 if (val.toLower() == cancelStr)
2502 if (val.toLower() == cancelAllStr)
2531 bool ok = (num.length() >= 1);
2532 ok = ok && ((num[0] >=
'0') && (num[0] <=
'9'));