Ticket #2226: mythtv-diseqc-repeat-option.patch
File mythtv-diseqc-repeat-option.patch, 8.5 KB (added by , 18 years ago) |
---|
-
libs/libmythtv/diseqc.cpp
1106 1106 // populate switch parameters from db 1107 1107 MSqlQuery query(MSqlQuery::InitCon()); 1108 1108 query.prepare( 1109 "SELECT subtype, switch_ports "1109 "SELECT subtype, switch_ports, cmd_repeat " 1110 1110 "FROM diseqc_tree " 1111 1111 "WHERE diseqcid = :DEVID"); 1112 1112 query.bindValue(":DEVID", GetDeviceID()); … … 1120 1120 { 1121 1121 m_type = SwitchTypeFromString(query.value(0).toString()); 1122 1122 m_num_ports = query.value(1).toUInt(); 1123 m_repeat = query.value(2).toUInt(); 1123 1124 m_children.resize(m_num_ports); 1124 1125 for (uint i = 0; i < m_num_ports; i++) 1125 1126 m_children[i] = NULL; … … 1169 1170 " type = 'switch', " 1170 1171 " description = :DESC, " 1171 1172 " subtype = :TYPE, " 1172 " switch_ports = :PORTS " 1173 " switch_ports = :PORTS, " 1174 " cmd_repeat = :REPEAT " 1173 1175 "WHERE diseqcid = :DEVID"); 1174 1176 } 1175 1177 else … … 1177 1179 query.prepare( 1178 1180 "INSERT INTO diseqc_tree" 1179 1181 " ( parentid, ordinal, type, " 1180 " description, subtype, switch_ports) " 1182 " description, subtype, switch_ports, " 1183 " cmd_repeat )" 1181 1184 "VALUES " 1182 1185 " (:PARENT, :ORDINAL, 'switch', " 1183 " :DESC, :TYPE, :PORTS)"); 1186 " :DESC, :TYPE, :PORTS, " 1187 " :REPEAT )"); 1184 1188 } 1185 1189 1186 1190 if (m_parent) … … 1190 1194 query.bindValue(":DESC", GetDescription()); 1191 1195 query.bindValue(":TYPE", type); 1192 1196 query.bindValue(":PORTS", m_num_ports); 1197 query.bindValue(":REPEAT", m_repeat); 1193 1198 query.bindValue(":DEVID", GetDeviceID()); 1194 1199 1195 1200 if (!query.exec()) … … 1555 1560 MSqlQuery query(MSqlQuery::InitCon()); 1556 1561 query.prepare( 1557 1562 "SELECT subtype, rotor_positions, " 1558 " rotor_hi_speed, rotor_lo_speed " 1563 " rotor_hi_speed, rotor_lo_speed, " 1564 " cmd_repeat " 1559 1565 "FROM diseqc_tree " 1560 1566 "WHERE diseqcid = :DEVID"); 1561 1567 query.bindValue(":DEVID", GetDeviceID()); … … 1570 1576 m_type = RotorTypeFromString(query.value(0).toString()); 1571 1577 m_speed_hi = query.value(2).toDouble(); 1572 1578 m_speed_lo = query.value(3).toDouble(); 1579 m_repeat = query.value(4).toUInt(); 1573 1580 1574 1581 // form of "angle1=index1:angle2=index2:..." 1575 1582 QString positions = query.value(1).toString(); … … 1639 1646 " subtype = :TYPE, " 1640 1647 " rotor_hi_speed = :HISPEED, " 1641 1648 " rotor_lo_speed = :LOSPEED, " 1642 " rotor_positions = :POSMAP " 1649 " rotor_positions = :POSMAP, " 1650 " cmd_repeat = :REPEAT " 1643 1651 "WHERE diseqcid = :DEVID"); 1644 1652 } 1645 1653 else … … 1648 1656 "INSERT INTO diseqc_tree " 1649 1657 " ( parentid, ordinal, type, " 1650 1658 " description, subtype, rotor_hi_speed, " 1651 " rotor_lo_speed, rotor_positions ) "1659 " rotor_lo_speed, rotor_positions, cmd_repeat ) " 1652 1660 "VALUES " 1653 1661 " (:PARENT, :ORDINAL, 'rotor', " 1654 1662 " :DESC, :TYPE, :HISPEED, " 1655 " :LOSPEED, :POSMAP )");1663 " :LOSPEED, :POSMAP, :REPEAT )"); 1656 1664 } 1657 1665 1658 1666 if (m_parent) … … 1664 1672 query.bindValue(":HISPEED", m_speed_hi); 1665 1673 query.bindValue(":LOSPEED", m_speed_lo); 1666 1674 query.bindValue(":POSMAP", posmap); 1675 query.bindValue(":REPEAT", m_repeat); 1667 1676 query.bindValue(":DEVID", GetDeviceID()); 1668 1677 1669 1678 if (!query.exec()) … … 1883 1892 MSqlQuery query(MSqlQuery::InitCon()); 1884 1893 query.prepare( 1885 1894 "SELECT subtype, lnb_lof_switch, " 1886 " lnb_lof_hi, lnb_lof_lo " 1895 " lnb_lof_hi, lnb_lof_lo, " 1896 " cmd_repeat " 1887 1897 "FROM diseqc_tree " 1888 1898 "WHERE diseqcid = :DEVID"); 1889 1899 query.bindValue(":DEVID", GetDeviceID()); … … 1899 1909 m_lof_switch = query.value(1).toInt(); 1900 1910 m_lof_hi = query.value(2).toInt(); 1901 1911 m_lof_lo = query.value(3).toInt(); 1912 m_repeat = query.value(4).toUInt(); 1902 1913 } 1903 1914 1904 1915 return true; … … 1921 1932 " subtype = :TYPE, " 1922 1933 " lnb_lof_switch = :LOFSW, " 1923 1934 " lnb_lof_lo = :LOFLO, " 1924 " lnb_lof_hi = :LOFHI " 1935 " lnb_lof_hi = :LOFHI, " 1936 " cmd_repeat = :REPEAT " 1925 1937 "WHERE diseqcid = :DEVID"); 1926 1938 } 1927 1939 else … … 1930 1942 "INSERT INTO diseqc_tree" 1931 1943 " ( parentid, ordinal, type, " 1932 1944 " description, subtype, lnb_lof_switch, " 1933 " lnb_lof_lo, lnb_lof_hi ) "1945 " lnb_lof_lo, lnb_lof_hi, cmd_repeat ) " 1934 1946 "VALUES " 1935 1947 " (:PARENT, :ORDINAL, 'lnb', " 1936 1948 " :DESC, :TYPE, :LOFSW, " 1937 " :LOFLO, :LOFHI ) ");1949 " :LOFLO, :LOFHI, :REPEAT ) "); 1938 1950 } 1939 1951 1940 1952 if (m_parent) … … 1946 1958 query.bindValue(":LOFSW", m_lof_switch); 1947 1959 query.bindValue(":LOFLO", m_lof_lo); 1948 1960 query.bindValue(":LOFHI", m_lof_hi); 1961 query.bindValue(":REPEAT", m_repeat); 1949 1962 query.bindValue(":DEVID", GetDeviceID()); 1950 1963 1951 1964 // update dev_id -
libs/libmythtv/diseqc.h
147 147 void SetParent(DiSEqCDevDevice* parent) { m_parent = parent; } 148 148 void SetOrdinal(uint ordinal) { m_ordinal = ordinal; } 149 149 void SetDescription(const QString &desc) { m_desc = desc; } 150 void SetRepeatCount(uint repeat) { m_repeat = repeat; } 150 151 virtual bool SetChild(uint, DiSEqCDevDevice*){return false; } 151 152 152 153 // Gets … … 157 158 DiSEqCDevDevice *GetParent(void) const { return m_parent; } 158 159 uint GetOrdinal(void) const { return m_ordinal; } 159 160 QString GetDescription(void) const { return m_desc; } 161 uint GetRepeatCount(void) const { return m_repeat; } 160 162 virtual uint GetChildCount(void) const { return 0; } 161 163 virtual bool IsCommandNeeded( 162 164 const DiSEqCDevSettings&) const { return false; } -
libs/libmythtv/diseqcsettings.cpp
96 96 DiSEqCDevDevice &m_device; 97 97 }; 98 98 99 100 //////////////////////////////////////// DeviceRepeatSetting 101 102 class DeviceRepeatSetting : public LineEditSetting 103 { 104 public: 105 DeviceRepeatSetting(DiSEqCDevDevice &device) : m_device(device) 106 { 107 setLabel(DeviceTree::tr("Repeat Count")); 108 QString help = DeviceTree::tr( 109 "Number of times to repeat DiSEqC commands sent to this device. " 110 "Larger values may help with less reliable devices."); 111 setHelpText(help); 112 } 113 114 virtual void load(void) 115 { 116 setValue(QString::number(m_device.GetRepeatCount())); 117 } 118 119 virtual void save(void) 120 { 121 m_device.SetRepeatCount(getValue().toUInt()); 122 } 123 124 private: 125 DiSEqCDevDevice &m_device; 126 }; 127 99 128 //////////////////////////////////////// SwitchTypeSetting 100 129 101 130 class SwitchTypeSetting : public ComboBoxSetting … … 171 200 group->setLabel(DeviceTree::tr("Switch Configuration")); 172 201 173 202 group->addChild(new DeviceDescrSetting(switch_dev)); 203 group->addChild(new DeviceRepeatSetting(switch_dev)); 174 204 m_type = new SwitchTypeSetting(switch_dev); 175 205 group->addChild(m_type); 176 206 m_ports = new SwitchPortsSetting(switch_dev); … … 408 438 group->setLabel(DeviceTree::tr("Rotor Configuration")); 409 439 410 440 group->addChild(new DeviceDescrSetting(rotor)); 441 group->addChild(new DeviceRepeatSetting(rotor)); 411 442 412 443 ConfigurationGroup *tgroup = 413 444 new HorizontalConfigurationGroup(false, false, true, true);