generate_menu.h

Go to the documentation of this file.
00001 #ifndef __GENERATE_MENU_H__
00002 #define __GENERATE_MENU_H__
00003 #include "mainwindow.h"
00004 #include "octave_connection.h"
00005 #include "operations.h"
00006 #include <QProcess>
00007 
00008 /**This class generates new menus from dirs.
00009  */
00010 class GenerateMenu:public QObject
00011 {
00012         Q_OBJECT
00013         public:
00014         GenerateMenu(MainWindow *mainwindow, Operations *operations);
00015         /** Set path to read menus entries.
00016          * @param path path to menus.
00017          */
00018         void setPath(QString path);
00019         /** Load menus. Menus are read from path.
00020          */
00021         void load_menu();
00022         private:
00023         void load_menu(QString dir_name, QMenu *parent_menu);
00024                 
00025         //Directorio en el que se encuentran los menús
00026         QString path;
00027         Operations *operations;
00028         MainWindow *mainwindow;
00029         /**Parse files with .menu extension.*/
00030         bool process_menu_file(QString _file,  QStringList &  input_labels,  QStringList &  input_parameters, QStringList & output_labels, QStringList & output_parameters, QString & command, QString & menu_name, QString & help, bool & accept_blank_parameters);
00031         /**Removes path from file_path.*/
00032         QString menu_path(QString file_path);
00033         /**Finds icon for given menu.*/
00034         QString find_icon(QString file_path, QString menu);
00035 };
00036 
00037 /**Simple Callback for menus genetates using GenerateMenu. This callback is used when menu file is executable. When menu item is selected, menu file is executed and result is sent to OctaveConnection.*/
00038 class MenuCallBack:public QObject
00039 {
00040         Q_OBJECT
00041         public:
00042         MenuCallBack(QString menu_name, OctaveConnection *oc);
00043         private:
00044         QProcess process;
00045         QString menu_name;
00046         QString output;
00047         OctaveConnection *octave_connection;
00048         public slots:
00049         void actions_callback();
00050         void readyReadStandardOutput();
00051         void finished( int exitCode, QProcess::ExitStatus exitStatus );
00052 };
00053 
00054 /**Callback for ".menu" files. See QtOctave doc for ".menu" files.*/
00055 class MenuFileCallBack: public QObject
00056 {
00057         Q_OBJECT
00058         public:
00059                 MenuFileCallBack(QString menu_name, OctaveConnection *oc, Operations *operations, QStringList &  input_labels,  QStringList &  input_parameters, QStringList & output_labels, QStringList & output_parameters, QString & command, QString & help, bool & accept_blank_parameters);
00060         private:
00061                 Operations *operations;
00062                 QString menu_name;
00063                 OctaveConnection *oc;
00064                 QStringList input_parameters, output_parameters, output_labels, input_labels;
00065                 QString command, help;
00066                 bool accept_blank_parameters;
00067         public slots:
00068                 void actions_callback();
00069         
00070 };
00071 
00072 #endif

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