QPDFWriter::indicateProgress(bool decrement, bool finished)
{
    if (decrement)
    {
        --this->m->events_seen;
        return;
    }

    ++this->m->events_seen;

    if (! this->m->progress_reporter.getPointer())
    {
        return;
    }

    if (finished || (this->m->events_seen >= this->m->next_progress_report))
    {
        int percentage = (
            finished
            ? 100
            : this->m->next_progress_report == 0
            ? 0
            : std::min(99, 1 + ((100 * this->m->events_seen) /
                                this->m->events_expected)));
        this->m->progress_reporter->reportProgress(percentage);
    }
    int increment = std::max(1, (this->m->events_expected / 100));
    while (this->m->events_seen >= this->m->next_progress_report)
    {
        this->m->next_progress_report += increment;
    }
}
QPDFWriter::indicateProgress(bool decrement, bool finished)
{
    if (decrement)
    {
        --this->m->events_seen;
        return;
    }

    ++this->m->events_seen;

    if (! this->m->progress_reporter.getPointer())
    {
        return;
    }

    if (finished || (this->m->events_seen >= this->m->next_progress_report))
    {
        int percentage = (
            finished
            ? 100
            : this->m->next_progress_report == 0
            ? 0
            : std::min(99, 1 + ((100 * this->m->events_seen) /
                                this->m->events_expected)));
        this->m->progress_reporter->reportProgress(percentage);
    }
    int increment = std::max(1, (this->m->events_expected / 100));
    while (this->m->events_seen >= this->m->next_progress_report)
    {
        this->m->next_progress_report += increment;
    }
}