Commits

iorodeo committed a544c93

Worked on format7 settings dialog.

Comments (0)

Files changed (8)

src/gui/CMakeLists.txt

     property_dialog.ui
     timer_settings_dialog.ui
     logging_settings_dialog.ui
+    format7_settings_dialog.ui
     )
 
 set(
     property_dialog.hpp
     timer_settings_dialog.hpp
     logging_settings_dialog.hpp
+    format7_settings_dialog.hpp
+    ar_graphics_view.hpp
     json.hpp
     basic_http_server.hpp
     )
     property_dialog.cpp
     timer_settings_dialog.cpp
     logging_settings_dialog.cpp
+    format7_settings_dialog.cpp
+    ar_graphics_view.cpp
     json.cpp
     basic_http_server.cpp
     )
 
 add_dependencies(test_gui ${bias_gui_FORMS})
 include_directories(${CMAKE_CURRENT_BINARY_DIR})
+include_directories(.)
 target_link_libraries(
     test_gui 
     ${QT_LIBRARIES} 

src/gui/ar_graphics_view.cpp

+#include "ar_graphics_view.hpp"
+#include <iostream>
+
+namespace bias
+{
+
+    ARGraphicsView::ARGraphicsView(QWidget *parent) : QGraphicsView(parent)
+    {
+        //QSizePolicy sizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); 
+        //sizePolicy.setHeightForWidth(true);
+        //setSizePolicy(sizePolicy);
+    }
+
+    int ARGraphicsView::heightForWidth(int w) const
+    {
+        int h = int(double(w)*(1024.0/1280.0)); 
+        std::cout << "h = " << h << std::endl;
+        return h;
+    }
+
+} // namespace bias

src/gui/ar_graphics_view.hpp

+#ifndef BIAS_AR_GRAPHICS_VIEW_HPP
+#define BIAS_AR_GRAPHICS_VIEW_HPP
+#include <QGraphicsView>
+
+namespace bias
+{
+    class ARGraphicsView : public QGraphicsView
+    {
+        public:
+
+            ARGraphicsView(QWidget *parent=0);
+            virtual int heightForWidth(int w) const;
+    };
+} // namepsace bias
+
+#endif // #ifndef BIAS_AR_GRAPHICS_VIEW_HPP

src/gui/camera_window.cpp

 #include "property_dialog.hpp"
 #include "timer_settings_dialog.hpp"
 #include "logging_settings_dialog.hpp"
+#include "format7_settings_dialog.hpp"
 #include "background_histogram_ufmf.hpp"
 #include "json.hpp"
 #include "basic_http_server.hpp"
 
     void CameraWindow::actionCameraFormat7SettingsTriggered()
     {
-        QString msgTitle("Development");
-        QString msgText("Format7 settings not fully implemented");
-        QMessageBox::information(this, msgTitle, msgText);
+        // If format7 settings dialog does exist create it otherwise raise
+        if (format7SettingsDialogPtr_.isNull()) 
+        {
+            format7SettingsDialogPtr_ = new Format7SettingsDialog(this);
+            format7SettingsDialogPtr_ -> show();
+        }
+        else
+        {
+            format7SettingsDialogPtr_ -> raise();
+        }
+
+        //QString msgTitle("Development");
+        //QString msgText("Format7 settings not fully implemented");
+        //QMessageBox::information(this, msgTitle, msgText);
     }
 
     

src/gui/camera_window.hpp

     class ImageLogger; 
     class TimerSettingsDialog;
     class LoggingSettingsDialog;
+    class Format7SettingsDialog;
     class BasicHttpServer;
     template <class T> class Lockable;
     template <class T> class LockableQueue;
 
             QPointer<TimerSettingsDialog> timerSettingsDialogPtr_;
             QPointer<LoggingSettingsDialog> loggingSettingsDialogPtr_;
+            QPointer<Format7SettingsDialog> format7SettingsDialogPtr_;
 
             VideoWriterParams videoWriterParams_;
 

src/gui/format7_settings_dialog.cpp

+#include "format7_settings_dialog.hpp"
+#include <iostream>
+#include <algorithm>
+#include <QGraphicsScene>
+#include <QPointer>
+
+namespace bias 
+{
+    Format7SettingsDialog::Format7SettingsDialog(QWidget *parent, Qt::WindowFlags f) 
+        : QDialog(parent,f)
+    {
+        initialize();
+    }
+
+    void Format7SettingsDialog::initialize()
+    {
+        setupUi(this);
+        setAttribute(Qt::WA_DeleteOnClose);
+
+        // Temporary
+        modeComboBoxPtr_ -> addItem("0");
+        pixelFormatComboBoxPtr_ -> addItem("MONO8");
+        xOffsetLineEditPtr_ -> setText("0");
+        yOffsetLineEditPtr_ -> setText("0");
+        xWidthLineEditPtr_ -> setText("1280");
+        yHeightLineEditPtr_ -> setText("1024");
+
+        QPointer<QGraphicsScene> scenePtr = new QGraphicsScene();
+        roiGraphicsViewPtr_ -> setScene(scenePtr);
+        scenePtr -> addRect(QRectF(0,0,200,200));
+
+    }
+    
+    void Format7SettingsDialog::resizeEvent(QResizeEvent *event)
+    {
+        QSize size = roiWidgetPtr_ -> size();
+        int minDim = std::min(size.width(), size.height());
+
+        roiGraphicsViewPtr_ -> setGeometry(
+                (size.width() - minDim)/2,
+                (size.height() - minDim)/2,
+                minDim,
+                minDim
+                );
+
+        std::cout << "size: " << size.width() << ", " << size.height() << std::endl;
+
+    }
+
+
+    
+
+} // namespace bias

src/gui/format7_settings_dialog.hpp

+#ifndef BIAS_FORMAT7_SETTINGS_DIALOG_HPP
+#define BIAS_FORMAT7_SETTINGS_DIALOG_HPP
+
+#include <QDialog>
+#include "ui_format7_settings_dialog.h"
+
+namespace bias
+{
+
+    class Format7SettingsDialog : public QDialog, public Ui::Format7SettingsDialog
+    {
+        Q_OBJECT
+
+        public:
+            Format7SettingsDialog(
+                    QWidget *parent=0,
+                    Qt::WindowFlags f=0
+                    );
+
+        protected:
+            void resizeEvent(QResizeEvent *event);
+
+        private:
+            void initialize();
+
+    }; // class Format7SettingsDialog
+
+} // namespace bias
+
+
+#endif // #ifndef BIAS_FORMAT7_SETTINGS_DIALOG_HPP

src/gui/format7_settings_dialog.ui

+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>Format7SettingsDialog</class>
+ <widget class="QDialog" name="Format7SettingsDialog">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>653</width>
+    <height>408</height>
+   </rect>
+  </property>
+  <property name="sizePolicy">
+   <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
+    <horstretch>0</horstretch>
+    <verstretch>0</verstretch>
+   </sizepolicy>
+  </property>
+  <property name="windowTitle">
+   <string>Format7 Settings</string>
+  </property>
+  <layout class="QVBoxLayout" name="verticalLayout_2">
+   <item>
+    <widget class="QGroupBox" name="imageParamGroupBoxPtr_">
+     <property name="font">
+      <font>
+       <weight>75</weight>
+       <bold>true</bold>
+      </font>
+     </property>
+     <property name="title">
+      <string>Image Parameters</string>
+     </property>
+     <layout class="QHBoxLayout" name="horizontalLayout">
+      <item>
+       <widget class="QLabel" name="label">
+        <property name="font">
+         <font>
+          <weight>50</weight>
+          <bold>false</bold>
+         </font>
+        </property>
+        <property name="text">
+         <string>Mode</string>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <widget class="QComboBox" name="modeComboBoxPtr_">
+        <property name="sizePolicy">
+         <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+          <horstretch>0</horstretch>
+          <verstretch>0</verstretch>
+         </sizepolicy>
+        </property>
+        <property name="minimumSize">
+         <size>
+          <width>60</width>
+          <height>0</height>
+         </size>
+        </property>
+        <property name="maximumSize">
+         <size>
+          <width>60</width>
+          <height>16777215</height>
+         </size>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <spacer name="horizontalSpacer">
+        <property name="orientation">
+         <enum>Qt::Horizontal</enum>
+        </property>
+        <property name="sizeType">
+         <enum>QSizePolicy::Fixed</enum>
+        </property>
+        <property name="sizeHint" stdset="0">
+         <size>
+          <width>20</width>
+          <height>20</height>
+         </size>
+        </property>
+       </spacer>
+      </item>
+      <item>
+       <widget class="QLabel" name="label_2">
+        <property name="font">
+         <font>
+          <weight>50</weight>
+          <bold>false</bold>
+         </font>
+        </property>
+        <property name="text">
+         <string>Pixel Format</string>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <widget class="QComboBox" name="pixelFormatComboBoxPtr_">
+        <property name="sizePolicy">
+         <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+          <horstretch>0</horstretch>
+          <verstretch>0</verstretch>
+         </sizepolicy>
+        </property>
+        <property name="minimumSize">
+         <size>
+          <width>200</width>
+          <height>0</height>
+         </size>
+        </property>
+        <property name="maximumSize">
+         <size>
+          <width>200</width>
+          <height>16777215</height>
+         </size>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <spacer name="horizontalSpacer_5">
+        <property name="orientation">
+         <enum>Qt::Horizontal</enum>
+        </property>
+        <property name="sizeHint" stdset="0">
+         <size>
+          <width>40</width>
+          <height>20</height>
+         </size>
+        </property>
+       </spacer>
+      </item>
+     </layout>
+    </widget>
+   </item>
+   <item>
+    <widget class="QGroupBox" name="roiGroupBoxPtr_">
+     <property name="font">
+      <font>
+       <weight>75</weight>
+       <bold>true</bold>
+      </font>
+     </property>
+     <property name="title">
+      <string>Region Of Interest</string>
+     </property>
+     <layout class="QVBoxLayout" name="verticalLayout">
+      <item>
+       <widget class="QWidget" name="roiWidgetPtr_" native="true">
+        <property name="sizePolicy">
+         <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
+          <horstretch>0</horstretch>
+          <verstretch>0</verstretch>
+         </sizepolicy>
+        </property>
+        <layout class="QHBoxLayout" name="horizontalLayout_3">
+         <item>
+          <widget class="bias::ARGraphicsView" name="roiGraphicsViewPtr_">
+           <property name="sizePolicy">
+            <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
+             <horstretch>0</horstretch>
+             <verstretch>0</verstretch>
+            </sizepolicy>
+           </property>
+           <property name="frameShape">
+            <enum>QFrame::NoFrame</enum>
+           </property>
+          </widget>
+         </item>
+        </layout>
+       </widget>
+      </item>
+      <item>
+       <widget class="Line" name="line">
+        <property name="orientation">
+         <enum>Qt::Horizontal</enum>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <widget class="QWidget" name="rioShapeWidgetPtr_" native="true">
+        <layout class="QHBoxLayout" name="horizontalLayout_2">
+         <item>
+          <widget class="QLabel" name="label_3">
+           <property name="font">
+            <font>
+             <weight>50</weight>
+             <bold>false</bold>
+            </font>
+           </property>
+           <property name="text">
+            <string>X Offset</string>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <widget class="QLineEdit" name="xOffsetLineEditPtr_">
+           <property name="sizePolicy">
+            <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+             <horstretch>0</horstretch>
+             <verstretch>0</verstretch>
+            </sizepolicy>
+           </property>
+           <property name="minimumSize">
+            <size>
+             <width>60</width>
+             <height>0</height>
+            </size>
+           </property>
+           <property name="maximumSize">
+            <size>
+             <width>60</width>
+             <height>16777215</height>
+            </size>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <spacer name="horizontalSpacer_6">
+           <property name="orientation">
+            <enum>Qt::Horizontal</enum>
+           </property>
+           <property name="sizeType">
+            <enum>QSizePolicy::Fixed</enum>
+           </property>
+           <property name="sizeHint" stdset="0">
+            <size>
+             <width>15</width>
+             <height>20</height>
+            </size>
+           </property>
+          </spacer>
+         </item>
+         <item>
+          <widget class="QLabel" name="label_4">
+           <property name="font">
+            <font>
+             <weight>50</weight>
+             <bold>false</bold>
+            </font>
+           </property>
+           <property name="text">
+            <string>Y Offset</string>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <widget class="QLineEdit" name="yOffsetLineEditPtr_">
+           <property name="sizePolicy">
+            <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+             <horstretch>0</horstretch>
+             <verstretch>0</verstretch>
+            </sizepolicy>
+           </property>
+           <property name="minimumSize">
+            <size>
+             <width>60</width>
+             <height>0</height>
+            </size>
+           </property>
+           <property name="maximumSize">
+            <size>
+             <width>60</width>
+             <height>16777215</height>
+            </size>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <spacer name="horizontalSpacer_7">
+           <property name="orientation">
+            <enum>Qt::Horizontal</enum>
+           </property>
+           <property name="sizeType">
+            <enum>QSizePolicy::Fixed</enum>
+           </property>
+           <property name="sizeHint" stdset="0">
+            <size>
+             <width>15</width>
+             <height>20</height>
+            </size>
+           </property>
+          </spacer>
+         </item>
+         <item>
+          <widget class="QLabel" name="label_5">
+           <property name="font">
+            <font>
+             <weight>50</weight>
+             <bold>false</bold>
+            </font>
+           </property>
+           <property name="text">
+            <string>X Width</string>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <widget class="QLineEdit" name="xWidthLineEditPtr_">
+           <property name="sizePolicy">
+            <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+             <horstretch>0</horstretch>
+             <verstretch>0</verstretch>
+            </sizepolicy>
+           </property>
+           <property name="minimumSize">
+            <size>
+             <width>60</width>
+             <height>0</height>
+            </size>
+           </property>
+           <property name="maximumSize">
+            <size>
+             <width>60</width>
+             <height>16777215</height>
+            </size>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <spacer name="horizontalSpacer_8">
+           <property name="orientation">
+            <enum>Qt::Horizontal</enum>
+           </property>
+           <property name="sizeType">
+            <enum>QSizePolicy::Fixed</enum>
+           </property>
+           <property name="sizeHint" stdset="0">
+            <size>
+             <width>15</width>
+             <height>20</height>
+            </size>
+           </property>
+          </spacer>
+         </item>
+         <item>
+          <widget class="QLabel" name="label_6">
+           <property name="font">
+            <font>
+             <weight>50</weight>
+             <bold>false</bold>
+            </font>
+           </property>
+           <property name="text">
+            <string>Y Heigth</string>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <widget class="QLineEdit" name="yHeightLineEditPtr_">
+           <property name="sizePolicy">
+            <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+             <horstretch>0</horstretch>
+             <verstretch>0</verstretch>
+            </sizepolicy>
+           </property>
+           <property name="minimumSize">
+            <size>
+             <width>60</width>
+             <height>0</height>
+            </size>
+           </property>
+           <property name="maximumSize">
+            <size>
+             <width>60</width>
+             <height>16777215</height>
+            </size>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <spacer name="horizontalSpacer_2">
+           <property name="orientation">
+            <enum>Qt::Horizontal</enum>
+           </property>
+           <property name="sizeHint" stdset="0">
+            <size>
+             <width>40</width>
+             <height>20</height>
+            </size>
+           </property>
+          </spacer>
+         </item>
+        </layout>
+       </widget>
+      </item>
+     </layout>
+    </widget>
+   </item>
+  </layout>
+ </widget>
+ <customwidgets>
+  <customwidget>
+   <class>bias::ARGraphicsView</class>
+   <extends>QGraphicsView</extends>
+   <header>ar_graphics_view.hpp</header>
+  </customwidget>
+ </customwidgets>
+ <resources/>
+ <connections/>
+</ui>