26#include <unordered_set>
34#include <QRadioButton>
46 template <
typename T1,
typename T2>
50 auto h1 = std::hash<T1>{}(p.first);
51 auto h2 = std::hash<T2>{}(p.second);
52 return h1 ^ (h2 << 1);
56 using Layers = std::unordered_set<viz::CoinLayerID, pair_hash>;
70 const QString& name =
"",
71 bool additive =
false,
72 bool addDialog =
true,
73 bool isDefault =
false);
88 QRadioButton* additiveRadioButton;
89 QRadioButton* substractiveRadioButton;
90 QPushButton* deleteButton;
91 QCheckBox* defaultCheckBox;
104 std::scoped_lock lock(mtx);
106 if (currentProfile.additive == visible)
108 currentProfile.layers.insert(layerID);
110 else if (currentProfile.layers.count(layerID) > 0)
112 currentProfile.layers.erase(layerID);
113 currentProfile.layers.erase({layerID.first,
"*"});
118 update(
const std::string& componentName,
bool visible)
120 update({componentName,
"*"}, visible);
126 std::scoped_lock lock(mtx);
128 const bool result = currentProfile.layers.count(layerID) > 0 or
129 currentProfile.layers.count({layerID.first,
"*"}) > 0;
131 if (currentProfile.additive)
144 std::scoped_lock lock(mtx);
146 return currentProfile.additive ==
147 (currentProfile.layers.count({componentName,
"*"}) == 0);
158 void saveCurrentProfile();
159 void deleteCurrentProfileSave();
165 void loadLayerNames();
166 void loadProfile(
const QString& name);
167 bool saveProfile(
const QString& name,
const Profile& profile);
170 QComboBox* layersComboBox;
171 QPushButton* addButton;
172 QPushButton* editButton;
173 QPushButton* saveButton;
175 mutable std::mutex mtx;
179 static const QString SETTINGS_DEFAULT_PROFILE_KEY;
bool isDefaultProfile() const
void deleteProfileSignal()
ProfileDialog(QWidget *parent=nullptr, const QString &name="", bool additive=false, bool addDialog=true, bool isDefault=false)
std::pair< std::string, std::string > CoinLayerID
This file offers overloads of toIce() and fromIce() functions for STL container types.
std::unordered_set< viz::CoinLayerID, pair_hash > Layers
std::size_t operator()(const std::pair< T1, T2 > &p) const