Skip to content

Commit

Permalink
Pref Library: mark missing/invalid directories with icon, add tooltip
Browse files Browse the repository at this point in the history
  • Loading branch information
ronso0 committed Oct 3, 2023
1 parent cd2fdb3 commit 7b83ac7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
7 changes: 5 additions & 2 deletions src/preferences/dialog/dlgpreferencepage.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,15 @@ class DlgPreferencePage : public QWidget {
/// overriding this. The default implementation returns an invalid QUrl.
virtual QUrl helpUrl() const;

const QString kWarningIconPath =
QStringLiteral(":/images/preferences/ic_preferences_warning.svg");
const QString kWarningIconHtmlString = QStringLiteral(
"<html>"
"<img "
"src=':/images/preferences/ic_preferences_warning.svg' "
"src='%1' "
"width='20' height='20'>"
"</html> ");
"</html> ")
.arg(kWarningIconPath);

void setScrollSafeGuardForAllInputWidgets(QObject* obj);
/// Avoid undesired value changes when scrolling a preferences page while
Expand Down
8 changes: 7 additions & 1 deletion src/preferences/dialog/dlgpreflibrary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,13 @@ void DlgPrefLibrary::initializeDirList() {
->internalCollection()
->loadRootDirs();
for (const mixxx::FileInfo& rootDir : rootDirs) {
m_dirListModel.appendRow(new QStandardItem(rootDir.location()));
// mark missing/invalid dirs with a warning icon, add a tooltip
auto* pDirItem = new QStandardItem(rootDir.location());
if (!rootDir.exists() || !rootDir.isDir()) {
pDirItem->setIcon(QIcon(kWarningIconPath));
pDirItem->setToolTip(tr("Item is not a directory or directory is missing"));
}
m_dirListModel.appendRow(pDirItem);
}
dirList->setModel(&m_dirListModel);
dirList->setCurrentIndex(m_dirListModel.index(0, 0));
Expand Down

0 comments on commit 7b83ac7

Please sign in to comment.