Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#5127: More FavouritesManager implementation. Add legacy loading code…
… to import MediaBrowser favourites that have been stored in a different XPath up to v2.10.
- Loading branch information
1 parent
55b012a
commit 86ac171
Showing
5 changed files
with
81 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#pragma once | ||
|
||
#include <string> | ||
#include <set> | ||
|
||
namespace decl | ||
{ | ||
|
||
class FavouriteSet | ||
{ | ||
private: | ||
std::set<std::string> _set; | ||
|
||
public: | ||
std::set<std::string>& get() | ||
{ | ||
return _set; | ||
} | ||
|
||
const std::set<std::string>& get() const | ||
{ | ||
return _set; | ||
} | ||
|
||
void loadFromRegistry(const std::string& rootPath) | ||
{ | ||
xml::NodeList favourites = GlobalRegistry().findXPath(rootPath + "//favourite"); | ||
|
||
for (xml::Node& node : favourites) | ||
{ | ||
_set.insert(node.getAttributeValue("value")); | ||
} | ||
} | ||
|
||
void saveToRegistry(const std::string& rootPath) | ||
{ | ||
GlobalRegistry().deleteXPath(rootPath + "//favourite"); | ||
|
||
xml::Node favourites = GlobalRegistry().createKey(rootPath); | ||
|
||
for (const auto& favourite : _set) | ||
{ | ||
xml::Node node = favourites.createChild("favourite"); | ||
node.setAttributeValue("value", favourite); | ||
} | ||
} | ||
}; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters