MCPcopy Create free account
hub / github.com/KikoPlayProject/KikoPlay / setData

Method setData

MediaLibrary/episodesmodel.cpp:145–177  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

143}
144
145bool EpisodesModel::setData(const QModelIndex &index, const QVariant &value, int )
146{
147 if(!index.isValid() || !currentAnime) return false;
148 Columns col=static_cast<Columns>(index.column());
149 auto &ep=currentEps[index.row()];
150 switch (col)
151 {
152 case Columns::TITLE:
153 {
154 EpInfo nEp(value.value<EpInfo>());
155 if(ep.name==nEp.name && ep.type==nEp.type && ep.index==nEp.index)return false;
156 AnimeWorker::instance()->updateEpInfo(currentAnime->name(),ep.localFile, nEp);
157 break;
158 }
159 case Columns::FINISHTIME:
160 {
161 qint64 nTime = value.toLongLong();
162 if(nTime==ep.finishTime) return false;
163 AnimeWorker::instance()->updateEpTime(currentAnime->name(),ep.localFile,true,nTime);
164 break;
165 }
166 case Columns::LOCALFILE:
167 {
168 QString nPath = value.toString();
169 if(nPath==ep.localFile || nPath.isEmpty()) return false;
170 AnimeWorker::instance()->updateEpPath(currentAnime->name(), ep.localFile, nPath);
171 break;
172 }
173 default:
174 return false;
175 }
176 return true;
177}
178
179QVariant EpisodesModel::headerData(int section, Qt::Orientation orientation, int role) const
180{

Callers

nothing calls this directly

Calls 7

isValidMethod · 0.45
updateEpInfoMethod · 0.45
nameMethod · 0.45
updateEpTimeMethod · 0.45
toStringMethod · 0.45
isEmptyMethod · 0.45
updateEpPathMethod · 0.45

Tested by

no test coverage detected