From 572d5ee906e5485dbc5fb838a1e22db2884cc9dc Mon Sep 17 00:00:00 2001 From: luc-git <102831178+luc-git@users.noreply.github.com> Date: Fri, 16 Feb 2024 21:12:04 +0100 Subject: [PATCH] Add a button to add dir to the library --- src/platform/qt/Window.cpp | 4 ++++ src/platform/qt/library/LibraryController.cpp | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/platform/qt/Window.cpp b/src/platform/qt/Window.cpp index 8004534890f..f33463ea38c 100644 --- a/src/platform/qt/Window.cpp +++ b/src/platform/qt/Window.cpp @@ -116,6 +116,10 @@ Window::Window(CoreManager* manager, ConfigController* config, int playerId, QWi i = m_savedScale; } #ifdef USE_SQLITE3 + QPushButton* m_AddDirText = new QPushButton("Click to add a directory to the library", this); + m_AddDirText->connect(m_AddDirText, &QPushButton::clicked, [this] { addDirToLibrary(); + }); + m_AddDirText->setFixedSize(150 ,50); m_libraryView = new LibraryController(nullptr, ConfigController::configDir() + "/library.sqlite3", m_config); ConfigOption* showLibrary = m_config->addOption("showLibrary"); showLibrary->connect([this](const QVariant& value) { diff --git a/src/platform/qt/library/LibraryController.cpp b/src/platform/qt/library/LibraryController.cpp index 2a1ba154654..faf24efbb97 100644 --- a/src/platform/qt/library/LibraryController.cpp +++ b/src/platform/qt/library/LibraryController.cpp @@ -155,7 +155,8 @@ void LibraryController::refresh() { mLibraryListing listing; mLibraryListingInit(&listing, 0); - mLibraryGetEntries(m_library.get(), &listing, 0, 0, nullptr); + size_t entries = mLibraryGetEntries(m_library.get(), &listing, 0, 0, nullptr); + setVisible(!entries == 0); for (size_t i = 0; i < mLibraryListingSize(&listing); i++) { LibraryEntry entry = mLibraryListingGetConstPointer(&listing, i); if (!m_entries.contains(entry.fullpath)) {