KreCategoriesListWidget::KreCategoriesListWidget( QWidget *parent, RecipeDB *db ):
	KreGenericListWidget( parent, db )
{

	//The QTreeView.
	ui->m_treeView->setRootIsDecorated( true );
	ui->m_treeView->showColumn( 0 );
	KConfigGroup configAdvanced( KGlobal::config(), "Advanced" );
	if ( !configAdvanced.readEntry( "ShowID", false ) ) {
		ui->m_treeView->hideColumn( 1 );
	}
	ui->m_treeView->header()->setStretchLastSection( false );
	ui->m_treeView->header()->setResizeMode( 0, QHeaderView::Stretch );


	//The horizontal column labels.
	QStringList horizontalLabels;
	horizontalLabels << i18nc( "@title:column", "Categories" ) << i18nc( "@title:column", "Id" );
	m_sourceModel->setHorizontalHeaderLabels( horizontalLabels );

	//The maximum number of elements to show in the author list.
	KConfigGroup configPerformance = KGlobal::config()->group( "Performance" );
	setCurrentLimit( configPerformance.readEntry( "CategoryLimit", -1 ) );

	connect( m_database, SIGNAL( categoryCreated( const Element &, int) ), 
		SLOT( createCategory( const Element &, int ) ) );
	connect( m_database, SIGNAL( categoryRemoved( int ) ), 
		SLOT( removeCategory( int ) ) );

}
//#################################################################
//
// void dynamixels::setCurrentLimitALL(uint16_t desired_current_limit)
//
//#################################################################
void dynamixels::setCurrentLimitALL(uint16_t desired_current_limit)
{
	for (int i=0; i<MAXIMUM_NUMBER_DYNAMIXELS && ID_array[i]!= 0; i++)
	{
		setCurrentLimit(i, desired_current_limit);
	}
}
Exemple #3
0
void ChartXYScale::calculateLimit(QAbstractItemModel *model,unsigned int x_step,unsigned int y_step)
  {
  QVariant x_minimun;
  QVariant x_maximun;
  QVariant y_minimun;
  QVariant y_maximun;
  QVariant x;
  QVariant y;
  int i,j;

  if((m_auto_base_limit==false)&&(m_auto_current_limit==false)) return;

  for(i=0;i<model->rowCount();i++)
    {
    x=model->data(model->index(i,0));
    if((!x_minimun.isValid())||((ChartXYFunction::variantToAbsolute(x))<(ChartXYFunction::variantToAbsolute(x_minimun))))
      {
      x_minimun=x;
      }
    if((!x_maximun.isValid())||((ChartXYFunction::variantToAbsolute(x))>(ChartXYFunction::variantToAbsolute(x_maximun))))
      {
      x_maximun=x;
      }
    for(j=1;j<model->columnCount();j++)
      {
      y=model->data(model->index(i,j));
      if((!y_minimun.isValid())||((ChartXYFunction::variantToAbsolute(y))<(ChartXYFunction::variantToAbsolute(y_minimun))))
        {
        y_minimun=y;
        }
      if((!y_maximun.isValid())||((ChartXYFunction::variantToAbsolute(y))>(ChartXYFunction::variantToAbsolute(y_maximun))))
        {
        y_maximun=y;
        }
      }
    }

  if(m_nominal_auto_limit)
    {
    Calculate_nominal_limit(x_minimun,x_maximun,x_step,1);
    Calculate_nominal_limit(y_minimun,y_maximun,y_step,1);
    }


  if(m_auto_base_limit)
    {
    setBaseLimit(ChartXYLimit(ChartXYLimitAxis(x_minimun,x_maximun),ChartXYLimitAxis(y_minimun,y_maximun)));
    }

  if(m_auto_current_limit)
    {
    setCurrentLimit(ChartXYLimit(ChartXYLimitAxis(x_minimun,x_maximun),ChartXYLimitAxis(y_minimun,y_maximun)));
    }
  }
Exemple #4
0
bool StreamingDevice::processMessage(ClientConn& client, string& cmd, JSONNode& n){
	if (cmd == "listen"){
		cancelListen(findListener(&client, jsonIntProp(n, "id")));
		addListener(makeStreamListener(this, &client, n));
	
	}else if (cmd == "cancelListen"){
		cancelListen(findListener(&client, jsonIntProp(n, "id")));
	
	}else if (cmd == "configure"){
		int      mode =       jsonIntProp(n,   "mode");
		unsigned samples =    jsonIntProp(n,   "samples");
		double    sampleTime = jsonFloatProp(n, "sampleTime");
		bool     continuous = jsonBoolProp(n,  "continuous", false);
		bool     raw =        jsonBoolProp(n,  "raw", false);
		configure(mode, sampleTime, samples, continuous, raw);
	
	}else if (cmd == "startCapture"){
		start_capture();
	
	}else if (cmd == "pauseCapture"){
		pause_capture();
	
	}else if (cmd == "set"){
		Channel *channel = channelById(jsonStringProp(n, "channel"));
		if (!channel) throw ErrorStringException("Channel not found");
		setOutput(channel, makeSource(n));
		
	}else if (cmd == "setGain"){
		Channel *channel = channelById(jsonStringProp(n, "channel"));
		if (!channel) throw ErrorStringException("Channel not found");
		Stream *stream = findStream(
				jsonStringProp(n, "channel"),
				jsonStringProp(n, "stream"));

		double gain = jsonFloatProp(n, "gain", 1);
		
		setGain(channel, stream, gain);
	}else if (cmd == "setCurrentLimit"){
		unsigned limit = jsonFloatProp(n, "currentLimit");
		setCurrentLimit(limit);
	}else{
		return false;
	}
	return true;
}
Exemple #5
0
KreAuthorListWidget::KreAuthorListWidget( QWidget *parent, RecipeDB *db ):
	KreGenericListWidget( parent, db )
{
	//The thread to execute the SQL query.
	m_thread = new LoadingAuthorsThread;
	
	//The horizontal column labels.
	QStringList horizontalLabels;
	horizontalLabels << i18nc( "@title:column", "Id" ) << i18nc( "@title:column", "Author" );
	m_sourceModel->setHorizontalHeaderLabels( horizontalLabels );

	//The maximum number of elements to show in the author list.
	KConfigGroup config = KGlobal::config()->group( "Performance" );
	setCurrentLimit( config.readEntry( "Limit", -1 ) );

	connect( m_database, SIGNAL( authorCreated( const Element & ) ), 
		SLOT( createAuthor( const Element & ) ) );
	connect( m_database, SIGNAL( authorRemoved( int ) ), 
		SLOT( removeAuthor( int ) ) );

}