void YTChannel::storeNotifyCount(int count) { if (notifyCount != count) emit notifyCountChanged(); notifyCount = count; QSqlDatabase db = Database::instance().getConnection(); QSqlQuery query(db); query.prepare("update subscriptions set notify_count=? where user_id=?"); query.bindValue(0, count); query.bindValue(1, channelId); bool success = query.exec(); if (!success) qWarning() << query.lastQuery() << query.lastError().text(); }
void YTChannel::updateWatched() { if (channelId.isEmpty()) return; uint now = QDateTime::currentDateTime().toTime_t(); watched = now; notifyCount = 0; emit notifyCountChanged(); QSqlDatabase db = Database::instance().getConnection(); QSqlQuery query(db); query.prepare("update subscriptions set watched=?, notify_count=0, views=views+1 where user_id=?"); query.bindValue(0, now); query.bindValue(1, channelId); bool success = query.exec(); if (!success) qWarning() << query.lastQuery() << query.lastError().text(); }
void SpaceSceneElements::setElements(QVector<SharedPtr<SceneElement>> elements) { m_elements = std::move(elements); notifyCountChanged(); }
void SpaceSceneElements::clearElements() { m_elements.clear(); notifyCountChanged(); }
void SpaceSceneElements::addElement(SharedPtr<SceneElement> element) { m_elements.append(std::move(element)); notifyCountChanged(); }