File indexing completed on 2024-05-05 17:04:26
0001 /* This file is part of the KDE project 0002 * Copyright (C) 2012 KO GmbH. Contact: Boudewijn Rempt <boud@kogmbh.com> 0003 * 0004 * This library is free software; you can redistribute it and/or 0005 * modify it under the terms of the GNU Library General Public 0006 * License as published by the Free Software Foundation; either 0007 * version 2 of the License, or (at your option) any later version. 0008 * 0009 * This library is distributed in the hope that it will be useful, 0010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0012 * Library General Public License for more details. 0013 * 0014 * You should have received a copy of the GNU Library General Public License 0015 * along with this library; see the file COPYING.LIB. If not, write to 0016 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 0017 * Boston, MA 02110-1301, USA. 0018 */ 0019 #include "ProgressProxy.h" 0020 0021 class ProgressProxy::Private 0022 { 0023 public: 0024 int minimum; 0025 int maximum; 0026 QString taskName; 0027 }; 0028 0029 ProgressProxy::ProgressProxy(QObject *parent) 0030 : QObject(parent), d(new Private) 0031 { 0032 } 0033 0034 ProgressProxy::~ProgressProxy() 0035 { 0036 0037 } 0038 0039 QString ProgressProxy::taskName() const 0040 { 0041 return d->taskName; 0042 } 0043 0044 void ProgressProxy::setFormat(const QString& format) 0045 { 0046 if ( format != d->taskName ) { 0047 d->taskName = format; 0048 emit taskNameChanged(); 0049 } 0050 } 0051 0052 void ProgressProxy::setRange(int minimum, int maximum) 0053 { 0054 d->minimum = minimum; 0055 d->maximum = maximum; 0056 } 0057 0058 void ProgressProxy::setValue(int value) 0059 { 0060 if (value == d->minimum) { 0061 emit taskStarted(); 0062 } 0063 0064 if (value == d->maximum) { 0065 emit taskEnded(); 0066 } 0067 0068 emit valueChanged(value); 0069 } 0070 0071 int ProgressProxy::maximum() const 0072 { 0073 return d->maximum; 0074 } 0075