File indexing completed on 2024-04-28 09:26:08

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 #pragma once
0010 
0011 #include <QObject>
0012 
0013 #include "kscreen_export.h"
0014 #include "types.h"
0015 
0016 namespace KScreen
0017 {
0018 class ConfigOperationPrivate;
0019 
0020 class KSCREEN_EXPORT ConfigOperation : public QObject
0021 {
0022     Q_OBJECT
0023 
0024 public:
0025     enum Option {
0026         NoOptions,
0027         NoEDID,
0028     };
0029     Q_DECLARE_FLAGS(Options, Option)
0030 
0031     ~ConfigOperation() override;
0032 
0033     bool hasError() const;
0034     QString errorString() const;
0035 
0036     virtual KScreen::ConfigPtr config() const = 0;
0037 
0038     bool exec();
0039 
0040 Q_SIGNALS:
0041     void finished(ConfigOperation *operation);
0042 
0043 protected:
0044     explicit ConfigOperation(ConfigOperationPrivate *dd, QObject *parent = nullptr);
0045 
0046     void setError(const QString &error);
0047     void emitResult();
0048 
0049 protected Q_SLOTS:
0050     virtual void start() = 0;
0051 
0052 protected:
0053     ConfigOperationPrivate *const d_ptr;
0054     Q_DECLARE_PRIVATE(ConfigOperation)
0055 };
0056 }