Example #1
0
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();
}
Example #2
0
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();
}
Example #3
0
void SpaceSceneElements::setElements(QVector<SharedPtr<SceneElement>> elements)
{
    m_elements = std::move(elements);
    notifyCountChanged();
}
Example #4
0
void SpaceSceneElements::clearElements()
{
    m_elements.clear();
    notifyCountChanged();
}
Example #5
0
void SpaceSceneElements::addElement(SharedPtr<SceneElement> element)
{
    m_elements.append(std::move(element));
    notifyCountChanged();
}