void SqliteTableModel::handleFinishedFetch (int life_id, unsigned int fetched_row_begin, unsigned int fetched_row_end) { if(life_id < m_lifeCounter) return; Q_ASSERT(fetched_row_end >= fetched_row_begin); auto old_row_count = m_currentRowCount; auto new_row_count = std::max(old_row_count, fetched_row_begin); new_row_count = std::max(new_row_count, fetched_row_end); Q_ASSERT(new_row_count >= old_row_count); if(new_row_count != old_row_count) { beginInsertRows(QModelIndex(), old_row_count, new_row_count - 1); m_currentRowCount = new_row_count; endInsertRows(); } if(fetched_row_end != fetched_row_begin) { // TODO optimize int num_columns = m_headers.size(); emit dataChanged(createIndex(fetched_row_begin, 0), createIndex(fetched_row_end - 1, num_columns - 1)); } if(m_rowCountAvailable != RowCount::Complete) m_rowCountAvailable = RowCount::Partial; emit finishedFetch(fetched_row_begin, fetched_row_end); }
/** * Fetches twitter user information * @param userid id of user to fetch information in string */ void UserInfo::fetch(const QString &userid) { bool ok; qint64 id = userid.toLongLong(&ok); if (ok) { QTweetUserShow* userShow = new QTweetUserShow(m_oauthTwitter, this); userShow->fetch(id); connect(userShow, SIGNAL(parsedUserInfo(QTweetUser)), this, SLOT(finishedFetch(QTweetUser))); } }
/** * Fetches twitter user information * @param screenName screenname of the user to fetch information */ void UserInfo::fetchByName(const QString &screenName) { QTweetUserShow* userShow = new QTweetUserShow(m_oauthTwitter, this); userShow->fetch(screenName); connect(userShow, SIGNAL(parsedUserInfo(QTweetUser)), this, SLOT(finishedFetch(QTweetUser))); }
/** * Fetches twitter user information * @param userid id of user to fetch information */ void UserInfo::fetch(qint64 userid) { QTweetUserShow* userShow = new QTweetUserShow(m_oauthTwitter, this); userShow->fetch(userid); connect(userShow, SIGNAL(parsedUserInfo(QTweetUser)), this, SLOT(finishedFetch(QTweetUser))); }