Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
PIM
PIM GrantleeTheme
Commits
ce776f82
Commit
ce776f82
authored
Nov 24, 2021
by
Laurent Montel
😁
Browse files
Modernize code
parent
172b1271
Pipeline
#100492
passed with stage
in 3 minutes and 36 seconds
Changes
9
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
autotest/grantleethememanagertest.cpp
View file @
ce776f82
...
...
@@ -43,8 +43,7 @@ void GrantleeThemeManagerTest::initTestCase()
void
GrantleeThemeManagerTest
::
updateActionList
()
{
KActionCollection
coll
(
this
);
GrantleeTheme
::
ThemeManager
*
manager
(
new
GrantleeTheme
::
ThemeManager
(
QStringLiteral
(
"Stuff"
),
QStringLiteral
(
"filename.testdesktop"
),
&
coll
,
QStringLiteral
(
"themes"
)));
auto
manager
(
new
GrantleeTheme
::
ThemeManager
(
QStringLiteral
(
"Stuff"
),
QStringLiteral
(
"filename.testdesktop"
),
&
coll
,
QStringLiteral
(
"themes"
)));
QCOMPARE
(
manager
->
themes
().
count
(),
2
);
QVERIFY
(
!
manager
->
actionForTheme
());
// Bug? No "default" theme.
...
...
@@ -68,8 +67,7 @@ void GrantleeThemeManagerTest::updateActionList()
void
GrantleeThemeManagerTest
::
destructionOrderTest
()
{
KActionCollection
coll
(
this
);
GrantleeTheme
::
ThemeManager
*
manager
(
new
GrantleeTheme
::
ThemeManager
(
QStringLiteral
(
"Stuff"
),
QStringLiteral
(
"filename.testdesktop"
),
&
coll
,
QStringLiteral
(
"themes"
)));
auto
manager
(
new
GrantleeTheme
::
ThemeManager
(
QStringLiteral
(
"Stuff"
),
QStringLiteral
(
"filename.testdesktop"
),
&
coll
,
QStringLiteral
(
"themes"
)));
QCOMPARE
(
manager
->
themes
().
count
(),
2
);
QVERIFY
(
!
manager
->
actionForTheme
());
// Bug? No "default" theme.
...
...
autotest/grantleethemetest.cpp
View file @
ce776f82
...
...
@@ -27,9 +27,7 @@ GrantleeThemeTest::GrantleeThemeTest(QObject *parent)
qputenv
(
"XDG_DATA_DIRS"
,
GRANTLEETHEME_DATA_DIR
);
}
GrantleeThemeTest
::~
GrantleeThemeTest
()
{
}
GrantleeThemeTest
::~
GrantleeThemeTest
()
=
default
;
void
GrantleeThemeTest
::
shouldHaveDefaultValue
()
{
...
...
src/grantleeki18nlocalizer.cpp
View file @
ce776f82
...
...
@@ -20,9 +20,7 @@ GrantleeKi18nLocalizer::GrantleeKi18nLocalizer()
{
}
GrantleeKi18nLocalizer
::~
GrantleeKi18nLocalizer
()
{
}
GrantleeKi18nLocalizer
::~
GrantleeKi18nLocalizer
()
=
default
;
QString
GrantleeKi18nLocalizer
::
processArguments
(
const
KLocalizedString
&
kstr
,
const
QVariantList
&
arguments
)
const
{
...
...
src/grantleetheme.cpp
View file @
ce776f82
...
...
@@ -29,22 +29,10 @@ ThemePrivate::ThemePrivate()
}
ThemePrivate
::
ThemePrivate
(
const
ThemePrivate
&
other
)
:
QSharedData
(
other
)
,
displayExtraVariables
(
other
.
displayExtraVariables
)
,
themeFileName
(
other
.
themeFileName
)
,
description
(
other
.
description
)
,
name
(
other
.
name
)
,
dirName
(
other
.
dirName
)
,
absolutePaths
(
other
.
absolutePaths
)
,
author
(
other
.
author
)
,
email
(
other
.
email
)
,
loader
(
other
.
loader
)
{
}
ThemePrivate
::~
ThemePrivate
()
{
}
=
default
;
ThemePrivate
::~
ThemePrivate
()
=
default
;
void
ThemePrivate
::
setupEngine
()
{
...
...
@@ -121,13 +109,10 @@ Theme::Theme(const QString &themePath, const QString &dirName, const QString &de
}
Theme
::
Theme
(
const
Theme
&
other
)
:
d
(
other
.
d
)
{
}
Theme
::~
Theme
()
{
}
=
default
;
Theme
::~
Theme
()
=
default
;
bool
Theme
::
operator
==
(
const
Theme
&
other
)
const
{
...
...
@@ -206,7 +191,7 @@ QString Theme::render(const QString &templateName, const QVariantHash &data, con
if
(
!
d
->
loader
->
canLoadTemplate
(
templateName
))
{
qCWarning
(
GRANTLEETHEME_LOG
)
<<
"Cannot load template"
<<
templateName
<<
", please check your installation. Tried in these dirs:"
<<
d
->
loader
->
templateDirs
();
return
QString
()
;
return
{}
;
}
Grantlee
::
Template
tpl
=
d
->
loader
->
loadByName
(
templateName
,
ThemePrivate
::
sEngine
);
...
...
src/grantleethemeengine.cpp
View file @
ce776f82
...
...
@@ -14,13 +14,9 @@ using namespace GrantleeTheme;
class
GrantleeTheme
::
EnginePrivate
{
public:
EnginePrivate
()
{
}
EnginePrivate
()
=
default
;
~
EnginePrivate
()
{
}
~
EnginePrivate
()
=
default
;
QWeakPointer
<
GrantleeKi18nLocalizer
>
localizer
;
};
...
...
src/grantleethememanager.cpp
View file @
ce776f82
...
...
@@ -176,7 +176,7 @@ public:
while
(
i
.
hasNext
())
{
i
.
next
();
GrantleeTheme
::
Theme
theme
=
i
.
value
();
KToggleAction
*
act
=
new
KToggleAction
(
theme
.
name
(),
q
);
auto
act
=
new
KToggleAction
(
theme
.
name
(),
q
);
act
->
setToolTip
(
theme
.
description
());
act
->
setData
(
theme
.
dirName
());
if
(
theme
.
dirName
()
==
themeActivated
)
{
...
...
@@ -316,7 +316,7 @@ QStringList ThemeManager::displayExtraVariables(const QString &themename) const
return
i
.
value
().
displayExtraVariables
();
}
}
return
QStringList
()
;
return
{}
;
}
GrantleeTheme
::
Theme
ThemeManager
::
theme
(
const
QString
&
themeName
)
...
...
@@ -355,7 +355,7 @@ QString ThemeManager::pathFromThemes(const QString &themesRelativePath, const QS
}
}
}
return
QString
()
;
return
{}
;
}
GrantleeTheme
::
Theme
ThemeManager
::
loadTheme
(
const
QString
&
themePath
,
const
QString
&
dirName
,
const
QString
&
defaultDesktopFileName
)
...
...
src/plugin/icon.cpp
View file @
ce776f82
...
...
@@ -18,9 +18,7 @@ IconTag::IconTag(QObject *parent)
{
}
IconTag
::~
IconTag
()
{
}
IconTag
::~
IconTag
()
=
default
;
Grantlee
::
Node
*
IconTag
::
getNode
(
const
QString
&
tagContent
,
Grantlee
::
Parser
*
p
)
const
{
...
...
@@ -86,9 +84,7 @@ IconNode::IconNode(const QString &iconName, int sizeOrGroup, const QString &altT
{
}
IconNode
::~
IconNode
()
{
}
IconNode
::~
IconNode
()
=
default
;
void
IconNode
::
render
(
Grantlee
::
OutputStream
*
stream
,
Grantlee
::
Context
*
c
)
const
{
...
...
src/plugin/kdegrantleeplugin.cpp
View file @
ce776f82
...
...
@@ -20,9 +20,7 @@ KDEGrantleePlugin::KDEGrantleePlugin(QObject *parent)
Palette
::
registerMetaType
();
}
KDEGrantleePlugin
::~
KDEGrantleePlugin
()
{
}
KDEGrantleePlugin
::~
KDEGrantleePlugin
()
=
default
;
QHash
<
QString
,
Grantlee
::
AbstractNodeFactory
*>
KDEGrantleePlugin
::
nodeFactories
(
const
QString
&
name
)
{
...
...
src/qtresourcetemplateloader.cpp
View file @
ce776f82
...
...
@@ -25,7 +25,7 @@ Grantlee::Template QtResourceTemplateLoader::loadByName(const QString &fileName,
QFile
file
;
file
.
setFileName
(
fileName
);
if
(
!
file
.
exists
()
||
!
file
.
open
(
QIODevice
::
ReadOnly
|
QIODevice
::
Text
))
{
return
Grantlee
::
Template
()
;
return
{}
;
}
QTextStream
fstream
(
&
file
);
...
...
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