#ifndef USE_SCREEN_H
#define USE_SCREEN_H

#include <QObject>
#include <QWidget>
#include <QDebug>
#include "ui_use_screen.h"
#include "api/mscreen.h"
#include "log2ui.h"
#include "videoview2.h"
using namespace rtc;

class Use_Screen : public QWidget,public IMScreen::IListener
{
    Q_OBJECT
public:
    explicit Use_Screen(QWidget *parent = nullptr);

    void onAttach(rtc::IRoom* room);
    void onDetach();
    bool   isAttach() const { return NULL != module_; }
    rtc::DeviceId getSelectedDeviceId(QListWidget* listw);
    rtc::ScreenWindow getSelectedScreenParams();


    void onScreenStatusNotify(ScreenStatus status, const DeviceId& fromId)override;
    void onScreenDataNotify(int level, const String& description, const DeviceId& fromId) override;
    void onPublishScreenNotify(const ScreenWindow& screen) override;
    void onUnpublishScreenNotify(const ScreenWindow& screen)override;
    void onSubscribeScreenResult(Result result, const DeviceId& fromId) override;
    void onUnsubscribeScreenResult(Result result, const DeviceId& fromId) override;
    void onPublishScreenResult(Result result, const DeviceId& fromId) override;
    void onUnpublishScreenResult(Result result, const DeviceId& fromId) override;


public slots:
    bool on_subscribeRemoteScreen(bool sub);
    bool on_publishScreen(bool pub);
signals:

private:
    Ui_Use_Screen ui;
    rtc::IMScreen* module_;
    rtc::DeviceId curRemoteId_;
    IVideoView* remoteScreen_;
    std::string curLocalId_;
};

#endif // USE_SCREEN_H
