operations.h

Go to the documentation of this file.
00001 /* Copyright (C) 2006 P.L. Lucas
00002  *
00003  * This program is free software; you can redistribute it and/or modify
00004  * it under the terms of the GNU General Public License as published by
00005  * the Free Software Foundation; either version 2 of the License, or
00006  * (at your option) any later version.
00007  *
00008  * This program is distributed in the hope that it will be useful,
00009  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00010  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00011  * GNU General Public License for more details.
00012  *
00013  * You should have received a copy of the GNU General Public License
00014  * along with this program; if not, write to the Free Software
00015  * Foundation, Inc., 59 Temple Place, Suite 330, 
00016  * Boston, MA 02111-1307, USA. 
00017  */
00018 
00019 #ifndef __OPERATIONS_H__
00020 #define __OPERATIONS_H__
00021 #include "mainwindow.h"
00022 #include "octave_connection.h"
00023 #include "basewidget.h"
00024 #include "table.h"
00025 #include <QDialog>
00026 #include <QLineEdit>
00027 #include <QTreeWidget>
00028 #include <QComboBox>
00029 #include <QCheckBox>
00030 
00031 
00032 /**This class is used to show plots menus.
00033  */
00034 class Plot:public QDialog
00035 {
00036         Q_OBJECT
00037         public:
00038         /**Menu type.*/
00039         enum Type {PLOT,SEMILOGY, SEMILOGX, LOGLOG, POLAR};
00040         Plot(QWidget *parent=0, Plot::Type type=PLOT);
00041         /**Command to send to Octave.
00042          * @return QString representing command. This command is used by Octave to plot.
00043          */
00044         QString command();
00045         
00046         private:
00047         QLineEdit *x_lineedit, *y_lineedit, *error_x_lineedit, *error_y_lineedit, *title_lineedit;
00048         QVBoxLayout *vlayout;
00049         QComboBox *style_combo, *color_combo, *pointStyle_combo;
00050         QTreeWidget *plots_tree;
00051         QCheckBox *no_title;
00052         Plot::Type type;
00053         
00054         public slots:
00055         void add_callback();
00056         void remove_callback();
00057         void copy_clipboard_callback();
00058 };
00059 
00060 
00061 /**Connects menu signals with callbacks.
00062 */
00063 
00064 class Operations:public QObject
00065 {
00066         Q_OBJECT
00067         public:
00068         Operations( QObject * parent = 0, BaseWidget **active_widget=0, MainWindow *main_window=0 );
00069         void setOctaveConnection(OctaveConnection *octave_connection);
00070         void setMatrix(QString matrix);
00071         
00072         enum MenuResult {ACCEPTED, COPY_CLIPBOARD, CANCEL}; //Se usa para saber el tipo de salida de un menú
00073         
00074         private:
00075         OctaveConnection *octave_connection;
00076         QString matrix;
00077         BaseWidget **active_widget;
00078         MainWindow *main_window;
00079         
00080         bool copy_clipboard_ok;
00081         
00082         public:
00083         /**Shows simple dialog with one label and line edit.
00084          * @param title Dialog title.
00085          * @param label Dialog label.
00086          * @param input Value of line edit
00087          * @return true if user press ok button.
00088          */
00089         bool input_dialog(QString title, QString label, QString &input);
00090         /**Shows simple dialog with one label and line edit, and executes _command with line edit value.
00091          * @param title Dialog title.
00092          * @param label Dialog label.
00093          * @param _command Command to execute.
00094          * @return true if user press ok button.
00095          */
00096         void simple_comand(QString title, QString label, QString _command);
00097         /**Shows dialog with labels and line edits.
00098          * @param title Dialog title.
00099          * @param parameters_labels Dialog labels for input parameters.
00100          * @param parameters Value of line edits for input parameters.
00101          * @param output_labels Dialog labels for output parameters.
00102          * @param output Value of line edits for output parameters.
00103          * @param help Html text with help.
00104          * @param accept_blank_parameters If user lefts parameters in blank, this option lets them. Otherwise function returns CANCEL.
00105          * @return Result of dialog.
00106          */
00107         MenuResult menu_window(QString title, QStringList parameters_labels, QStringList &parameters, QStringList output_labels, QStringList &output, QString help=QString(), bool accept_blank_parameters=false);
00108         public:
00109         /**Shows dialog with labels and line edits, and executes _command with line edit value..
00110          * @param title Dialog title.
00111          * @param _command Command to execute.
00112          * @param parameters_labels Dialog labels for input parameters.
00113          * @param parameters Value of line edits for input parameters.
00114          * @param output_labels Dialog labels for output parameters.
00115          * @param output Value of line edits for output parameters.
00116          * @param help Html text with help.
00117          * @param is_table If focused window is a table window, asigs value to table.
00118          * @param accept_blank_parameters If user lefts parameters in blank, this option lets them. Otherwise function returns.
00119          */
00120         void compex_comand(QString title, QString _command, QStringList parameters_labels, QStringList &parameters, QStringList output_labels, QStringList &output, QString help=QString(), bool is_table=false, bool accept_blank_parameters=false);
00121         
00122         public slots:
00123         /**Makes copy_clipboard_ok true. This callback function deals with menu_window and input_dialog methods.
00124          * @see copy_clipboard_ok, menu_window, input_dialog.
00125          */
00126         void copy_clipboard_callback();
00127         
00128         //File operations
00129         void exit_callback();
00130         void cd_callback();
00131         
00132         //Operaciones con matrices
00133         void inverse_callback();
00134         void determinant_callback();
00135         void eigenvalues_callback();
00136         void transpose_callback();
00137         void submatrix_callback();
00138         
00139         //Operaciones estadísticas
00140         void mean_callback();
00141         void median_callback();
00142         void std_callback();
00143         void cov_callback();
00144         void corrcoef_callback();
00145         
00146         //Plot menu
00147         void plot_callback();
00148         void axis_callback();
00149         void title_label_callback();
00150         void to_eps_callback();
00151         void to_pdf_callback();
00152         void to_png_callback();
00153         void semilogy_callback();
00154         void semilogx_callback();
00155         void log_log_callback();
00156         void polar_callback();
00157         void error_bars_callback();
00158         /**Callback for histogram menu. Shows dialog for histogram.*/
00159         void hist_callback();
00160         /**Callback for bar graph menu. Shows dialog for bar graph.*/
00161         void bar_callback();
00162         /**Callback for contour menu. Shows dialog for contour plot of three-dimensional surface.*/
00163         void contour_callback();
00164         /**Callback for mesh menu. Shows dialog for plot of three-dimensional surface.*/
00165         void mesh_callback();
00166         /**Callback for A+B menu.*/
00167         void suma_callback();
00168         /**Callback for A*B menu.*/
00169         void producto_callback();
00170         /**Callback for A**B menu.*/
00171         void exponente_callback();
00172         
00173         //General actions
00174         void editor_callback();
00175         
00176         //Config actions
00177         void general_config_callback();
00178 
00179 };
00180 
00181 
00182 
00183 
00184 
00185 #endif

Generated on Wed Mar 21 10:32:50 2007 for QtOctave by  doxygen 1.4.7