QtiPlot 0.9.7.3
|
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 QNetworkProxy; 00049 00050 class Graph; 00051 class FrameWidget; 00052 class LegendWidget; 00053 class ColorButton; 00054 class DoubleSpinBox; 00055 class PatternBox; 00056 class PenStyleBox; 00057 class RectangleWidget; 00058 class TextFormatButtons; 00059 class ApplicationWindow; 00060 00061 class EnrichmentDialog : public QDialog 00062 { 00063 Q_OBJECT 00064 00065 public: 00066 enum WidgetType{Frame, Text, Image, Tex, MDIWindow, Ellipse}; 00067 00068 EnrichmentDialog(WidgetType wt, Graph *g, ApplicationWindow *app, QWidget *parent = 0); 00069 ~EnrichmentDialog(); 00070 00071 void setWidget(QWidget *w); 00072 void accept (){return apply();}; 00073 00074 private slots: 00075 void clearForm(); 00076 void fetchImage(); 00077 void updateForm(bool error); 00078 void apply(); 00079 void customButtons(QWidget *w); 00080 void chooseImageFile(const QString& fn = QString::null); 00081 void displayCoordinates(int unit); 00082 void adjustHeight(double width); 00083 void adjustWidth(double height); 00084 void saveImagesInternally(bool save); 00085 void setBestSize(); 00086 void frameApplyTo(); 00087 void patternApplyTo(); 00088 void textFormatApplyTo(); 00089 void customFont(); 00090 void updateTransparency(int alpha); 00091 void setTextDefaultValues(); 00092 void setFrameDefaultValues(); 00093 void setRectangleDefaultValues(); 00094 void finishedCompiling(int, QProcess::ExitStatus); 00095 void displayCompileError(QProcess::ProcessError error); 00096 void createImage(); 00097 void updateCompilerInterface(int); 00098 void updateButtons(); 00099 00100 private: 00101 void initTextPage(); 00102 void initEditorPage(); 00103 void initImagePage(); 00104 void initFramePage(); 00105 void initGeometryPage(); 00106 void initPatternPage(); 00107 void setCoordinates(int unit); 00108 void setFrameTo(FrameWidget *fw); 00109 void setPatternTo(FrameWidget *r); 00110 void setTextFormatTo(LegendWidget *l); 00111 void setText(QTextEdit *editor, const QString & t); 00112 QString createTempTexFile(); 00113 00114 ApplicationWindow *d_app; 00115 QHttp *http; 00116 QProcess *compileProcess, *dvipngProcess; 00117 00118 QLabel *outputLabel; 00119 QPushButton *clearButton; 00120 QPushButton *updateButton; 00121 QPushButton *cancelButton; 00122 QPushButton *bestSizeButton; 00123 QTextEdit *equationEditor, *textEditBox; 00124 QComboBox *frameBox; 00125 QTabWidget* tabWidget; 00126 QWidget *editPage, *framePage, *geometryPage, *imagePage, *patternPage, *textPage; 00127 ColorButton *frameColorBtn, *backgroundColorBtn, *patternColorBtn; 00128 QCheckBox *boxSaveImagesInternally; 00129 QLineEdit *imagePathBox; 00130 DoubleSpinBox *xBox, *yBox, *widthBox, *heightBox, *boxFrameWidth; 00131 QComboBox *unitBox; 00132 PenStyleBox *boxFrameLineStyle; 00133 QCheckBox *keepAspectBox, *useFrameColorBox; 00134 QSpinBox *boxTransparency, *boxTextAngle; 00135 PatternBox *patternBox; 00136 QPushButton *textApplyToBtn; 00137 QComboBox *frameApplyToBox, *patternApplyToBox, *textApplyToBox; 00138 ColorButton *textColorBtn, *textBackgroundBtn; 00139 QPushButton *textFontBtn; 00140 QSpinBox *boxBackgroundTransparency; 00141 TextFormatButtons *formatButtons, *texFormatButtons; 00142 QPushButton *textDefaultBtn, *frameDefaultBtn, *rectangleDefaultBtn; 00143 QCheckBox *autoUpdateTextBox, *texOutputBox; 00144 QComboBox *texCompilerBox; 00145 QComboBox* attachToBox; 00146 00147 QFont textFont; 00148 00149 Graph *d_plot; 00150 QWidget *d_widget; 00151 WidgetType d_widget_type; 00152 double aspect_ratio; 00153 }; 00154 00155 #endif