File indexing completed on 2025-02-16 11:39:54
0001 // clang-format off 0002 /* 0003 * KDiff3 - Text Diff And Merge Tool 0004 * 0005 * SPDX-FileCopyrightText: 2002-2011 Joachim Eibl, joachim.eibl at gmx.de 0006 * SPDX-FileCopyrightText: 2018-2020 Michael Reeves reeves.87@gmail.com 0007 * SPDX-License-Identifier: GPL-2.0-or-later 0008 */ 0009 // clang-format on 0010 0011 #include "ProgressProxy.h" 0012 0013 #include "combiners.h" 0014 0015 #include <boost/signals2.hpp> 0016 0017 #include <QDialog> 0018 #include <QString> 0019 0020 namespace signals2 = boost::signals2; 0021 /* 0022 Using boost allows ProgessProxy to be disconnected during auto testing. 0023 This prevents uneeded UI calls from being made in an evironment were they 0024 cann't function properly. 0025 */ 0026 signals2::signal<void()> ProgressProxy::startBackgroundTask; 0027 signals2::signal<void()> ProgressProxy::endBackgroundTask; 0028 0029 signals2::signal<void()> ProgressProxy::push; 0030 signals2::signal<void(bool)> ProgressProxy::pop; 0031 signals2::signal<void()> ProgressProxy::clear; 0032 0033 signals2::signal<void(KJob*, const QString&)> ProgressProxy::enterEventLoop; 0034 signals2::signal<void()> ProgressProxy::exitEventLoop; 0035 0036 signals2::signal<void(quint64, bool)> ProgressProxy::setCurrentSig; 0037 signals2::signal<void(quint64)> ProgressProxy::setMaxNofSteps; 0038 signals2::signal<void(quint64)> ProgressProxy::addNofSteps; 0039 signals2::signal<void(bool)> ProgressProxy::stepSig; 0040 0041 signals2::signal<void(double, double)> ProgressProxy::setRangeTransformation; 0042 signals2::signal<void(double, double)> ProgressProxy::setSubRangeTransformation; 0043 0044 signals2::signal<bool(), find> ProgressProxy::wasCancelled; 0045 0046 signals2::signal<void(const QString&, bool)> ProgressProxy::setInformationSig; 0047 0048 ProgressScope::ProgressScope() 0049 { 0050 ProgressProxy::push(); 0051 } 0052 0053 ProgressScope::~ProgressScope() 0054 { 0055 ProgressProxy::pop(false); 0056 } 0057 0058 void ProgressProxy::setInformation(const QString& info, bool bRedrawUpdate) 0059 { 0060 setInformationSig(info, bRedrawUpdate); 0061 } 0062 0063 void ProgressProxy::setInformation(const QString& info, qint32 current, bool bRedrawUpdate) 0064 { 0065 setCurrentSig(current, false); 0066 setInformationSig(info, bRedrawUpdate); 0067 } 0068 0069 void ProgressProxy::setCurrent(quint64 current, bool bRedrawUpdate) 0070 { 0071 setCurrentSig(current, bRedrawUpdate); 0072 } 0073 0074 void ProgressProxy::step(bool bRedrawUpdate) 0075 { 0076 stepSig(bRedrawUpdate); 0077 }