QtiPlot  0.9.8.2
EnrichmentDialog.h
Go to the documentation of this file.
00001 /***************************************************************************
00002     File                 : EnrichmentDialog.h
00003     Project              : QtiPlot
00004     --------------------------------------------------------------------
00005     Copyright            : (C) 2008 by Ion Vasilief
00006     Email (use @ for *)  : ion_vasilief*yahoo.fr
00007     Description          : A general properties dialog for the FrameWidget, using article
00008                           "Using a Simple Web Service with Qt" in Qt Quaterly, Issue 23, Q3 2007
00009 
00010  ***************************************************************************/
00011 
00012 /***************************************************************************
00013  *                                                                         *
00014  *  This program is free software; you can redistribute it and/or modify   *
00015  *  it under the terms of the GNU General Public License as published by   *
00016  *  the Free Software Foundation; either version 2 of the License, or      *
00017  *  (at your option) any later version.                                    *
00018  *                                                                         *
00019  *  This program is distributed in the hope that it will be useful,        *
00020  *  but WITHOUT ANY WARRANTY; without even the implied warranty of         *
00021  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          *
00022  *  GNU General Public License for more details.                           *
00023  *                                                                         *
00024  *   You should have received a copy of the GNU General Public License     *
00025  *   along with this program; if not, write to the Free Software           *
00026  *   Foundation, Inc., 51 Franklin Street, Fifth Floor,                    *
00027  *   Boston, MA  02110-1301  USA                                           *
00028  *                                                                         *
00029  ***************************************************************************/
00030 
00031 #ifndef TEXWIDGETDIALOG_H
00032 #define TEXWIDGETDIALOG_H
00033 
00034 #include <QDialog>
00035 #include <QProcess>
00036 
00037 class QComboBox;
00038 class QGroupBox;
00039 class QHttp;
00040 class QLabel;
00041 class QPushButton;
00042 class QTextEdit;
00043 class QTabWidget;
00044 class QCheckBox;
00045 class QLineEdit;
00046 class QCheckBox;
00047 class QSpinBox;
00048 class QSlider;
00049 class QNetworkProxy;
00050 
00051 class Graph;
00052 class FrameWidget;
00053 class LegendWidget;
00054 class ColorButton;
00055 class DoubleSpinBox;
00056 class PatternBox;
00057 class PenStyleBox;
00058 class RectangleWidget;
00059 class TextFormatButtons;
00060 class ApplicationWindow;
00061 
00062 class EnrichmentDialog : public QDialog
00063 {
00064     Q_OBJECT
00065 
00066 public:
00067     enum WidgetType{Frame, Text, Image, Tex, MDIWindow, Ellipse};
00068 
00069     EnrichmentDialog(WidgetType wt, Graph *g, ApplicationWindow *app, QWidget *parent = 0);
00070     ~EnrichmentDialog();
00071 
00072     void setWidget(QWidget *w);
00073     void accept (){return apply();};
00074 
00075 private slots:
00076     void clearForm();
00077     void fetchImage();
00078     void updateForm(bool error);
00079     void apply();
00080     void customButtons(QWidget *w);
00081     void chooseImageFile(const QString& fn = QString::null);
00082     void displayCoordinates(int unit);
00083     void adjustHeight(double width);
00084     void adjustWidth(double height);
00085     void saveImagesInternally(bool save);
00086     void setBestSize();
00087     void frameApplyTo();
00088     void patternApplyTo();
00089     void textFormatApplyTo();
00090     void customFont();
00091     void updateTransparency(int alpha);
00092     void setTextDefaultValues();
00093     void setFrameDefaultValues();
00094     void setRectangleDefaultValues();
00095     void finishedCompiling(int, QProcess::ExitStatus);
00096     void displayCompileError(QProcess::ProcessError error);
00097     void createImage();
00098     void updateCompilerInterface(int);
00099     void updateButtons();
00100 
00101 private:
00102     void initTextPage();
00103     void initEditorPage();
00104     void initImagePage();
00105     void initFramePage();
00106     void initGeometryPage();
00107     void initPatternPage();
00108     void setCoordinates(int unit);
00109     void setFrameTo(FrameWidget *fw);
00110     void setPatternTo(FrameWidget *r);
00111     void setTextFormatTo(LegendWidget *l);
00112     void setText(QTextEdit *editor, const QString & t);
00113     QString createTempTexFile();
00114 
00115     ApplicationWindow *d_app;
00116     QHttp *http;
00117     QProcess *compileProcess, *dvipngProcess;
00118 
00119     QLabel *outputLabel;
00120     QPushButton *clearButton;
00121     QPushButton *updateButton;
00122     QPushButton *cancelButton;
00123     QPushButton *bestSizeButton;
00124     QTextEdit *equationEditor, *textEditBox;
00125     QComboBox *frameBox;
00126     QTabWidget* tabWidget;
00127     QWidget *editPage, *framePage, *geometryPage, *imagePage, *patternPage, *textPage;
00128     ColorButton *frameColorBtn, *backgroundColorBtn, *patternColorBtn;
00129     QCheckBox *boxSaveImagesInternally;
00130     QLineEdit *imagePathBox;
00131     DoubleSpinBox *xBox, *yBox, *widthBox, *heightBox, *boxFrameWidth;
00132     QComboBox *unitBox;
00133     PenStyleBox *boxFrameLineStyle;
00134     QCheckBox *keepAspectBox, *useFrameColorBox;
00135     QSpinBox *boxTransparency, *boxTextAngle;
00136     PatternBox *patternBox;
00137     QPushButton *textApplyToBtn;
00138     QComboBox *frameApplyToBox, *patternApplyToBox, *textApplyToBox;
00139     ColorButton *textColorBtn, *textBackgroundBtn;
00140     QPushButton *textFontBtn;
00141     QSpinBox *boxBackgroundTransparency;
00142     QSlider *transparencySlider, *fillTransparencySlider;
00143     TextFormatButtons *formatButtons, *texFormatButtons;
00144     QPushButton *textDefaultBtn, *frameDefaultBtn, *rectangleDefaultBtn;
00145     QCheckBox *autoUpdateTextBox, *texOutputBox;
00146     QComboBox *texCompilerBox;
00147     QComboBox* attachToBox;
00148 
00149     QFont textFont;
00150 
00151     Graph *d_plot;
00152     QWidget *d_widget;
00153     WidgetType d_widget_type;
00154     double aspect_ratio;
00155 };
00156 
00157 #endif