mirror of
https://github.com/arcan1s/awesome-widgets.git
synced 2025-07-14 06:15:49 +00:00
add socket activation for extensions (#118)
Option `X-AW-Socket` is used. Any message received by this socket will trigger extension update. If the option is set, `X-AW-Interval` will be ignored
This commit is contained in:
@ -22,6 +22,8 @@
|
||||
#include <QVariant>
|
||||
|
||||
|
||||
class QLocalServer;
|
||||
|
||||
class AbstractExtItem : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
@ -32,6 +34,7 @@ class AbstractExtItem : public QDialog
|
||||
Q_PROPERTY(int interval READ interval WRITE setInterval)
|
||||
Q_PROPERTY(QString name READ name WRITE setName)
|
||||
Q_PROPERTY(int number READ number WRITE setNumber)
|
||||
Q_PROPERTY(QString socket READ socket WRITE setSocket)
|
||||
Q_PROPERTY(QString uniq READ uniq)
|
||||
|
||||
public:
|
||||
@ -51,6 +54,7 @@ public:
|
||||
bool isActive() const;
|
||||
QString name() const;
|
||||
int number() const;
|
||||
QString socket() const;
|
||||
QString tag(const QString _type) const;
|
||||
virtual QString uniq() const = 0;
|
||||
// set methods
|
||||
@ -60,17 +64,24 @@ public:
|
||||
void setInterval(const int _interval = 1);
|
||||
void setName(const QString _name = QString("none"));
|
||||
void setNumber(int _number = -1);
|
||||
void setSocket(const QString _socket = QString(""));
|
||||
|
||||
signals:
|
||||
void dataReceived(const QVariantHash &data);
|
||||
void socketActivated();
|
||||
|
||||
public slots:
|
||||
virtual void deinitSocket();
|
||||
virtual void initSocket();
|
||||
virtual void readConfiguration();
|
||||
virtual QVariantHash run() = 0;
|
||||
virtual int showConfiguration(const QVariant args = QVariant()) = 0;
|
||||
bool tryDelete() const;
|
||||
virtual void writeConfiguration() const;
|
||||
|
||||
private slots:
|
||||
void newConnectionReceived();
|
||||
|
||||
private:
|
||||
QString m_fileName = QString("/dev/null");
|
||||
virtual void translate() = 0;
|
||||
@ -81,6 +92,8 @@ private:
|
||||
int m_interval = 1;
|
||||
QString m_name = QString("none");
|
||||
int m_number = -1;
|
||||
QLocalServer *m_socket = nullptr;
|
||||
QString m_socketFile = QString("");
|
||||
};
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user