|
Packit |
0986c0 |
/* GNUPLOT - QtGnuplotInstance.h */
|
|
Packit |
0986c0 |
|
|
Packit |
0986c0 |
/*[
|
|
Packit |
0986c0 |
* Copyright 2009 Jérôme Lodewyck
|
|
Packit |
0986c0 |
*
|
|
Packit |
0986c0 |
* Permission to use, copy, and distribute this software and its
|
|
Packit |
0986c0 |
* documentation for any purpose with or without fee is hereby granted,
|
|
Packit |
0986c0 |
* provided that the above copyright notice appear in all copies and
|
|
Packit |
0986c0 |
* that both that copyright notice and this permission notice appear
|
|
Packit |
0986c0 |
* in supporting documentation.
|
|
Packit |
0986c0 |
*
|
|
Packit |
0986c0 |
* Permission to modify the software is granted, but not the right to
|
|
Packit |
0986c0 |
* distribute the complete modified source code. Modifications are to
|
|
Packit |
0986c0 |
* be distributed as patches to the released version. Permission to
|
|
Packit |
0986c0 |
* distribute binaries produced by compiling modified sources is granted,
|
|
Packit |
0986c0 |
* provided you
|
|
Packit |
0986c0 |
* 1. distribute the corresponding source modifications from the
|
|
Packit |
0986c0 |
* released version in the form of a patch file along with the binaries,
|
|
Packit |
0986c0 |
* 2. add special version identification to distinguish your version
|
|
Packit |
0986c0 |
* in addition to the base release version number,
|
|
Packit |
0986c0 |
* 3. provide your name and address as the primary contact for the
|
|
Packit |
0986c0 |
* support of your modified version, and
|
|
Packit |
0986c0 |
* 4. retain our contact information in regard to use of the base
|
|
Packit |
0986c0 |
* software.
|
|
Packit |
0986c0 |
* Permission to distribute the released version of the source code along
|
|
Packit |
0986c0 |
* with corresponding source modifications in the form of a patch file is
|
|
Packit |
0986c0 |
* granted with same provisions 2 through 4 for binary distributions.
|
|
Packit |
0986c0 |
*
|
|
Packit |
0986c0 |
* This software is provided "as is" without express or implied warranty
|
|
Packit |
0986c0 |
* to the extent permitted by applicable law.
|
|
Packit |
0986c0 |
*
|
|
Packit |
0986c0 |
*
|
|
Packit |
0986c0 |
* Alternatively, the contents of this file may be used under the terms of the
|
|
Packit |
0986c0 |
* GNU General Public License Version 2 or later (the "GPL"), in which case the
|
|
Packit |
0986c0 |
* provisions of GPL are applicable instead of those above. If you wish to allow
|
|
Packit |
0986c0 |
* use of your version of this file only under the terms of the GPL and not
|
|
Packit |
0986c0 |
* to allow others to use your version of this file under the above gnuplot
|
|
Packit |
0986c0 |
* license, indicate your decision by deleting the provisions above and replace
|
|
Packit |
0986c0 |
* them with the notice and other provisions required by the GPL. If you do not
|
|
Packit |
0986c0 |
* delete the provisions above, a recipient may use your version of this file
|
|
Packit |
0986c0 |
* under either the GPL or the gnuplot license.
|
|
Packit |
0986c0 |
]*/
|
|
Packit |
0986c0 |
|
|
Packit |
0986c0 |
#ifndef QTGNUPLOTINSTANCE_H
|
|
Packit |
0986c0 |
#define QTGNUPLOTINSTANCE_H
|
|
Packit |
0986c0 |
|
|
Packit |
0986c0 |
#include <QtCore>
|
|
Packit |
0986c0 |
|
|
Packit |
0986c0 |
class QtGnuplotWidget;
|
|
Packit |
0986c0 |
|
|
Packit |
0986c0 |
class QtGnuplotInstance : public QObject
|
|
Packit |
0986c0 |
{
|
|
Packit |
0986c0 |
Q_OBJECT
|
|
Packit |
0986c0 |
|
|
Packit |
0986c0 |
public:
|
|
Packit |
0986c0 |
QtGnuplotInstance(QtGnuplotWidget* widget = 0, QString gnuplotPath = "gnuplot");
|
|
Packit |
0986c0 |
~QtGnuplotInstance();
|
|
Packit |
0986c0 |
|
|
Packit |
0986c0 |
public:
|
|
Packit |
0986c0 |
/// Redirect the instance plotting to widget @p widget
|
|
Packit |
0986c0 |
void setWidget(QtGnuplotWidget* widget);
|
|
Packit |
0986c0 |
/// Returns the widget to which the instance plots
|
|
Packit |
0986c0 |
QtGnuplotWidget* widget();
|
|
Packit |
0986c0 |
/// Send the given command to gnuplot
|
|
Packit |
0986c0 |
void exec(const QByteArray& command);
|
|
Packit |
0986c0 |
/// Send the given command to gnuplot and return the result string. Timeout after @p msecs milliseconds
|
|
Packit |
0986c0 |
QByteArray execAndRead(const QByteArray& command, int msecs = 30000);
|
|
Packit |
0986c0 |
|
|
Packit |
0986c0 |
signals:
|
|
Packit |
0986c0 |
/// Emitted when gnuplot sends data through it standards outputs
|
|
Packit |
0986c0 |
void gnuplotOutput(const QString& output);
|
|
Packit |
0986c0 |
|
|
Packit |
0986c0 |
private slots:
|
|
Packit |
0986c0 |
void gnuplotDataReady();
|
|
Packit |
0986c0 |
|
|
Packit |
0986c0 |
private:
|
|
Packit |
0986c0 |
QtGnuplotWidget* m_widget;
|
|
Packit |
0986c0 |
QProcess m_gnuplot;
|
|
Packit |
0986c0 |
};
|
|
Packit |
0986c0 |
|
|
Packit |
0986c0 |
/// Overloaded from QtGnuplotInstance::exec
|
|
Packit |
0986c0 |
QtGnuplotInstance& operator<<(QtGnuplotInstance& instance, const QString& command);
|
|
Packit |
0986c0 |
/// Overloaded from QtGnuplotInstance::exec
|
|
Packit |
0986c0 |
QtGnuplotInstance& operator<<(QtGnuplotInstance& instance, const QVector<QPointF>& points);
|
|
Packit |
0986c0 |
|
|
Packit |
0986c0 |
#endif // QTGNUPLOTINSTANCE_H
|