| 143 | } |
| 144 | |
| 145 | bool 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 | |
| 179 | QVariant EpisodesModel::headerData(int section, Qt::Orientation orientation, int role) const |
| 180 | { |
nothing calls this directly
no test coverage detected