Use QUrl in the ScreenMapper API
ClosedPublic

Authored by amantia on Dec 14 2017, 11:31 AM.

Diff Detail

Repository
R119 Plasma Desktop
Branch
master
Lint
No Linters Available
Unit
No Unit Test Coverage
amantia requested review of this revision.Dec 14 2017, 11:31 AM
amantia created this revision.

To be honest, I'm not sure the benefit of a nice API warrants the rest of the ugliness, as some parts still rely on using a string for URL (FolderModel::url) and makes the unit tests also uglier.

amantia set the repository for this revision to R119 Plasma Desktop.
Restricted Application added a project: Plasma. · View Herald TranscriptDec 14 2017, 11:33 AM
Restricted Application added a subscriber: plasma-devel. · View Herald Transcript
mlaurent added inline comments.
containments/desktop/plugins/folder/autotests/foldermodeltest.cpp
34

new line after ')'

containments/desktop/plugins/folder/autotests/positionertest.cpp
38

I don't think that it used in this file.

amantia updated this revision to Diff 23954.Dec 15 2017, 10:35 AM

Fixed issues pointed out by Laurent.

mlaurent added inline comments.Dec 18 2017, 10:33 AM
containments/desktop/plugins/folder/screenmapper.cpp
113

"== QLatin1Char('/') ?"

mwolff requested changes to this revision.Dec 18 2017, 10:53 AM
mwolff added inline comments.
containments/desktop/plugins/folder/foldermodel.cpp
1062

move down into the first conditional, return original url when nothing changed

1068

return QUrl::fromUserInput(mappedUrl, {}, QUrl::AssumeLocalFile)

1072

return url;

1510–1511

not your change: why is m_url not an url :-/

also: introduce the helper function you have in the tests here, too - maybe even move it into a static function in the ScreenMapper and then use it everywhere inplace of the QUrl::fromUserInput three-arg function call

This revision now requires changes to proceed.Dec 18 2017, 10:53 AM
ervin added a subscriber: ervin.Dec 19 2017, 12:48 PM

@mwolff and @broulik Could one of you answer @amantia concerns regarding the motivations of that patch? If you agree with him maybe we don't want that patch at all...

I'd personally prefer to use an API with less conversions if possible. The fact that the test code becomes (marginally) more complex doesn't really count in my opinion.

containments/desktop/plugins/folder/foldermodel.cpp
291

couldn't you use this->resolvedUrl() here?

327

shouldn't/couldn't this use resolvedUrl?

633

resolvedUrl()?

amantia updated this revision to Diff 25799.Jan 23 2018, 11:28 AM

Change code according to reviewer's requests

containments/desktop/plugins/folder/foldermodel.cpp
1510–1511

m_url is exposed to QML, that doesn't support QUrl.

amantia edited reviewers, added: hein; removed: dakon.Jan 23 2018, 11:28 AM
hein accepted this revision.Jan 23 2018, 1:06 PM
mwolff accepted this revision.Jan 25 2018, 9:39 AM

two questions, otherwise lgtm

containments/desktop/plugins/folder/foldermodel.cpp
291

could you call this at the top? then the this-> call shouldn't be required, I think.

327

is this different from the local resolvedUrl variable? If so, why? confusing ;-) Add a comment then

This revision is now accepted and ready to land.Jan 25 2018, 9:39 AM
amantia updated this revision to Diff 25933.Jan 25 2018, 10:57 AM

Make the code more clear, by renaming a local variable.

amantia closed this revision.Jan 26 2018, 9:27 AM