Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Johannes Zarl-Zierl
KPhotoAlbum
Commits
ab6c9036
Commit
ab6c9036
authored
Sep 26, 2020
by
Robert Krawitz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Performance improvements to ImageDate class
parent
13f5afaa
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
22 deletions
+15
-22
DB/ImageDate.cpp
DB/ImageDate.cpp
+13
-20
DB/ImageDate.h
DB/ImageDate.h
+2
-2
No files found.
DB/ImageDate.cpp
View file @
ab6c9036
...
...
@@ -24,10 +24,13 @@
using
namespace
DB
;
static
const
QTime
_startOfDay_
(
0
,
0
,
0
);
static
const
QTime
_endOfDay_
(
23
,
59
,
59
);
ImageDate
::
ImageDate
(
const
QDate
&
date
)
{
m_start
=
Utilities
::
FastDateTime
(
date
,
QTime
(
0
,
0
,
0
)
);
m_end
=
Utilities
::
FastDateTime
(
date
,
QTime
(
0
,
0
,
0
))
;
m_start
=
Utilities
::
FastDateTime
(
date
,
_startOfDay_
);
m_end
=
m_start
;
}
ImageDate
::
ImageDate
(
const
Utilities
::
FastDateTime
&
date
)
...
...
@@ -163,16 +166,6 @@ QString ImageDate::formatRegexp()
return
str
;
}
Utilities
::
FastDateTime
ImageDate
::
start
()
const
{
return
m_start
;
}
Utilities
::
FastDateTime
ImageDate
::
end
()
const
{
return
m_end
;
}
bool
ImageDate
::
operator
<
(
const
ImageDate
&
other
)
const
{
return
start
()
<
other
.
start
()
||
(
start
()
==
other
.
start
()
&&
end
()
<
other
.
end
());
...
...
@@ -192,11 +185,11 @@ ImageDate::ImageDate(const Utilities::FastDateTime &start, const Utilities::Fast
ImageDate
::
ImageDate
(
const
QDate
&
start
,
const
QDate
&
end
)
{
if
(
!
start
.
isValid
()
||
!
end
.
isValid
()
||
start
<=
end
)
{
m_start
=
Utilities
::
FastDateTime
(
start
,
QTime
(
0
,
0
,
0
)
);
m_end
=
Utilities
::
FastDateTime
(
end
,
QTime
(
23
,
59
,
59
)
);
m_start
=
Utilities
::
FastDateTime
(
start
,
_startOfDay_
);
m_end
=
Utilities
::
FastDateTime
(
end
,
_endOfDay_
);
}
else
{
m_start
=
Utilities
::
FastDateTime
(
end
,
QTime
(
0
,
0
,
0
)
);
m_end
=
Utilities
::
FastDateTime
(
start
,
QTime
(
23
,
59
,
59
)
);
m_start
=
Utilities
::
FastDateTime
(
end
,
_startOfDay_
);
m_end
=
Utilities
::
FastDateTime
(
start
,
_endOfDay_
);
}
}
...
...
@@ -349,11 +342,11 @@ ImageDate::ImageDate(const QDate &start, QDate end, const QTime &time)
m_end
=
m_start
;
}
else
{
if
(
start
>
end
)
{
m_end
=
Utilities
::
FastDateTime
(
start
,
QTime
(
0
,
0
,
0
)
);
m_start
=
Utilities
::
FastDateTime
(
end
,
QTime
(
23
,
59
,
59
)
);
m_end
=
Utilities
::
FastDateTime
(
start
,
_startOfDay_
);
m_start
=
Utilities
::
FastDateTime
(
end
,
_endOfDay_
);
}
else
{
m_start
=
Utilities
::
FastDateTime
(
start
,
QTime
(
0
,
0
,
0
)
);
m_end
=
Utilities
::
FastDateTime
(
end
,
QTime
(
23
,
59
,
59
)
);
m_start
=
Utilities
::
FastDateTime
(
start
,
_startOfDay_
);
m_end
=
Utilities
::
FastDateTime
(
end
,
_endOfDay_
);
}
}
}
...
...
DB/ImageDate.h
View file @
ab6c9036
...
...
@@ -36,8 +36,8 @@ public:
explicit
ImageDate
(
const
Utilities
::
FastDateTime
&
);
ImageDate
(
const
QDate
&
start
,
QDate
end
,
const
QTime
&
time
);
Utilities
::
FastDateTime
start
()
const
;
Utilities
::
FastDateTime
end
()
const
;
const
Utilities
::
FastDateTime
&
start
()
const
{
return
m_start
;
}
const
Utilities
::
FastDateTime
&
end
()
const
{
return
m_end
;
}
static
QDate
parseDate
(
const
QString
&
date
,
bool
startDate
);
bool
operator
<
(
const
ImageDate
&
other
)
const
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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