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
Graphics
Gwenview
Commits
6f62de55
Commit
6f62de55
authored
Feb 09, 2022
by
Laurent Montel
Browse files
Const'ify more variables
parent
9c7de15f
Pipeline
#135254
failed with stage
in 1 minute and 55 seconds
Changes
14
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
lib/decoratedtag/decoratedtag.cpp
View file @
6f62de55
...
...
@@ -65,12 +65,12 @@ void DecoratedTag::paintEvent(QPaintEvent *event)
Q_D
(
const
DecoratedTag
);
QStylePainter
painter
(
this
);
painter
.
setRenderHint
(
QPainter
::
Antialiasing
);
QColor
penColor
=
KColorUtils
::
mix
(
palette
().
base
().
color
(),
palette
().
text
().
color
(),
0.3
);
const
QColor
penColor
=
KColorUtils
::
mix
(
palette
().
base
().
color
(),
palette
().
text
().
color
(),
0.3
);
// QPainter is bad at drawing lines that are exactly 1px.
// Using QPen::setCosmetic(true) with a 1px pen width
// doesn't look quite as good as just using 1.001px.
qreal
penWidth
=
1.001
;
qreal
penMargin
=
penWidth
/
2
;
const
qreal
penWidth
=
1.001
;
const
qreal
penMargin
=
penWidth
/
2
;
QPen
pen
(
penColor
,
penWidth
);
pen
.
setCosmetic
(
true
);
QRectF
rect
=
event
->
rect
();
...
...
lib/document/abstractdocumentimpl.cpp
View file @
6f62de55
...
...
@@ -32,7 +32,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
namespace
Gwenview
{
struct
AbstractDocumentImplPrivate
{
Document
*
mDocument
;
Document
*
mDocument
=
nullptr
;
};
AbstractDocumentImpl
::
AbstractDocumentImpl
(
Document
*
document
)
...
...
lib/document/documentfactory.cpp
View file @
6f62de55
...
...
@@ -102,7 +102,7 @@ struct DocumentFactoryPrivate {
// the oldest one is always unreferencedImages.begin().
for
(
UnreferencedImages
::
Iterator
unreferencedIt
=
unreferencedImages
.
begin
();
unreferencedImages
.
count
()
>
MAX_UNREFERENCED_IMAGES
;
unreferencedIt
=
unreferencedImages
.
erase
(
unreferencedIt
))
{
QUrl
url
=
unreferencedIt
.
value
();
const
QUrl
url
=
unreferencedIt
.
value
();
LOG
(
"Collecting"
<<
url
);
it
=
map
.
find
(
url
);
Q_ASSERT
(
it
!=
map
.
end
());
...
...
@@ -232,8 +232,8 @@ void DocumentFactory::slotLoaded(const QUrl &url)
void
DocumentFactory
::
slotSaved
(
const
QUrl
&
oldUrl
,
const
QUrl
&
newUrl
)
{
bool
oldIsNew
=
oldUrl
==
newUrl
;
bool
oldUrlWasModified
=
d
->
mModifiedDocumentList
.
removeOne
(
oldUrl
);
const
bool
oldIsNew
=
oldUrl
==
newUrl
;
const
bool
oldUrlWasModified
=
d
->
mModifiedDocumentList
.
removeOne
(
oldUrl
);
bool
newUrlWasModified
=
false
;
if
(
!
oldIsNew
)
{
newUrlWasModified
=
d
->
mModifiedDocumentList
.
removeOne
(
newUrl
);
...
...
lib/document/documentloadedimpl.cpp
View file @
6f62de55
...
...
@@ -113,7 +113,7 @@ void DocumentLoadedImpl::setImage(const QImage &image)
void
DocumentLoadedImpl
::
applyTransformation
(
Orientation
orientation
)
{
QImage
image
=
document
()
->
image
();
QTransform
matrix
=
ImageUtils
::
transformMatrix
(
orientation
);
const
QTransform
matrix
=
ImageUtils
::
transformMatrix
(
orientation
);
image
=
image
.
transformed
(
matrix
);
setDocumentImage
(
image
);
Q_EMIT
imageRectUpdated
(
image
.
rect
());
...
...
lib/document/jpegdocumentloadedimpl.cpp
View file @
6f62de55
...
...
@@ -54,7 +54,7 @@ bool JpegDocumentLoadedImpl::saveInternal(QIODevice *device, const QByteArray &f
{
if
(
format
==
"jpeg"
)
{
if
(
!
d
->
mJpegContent
->
thumbnail
().
isNull
())
{
QImage
thumbnail
=
document
()
->
image
().
scaled
(
128
,
128
,
Qt
::
KeepAspectRatio
);
const
QImage
thumbnail
=
document
()
->
image
().
scaled
(
128
,
128
,
Qt
::
KeepAspectRatio
);
d
->
mJpegContent
->
setThumbnail
(
thumbnail
);
}
...
...
lib/documentview/abstractdocumentviewadapter.h
View file @
6f62de55
...
...
@@ -179,7 +179,7 @@ Q_SIGNALS:
void
toggleFullScreenRequested
();
private:
QGraphicsWidget
*
mWidget
;
QGraphicsWidget
*
mWidget
=
nullptr
;
};
/**
...
...
lib/documentview/abstractimageview.cpp
View file @
6f62de55
...
...
@@ -86,12 +86,12 @@ struct AbstractImageViewPrivate {
mScrollPos
=
_newPos
;
return
;
}
QSizeF
zoomedDocSize
=
q
->
dipDocumentSize
()
*
mZoom
;
QSizeF
viewSize
=
q
->
boundingRect
().
size
();
QPointF
newPos
(
qBound
(
qreal
(
0.
),
_newPos
.
x
(),
zoomedDocSize
.
width
()
-
viewSize
.
width
()),
qBound
(
qreal
(
0.
),
_newPos
.
y
(),
zoomedDocSize
.
height
()
-
viewSize
.
height
()));
const
QSizeF
zoomedDocSize
=
q
->
dipDocumentSize
()
*
mZoom
;
const
QSizeF
viewSize
=
q
->
boundingRect
().
size
();
const
QPointF
newPos
(
qBound
(
qreal
(
0.
),
_newPos
.
x
(),
zoomedDocSize
.
width
()
-
viewSize
.
width
()),
qBound
(
qreal
(
0.
),
_newPos
.
y
(),
zoomedDocSize
.
height
()
-
viewSize
.
height
()));
if
(
newPos
!=
mScrollPos
)
{
QPointF
oldPos
=
mScrollPos
;
const
QPointF
oldPos
=
mScrollPos
;
mScrollPos
=
newPos
;
if
(
verbosity
==
Notify
)
{
...
...
lib/documentview/birdeyeview.cpp
View file @
6f62de55
...
...
@@ -157,8 +157,8 @@ void BirdEyeView::adjustGeometry()
void
BirdEyeView
::
adjustVisibleRect
()
{
QSizeF
docSize
=
d
->
mDocView
->
document
()
->
size
()
/
qApp
->
devicePixelRatio
();
qreal
viewZoom
=
d
->
mDocView
->
zoom
();
const
QSizeF
docSize
=
d
->
mDocView
->
document
()
->
size
()
/
qApp
->
devicePixelRatio
();
const
qreal
viewZoom
=
d
->
mDocView
->
zoom
();
qreal
bevZoom
;
if
(
docSize
.
height
()
>
docSize
.
width
())
{
bevZoom
=
size
().
height
()
/
docSize
.
height
();
...
...
@@ -171,7 +171,7 @@ void BirdEyeView::adjustVisibleRect()
return
;
}
QRectF
rect
=
QRectF
(
QPointF
(
d
->
mDocView
->
position
())
/
viewZoom
*
bevZoom
,
(
d
->
mDocView
->
size
()
/
viewZoom
).
boundedTo
(
docSize
)
*
bevZoom
);
const
QRectF
rect
=
QRectF
(
QPointF
(
d
->
mDocView
->
position
())
/
viewZoom
*
bevZoom
,
(
d
->
mDocView
->
size
()
/
viewZoom
).
boundedTo
(
docSize
)
*
bevZoom
);
d
->
mVisibleRect
=
rect
;
}
...
...
@@ -245,9 +245,9 @@ void BirdEyeView::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
// Do not drag if mouse was pressed outside visible rect
return
;
}
qreal
ratio
=
qMin
(
d
->
mDocView
->
boundingRect
().
height
()
/
d
->
mVisibleRect
.
height
(),
d
->
mDocView
->
boundingRect
().
width
()
/
d
->
mVisibleRect
.
width
());
QPointF
mousePos
=
event
->
pos
();
QPointF
viewPos
=
d
->
mStartDragViewPos
+
(
mousePos
-
d
->
mStartDragMousePos
)
*
ratio
;
const
qreal
ratio
=
qMin
(
d
->
mDocView
->
boundingRect
().
height
()
/
d
->
mVisibleRect
.
height
(),
d
->
mDocView
->
boundingRect
().
width
()
/
d
->
mVisibleRect
.
width
());
const
QPointF
mousePos
=
event
->
pos
();
const
QPointF
viewPos
=
d
->
mStartDragViewPos
+
(
mousePos
-
d
->
mStartDragMousePos
)
*
ratio
;
d
->
mDocView
->
setPosition
(
viewPos
.
toPoint
());
}
...
...
lib/documentview/documentview.cpp
View file @
6f62de55
...
...
@@ -94,15 +94,15 @@ const int DocumentView::MaximumZoom = 16;
const
int
DocumentView
::
AnimDuration
=
250
;
struct
DocumentViewPrivate
{
DocumentView
*
q
;
DocumentView
*
q
=
nullptr
;
int
mSortKey
;
// Used to sort views when displayed in compare mode
HudWidget
*
mHud
;
BirdEyeView
*
mBirdEyeView
;
HudWidget
*
mHud
=
nullptr
;
BirdEyeView
*
mBirdEyeView
=
nullptr
;
QPointer
<
QPropertyAnimation
>
mMoveAnimation
;
QPointer
<
QPropertyAnimation
>
mFadeAnimation
;
QGraphicsOpacityEffect
*
mOpacityEffect
;
QGraphicsOpacityEffect
*
mOpacityEffect
=
nullptr
;
LoadingIndicator
*
mLoadingIndicator
;
LoadingIndicator
*
mLoadingIndicator
=
nullptr
;
QScopedPointer
<
AbstractDocumentViewAdapter
>
mAdapter
;
QList
<
qreal
>
mZoomSnapValues
;
...
...
lib/documentview/documentviewcontainer.cpp
View file @
6f62de55
...
...
@@ -42,8 +42,8 @@ using DocumentViewSet = QSet<DocumentView *>;
using
SetupForUrl
=
QHash
<
QUrl
,
DocumentView
::
Setup
>
;
struct
DocumentViewContainerPrivate
{
DocumentViewContainer
*
q
;
QGraphicsScene
*
mScene
;
DocumentViewContainer
*
q
=
nullptr
;
QGraphicsScene
*
mScene
=
nullptr
;
SetupForUrl
mSetupForUrl
;
DocumentViewSet
mViews
;
DocumentViewSet
mAddedViews
;
...
...
lib/documentview/documentviewcontroller.cpp
View file @
6f62de55
...
...
@@ -34,22 +34,22 @@
namespace
Gwenview
{
struct
DocumentViewControllerPrivate
{
DocumentViewController
*
q
;
KActionCollection
*
mActionCollection
;
DocumentView
*
mView
;
ZoomWidget
*
mZoomWidget
;
SlideContainer
*
mToolContainer
;
QAction
*
mZoomToFitAction
;
QAction
*
mZoomToFillAction
;
QAction
*
mActualSizeAction
;
QAction
*
mZoomInAction
;
QAction
*
mZoomOutAction
;
QAction
*
mToggleBirdEyeViewAction
;
QAction
*
mBackgroundColorModeAuto
;
QAction
*
mBackgroundColorModeLight
;
QAction
*
mBackgroundColorModeNeutral
;
QAction
*
mBackgroundColorModeDark
;
DocumentViewController
*
q
=
nullptr
;
KActionCollection
*
mActionCollection
=
nullptr
;
DocumentView
*
mView
=
nullptr
;
ZoomWidget
*
mZoomWidget
=
nullptr
;
SlideContainer
*
mToolContainer
=
nullptr
;
QAction
*
mZoomToFitAction
=
nullptr
;
QAction
*
mZoomToFillAction
=
nullptr
;
QAction
*
mActualSizeAction
=
nullptr
;
QAction
*
mZoomInAction
=
nullptr
;
QAction
*
mZoomOutAction
=
nullptr
;
QAction
*
mToggleBirdEyeViewAction
=
nullptr
;
QAction
*
mBackgroundColorModeAuto
=
nullptr
;
QAction
*
mBackgroundColorModeLight
=
nullptr
;
QAction
*
mBackgroundColorModeNeutral
=
nullptr
;
QAction
*
mBackgroundColorModeDark
=
nullptr
;
QList
<
QAction
*>
mActions
;
void
setupActions
()
...
...
@@ -160,12 +160,12 @@ struct DocumentViewControllerPrivate {
painter
.
setRenderHint
(
QPainter
::
Antialiasing
);
// QPainter isn't good at drawing lines that are exactly 1px thick.
qreal
penWidth
=
qApp
->
devicePixelRatio
()
!=
1
?
qApp
->
devicePixelRatio
()
:
qApp
->
devicePixelRatio
()
+
0.001
;
QColor
penColor
=
KColorUtils
::
mix
(
color
,
qApp
->
palette
().
text
().
color
(),
0.3
);
QPen
pen
(
penColor
,
penWidth
);
qreal
margin
=
pen
.
widthF
()
/
2.0
;
QMarginsF
penMargins
(
margin
,
margin
,
margin
,
margin
);
QRectF
rect
=
pixmap
.
rect
();
const
qreal
penWidth
=
qApp
->
devicePixelRatio
()
!=
1
?
qApp
->
devicePixelRatio
()
:
qApp
->
devicePixelRatio
()
+
0.001
;
const
QColor
penColor
=
KColorUtils
::
mix
(
color
,
qApp
->
palette
().
text
().
color
(),
0.3
);
const
QPen
pen
(
penColor
,
penWidth
);
const
qreal
margin
=
pen
.
widthF
()
/
2.0
;
const
QMarginsF
penMargins
(
margin
,
margin
,
margin
,
margin
);
const
QRectF
rect
=
pixmap
.
rect
();
painter
.
setBrush
(
color
);
painter
.
setPen
(
pen
);
...
...
@@ -181,14 +181,14 @@ struct DocumentViewControllerPrivate {
painter
.
setRenderHint
(
QPainter
::
Antialiasing
);
// QPainter isn't good at drawing lines that are exactly 1px thick.
qreal
penWidth
=
qApp
->
devicePixelRatio
()
!=
1
?
qApp
->
devicePixelRatio
()
:
qApp
->
devicePixelRatio
()
+
0.001
;
QColor
lightPenColor
=
KColorUtils
::
mix
(
lightColor
,
darkColor
,
0.3
);
QPen
lightPen
(
lightPenColor
,
penWidth
);
QColor
darkPenColor
=
KColorUtils
::
mix
(
darkColor
,
lightColor
,
0.3
);
QPen
darkPen
(
darkPenColor
,
penWidth
);
qreal
margin
=
lightPen
.
widthF
()
/
2.0
;
QMarginsF
penMargins
(
margin
,
margin
,
margin
,
margin
);
const
qreal
penWidth
=
qApp
->
devicePixelRatio
()
!=
1
?
qApp
->
devicePixelRatio
()
:
qApp
->
devicePixelRatio
()
+
0.001
;
const
QColor
lightPenColor
=
KColorUtils
::
mix
(
lightColor
,
darkColor
,
0.3
);
const
QPen
lightPen
(
lightPenColor
,
penWidth
);
const
QColor
darkPenColor
=
KColorUtils
::
mix
(
darkColor
,
lightColor
,
0.3
);
const
QPen
darkPen
(
darkPenColor
,
penWidth
);
const
qreal
margin
=
lightPen
.
widthF
()
/
2.0
;
const
QMarginsF
penMargins
(
margin
,
margin
,
margin
,
margin
);
QRectF
rect
=
pixmap
.
rect
();
rect
=
rect
.
marginsRemoved
(
penMargins
);
int
lightStartAngle
=
45
*
16
;
...
...
lib/documentview/documentviewsynchronizer.cpp
View file @
6f62de55
...
...
@@ -32,8 +32,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Cambridge, MA 02110-1301, USA
namespace
Gwenview
{
struct
DocumentViewSynchronizerPrivate
{
DocumentViewSynchronizer
*
q
;
const
QList
<
DocumentView
*>
*
mViews
;
DocumentViewSynchronizer
*
q
=
nullptr
;
const
QList
<
DocumentView
*>
*
mViews
=
nullptr
;
QPointer
<
DocumentView
>
mCurrentView
;
bool
mActive
;
QPoint
mOldPosition
;
...
...
lib/documentview/loadingindicator.cpp
View file @
6f62de55
...
...
@@ -35,10 +35,10 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Cambridge, MA 02110-1301, USA
namespace
Gwenview
{
struct
LoadingIndicatorPrivate
{
LoadingIndicator
*
q
;
LoadingIndicator
*
q
=
nullptr
;
KPixmapSequence
mSequence
;
int
mIndex
;
QTimer
*
mTimer
;
QTimer
*
const
mTimer
;
LoadingIndicatorPrivate
(
LoadingIndicator
*
qq
)
:
q
(
qq
)
...
...
lib/documentview/rasterimageview.cpp
View file @
6f62de55
...
...
@@ -80,9 +80,9 @@ struct RasterImageViewPrivate {
{
}
RasterImageView
*
q
;
RasterImageView
*
q
=
nullptr
;
RasterImageItem
*
mImageItem
;
RasterImageItem
*
mImageItem
=
nullptr
;
ToolPainter
*
mToolItem
=
nullptr
;
QPointer
<
AbstractRasterImageViewTool
>
mTool
;
...
...
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