File indexing completed on 2024-04-21 16:17:33

0001 /*
0002  * <one line to give the library's name and an idea of what it does.>
0003  * SPDX-FileCopyrightText: 2014 Daniel Vratil <dvratil@redhat.com>
0004  *
0005  * SPDX-License-Identifier: LGPL-2.1-or-later
0006  *
0007  */
0008 
0009 #ifndef KSCREEN_CONFIGOPERATION_H
0010 #define KSCREEN_CONFIGOPERATION_H
0011 
0012 #include <QObject>
0013 
0014 #include "kscreen_export.h"
0015 #include "types.h"
0016 
0017 namespace KScreen
0018 {
0019 class ConfigOperationPrivate;
0020 
0021 class KSCREEN_EXPORT ConfigOperation : public QObject
0022 {
0023     Q_OBJECT
0024 
0025 public:
0026     enum Option {
0027         NoOptions,
0028         NoEDID,
0029     };
0030     Q_DECLARE_FLAGS(Options, Option)
0031 
0032     ~ConfigOperation() override;
0033 
0034     bool hasError() const;
0035     QString errorString() const;
0036 
0037     virtual KScreen::ConfigPtr config() const = 0;
0038 
0039     bool exec();
0040 
0041 Q_SIGNALS:
0042     void finished(ConfigOperation *operation);
0043 
0044 protected:
0045     explicit ConfigOperation(ConfigOperationPrivate *dd, QObject *parent = nullptr);
0046 
0047     void setError(const QString &error);
0048     void emitResult();
0049 
0050 protected Q_SLOTS:
0051     virtual void start() = 0;
0052 
0053 protected:
0054     ConfigOperationPrivate *const d_ptr;
0055     Q_DECLARE_PRIVATE(ConfigOperation)
0056 };
0057 }
0058 
0059 #endif // KSCREEN_CONFIGOPERATION_H