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

Method setData

UI/animeinfoeditor.cpp:234–271  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

232}
233
234bool AliasModel::setData(const QModelIndex &index, const QVariant &value, int)
235{
236 if(!index.isValid() || anime.isEmpty()) return false;
237 QString alias = value.toString();
238 auto remove = [=](int row){
239 beginRemoveRows(QModelIndex(), row, row);
240 aliasList.removeAt(row);
241 endRemoveRows();
242 };
243 if(alias.isEmpty())
244 {
245 remove(index.row());
246 return false;
247 }
248 if(alias == anime)
249 {
250 remove(index.row());
251 emit addFailed();
252 return false;
253 }
254 if(AnimeWorker::instance()->hasAnime(alias))
255 {
256 remove(index.row());
257 emit addFailed();
258 return false;
259 }
260 if(AnimeWorker::instance()->addAlias(anime, alias))
261 {
262 aliasList[index.row()] = alias;
263 return true;
264 }
265 else
266 {
267 remove(index.row());
268 emit addFailed();
269 return false;
270 }
271}
272
273StaffModel::StaffModel(const Anime *anime, QObject *parent) : QAbstractItemModel(parent)
274{

Callers

nothing calls this directly

Calls 5

hasAnimeMethod · 0.80
isValidMethod · 0.45
isEmptyMethod · 0.45
toStringMethod · 0.45
addAliasMethod · 0.45

Tested by

no test coverage detected