[education/kstars] kstars/indi: Add full screen support for Streaming window

Jasem Mutlaq <[email protected]>
Newsgroups gmane.comp.kde.cvs
Message-ID <[email protected]>
Git commit 5239563d05027acbd73766a4bee30b187d703dbd by Jasem Mutlaq.
Committed on 14/08/2026 at 16:27.
Pushed by mutlaqja into branch 'master'.

Add full screen support for Streaming window

M  +33   -2    kstars/indi/streamform.ui
M  +40   -0    kstars/indi/streamwg.cpp
M  +5    -0    kstars/indi/streamwg.h

https://invent.kde.org/education/kstars/-/commit/5239563d05027acbd73766a4bee30b187d703dbd

diff --git a/kstars/indi/streamform.ui b/kstars/indi/streamform.ui
index e826a96cfb..a14e93df94 100644
--- a/kstars/indi/streamform.ui
+++ b/kstars/indi/streamform.ui
@@ -36,7 +36,8 @@
     <number>3</number>
    </property>
    <item>
-    <layout class="QHBoxLayout" name="horizontalLayout">
+    <widget class="QWidget" name="toolbarWidget" native="true">
+     <layout class="QHBoxLayout" name="horizontalLayout">
      <property name="spacing">
       <number>3</number>
      </property>
@@ -422,7 +423,36 @@
        </property>
       </widget>
      </item>
-    </layout>
+     <item>
+      <widget class="QPushButton" name="fullScreenB">
+       <property name="minimumSize">
+        <size>
+         <width>32</width>
+         <height>32</height>
+        </size>
+       </property>
+       <property name="maximumSize">
+        <size>
+         <width>64</width>
+         <height>64</height>
+        </size>
+       </property>
+       <property name="toolTip">
+        <string>Toggle Full Screen</string>
+       </property>
+       <property name="text">
+        <string/>
+       </property>
+       <property name="iconSize">
+        <size>
+         <width>32</width>
+         <height>32</height>
+        </size>
+       </property>
+      </widget>
+     </item>
+     </layout>
+    </widget>
    </item>
    <item>
     <widget class="VideoWG" name="videoFrame">
@@ -468,6 +498,7 @@
   <tabstop>NSSlider</tabstop>
   <tabstop>targetFrameDurationSpin</tabstop>
   <tabstop>changeFPSB</tabstop>
+  <tabstop>fullScreenB</tabstop>
  </tabstops>
  <resources/>
  <connections/>
diff --git a/kstars/indi/streamwg.cpp b/kstars/indi/streamwg.cpp
index b6819377ea..de1e34e8b9 100644
--- a/kstars/indi/streamwg.cpp
+++ b/kstars/indi/streamwg.cpp
@@ -223,6 +223,11 @@ StreamWG::StreamWG(ISD::Camera *ccd) : QDialog(KStars::Instance())
         m_DebayerActive = !m_DebayerActive;
     });
     syncDebayerParameters();
+
+    fullScreenIcon = QIcon::fromTheme("view-fullscreen");
+    restoreScreenIcon = QIcon::fromTheme("view-restore");
+    fullScreenB->setIcon(fullScreenIcon);
+    connect(fullScreenB, &QPushButton::clicked, this, &StreamWG::toggleFullScreen);
 }
 
 void StreamWG::syncDebayerParameters()
@@ -347,6 +352,9 @@ void StreamWG::closeEvent(QCloseEvent * ev)
 {
     processStream = false;
 
+    if (m_FullScreen)
+        toggleFullScreen();
+
     Options::setStreamWindowWidth(width());
     Options::setStreamWindowHeight(height());
 
@@ -355,6 +363,38 @@ void StreamWG::closeEvent(QCloseEvent * ev)
     Q_EMIT hidden();
 }
 
+void StreamWG::keyPressEvent(QKeyEvent *ev)
+{
+    if (ev->key() == Qt::Key_F11 || (m_FullScreen && ev->key() == Qt::Key_Escape))
+    {
+        toggleFullScreen();
+        ev->accept();
+        return;
+    }
+
+    QDialog::keyPressEvent(ev);
+}
+
+void StreamWG::toggleFullScreen()
+{
+    m_FullScreen = !m_FullScreen;
+
+    toolbarWidget->setVisible(!m_FullScreen);
+
+    if (m_FullScreen)
+    {
+        fullScreenB->setIcon(restoreScreenIcon);
+        fullScreenB->setToolTip(i18n("Exit Full Screen"));
+        showFullScreen();
+    }
+    else
+    {
+        fullScreenB->setIcon(fullScreenIcon);
+        fullScreenB->setToolTip(i18n("Toggle Full Screen"));
+        showNormal();
+    }
+}
+
 void StreamWG::setColorFrame(bool color)
 {
     colorFrame = color;
diff --git a/kstars/indi/streamwg.h b/kstars/indi/streamwg.h
index 5415c71a54..d78be6ca16 100644
--- a/kstars/indi/streamwg.h
+++ b/kstars/indi/streamwg.h
@@ -16,6 +16,7 @@
 #include <QColor>
 #include <QIcon>
 #include <QImage>
+#include <QKeyEvent>
 #include <QPaintEvent>
 #include <QPixmap>
 #include <QResizeEvent>
@@ -69,6 +70,7 @@ class StreamWG : public QDialog, public Ui::streamForm
     protected:
         void closeEvent(QCloseEvent *ev) override;
         void showEvent(QShowEvent *ev) override;
+        void keyPressEvent(QKeyEvent *ev) override;
         QSize sizeHint() const override;
 
     public Q_SLOTS:
@@ -76,6 +78,7 @@ class StreamWG : public QDialog, public Ui::streamForm
         void updateRecordStatus(bool enabled);
         void resetFrame();
         void syncDebayerParameters();
+        void toggleFullScreen();
 
     protected Q_SLOTS:
         void setStreamingFrame(QRect newFrame);
@@ -94,6 +97,8 @@ class StreamWG : public QDialog, public Ui::streamForm
         bool colorFrame, isRecording;
         bool showOverlay = false;
         QIcon recordIcon, stopIcon;
+        QIcon fullScreenIcon, restoreScreenIcon;
+        bool m_FullScreen {false};
         ISD::Camera *m_Camera {nullptr};
 
         // Debayer
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.