File indexing completed on 2024-05-05 05:12:58
0001 /* 0002 This file is part of Akregator. 0003 0004 SPDX-FileCopyrightText: 2008 Frank Osterfeld <osterfeld@kde.org> 0005 0006 SPDX-License-Identifier: GPL-2.0-or-later WITH Qt-Commercial-exception-1.0 0007 */ 0008 0009 #pragma once 0010 0011 #include "akregatorinterfaces_export.h" 0012 0013 #include <QObject> 0014 0015 #include <memory> 0016 0017 class QWidget; 0018 0019 namespace Akregator 0020 { 0021 class CommandPrivate; 0022 0023 class AKREGATORINTERFACES_EXPORT Command : public QObject 0024 { 0025 Q_OBJECT 0026 public: 0027 explicit Command(QObject *parent = nullptr); 0028 ~Command() override; 0029 0030 QWidget *parentWidget() const; 0031 void setParentWidget(QWidget *parentWidget); 0032 0033 void start(); 0034 void abort(); 0035 0036 void waitForFinished(); 0037 0038 Q_SIGNALS: 0039 void started(); 0040 void finished(); 0041 void progress(int percent, const QString &msg); 0042 0043 protected: 0044 virtual void doStart() = 0; 0045 virtual void doAbort() = 0; 0046 0047 void done(); 0048 0049 private: 0050 std::unique_ptr<CommandPrivate> const d; 0051 }; 0052 }