Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a button to add dir to the library #3144

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/platform/qt/Window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
3 changes: 2 additions & 1 deletion src/platform/qt/library/LibraryController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down