40 lines
867 B
C++
40 lines
867 B
C++
#ifndef PLUMBER_H
|
|
#define PLUMBER_H
|
|
|
|
#include <QObject>
|
|
#include <QProcess>
|
|
#if QT_VERSION_MAJOR >= 6
|
|
#include <QQmlEngine>
|
|
#endif
|
|
|
|
// Plumber wraps plan9port's plumb command for context-aware actions.
|
|
// B3-click on text → plumber routes to appropriate handler (editor, browser, etc.)
|
|
class Plumber : public QObject
|
|
{
|
|
Q_OBJECT
|
|
#if QT_VERSION_MAJOR >= 6
|
|
QML_ELEMENT
|
|
QML_SINGLETON
|
|
#endif
|
|
|
|
public:
|
|
explicit Plumber(QObject *parent = nullptr);
|
|
|
|
// Plumb text to the plan9port plumber daemon
|
|
Q_INVOKABLE void plumb(const QString &text);
|
|
|
|
// Plumb with explicit source/destination
|
|
Q_INVOKABLE void plumbTo(const QString &text, const QString &dst);
|
|
|
|
// Check if plumber is available
|
|
Q_INVOKABLE bool available() const;
|
|
|
|
signals:
|
|
void plumbError(const QString &error);
|
|
|
|
private:
|
|
QString m_plumbPath;
|
|
};
|
|
|
|
#endif // PLUMBER_H
|