61 QMessageBox::warning(this, |
61 QMessageBox::warning(this, |
62 tr("Unreadable library"), |
62 tr("Unreadable library"), |
63 tr("The directory %1 cannot be read.").arg(quoted(dir.path())) |
63 tr("The directory %1 cannot be read.").arg(quoted(dir.path())) |
64 ); |
64 ); |
65 } |
65 } |
66 model->addLibrary({Library::OfficialLibrary, dir}); |
66 model->addLibrary({library_role_e::official, dir}); |
67 this->ui.newLibraryPath->clear(); |
67 this->ui.newLibraryPath->clear(); |
68 } |
68 } |
69 } |
69 } |
70 } |
70 } |
71 |
71 |
81 removeAction, |
81 removeAction, |
82 &QAction::triggered, |
82 &QAction::triggered, |
83 this, |
83 this, |
84 &LibrariesEditor::removeCurrentLibrary); |
84 &LibrariesEditor::removeCurrentLibrary); |
85 QMenu* roleMenu = new QMenu{tr("Set role"), contextMenu}; |
85 QMenu* roleMenu = new QMenu{tr("Set role"), contextMenu}; |
86 for (const Library::Role role : Library::allRoles) |
86 for (const library_role_e role : all_library_roles) |
87 { |
87 { |
88 QAction* setRoleAction = new QAction{Library::libraryRoleName(role)}; |
88 QAction* setRoleAction = new QAction{library_role_name(role)}; |
89 setRoleAction->setData(role); |
89 setRoleAction->setData(QVariant::fromValue(role)); |
90 roleMenu->addAction(setRoleAction); |
90 roleMenu->addAction(setRoleAction); |
91 connect( |
91 connect( |
92 setRoleAction, |
92 setRoleAction, |
93 &QAction::triggered, |
93 &QAction::triggered, |
94 this, |
94 this, |
119 { |
119 { |
120 if (LibrariesModel* model = this->currentModel()) { |
120 if (LibrariesModel* model = this->currentModel()) { |
121 const index_t libraryIndex = currentLibraryIndex(); |
121 const index_t libraryIndex = currentLibraryIndex(); |
122 QObject* senderObject = sender(); |
122 QObject* senderObject = sender(); |
123 QAction* senderAction = qobject_cast<QAction*>(senderObject); |
123 QAction* senderAction = qobject_cast<QAction*>(senderObject); |
124 const Library::Role role = senderAction->data().value<Library::Role>(); |
124 const library_role_e role = senderAction->data().value<library_role_e>(); |
125 model->setLibraryRole(libraryIndex, role); |
125 model->setLibraryRole(libraryIndex, role); |
126 } |
126 } |
127 } |
127 } |
128 |
128 |
129 void LibrariesEditor::removeCurrentLibrary() |
129 void LibrariesEditor::removeCurrentLibrary() |