COSC345CoolGroupASLtoSpeech
BridgingASLandspokenlanguagewithAI:Translategesturestospeechforinclusivecommunication.
Public Slots | Public Member Functions | Public Attributes | List of all members
Camera Class Reference

The Camera class represents the main application window and camera functionalities. More...

#include <camera.h>

Inheritance diagram for Camera:
Inheritance graph
[legend]
Collaboration diagram for Camera:
Collaboration graph
[legend]

Public Slots

void setupMenus ()
 setupMenus More...
 
void displayCameraError ()
 displayCameraError More...
 
void translateText ()
 translateText More...
 
void addToHistory (const QString &original)
 addToHistory More...
 
void startCamera ()
 Start the current Camera. More...
 
void stopCamera ()
 Stop the current Camera. More...
 
QString getHistoryText ()
 getHistoryText More...
 
void imageAvailable (QVideoFrame frame)
 imageAvailable More...
 
bool getCameraActive ()
 Returns the current camera. More...
 
QString getLastHistory ()
 Returns the last translated text. More...
 
QString getTranslateText ()
 
void setTranslateText (QString str)
 
void setSubtitle (QString str)
 
QString getSubtitle ()
 Returns the subtitle text. More...
 
void onAboutToQuit ()
 
QString getHistoryForTranslate ()
 
void openSettings ()
 
void closeSettings ()
 
void closeApp ()
 Allows the application to be closed from the file menu. More...
 
void enableTyping ()
 Updates the readOnly variable of the translate text input box. More...
 
void signTimer ()
 
void updateProgressBar ()
 
void startProgressBar ()
 
void setProgressBarValue (int value)
 
int getGender ()
 
void openHelp ()
 
void closeHelp ()
 

Public Member Functions

 Camera ()
 Camera() is the constructor for the Camera class. More...
 

Public Attributes

Ui::Camera * ui
 
QStackedWidget * stacked
 
QList< QString > history
 list to store history of translations More...
 
QActionGroup * videoDevicesGroup = nullptr
 group of video devices More...
 
QMediaDevices m_devices
 available multimedia input/output devices instance More...
 
QImageCapture m_imageCapture
 image capture instance More...
 
QMediaCaptureSession m_captureSession
 media capture session instance More...
 
QCamera m_camera
 camera instance More...
 
QCamera * cam
 
QScopedPointer< QAudioInput > m_audioInput
 
QScopedPointer< QMediaRecorder > m_mediaRecorder
 
QMessageBox msgBox
 
QMenu * fileMenu
 
QMenu * devicesMenu
 
QMenu * cameraMenu
 
bool m_isCapturingImage = false
 
bool m_applicationExiting = false
 
bool m_doImageCapture = true
 
QProgressBar * progressBar
 
QRadioButton * maleButton
 
QRadioButton * femaleButton
 

Detailed Description

The Camera class represents the main application window and camera functionalities.

This class represents the main application window and provides functionalities related to camera capture, image processing, and user interaction. It also provides a UI for the user to interact with the application.

Constructor & Destructor Documentation

◆ Camera()

Camera::Camera ( )

Camera() is the constructor for the Camera class.

Camera::Camera() : ui(new Ui::Camera) constructs a new Camera:: Camera object.

The Camera() constructor initializes the Camera class and sets up the UI and camera-related components.

The Camera::Camera() : ui(new Ui::Camera) constructor initializes the Camera object and sets up various connections for button clicks and video frame updates. It also initializes camera resources.

Connect Camera::imageAvailable to QVideoSink::videoFrameChanged.

Everytime QVideoSink has a new frame, Camera::imageAvailable is called.

Member Function Documentation

◆ addToHistory

void Camera::addToHistory ( const QString &  original)
slot

addToHistory

Adds an entry to the translation history.

Adds the text in the text box to the history.

Parameters
originalThe original text.

This function appends a pair of original and translated text to the translation history data structure. It updates the history display in the GUI to reflect the new entry.

Note
Not currently active.
Parameters
originalThe original text before translation.

◆ closeApp

void Camera::closeApp ( )
slot

Allows the application to be closed from the file menu.

This function is called when the user selects the 'close' item in the file menu.

◆ closeHelp

void Camera::closeHelp ( )
slot

◆ closeSettings

void Camera::closeSettings ( )
slot

◆ displayCameraError

void Camera::displayCameraError ( )
slot

displayCameraError

Displays a camera error message.

Displays an error message if the camera fails to start.

This function displays a camera error message in a message box if there is an error with the camera.

◆ enableTyping

void Camera::enableTyping ( )
slot

Updates the readOnly variable of the translate text input box.

This function updates the readOnly function of the translate text input box.

◆ getCameraActive

bool Camera::getCameraActive ( )
slot

Returns the current camera.

This function returns the current camera that is being used.

Returns
The current camera that is being used.

◆ getGender

int Camera::getGender ( )
slot

◆ getHistoryForTranslate

QString Camera::getHistoryForTranslate ( )
slot

◆ getHistoryText

QString Camera::getHistoryText ( )
slot

getHistoryText

Retrieves formatted text for displaying translation history.

Gets the text from the history.

Returns
The text from the history.

This function generates a formatted text string containing all entries in the translation history data structure. Each entry includes the original and translated (or modified) text. The formatted text is suitable for display in the history spot in the GUI.

Note
Not currently active.
Returns
A text string containing translation history.

◆ getLastHistory

QString Camera::getLastHistory ( )
slot

Returns the last translated text.

This function returns the last translated text, which is the last entry in the translation history.

Returns
The last translated text.

◆ getSubtitle

QString Camera::getSubtitle ( )
slot

Returns the subtitle text.

This function returns the current subtitle text.

Returns
The current subtitle text.

◆ getTranslateText

QString Camera::getTranslateText ( )
slot

◆ imageAvailable

void Camera::imageAvailable ( QVideoFrame  frame)
slot

imageAvailable

Slot called when a new video frame is captured.

This function is connected to the QVideoSink::imageAvailable function. Everytime the camera recieves a new frame, this function is also called. This checks the frame for a recognised ASL sign.

Parameters
frameThe current frame from the camera.

This slot processes the incoming video frame, interacts with a Python module, and updates the video frame display. It also performs necessary data conversion between C++ and Python.

Note
Currently only calls the Python function every 9 frames as to reduce lag.
Parameters
frameThe incoming video frame.

◆ onAboutToQuit

void Camera::onAboutToQuit ( )
slot

◆ openHelp

void Camera::openHelp ( )
slot

◆ openSettings

void Camera::openSettings ( )
slot

◆ setProgressBarValue

void Camera::setProgressBarValue ( int  value)
slot

◆ setSubtitle

void Camera::setSubtitle ( QString  str)
slot

◆ setTranslateText

void Camera::setTranslateText ( QString  str)
slot

◆ setupMenus

void Camera::setupMenus ( )
slot

setupMenus

Sets up the application menus.

Sets up the MenuBar in the applicatoin.

This function creates and sets up menus for the application, such as File, Devices, and Camera menus. It also connects menu actions to corresponding functions in the Camera class.

◆ signTimer

void Camera::signTimer ( )
slot

◆ startCamera

void Camera::startCamera ( )
slot

Start the current Camera.

updates the camera device for the application to use.

This function starts the current Camera.

This function updates the camera device for the application to use.

Parameters
actionthe QAction corresponding to the camera device to use Starts the current camera.

This function starts the current camera.

Note
Not currently active.

◆ startProgressBar

void Camera::startProgressBar ( )
slot

◆ stopCamera

void Camera::stopCamera ( )
slot

Stop the current Camera.

Stops the current camera.

This function stops the current Camera.

This function stops the current camera.

Note
Not currently active.

◆ translateText

void Camera::translateText ( )
slot

translateText

Translates and displays input text using text-to-speech.

Translates the text in the text box.

This function is triggered when the "Translate" button is clicked in the GUI. It retrieves the input text from the UI, performs translation logic (if any), and then uses the text-to-speech function to generate speech from the input text. The translated text is displayed in the GUI, and the original and translated text are stored in the history for reference.

Note
Not currently active.

◆ updateProgressBar

void Camera::updateProgressBar ( )
slot

Member Data Documentation

◆ cam

QCamera* Camera::cam

◆ cameraMenu

QMenu* Camera::cameraMenu

◆ devicesMenu

QMenu* Camera::devicesMenu

◆ femaleButton

QRadioButton* Camera::femaleButton

◆ fileMenu

QMenu* Camera::fileMenu

◆ history

QList<QString> Camera::history

list to store history of translations

◆ m_applicationExiting

bool Camera::m_applicationExiting = false

◆ m_audioInput

QScopedPointer<QAudioInput> Camera::m_audioInput

◆ m_camera

QCamera Camera::m_camera

camera instance

◆ m_captureSession

QMediaCaptureSession Camera::m_captureSession

media capture session instance

◆ m_devices

QMediaDevices Camera::m_devices

available multimedia input/output devices instance

◆ m_doImageCapture

bool Camera::m_doImageCapture = true

◆ m_imageCapture

QImageCapture Camera::m_imageCapture

image capture instance

◆ m_isCapturingImage

bool Camera::m_isCapturingImage = false

◆ m_mediaRecorder

QScopedPointer<QMediaRecorder> Camera::m_mediaRecorder

◆ maleButton

QRadioButton* Camera::maleButton

◆ msgBox

QMessageBox Camera::msgBox

◆ progressBar

QProgressBar* Camera::progressBar

◆ stacked

QStackedWidget* Camera::stacked

◆ ui

Ui::Camera* Camera::ui

◆ videoDevicesGroup

QActionGroup* Camera::videoDevicesGroup = nullptr

group of video devices


The documentation for this class was generated from the following files: