31 #include <QStandardItem> 47 const QString& senderID,
const QString& cat,
const QString& type,
48 const QString&
id,
const QStringList& visualPath,
50 const QString& fullText,
const QString& extendedText)
68 const QString& cat,
const QStringList& types, AN::NotifyFlags flags,
69 bool openConfiguration,
const QList<QPair<QString, ANFieldValue>>&
fields)
73 e.Additional_ [
AN::EF::EventID] =
"org.LC.AdvNotifications.RuleRegister";
77 e.Mime_ +=
"-rule-create";
79 for (
const auto& field :
fields)
80 e.Additional_ [field.first] = QVariant::fromValue (field.second);
96 const auto& e =
MakeEntity (data, QString (), {},
"x-leechcraft/data-filter-request");
100 std::copy_if (handlers.begin (), handlers.end (), std::back_inserter (result),
101 [] (QObject *obj) {
return qobject_cast<
IDataFilter*> (obj); });
106 const QString& location,
119 const QString& text,
Priority priority)
124 "x-leechcraft/notification");
126 result.
Additional_ [
"Priority"] = QVariant::fromValue (priority);
151 const auto& plugins = proxy->GetPluginsManager ()->
152 GetAllCastableTo<IPersistentStoragePlugin*> ();
153 for (
const auto plug : plugins)
155 const auto& storage = plug->RequestStorage ();
159 const auto& value = storage->Get (key);
160 if (!value.isNull ())
167 qint64 done, qint64 total,
const QString& text)
170 if (text.contains (
"%1") && text.contains (
"%2"))
171 item->setText (text.arg (done).arg (total));
173 item->setText (text);
187 for (
const auto item : row)
189 item->setEditable (
false);
The process is running just fine.
Proxy to core entity manager.
constexpr detail::AggregateType< detail::AggregateFunction::Count, Ptr > count
virtual QList< QObject * > GetPossibleHandlers(const LC::Entity &entity)=0
Queries what plugins can handle the given entity.
void SetJobHolderProgress(const QList< QStandardItem *> &row, qint64 done, qint64 total, const QString &text)
Sets the progress values on the given row.
Q_DECL_IMPORT const QString NotifyAudio
Whether an audio notifier should be enabled by default in the rule being created (bool).
Base interface for data filter plugins.
Q_DECL_IMPORT const QString Count
The new total event count (int).
QString Mime_
MIME type of the entity.
TaskParameters Parameters_
Parameters of this task.
QList< QObject * > GetDataFilters(const QVariant &data, IEntityManager *manager)
Returns the data filter plugins that can handle data.
QVariant Entity_
The entity that this object represents.
Entity MakeANCancel(const Entity &event)
Makes an event for canceling another Advanced Notifications event.
Entity MakeEntity(const QVariant &entity, const QString &location, TaskParameters tp, const QString &mime)
Notify by playing back an audio file.
Entity MakeAN(const QString &header, const QString &text, Priority priority, const QString &senderID, const QString &cat, const QString &type, const QString &id, const QStringList &visualPath, int delta, int count, const QString &fullText, const QString &extendedText)
Creates an Advanced Notifications-enabled notify entity.
The column with the progress of the task, like the amount of data downloaded so far or last update...
void InitJobHolderRow(const QList< QStandardItem *> &row)
Q_DECL_IMPORT const QString EventID
The ID of the event (QString).
Q_DECL_IMPORT const QString ExtendedText
The even more detailed text than FullText (QString).
Q_DECL_IMPORT const QString NotifyTransient
Whether a transient notifier should be enabled by default in the rule being created (bool)...
State of a single process represented in a IJobHolder model.
Rule should be triggered only once.
Entity MakeANRule(const QString &title, const QString &senderID, const QString &cat, const QStringList &types, AN::NotifyFlags flags, bool openConfiguration, const QList< QPair< QString, ANFieldValue >> &fields)
Creates an Entity defining an Advanced Notifications rule.
Q_DECL_IMPORT const QString EventCategory
The category of the event (QString).
Q_DECL_IMPORT const QString NotifyPersistent
Whether a persistent notifier should be enabled by default in the rule being created (bool)...
std::shared_ptr< ICoreProxy > ICoreProxy_ptr
Q_DECL_IMPORT const QString IsSingleShot
Whether the created rule should be single-shot (bool).
User should be notified visually via persistent notifications.
QMap< QString, QVariant > Additional_
Additional parameters.
Q_DECL_IMPORT const QString SenderID
The plugin ID of the sender (QByteArray or QString).
Q_DECL_IMPORT const QString FullText
The detailed text of the event (QString).
Q_DECLARE_METATYPE(QVariantList *)
Q_DECL_IMPORT const QString DeltaCount
The change in event count (int).
constexpr detail::MemberPtrs< Ptrs... > fields
Q_DECL_IMPORT const QString EventType
The type of the event (QString).
A message used for inter-plugin communication.
User should be notified visually.
Q_DECL_IMPORT const QString OpenConfiguration
Whether configuration dialog should be opened (bool).
qlonglong Done_
The amount of items already processed or downloaded.
QString Location_
Source or destination.
Entity MakeNotification(const QString &header, const QString &text, Priority priority)
An utility function to make a Entity with notification.
QVariant GetPersistentData(const QByteArray &key, const ICoreProxy_ptr &proxy)
Returns persistent data stored under given key.
Q_DECL_IMPORT const QString CatEventCancel
Event cancel pseudo-category.
Q_DECL_IMPORT const QString VisualPath
Visual path to this event (QStringList).
Describes the state of a process.