Changeset View
Changeset View
Standalone View
Standalone View
src/core-impl/logger/ProxyLogger.h
Show All 22 Lines | |||||
23 | #include <QMutex> | 23 | #include <QMutex> | ||
24 | #include <QPair> | 24 | #include <QPair> | ||
25 | #include <QPointer> | 25 | #include <QPointer> | ||
26 | #include <QQueue> | 26 | #include <QQueue> | ||
27 | #include <QTimer> | 27 | #include <QTimer> | ||
28 | 28 | | |||
29 | #include <KJob> | 29 | #include <KJob> | ||
30 | 30 | | |||
31 | #include <functional> | ||||
32 | | ||||
33 | | ||||
31 | class QNetworkReply; | 34 | class QNetworkReply; | ||
32 | 35 | | |||
33 | typedef QPair<QString, Amarok::Logger::MessageType> LongMessage; | 36 | typedef QPair<QString, Amarok::Logger::MessageType> LongMessage; | ||
34 | 37 | | |||
35 | struct ProgressData | 38 | struct ProgressData | ||
36 | { | 39 | { | ||
37 | QPointer<QObject> sender; | 40 | QPointer<QObject> sender; | ||
41 | QMetaMethod increment; | ||||
42 | QMetaMethod end; | ||||
38 | QPointer<KJob> job; | 43 | QPointer<KJob> job; | ||
39 | QPointer<QNetworkReply> reply; | 44 | QPointer<QNetworkReply> reply; | ||
40 | QString text; | 45 | QString text; | ||
41 | int maximum; | 46 | int maximum; | ||
42 | QPointer<QObject> cancelObject; | 47 | QPointer<QObject> cancelObject; | ||
43 | const char *slot; | 48 | std::function<void ()> function; | ||
44 | Qt::ConnectionType type; | 49 | Qt::ConnectionType type; | ||
45 | }; | 50 | }; | ||
46 | 51 | | |||
47 | /** | 52 | /** | ||
48 | * Proxy implementation for the Amarok::Logger interface. | 53 | * Proxy implementation for the Amarok::Logger interface. | ||
49 | * This class does not notify the user, but forwards the notifications | 54 | * This class does not notify the user, but forwards the notifications | ||
50 | * to a real logger if available. If no logger is available yet, it stores | 55 | * to a real logger if available. If no logger is available yet, it stores | ||
51 | * the notifications until another logger becomes available. | 56 | * the notifications until another logger becomes available. | ||
Show All 11 Lines | |||||
63 | 68 | | |||
64 | public: | 69 | public: | ||
65 | ProxyLogger(); | 70 | ProxyLogger(); | ||
66 | virtual ~ProxyLogger(); | 71 | virtual ~ProxyLogger(); | ||
67 | 72 | | |||
68 | public Q_SLOTS: | 73 | public Q_SLOTS: | ||
69 | virtual void shortMessage( const QString &text ); | 74 | virtual void shortMessage( const QString &text ); | ||
70 | virtual void longMessage( const QString &text, MessageType type ); | 75 | virtual void longMessage( const QString &text, MessageType type ); | ||
71 | virtual void newProgressOperation( KJob *job, const QString &text, QObject *obj = 0, | 76 | virtual void newProgressOperationImpl( KJob * job, const QString & text, QObject * context, | ||
72 | const char *slot = 0, | 77 | const std::function<void ()> &function, Qt::ConnectionType type ) override; | ||
73 | Qt::ConnectionType type = Qt::AutoConnection ); | 78 | virtual void newProgressOperationImpl( QNetworkReply *reply, const QString &text, QObject *obj, | ||
74 | virtual void newProgressOperation( QNetworkReply *reply, const QString &text, QObject *obj = 0, | 79 | const std::function<void ()> &function, | ||
75 | const char *slot = 0, | 80 | Qt::ConnectionType type ) override; | ||
76 | Qt::ConnectionType type = Qt::AutoConnection ); | 81 | virtual void newProgressOperationImpl( QObject *sender, const QMetaMethod &increment, const QMetaMethod &end, | ||
77 | virtual void newProgressOperation( QObject *sender, const QString &text, int maximum = 100, | 82 | const QString &text, int maximum, QObject *obj, | ||
78 | QObject *obj = 0, const char *slot = 0, | 83 | const std::function<void ()> &function, Qt::ConnectionType type ) override; | ||
79 | Qt::ConnectionType type = Qt::AutoConnection ); | | |||
80 | 84 | | |||
81 | /** | 85 | /** | ||
82 | * Set the real logger. | 86 | * Set the real logger. | ||
83 | * The proxy logger will forward notifications to this logger. | 87 | * The proxy logger will forward notifications to this logger. | ||
84 | * @param logger The real logger to use. ProxyLogger does not take ownership of the pointer | 88 | * @param logger The real logger to use. ProxyLogger does not take ownership of the pointer | ||
85 | */ | 89 | */ | ||
86 | void setLogger( Logger *logger ); | 90 | void setLogger( Logger *logger ); | ||
87 | Logger* logger() const; | 91 | Logger* logger() const; | ||
Show All 21 Lines |