test
This commit is contained in:
parent
24d92ea735
commit
de4537c6b1
@ -2,20 +2,25 @@
|
||||
|
||||
#include "src/standardserviceentrypoint.h"
|
||||
|
||||
#include "src/gui/formeditstandardaccount.h"
|
||||
#include "src/standardserviceroot.h"
|
||||
#include <librssguard/database/databasequeries.h>
|
||||
#include <librssguard/definitions/definitions.h>
|
||||
#include <librssguard/miscellaneous/application.h>
|
||||
#include "src/gui/formeditstandardaccount.h"
|
||||
#include "src/standardserviceroot.h"
|
||||
|
||||
StandardServiceEntryPoint::StandardServiceEntryPoint(QObject* parent) : QObject(parent) {}
|
||||
|
||||
StandardServiceEntryPoint::~StandardServiceEntryPoint() {
|
||||
qDebugNN << LOGSEC_CORE << "Destructing plugin.";
|
||||
}
|
||||
|
||||
QString StandardServiceEntryPoint::name() const {
|
||||
return QSL("RSS/RDF/ATOM/JSON");
|
||||
}
|
||||
|
||||
QString StandardServiceEntryPoint::description() const {
|
||||
return QObject::tr("This service offers integration with standard online RSS/RDF/ATOM/JSON feeds and podcasts.");
|
||||
return QObject::
|
||||
tr("This service offers integration with standard online RSS/RDF/ATOM/JSON/Sitemap/iCalendar feeds and podcasts.");
|
||||
}
|
||||
|
||||
QString StandardServiceEntryPoint::author() const {
|
||||
@ -42,3 +47,7 @@ QList<ServiceRoot*> StandardServiceEntryPoint::initializeSubtree() const {
|
||||
|
||||
return DatabaseQueries::getAccounts<StandardServiceRoot>(database, code());
|
||||
}
|
||||
|
||||
bool StandardServiceEntryPoint::isDynamicallyLoaded() const {
|
||||
return true;
|
||||
}
|
||||
|
@ -12,6 +12,7 @@ class RSSGUARD_DLLSPEC_EXPORT StandardServiceEntryPoint : public QObject, public
|
||||
|
||||
public:
|
||||
explicit StandardServiceEntryPoint(QObject* parent = nullptr);
|
||||
virtual ~StandardServiceEntryPoint();
|
||||
|
||||
virtual QString name() const;
|
||||
virtual QString description() const;
|
||||
@ -20,6 +21,7 @@ class RSSGUARD_DLLSPEC_EXPORT StandardServiceEntryPoint : public QObject, public
|
||||
virtual QString code() const;
|
||||
virtual ServiceRoot* createNewRoot() const;
|
||||
virtual QList<ServiceRoot*> initializeSubtree() const;
|
||||
virtual bool isDynamicallyLoaded() const;
|
||||
};
|
||||
|
||||
#endif // STANDARDSERVICEENTRYPOINT_H
|
||||
|
@ -300,6 +300,8 @@ void Application::performLogging(QtMsgType type, const QMessageLogContext& conte
|
||||
|
||||
if (!s_disableDebug) {
|
||||
std::cerr << console_message.toStdString() << std::endl;
|
||||
|
||||
std::cerr << QDir::currentPath().toStdString() << std::endl;
|
||||
}
|
||||
|
||||
if (!s_customLogFile.isEmpty()) {
|
||||
|
@ -52,7 +52,17 @@ FeedReader::FeedReader(QObject* parent)
|
||||
|
||||
FeedReader::~FeedReader() {
|
||||
qDebugNN << LOGSEC_CORE << "Destroying FeedReader instance.";
|
||||
qDeleteAll(m_feedServices);
|
||||
|
||||
for (ServiceEntryPoint* service : m_feedServices) {
|
||||
if (!service->isDynamicallyLoaded()) {
|
||||
qDebugNN << LOGSEC_CORE << "Deleting service" << QUOTE_W_SPACE_DOT(service->code());
|
||||
}
|
||||
else {
|
||||
qDebugNN << LOGSEC_CORE << "Service" << QUOTE_W_SPACE(service->code()) << "will be deleted by runtime.";
|
||||
}
|
||||
}
|
||||
// qDeleteAll(m_feedServices);
|
||||
|
||||
qDeleteAll(m_messageFilters);
|
||||
}
|
||||
|
||||
|
@ -27,23 +27,23 @@ QList<ServiceEntryPoint*> PluginFactory::loadPlugins() const {
|
||||
|
||||
while (dir_iter.hasNext()) {
|
||||
dir_iter.next();
|
||||
|
||||
const QFileInfo& plugin_file = dir_iter.fileInfo();
|
||||
|
||||
qApp->addLibraryPath(plugin_file.absolutePath());
|
||||
QDir::setCurrent(plugin_file.absolutePath());
|
||||
|
||||
qDebugNN << LOGSEC_CORE << "Loading plugin"
|
||||
<< QUOTE_W_SPACE_DOT(QDir::toNativeSeparators(plugin_file.absoluteFilePath()));
|
||||
|
||||
QPluginLoader loader(plugin_file.absoluteFilePath());
|
||||
ServiceEntryPoint* plugin_instance = qobject_cast<ServiceEntryPoint*>(loader.instance());
|
||||
|
||||
QDir::setCurrent(backup_current_dir);
|
||||
|
||||
if (plugin_instance == nullptr) {
|
||||
qCriticalNN << LOGSEC_CORE
|
||||
<< "The plugin was not loaded successfully:" << QUOTE_W_SPACE_DOT(loader.errorString());
|
||||
qCriticalNN << LOGSEC_CORE << "The plugin" << QUOTE_W_SPACE(plugin_file.absoluteFilePath())
|
||||
<< "was not loaded successfully:" << QUOTE_W_SPACE_DOT(loader.errorString());
|
||||
}
|
||||
else {
|
||||
qDebugNN << LOGSEC_CORE << "Plugin" << QUOTE_W_SPACE(plugin_instance->code()) << "loaded.";
|
||||
qDebugNN << LOGSEC_CORE << "Plugin" << QUOTE_W_SPACE(plugin_file.absoluteFilePath()) << "loaded.";
|
||||
|
||||
plugins.append(plugin_instance);
|
||||
}
|
||||
|
@ -43,8 +43,14 @@ class RSSGUARD_DLLSPEC ServiceEntryPoint {
|
||||
|
||||
// Icon of the service.
|
||||
virtual QIcon icon() const = 0;
|
||||
|
||||
virtual bool isDynamicallyLoaded() const;
|
||||
};
|
||||
|
||||
inline bool ServiceEntryPoint::isDynamicallyLoaded() const {
|
||||
return false;
|
||||
}
|
||||
|
||||
Q_DECLARE_INTERFACE(ServiceEntryPoint, "io.github.martinrotter.rssguard.serviceentrypoint")
|
||||
|
||||
#endif // SERVICE_H
|
||||
|
Loading…
x
Reference in New Issue
Block a user