mirror of https://github.com/mgba-emu/mgba.git
Add a button to add dir to the library
This commit is contained in:
parent
398df56ac9
commit
572d5ee906
|
@ -116,6 +116,10 @@ Window::Window(CoreManager* manager, ConfigController* config, int playerId, QWi
|
||||||
i = m_savedScale;
|
i = m_savedScale;
|
||||||
}
|
}
|
||||||
#ifdef USE_SQLITE3
|
#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);
|
m_libraryView = new LibraryController(nullptr, ConfigController::configDir() + "/library.sqlite3", m_config);
|
||||||
ConfigOption* showLibrary = m_config->addOption("showLibrary");
|
ConfigOption* showLibrary = m_config->addOption("showLibrary");
|
||||||
showLibrary->connect([this](const QVariant& value) {
|
showLibrary->connect([this](const QVariant& value) {
|
||||||
|
|
|
@ -155,7 +155,8 @@ void LibraryController::refresh() {
|
||||||
|
|
||||||
mLibraryListing listing;
|
mLibraryListing listing;
|
||||||
mLibraryListingInit(&listing, 0);
|
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++) {
|
for (size_t i = 0; i < mLibraryListingSize(&listing); i++) {
|
||||||
LibraryEntry entry = mLibraryListingGetConstPointer(&listing, i);
|
LibraryEntry entry = mLibraryListingGetConstPointer(&listing, i);
|
||||||
if (!m_entries.contains(entry.fullpath)) {
|
if (!m_entries.contains(entry.fullpath)) {
|
||||||
|
|
Loading…
Reference in New Issue