Ticket #2240: 2240-v1.patch
| File 2240-v1.patch, 6.9 KB (added by , 19 years ago) |
|---|
-
libs/libmythtv/channeleditor.cpp
19 19 20 20 #include "scanwizard.h" 21 21 22 ChannelWizard::ChannelWizard(int id )22 ChannelWizard::ChannelWizard(int id, int default_sourceid) 23 23 : ConfigurationWizard() { 24 24 setLabel(QObject::tr("Channel Options")); 25 25 26 26 // Must be first. 27 27 addChild(cid = new ChannelID()); 28 28 cid->setValue(id); 29 30 ChannelOptionsCommon* common = new ChannelOptionsCommon(*cid); 29 30 ChannelOptionsCommon *common = 31 new ChannelOptionsCommon(*cid, default_sourceid); 31 32 addChild(common); 32 33 33 34 int cardtypes = countCardtypes(); … … 336 337 void ChannelEditor::edit() 337 338 { 338 339 id = list->getValue().toInt(); 339 ChannelWizard cw(id );340 ChannelWizard cw(id, source->getValue().toUInt()); 340 341 cw.exec(); 341 342 342 343 list->fillSelections(); -
libs/libmythtv/channeleditor.h
38 38 class ChannelWizard: public ConfigurationWizard { 39 39 Q_OBJECT 40 40 public: 41 ChannelWizard(int id );41 ChannelWizard(int id, int default_sourceid); 42 42 QString getCardtype(); 43 43 bool cardTypesInclude(const QString& cardtype); 44 44 int countCardtypes(); -
libs/libmythtv/channelsettings.cpp
42 42 }; 43 43 }; 44 44 45 class Source: public ComboBoxSetting, public CSetting { 46 public: 47 Source(const ChannelID& id): 48 ComboBoxSetting(), CSetting(id, "sourceid") { 45 class Source: public ComboBoxSetting, public CSetting 46 { 47 public: 48 Source(const ChannelID &id, uint _default_sourceid) : 49 ComboBoxSetting(), CSetting(id, "sourceid"), 50 default_sourceid(_default_sourceid) 51 { 49 52 setLabel(QObject::tr("Video Source")); 50 53 }; 51 54 52 void load() { 55 void load(void) 56 { 53 57 fillSelections(); 54 58 CSetting::load(); 59 60 if (default_sourceid && !getValue().toUInt()) 61 { 62 uint which = sourceid_to_index[default_sourceid]; 63 if (which) 64 setValue(which); 65 } 55 66 }; 56 67 57 void fillSelections( )68 void fillSelections(void) 58 69 { 59 70 addSelection(QObject::tr("[Not Selected]"), "0"); 60 71 61 72 MSqlQuery query(MSqlQuery::InitCon()); 62 query.prepare("SELECT name, sourceid FROM videosource"); 73 query.prepare("SELECT name, sourceid " 74 "FROM videosource " 75 "ORDER BY sourceid"); 63 76 64 if (query.exec() && query.isActive() && query.size() > 0) 65 while(query.next()) 77 if (!query.exec() || !query.isActive()) 78 { 79 MythContext::DBError("Source::fillSelections", query); 80 } 81 else 82 { 83 for (uint i = 1; query.next(); i++) 84 { 85 sourceid_to_index[query.value(1).toUInt()] = i; 66 86 addSelection(query.value(0).toString(), 67 87 query.value(1).toString()); 88 } 89 } 90 91 sourceid_to_index[0] = 0; // Not selected entry. 68 92 }; 93 94 private: 95 uint default_sourceid; 96 QMap<uint,uint> sourceid_to_index; 69 97 }; 70 98 71 99 class Callsign: public LineEditSetting, public CSetting { … … 265 293 }; 266 294 }; 267 295 268 ChannelOptionsCommon::ChannelOptionsCommon(const ChannelID& id) : 269 ConfigurationGroup(false, true, false, false), 296 ChannelOptionsCommon::ChannelOptionsCommon(const ChannelID &id, 297 uint default_sourceid) : 298 ConfigurationGroup( false, true, false, false), 270 299 VerticalConfigurationGroup(false, true, false, false) 271 300 { 272 301 setLabel(QObject::tr("Channel Options - Common")); … … 274 303 275 304 addChild(new Name(id)); 276 305 277 Source *source ;306 Source *source = new Source(id, default_sourceid); 278 307 279 HorizontalConfigurationGroup* group1 = new HorizontalConfigurationGroup(false,true); 308 HorizontalConfigurationGroup *group1 = 309 new HorizontalConfigurationGroup(false, true); 310 HorizontalConfigurationGroup *lefthoz = 311 new HorizontalConfigurationGroup(false, true); 312 HorizontalConfigurationGroup *bottomhoz = 313 new HorizontalConfigurationGroup(false, true); 314 VerticalConfigurationGroup *left = 315 new VerticalConfigurationGroup(false, true); 316 VerticalConfigurationGroup *right = 317 new VerticalConfigurationGroup(false, true); 280 318 281 VerticalConfigurationGroup* left = new VerticalConfigurationGroup(false,true); 319 lefthoz->addChild(new Visible(id)); 320 lefthoz->addChild(new CommFree(id)); 321 282 322 left->addChild(new Channum(id)); 283 323 left->addChild(new Callsign(id)); 284 285 HorizontalConfigurationGroup *lefthoz = new HorizontalConfigurationGroup(false,true);286 287 lefthoz->addChild(new Visible(id));288 lefthoz->addChild(new CommFree(id));289 324 left->addChild(lefthoz); 290 group1->addChild(left);291 325 292 VerticalConfigurationGroup* right = new VerticalConfigurationGroup(false, true); 293 right->addChild(source = new Source(id)); 326 right->addChild(source); 294 327 right->addChild(new ChannelTVFormat(id)); 295 328 right->addChild(new Priority(id)); 329 330 group1->addChild(left); 296 331 group1->addChild(right); 297 332 333 bottomhoz->addChild(onairguide = new OnAirGuide(id)); 334 bottomhoz->addChild(xmltvID = new XmltvID(id)); 335 bottomhoz->addChild(new TimeOffset(id)); 336 298 337 addChild(group1); 299 300 338 addChild(new Icon(id)); 301 339 addChild(new VideoFilters(id)); 302 340 addChild(new OutputFilters(id)); 303 304 HorizontalConfigurationGroup *bottomhoz =305 new HorizontalConfigurationGroup(false, true);306 307 bottomhoz->addChild(onairguide = new OnAirGuide(id));308 bottomhoz->addChild(xmltvID = new XmltvID(id));309 bottomhoz->addChild(new TimeOffset(id));310 341 addChild(bottomhoz); 311 342 312 343 connect(onairguide, SIGNAL(valueChanged( bool)), -
libs/libmythtv/channelsettings.h
106 106 class OnAirGuide; 107 107 class XmltvID; 108 108 109 class ChannelOptionsCommon: public VerticalConfigurationGroup { 109 class ChannelOptionsCommon: public VerticalConfigurationGroup 110 { 110 111 Q_OBJECT 111 public: 112 ChannelOptionsCommon(const ChannelID& id); 113 void load(); 114 public slots: 112 113 public: 114 ChannelOptionsCommon(const ChannelID &id, uint default_sourceid); 115 void load(void); 116 117 public slots: 115 118 void onAirGuideChanged(bool); 116 119 void sourceChanged(const QString&); 117 120 118 protected:121 protected: 119 122 OnAirGuide *onairguide; 120 123 XmltvID *xmltvID; 121 124 };
