Vagyojaka 5.5.7
Loading...
Searching...
No Matches
Tool Class Referencefinal

The Tool class (Main Window) More...

#include <tool.h>

Inheritance diagram for Tool:

Public Member Functions

 Tool (QWidget *parent=nullptr)
 Constructs a Tool object.
 
 ~Tool () final
 Destroys the Tool object.
 

Protected Member Functions

void keyPressEvent (QKeyEvent *event) override
 Handles key press events.
 
void dragEnterEvent (QDragEnterEvent *event) override
 Handles drag enter events.
 
void dropEvent (QDropEvent *event) override
 Handles drop events.
 
void dragMoveEvent (QDragMoveEvent *event) override
 Handles drag move events.
 
void resizeEvent (QResizeEvent *event) override
 Handles resize events.
 

Private Slots

void handleMediaPlayerError ()
 Handles errors from the media player and prints at statusbar.
 
void createKeyboardShortcutGuide ()
 Creates a guide for keyboard shortcuts.
 
void changeFont ()
 Changes the font of the application.
 
void changeFontSize (int change)
 Changes the font size.
 
void transliterationSelected (QAction *action)
 Handles the selection of a transliteration action.
 
void createMediaSplitter ()
 Creates a media splitter.
 
void on_Upload_and_generate_Transcript_triggered ()
 Triggered when the upload and generate transcript action is invoked.
 
void on_btn_translate_clicked ()
 Triggered when the translate button is clicked.
 
void on_editor_openTranscript_triggered ()
 Triggered when the "Open Transcript" button is clicked.
 
void on_add_video_clicked ()
 Triggered when the "Open Video/Audio" button is clicked in the GUI.
 
void on_open_transcript_clicked ()
 Triggered when the editor to open a transcript is invoked.
 
void on_new_transcript_clicked ()
 Triggered when the "New Transcript" button is clicked.
 
void on_save_transcript_clicked ()
 Triggered when the "Save Transcript" button is clicked.
 
void on_save_as_transcript_clicked ()
 Triggered when the "Save As Transcript" button is clicked.
 
void on_load_a_custom_dict_clicked ()
 Triggered when the "Load Custom Dictionary" button is clicked.
 
void on_get_PDF_clicked ()
 Triggered when the "Get PDF" button is clicked.
 
void on_decreseFontSize_clicked ()
 Triggered when the "Decrease Font Size" button is clicked.
 
void on_increaseFontSize_clicked ()
 Triggered when the "Increase Font Size" button is clicked.
 
void on_toggleWordEditor_clicked ()
 Toggles the visibility of the word editor.
 
void on_keyboard_shortcuts_clicked ()
 Opens the keyboard shortcuts guide.
 
void on_fontComboBox_currentFontChanged (const QFont &f)
 Updates the font based on the current selection in the font combo box.
 
void on_actionAbout_triggered ()
 Triggered when the "About" action is invoked.
 
void on_actionInit_triggered ()
 Triggered when the "Initialize" action is invoked.
 
void on_actionAdd_All_triggered ()
 Triggered when the "Add All" action is invoked.
 
void on_actionCommit_triggered ()
 Triggered when the "Commit" action is invoked.
 
void on_actionAdd_Remote_URL_triggered ()
 Triggered when the "Add Remote URL" action is invoked.
 
void on_actionPush_triggered ()
 Triggered when the "Push" action is invoked.
 
void on_actionPull_triggered ()
 Triggered when the "Pull" action is invoked.
 
void on_actionShow_Waveform_triggered ()
 Triggered when the "Show Waveform" action is invoked.
 
void on_actionSave_Timestamps_triggered ()
 Triggered when the "Update Timestamps" action is invoked.
 
void connectWaveformAndMediaplayer ()
 Connects the waveform visualization and the media player.
 
void on_actionUpdate_Timestamps_triggered ()
 Triggered when the "Update Timestamps" action is invoked.
 
void on_actionShow_Endlines_triggered ()
 Triggered when the "Show Endlines" action is invoked.
 
void on_actionOpen_triggered ()
 Triggered when the "Open" action from TTS options is invoked.
 

Private Member Functions

void setFontForElements ()
 Sets the font for various UI elements.
 
void setTransliterationLangCodes ()
 Sets up transliteration language codes.
 
bool isDroppedOnLayout (const QPoint &pos, QVBoxLayout *layout)
 isDroppedOnLayout
 
QVector< TTSRowparseXML (const QUrl &fileUrl)
 parseXML
 
void setDefaultAudioOutputDevice ()
 Sets the default audio output device.
 
void onTabChanged (int index)
 Handles tab change events in the UI.
 

Private Attributes

MediaPlayerplayer = nullptr
 Pointer to the media player instance.
 
QAudioOutput * m_audioOutput = nullptr
 Pointer to the audio output instance.
 
Ui::Tool * ui
 Pointer to the UI components.
 
QFont font
 Font used for various text elements in the UI.
 
QMap< QString, QString > m_transliterationLang
 Map of transliteration languages and their corresponding codes.
 
Gitgit = nullptr
 Pointer to the Git management class.
 
bool isSendingSampleRateSuccess = false
 Flag indicating if sending sample rate was successful.
 
bool isSamplingSuccess = false
 Flag indicating if audio sampling was successful.
 
QSettings * settings
 Pointer to application settings.
 
KeyboardShortcutGuidehelp_keyshortcuts = nullptr
 Pointer to the keyboard shortcut guide.
 
Aboutabout = nullptr
 Pointer to the About dialog.
 
QMediaDevices m_mediaDevices
 Object representing available media devices.
 

Detailed Description

The Tool class (Main Window)

This class serves as the main interface for the application, providing access to various functionalities and managing the overall user experience.

Constructor & Destructor Documentation

◆ Tool()

Tool::Tool ( QWidget * parent = nullptr)
explicit

Constructs a Tool object.

Initializes the main window and sets up the UI components.

Parameters
parentOptional parent widget.

◆ ~Tool()

Tool::~Tool ( )
final

Destroys the Tool object.

Cleans up resources and saves any necessary state before destruction.

Member Function Documentation

◆ changeFont

void Tool::changeFont ( )
privateslot

Changes the font of the application.

◆ changeFontSize

void Tool::changeFontSize ( int change)
privateslot

Changes the font size.

Parameters
changeThe amount to change the font size by.

◆ connectWaveformAndMediaplayer

void Tool::connectWaveformAndMediaplayer ( )
privateslot

Connects the waveform visualization and the media player.

This method establishes connections between the MediaPlayer instance player and the AudioWaveForm instance from the UI based on the success of audio sampling.

If isSamplingSuccess is true, it connects the media player's position changes to update the waveform position, and vice versa. If sampling is not successful, it disconnects any existing connections to prevent updates between the media player and the waveform.

◆ createKeyboardShortcutGuide

void Tool::createKeyboardShortcutGuide ( )
privateslot

Creates a guide for keyboard shortcuts.

If the guide is empty, it initializes a new KeyboardShortcutGuide. Otherwise, it uses the existing member variable help_keyshortcuts, which points to the current keyboard shortcut guide.

◆ createMediaSplitter

void Tool::createMediaSplitter ( )
privateslot

Creates a media splitter.

This method initializes a MediaSplitter class instance and splits media files based on the provided transcript timestamps.

◆ dragEnterEvent()

void Tool::dragEnterEvent ( QDragEnterEvent * event)
overrideprotected

Handles drag enter events.

Parameters
eventThe drag enter event.

◆ dragMoveEvent()

void Tool::dragMoveEvent ( QDragMoveEvent * event)
overrideprotected

Handles drag move events.

Parameters
eventThe drag move event.

◆ dropEvent()

void Tool::dropEvent ( QDropEvent * event)
overrideprotected

Handles drop events.

Parameters
eventThe drop event.

◆ handleMediaPlayerError

void Tool::handleMediaPlayerError ( )
privateslot

Handles errors from the media player and prints at statusbar.

◆ isDroppedOnLayout()

bool Tool::isDroppedOnLayout ( const QPoint & pos,
QVBoxLayout * layout )
private

isDroppedOnLayout

Parameters
pos
layout
Returns
Unused

◆ keyPressEvent()

void Tool::keyPressEvent ( QKeyEvent * event)
overrideprotected

Handles key press events.

Overrides the default behavior to customize key event handling.

Parameters
eventThe key event.

◆ on_actionAbout_triggered

void Tool::on_actionAbout_triggered ( )
privateslot

Triggered when the "About" action is invoked.

This method displays the About dialog, providing information about the application and its authors.

◆ on_actionAdd_All_triggered

void Tool::on_actionAdd_All_triggered ( )
privateslot

Triggered when the "Add All" action is invoked.

This method is called when the user selects the "Add All" option in the GUI. It invokes the Git::add() method to stage all changes in the repository.

◆ on_actionAdd_Remote_URL_triggered

void Tool::on_actionAdd_Remote_URL_triggered ( )
privateslot

Triggered when the "Add Remote URL" action is invoked.

This method is called when the user selects the "Add Remote URL" option in the GUI. It invokes the Git::addRemoteUrl() method to add or update a remote repository URL.

◆ on_actionCommit_triggered

void Tool::on_actionCommit_triggered ( )
privateslot

Triggered when the "Commit" action is invoked.

This method is called when the user selects the "Commit" option in the GUI. It invokes the Git::commit() method to commit all staged changes to the repository.

◆ on_actionInit_triggered

void Tool::on_actionInit_triggered ( )
privateslot

Triggered when the "Initialize" action is invoked.

This method is called when the user selects the "Initialize" option in the GUI. It invokes the Git::init() method to set up the Git repository and necessary configurations, enabling version control features within the application.

◆ on_actionOpen_triggered

void Tool::on_actionOpen_triggered ( )
privateslot

Triggered when the "Open" action from TTS options is invoked.

This method is called when the user selects the "Open" option in the GUI. It invokes the openTTSTranscript() method of the TTSAnnotator instance, allowing the user to select a transcript file to open and process.

◆ on_actionPull_triggered

void Tool::on_actionPull_triggered ( )
privateslot

Triggered when the "Pull" action is invoked.

This method is called when the user selects the "Pull" option in the GUI. It invokes the Git::pull() method to retrieve and merge changes from the remote repository into the local repository, ensuring that the local state is up-to-date with the latest commits.

◆ on_actionPush_triggered

void Tool::on_actionPush_triggered ( )
privateslot

Triggered when the "Push" action is invoked.

This method is called when the user selects the "Push" option in the GUI. It invokes the Git::push() method to upload local changes to the remote repository.

◆ on_actionSave_Timestamps_triggered

void Tool::on_actionSave_Timestamps_triggered ( )
privateslot

Triggered when the "Update Timestamps" action is invoked.

This method is called when the user selects the "Update Timestamps" option in the GUI. It invokes the updateTimestampsToggle() method of the AudioWaveForm instance, updating the timestamps in the currently opened transcript block in the editor.

◆ on_actionShow_Endlines_triggered

void Tool::on_actionShow_Endlines_triggered ( )
privateslot

Triggered when the "Show Endlines" action is invoked.

This method is called when the user selects the "Show Endlines" option in the GUI. It invokes the showWaveform() method of the Editor instance, which processes the current transcript blocks and prepares the waveform for display.

◆ on_actionShow_Waveform_triggered

void Tool::on_actionShow_Waveform_triggered ( )
privateslot

Triggered when the "Show Waveform" action is invoked.

This method is called when the user selects the "Show Waveform" option in the GUI. It invokes the showWaveForm() method of the AudioWaveForm instance, displaying the waveform of the currently loaded audio for visual analysis at Waveform tab.

◆ on_actionUpdate_Timestamps_triggered

void Tool::on_actionUpdate_Timestamps_triggered ( )
privateslot

Triggered when the "Update Timestamps" action is invoked.

This method is called when the user selects the "Update Timestamps" option in the GUI. It invokes the updateTimeStamps() method of the AudioWaveForm instance, which processes and emits the updated timestamps for the currently loaded audio.

◆ on_add_video_clicked

void Tool::on_add_video_clicked ( )
privateslot

Triggered when the "Open Video/Audio" button is clicked in the GUI.

This method is invoked when the user clicks the "Open Video/Audio" button, prompting the MediaPlayer to open a file dialog and select a video file by calling the MediaPlayer::open() method.

◆ on_btn_translate_clicked

void Tool::on_btn_translate_clicked ( )
privateslot

Triggered when the translate button is clicked.

Note: This feature is currently disabled.

◆ on_decreseFontSize_clicked

void Tool::on_decreseFontSize_clicked ( )
privateslot

Triggered when the "Decrease Font Size" button is clicked.

This method decreases the font size of UI elements to improve readability.

◆ on_editor_openTranscript_triggered

void Tool::on_editor_openTranscript_triggered ( )
privateslot

Triggered when the "Open Transcript" button is clicked.

This signal is emitted when the corresponding button in the GUI is clicked, prompting the Editor class to open a specified transcript using a file dialog from the file explorer for viewing or editing, by calling the Editor::transcriptOpen() method.

◆ on_fontComboBox_currentFontChanged

void Tool::on_fontComboBox_currentFontChanged ( const QFont & f)
privateslot

Updates the font based on the current selection in the font combo box.

Parameters
fThe newly selected font.

◆ on_get_PDF_clicked

void Tool::on_get_PDF_clicked ( )
privateslot

Triggered when the "Get PDF" button is clicked.

This method saves the current transcript as a PDF when the user clicks the "Get PDF" button in the GUI, invoking the Editor::saveAsPDF() method.

◆ on_increaseFontSize_clicked

void Tool::on_increaseFontSize_clicked ( )
privateslot

Triggered when the "Increase Font Size" button is clicked.

This method increases the font size of UI elements for better visibility.

◆ on_keyboard_shortcuts_clicked

void Tool::on_keyboard_shortcuts_clicked ( )
privateslot

Opens the keyboard shortcuts guide.

This method is triggered when the user clicks the "Keyboard Shortcuts" button in the GUI. It invokes the createKeyboardShortcutGuide() method to display the available keyboard shortcuts, helping users navigate the application more efficiently.

◆ on_load_a_custom_dict_clicked

void Tool::on_load_a_custom_dict_clicked ( )
privateslot

Triggered when the "Load Custom Dictionary" button is clicked.

This method opens a file dialog to load a custom dictionary file when the corresponding button in the GUI is clicked.

◆ on_new_transcript_clicked

void Tool::on_new_transcript_clicked ( )
privateslot

Triggered when the "New Transcript" button is clicked.

Note: This feature is currently disabled.

◆ on_open_transcript_clicked

void Tool::on_open_transcript_clicked ( )
privateslot

Triggered when the editor to open a transcript is invoked.

This signal is emitted when the corresponding button in the GUI is clicked, prompting the Editor class to open the specified transcript for viewing or editing by calling the Editor::transcriptOpen() method.

◆ on_save_as_transcript_clicked

void Tool::on_save_as_transcript_clicked ( )
privateslot

Triggered when the "Save As Transcript" button is clicked.

This method saves the current transcript from the GUI after the user clicks the save as button, invoking the Editor::transcriptSaveAs() method.

◆ on_save_transcript_clicked

void Tool::on_save_transcript_clicked ( )
privateslot

Triggered when the "Save Transcript" button is clicked.

This method saves the current transcript from the GUI after the user clicks the save button, invoking the Editor::transcriptSave() method.

◆ on_toggleWordEditor_clicked

void Tool::on_toggleWordEditor_clicked ( )
privateslot

Toggles the visibility of the word editor.

This method shows or hides the WordEditor instance in the GUI based on the current state. If the word editor is currently hidden, it will be displayed; if it is visible, it will be hidden. The visibility state is managed through the m_wordEditor GUI variable.

◆ on_Upload_and_generate_Transcript_triggered

void Tool::on_Upload_and_generate_Transcript_triggered ( )
privateslot

Triggered when the upload and generate transcript action is invoked.

This method uploads the media file to the web portal, generates transcripts, and loads them into the application.

Note: This feature is currently disabled.

◆ onTabChanged()

void Tool::onTabChanged ( int index)
private

Handles tab change events in the UI.

This method is called when the user switches between tabs in the UI. It checks the index of the currently selected tab. If the index is greater than 0 (indicating that a tab other than the first tab is selected), it hides the media and transcript filename labels. If the first tab is selected (index 0), it shows these labels.

Parameters
indexThe index of the currently selected tab.

◆ parseXML()

QVector< TTSRow > Tool::parseXML ( const QUrl & fileUrl)
private

parseXML

Parameters
fileUrl
Returns
Unused

◆ resizeEvent()

void Tool::resizeEvent ( QResizeEvent * event)
overrideprotected

Handles resize events.

Parameters
eventThe resize event.

◆ setDefaultAudioOutputDevice()

void Tool::setDefaultAudioOutputDevice ( )
private

Sets the default audio output device.

This method retrieves the system's default audio output device using QMediaDevices::defaultAudioOutput(). If a valid device is found, it sets this device for the audio output instance (m_audioOutput) and logs the device description for debugging purposes. If no audio output devices are available, it logs a message indicating that no devices were found.

◆ setFontForElements()

void Tool::setFontForElements ( )
private

Sets the font for various UI elements.

This method applies a specified font to multiple editor components and other UI elements. It ensures that the appearance of the text in the editors and associated widgets is consistent by setting the same font across all relevant elements. The method also calls fitTableContents() on the word editor to adjust the display according to the new font settings.

◆ setTransliterationLangCodes()

void Tool::setTransliterationLangCodes ( )
private

Sets up transliteration language codes.

This method initializes the mapping of language names to their corresponding ISO language codes. It creates two QStringLists: one for the language names and another for the associated codes. The method iterates through the lists and populates the m_transliterationLang map with the language names as keys and their corresponding codes as values. This mapping is used for transliteration functionality throughout the application.

◆ transliterationSelected

void Tool::transliterationSelected ( QAction * action)
privateslot

Handles the selection of a transliteration action.

Parameters
actionThe selected action.

Member Data Documentation

◆ about

About* Tool::about = nullptr
private

Pointer to the About dialog.

This object displays information about the application.

◆ font

QFont Tool::font
private

Font used for various text elements in the UI.

This variable holds the QFont object representing the default font used throughout the application.

◆ git

Git* Tool::git = nullptr
private

Pointer to the Git management class.

This object handles Git operations such as init, add_url, commit, push, and pull.

◆ help_keyshortcuts

KeyboardShortcutGuide* Tool::help_keyshortcuts = nullptr
private

Pointer to the keyboard shortcut guide.

This object provides assistance for using keyboard shortcuts in the application.

◆ isSamplingSuccess

bool Tool::isSamplingSuccess = false
private

Flag indicating if audio sampling was successful.

This boolean variable indicates whether audio sampling was completed successfully.

◆ isSendingSampleRateSuccess

bool Tool::isSendingSampleRateSuccess = false
private

Flag indicating if sending sample rate was successful.

This boolean variable tracks the success state of sample rate operations.

◆ m_audioOutput

QAudioOutput* Tool::m_audioOutput = nullptr
private

Pointer to the audio output instance.

This object manages the audio output device used for playback.

◆ m_mediaDevices

QMediaDevices Tool::m_mediaDevices
private

Object representing available media devices.

This object provides access to media devices available on the system.

◆ m_transliterationLang

QMap<QString, QString> Tool::m_transliterationLang
private

Map of transliteration languages and their corresponding codes.

This map associates language names with their ISO language codes to facilitate transliteration functionality.

◆ player

MediaPlayer* Tool::player = nullptr
private

Pointer to the media player instance.

This object is responsible for playing media files and managing playback controls.

◆ settings

QSettings* Tool::settings
private

Pointer to application settings.

This object manages user preferences and settings using QSettings.

◆ ui

Ui::Tool* Tool::ui
private

Pointer to the UI components.

This pointer provides access to the user interface elements defined in the Tool class UI.


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