00001
00002
00003
00004 #include "inputinfo.h"
00005
00006 InputInfo::InputInfo(
00007 const QString &_name,
00008 uint _sourceid, uint _inputid, uint _cardid, uint _mplexid,
00009 uint _livetvorder) :
00010 name(_name),
00011 sourceid(_sourceid),
00012 inputid(_inputid),
00013 cardid(_cardid),
00014 mplexid(_mplexid),
00015 livetvorder(_livetvorder)
00016 {
00017 name.detach();
00018 }
00019
00020 InputInfo::InputInfo(const InputInfo &other) :
00021 name(other.name),
00022 sourceid(other.sourceid),
00023 inputid(other.inputid),
00024 cardid(other.cardid),
00025 mplexid(other.mplexid),
00026 livetvorder(other.livetvorder)
00027 {
00028 name.detach();
00029 }
00030
00031 InputInfo &InputInfo::operator=(const InputInfo &other)
00032 {
00033 name = other.name;
00034 name.detach();
00035 sourceid = other.sourceid;
00036 inputid = other.inputid;
00037 cardid = other.cardid;
00038 mplexid = other.mplexid;
00039 livetvorder = other.livetvorder;
00040 return *this;
00041 }
00042
00043 void InputInfo::Clear(void)
00044 {
00045 InputInfo blank;
00046 *this = blank;
00047 }
00048
00049 #define NEXT() do { ++it; if (it == end) return false; } while (0)
00050 bool InputInfo::FromStringList(QStringList::const_iterator &it,
00051 QStringList::const_iterator end)
00052 {
00053 if (it == end)
00054 return false;
00055
00056 name = *it;
00057 name.detach();
00058 name = (name == "<EMPTY>") ? QString::null : name;
00059 NEXT();
00060
00061 sourceid = (*it).toUInt(); NEXT();
00062 inputid = (*it).toUInt(); NEXT();
00063 cardid = (*it).toUInt(); NEXT();
00064 mplexid = (*it).toUInt(); NEXT();
00065 livetvorder = (*it).toUInt(); ++it;
00066
00067 return true;
00068 }
00069 #undef NEXT
00070
00071 void InputInfo::ToStringList(QStringList &list) const
00072 {
00073 list.push_back(name.isEmpty() ? "<EMPTY>" : name);
00074 list.push_back(QString::number(sourceid));
00075 list.push_back(QString::number(inputid));
00076 list.push_back(QString::number(cardid));
00077 list.push_back(QString::number(mplexid));
00078 list.push_back(QString::number(livetvorder));
00079 }
00080
00081 TunedInputInfo::TunedInputInfo(
00082 const QString &_name,
00083 uint _sourceid, uint _inputid, uint _cardid, uint _mplexid,
00084 uint _livetvorder, uint _chanid) :
00085 InputInfo(_name, _sourceid, _inputid, _cardid, _mplexid, _livetvorder),
00086 chanid(_chanid)
00087 {
00088 }
00089
00090 TunedInputInfo::TunedInputInfo(const TunedInputInfo &other) :
00091 InputInfo(other), chanid(other.chanid)
00092 {
00093 }
00094
00095 TunedInputInfo &TunedInputInfo::operator=(const TunedInputInfo &other)
00096 {
00097 *((InputInfo*)this) = other;
00098 chanid = other.chanid;
00099 return *this;
00100 }
00101
00102 void TunedInputInfo::Clear(void)
00103 {
00104 TunedInputInfo blank;
00105 *this = blank;
00106 }
00107
00108 bool TunedInputInfo::FromStringList(QStringList::const_iterator &it,
00109 QStringList::const_iterator end)
00110 {
00111 if (!InputInfo::FromStringList(it, end) || (it == end))
00112 return false;
00113
00114 chanid = (*it).toUInt();
00115 ++it;
00116 return true;
00117 }
00118
00119 void TunedInputInfo::ToStringList(QStringList &list) const
00120 {
00121 InputInfo::ToStringList(list);
00122 list.push_back(QString::number(chanid));
00123 }
00124
00125 ChannelInputInfo::ChannelInputInfo(const ChannelInputInfo &other) :
00126 InputInfo(*this),
00127 startChanNum(other.startChanNum),
00128 tuneToChannel(other.tuneToChannel),
00129 externalChanger(other.externalChanger),
00130 channels(other.channels),
00131 groups(other.groups),
00132 inputNumV4L(other.inputNumV4L),
00133 videoModeV4L1(other.videoModeV4L1),
00134 videoModeV4L2(other.videoModeV4L2)
00135 {
00136 startChanNum.detach();
00137 tuneToChannel.detach();
00138 externalChanger.detach();
00139 }
00140
00141 ChannelInputInfo &ChannelInputInfo::operator=(const ChannelInputInfo &other)
00142 {
00143 *((InputInfo*)this) = other;
00144
00145 startChanNum = other.startChanNum;
00146 tuneToChannel = other.tuneToChannel;
00147 externalChanger = other.externalChanger;
00148 channels = other.channels;
00149 groups = other.groups;
00150 inputNumV4L = other.inputNumV4L;
00151 videoModeV4L1 = other.videoModeV4L1;
00152 videoModeV4L2 = other.videoModeV4L2;
00153
00154 startChanNum.detach();
00155 tuneToChannel.detach();
00156 externalChanger.detach();
00157
00158 return *this;
00159 }
00160
00161 void ChannelInputInfo::Clear(void)
00162 {
00163 ChannelInputInfo blank;
00164 *this = blank;
00165 }
00166