Skip to content
This repository was archived by the owner on May 30, 2023. It is now read-only.

Add context string variable to phantom #4

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions src/phantomjs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ class Phantom: public QObject
Q_PROPERTY(QString userAgent READ userAgent WRITE setUserAgent)
Q_PROPERTY(QVariantMap version READ version)
Q_PROPERTY(QVariantMap viewportSize READ viewportSize WRITE setViewportSize)
Q_PROPERTY(QString context READ context WRITE setContext)

public:
Phantom(QObject *parent = 0);
Expand All @@ -125,6 +126,10 @@ class Phantom: public QObject
void setViewportSize(const QVariantMap &size);
QVariantMap viewportSize() const;

void setContext(const QString &value);
QString context() const;


public slots:
void exit(int code = 0);
void open(const QString &address);
Expand All @@ -142,6 +147,7 @@ private slots:
int m_returnValue;
QString m_script;
QString m_state;
QString m_context;
};

Phantom::Phantom(QObject *parent)
Expand Down Expand Up @@ -296,6 +302,16 @@ QString Phantom::state() const
return m_state;
}

void Phantom::setContext(const QString &value)
{
m_context = value;
}

QString Phantom::context() const
{
return m_context;
}

void Phantom::setUserAgent(const QString &ua)
{
m_page.m_userAgent = ua;
Expand Down