|
Vagyojaka 5.5.7
|
The Tool class (Main Window) More...
#include <tool.h>
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< TTSRow > | parseXML (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 | |
| MediaPlayer * | player = 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. | |
| Git * | git = 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. | |
| KeyboardShortcutGuide * | help_keyshortcuts = nullptr |
| Pointer to the keyboard shortcut guide. | |
| About * | about = nullptr |
| Pointer to the About dialog. | |
| QMediaDevices | m_mediaDevices |
| Object representing available media devices. | |
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.
|
explicit |
Constructs a Tool object.
Initializes the main window and sets up the UI components.
| parent | Optional parent widget. |
|
final |
Destroys the Tool object.
Cleans up resources and saves any necessary state before destruction.
|
privateslot |
Changes the font of the application.
|
privateslot |
Changes the font size.
| change | The amount to change the font size by. |
|
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.
|
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.
|
privateslot |
Creates a media splitter.
This method initializes a MediaSplitter class instance and splits media files based on the provided transcript timestamps.
|
overrideprotected |
Handles drag enter events.
| event | The drag enter event. |
|
overrideprotected |
Handles drag move events.
| event | The drag move event. |
|
overrideprotected |
Handles drop events.
| event | The drop event. |
|
privateslot |
Handles errors from the media player and prints at statusbar.
|
private |
isDroppedOnLayout
| pos | |
| layout |
|
overrideprotected |
Handles key press events.
Overrides the default behavior to customize key event handling.
| event | The key event. |
|
privateslot |
Triggered when the "About" action is invoked.
This method displays the About dialog, providing information about the application and its authors.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
privateslot |
Triggered when the translate button is clicked.
Note: This feature is currently disabled.
|
privateslot |
Triggered when the "Decrease Font Size" button is clicked.
This method decreases the font size of UI elements to improve readability.
|
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.
|
privateslot |
Updates the font based on the current selection in the font combo box.
| f | The newly selected font. |
|
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.
|
privateslot |
Triggered when the "Increase Font Size" button is clicked.
This method increases the font size of UI elements for better visibility.
|
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.
|
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.
|
privateslot |
Triggered when the "New Transcript" button is clicked.
Note: This feature is currently disabled.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
| index | The index of the currently selected tab. |
|
private |
parseXML
| fileUrl |
|
overrideprotected |
Handles resize events.
| event | The resize event. |
|
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.
|
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.
|
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.
|
privateslot |
Handles the selection of a transliteration action.
| action | The selected action. |
|
private |
Pointer to the About dialog.
This object displays information about the application.
|
private |
Font used for various text elements in the UI.
This variable holds the QFont object representing the default font used throughout the application.
|
private |
|
private |
Pointer to the keyboard shortcut guide.
This object provides assistance for using keyboard shortcuts in the application.
|
private |
Flag indicating if audio sampling was successful.
This boolean variable indicates whether audio sampling was completed successfully.
|
private |
Flag indicating if sending sample rate was successful.
This boolean variable tracks the success state of sample rate operations.
|
private |
Pointer to the audio output instance.
This object manages the audio output device used for playback.
|
private |
Object representing available media devices.
This object provides access to media devices available on the system.
|
private |
Map of transliteration languages and their corresponding codes.
This map associates language names with their ISO language codes to facilitate transliteration functionality.
|
private |
Pointer to the media player instance.
This object is responsible for playing media files and managing playback controls.
|
private |
Pointer to application settings.
This object manages user preferences and settings using QSettings.
|
private |
Pointer to the UI components.
This pointer provides access to the user interface elements defined in the Tool class UI.