Add method to store settings using QVariantMap
ClosedPublic

Authored by laysrodrigues on Jul 8 2019, 6:26 PM.

Details

Summary

Signed-off-by: Lays Rodrigues <lays.rodrigues@kde.org>

Add method to convert MachineInfo enum to string

Signed-off-by: Lays Rodrigues <lays.rodrigues@kde.org>

Diff Detail

Repository
R232 AtCore
Branch
add_key_function
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 13766
Build 13784: arc lint + arc unit
laysrodrigues requested review of this revision.Jul 8 2019, 6:26 PM
laysrodrigues created this revision.
rizzitello requested changes to this revision.Jul 8 2019, 6:41 PM
rizzitello added inline comments.
src/core/machineinfo.cpp
196

Please add a new line here

This revision now requires changes to proceed.Jul 8 2019, 6:41 PM
laysrodrigues marked an inline comment as done.

Add line

rizzitello accepted this revision.Jul 8 2019, 7:04 PM
This revision is now accepted and ready to land.Jul 8 2019, 7:04 PM
broulik added a subscriber: broulik.Jul 8 2019, 8:35 PM
broulik added inline comments.
src/core/machineinfo.cpp
173

.first() will assert if the map is empty. Does this make sense to use for an associative container?

174

Don't call keys() which creates a temporary list just to iterate it, also avoid double lookup. use iterators

for (auto it = profile.begin(), end = profile.end(); it != end; ++it) {
    m_settings->setValue(it.key(), it.value());
}
src/core/machineinfo.h
88

const QVariantMap &?
Also, docs.

laysrodrigues marked 2 inline comments as done.Jul 9 2019, 1:30 AM

Kai suggestions

Minor fixes

tcanabrava requested changes to this revision.Jul 9 2019, 5:16 PM
tcanabrava added inline comments.
src/core/machineinfo.cpp
190

This can create elements if the key does not exist. use find(), assert that the result is != than end()

This revision now requires changes to proceed.Jul 9 2019, 5:16 PM
laysrodrigues marked an inline comment as done.Jul 9 2019, 6:17 PM
laysrodrigues added inline comments.
src/core/machineinfo.cpp
173

I thought that I should use first() to get the first key in the map. What should I do instead?

Tomaz suggestions

rizzitello accepted this revision.Jul 10 2019, 3:52 PM
tcanabrava accepted this revision.Jul 10 2019, 3:53 PM
This revision is now accepted and ready to land.Jul 10 2019, 3:53 PM
patrickelectric accepted this revision.Jul 10 2019, 4:00 PM
laysrodrigues closed this revision.Jul 10 2019, 4:10 PM