Logo Search packages:      
Sourcecode: qtoctave version File versions  Download package

void Operations::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 
)

Shows dialog with labels and line edits, and executes _command with line edit value..

Parameters:
title Dialog title.
_command Command to execute.
parameters_labels Dialog labels for input parameters.
parameters Value of line edits for input parameters.
output_labels Dialog labels for output parameters.
output Value of line edits for output parameters.
help Html text with help.
is_table If focused window is a table window, asigs value to table.
accept_blank_parameters If user lefts parameters in blank, this option lets them. Otherwise function returns.

Definition at line 628 of file operations.cpp.

References OctaveConnection::command_enter(), menu_window(), and BaseWidget::widgetType().

Referenced by bar_callback(), contour_callback(), hist_callback(), and mesh_callback().

{
      MenuResult r=menu_window(title, parameters_labels, parameters, output_labels, output, help, accept_blank_parameters);
      
      QString command;
      
      if (r!=CANCEL)
      {
            QTextStream command_stream(&command);
             
            if(output_labels.size()>0)
            {
                  command_stream << "[";
                  for (int i = 0; i < output_labels.size();)
                  {
                        command_stream << output.at(i);
                        ++i;
                        if(i < output_labels.size()) command_stream << ",";
                  }
                  command_stream << "]=";
            }
            
            if(parameters_labels.size()>0)
            {
                  command_stream << _command << "(";
                  if( !parameters.at(0).isEmpty() ) command_stream << parameters.at(0);
                  for (int i = 1; i < parameters_labels.size();i++)
                  {
                        if( !parameters.at(i).isEmpty() )
                        {
                              command_stream << "," << parameters.at(i);
                              //++i;
                              //if( i < parameters_labels.size() ) command_stream << ",";
                        }
                        //else i++;
                  }
                  command_stream << ")";
            }
      }
      else return;
      
      
      if(r==COPY_CLIPBOARD)
      {
                  QClipboard *clipboard = QApplication::clipboard();
                  clipboard->setText(command);
      }
      //r==ACCEPTED
      else if(!is_table)
      {
            octave_connection->command_enter(command);
      }
      else
      {
            BaseWidget *top_widget=*active_widget;
            matrix=parameters.at(0);
            if(top_widget->widgetType()==TABLE)
            {
                  if( matrix==((Table*)top_widget)->getMatrix() )
                  {
                        command=matrix+"="+command;
                  }
            }
            octave_connection->command_enter(command);
      }

}


Generated by  Doxygen 1.6.0   Back to index