File indexing completed on 2024-04-14 05:38:06
0001 /*************************************************************************** 0002 * Copyright (C) 2012 by Daniel Nicoletti <dantti12@gmail.com> * 0003 * * 0004 * This program is free software; you can redistribute it and/or modify * 0005 * it under the terms of the GNU General Public License as published by * 0006 * the Free Software Foundation; either version 2 of the License, or * 0007 * (at your option) any later version. * 0008 * * 0009 * This program 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 * 0012 * GNU General Public License for more details. * 0013 * * 0014 * You should have received a copy of the GNU General Public License * 0015 * along with this program; see the file COPYING. If not, write to * 0016 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * 0017 * Boston, MA 02110-1301, USA. * 0018 ***************************************************************************/ 0019 0020 #ifndef APPERDTHREAD_H 0021 #define APPERDTHREAD_H 0022 0023 #include <QTimer> 0024 #include <QDBusConnection> 0025 #include <QDateTime> 0026 0027 class DBusInterface; 0028 class DistroUpgrade; 0029 class RefreshCacheTask; 0030 class TransactionWatcher; 0031 class Updater; 0032 class AptRebootListener; 0033 0034 class ApperdThread : public QObject 0035 { 0036 Q_OBJECT 0037 public: 0038 explicit ApperdThread(QObject *parent = nullptr); 0039 ~ApperdThread() override; 0040 0041 static bool nameHasOwner(const QString &name, const QDBusConnection &connection); 0042 0043 private Q_SLOTS: 0044 void init(); 0045 void poll(); 0046 void configFileChanged(); 0047 void proxyChanged(); 0048 void setProxy(); 0049 0050 void updatesChanged(); 0051 void appShouldConserveResourcesChanged(); 0052 0053 private: 0054 QDateTime getTimeSinceRefreshCache() const; 0055 bool isSystemReady(bool ignoreBattery, bool ignoreMobile) const; 0056 0057 bool m_proxyChanged; 0058 QVariantHash m_configs; 0059 QHash<QString, QString> m_proxyConfig; 0060 QDateTime m_lastRefreshCache; 0061 QTimer *m_qtimer; 0062 0063 DBusInterface *m_interface; 0064 DistroUpgrade *m_distroUpgrade; 0065 RefreshCacheTask *m_refreshCache; 0066 TransactionWatcher *m_transactionWatcher; 0067 Updater *m_updater; 0068 0069 // Apt reboot listener 0070 AptRebootListener *m_AptRebootListener; 0071 }; 0072 0073 #endif // APPERDTHREAD_H