justburner e9f260
#pragma once
justburner e9f260
justburner e9f260
#include "toonzqt/dvdialog.h"
justburner e9f260
justburner e9f260
#include <qlabel></qlabel>
justburner e9f260
#include <qslider></qslider>
justburner e9f260
#include <qpushbutton></qpushbutton>
justburner 06cb33
#include <qboxlayout></qboxlayout>
justburner e9f260
justburner 521a74
#undef DVAPI
justburner 521a74
#undef DVVAR
justburner 521a74
#ifdef TOONZQT_EXPORTS
justburner 521a74
#define DVAPI DV_EXPORT_API
justburner 521a74
#define DVVAR DV_EXPORT_VAR
justburner 521a74
#else
justburner 521a74
#define DVAPI DV_IMPORT_API
justburner 521a74
#define DVVAR DV_IMPORT_VAR
justburner 521a74
#endif
justburner 521a74
justburner 521a74
class SeeThroughWindowMode;
justburner 521a74
justburner e9f260
class SeeThroughWindowPopup final : public DVGui::Dialog {
justburner e9f260
  Q_OBJECT
justburner e9f260
justburner 521a74
  SeeThroughWindowMode *m_mode;
justburner 521a74
justburner 521a74
  int m_backupValue;
justburner 521a74
  QWidget *m_mainWindow;
justburner 06cb33
  QBoxLayout *m_layout;
justburner e9f260
justburner e9f260
  QSlider *m_opacitySlider;
justburner e9f260
  QPushButton *m_opacityBtn;
justburner e9f260
  QPushButton *m_closeBtn;
justburner 06cb33
  QString m_suffixTxtSlider;
justburner e9f260
justburner e9f260
  QIcon m_seeThroughIcon_off;
justburner e9f260
  QIcon m_seeThroughIcon_on;
justburner e9f260
justburner e9f260
public:
justburner 521a74
  SeeThroughWindowPopup(SeeThroughWindowMode *mode, QWidget *mainWindow);
justburner 521a74
  QWidget *getMainWindow();
justburner e9f260
justburner e9f260
  void toggleMode();
justburner e9f260
justburner 521a74
  int getOpacitySlider();
justburner 521a74
  int setOpacitySlider(int opacity);
justburner 521a74
justburner 521a74
  void changeOpacity(int value);
justburner 521a74
justburner e9f260
private:
justburner e9f260
  void showEvent(QShowEvent *e) override;
justburner e9f260
  void hideEvent(QHideEvent *e) override;
justburner 06cb33
  void resizeEvent(QResizeEvent *) override;
justburner e9f260
justburner e9f260
private slots:
justburner e9f260
  void sliderChanged(int value);
justburner e9f260
  void opacityToggle();
justburner e9f260
};
justburner 521a74
justburner 521a74
class DVAPI SeeThroughWindowMode final : public QObject {
justburner 521a74
  Q_OBJECT
justburner 521a74
justburner 521a74
  SeeThroughWindowPopup *m_dialog;
justburner 521a74
justburner 521a74
public:
justburner 521a74
  static SeeThroughWindowMode *instance() {
justburner 521a74
    static SeeThroughWindowMode _instance;
justburner 521a74
    return &_instance;
justburner 521a74
  }
justburner 521a74
justburner 521a74
  void toggleMode(QWidget *mainWindow);
justburner 521a74
  QWidget *getMainWindow();
justburner 521a74
  int getOpacity();
justburner 521a74
  void refreshOpacity();
justburner 521a74
justburner 521a74
signals:
justburner 521a74
  void opacityChanged(int value, bool &hideMain);
justburner 521a74
justburner 521a74
private:
justburner 521a74
  SeeThroughWindowMode();
justburner 521a74
justburner 521a74
  void toggleMode_m(QWidget *mainWindow);
justburner 521a74
};