File indexing completed on 2024-04-28 05:44:58
0001 /*************************************************************************** 0002 * Copyright (C) 2009-2018 by Daniel Nicoletti * 0003 * dantti12@gmail.com * 0004 * * 0005 * This program is free software; you can redistribute it and/or modify * 0006 * it under the terms of the GNU General Public License as published by * 0007 * the Free Software Foundation; either version 2 of the License, or * 0008 * (at your option) any later version. * 0009 * * 0010 * This program is distributed in the hope that it will be useful, * 0011 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 0012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 0013 * GNU General Public License for more details. * 0014 * * 0015 * You should have received a copy of the GNU General Public License * 0016 * along with this program; see the file COPYING. If not, write to * 0017 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * 0018 * Boston, MA 02110-1301, USA. * 0019 ***************************************************************************/ 0020 0021 #include "AbstractIsRunning.h" 0022 0023 #include <Daemon> 0024 0025 #include <QLoggingCategory> 0026 0027 Q_DECLARE_LOGGING_CATEGORY(APPER_SESSION) 0028 0029 using namespace PackageKit; 0030 0031 AbstractIsRunning::AbstractIsRunning(QObject *parent) : 0032 QObject(parent) 0033 { 0034 } 0035 0036 AbstractIsRunning::~AbstractIsRunning() 0037 { 0038 } 0039 0040 void AbstractIsRunning::increaseRunning() 0041 { 0042 m_running++; 0043 qCDebug(APPER_SESSION) << "Increase running" << m_running; 0044 } 0045 0046 void AbstractIsRunning::decreaseRunning() 0047 { 0048 m_running--; 0049 qCDebug(APPER_SESSION) << "Decrease running" << m_running; 0050 if (!isRunning()) { 0051 qCDebug(APPER_SESSION) << "All tasks completed"; 0052 emit close(); 0053 } 0054 } 0055 0056 bool AbstractIsRunning::isRunning() const 0057 { 0058 return m_running > 0; 0059 } 0060 0061 #include "moc_AbstractIsRunning.cpp"