10#include <QXmlStreamReader>
11#include <QRegularExpression>
12#include <QSyntaxHighlighter>
13#include <QTextDocument>
15#include <QAbstractItemModel>
16#include <qcompleter.h>
18#include <QNetworkAccessManager>
19#include <QNetworkRequest>
20#include <QNetworkReply>
22#include <QUndoCommand>
42 explicit Editor(QWidget *parent =
nullptr);
289 void splitLine(
const QTime& elapsedTime);
430 void contentChanged(
int position,
int charsRemoved,
int charsAdded);
452 void changeSpeaker(
const QString& newSpeaker,
bool replaceAllOccurrences);
465 void propagateTime(
const QTime& time,
int start,
int end,
bool negateTime);
475 void selectTags(
const QStringList& newTagList);
541 void sendRequest(
const QString& input,
const QString& langCode);
555 static QTime
getTime(
const QString& text);
569 static word makeWord(
const QTime& t,
const QString& s,
const QStringList& tagList,
const QString& isEdited);
638 static QStringList
listFromFile(
const QString& fileName) ;
714 explicit Highlighter(QTextDocument *parent =
nullptr) : QSyntaxHighlighter(parent) {};
Definition changespeakerdialog.h:11
Manages the editing functionalities of transcripts, including time stamps, speaker changes,...
Definition editor.h:32
void loadDictionary()
Loads a dictionary for the editor to use for word suggestions and spell-checking.
Definition editor.cpp:1308
void mergeDown()
Merges the current block with the next block, transferring word list and text. Only merges if the spe...
Definition editor.cpp:2099
std::set< QString > m_correctedWords
Set of words that have been corrected.
Definition editor.h:676
ChangeSpeakerDialog * m_changeSpeaker
Dialog for changing speakers.
Definition editor.h:663
QCompleter * makeCompleter()
Creates and configures a QCompleter for use in the editor.
Definition editor.cpp:1021
qint64 highlightedWord
Index of the currently highlighted word in the editor.
Definition editor.h:659
Highlighter * m_highlighter
Pointer to the syntax highlighter.
Definition editor.h:655
QString fileBeforeSave
File path for the initial state before saving.
Definition editor.h:690
void jumpToHighlightedLine()
Moves the cursor to the highlighted line in the editor. If no block is highlighted,...
Definition editor.cpp:1932
bool realTimeDataSaver
Flag to indicate if real-time data saving is enabled.
Definition editor.h:695
void setShowTimeStamp()
Toggles the visibility of timestamps in the editor.
Definition editor.cpp:1427
void transcriptOpen()
Opens a transcript file, allowing the user to select a file from the file dialog.
Definition editor.cpp:760
void saveXml(QFile *file)
Saves the current transcript data to an XML file.
Definition editor.cpp:1218
void createChangeSpeakerDialog()
Opens a dialog to select a new speaker for the highlighted block. Displays a modal dialog with a list...
Definition editor.cpp:2130
void insertTimeStamp(const QTime &elapsedTime)
Inserts a timestamp at the current cursor position within a block. Updates the timestamp associated w...
Definition editor.cpp:2201
bool updatingWordEditor
Indicates if the word editor is being updated.
Definition editor.h:642
void propagateTime(const QTime &time, int start, int end, bool negateTime)
Propagates a specified time adjustment to a range of blocks.
Definition editor.cpp:2552
void saveAsPDF()
Exports the transcript as a PDF file.
Definition editor.cpp:2394
void useAutoSave(bool value)
Enables or disables the auto-save feature for the editor.
Definition editor.h:374
QStringList clipboardTexts
List of text items in the clipboard.
Definition editor.h:689
void setContent()
Sets the content of the editor.
Definition editor.cpp:1444
void selectTags(const QStringList &newTagList)
Selects tags for the current block.
Definition editor.cpp:2596
void jumpToPlayer(const QTime &time)
Signal emitted to jump to a specific time in the MediaPlayer.
qint64 highlightedBlock
Index of the currently highlighted block in the editor.
Definition editor.h:658
TagSelectionDialog * m_selectTag
Dialog for selecting tags.
Definition editor.h:665
void saveAsTXT()
Exports the transcript as a text file.
Definition editor.cpp:2447
void addCustomDictonary()
Opens a file dialog to add a custom dictionary.
Definition editor.cpp:988
QSettings * settings
Pointer to application settings.
Definition editor.h:654
bool settingContent
Indicates if the editor is currently in a setting content mode.
Definition editor.h:641
int lastHighlightedBlock
Index of the last highlighted block.
Definition editor.h:699
QStringList allClips
List of all clipboard contents.
Definition editor.h:696
void transcriptSave()
Saves the current transcript.
Definition editor.cpp:775
QString m_transcriptLang
Language of the transcript.
Definition editor.h:650
void loadTranscriptFromUrl(QUrl *fileUrl)
Loads transcript data from a given URL.
Definition editor.cpp:1032
void setWordEditor(WordEditor *wordEditor)
Sets the word editor for the current Editor instance.
Definition editor.h:52
void wordEditorChanged()
Definition editor.cpp:2492
void insertSpeakerCompletion(const QString &completion)
Inserts speaker name completion into the editor.
Definition editor.cpp:2674
void highlightTranscript(const QTime &elapsedTime)
Highlights a transcript block and word based on the provided elapsed time.
Definition editor.cpp:931
void mergeUp()
Merges the current block with the previous one, combining text and word lists. Only merges if the spe...
Definition editor.cpp:2069
bool dontUpdateWordEditor
Flag to prevent updates to the word editor.
Definition editor.h:643
QStringList m_lastReplyList
List of the last replies from network requests.
Definition editor.h:680
QCompleter * m_textCompleter
Completer for text suggestions.
Definition editor.h:669
bool timestampVisibility()
Checks the visibility status of timestamps.
Definition editor.cpp:1616
void helpJumpToPlayer()
Sends the current text block to the MediaPlayer, allowing a jump to the relevant timestamp with Media...
Definition editor.cpp:1267
void useTransliteration(bool value, const QString &langCode="en")
Enables or disables transliteration for the editor. Sets the transliteration state and language code.
Definition editor.cpp:2362
void handleReply()
Processes the response received from a network reply and extracts tokens.
Definition editor.cpp:2716
QString m_punctuation
Default punctuation characters used in the editor.
Definition editor.h:651
QRegularExpression timeStampExp
Regular expression for timestamps.
Definition editor.h:65
QCompleter * m_speakerCompleter
Completer for speaker names.
Definition editor.h:668
void createTagSelectionDialog()
Opens a dialog for selecting and marking tags in the current block. Allows users to add tags to a blo...
Definition editor.cpp:2180
void openMessage(const QString &text)
Signal emitted to open a message box or display a message in the UI.
void insertTextCompletion(const QString &completion)
Inserts text completion into the editor.
Definition editor.cpp:2690
void refreshTagList(const QStringList &tagList)
Signal emitted to refresh the tag list display in the UI.
QStringList m_english_dictionary
List of English dictionary entries.
Definition editor.h:674
void splitLine(const QTime &elapsedTime)
Splits the current text line at the cursor's position. Divides the block into two based on cursor pos...
Definition editor.cpp:1940
void setEditorFont(const QFont &font)
Sets the font for the editor.
Definition editor.cpp:87
QStringList m_dictionary
List of user-defined dictionary entries.
Definition editor.h:673
void showWaveform()
Shows the waveform based on the current blocks.
Definition editor.cpp:2823
void realTimeDataSavingToggle()
Toggles real-time data saving on or off. Enables or disables the data-saving feature in real-time.
Definition editor.cpp:2384
void updateTimeStampsBlock(QVector< int > blks)
Updates timestamps for a range of blocks based on a provided vector of seconds.
Definition editor.cpp:2793
QString m_transliterateLangCode
Language code for transliteration.
Definition editor.h:677
void insertTransliterationCompletion(const QString &completion)
Inserts transliteration completion into the editor.
Definition editor.cpp:2704
QStringList supportedFormats
List of supported file formats.
Definition editor.h:701
QString m_customDictonaryPath
Path to the custom dictionary file.
Definition editor.h:675
QNetworkAccessManager m_manager
Network manager for handling requests.
Definition editor.h:681
void markWordAsCorrect(int blockNumber, int wordNumber)
Marks a word as correct and updates the dictionary.
Definition editor.cpp:2608
void loadTranscriptData(QFile &file)
Loads transcript data from a given file.
Definition editor.cpp:1125
bool m_transliterate
Indicates if transliteration is enabled.
Definition editor.h:646
WordEditor * m_wordEditor
Pointer to the word editor instance.
Definition editor.h:662
QVector< block > m_blocks
Stores the blocks of text and their associated data.
Definition editor.h:79
void setMoveAlongTimeStamps()
Configures the editor to move along timestamps.
Definition editor.cpp:96
QNetworkReply * m_reply
Pointer to the current network reply.
Definition editor.h:682
bool moveAlongTimeStamps
Flag to determine if the editor should move along timestamps.
Definition editor.h:700
void transcriptClose()
Closes the current transcript file.
Definition editor.cpp:904
Editor(QWidget *parent=nullptr)
Constructs an Editor instance.
Definition editor.cpp:24
void sendRequest(const QString &input, const QString &langCode)
Sends a request to an external service for text completion.
Definition editor.cpp:2733
int m_saveInterval
Interval in seconds for auto-saving documents.
Definition editor.h:686
static word makeWord(const QTime &t, const QString &s, const QStringList &tagList, const QString &isEdited)
Creates a word object with the given attributes.
Definition editor.cpp:1015
QString fileAfterSave
File path for the final state after saving.
Definition editor.h:691
void createTimePropagationDialog()
Opens a dialog for propagating time across a range of blocks. Sets up a dialog allowing users to sele...
Definition editor.cpp:2156
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 ...
Definition editor.cpp:2329
QTimer * m_saveTimer
Timer for managing save intervals.
Definition editor.h:685
void sendBlockText(QString blockText)
Signal emitted to send the text content of a specific block.
bool showTimeStamp
Flag indicating whether to show timestamps.
Definition editor.h:81
void contextMenuEvent(QContextMenuEvent *event) override
Creates and displays a customized context menu with additional options.
Definition editor.cpp:649
static QStringList listFromFile(const QString &fileName)
Loads transcript data from an XML file into the editor.
Definition editor.cpp:1408
void updateWordEditor()
Updates the word editor with the current block's words.
Definition editor.cpp:2475
void mousePressEvent(QMouseEvent *e) override
Handles mouse press events, enabling specific behavior with Ctrl key.
Definition editor.cpp:393
void suggest(QString suggest)
Provides word suggestions and replaces the selected word. Highlights the current word under the curso...
Definition editor.cpp:2368
void changeTranscriptLang()
Changes the language of the transcript. Prompts the user to enter a new language, then loads the rele...
Definition editor.cpp:2223
void showBlocksFromData()
Displays all blocks and their content in the QDebug (Saved in Logfile). Iterates through each block a...
Definition editor.cpp:921
void changeSpeaker(const QString &newSpeaker, bool replaceAllOccurrences)
Changes the speaker's name in the transcript.
Definition editor.cpp:2525
void speakerWiseJump(const QString &jumpDirection)
Navigates to the next or previous block by the same speaker. Searches for the closest block in the sp...
Definition editor.cpp:2231
block fromEditor(qint64 blockNumber) const
Converts a block number into a block structure containing the timestamp, text, speaker,...
Definition editor.cpp:1083
void transcriptSaveAs()
Saves the current transcript with a new file name.
Definition editor.cpp:869
QString ComparedOutputFile
File path for compared dictionary output.
Definition editor.h:692
QUrl m_transcriptUrl
URL of the loaded transcript.
Definition editor.h:80
void updateTimeStamp(int block_num, QTime endTime)
Updates the current block's timestamp with a new value.
Definition editor.cpp:2774
void replyCame()
Signal emitted when a reply is received from an external source.
QRegularExpression speakerExp
Regular expression for speaker identification.
Definition editor.h:66
void sendBlockTime(QVector< QTime > timeArray)
Signal emitted to send a vector of block timestamps for display in the AudioWaveForm.
QCompleter * m_transliterationCompleter
Completer for transliteration suggestions.
Definition editor.h:670
QList< QTime > getTimeStamps()
Retrieves timestamps from the blocks.
Definition editor.cpp:2755
static QTime getTime(const QString &text)
Parses a time string and converts it into a QTime object.
Definition editor.cpp:1003
void contentChanged(int position, int charsRemoved, int charsAdded)
Definition editor.cpp:1621
TimePropagationDialog * m_propagateTime
Dialog for propagating time changes.
Definition editor.h:664
bool m_autoSave
Indicates if auto-save functionality is enabled.
Definition editor.h:647
void keyPressEvent(QKeyEvent *event) override
Handles key press events and provides custom shortcuts and suggestions.
Definition editor.cpp:400
void wordWiseJump(const QString &jumpDirection)
Jumps to the next or previous word in the highlighted block. Adjusts position based on direction and ...
Definition editor.cpp:2275
Highlighter(QTextDocument *parent=nullptr)
Definition editor.h:714
QList< int > taggedBlockNumbers
Definition editor.h:771
void setInvalidBlocks(const QList< int > &invalidBlocks)
Definition editor.h:731
QMultiMap< int, int > invalidWords
Definition editor.h:773
QList< int > invalidBlockNumbers
Definition editor.h:770
void setInvalidWords(const QMultiMap< int, int > &invalidWordsMap)
Definition editor.h:745
int blockToHighlight
Definition editor.h:768
void setWordToHighlight(int wordNumber)
Definition editor.h:726
void clearTaggedBlocks()
Definition editor.h:741
void setTaggedBlocks(const QList< int > &taggedBlock)
Definition editor.h:736
void setEditedWords(const QMultiMap< int, int > &editedWordsMap)
Definition editor.h:755
int wordToHighlight
Definition editor.h:769
void setBlockToHighlight(qint64 blockNumber)
Definition editor.h:721
void highlightBlock(const QString &) override
Definition editor.cpp:107
void clearInvalidBlocks()
Definition editor.h:759
void setTaggedWords(const QMultiMap< int, int > &taggedWordsMap)
Definition editor.h:750
QMultiMap< int, int > taggedWords
Definition editor.h:774
QMultiMap< int, int > editedWords
Definition editor.h:775
void clearHighlight()
Definition editor.h:716
Definition tagselectiondialog.h:10
Definition texteditor.h:10
Definition timepropagationdialog.h:12
Definition wordeditor.h:7
Definition blockandword.h:27
Definition blockandword.h:7