1 /* GNUPLOT - QtGnuplotWindow.h */ 2 3 /*[ 4 * Copyright 2009 Jérôme Lodewyck 5 * 6 * Permission to use, copy, and distribute this software and its 7 * documentation for any purpose with or without fee is hereby granted, 8 * provided that the above copyright notice appear in all copies and 9 * that both that copyright notice and this permission notice appear 10 * in supporting documentation. 11 * 12 * Permission to modify the software is granted, but not the right to 13 * distribute the complete modified source code. Modifications are to 14 * be distributed as patches to the released version. Permission to 15 * distribute binaries produced by compiling modified sources is granted, 16 * provided you 17 * 1. distribute the corresponding source modifications from the 18 * released version in the form of a patch file along with the binaries, 19 * 2. add special version identification to distinguish your version 20 * in addition to the base release version number, 21 * 3. provide your name and address as the primary contact for the 22 * support of your modified version, and 23 * 4. retain our contact information in regard to use of the base 24 * software. 25 * Permission to distribute the released version of the source code along 26 * with corresponding source modifications in the form of a patch file is 27 * granted with same provisions 2 through 4 for binary distributions. 28 * 29 * This software is provided "as is" without express or implied warranty 30 * to the extent permitted by applicable law. 31 * 32 * 33 * Alternatively, the contents of this file may be used under the terms of the 34 * GNU General Public License Version 2 or later (the "GPL"), in which case the 35 * provisions of GPL are applicable instead of those above. If you wish to allow 36 * use of your version of this file only under the terms of the GPL and not 37 * to allow others to use your version of this file under the above gnuplot 38 * license, indicate your decision by deleting the provisions above and replace 39 * them with the notice and other provisions required by the GPL. If you do not 40 * delete the provisions above, a recipient may use your version of this file 41 * under either the GPL or the gnuplot license. 42 ]*/ 43 44 #ifndef QTGNUPLOTWINDOW_H 45 #define QTGNUPLOTWINDOW_H 46 47 #include "QtGnuplotEvent.h" 48 49 #include <QMainWindow> 50 51 /* I had to add these in order to link against qt5 rather than qt4 */ 52 #if QT_VERSION >= 0x050000 53 #include <QtWidgets> 54 #endif 55 56 class QLabel; 57 class QStatusBar; 58 class QToolBar; 59 class QtGnuplotWidget; 60 class Ui_settingsDialog; 61 62 class QtGnuplotWindow : public QMainWindow, public QtGnuplotEventReceiver 63 { 64 Q_OBJECT 65 66 public: 67 QtGnuplotWindow(int id, QtGnuplotEventHandler* eventHandler = 0, QWidget* parent = 0); 68 ~QtGnuplotWindow(); 69 70 public: 71 virtual void keyPressEvent(QKeyEvent* event); 72 void processEvent(QtGnuplotEventType type, QDataStream& in); 73 74 public slots: 75 void on_setStatusText(const QString& status); 76 void on_keyAction(); 77 78 private slots: 79 void print(); 80 void exportToPdf(); 81 void exportToImage(); 82 void exportToSvg(); 83 void showSettingsDialog(); 84 void settingsSelectBackgroundColor(); 85 86 private: 87 void createAction(const QString& name, int key, const QString& icon); 88 void loadSettings(); 89 void saveSettings() const; 90 void closeEvent(QCloseEvent *event); 91 92 private: 93 bool m_ctrl; 94 int m_id; 95 bool m_statusBarActive; 96 QStatusBar* m_statusBar; 97 QToolBar* m_toolBar; 98 QToolBar* m_mouseToolBar; 99 QLabel* m_mouseToolBarLabel; 100 QtGnuplotWidget* m_widget; 101 Ui_settingsDialog* m_ui; 102 QColor m_chosenBackgroundColor; 103 quint32 m_pid; 104 }; 105 106 #endif // QTGNUPLOTWINDOW_H 107