Vagyojaka 5.5.7
Loading...
Searching...
No Matches
Editor Class Reference

Manages the editing functionalities of transcripts, including time stamps, speaker changes, and file exports. More...

#include <editor.h>

Inheritance diagram for Editor:
TextEditor

Public Slots

void transcriptOpen ()
 Opens a transcript file, allowing the user to select a file from the file dialog.
 
void transcriptSave ()
 Saves the current transcript.
 
void transcriptSaveAs ()
 Saves the current transcript with a new file name.
 
void transcriptClose ()
 Closes the current transcript file.
 
void highlightTranscript (const QTime &elapsedTime)
 Highlights a transcript block and word based on the provided elapsed time.
 
void addCustomDictonary ()
 Opens a file dialog to add a custom dictionary.
 
void showBlocksFromData ()
 Displays all blocks and their content in the QDebug (Saved in Logfile). Iterates through each block and prints its timestamp, speaker, text, and associated tags, followed by printing word details within each block.
 
void jumpToHighlightedLine ()
 Moves the cursor to the highlighted line in the editor. If no block is highlighted, the function returns immediately.
 
void splitLine (const QTime &elapsedTime)
 Splits the current text line at the cursor's position. Divides the block into two based on cursor position, creating a new block and adjusting the timestamp and word list of each. Updates the editor content accordingly.
 
void mergeUp ()
 Merges the current block with the previous one, combining text and word lists. Only merges if the speaker of the current and previous block match.
 
void mergeDown ()
 Merges the current block with the next block, transferring word list and text. Only merges if the speakers match for both blocks.
 
void createChangeSpeakerDialog ()
 Opens a dialog to select a new speaker for the highlighted block. Displays a modal dialog with a list of existing speakers. Updates the selected speaker in the block upon confirmation.
 
void createTimePropagationDialog ()
 Opens a dialog for propagating time across a range of blocks. Sets up a dialog allowing users to select a time range and optionally negate it. On confirmation, the specified time is propagated to the selected block range.
 
void createTagSelectionDialog ()
 Opens a dialog for selecting and marking tags in the current block. Allows users to add tags to a block, showing existing tags initially.
 
void insertTimeStamp (const QTime &elapsedTime)
 Inserts a timestamp at the current cursor position within a block. Updates the timestamp associated with the block and positions the cursor at the end.
 
void changeTranscriptLang ()
 Changes the language of the transcript. Prompts the user to enter a new language, then loads the relevant dictionary.
 
void speakerWiseJump (const QString &jumpDirection)
 Navigates to the next or previous block by the same speaker. Searches for the closest block in the specified direction with the same speaker, then jumps to that block's timestamp if found.
 
void wordWiseJump (const QString &jumpDirection)
 Jumps to the next or previous word in the highlighted block. Adjusts position based on direction and ensures cursor remains within block limits.
 
void blockWiseJump (const QString &jumpDirection)
 Jumps to the next or previous block. Moves the cursor up or down to adjacent blocks and jumps to the appropriate timestamp.
 
void useTransliteration (bool value, const QString &langCode="en")
 Enables or disables transliteration for the editor. Sets the transliteration state and language code.
 
void useAutoSave (bool value)
 Enables or disables the auto-save feature for the editor.
 
void suggest (QString suggest)
 Provides word suggestions and replaces the selected word. Highlights the current word under the cursor and replaces it with the suggested text.
 
void realTimeDataSavingToggle ()
 Toggles real-time data saving on or off. Enables or disables the data-saving feature in real-time.
 
void saveAsPDF ()
 Exports the transcript as a PDF file.
 
void saveAsTXT ()
 Exports the transcript as a text file.
 
void updateTimeStamp (int block_num, QTime endTime)
 Updates the current block's timestamp with a new value.
 
void updateTimeStampsBlock (QVector< int > blks)
 Updates timestamps for a range of blocks based on a provided vector of seconds.
 
- Public Slots inherited from TextEditor
void findReplace ()
 

Signals

void jumpToPlayer (const QTime &time)
 Signal emitted to jump to a specific time in the MediaPlayer.
 
void refreshTagList (const QStringList &tagList)
 Signal emitted to refresh the tag list display in the UI.
 
void replyCame ()
 Signal emitted when a reply is received from an external source.
 
void openMessage (const QString &text)
 Signal emitted to open a message box or display a message in the UI.
 
void sendBlockTime (QVector< QTime > timeArray)
 Signal emitted to send a vector of block timestamps for display in the AudioWaveForm.
 
void sendBlockText (QString blockText)
 Signal emitted to send the text content of a specific block.
 
- Signals inherited from TextEditor
void message (const QString &text, int timeout=5000)
 
void openMessage (const QString &text)
 

Public Member Functions

 Editor (QWidget *parent=nullptr)
 Constructs an Editor instance.
 
void setWordEditor (WordEditor *wordEditor)
 Sets the word editor for the current Editor instance.
 
void setEditorFont (const QFont &font)
 Sets the font for the editor.
 
void setMoveAlongTimeStamps ()
 Configures the editor to move along timestamps.
 
void setShowTimeStamp ()
 Toggles the visibility of timestamps in the editor.
 
void loadTranscriptData (QFile &file)
 Loads transcript data from a given file.
 
void setContent ()
 Sets the content of the editor.
 
bool timestampVisibility ()
 Checks the visibility status of timestamps.
 
QList< QTime > getTimeStamps ()
 Retrieves timestamps from the blocks.
 
void loadTranscriptFromUrl (QUrl *fileUrl)
 Loads transcript data from a given URL.
 
void showWaveform ()
 Shows the waveform based on the current blocks.
 
- Public Member Functions inherited from TextEditor
 TextEditor (QWidget *parent=nullptr)
 
void lineNumberAreaPaintEvent (QPaintEvent *event)
 
int lineNumberAreaWidth ()
 
void setLineNumberAreaFont (const QFont &font)
 

Public Attributes

QRegularExpression timeStampExp
 Regular expression for timestamps.
 
QRegularExpression speakerExp
 Regular expression for speaker identification.
 
QVector< blockm_blocks
 Stores the blocks of text and their associated data.
 
QUrl m_transcriptUrl
 URL of the loaded transcript.
 
bool showTimeStamp =false
 Flag indicating whether to show timestamps.
 

Protected Member Functions

void mousePressEvent (QMouseEvent *e) override
 Handles mouse press events, enabling specific behavior with Ctrl key.
 
void keyPressEvent (QKeyEvent *event) override
 Handles key press events and provides custom shortcuts and suggestions.
 
void contextMenuEvent (QContextMenuEvent *event) override
 Creates and displays a customized context menu with additional options.
 
- Protected Member Functions inherited from TextEditor
void resizeEvent (QResizeEvent *event) override
 
void keyPressEvent (QKeyEvent *event) override
 

Private Slots

void contentChanged (int position, int charsRemoved, int charsAdded)
 
void wordEditorChanged ()
 
void updateWordEditor ()
 Updates the word editor with the current block's words.
 
void changeSpeaker (const QString &newSpeaker, bool replaceAllOccurrences)
 Changes the speaker's name in the transcript.
 
void propagateTime (const QTime &time, int start, int end, bool negateTime)
 Propagates a specified time adjustment to a range of blocks.
 
void selectTags (const QStringList &newTagList)
 Selects tags for the current block.
 
void markWordAsCorrect (int blockNumber, int wordNumber)
 Marks a word as correct and updates the dictionary.
 
void insertSpeakerCompletion (const QString &completion)
 Inserts speaker name completion into the editor.
 
void insertTextCompletion (const QString &completion)
 Inserts text completion into the editor.
 
void insertTransliterationCompletion (const QString &completion)
 Inserts transliteration completion into the editor.
 
void handleReply ()
 Processes the response received from a network reply and extracts tokens.
 
void sendRequest (const QString &input, const QString &langCode)
 Sends a request to an external service for text completion.
 

Private Member Functions

QCompleter * makeCompleter ()
 Creates and configures a QCompleter for use in the editor.
 
void saveXml (QFile *file)
 Saves the current transcript data to an XML file.
 
void helpJumpToPlayer ()
 Sends the current text block to the MediaPlayer, allowing a jump to the relevant timestamp with MediaPlayer::setPositionToTime.
 
void loadDictionary ()
 Loads a dictionary for the editor to use for word suggestions and spell-checking.
 
block fromEditor (qint64 blockNumber) const
 Converts a block number into a block structure containing the timestamp, text, speaker, and a list of words.
 

Static Private Member Functions

static QTime getTime (const QString &text)
 Parses a time string and converts it into a QTime object.
 
static word makeWord (const QTime &t, const QString &s, const QStringList &tagList, const QString &isEdited)
 Creates a word object with the given attributes.
 
static QStringList listFromFile (const QString &fileName)
 Loads transcript data from an XML file into the editor.
 

Private Attributes

bool settingContent {false}
 Indicates if the editor is currently in a setting content mode.
 
bool updatingWordEditor {false}
 Indicates if the word editor is being updated.
 
bool dontUpdateWordEditor {false}
 Flag to prevent updates to the word editor.
 
bool m_transliterate {false}
 Indicates if transliteration is enabled.
 
bool m_autoSave {false}
 Indicates if auto-save functionality is enabled.
 
QString m_transcriptLang
 Language of the transcript.
 
QString m_punctuation {",.!;:?"}
 Default punctuation characters used in the editor.
 
QSettings * settings
 Pointer to application settings.
 
Highlighterm_highlighter = nullptr
 Pointer to the syntax highlighter.
 
qint64 highlightedBlock = -1
 Index of the currently highlighted block in the editor.
 
qint64 highlightedWord = -1
 Index of the currently highlighted word in the editor.
 
WordEditorm_wordEditor = nullptr
 Pointer to the word editor instance.
 
ChangeSpeakerDialogm_changeSpeaker = nullptr
 Dialog for changing speakers.
 
TimePropagationDialogm_propagateTime = nullptr
 Dialog for propagating time changes.
 
TagSelectionDialogm_selectTag = nullptr
 Dialog for selecting tags.
 
QCompleter * m_speakerCompleter = nullptr
 Completer for speaker names.
 
QCompleter * m_textCompleter = nullptr
 Completer for text suggestions.
 
QCompleter * m_transliterationCompleter = nullptr
 Completer for transliteration suggestions.
 
QStringList m_dictionary
 List of user-defined dictionary entries.
 
QStringList m_english_dictionary
 List of English dictionary entries.
 
QString m_customDictonaryPath = nullptr
 Path to the custom dictionary file.
 
std::set< QString > m_correctedWords
 Set of words that have been corrected.
 
QString m_transliterateLangCode
 Language code for transliteration.
 
QStringList m_lastReplyList
 List of the last replies from network requests.
 
QNetworkAccessManager m_manager
 Network manager for handling requests.
 
QNetworkReply * m_reply = nullptr
 Pointer to the current network reply.
 
QTimer * m_saveTimer = nullptr
 Timer for managing save intervals.
 
int m_saveInterval {20}
 Interval in seconds for auto-saving documents.
 
QStringList clipboardTexts
 List of text items in the clipboard.
 
QString fileBeforeSave = "initial.txt"
 File path for the initial state before saving.
 
QString fileAfterSave = "final.txt"
 File path for the final state after saving.
 
QString ComparedOutputFile = "ComparedDictonary.json"
 File path for compared dictionary output.
 
bool realTimeDataSaver = false
 Flag to indicate if real-time data saving is enabled.
 
QStringList allClips
 List of all clipboard contents.
 
int lastHighlightedBlock = -1
 Index of the last highlighted block.
 
bool moveAlongTimeStamps = true
 Flag to determine if the editor should move along timestamps.
 
QStringList supportedFormats
 List of supported file formats.
 

Friends

class Highlighter
 Grants Highlighter access to private members.
 

Detailed Description

Manages the editing functionalities of transcripts, including time stamps, speaker changes, and file exports.

Constructor & Destructor Documentation

◆ Editor()

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

Constructs an Editor instance.

Parameters
parentThe parent widget.

Member Function Documentation

◆ addCustomDictonary

void Editor::addCustomDictonary ( )
slot

Opens a file dialog to add a custom dictionary.

Opens a dialog to select a custom dictionary file (in .txt format). Sets the path and loads the dictionary if the file is successfully opened.

◆ blockWiseJump

void Editor::blockWiseJump ( const QString & jumpDirection)
slot

Jumps to the next or previous block. Moves the cursor up or down to adjacent blocks and jumps to the appropriate timestamp.

Parameters
jumpDirectionDirection to jump ("up" or "down").

◆ changeSpeaker

void Editor::changeSpeaker ( const QString & newSpeaker,
bool replaceAllOccurrences )
privateslot

Changes the speaker's name in the transcript.

This function updates the speaker's name for the current block or replaces all occurrences of the old speaker name with the new one, based on the specified flag.

Parameters
newSpeakerThe new speaker's name.
replaceAllOccurrencesFlag indicating whether to replace all occurrences or just the current block.

◆ changeTranscriptLang

void Editor::changeTranscriptLang ( )
slot

Changes the language of the transcript. Prompts the user to enter a new language, then loads the relevant dictionary.

◆ contentChanged

void Editor::contentChanged ( int position,
int charsRemoved,
int charsAdded )
privateslot

◆ contextMenuEvent()

void Editor::contextMenuEvent ( QContextMenuEvent * event)
overrideprotected

Creates and displays a customized context menu with additional options.

Enhances the default context menu with:

  • "Mark As Correct" action: Marks the current word as correct if it’s under the cursor.
  • Suggestions sub-menu: Reads from a JSON file (replacedTextDictionary.json) to offer word replacements based on the selected word's content.
  • Clipboard sub-menu: Displays a list of clipboard items stored in allClips for easy reuse.
Parameters
eventPointer to the QContextMenuEvent containing details of the context menu event.

◆ createChangeSpeakerDialog

void Editor::createChangeSpeakerDialog ( )
slot

Opens a dialog to select a new speaker for the highlighted block. Displays a modal dialog with a list of existing speakers. Updates the selected speaker in the block upon confirmation.

◆ createTagSelectionDialog

void Editor::createTagSelectionDialog ( )
slot

Opens a dialog for selecting and marking tags in the current block. Allows users to add tags to a block, showing existing tags initially.

◆ createTimePropagationDialog

void Editor::createTimePropagationDialog ( )
slot

Opens a dialog for propagating time across a range of blocks. Sets up a dialog allowing users to select a time range and optionally negate it. On confirmation, the specified time is propagated to the selected block range.

◆ fromEditor()

block Editor::fromEditor ( qint64 blockNumber) const
private

Converts a block number into a block structure containing the timestamp, text, speaker, and a list of words.

This method processes the block text to extract a timestamp, speaker, and the corresponding text. It uses regular expressions to match the timestamp and speaker formats, and splits the text accordingly. The extracted words are stored in a QVector of word structures.

Parameters
blockNumberThe block number to convert into a block structure.
Returns
block A block structure containing the extracted data.

◆ getTime()

QTime Editor::getTime ( const QString & text)
staticprivate

Parses a time string and converts it into a QTime object.

The function checks the format of the provided time string text to determine whether it includes fractional seconds ('.') and whether it has hours included (based on the number of colons). Based on these characteristics, it applies the appropriate format for parsing.

Parameters
textA QString containing the time string to be converted.
Returns
A QTime object representing the parsed time, or an invalid QTime if parsing fails.

◆ getTimeStamps()

QList< QTime > Editor::getTimeStamps ( )

Retrieves timestamps from the blocks.

This function collects and returns a list of timestamps from all the blocks in the editor.

Returns
QList<QTime> A list of timestamps from the blocks.

◆ handleReply

void Editor::handleReply ( )
privateslot

Processes the response received from a network reply and extracts tokens.

Reads the data from m_reply, parses the response string to extract meaningful tokens, and stores them in m_lastReplyList. The function expects the response to follow a specific format: it splits on a predefined delimiter pattern ([\"</tt>) to access the content, extracts the token list, and removes extraneous characters. @note If the response format does not meet the expected structure (less than four sections when split by <tt>"[""), the function will exit early.

◆ helpJumpToPlayer()

void Editor::helpJumpToPlayer ( )
private

Sends the current text block to the MediaPlayer, allowing a jump to the relevant timestamp with MediaPlayer::setPositionToTime.

This function emits the text of the current block to the player and calculates the appropriate timestamp to jump to, based on the cursor’s position within the block. If the timestamp of the exact word under the cursor is valid, it is used; otherwise, the function defaults to the nearest preceding valid timestamp.

◆ highlightTranscript

void Editor::highlightTranscript ( const QTime & elapsedTime)
slot

Highlights a transcript block and word based on the provided elapsed time.

Finds the block and word that match the provided elapsed time and highlights them in the transcript view. Sends the block text as a signal and updates the highlighter to display the highlighted block and word.

Parameters
elapsedTimeThe time used to find and highlight the appropriate block and word.

◆ insertSpeakerCompletion

void Editor::insertSpeakerCompletion ( const QString & completion)
privateslot

Inserts speaker name completion into the editor.

This function inserts the selected speaker name completion at the current cursor position.

Parameters
completionThe completed speaker name to insert.

◆ insertTextCompletion

void Editor::insertTextCompletion ( const QString & completion)
privateslot

Inserts text completion into the editor.

This function inserts the selected text completion at the current cursor position.

Parameters
completionThe completed text to insert.

◆ insertTimeStamp

void Editor::insertTimeStamp ( const QTime & elapsedTime)
slot

Inserts a timestamp at the current cursor position within a block. Updates the timestamp associated with the block and positions the cursor at the end.

Parameters
elapsedTimeThe timestamp to set for the block.

◆ insertTransliterationCompletion

void Editor::insertTransliterationCompletion ( const QString & completion)
privateslot

Inserts transliteration completion into the editor.

This function inserts the selected transliteration at the current cursor position.

Parameters
completionThe completed transliteration to insert.

◆ jumpToHighlightedLine

void Editor::jumpToHighlightedLine ( )
slot

Moves the cursor to the highlighted line in the editor. If no block is highlighted, the function returns immediately.

◆ jumpToPlayer

void Editor::jumpToPlayer ( const QTime & time)
signal

Signal emitted to jump to a specific time in the MediaPlayer.

Parameters
timeThe QTime object representing the time to jump to in the MediaPlayer::setPositionToTime.

◆ keyPressEvent()

void Editor::keyPressEvent ( QKeyEvent * event)
overrideprotected

Handles key press events and provides custom shortcuts and suggestions.

Intercepts keyboard input, performing specific actions for various Ctrl + Key shortcuts.

  • Ctrl+R: Opens the Change Speaker dialog.
  • Ctrl+T: Opens the Time Propagation dialog.
  • Ctrl+M: Marks a word as correct if conditions are met.
  • Ctrl+I: Centers and focuses on the cursor for doubtful words.

Additionally, the method integrates multiple completers (text, speaker, and transliteration) to assist with typing. Uses JSON to retrieve and suggest replacements, populating a popup menu if suggestions are available.

Parameters
eventPointer to the QKeyEvent containing details of the key press event.

◆ listFromFile()

QStringList Editor::listFromFile ( const QString & fileName)
staticprivate

Loads transcript data from an XML file into the editor.

This method reads an XML file containing transcript data, extracts the language, and populates the internal block structure with information about each line of the transcript. It handles timestamps, speakers, and individual words along with their properties.

Parameters
fileA reference to the QFile object from which the transcript data is loaded.
Note
This method will raise an error if the file structure is incorrect.

◆ loadDictionary()

void Editor::loadDictionary ( )
private

Loads a dictionary for the editor to use for word suggestions and spell-checking.

This function checks if a language-specific dictionary file exists locally. If found, it reads the dictionary and any custom words into m_dictionary. If corrected words exist in a saved file, it includes them for spell-checking in the editor.

◆ loadTranscriptData()

void Editor::loadTranscriptData ( QFile & file)

Loads transcript data from a given file.

Parameters
fileReference to the QFile containing the transcript data.

◆ loadTranscriptFromUrl()

void Editor::loadTranscriptFromUrl ( QUrl * fileUrl)

Loads transcript data from a given URL.

Parameters
fileUrlPointer to the QUrl containing the transcript URL.

◆ makeCompleter()

QCompleter * Editor::makeCompleter ( )
private

Creates and configures a QCompleter for use in the editor.

This function initializes a QCompleter with case-insensitive, non-wrapping, popup-style completion, sets its widget to the current editor, and returns it.

Returns
A pointer to the configured QCompleter.

◆ makeWord()

word Editor::makeWord ( const QTime & t,
const QString & s,
const QStringList & tagList,
const QString & isEdited )
staticprivate

Creates a word object with the given attributes.

This function initializes and returns a word struct populated with the provided time, string content, list of tags, and edit status.

Parameters
tThe QTime representing the timestamp of the word.
sThe QString representing the content of the word.
tagListA QStringList containing any tags associated with the word.
isEditedA QString indicating the edit status of the word.
Returns
A word struct initialized with the provided parameters.

◆ markWordAsCorrect

void Editor::markWordAsCorrect ( int blockNumber,
int wordNumber )
privateslot

Marks a word as correct and updates the dictionary.

This function adds the specified word to the dictionary if it is not already present and updates the highlighting for invalid words.

Parameters
blockNumberThe index of the block containing the word (0-indexed).
wordNumberThe index of the word to mark as correct (0-indexed).

◆ mergeDown

void Editor::mergeDown ( )
slot

Merges the current block with the next block, transferring word list and text. Only merges if the speakers match for both blocks.

◆ mergeUp

void Editor::mergeUp ( )
slot

Merges the current block with the previous one, combining text and word lists. Only merges if the speaker of the current and previous block match.

◆ mousePressEvent()

void Editor::mousePressEvent ( QMouseEvent * e)
overrideprotected

Handles mouse press events, enabling specific behavior with Ctrl key.

Overrides the default QPlainTextEdit mouse press event to provide custom behavior. If the Ctrl key is held down and there are blocks in m_blocks, the method invokes helpJumpToPlayer().

Parameters
ePointer to the QMouseEvent containing details of the mouse press event.

◆ openMessage

void Editor::openMessage ( const QString & text)
signal

Signal emitted to open a message box or display a message in the UI.

Parameters
textThe text message to display.

◆ propagateTime

void Editor::propagateTime ( const QTime & time,
int start,
int end,
bool negateTime )
privateslot

Propagates a specified time adjustment to a range of blocks.

This function adjusts the timestamps of the selected blocks based on the specified time, either adding or subtracting it.

Parameters
timeThe time to be added or subtracted from the blocks' timestamps.
startThe starting block number (1-indexed).
endThe ending block number (1-indexed).
negateTimeFlag indicating whether to negate the time (subtract).

◆ realTimeDataSavingToggle

void Editor::realTimeDataSavingToggle ( )
slot

Toggles real-time data saving on or off. Enables or disables the data-saving feature in real-time.

◆ refreshTagList

void Editor::refreshTagList ( const QStringList & tagList)
signal

Signal emitted to refresh the tag list display in the UI.

Parameters
tagListThe updated list of tags to display.

◆ replyCame

void Editor::replyCame ( )
signal

Signal emitted when a reply is received from an external source.

◆ saveAsPDF

void Editor::saveAsPDF ( )
slot

Exports the transcript as a PDF file.

This function gathers the content of the transcript and formats it into HTML before exporting it as a PDF. The user is prompted to select a save location.

◆ saveAsTXT

void Editor::saveAsTXT ( )
slot

Exports the transcript as a text file.

The function compiles the content of the transcript into a plain text format and allows the user to choose a save location.

◆ saveXml()

void Editor::saveXml ( QFile * file)
private

Saves the current transcript data to an XML file.

This function writes the contents of m_blocks to an XML file, with each block represented as a "line" element containing a timestamp, speaker, and a list of words. Words within each line are nested as "word" elements with associated timestamps, tags, and edit status.

Parameters
fileA pointer to the QFile where the XML content will be written.

◆ selectTags

void Editor::selectTags ( const QStringList & newTagList)
privateslot

Selects tags for the current block.

This function assigns a list of tags to the current block and refreshes the displayed tag list.

Parameters
newTagListThe list of tags to assign to the current block.

◆ sendBlockText

void Editor::sendBlockText ( QString blockText)
signal

Signal emitted to send the text content of a specific block.

Parameters
blockTextThe text content of the block to send.

◆ sendBlockTime

void Editor::sendBlockTime ( QVector< QTime > timeArray)
signal

Signal emitted to send a vector of block timestamps for display in the AudioWaveForm.

Parameters
timeArrayA QVector of QTime objects representing the timestamps of each block.

◆ sendRequest

void Editor::sendRequest ( const QString & input,
const QString & langCode )
privateslot

Sends a request to an external service for text completion.

This function constructs and sends a network request to an external API based on the input text and language code.

Parameters
inputThe input text to send for completion suggestions.
langCodeThe language code indicating the language of the input text.

◆ setContent()

void Editor::setContent ( )

Sets the content of the editor.

◆ setEditorFont()

void Editor::setEditorFont ( const QFont & font)

Sets the font for the editor.

Parameters
fontThe font to be set for the editor.

◆ setMoveAlongTimeStamps()

void Editor::setMoveAlongTimeStamps ( )

Configures the editor to move along timestamps.

◆ setShowTimeStamp()

void Editor::setShowTimeStamp ( )

Toggles the visibility of timestamps in the editor.

◆ setWordEditor()

void Editor::setWordEditor ( WordEditor * wordEditor)
inline

Sets the word editor for the current Editor instance.

This function connects the word editor's itemChanged signal to the Editor's wordEditorChanged slot.

Parameters
wordEditorPointer to the WordEditor instance.

◆ showBlocksFromData

void Editor::showBlocksFromData ( )
slot

Displays all blocks and their content in the QDebug (Saved in Logfile). Iterates through each block and prints its timestamp, speaker, text, and associated tags, followed by printing word details within each block.

◆ showWaveform()

void Editor::showWaveform ( )

Shows the waveform based on the current blocks.

This function emits a signal with the timestamps of the blocks to display the waveform associated with the transcript.

◆ speakerWiseJump

void Editor::speakerWiseJump ( const QString & jumpDirection)
slot

Navigates to the next or previous block by the same speaker. Searches for the closest block in the specified direction with the same speaker, then jumps to that block's timestamp if found.

Parameters
jumpDirectionDirection to jump ("up" or "down").

◆ splitLine

void Editor::splitLine ( const QTime & elapsedTime)
slot

Splits the current text line at the cursor's position. Divides the block into two based on cursor position, creating a new block and adjusting the timestamp and word list of each. Updates the editor content accordingly.

Parameters
elapsedTimeThe time to associate with the split point.

◆ suggest

void Editor::suggest ( QString suggest)
slot

Provides word suggestions and replaces the selected word. Highlights the current word under the cursor and replaces it with the suggested text.

Parameters
suggestThe suggested replacement text.

◆ timestampVisibility()

bool Editor::timestampVisibility ( )

Checks the visibility status of timestamps.

Returns
True if timestamps are visible, otherwise false.

◆ transcriptClose

void Editor::transcriptClose ( )
slot

Closes the current transcript file.

Clears the transcript URL, removes loaded blocks, sets the transcript language to English, and reloads the dictionary to clear the document.

◆ transcriptOpen

void Editor::transcriptOpen ( )
slot

Opens a transcript file, allowing the user to select a file from the file dialog.

Displays a file dialog to choose a transcript file and sets the directory based on user settings. Loads the transcript from the selected URL.

◆ transcriptSave

void Editor::transcriptSave ( )
slot

Saves the current transcript.

If the transcript URL is empty, calls transcriptSaveAs() to save the file. Otherwise, opens the existing file and saves the XML content. Also creates necessary resources if they don't already exist.

◆ transcriptSaveAs

void Editor::transcriptSaveAs ( )
slot

Saves the current transcript with a new file name.

Opens a file dialog to select a save location and file name, then saves the transcript as XML. Ensures that the file has an .xml extension and updates the transcript URL.

◆ updateTimeStamp

void Editor::updateTimeStamp ( int block_num,
QTime endTime )
slot

Updates the current block's timestamp with a new value.

This function sets the timestamp of the specified block to the given end time.

Parameters
block_numThe index of the block to update (0-indexed).
endTimeThe new timestamp to set for the block.

◆ updateTimeStampsBlock

void Editor::updateTimeStampsBlock ( QVector< int > blks)
slot

Updates timestamps for a range of blocks based on a provided vector of seconds.

This function sets the timestamps of the blocks based on the provided vector. New blocks are added if the vector exceeds the current number of blocks.

Parameters
blksA QVector of integers representing the timestamps in seconds.

◆ updateWordEditor

void Editor::updateWordEditor ( )
privateslot

Updates the word editor with the current block's words.

This function refreshes the word editor display based on the current block of text being edited.

◆ useAutoSave

void Editor::useAutoSave ( bool value)
inlineslot

Enables or disables the auto-save feature for the editor.

Sets the m_autoSave member variable to the specified value, enabling or disabling the auto-save functionality based on the value parameter.

Parameters
valueBoolean value to enable (true) or disable (false) auto-save.

◆ useTransliteration

void Editor::useTransliteration ( bool value,
const QString & langCode = "en" )
slot

Enables or disables transliteration for the editor. Sets the transliteration state and language code.

Parameters
valueTrue to enable transliteration, false to disable.
langCodeThe language code to use for transliteration.

◆ wordEditorChanged

void Editor::wordEditorChanged ( )
privateslot

◆ wordWiseJump

void Editor::wordWiseJump ( const QString & jumpDirection)
slot

Jumps to the next or previous word in the highlighted block. Adjusts position based on direction and ensures cursor remains within block limits.

Parameters
jumpDirectionDirection to jump ("left" or "right").

Friends And Related Symbol Documentation

◆ Highlighter

friend class Highlighter
friend

Grants Highlighter access to private members.

Member Data Documentation

◆ allClips

QStringList Editor::allClips
private

List of all clipboard contents.

◆ clipboardTexts

QStringList Editor::clipboardTexts
private

List of text items in the clipboard.

◆ ComparedOutputFile

QString Editor::ComparedOutputFile = "ComparedDictonary.json"
private

File path for compared dictionary output.

◆ dontUpdateWordEditor

bool Editor::dontUpdateWordEditor {false}
private

Flag to prevent updates to the word editor.

◆ fileAfterSave

QString Editor::fileAfterSave = "final.txt"
private

File path for the final state after saving.

◆ fileBeforeSave

QString Editor::fileBeforeSave = "initial.txt"
private

File path for the initial state before saving.

◆ highlightedBlock

qint64 Editor::highlightedBlock = -1
private

Index of the currently highlighted block in the editor.

◆ highlightedWord

qint64 Editor::highlightedWord = -1
private

Index of the currently highlighted word in the editor.

◆ lastHighlightedBlock

int Editor::lastHighlightedBlock = -1
private

Index of the last highlighted block.

◆ m_autoSave

bool Editor::m_autoSave {false}
private

Indicates if auto-save functionality is enabled.

◆ m_blocks

QVector<block> Editor::m_blocks

Stores the blocks of text and their associated data.

◆ m_changeSpeaker

ChangeSpeakerDialog* Editor::m_changeSpeaker = nullptr
private

Dialog for changing speakers.

◆ m_correctedWords

std::set<QString> Editor::m_correctedWords
private

Set of words that have been corrected.

◆ m_customDictonaryPath

QString Editor::m_customDictonaryPath = nullptr
private

Path to the custom dictionary file.

◆ m_dictionary

QStringList Editor::m_dictionary
private

List of user-defined dictionary entries.

◆ m_english_dictionary

QStringList Editor::m_english_dictionary
private

List of English dictionary entries.

◆ m_highlighter

Highlighter* Editor::m_highlighter = nullptr
private

Pointer to the syntax highlighter.

◆ m_lastReplyList

QStringList Editor::m_lastReplyList
private

List of the last replies from network requests.

◆ m_manager

QNetworkAccessManager Editor::m_manager
private

Network manager for handling requests.

◆ m_propagateTime

TimePropagationDialog* Editor::m_propagateTime = nullptr
private

Dialog for propagating time changes.

◆ m_punctuation

QString Editor::m_punctuation {",.!;:?"}
private

Default punctuation characters used in the editor.

◆ m_reply

QNetworkReply* Editor::m_reply = nullptr
private

Pointer to the current network reply.

◆ m_saveInterval

int Editor::m_saveInterval {20}
private

Interval in seconds for auto-saving documents.

◆ m_saveTimer

QTimer* Editor::m_saveTimer = nullptr
private

Timer for managing save intervals.

◆ m_selectTag

TagSelectionDialog* Editor::m_selectTag = nullptr
private

Dialog for selecting tags.

◆ m_speakerCompleter

QCompleter* Editor::m_speakerCompleter = nullptr
private

Completer for speaker names.

◆ m_textCompleter

QCompleter* Editor::m_textCompleter = nullptr
private

Completer for text suggestions.

◆ m_transcriptLang

QString Editor::m_transcriptLang
private

Language of the transcript.

◆ m_transcriptUrl

QUrl Editor::m_transcriptUrl

URL of the loaded transcript.

◆ m_transliterate

bool Editor::m_transliterate {false}
private

Indicates if transliteration is enabled.

◆ m_transliterateLangCode

QString Editor::m_transliterateLangCode
private

Language code for transliteration.

◆ m_transliterationCompleter

QCompleter* Editor::m_transliterationCompleter = nullptr
private

Completer for transliteration suggestions.

◆ m_wordEditor

WordEditor* Editor::m_wordEditor = nullptr
private

Pointer to the word editor instance.

◆ moveAlongTimeStamps

bool Editor::moveAlongTimeStamps = true
private

Flag to determine if the editor should move along timestamps.

◆ realTimeDataSaver

bool Editor::realTimeDataSaver = false
private

Flag to indicate if real-time data saving is enabled.

◆ settingContent

bool Editor::settingContent {false}
private

Indicates if the editor is currently in a setting content mode.

◆ settings

QSettings* Editor::settings
private

Pointer to application settings.

◆ showTimeStamp

bool Editor::showTimeStamp =false

Flag indicating whether to show timestamps.

◆ speakerExp

QRegularExpression Editor::speakerExp

Regular expression for speaker identification.

◆ supportedFormats

QStringList Editor::supportedFormats
private

List of supported file formats.

◆ timeStampExp

QRegularExpression Editor::timeStampExp

Regular expression for timestamps.

◆ updatingWordEditor

bool Editor::updatingWordEditor {false}
private

Indicates if the word editor is being updated.


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