/*
 * Copyright (C) 2023, KylinSoft Co., Ltd.
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <https://www.gnu.org/licenses/>.
 *
 * Authors: wangyan <wangyan@kylinos.cn>
 *
 */

#ifndef PLUGINENTRY_H
#define PLUGINENTRY_H

#include <QObject>

#include "common.h"

class TouchScreenWidget;
class DeviceManager;
class PluginEntry : public QObject
{
    Q_OBJECT
public:
    explicit PluginEntry(QObject* parent = nullptr);

    QWidget* widget();
    static bool widgetEnable();

signals:
    void widgetEnableChanged(bool enaled);

private slots:
    void onDeviceChanged(DeviceType deviceType);

private:
    void initConnection();
    void initWidgetConnection();
    void updateWidgetEnable();
    TouchScreenWidget* createWidget();
    void resetWidgetCombobox(DeviceType deviceType);
    void buriedSettings(const QString& settingsName, const QString& action, const QString& value) const;

    TouchScreenWidget* m_widget;
    DeviceManager* m_deviceManager;
    bool m_widgetEnable;
};

#endif // PLUGINENTRY_H
