summaryrefslogtreecommitdiffstats
path: root/src/mainwindow.h
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-08-15 09:42:27 +0200
committerDanilo M. <danix@danix.xyz>2026-08-15 09:42:27 +0200
commit8f40c0b6dce67cefa1edce0b865c9a3885d39717 (patch)
tree3f8d6a7d38c1b92eea2140ad911765187c1d4f3b /src/mainwindow.h
parentdeec4e1bbf2a6af6f3f86043080fd5b4df535e03 (diff)
downloadqtmaildir-8f40c0b6dce67cefa1edce0b865c9a3885d39717.tar.gz
qtmaildir-8f40c0b6dce67cefa1edce0b865c9a3885d39717.zip
fix(status): count threads as they arrive instead of "Searching..."
Item 74. runQuery() set the status bar once and only queryFinished cleared it, so the bar kept claiming a query was running for the whole walk while rows were visibly arriving behind it. Measured cold against a 1.1 GB index: the first batch reaches the model at 642 ms and the walk finishes at 5714 ms, so five seconds of a slow query read as a frozen one. onThreadsReady now sets the bar from the model's own row count after each batch, which is the number of rows the user can actually see. No timing changes; this only stops the bar from lying. The refresh branch returns before the new line, so a background refresh stays silent exactly as onQueryFinished already keeps it. That silence has its own test, which fails when the write is moved above the guard. beginRefreshForTesting() is a new seam: refreshCurrentQuery() returns early without a worker and a bare window has none, so a test cannot otherwise reach the refresh path.
Diffstat (limited to 'src/mainwindow.h')
-rw-r--r--src/mainwindow.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/mainwindow.h b/src/mainwindow.h
index d861d72..80c7d2b 100644
--- a/src/mainwindow.h
+++ b/src/mainwindow.h
@@ -186,6 +186,19 @@ public:
/// stale, so a test standing in for the worker has to know the current one.
quint64 currentGenerationForTesting() const { return m_generation; }
+ /// Puts the window into the state refreshCurrentQuery() leaves it in, and
+ /// returns the generation the refresh's replies must carry.
+ ///
+ /// A test seam, because refreshCurrentQuery() returns early without a
+ /// worker and a bare window has none. It sets only what decides whether a
+ /// batch is a refresh's, not what the real function asks the worker to do.
+ quint64 beginRefreshForTesting()
+ {
+ m_refreshGeneration = ++m_generation;
+ m_refreshThreads.clear();
+ return m_refreshGeneration;
+ }
+
/// The generation a database-stats reply must carry to be accepted.
///
/// A test seam, for the same reason as the one above: onDatabaseStatsReady