Some beginning work, created some service entry points.

This commit is contained in:
Martin Rotter 2015-10-30 08:32:02 +01:00
parent f911773ee7
commit 6e22510e7c
16 changed files with 458 additions and 4 deletions

View file

@ -415,6 +415,10 @@ set(APP_SOURCES
src/core/recyclebin.cpp src/core/recyclebin.cpp
src/core/feedsselection.cpp src/core/feedsselection.cpp
# ABSTRACT service sources.
src/services/abstract/serviceentrypoint.cpp
src/services/abstract/serviceroot.cpp
# STANDARD feed service sources. # STANDARD feed service sources.
src/services/standard/standardfeed.cpp src/services/standard/standardfeed.cpp
src/services/standard/standardfeedsimportexportmodel.cpp src/services/standard/standardfeedsimportexportmodel.cpp
@ -422,6 +426,10 @@ set(APP_SOURCES
src/services/standard/gui/formstandardcategorydetails.cpp src/services/standard/gui/formstandardcategorydetails.cpp
src/services/standard/gui/formstandardfeeddetails.cpp src/services/standard/gui/formstandardfeeddetails.cpp
src/services/standard/gui/formstandardimportexport.cpp src/services/standard/gui/formstandardimportexport.cpp
src/services/standard/standardserviceentrypoint.cpp
# TT-RSS feed service sources.
src/services/tt-rss/ttrssserviceentrypoint.cpp
# NETWORK-WEB sources. # NETWORK-WEB sources.
src/network-web/basenetworkaccessmanager.cpp src/network-web/basenetworkaccessmanager.cpp

View file

@ -19,7 +19,6 @@
#define ROOTITEM_H #define ROOTITEM_H
#include <QIcon> #include <QIcon>
#include <QDateTime> #include <QDateTime>
#include <QFont> #include <QFont>

View file

@ -561,7 +561,7 @@ void FeedMessageViewer::updateFeeds(QList<StandardFeed *> feeds) {
m_feedDownloaderThread = new QThread(); m_feedDownloaderThread = new QThread();
// Downloader setup. // Downloader setup.
qRegisterMetaType<QList<StandardFeed*> >("QList<Feed*>"); qRegisterMetaType<QList<StandardFeed*> >("QList<StandardFeed*>");
m_feedDownloader->moveToThread(m_feedDownloaderThread); m_feedDownloader->moveToThread(m_feedDownloaderThread);
connect(this, SIGNAL(feedsUpdateRequested(QList<StandardFeed*>)), m_feedDownloader, SLOT(updateFeeds(QList<StandardFeed*>))); connect(this, SIGNAL(feedsUpdateRequested(QList<StandardFeed*>)), m_feedDownloader, SLOT(updateFeeds(QList<StandardFeed*>)));

View file

@ -28,6 +28,9 @@
#include "exceptions/applicationexception.h" #include "exceptions/applicationexception.h"
#include "adblock/adblockmanager.h" #include "adblock/adblockmanager.h"
#include "services/standard/standardserviceentrypoint.h"
#include "services/tt-rss/ttrssserviceentrypoint.h"
#include <QSessionManager> #include <QSessionManager>
#include <QThread> #include <QThread>
#include <QProcess> #include <QProcess>
@ -35,7 +38,7 @@
Application::Application(const QString &id, int &argc, char **argv) Application::Application(const QString &id, int &argc, char **argv)
: QtSingleApplication(id, argc, argv), : QtSingleApplication(id, argc, argv),
m_updateFeedsLock(NULL), m_userActions(QList<QAction*>()), m_mainForm(NULL), m_updateFeedsLock(NULL), m_feedServices(QList<ServiceEntryPoint*>()), m_userActions(QList<QAction*>()), m_mainForm(NULL),
m_trayIcon(NULL), m_settings(NULL), m_system(NULL), m_skins(NULL), m_trayIcon(NULL), m_settings(NULL), m_system(NULL), m_skins(NULL),
m_localization(NULL), m_icons(NULL), m_database(NULL), m_downloadManager(NULL), m_shouldRestart(false), m_localization(NULL), m_icons(NULL), m_database(NULL), m_downloadManager(NULL), m_shouldRestart(false),
m_notification(NULL) { m_notification(NULL) {
@ -46,6 +49,17 @@ Application::Application(const QString &id, int &argc, char **argv)
Application::~Application() { Application::~Application() {
delete m_updateFeedsLock; delete m_updateFeedsLock;
qDeleteAll(m_feedServices);
}
QList<ServiceEntryPoint*> Application::feedServices() {
if (m_feedServices.isEmpty()) {
// NOTE: All installed services create their entry points here.
m_feedServices.append(new StandardServiceEntryPoint());
m_feedServices.append(new TtRssServiceEntryPoint());
}
return m_feedServices;
} }
QList<QAction*> Application::userActions() { QList<QAction*> Application::userActions() {

View file

@ -30,6 +30,7 @@
#include "gui/systemtrayicon.h" #include "gui/systemtrayicon.h"
#include "gui/notifications/notification.h" #include "gui/notifications/notification.h"
#include "network-web/downloadmanager.h" #include "network-web/downloadmanager.h"
#include "services/abstract/serviceentrypoint.h"
#include <QList> #include <QList>
@ -54,6 +55,8 @@ class Application : public QtSingleApplication {
explicit Application(const QString &id, int &argc, char **argv); explicit Application(const QString &id, int &argc, char **argv);
virtual ~Application(); virtual ~Application();
QList<ServiceEntryPoint*> feedServices();
QList<QAction*> userActions(); QList<QAction*> userActions();
inline SystemFactory *system() { inline SystemFactory *system() {
@ -183,6 +186,7 @@ class Application : public QtSingleApplication {
// tries to lock the lock for writing), then no other // tries to lock the lock for writing), then no other
// action will be allowed to lock for reading. // action will be allowed to lock for reading.
Mutex *m_updateFeedsLock; Mutex *m_updateFeedsLock;
QList<ServiceEntryPoint*> m_feedServices;
QList<QAction*> m_userActions; QList<QAction*> m_userActions;
FormMain *m_mainForm; FormMain *m_mainForm;
SystemTrayIcon *m_trayIcon; SystemTrayIcon *m_trayIcon;

25
src/services/abstract/feed.cpp Executable file
View file

@ -0,0 +1,25 @@
// This file is part of RSS Guard.
//
// Copyright (C) 2011-2015 by Martin Rotter <rotter.martinos@gmail.com>
//
// RSS Guard is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// RSS Guard is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with RSS Guard. If not, see <http://www.gnu.org/licenses/>.
#include "services/abstract/feed.h"
Feed::Feed() {
}
Feed::~Feed() {
}

30
src/services/abstract/feed.h Executable file
View file

@ -0,0 +1,30 @@
// This file is part of RSS Guard.
//
// Copyright (C) 2011-2015 by Martin Rotter <rotter.martinos@gmail.com>
//
// RSS Guard is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// RSS Guard is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with RSS Guard. If not, see <http://www.gnu.org/licenses/>.
#ifndef FEED_H
#define FEED_H
#include "core/rootitem.h"
class Feed : public RootItem {
public:
explicit Feed();
virtual ~Feed();
};
#endif // FEED_H

View file

@ -0,0 +1,25 @@
// This file is part of RSS Guard.
//
// Copyright (C) 2011-2015 by Martin Rotter <rotter.martinos@gmail.com>
//
// RSS Guard is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// RSS Guard is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with RSS Guard. If not, see <http://www.gnu.org/licenses/>.
#include "services/abstract/serviceentrypoint.h"
ServiceEntryPoint::ServiceEntryPoint() {
}
ServiceEntryPoint::~ServiceEntryPoint() {
}

View file

@ -0,0 +1,72 @@
// This file is part of RSS Guard.
//
// Copyright (C) 2011-2015 by Martin Rotter <rotter.martinos@gmail.com>
//
// RSS Guard is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// RSS Guard is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with RSS Guard. If not, see <http://www.gnu.org/licenses/>.
#ifndef SERVICE_H
#define SERVICE_H
#include <QDialog>
#include <QIcon>
#include <QString>
// TOP LEVEL class which provides basic information about the "service"
class ServiceEntryPoint {
public:
// Constructors.
explicit ServiceEntryPoint();
virtual ~ServiceEntryPoint();
// Must this service account be activated by default?
// NOTE: This is true particularly for "standard" service
// which operates with normal RSS/ATOM feeds.
virtual bool isDefaultService() = 0;
// Can this service account be added just once?
// NOTE: This is true particularly for "standard" service
// which operates with normal RSS/ATOM feeds.
virtual bool isSingleInstanceService() = 0;
// Can this service account be added by user via GUI?
// NOTE: This is true particularly for "standard" service
// which operates with normal RSS/ATOM feeds.
virtual bool canBeAdded() = 0;
// Can this service account by deleted by user via GUI?
// NOTE: This is false particularly for "standard" service
// which operates with normal RSS/ATOM feeds.
virtual bool canBeDeleted() = 0;
// Can properties of this service account be edited by user via GUI?
virtual bool canBeEdited() = 0;
// Human readable service name, for example "TT-RSS".
virtual QString name() = 0;
// Human readable service description, for example "Services which offers TT-RSS integration.".
virtual QString description() = 0;
// Version of the service, using of semantic versioning is recommended.
virtual QString version() = 0;
// Author of the service.
virtual QString author() = 0;
// Icon of the service.
virtual QIcon icon() = 0;
};
#endif // SERVICE_H

View file

@ -0,0 +1,26 @@
// This file is part of RSS Guard.
//
// Copyright (C) 2011-2015 by Martin Rotter <rotter.martinos@gmail.com>
//
// RSS Guard is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// RSS Guard is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with RSS Guard. If not, see <http://www.gnu.org/licenses/>.
#include "services/abstract/serviceroot.h"
ServiceRoot::ServiceRoot() {
}
ServiceRoot::~ServiceRoot() {
}

View file

@ -0,0 +1,29 @@
// This file is part of RSS Guard.
//
// Copyright (C) 2011-2015 by Martin Rotter <rotter.martinos@gmail.com>
//
// RSS Guard is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// RSS Guard is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with RSS Guard. If not, see <http://www.gnu.org/licenses/>.
#ifndef SERVICEROOT_H
#define SERVICEROOT_H
// THIS IS the root node of the service.
// TODO: Inherit proper base root class for this.
class ServiceRoot {
public:
explicit ServiceRoot();
virtual ~ServiceRoot();
};
#endif // SERVICEROOT_H

View file

@ -34,7 +34,7 @@ class FeedsModel;
// Represents BASE class for feeds contained in FeedsModel. // Represents BASE class for feeds contained in FeedsModel.
// NOTE: This class should be derived to create PARTICULAR feed types. // NOTE: This class should be derived to create PARTICULAR feed types.
class StandardFeed : public RootItem { class StandardFeed : public RootItem {
Q_DECLARE_TR_FUNCTIONS(Feed) Q_DECLARE_TR_FUNCTIONS(StandardFeed)
public: public:
// Describes possible types of feeds. // Describes possible types of feeds.

View file

@ -0,0 +1,69 @@
// This file is part of RSS Guard.
//
// Copyright (C) 2011-2015 by Martin Rotter <rotter.martinos@gmail.com>
//
// RSS Guard is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// RSS Guard is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with RSS Guard. If not, see <http://www.gnu.org/licenses/>.
#include "services/standard/standardserviceentrypoint.h"
#include "definitions/definitions.h"
#include "miscellaneous/application.h"
StandardServiceEntryPoint::StandardServiceEntryPoint() {
}
StandardServiceEntryPoint::~StandardServiceEntryPoint() {
}
bool StandardServiceEntryPoint::isDefaultService() {
return true;
}
bool StandardServiceEntryPoint::isSingleInstanceService() {
return true;
}
bool StandardServiceEntryPoint::canBeAdded() {
return false;
}
bool StandardServiceEntryPoint::canBeDeleted() {
return false;
}
bool StandardServiceEntryPoint::canBeEdited() {
return false;
}
QString StandardServiceEntryPoint::name() {
return QSL("Standard (RSS/RDF/ATOM)");
}
QString StandardServiceEntryPoint::description() {
return QSL("This service offers integration with standard online RSS/RDF/ATOM feeds and podcasts.");
}
QString StandardServiceEntryPoint::version() {
return APP_VERSION;
}
QString StandardServiceEntryPoint::author() {
return APP_AUTHOR;
}
QIcon StandardServiceEntryPoint::icon() {
return QIcon(APP_ICON_PATH);
}

View file

@ -0,0 +1,41 @@
// This file is part of RSS Guard.
//
// Copyright (C) 2011-2015 by Martin Rotter <rotter.martinos@gmail.com>
//
// RSS Guard is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// RSS Guard is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with RSS Guard. If not, see <http://www.gnu.org/licenses/>.
#ifndef STANDARDSERVICEENTRYPOINT_H
#define STANDARDSERVICEENTRYPOINT_H
#include "services/abstract/serviceentrypoint.h"
class StandardServiceEntryPoint : public ServiceEntryPoint {
public:
explicit StandardServiceEntryPoint();
virtual ~StandardServiceEntryPoint();
bool isDefaultService();
bool isSingleInstanceService();
bool canBeAdded();
bool canBeDeleted();
bool canBeEdited();
QString name();
QString description();
QString version();
QString author();
QIcon icon();
};
#endif // STANDARDSERVICEENTRYPOINT_H

View file

@ -0,0 +1,70 @@
// This file is part of RSS Guard.
//
// Copyright (C) 2011-2015 by Martin Rotter <rotter.martinos@gmail.com>
//
// RSS Guard is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// RSS Guard is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with RSS Guard. If not, see <http://www.gnu.org/licenses/>.
#include "services/tt-rss/ttrssserviceentrypoint.h"
#include "definitions/definitions.h"
#include "miscellaneous/application.h"
TtRssServiceEntryPoint::TtRssServiceEntryPoint(){
}
TtRssServiceEntryPoint::~TtRssServiceEntryPoint() {
}
bool TtRssServiceEntryPoint::isDefaultService() {
return false;
}
bool TtRssServiceEntryPoint::isSingleInstanceService() {
return false;
}
bool TtRssServiceEntryPoint::canBeAdded() {
return true;
}
bool TtRssServiceEntryPoint::canBeDeleted() {
return true;
}
bool TtRssServiceEntryPoint::canBeEdited() {
return true;
}
QString TtRssServiceEntryPoint::name() {
return QSL("TT-RSS (TinyTiny RSS)");
}
QString TtRssServiceEntryPoint::description() {
return QSL("This service offers integration with TinyTiny RSS.");
}
QString TtRssServiceEntryPoint::version() {
return QSL("0.0.1");
}
QString TtRssServiceEntryPoint::author() {
return APP_AUTHOR;
}
QIcon TtRssServiceEntryPoint::icon() {
return QIcon(APP_ICON_PATH);
}

View file

@ -0,0 +1,42 @@
// This file is part of RSS Guard.
//
// Copyright (C) 2011-2015 by Martin Rotter <rotter.martinos@gmail.com>
//
// RSS Guard is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// RSS Guard is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with RSS Guard. If not, see <http://www.gnu.org/licenses/>.
#ifndef TTRSSSERVICEENTRYPOINT_H
#define TTRSSSERVICEENTRYPOINT_H
#include "services/abstract/serviceentrypoint.h"
class TtRssServiceEntryPoint : public ServiceEntryPoint {
public:
explicit TtRssServiceEntryPoint();
virtual ~TtRssServiceEntryPoint();
bool isDefaultService();
bool isSingleInstanceService();
bool canBeAdded();
bool canBeDeleted();
bool canBeEdited();
QString name();
QString description();
QString version();
QString author();
QIcon icon();
};
#endif // TTRSSSERVICEENTRYPOINT_H