forked from qt-creator/qt-creator
Axivion: Raise the size of issues packet
Change-Id: I4a60649982b1ffa50c2c85f4db3d57f88186a211 Reviewed-by: hjk <hjk@qt.io> Reviewed-by: Andreas Loth <andreas.loth@qt.io>
This commit is contained in:
@@ -23,6 +23,8 @@ namespace Utils { class FilePath; }
|
|||||||
|
|
||||||
namespace Axivion::Internal {
|
namespace Axivion::Internal {
|
||||||
|
|
||||||
|
constexpr int DefaultSearchLimit = 2048;
|
||||||
|
|
||||||
struct IssueListSearch
|
struct IssueListSearch
|
||||||
{
|
{
|
||||||
QString kind;
|
QString kind;
|
||||||
@@ -33,7 +35,7 @@ struct IssueListSearch
|
|||||||
QString filter_path;
|
QString filter_path;
|
||||||
QString sort;
|
QString sort;
|
||||||
int offset = 0;
|
int offset = 0;
|
||||||
int limit = 150;
|
int limit = DefaultSearchLimit;
|
||||||
bool computeTotalRowCount = false;
|
bool computeTotalRowCount = false;
|
||||||
|
|
||||||
QString toQuery() const;
|
QString toQuery() const;
|
||||||
|
@@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
#include "dynamiclistmodel.h"
|
#include "dynamiclistmodel.h"
|
||||||
|
|
||||||
|
#include "axivionplugin.h"
|
||||||
#include "axiviontr.h"
|
#include "axiviontr.h"
|
||||||
|
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
@@ -10,8 +11,6 @@
|
|||||||
|
|
||||||
namespace Axivion::Internal {
|
namespace Axivion::Internal {
|
||||||
|
|
||||||
constexpr int pageSize = 150;
|
|
||||||
|
|
||||||
DynamicListModel::DynamicListModel(QObject *parent)
|
DynamicListModel::DynamicListModel(QObject *parent)
|
||||||
: QAbstractItemModel(parent)
|
: QAbstractItemModel(parent)
|
||||||
{
|
{
|
||||||
@@ -161,7 +160,7 @@ QModelIndex DynamicListModel::indexForItem(const ListItem *item) const
|
|||||||
void DynamicListModel::onNeedFetch(int row)
|
void DynamicListModel::onNeedFetch(int row)
|
||||||
{
|
{
|
||||||
m_fetchStart = row;
|
m_fetchStart = row;
|
||||||
m_fetchEnd = row + pageSize;
|
m_fetchEnd = row + DefaultSearchLimit;
|
||||||
if (m_fetchStart < 0)
|
if (m_fetchStart < 0)
|
||||||
return;
|
return;
|
||||||
m_fetchMoreTimer.start();
|
m_fetchMoreTimer.start();
|
||||||
@@ -171,14 +170,14 @@ void DynamicListModel::fetchNow()
|
|||||||
{
|
{
|
||||||
const int old = m_lastFetch;
|
const int old = m_lastFetch;
|
||||||
m_lastFetch = m_fetchStart; // we need the "original" fetch request to avoid endless loop
|
m_lastFetch = m_fetchStart; // we need the "original" fetch request to avoid endless loop
|
||||||
m_lastFetchEnd = m_fetchStart + pageSize;
|
m_lastFetchEnd = m_fetchStart + DefaultSearchLimit;
|
||||||
|
|
||||||
if (old != -1) {
|
if (old != -1) {
|
||||||
const int diff = old - m_fetchStart;
|
const int diff = old - m_fetchStart;
|
||||||
if (0 < diff && diff < pageSize) {
|
if (0 < diff && diff < DefaultSearchLimit) {
|
||||||
m_fetchStart = qMax(old - pageSize, 0);
|
m_fetchStart = qMax(old - DefaultSearchLimit, 0);
|
||||||
} else if (0 > diff && diff > -pageSize) {
|
} else if (0 > diff && diff > - DefaultSearchLimit) {
|
||||||
m_fetchStart = old + pageSize;
|
m_fetchStart = old + DefaultSearchLimit;
|
||||||
if (m_expectedRowCount && m_fetchStart > *m_expectedRowCount)
|
if (m_expectedRowCount && m_fetchStart > *m_expectedRowCount)
|
||||||
m_fetchStart = *m_expectedRowCount;
|
m_fetchStart = *m_expectedRowCount;
|
||||||
}
|
}
|
||||||
@@ -186,7 +185,7 @@ void DynamicListModel::fetchNow()
|
|||||||
|
|
||||||
QTC_CHECK(m_expectedRowCount ? m_fetchStart <= *m_expectedRowCount
|
QTC_CHECK(m_expectedRowCount ? m_fetchStart <= *m_expectedRowCount
|
||||||
: m_fetchStart >= m_children.size());
|
: m_fetchStart >= m_children.size());
|
||||||
emit fetchRequested(m_fetchStart, pageSize);
|
emit fetchRequested(m_fetchStart, DefaultSearchLimit);
|
||||||
m_fetchStart = -1;
|
m_fetchStart = -1;
|
||||||
m_fetchEnd = -1;
|
m_fetchEnd = -1;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user