Kstars

streamwg.h
1 /*
2  SPDX-FileCopyrightText: 2003-2017 Jasem Mutlaq <[email protected]>
3 
4  SPDX-License-Identifier: GPL-2.0-or-later
5 */
6 
7 #pragma once
8 
9 #include "indicamera.h"
10 #include "ui_streamform.h"
11 #include "ui_recordingoptions.h"
12 #include "fitsviewer/bayer.h"
13 #include <indidevapi.h>
14 
15 #include <QCloseEvent>
16 #include <QColor>
17 #include <QIcon>
18 #include <QImage>
19 #include <QPaintEvent>
20 #include <QPixmap>
21 #include <QResizeEvent>
22 #include <QVBoxLayout>
23 #include <QVector>
24 
25 class RecordOptions : public QDialog, public Ui::recordingOptions
26 {
27  Q_OBJECT
28 
29  public:
30  explicit RecordOptions(QWidget *parent);
31 
32  public slots:
33  void selectRecordDirectory();
34 
35  private:
36  QUrl dirPath;
37 
38  friend class StreamWG;
39 };
40 
41 class StreamWG : public QDialog, public Ui::streamForm
42 {
43  Q_OBJECT
44 
45  public:
46  explicit StreamWG(ISD::Camera *ccd);
47  virtual ~StreamWG() override = default;
48 
49  void setColorFrame(bool color);
50  void setSize(int wd, int ht);
51 
52  void enableStream(bool enable);
53  bool isStreamEnabled()
54  {
55  return processStream;
56  }
57 
58  void newFrame(IBLOB *bp);
59 
60  int getStreamWidth()
61  {
62  return streamWidth;
63  }
64  int getStreamHeight()
65  {
66  return streamHeight;
67  }
68 
69  protected:
70  void closeEvent(QCloseEvent *ev) override;
71  void showEvent(QShowEvent *ev) override;
72  QSize sizeHint() const override;
73 
74  public slots:
75  void toggleRecord();
76  void updateRecordStatus(bool enabled);
77  void resetFrame();
78  void syncDebayerParameters();
79 
80  protected slots:
81  void setStreamingFrame(QRect newFrame);
82  void updateFPS(double instantFPS, double averageFPS);
83 
84  signals:
85  void hidden();
86  void imageChanged(const QSharedPointer<QImage> &frame);
87 
88  private:
89  bool queryDebayerParameters();
90 
91  bool processStream;
92  int streamWidth, streamHeight;
93  bool colorFrame, isRecording;
94  QIcon recordIcon, stopIcon;
95  ISD::Camera *m_Camera {nullptr};
96 
97  // Debayer
98  BayerParams m_DebayerParams;
99  uint8_t m_BBP {8};
100  uint16_t offsetX, offsetY;
101  double pixelX, pixelY;
102  bool m_DebayerActive { false }, m_DebayerSupported { false };
103 
104  // For Canon DSLRs
105  INDI::Property *eoszoom {nullptr}, *eoszoomposition {nullptr};
106  RecordOptions *options;
107 };
Q_OBJECTQ_OBJECT
virtual void closeEvent(QCloseEvent *e) override
virtual void showEvent(QShowEvent *event) override
virtual QSize sizeHint() const const override
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Fri Aug 12 2022 04:00:58 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.