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
Plasma
Discover
Commits
3b96f860
Commit
3b96f860
authored
Oct 22, 2020
by
Laurent Montel
😁
Browse files
Now it depends against new version. Old code can be removed
parent
8c6422a9
Changes
7
Hide whitespace changes
Inline
Side-by-side
discover/DiscoverDeclarativePlugin.cpp
View file @
3b96f860
...
...
@@ -58,21 +58,12 @@ void DiscoverDeclarativePlugin::registerTypes(const char* /*uri*/)
qmlRegisterUncreatableType
<
Transaction
>
(
"org.kde.discover"
,
2
,
0
,
"Transaction"
,
QStringLiteral
(
"should come from the backends"
));
qmlRegisterUncreatableType
<
SourcesModel
>
(
"org.kde.discover"
,
2
,
0
,
"SourcesModelClass"
,
QStringLiteral
(
"should come from the backends"
));
qmlRegisterUncreatableType
<
SourcesModel
>
(
"org.kde.discover"
,
2
,
0
,
"AbstractBackendUpdater"
,
QStringLiteral
(
"should come from the backends"
));
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
qmlRegisterType
<
TransactionModel
>
();
qmlRegisterType
<
Rating
>
();
qmlRegisterType
<
AbstractResourcesBackend
>
();
qmlRegisterType
<
AbstractReviewsBackend
>
();
qmlRegisterType
<
Category
>
();
qmlRegisterType
<
ResourcesModel
>
();
#else
qmlRegisterAnonymousType
<
TransactionModel
>
(
"org.kde.discover"
,
1
);
qmlRegisterAnonymousType
<
Rating
>
(
"org.kde.discover"
,
1
);
qmlRegisterAnonymousType
<
AbstractResourcesBackend
>
(
"org.kde.discover"
,
1
);
qmlRegisterAnonymousType
<
AbstractReviewsBackend
>
(
"org.kde.discover"
,
1
);
qmlRegisterAnonymousType
<
Category
>
(
"org.kde.discover"
,
1
);
qmlRegisterAnonymousType
<
ResourcesModel
>
(
"org.kde.discover"
,
1
);
#endif
qmlProtectModule
(
"org.kde.discover"
,
2
);
qRegisterMetaType
<
QList
<
QAction
*>>
();
}
discover/DiscoverObject.cpp
View file @
3b96f860
...
...
@@ -44,7 +44,6 @@
#include <KStandardAction>
#include <KCrash>
#include <kcoreaddons_version.h>
#include <kcrash_version.h>
// #include <KSwitchLanguageDialog>
// DiscoverCommon includes
...
...
@@ -112,15 +111,6 @@ DiscoverObject::DiscoverObject(CompactMode mode, const QVariantMap &initialPrope
connect
(
r
,
&
DiscoverSettings
::
appsListPageSortingChanged
,
r
,
&
DiscoverSettings
::
save
);
return
r
;
});
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
qmlRegisterType
<
QQuickView
>
();
qmlRegisterType
<
QActionGroup
>
();
qmlRegisterType
<
QAction
>
();
qmlRegisterType
<
KAboutData
>
();
qmlRegisterType
<
KAboutLicense
>
();
qmlRegisterType
<
KAboutPerson
>
();
#else
qmlRegisterAnonymousType
<
QQuickView
>
(
"org.kde.discover.app"
,
1
);
qmlRegisterAnonymousType
<
QActionGroup
>
(
"org.kde.discover.app"
,
1
);
qmlRegisterAnonymousType
<
QAction
>
(
"org.kde.discover.app"
,
1
);
...
...
@@ -128,7 +118,6 @@ DiscoverObject::DiscoverObject(CompactMode mode, const QVariantMap &initialPrope
qmlRegisterAnonymousType
<
KAboutData
>
(
"org.kde.discover.app"
,
1
);
qmlRegisterAnonymousType
<
KAboutLicense
>
(
"org.kde.discover.app"
,
1
);
qmlRegisterAnonymousType
<
KAboutPerson
>
(
"org.kde.discover.app"
,
1
);
#endif
qmlRegisterUncreatableType
<
DiscoverObject
>
(
"org.kde.discover.app"
,
1
,
0
,
"DiscoverMainWindow"
,
QStringLiteral
(
"don't do that"
));
setupActions
();
...
...
@@ -139,9 +128,7 @@ DiscoverObject::DiscoverObject(CompactMode mode, const QVariantMap &initialPrope
plugin
->
initializeEngine
(
m_engine
,
uri
);
plugin
->
registerTypes
(
uri
);
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
m_engine
->
setInitialProperties
(
initialProperties
);
#endif
m_engine
->
rootContext
()
->
setContextProperty
(
QStringLiteral
(
"app"
),
this
);
m_engine
->
rootContext
()
->
setContextProperty
(
QStringLiteral
(
"discoverAboutData"
),
QVariant
::
fromValue
(
KAboutData
::
applicationData
()));
...
...
@@ -341,9 +328,7 @@ void DiscoverObject::integrateObject(QObject* object)
rootObject
()
->
setVisibility
(
qMax
(
visibility
,
QQuickView
::
AutomaticVisibility
));
}
connect
(
rootObject
(),
&
QQuickView
::
sceneGraphError
,
this
,
[]
(
QQuickWindow
::
SceneGraphError
/*error*/
,
const
QString
&
message
)
{
#if KCrash_VERSION >= QT_VERSION_CHECK(5, 69, 0)
KCrash
::
setErrorMessage
(
message
);
#endif
qFatal
(
"%s"
,
qPrintable
(
message
));
});
...
...
libdiscover/DiscoverBackendsFactory.cpp
View file @
3b96f860
...
...
@@ -108,11 +108,7 @@ void DiscoverBackendsFactory::setupCommandLine(QCommandLineParser* parser)
void
DiscoverBackendsFactory
::
processCommandLine
(
QCommandLineParser
*
parser
,
bool
test
)
{
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
QStringList
backends
=
test
?
QStringList
{
QStringLiteral
(
"dummy-backend"
)
}
:
parser
->
value
(
QStringLiteral
(
"backends"
)).
split
(
QLatin1Char
(
','
),
QString
::
SkipEmptyParts
);
#else
QStringList
backends
=
test
?
QStringList
{
QStringLiteral
(
"dummy-backend"
)
}
:
parser
->
value
(
QStringLiteral
(
"backends"
)).
split
(
QLatin1Char
(
','
),
Qt
::
SkipEmptyParts
);
#endif
for
(
auto
&
backend
:
backends
)
{
if
(
!
backend
.
endsWith
(
QLatin1String
(
"-backend"
)))
backend
.
append
(
QLatin1String
(
"-backend"
));
...
...
libdiscover/appstream/AppStreamUtils.cpp
View file @
3b96f860
...
...
@@ -97,11 +97,7 @@ QStringList AppStreamUtils::appstreamIds(const QUrl &appstreamUrl)
ret
+=
appstreamUrl
.
host
().
isEmpty
()
?
appstreamUrl
.
path
()
:
appstreamUrl
.
host
();
if
(
appstreamUrl
.
hasQuery
())
{
QUrlQuery
query
(
appstreamUrl
);
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
ret
<<
query
.
queryItemValue
(
QStringLiteral
(
"alt"
)).
split
(
QLatin1Char
(
','
),
QString
::
SkipEmptyParts
);
#else
ret
<<
query
.
queryItemValue
(
QStringLiteral
(
"alt"
)).
split
(
QLatin1Char
(
','
),
Qt
::
SkipEmptyParts
);
#endif
}
return
ret
;
}
libdiscover/backends/KNSBackend/KNSBackend.cpp
View file @
3b96f860
...
...
@@ -572,11 +572,7 @@ ResultsStream * KNSBackend::findResourceByPackageName(const QUrl& search)
if
(
search
.
scheme
()
!=
QLatin1String
(
"kns"
)
||
search
.
host
()
!=
name
())
return
voidStream
();
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
const
auto
pathParts
=
search
.
path
().
split
(
QLatin1Char
(
'/'
),
QString
::
SkipEmptyParts
);
#else
const
auto
pathParts
=
search
.
path
().
split
(
QLatin1Char
(
'/'
),
Qt
::
SkipEmptyParts
);
#endif
if
(
pathParts
.
size
()
!=
2
)
{
Q_EMIT
passiveMessage
(
i18n
(
"Wrong KNewStuff URI: %1"
,
search
.
toString
()));
return
voidStream
();
...
...
libdiscover/backends/PackageKitBackend/PackageKitUpdater.cpp
View file @
3b96f860
...
...
@@ -262,11 +262,7 @@ void PackageKitUpdater::addResources(const QList<AbstractResource*>& apps)
QList
<
AbstractResource
*>
PackageKitUpdater
::
toUpdate
()
const
{
return
m_toUpgrade
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
.
values
();
#else
.
toList
();
#endif
}
bool
PackageKitUpdater
::
isMarked
(
AbstractResource
*
res
)
const
...
...
libdiscover/utils.h
View file @
3b96f860
...
...
@@ -103,25 +103,13 @@ static QVector<T> kSetToVector(const QSet<T> & set)
template
<
typename
T
>
static
QSet
<
T
>
kToSet
(
const
QVector
<
T
>
&
set
)
{
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
return
QSet
<
T
>
(
set
.
begin
(),
set
.
end
());
#else
QSet
<
T
>
ret
;
ret
.
reserve
(
set
.
size
());
for
(
auto
&
x
:
set
)
ret
.
insert
(
x
);
return
ret
;
#endif
}
template
<
typename
T
>
static
QSet
<
T
>
kToSet
(
const
QList
<
T
>
&
set
)
{
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
return
QSet
<
T
>
(
set
.
begin
(),
set
.
end
());
#else
return
set
.
toSet
();
#endif
}
class
ElapsedDebug
:
private
QElapsedTimer
...
...
Write
Preview
Supports
Markdown
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