Ticket #2793: 2793-v4.patch
File 2793-v4.patch, 14.1 KB (added by , 17 years ago) |
---|
-
libs/libmythtv/videosource.h
588 588 { 589 589 Q_OBJECT 590 590 public: 591 CardInput(bool is_dtv_card, bool is_dvb_card, int cardid); 591 CardInput(bool is_dtv_card, bool is_dvb_card, 592 bool is_new_input, int cardid); 592 593 ~CardInput(); 593 594 594 595 int getInputID(void) const { return id->intValue(); }; … … 605 606 public slots: 606 607 void channelScanner(); 607 608 void sourceFetch(); 608 void diseqcConfig();609 609 void SetSourceID(const QString &sourceid); 610 610 611 611 private: -
libs/libmythtv/cardutil.cpp
766 766 QStringList::iterator it = inputs.begin(); 767 767 for (; it != inputs.end(); ++it) 768 768 { 769 CardInput* cardinput = new CardInput(is_dtv, false, cardid);769 CardInput* cardinput = new CardInput(is_dtv, false, false, cardid); 770 770 cardinput->loadByInput(rcardid, (*it)); 771 771 cardinput->SetChildCardID((parentid) ? cardid : 0); 772 772 inputLabels.push_back( … … 787 787 InputNames::const_iterator it; 788 788 for (it = list.begin(); it != list.end(); ++it) 789 789 { 790 CardInput *cardinput = new CardInput(is_dtv, true, rcardid);790 CardInput *cardinput = new CardInput(is_dtv, true, false, rcardid); 791 791 cardinput->loadByInput(rcardid, *it); 792 792 cardinput->SetChildCardID(parentid ? cardid : 0); 793 793 inputLabels.push_back( … … 799 799 // plus add one "new" input 800 800 if (needs_conf) 801 801 { 802 CardInput *newcard = new CardInput(is_dtv, true, rcardid);802 CardInput *newcard = new CardInput(is_dtv, true, true, rcardid); 803 803 QString newname = QString("DVBInput #%1").arg(list.size() + 1); 804 804 newcard->loadByInput(rcardid, newname); 805 805 newcard->SetChildCardID((parentid) ? cardid : 0); -
libs/libmythtv/videosource.cpp
1736 1736 }; 1737 1737 }; 1738 1738 1739 CardInput::CardInput(bool isDTVcard, bool isDVBcard, int _cardid) : 1739 CardInput::CardInput(bool isDTVcard, bool isDVBcard, 1740 bool isNewInput, int _cardid) : 1741 id(new ID()), 1742 cardid(new CardID(*this)), 1743 childid(), 1744 inputname(new InputName(*this)), 1745 sourceid(new SourceID(*this)), 1746 startchan(new StartingChannel(*this)), 1747 scan(new TransButtonSetting()), 1748 srcfetch(new TransButtonSetting()), 1740 1749 externalInputSettings(new DiSEqCDevSettings()) 1741 1750 { 1742 (void) _cardid;1751 addChild(id); 1743 1752 1744 addChild(id = new ID()); 1753 if (CardUtil::IsInNeedOfExternalInputConf(_cardid)) 1754 { 1755 addChild(new DTVDeviceConfigGroup(*externalInputSettings, 1756 _cardid, isNewInput)); 1757 } 1745 1758 1746 1759 ConfigurationGroup *group = 1747 1760 new VerticalConfigurationGroup(false, false, true, true); … … 1750 1763 1751 1764 HorizontalConfigurationGroup *ci; 1752 1765 ci = new HorizontalConfigurationGroup(false, false); 1753 ci->addChild(cardid = new CardID(*this));1754 ci->addChild(inputname = new InputName(*this));1766 ci->addChild(cardid); 1767 ci->addChild(inputname); 1755 1768 group->addChild(ci); 1756 1769 group->addChild(new InputDisplayName(*this)); 1757 group->addChild(sourceid = new SourceID(*this));1770 group->addChild(sourceid); 1758 1771 if (!isDVBcard) 1759 1772 { 1760 1773 group->addChild(new ExternalChannelCommand(*this)); … … 1770 1783 group->addChild(chgroup); 1771 1784 } 1772 1785 1773 #ifdef USING_DVB1774 1786 if (isDVBcard) 1775 1787 { 1776 TransButtonSetting *diseqc = new TransButtonSetting();1777 diseqc->setLabel(tr("DVB-S"));1778 diseqc->setHelpText(tr("Input and satellite settings."));1779 diseqc->setVisible(CardUtil::IsInNeedOfExternalInputConf(_cardid));1780 group->addChild(diseqc);1781 connect(diseqc, SIGNAL(pressed()), SLOT(diseqcConfig()));1782 1783 1788 ConfigurationGroup *chgroup = 1784 1789 new HorizontalConfigurationGroup(false, false, true, true); 1785 1790 chgroup->addChild(new RadioServices(*this)); 1786 1791 chgroup->addChild(new DishNetEIT(*this)); 1787 1792 group->addChild(chgroup); 1788 1793 } 1789 #endif1790 1794 1791 scan = new TransButtonSetting();1792 1795 scan->setLabel(tr("Scan for channels")); 1793 1796 scan->setHelpText( 1794 1797 tr("Use channel scanner to find channels for this input.")); 1795 1798 1796 srcfetch = new TransButtonSetting();1797 1799 srcfetch->setLabel(tr("Fetch channels from listings source")); 1798 1800 srcfetch->setHelpText( 1799 1801 tr("This uses the listings data source to " … … 1806 1808 sgrp->addChild(srcfetch); 1807 1809 group->addChild(sgrp); 1808 1810 1809 startchan = new StartingChannel(*this);1810 1811 group->addChild(startchan); 1811 1812 group->addChild(new InputPriority(*this)); 1812 1813 … … 1922 1923 } 1923 1924 } 1924 1925 1925 void CardInput::diseqcConfig(void)1926 {1927 #ifdef USING_DVB1928 DTVDeviceConfigWizard wizard(*externalInputSettings,1929 cardid->getValue().toUInt());1930 wizard.exec();1931 #endif // USING_DVB1932 }1933 1934 1926 QString CardInputDBStorage::whereClause(MSqlBindings& bindings) 1935 1927 { 1936 1928 QString cardinputidTag(":WHERECARDINPUTID"); -
libs/libmythtv/diseqcsettings.cpp
356 356 return str; 357 357 } 358 358 359 static double AngleTo Float(const QString &angle)359 static double AngleToEdit(double angle, QString &hemi) 360 360 { 361 if (angle > 0.0) 362 { 363 hemi = "E"; 364 return angle; 365 } 366 367 hemi = "W"; 368 return -angle; 369 } 370 371 static double AngleToFloat(const QString &angle, bool translated = true) 372 { 361 373 if (angle.length() < 2) 362 374 return 0.0; 363 375 … … 366 378 if (postfix.isLetter()) 367 379 { 368 380 pos = angle.left(angle.length() - 1).toDouble(); 369 if (postfix.upper() == DeviceTree::tr("W", "Western Hemisphere")) 381 if ((translated && 382 (postfix.upper() == DeviceTree::tr("W", "Western Hemisphere"))) || 383 (!translated && (postfix.upper() == "W"))) 384 { 370 385 pos = -pos; 386 } 371 387 } 372 388 else 373 389 pos = angle.toDouble(); … … 1163 1179 1164 1180 //////////////////////////////////////// USALSRotorSetting 1165 1181 1166 class USALSRotorSetting : public LineEditSetting, public Storage1182 class USALSRotorSetting : public HorizontalConfigurationGroup 1167 1183 { 1168 1184 public: 1169 1185 USALSRotorSetting(DiSEqCDevDevice &node, DiSEqCDevSettings &settings) : 1170 LineEditSetting(this), m_node(node), m_settings(settings) 1186 HorizontalConfigurationGroup(false, false, true, true), 1187 numeric(new TransLineEditSetting()), 1188 hemisphere(new TransComboBoxSetting(false)), 1189 m_node(node), m_settings(settings) 1171 1190 { 1172 setLabel(node.GetDescription()); 1173 QString help = DeviceTree::tr( 1174 "The longitude of the satellite you are aiming at, in degrees. " 1175 "In the Western hemisphere use 'W' as the suffix. " 1176 "In the Eastern hemisphere use 'E' as the suffix. "); 1177 setHelpText(help); 1191 QString help = 1192 DeviceTree::tr( 1193 "Locates the satelite you wish to point to " 1194 "with the longitude along the Clarke Belt of" 1195 "the satellite [-180..180] and its hemisphere."); 1196 1197 numeric->setLabel(DeviceTree::tr("Longitude (degrees)")); 1198 numeric->setHelpText(help); 1199 hemisphere->setLabel(DeviceTree::tr("Hemisphere")); 1200 hemisphere->addSelection(DeviceTree::tr("Eastern"), "E", false); 1201 hemisphere->addSelection(DeviceTree::tr("Western"), "W", true); 1202 hemisphere->setHelpText(help); 1203 1204 addChild(numeric); 1205 addChild(hemisphere); 1178 1206 } 1179 1207 1180 1208 virtual void load(void) 1181 1209 { 1182 setValue(AngleToString(m_settings.GetValue(m_node.GetDeviceID()))); 1210 double val = m_settings.GetValue(m_node.GetDeviceID()); 1211 QString hemi = QString::null; 1212 double eval = AngleToEdit(val, hemi); 1213 numeric->setValue(QString::number(eval)); 1214 hemisphere->setValue(hemisphere->getValueIndex(hemi)); 1183 1215 } 1184 1216 1185 1217 virtual void save(void) 1186 1218 { 1187 m_settings.SetValue(m_node.GetDeviceID(), AngleToFloat(getValue())); 1219 QString val = QString::number(numeric->getValue().toDouble()); 1220 val += hemisphere->getValue(); 1221 m_settings.SetValue(m_node.GetDeviceID(), AngleToFloat(val, false)); 1188 1222 } 1189 1223 1190 1224 virtual void save(QString /*destination*/) { } 1191 1225 1192 1226 private: 1193 DiSEqCDevDevice &m_node; 1194 DiSEqCDevSettings &m_settings; 1227 TransLineEditSetting *numeric; 1228 TransComboBoxSetting *hemisphere; 1229 DiSEqCDevDevice &m_node; 1230 DiSEqCDevSettings &m_settings; 1195 1231 }; 1196 1232 1197 //////////////////////////////////////// DTVDeviceConfig Wizard1233 //////////////////////////////////////// DTVDeviceConfigGroup 1198 1234 1199 DTVDeviceConfigWizard::DTVDeviceConfigWizard(DiSEqCDevSettings &settings, 1200 uint cardid) 1201 : m_settings(settings) 1235 DTVDeviceConfigGroup::DTVDeviceConfigGroup( 1236 DiSEqCDevSettings &settings, uint cardid, bool switches_enabled) : 1237 VerticalConfigurationGroup(false, false, true, true), 1238 m_settings(settings), m_switches_enabled(switches_enabled) 1202 1239 { 1203 ConfigurationGroup *group = 1204 new VerticalConfigurationGroup(false, false); 1205 group->setLabel(DeviceTree::tr("DTV Device Configuration")); 1240 setLabel(DeviceTree::tr("DTV Device Configuration")); 1206 1241 1207 1242 // load 1208 1243 m_tree.Load(cardid); 1209 1244 1210 1245 // initial UI setup 1211 AddNodes(*group, m_tree.Root()); 1212 SelectNodes(); 1213 1214 addChild(group); 1246 AddNodes(this, QString::null, m_tree.Root()); 1215 1247 } 1216 1248 1217 DTVDeviceConfig Wizard::~DTVDeviceConfigWizard(void)1249 DTVDeviceConfigGroup::~DTVDeviceConfigGroup(void) 1218 1250 { 1219 1251 } 1220 1252 1221 void DTVDeviceConfig Wizard::AddNodes(ConfigurationGroup &group,1222 DiSEqCDevDevice*node)1253 void DTVDeviceConfigGroup::AddNodes( 1254 ConfigurationGroup *group, const QString &trigger, DiSEqCDevDevice *node) 1223 1255 { 1224 1256 if (!node) 1225 1257 return; … … 1229 1261 { 1230 1262 case DiSEqCDevDevice::kTypeSwitch: 1231 1263 setting = new SwitchSetting(*node, m_settings); 1232 connect(setting, SIGNAL(valueChanged(const QString&)), 1233 SLOT(SelectNodes())); 1264 setting->setEnabled(m_switches_enabled); 1234 1265 break; 1235 1266 case DiSEqCDevDevice::kTypeRotor: 1236 1267 { … … 1245 1276 break; 1246 1277 } 1247 1278 1248 if ( setting)1279 if (!setting) 1249 1280 { 1250 // add this node 1251 m_devs[node->GetDeviceID()] = setting; 1252 group.addChild(setting); 1281 AddChild(group, trigger, new TransLabelSetting()); 1282 return; 1253 1283 } 1254 1284 1255 // add children 1285 m_devs[node->GetDeviceID()] = setting; 1286 1256 1287 uint num_ch = node->GetChildCount(); 1257 for (uint ch = 0; ch < num_ch; ch++) 1258 AddNodes(group, node->GetChild(ch)); 1259 } 1288 if (DiSEqCDevDevice::kTypeSwitch == node->GetDeviceType()) 1289 { 1290 bool useframe = (node != m_tree.Root()); 1291 bool zerospace = !useframe; 1292 TriggeredConfigurationGroup *cgrp = new TriggeredConfigurationGroup( 1293 false, useframe, true, true, false, false, true, zerospace); 1260 1294 1261 void DTVDeviceConfigWizard::SelectNodes(void) 1262 { 1263 ConfigurationWizard::save(); 1295 cgrp->addChild(setting); 1296 cgrp->setTrigger(setting); 1264 1297 1265 QMap<uint,bool> active; 1266 DiSEqCDevDevice *node = m_tree.Root(); 1267 while (node) 1298 for (uint i = 0; i < num_ch; i++) 1299 AddNodes(cgrp, QString::number(i), node->GetChild(i)); 1300 1301 AddChild(group, trigger, cgrp); 1302 return; 1303 } 1304 1305 if (!num_ch) 1268 1306 { 1269 active[node->GetDeviceID()] = true;1270 node = node->GetSelectedChild(m_settings);1307 AddChild(group, trigger, setting); 1308 return; 1271 1309 } 1272 1310 1273 devid_to_setting_t::iterator it = m_devs.begin(); 1274 for (; it != m_devs.end(); ++it) 1275 (*it)->setEnabled(active[it.key()]); 1311 VerticalConfigurationGroup *cgrp = 1312 new VerticalConfigurationGroup(false, false, true, true); 1313 1314 AddChild(cgrp, QString::null, setting); 1315 for (uint i = 0; i < num_ch; i++) 1316 AddNodes(cgrp, QString::null, node->GetChild(i)); 1317 1318 AddChild(group, trigger, cgrp); 1276 1319 } 1277 1320 1321 void DTVDeviceConfigGroup::AddChild( 1322 ConfigurationGroup *group, const QString &trigger, Setting *setting) 1323 { 1324 TriggeredConfigurationGroup *grp = 1325 dynamic_cast<TriggeredConfigurationGroup*>(group); 1326 1327 if (grp && !trigger.isEmpty()) 1328 grp->addTarget(trigger, setting); 1329 else 1330 group->addChild(setting); 1331 } 1332 1278 1333 //////////////////////////////////////// Database Upgrade 1279 1334 1280 1335 enum OLD_DISEQC_TYPES -
libs/libmythtv/diseqcsettings.h
133 133 virtual int exec(void); 134 134 }; 135 135 136 class DTVDeviceConfig Wizard : public QObject, public ConfigurationWizard136 class DTVDeviceConfigGroup : public VerticalConfigurationGroup 137 137 { 138 Q_OBJECT139 140 138 public: 141 DTVDeviceConfigWizard(DiSEqCDevSettings &settings, uint cardid); 142 ~DTVDeviceConfigWizard(void); 139 DTVDeviceConfigGroup(DiSEqCDevSettings &settings, uint cardid, 140 bool switches_enabled); 141 ~DTVDeviceConfigGroup(void); 143 142 144 public slots:145 void SelectNodes(void);146 147 143 protected: 148 void AddNodes(ConfigurationGroup &group, DiSEqCDevDevice *node); 144 void AddNodes(ConfigurationGroup *group, const QString &trigger, 145 DiSEqCDevDevice *node); 146 147 void AddChild(ConfigurationGroup *group, const QString &trigger, 148 Setting *setting); 149 149 150 150 private: 151 151 DiSEqCDevTree m_tree; 152 152 DiSEqCDevSettings &m_settings; 153 153 devid_to_setting_t m_devs; 154 bool m_switches_enabled; 154 155 }; 155 156 156 157 #endif // _DISEQCSETTINGS_H_