Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/design/file-jobs.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Keep captured destinations and target identities throughout preparation, conflic

The [operations controller](../../src/app/page/operations_controller.h) owns a toolbar indicator, anchored scrollable popover and centered report inspector. While every running job knows its progress, the indicator draws their average as a thin bar along its bottom edge, and the popover fits its height to its rows up to a window-relative limit. The [operations view](../../src/ui/controls/operations_view.h) composes actual Noctalia Button, ProgressBar and ScrollView controls. It builds one row per job, never per file. Running transfer rows show speed, a 6px progress bar with tabular percentage, compact byte/file totals, remaining time, current item, Details and Cancel inline; finished rows show their outcome and Details. Service events update indicators globally. A 200 ms progress timer runs while jobs are preparing or working and the popover or a shown toolbar indicator draws them, or while the details dialog follows a live job; row identities remain stable during progress updates, and the dialog rewrites its labels and bar in place instead of rebuilding. Scene structure changes occur in Layout and cancel stale pointer captures. Closing presentation releases controls/timers without cancelling accepted jobs. A parent size change dismisses the toolbar popover, avoiding repositioning against stale parent/output geometry; reopening measures against the committed window size.

Only genuinely known totals produce progress fractions. Transfers measure their sources on the worker before streaming payload bytes across local disks, mounted network shares, phones/cameras and remote GIO providers so byte totals, percentage, file counts, live speed and smoothed remaining time are measured rather than assumed; network and remote provider directory scans obey both entry/depth limits and a short time budget so a huge remote tree falls back to an honest lower bound instead of stalling the transfer start, while phones and cameras list in full within the entry limit, since a USB listing is slow but finite. Native sources use the shared folder walk, without counting link target lengths a transfer never writes. Provider copies count each regular file once its copy is verified, so links and special entries in a provider tree leave the total a lower bound. Once transferred bytes surpass a partial lower bound, the bar drops its fraction instead of claiming 100%, and running fractions stay below 100% until all bytes land. A move that stays on one device renames instead of streaming payload, a link transfer writes no payload, history replay re-runs recorded effects, removable-media device flush has no measurable writeback denominator, and archive counters have no reliable final denominator, so those phases stay indeterminate. A native copy or move job parks its worker at the next scan measurement, walk entry, copy chunk or staging checkpoint when paused, and the park releases on resume or cancellation; provider transfers, link transfers, history replay and the terminal flush offer no pause. Pause is not rollback: already published effects stay, and terminal summaries still distinguish failed, partial, cancelled, skipped and completed effects. Cancellation is not rollback. Reports use literal UTF-8 text and explicit truncation. Finished reports survive ordinary job pruning; the popover header's Clear removes reports, not jobs.
Only genuinely known totals produce progress fractions. Transfers measure their sources on the worker before streaming payload bytes across local disks, mounted network shares, phones/cameras and remote GIO providers so byte totals, percentage, file counts, live speed and smoothed remaining time are measured rather than assumed; network and remote provider directory scans obey both entry/depth limits and a short time budget so a huge remote tree falls back to an honest lower bound instead of stalling the transfer start, while phones and cameras list in full within the entry limit, since a USB listing is slow but finite. Native sources use the shared folder walk, without counting link target lengths a transfer never writes. Provider copies count each regular file once its copy is verified, so links and special entries in a provider tree leave the total a lower bound. Once transferred bytes surpass a partial lower bound, the bar drops its fraction instead of claiming 100%, and running fractions stay below 100% until all bytes land. A move that stays on one device renames instead of streaming payload, a link transfer writes no payload, history replay re-runs recorded effects and removable-media device flush has no measurable writeback denominator, so those phases stay indeterminate. Archive extraction takes its denominator from the validated member catalog before payload is written, and compression pre-scans its sources before opening the output; the compression pre-scan is its own archive-limited pass rather than the transfer estimator's shared folder walker, because entry/depth limits and special-file refusal differ there, the compressed result size exists only when the job ends, so it is never a progress denominator, raw single-file formats with unknown uncompressed sizes and provider-run unpacking keep those byte totals withheld, batch rows keep their per-archive fraction, and a source that grows past the compression pre-scan total turns that total into a lower bound whose fraction the row drops, exactly as a transfer's bounded partial scan does. A native copy or move job parks its worker at the next scan measurement, walk entry, copy chunk or staging checkpoint when paused, and the park releases on resume or cancellation; provider transfers, link transfers, history replay and the terminal flush offer no pause. Pause is not rollback: already published effects stay, and terminal summaries still distinguish failed, partial, cancelled, skipped and completed effects. Cancellation is not rollback. Reports use literal UTF-8 text and explicit truncation. Finished reports survive ordinary job pruning; the popover header's Clear removes reports, not jobs.

Actions retain a JobId and revalidate it. Review/Retry route to the job's current owning page through the workspace, including reassignment after tab closure. Existing conflict/password dialogs remain authoritative. Transfer retry stays in TransferController, including its asynchronous clipboard revision claim and finishMove safeguards. Details capture an immutable report; copying it cannot refer to a recycled row. Only finished jobs that failed, ended partial or were cancelled offer that dialog: it shows the fixed snapshot it was opened from, every measured field and the report. A running row already shows its live progress, and a clean success shows its outcome on the row, with the elapsed time its own service measured, which a job loaded from history never has.

Expand Down
2 changes: 1 addition & 1 deletion docs/user/file-operations.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ Choose **Regex** to replace every match of an ECMAScript regular expression. In

## File Operations popover

The toolbar **File Operations** button shows a busy glyph while jobs run, with a thin bar along its bottom edge while every running job's progress is known; its tooltip names the job or counts the active ones. Open it, or use **File Operations** in the main menu, to see every tab and window of this Luciole inline: progress bar and percentage, bytes transferred, transfer speed, file counts, remaining time, current item, pending decisions and results. Copy and move jobs measure their sources first across local folders, phones and cameras, mounted network shares and remote locations, falling back to a lower bound if a large remote tree hits the scan limit. A move that stays on the same drive renames the folder instead of copying it, and jobs with no byte payload (such as creating links) track item progress once multiple items complete or omit the bar for a single item.
The toolbar **File Operations** button shows a busy glyph while jobs run, with a thin bar along its bottom edge while every running job's progress is known; its tooltip names the job or counts the active ones. Open it, or use **File Operations** in the main menu, to see every tab and window of this Luciole inline: progress bar and percentage, bytes transferred, transfer speed, file counts, remaining time, current item, pending decisions and results. Copy and move jobs measure their sources first across local folders, phones and cameras, mounted network shares and remote locations, falling back to a lower bound if a large remote tree hits the scan limit. A move that stays on the same drive renames the folder instead of copying it, and jobs with no byte payload (such as creating links) track item progress once multiple items complete or omit the bar for a single item. Extract and Compress jobs measure against the archive listing and the source files, showing byte and entry totals whenever they are knowable, see [archives](archives.md).

Running rows show their actions as icons; hover one for its name.

Expand Down
68 changes: 49 additions & 19 deletions src/app/job_activity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -215,19 +215,22 @@ namespace {
return {formatted, {}};
}
// Compact byte ratio for the inline row ("5.9 / 12.3 GiB", or "48.2 GiB / 1.4 TiB+").
std::string compactBytesText(const luciole::TransferProgress& measured) {
const std::string done = sizeText(measured.bytes);
if (!measured.bytesTotal || !*measured.bytesTotal) {
return i18n::tr("app.job-activity.size-transferred", "size", done);
}
const std::string total = sizeText(*measured.bytesTotal);
const auto [doneVal, doneUnit] = splitSizeUnit(done);
const auto [totalVal, totalUnit] = splitSizeUnit(total);
const char* plus = measured.partial ? "+" : "";
std::string compactBytesText(std::uint64_t done, const std::optional<std::uint64_t>& total, bool partial) {
const std::string doneText = sizeText(done);
if (!total || !*total) {
return i18n::tr("app.job-activity.size-transferred", "size", doneText);
}
const std::string totalText = sizeText(*total);
const auto [doneVal, doneUnit] = splitSizeUnit(doneText);
const auto [totalVal, totalUnit] = splitSizeUnit(totalText);
const char* suffix = partial ? "+" : "";
if (!doneUnit.empty() && doneUnit == totalUnit) {
return std::format("{} / {}{}{}", doneVal, totalVal, totalUnit, plus);
return std::format("{} / {}{}{}", doneVal, totalVal, totalUnit, suffix);
}
return std::format("{} / {}{}", done, total, plus);
return std::format("{} / {}{}", doneText, totalText, suffix);
}
std::string compactBytesText(const luciole::TransferProgress& measured) {
return compactBytesText(measured.bytes, measured.bytesTotal, measured.partial);
}
// Compact file count for the inline row; hides noisy "0/1 files" on single-file transfers.
std::string compactFilesText(const luciole::TransferProgress& measured) {
Expand Down Expand Up @@ -478,32 +481,35 @@ namespace {
activity.title = service.archiveCount() ? i18n::tr("app.job-activity.extract-archives")
: i18n::tr("app.job-activity.archive-operation");
if (job.running()) {
switch (service.phase()) {
const auto phase = service.phase();
std::string phaseLabel;
switch (phase) {
case luciole::ArchivePhase::Reading:
activity.summary = i18n::tr("app.job-activity.reading-archive");
phaseLabel = i18n::tr("app.job-activity.reading-archive");
break;
case luciole::ArchivePhase::Compressing:
activity.summary = i18n::tr("app.job-activity.compressing");
phaseLabel = i18n::tr("app.job-activity.compressing");
break;
case luciole::ArchivePhase::Extracting:
activity.summary = i18n::tr("app.job-activity.extracting");
phaseLabel = i18n::tr("app.job-activity.extracting");
break;
case luciole::ArchivePhase::Transferring:
activity.summary = service.flushPhase() == luciole::TransferFlush::None
phaseLabel = service.flushPhase() == luciole::TransferFlush::None
? i18n::tr("app.job-activity.publishing-output")
: i18n::tr("app.job-activity.writing-to-device");
break;
case luciole::ArchivePhase::Cleaning:
activity.summary = i18n::tr("app.job-activity.cleaning-up");
phaseLabel = i18n::tr("app.job-activity.cleaning-up");
break;
case luciole::ArchivePhase::WaitingPassword:
activity.summary = i18n::tr("app.job-activity.waiting-for-password");
phaseLabel = i18n::tr("app.job-activity.waiting-for-password");
activity.canReview = true;
break;
case luciole::ArchivePhase::Idle:
activity.summary = i18n::tr("app.job-activity.preparing");
phaseLabel = i18n::tr("app.job-activity.preparing");
break;
}
activity.summary = phaseLabel;
activity.summary += " · "
+ i18n::trp("app.job-activity.count-entries-size-processed", static_cast<long>(service.items()), "size",
sizeText(service.bytes()));
Expand All @@ -523,6 +529,30 @@ namespace {
);
activity.progress = ratio;
activity.progressText = percentText(ratio, service.completedArchives() >= service.archiveCount());
} else if (phase == luciole::ArchivePhase::Extracting || phase == luciole::ArchivePhase::Compressing) {
const auto totalBytes = service.totalBytes();
const auto totalItems = service.totalItems();
if (totalBytes || totalItems) {
activity.statusRight = phaseLabel;
const bool surpassed = totalBytes && service.bytes() > totalBytes;
std::string left = totalBytes && !surpassed
? compactBytesText(service.bytes(), totalBytes, false)
: i18n::tr("app.job-activity.size-transferred", "size", sizeText(service.bytes()));
if (totalItems) {
const auto done = std::min(
phase == luciole::ArchivePhase::Compressing ? service.items() : service.completedItems(), totalItems
);
left +=
" · " + i18n::trp("app.job-activity.done-of-count-items", static_cast<long>(totalItems), "done", done);
}
activity.detailLeft = std::move(left);
if (totalBytes && !surpassed) {
const float ratio =
std::clamp(static_cast<float>(service.bytes()) / static_cast<float>(totalBytes), 0.0F, 1.0F);
activity.progress = ratio;
activity.progressText = percentText(ratio, service.bytes() >= totalBytes);
}
}
}
activity.state = activity.canReview ? ActivityState::Waiting : ActivityState::Working;
} else if (!service.results().empty()) {
Expand Down
24 changes: 24 additions & 0 deletions src/operations/archive_reader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -624,6 +624,26 @@ namespace {
fs::remove_all(directory, ignored);
work.progress.bytes.store(total);
}
void publishExtractionTotals(
Work& work, const ArchiveCatalog& contents, const std::map<std::string, std::size_t>& entries,
const std::set<std::string>& wanted, const std::set<std::string>& bodies, bool providerRun
) {
if (providerRun) {
return;
}
std::uint64_t selectedBytes = 0;
bool sizesKnown = true;
for (const auto& path : bodies) {
const auto& size = contents.entries[entries.at(path)].size;
if (!size || *size > UINT64_MAX - selectedBytes) {
sizesKnown = false;
continue;
}
selectedBytes += *size;
}
work.progress.totalBytes.store(sizesKnown ? selectedBytes : 0);
work.progress.totalItems.store(wanted.size());
}
} // namespace

luciole::archive_work::Prepared luciole::archive_work::inspect(
Expand Down Expand Up @@ -747,6 +767,7 @@ luciole::archive_work::Prepared luciole::archive_work::extract(
for (const auto& path : bodies) {
addSize(stagingBytes, dataSize(path));
}
publishExtractionTotals(work, *contents, entries, wanted, bodies, reader.nativeSevenZip());
requireSpace(data.get(), stagingBytes);
if (!open) {
const auto parent = opened(::open(destinationParent.c_str(), O_PATH | O_DIRECTORY | O_CLOEXEC));
Expand Down Expand Up @@ -799,6 +820,7 @@ luciole::archive_work::Prepared luciole::archive_work::extract(
if (output.close() != 0) {
systemError(i18n::tr("operations.archive-reader.could-not-close-extracted-data"));
}
work.progress.completedItems.fetch_add(bodyUses.at(path));
} else {
reader.skip();
}
Expand Down Expand Up @@ -828,6 +850,7 @@ luciole::archive_work::Prepared luciole::archive_work::extract(
if (::fchmod(folder.get(), static_cast<mode_t>(0700U | (entry.mode & 0055U))) != 0) {
systemError(i18n::tr("operations.archive-reader.could-not-set-folder-permissions"));
}
work.progress.completedItems.fetch_add(1);
} else if (entry.kind == ArchiveEntryKind::File || entry.kind == ArchiveEntryKind::Hardlink) {
const auto target = body(path);
const auto id = std::to_string(entries.at(target));
Expand Down Expand Up @@ -863,6 +886,7 @@ luciole::archive_work::Prepared luciole::archive_work::extract(
if (::symlinkat(entry.link.c_str(), parent.get(), entry.name.c_str()) != 0) {
systemError(i18n::tr("operations.archive-reader.could-not-create-extracted-link"));
}
work.progress.completedItems.fetch_add(1);
}
}
work.check();
Expand Down
15 changes: 15 additions & 0 deletions src/operations/archive_service.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,9 @@ struct luciole::ArchiveService::State : std::enable_shared_from_this<State> {
results.clear();
progress.bytes.store(0);
progress.items.store(0);
progress.totalBytes.store(0);
progress.totalItems.store(0);
progress.completedItems.store(0);
cancel = CancelToken{};
if (!known) {
known = catalog;
Expand Down Expand Up @@ -275,6 +278,9 @@ struct luciole::ArchiveService::State : std::enable_shared_from_this<State> {
const auto destination = task.destination;
progress.bytes.store(0);
progress.items.store(0);
progress.totalBytes.store(0);
progress.totalItems.store(0);
progress.completedItems.store(0);
progress.passwordNeeded.store(false);
progress.passwordFormat = ArchiveFormat::Zip;
phase = operation == Operation::Inspect ? ArchivePhase::Reading
Expand Down Expand Up @@ -467,6 +473,15 @@ std::uint64_t luciole::ArchiveService::bytes() const {
std::size_t luciole::ArchiveService::items() const {
return m_batch ? m_batch->worker->items() : m_state->progress.items.load();
}
std::uint64_t luciole::ArchiveService::totalBytes() const {
return m_batch ? m_batch->worker->totalBytes() : m_state->progress.totalBytes.load();
}
std::size_t luciole::ArchiveService::totalItems() const {
return m_batch ? m_batch->worker->totalItems() : m_state->progress.totalItems.load();
}
std::size_t luciole::ArchiveService::completedItems() const {
return m_batch ? m_batch->worker->completedItems() : m_state->progress.completedItems.load();
}
const std::optional<luciole::FileError>& luciole::ArchiveService::error() const {
return !m_state->error && m_batch && !m_batch->running ? m_batch->error : m_state->error;
}
Expand Down
4 changes: 4 additions & 0 deletions src/operations/archive_service.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,10 @@ namespace luciole {
TransferFlush flushPhase() const;
std::uint64_t bytes() const;
std::size_t items() const;
// Measured denominators of the running job; 0 = unknown.
std::uint64_t totalBytes() const;
std::size_t totalItems() const;
std::size_t completedItems() const;
const std::optional<FileError>& error() const;
const std::shared_ptr<const ArchiveCatalog>& catalog() const;
std::optional<ArchiveMember> takeOpenedMember();
Expand Down
3 changes: 3 additions & 0 deletions src/operations/archive_work.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ namespace luciole::archive_work {
struct Progress {
std::atomic<std::uint64_t> bytes{0};
std::atomic<std::size_t> items{0};
std::atomic<std::uint64_t> totalBytes{0};
std::atomic<std::size_t> totalItems{0};
std::atomic<std::size_t> completedItems{0};
std::atomic<bool> passwordNeeded{false};
// Accessed by a worker, then its completion callback, never concurrently.
std::string sourceStamp;
Expand Down
Loading
Loading