src/libraries.h

changeset 381
80bea7a6e84f
parent 380
16f6717a218b
--- a/src/libraries.h	Wed Apr 19 22:42:43 2023 +0300
+++ b/src/libraries.h	Wed Apr 19 22:51:56 2023 +0300
@@ -24,24 +24,31 @@
 
 class QSettings;
 
+enum class library_role_e
+{
+	official,
+	unofficial,
+	working,
+};
+
+constexpr static const library_role_e all_library_roles[] =
+{
+	library_role_e::official,
+	library_role_e::unofficial,
+	library_role_e::working
+};
+
 struct Library
 {
-	enum Role
-	{
-		OfficialLibrary,
-		UnofficialLibrary,
-		WorkingLibrary,
-	} role;
+	library_role_e role;
 	QDir path;
-	static QString libraryRoleName(const Role role);
-	static bool isValidRole(const Role role);
-	constexpr static const Role allRoles[] = {OfficialLibrary, UnofficialLibrary, WorkingLibrary};
 };
 
+QString library_role_name(const library_role_e role);
 bool operator==(const Library& one, const Library& other);
 
 Q_DECLARE_METATYPE(Library)
-Q_DECLARE_METATYPE(Library::Role)
+Q_DECLARE_METATYPE(library_role_e)
 QDataStream &operator<<(QDataStream&, const Library&);
 QDataStream &operator>>(QDataStream&, Library&);
 using Libraries = QVector<Library>;
@@ -58,7 +65,7 @@
 	void removeLibrary(const index_t libraryIndex);
 	const Library& library(index_t libraryIndex) const;
 	void setLibraryPath(index_t libraryIndex, const QDir& path);
-	void setLibraryRole(index_t libraryIndex, const Library::Role role);
+	void setLibraryRole(index_t libraryIndex, const library_role_e role);
 	void restoreFromSettings();
 	void storeToSettings();
 	index_t count() const;

mercurial