mirror of
https://github.com/kiwix/kiwix-desktop.git
synced 2025-09-24 04:32:15 -04:00
Initialize the Library with the libraryDirectory.
If not, the `Library` constructor use `KiwixApp::instance()` to get the kiwixapp but, at this time, the kiwixapp is not yet existing (we are constructing it)
This commit is contained in:
parent
bceebdc94b
commit
2979668c3a
@ -19,7 +19,7 @@ KiwixApp::KiwixApp(int& argc, char *argv[])
|
||||
m_settingsManager(),
|
||||
m_profile(),
|
||||
m_libraryDirectory(findLibraryDirectory()),
|
||||
m_library(),
|
||||
m_library(m_libraryDirectory),
|
||||
mp_downloader(nullptr),
|
||||
mp_manager(nullptr),
|
||||
mp_mainWindow(nullptr),
|
||||
|
@ -22,12 +22,11 @@ class LibraryManipulator: public kiwix::LibraryManipulator {
|
||||
Library* mp_library;
|
||||
};
|
||||
|
||||
Library::Library()
|
||||
Library::Library(const QString& libraryDirectory)
|
||||
: m_libraryDirectory(libraryDirectory)
|
||||
{
|
||||
auto manipulator = LibraryManipulator(this);
|
||||
auto manager = kiwix::Manager(&manipulator);
|
||||
m_libraryDirectory = KiwixApp::instance()->getLibraryDirectory();
|
||||
qInfo() << "Library directory :" << m_libraryDirectory;
|
||||
manager.readFile(appendToDirectory(m_libraryDirectory.toStdString(),"library.xml"), false);
|
||||
manager.readBookmarkFile(appendToDirectory(m_libraryDirectory.toStdString(),"library.bookmarks.xml"));
|
||||
emit(booksChanged());
|
||||
|
@ -25,7 +25,7 @@ class Library : public QObject
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(QStringList bookIds READ getBookIds NOTIFY booksChanged)
|
||||
public:
|
||||
Library();
|
||||
Library(const QString& libraryDirectory);
|
||||
virtual ~Library();
|
||||
QString openBookFromPath(const QString& zimPath);
|
||||
std::shared_ptr<kiwix::Reader> getReader(const QString& zimId);
|
||||
|
Loading…
x
Reference in New Issue
Block a user