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