mirror of
https://github.com/YACReader/yacreader
synced 2025-05-25 18:00:46 -04:00
Fix LibraryCreator instantiation in yacreaderlibraryserver
This commit is contained in:
parent
b364501a2c
commit
555540b85d
@ -5,8 +5,8 @@
|
||||
#include "library_creator.h"
|
||||
#include "yacreader_libraries.h"
|
||||
|
||||
ConsoleUILibraryCreator::ConsoleUILibraryCreator(QObject *parent)
|
||||
: QObject(parent), numComicsProcessed(0)
|
||||
ConsoleUILibraryCreator::ConsoleUILibraryCreator(QSettings *settings, QObject *parent)
|
||||
: QObject(parent), numComicsProcessed(0), settings(settings)
|
||||
{
|
||||
}
|
||||
|
||||
@ -19,7 +19,7 @@ void ConsoleUILibraryCreator::createLibrary(const QString &name, const QString &
|
||||
}
|
||||
|
||||
QEventLoop eventLoop;
|
||||
LibraryCreator *libraryCreator = new LibraryCreator();
|
||||
LibraryCreator *libraryCreator = new LibraryCreator(settings);
|
||||
QString cleanPath = QDir::cleanPath(pathDir.absolutePath());
|
||||
|
||||
YACReaderLibraries yacreaderLibraries;
|
||||
@ -56,7 +56,7 @@ void ConsoleUILibraryCreator::updateLibrary(const QString &path)
|
||||
}
|
||||
|
||||
QEventLoop eventLoop;
|
||||
LibraryCreator *libraryCreator = new LibraryCreator();
|
||||
LibraryCreator *libraryCreator = new LibraryCreator(settings);
|
||||
QString cleanPath = QDir::cleanPath(pathDir.absolutePath());
|
||||
|
||||
libraryCreator->updateLibrary(cleanPath, QDir::cleanPath(pathDir.absolutePath() + "/.yacreaderlibrary"));
|
||||
|
@ -7,7 +7,7 @@ class ConsoleUILibraryCreator : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit ConsoleUILibraryCreator(QObject *parent = 0);
|
||||
explicit ConsoleUILibraryCreator(QSettings *settings, QObject *parent = 0);
|
||||
void createLibrary(const QString &name, const QString &path);
|
||||
void updateLibrary(const QString &path);
|
||||
void addExistingLibrary(const QString &name, const QString &path);
|
||||
@ -15,6 +15,7 @@ public:
|
||||
|
||||
private:
|
||||
uint numComicsProcessed;
|
||||
QSettings *settings;
|
||||
signals:
|
||||
|
||||
public slots:
|
||||
|
@ -124,6 +124,9 @@ int main(int argc, char **argv)
|
||||
return 0;
|
||||
}
|
||||
|
||||
QSettings *settings = new QSettings(YACReader::getSettingsPath() + "/" + QCoreApplication::applicationName() + ".ini", QSettings::IniFormat);
|
||||
settings->beginGroup("libraryConfig");
|
||||
|
||||
if (command == "start") {
|
||||
parser.clearPositionalArguments();
|
||||
parser.addPositionalArgument("start", "Start YACReaderLibraryServer");
|
||||
@ -190,9 +193,6 @@ int main(int argc, char **argv)
|
||||
|
||||
QLOG_INFO() << "YACReaderLibrary starting";
|
||||
|
||||
QSettings *settings = new QSettings(YACReader::getSettingsPath() + "/" + QCoreApplication::applicationName() + ".ini", QSettings::IniFormat);
|
||||
settings->beginGroup("libraryConfig");
|
||||
|
||||
// server
|
||||
YACReaderHttpServer *httpServer = new YACReaderHttpServer();
|
||||
if (parser.isSet("port")) {
|
||||
@ -244,7 +244,7 @@ int main(int argc, char **argv)
|
||||
return 0;
|
||||
}
|
||||
|
||||
ConsoleUILibraryCreator *libraryCreatorUI = new ConsoleUILibraryCreator;
|
||||
ConsoleUILibraryCreator *libraryCreatorUI = new ConsoleUILibraryCreator(settings);
|
||||
libraryCreatorUI->createLibrary(args.at(1), args.at(2));
|
||||
|
||||
return 0;
|
||||
@ -260,7 +260,7 @@ int main(int argc, char **argv)
|
||||
return 0;
|
||||
}
|
||||
|
||||
ConsoleUILibraryCreator *libraryCreatorUI = new ConsoleUILibraryCreator;
|
||||
ConsoleUILibraryCreator *libraryCreatorUI = new ConsoleUILibraryCreator(settings);
|
||||
libraryCreatorUI->updateLibrary(args.at(1));
|
||||
|
||||
return 0;
|
||||
@ -277,7 +277,7 @@ int main(int argc, char **argv)
|
||||
return 0;
|
||||
}
|
||||
|
||||
ConsoleUILibraryCreator *libraryCreatorUI = new ConsoleUILibraryCreator;
|
||||
ConsoleUILibraryCreator *libraryCreatorUI = new ConsoleUILibraryCreator(settings);
|
||||
libraryCreatorUI->addExistingLibrary(args.at(1), args.at(2));
|
||||
|
||||
return 0;
|
||||
@ -293,7 +293,7 @@ int main(int argc, char **argv)
|
||||
return 0;
|
||||
}
|
||||
|
||||
ConsoleUILibraryCreator *libraryCreatorUI = new ConsoleUILibraryCreator;
|
||||
ConsoleUILibraryCreator *libraryCreatorUI = new ConsoleUILibraryCreator(settings);
|
||||
libraryCreatorUI->removeLibrary(args.at(1));
|
||||
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user