File indexing completed on 2024-05-12 04:57:16

0001 /*
0002     SPDX-FileCopyrightText: 2010-2022 Mladen Milinkovic <max@smoothware.net>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #include "config.h"
0008 
0009 #include "appglobal.h"
0010 #include "application.h"
0011 #include "core/subtitleiterator.h"
0012 #include "errors/finderrorsdialog.h"
0013 #include "errors/errorfinder.h"
0014 #include "gui/treeview/lineswidget.h"
0015 
0016 using namespace SubtitleComposer;
0017 
0018 void
0019 Application::selectNextError()
0020 {
0021     const int idx = m_mainWindow->m_linesWidget->currentLineIndex();
0022     if(!m_errorFinder->findNext(idx)) {
0023         m_lastFoundLine = nullptr;
0024         m_errorFinder->find(idx, false);
0025     }
0026 }
0027 
0028 void
0029 Application::selectPreviousError()
0030 {
0031     const int idx = m_mainWindow->m_linesWidget->currentLineIndex();
0032     if(!m_errorFinder->findPrevious(idx)) {
0033         m_lastFoundLine = nullptr;
0034         m_errorFinder->find(idx, true);
0035     }
0036 }
0037 
0038 void
0039 Application::detectErrors()
0040 {
0041     m_lastFoundLine = nullptr;
0042     m_errorFinder->find(m_mainWindow->m_linesWidget->currentLineIndex());
0043 }
0044 
0045 void
0046 Application::clearErrors()
0047 {
0048     appSubtitle()->clearErrors(RangeList(Range::full()), SubtitleLine::AllErrors);
0049 }
0050 
0051 void
0052 Application::toggleSelectedLinesMark()
0053 {
0054     appSubtitle()->toggleMarked(m_mainWindow->m_linesWidget->selectionRanges());
0055 }
0056