Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Multimedia
Kdenlive
Commits
50255f3c
Commit
50255f3c
authored
Aug 24, 2022
by
Julius Künzel
💬
Browse files
Use static QRegularExpression
parent
dbdff1d0
Changes
10
Hide whitespace changes
Inline
Side-by-side
src/bin/model/subtitlemodel.cpp
View file @
50255f3c
...
...
@@ -186,7 +186,7 @@ void SubtitleModel::importSubtitle(const QString &filePath, int offset, bool ext
#endif
QString
line
;
QStringList
srtTime
;
QRegularExpression
rx
(
"([0-9]{1,2}):([0-9]{2})"
);
static
const
QRegularExpression
rx
(
"([0-9]{1,2}):([0-9]{2})"
);
QLatin1Char
separator
=
filePath
.
endsWith
(
".sbv"
)
?
QLatin1Char
(
','
)
:
QLatin1Char
(
' '
);
while
(
stream
.
readLineInto
(
&
line
))
{
line
=
line
.
trimmed
();
...
...
src/dialogs/kdenlivesettingsdialog.cpp
View file @
50255f3c
...
...
@@ -217,7 +217,7 @@ void KdenliveSettingsDialog::initMiscPage()
m_configMisc
.
kcfg_use_exiftool
->
setEnabled
(
!
QStandardPaths
::
findExecutable
(
QStringLiteral
(
"exiftool"
)).
isEmpty
());
QRegularExpression
reg
(
R"((\+|-)?\d{2}:\d{2}:\d{2}(:||,)\d{2})"
);
static
const
QRegularExpression
reg
(
R"((\+|-)?\d{2}:\d{2}:\d{2}(:||,)\d{2})"
);
QValidator
*
validator
=
new
QRegularExpressionValidator
(
reg
,
this
);
m_configMisc
.
kcfg_color_duration
->
setInputMask
(
pCore
->
timecode
().
mask
());
m_configMisc
.
kcfg_color_duration
->
setValidator
(
validator
);
...
...
src/dialogs/renderwidget.cpp
View file @
50255f3c
...
...
@@ -864,7 +864,7 @@ void RenderWidget::generateRenderFiles(QDomDocument doc, int in, int out, QStrin
if
(
renderArgs
.
contains
(
"=stills/"
))
{
// Image sequence, ensure we have a %0xd at file end.
// Format string for counter
QRegularExpression
rx
(
QRegularExpression
::
anchoredPattern
(
QStringLiteral
(
".*%[0-9]*d.*"
)));
static
const
QRegularExpression
rx
(
QRegularExpression
::
anchoredPattern
(
QStringLiteral
(
".*%[0-9]*d.*"
)));
if
(
!
rx
.
match
(
outputFile
).
hasMatch
())
{
outputFile
=
outputFile
.
section
(
QLatin1Char
(
'.'
),
0
,
-
2
)
+
QStringLiteral
(
"_%05d."
)
+
extension
;
}
...
...
src/doc/documentvalidator.cpp
View file @
50255f3c
...
...
@@ -1924,8 +1924,8 @@ auto DocumentValidator::upgradeTo100(const QLocale &documentLocale) -> QString
qDebug
()
<<
"Decimal point is NOT OK and needs fixing. Converting to . from "
<<
decimalPoint
;
auto
fixTimecode
=
[
decimalPoint
](
QString
&
value
)
{
QRegularExpression
reTimecode
(
R"((\d+:\d+:\d+))"
+
QString
(
decimalPoint
)
+
"(
\\
d+)"
);
QRegularExpression
reValue
(
"(=
\\
d+)"
+
QString
(
decimalPoint
)
+
"(
\\
d+)"
);
static
const
QRegularExpression
reTimecode
(
R"((\d+:\d+:\d+))"
+
QString
(
decimalPoint
)
+
"(
\\
d+)"
);
static
const
QRegularExpression
reValue
(
"(=
\\
d+)"
+
QString
(
decimalPoint
)
+
"(
\\
d+)"
);
value
.
replace
(
reTimecode
,
"
\\
1.
\\
2"
).
replace
(
reValue
,
"
\\
1.
\\
2"
);
};
...
...
src/mainwindow.cpp
View file @
50255f3c
...
...
@@ -2390,7 +2390,7 @@ void MainWindow::slotPreferences(int page, int option)
// Get the mappable actions in localized form
QMap
<
QString
,
QString
>
actions
;
KActionCollection
*
collection
=
actionCollection
();
QRegularExpression
ampEx
(
"&{1,1}"
);
static
const
QRegularExpression
ampEx
(
"&{1,1}"
);
for
(
const
QString
&
action_name
:
qAsConst
(
m_actionNames
))
{
QString
action_text
=
collection
->
action
(
action_name
)
->
text
();
action_text
.
remove
(
ampEx
);
...
...
src/monitor/glwidget.cpp
View file @
50255f3c
...
...
@@ -821,9 +821,9 @@ void GLWidget::mousePressEvent(QMouseEvent *event)
}
}
else
if
((
event
->
button
()
&
Qt
::
RightButton
)
!=
0u
)
{
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
emit
showContextMenu
(
event
->
globalPos
());
emit
showContextMenu
(
event
->
globalPos
());
#else
emit
showContextMenu
(
event
->
globalPosition
().
toPoint
());
emit
showContextMenu
(
event
->
globalPosition
().
toPoint
());
#endif
}
else
if
((
event
->
button
()
&
Qt
::
MiddleButton
)
!=
0u
)
{
m_panStart
=
event
->
pos
();
...
...
src/project/dialogs/archivewidget.cpp
View file @
50255f3c
...
...
@@ -411,7 +411,7 @@ void ArchiveWidget::generateItems(QTreeWidgetItem *parentItem, const QStringList
QString
ext
=
filter
.
section
(
QLatin1Char
(
'.'
),
-
1
);
filter
=
filter
.
section
(
QLatin1Char
(
'%'
),
0
,
-
2
);
QString
regexp
=
QLatin1Char
(
'^'
)
+
filter
+
QStringLiteral
(
"
\\
d+
\\
."
)
+
ext
+
QLatin1Char
(
'$'
);
QRegularExpression
rx
(
QRegularExpression
::
anchoredPattern
(
regexp
));
static
const
QRegularExpression
rx
(
QRegularExpression
::
anchoredPattern
(
regexp
));
QStringList
slideImages
;
QString
directory
=
dir
.
absolutePath
();
if
(
!
directory
.
endsWith
(
QLatin1Char
(
'/'
)))
{
...
...
@@ -508,7 +508,7 @@ void ArchiveWidget::generateItems(QTreeWidgetItem *parentItem, const QMap<QStrin
QString
ext
=
filter
.
section
(
QLatin1Char
(
'.'
),
-
1
).
section
(
QLatin1Char
(
'?'
),
0
,
0
);
filter
=
filter
.
section
(
QLatin1Char
(
'%'
),
0
,
-
2
);
QString
regexp
=
QLatin1Char
(
'^'
)
+
filter
+
QStringLiteral
(
"
\\
d+
\\
."
)
+
ext
+
QLatin1Char
(
'$'
);
QRegularExpression
rx
(
QRegularExpression
::
anchoredPattern
(
regexp
));
static
const
QRegularExpression
rx
(
QRegularExpression
::
anchoredPattern
(
regexp
));
QStringList
slideImages
;
qint64
totalSize
=
0
;
for
(
const
QString
&
path
:
qAsConst
(
result
))
{
...
...
src/project/dialogs/projectsettings.cpp
View file @
50255f3c
...
...
@@ -749,7 +749,7 @@ QStringList ProjectSettings::extractSlideshowUrls(const QString &url)
QString
ext
=
filter
.
section
(
QLatin1Char
(
'.'
),
-
1
);
filter
=
filter
.
section
(
QLatin1Char
(
'%'
),
0
,
-
2
);
QString
regexp
=
QLatin1Char
(
'^'
)
+
filter
+
QStringLiteral
(
"
\\
d+
\\
."
)
+
ext
+
QLatin1Char
(
'$'
);
QRegularExpression
rx
(
QRegularExpression
::
anchoredPattern
(
regexp
));
static
const
QRegularExpression
rx
(
QRegularExpression
::
anchoredPattern
(
regexp
));
int
count
=
0
;
const
QStringList
result
=
dir
.
entryList
(
QDir
::
Files
);
for
(
const
QString
&
p
:
result
)
{
...
...
src/project/dialogs/slideshowclip.cpp
View file @
50255f3c
...
...
@@ -292,7 +292,7 @@ void SlideshowClip::parseFolder()
}
// qCDebug(KDENLIVE_LOG) << " / /" << path_pattern << " / " << ext << " / " << filter;
QString
regexp
=
QLatin1Char
(
'^'
)
+
filter
+
QStringLiteral
(
"
\\
d+
\\
."
)
+
ext
+
QLatin1Char
(
'$'
);
QRegularExpression
rx
(
QRegularExpression
::
anchoredPattern
(
regexp
));
static
const
QRegularExpression
rx
(
QRegularExpression
::
anchoredPattern
(
regexp
));
QStringList
entries
;
for
(
const
QString
&
p
:
qAsConst
(
result
))
{
if
(
rx
.
match
(
p
).
hasMatch
())
{
...
...
src/titler/unicodedialog.cpp
View file @
50255f3c
...
...
@@ -64,7 +64,7 @@ UnicodeWidget::UnicodeWidget(UnicodeDialog::InputMethod inputMeth, QWidget *pare
if
(
m_inputMethod
==
UnicodeDialog
::
InputHex
)
{
unicodeNumber
->
setMaxLength
(
MAX_LENGTH_HEX
);
QRegularExpression
rx
(
"([0-9]|[a-f])*"
,
QRegularExpression
::
CaseInsensitiveOption
);
static
const
QRegularExpression
rx
(
"([0-9]|[a-f])*"
,
QRegularExpression
::
CaseInsensitiveOption
);
QValidator
*
validator
=
new
QRegularExpressionValidator
(
rx
,
this
);
unicodeNumber
->
setValidator
(
validator
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment