Ejemplo n.º 1
0
int MelBanks::GetFeatures(float *ret_features)
{
	if(input_vector == 0)
		return 0;                                  // we do not have input data

	// copy one frame from the input buffer to the temporary one during the first pass through this function,
	// shift the temporal buffer left an copy next 10 ms from the input buffer in all follow passes.
	if(first_frame)
	{
		sCopy(vector_size, frame, input_vector);
                                               // input_vector -> frame

		// backup the frame
		sCopy(vector_size, frame_backup, frame);

		frame_pos = vector_size;
		input_vector_pos += vector_size;

		first_frame = false;
	}
	else
	{
		// restore the last frame and shift it 10 ms left 
		if(frame_pos == vector_size - step)
		{
			sCopy(vector_size, frame, frame_backup);  // frame_backup -> frame
			sShiftLeft(vector_size, frame, step);
		}

		int n_input = input_vector_len - input_vector_pos; 
		int n_output = vector_size - frame_pos;
		int n_process = (n_input < n_output ? n_input : n_output);
		sCopy(n_process, frame + frame_pos, input_vector + input_vector_pos);
		input_vector_pos += n_process;
		frame_pos += n_process;

		if(input_vector_pos > input_vector_len)
			input_vector = 0;
	}

	if(frame_pos == vector_size)
	{
		// backup the frame
		sCopy(vector_size, frame_backup, frame);

		frame_pos = vector_size - step;

		// perform parameterisation of one frame
		ProcessFrame(frame, ret_features);
		return 1;
	}

	return 0;
}
Ejemplo n.º 2
0
void push(str_t *str, bstack_t *stack)
{
	//str_t *newstr;

	//add an element to the stack, growing the stack if necessary
	if (stack->num >= stack->size)
	{
		stack->size *=2;
		stack->elements = (str_t **)realloc(stack->elements,
			stack->size * sizeof(str_t*));
		if (stack->elements == NULL)
		{
			printf("error allocating stack space\n");
			return;
		}
	}

	//create a new string
	//newstr = (str_t *)malloc(sizeof(str_t));
	//sInit(newstr);
	//sCopy(newstr,str);
	sCopy(stack->elements[stack->num],str);
	stack->num++;

	//both stacks and queues push to the same side of the array
	//the top element and the number of elements are the same
	stack->top = stack->num - 1;
	//store the pointer to it in the stack
	//stack->elements[stack->top] = newstr;

	return;
}
Ejemplo n.º 3
0
/*
 *  Constructs a items as a child of 'parent', with the
 *  name 'name' and widget flags set to 'f'.
 *
 */
items::items(QWidget* parent, const char* name, Qt::WFlags fl)
    : QMainWindow(parent, name, fl)
{
    setupUi(this);

    (void)statusBar();

    QButtonGroup* _statusGroupInt = new QButtonGroup(this);
    _statusGroupInt->addButton(_showAll);
    _statusGroupInt->addButton(_showPurchased);
    _statusGroupInt->addButton(_showManufactured);
    _statusGroupInt->addButton(_showSold);

    // signals and slots connections
    connect(_item, SIGNAL(populateMenu(QMenu*,QTreeWidgetItem*,int)), this, SLOT(sPopulateMenu(QMenu*)));
    connect(_new, SIGNAL(clicked()), this, SLOT(sNew()));
    connect(_edit, SIGNAL(clicked()), this, SLOT(sEdit()));
    connect(_copy, SIGNAL(clicked()), this, SLOT(sCopy()));
    connect(_showInactive, SIGNAL(toggled(bool)), this, SLOT(sFillList()));
    connect(_statusGroupInt, SIGNAL(buttonClicked(int)), this, SLOT(sFillList()));
    connect(_searchFor, SIGNAL(textChanged(const QString&)), this, SLOT(sSearch(const QString&)));
    connect(_close, SIGNAL(clicked()), this, SLOT(close()));
    connect(_view, SIGNAL(clicked()), this, SLOT(sView()));
    connect(_item, SIGNAL(valid(bool)), _view, SLOT(setEnabled(bool)));
    connect(_delete, SIGNAL(clicked()), this, SLOT(sDelete()));
    init();
}
Ejemplo n.º 4
0
workCenters::workCenters(QWidget* parent, const char* name, Qt::WFlags fl)
    : XMainWindow(parent, name, fl)
{
  setupUi(this);

  connect(_new, SIGNAL(clicked()), this, SLOT(sNew()));
  connect(_edit, SIGNAL(clicked()), this, SLOT(sEdit()));
  connect(_copy, SIGNAL(clicked()), this, SLOT(sCopy()));
  connect(_delete, SIGNAL(clicked()), this, SLOT(sDelete()));
  connect(_wrkcnt, SIGNAL(populateMenu(QMenu *, QTreeWidgetItem *, int)), this, SLOT(sPopulateMenu(QMenu*)));
  connect(_print, SIGNAL(clicked()), this, SLOT(sPrint()));
  connect(_view, SIGNAL(clicked()), this, SLOT(sView()));

  _wrkcnt->addColumn(tr("Whs."),        _whsColumn,  Qt::AlignCenter );
  _wrkcnt->addColumn(tr("Work Cntr."),  _itemColumn, Qt::AlignLeft   );
  _wrkcnt->addColumn(tr("Description"), -1,          Qt::AlignLeft   );

  connect(omfgThis, SIGNAL(workCentersUpdated()), SLOT(sFillList()));

  if (_privileges->check("MaintainWorkCenters"))
  {
    connect(_wrkcnt, SIGNAL(valid(bool)), _edit, SLOT(setEnabled(bool)));
    connect(_wrkcnt, SIGNAL(valid(bool)), _copy, SLOT(setEnabled(bool)));
    connect(_wrkcnt, SIGNAL(valid(bool)), _delete, SLOT(setEnabled(bool)));
    connect(_wrkcnt, SIGNAL(itemSelected(int)), _edit, SLOT(animateClick()));
  }
  else
  {
    _new->setEnabled(FALSE);
    connect(_wrkcnt, SIGNAL(itemSelected(int)), _view, SLOT(animateClick()));
  }

  sFillList();
}
Ejemplo n.º 5
0
void projects::sPopulateMenu(QMenu * pMenu, QTreeWidgetItem *, int)
{
  QAction *menuItem;

  bool editPriv =
      (omfgThis->username() == list()->currentItem()->rawValue("prj_owner_username") && _privileges->check("MaintainPersonalProjects")) ||
      (omfgThis->username() == list()->currentItem()->rawValue("prj_username") && _privileges->check("MaintainPersonalProjects")) ||
      (_privileges->check("MaintainAllProjects"));

  bool viewPriv =
      (omfgThis->username() == list()->currentItem()->rawValue("prj_owner_username") && _privileges->check("ViewPersonalProjects")) ||
      (omfgThis->username() == list()->currentItem()->rawValue("prj_username") && _privileges->check("ViewPersonalProjects")) ||
      (_privileges->check("ViewAllProjects"));

  menuItem = pMenu->addAction("View...", this, SLOT(sView()));
  menuItem->setEnabled(viewPriv);

  menuItem = pMenu->addAction("Edit...", this, SLOT(sEdit()));
  menuItem->setEnabled(editPriv);

  menuItem = pMenu->addAction("Delete...", this, SLOT(sDelete()));
  menuItem->setEnabled(editPriv);

  menuItem = pMenu->addAction("Copy...", this, SLOT(sCopy()));
  menuItem->setEnabled(editPriv);
}
Ejemplo n.º 6
0
copyPurchaseOrder::copyPurchaseOrder(QWidget* parent, const char* name, bool modal, Qt::WFlags fl)
    : XDialog(parent, name, modal, fl)
{
    setupUi(this);

    connect(_close,	SIGNAL(clicked()),	this,	SLOT(reject()));
    connect(_copy,	SIGNAL(clicked()),	this,	SLOT(sCopy()));
    connect(_po,	SIGNAL(newId(int)),	this,	SLOT(sPopulatePoInfo(int)));
    connect(_po,	SIGNAL(requestList()),	this,	SLOT(sPoList()));
    connect(_poList,	SIGNAL(clicked()),	this,	SLOT(sPoList()));
    connect(_reschedule,SIGNAL(toggled(bool)),	_scheduleDate,	SLOT(setEnabled(bool)));

    _captive = FALSE;

#ifndef Q_WS_MAC
    _poList->setMaximumWidth(25);
#endif

    //omfgThis->inputManager()->notify(cBCPurchaseOrder, this, _po, SLOT(setId(int)));

    _poitem->addColumn(tr("#"),           _seqColumn,     Qt::AlignCenter );
    _poitem->addColumn(tr("Item"),        _itemColumn,    Qt::AlignLeft   );
    _poitem->addColumn(tr("Description"), -1,             Qt::AlignLeft   );
    _poitem->addColumn(tr("Whs."),        _whsColumn,     Qt::AlignCenter );
    _poitem->addColumn(tr("Ordered"),     _qtyColumn,     Qt::AlignRight  );
    _poitem->addColumn(tr("Price"),       _qtyColumn,     Qt::AlignRight  );
    _poitem->addColumn(tr("Extended"),    _qtyColumn,     Qt::AlignRight  );

    _currency->setType(XComboBox::Currencies);
    _currency->setLabel(_currencyLit);
}
Ejemplo n.º 7
0
bomList::bomList(QWidget* parent, const char* name, Qt::WFlags fl)
    : XWidget(parent, name, fl)
{
  setupUi(this);

  connect(_copy, SIGNAL(clicked()), this, SLOT(sCopy()));
  connect(_delete, SIGNAL(clicked()), this, SLOT(sDelete()));
  connect(_edit, SIGNAL(clicked()), this, SLOT(sEdit()));
  connect(_new, SIGNAL(clicked()), this, SLOT(sNew()));
  connect(_print, SIGNAL(clicked()), this, SLOT(sPrint()));
  connect(_searchFor, SIGNAL(textChanged(const QString&)), this, SLOT(sSearch(const QString&)));
  connect(_showInactive, SIGNAL(toggled(bool)), this, SLOT(sFillList()));
  connect(_showComponent, SIGNAL(toggled(bool)), this, SLOT(sFillList()));
  connect(_view, SIGNAL(clicked()), this, SLOT(sView()));

  _bom->addColumn(tr("Item Number"), _itemColumn, Qt::AlignLeft, true, "item_number");
  _bom->addColumn(tr("Description"), -1,          Qt::AlignLeft, true, "descrip");
  
  connect(omfgThis, SIGNAL(bomsUpdated(int, bool)), SLOT(sFillList(int, bool)));
  
  if (_privileges->check("MaintainBOMs"))
  {
    connect(_bom, SIGNAL(valid(bool)), _edit, SLOT(setEnabled(bool)));
    connect(_bom, SIGNAL(valid(bool)), _copy, SLOT(setEnabled(bool)));
    connect(_bom, SIGNAL(valid(bool)), this, SLOT(sHandleButtons()));

    connect(_bom, SIGNAL(itemSelected(int)), _edit, SLOT(animateClick()));
  }
Ejemplo n.º 8
0
plannedSchedule::plannedSchedule(QWidget * parent, const char * name, bool modal, Qt::WFlags fl)
    : XDialog(parent, name, modal, fl)
{
    setupUi(this);

    _pschheadid = -1;
    _presaved = false;

    connect(_cancel, SIGNAL(clicked()), this, SLOT(reject()));
    connect(_save, SIGNAL(clicked()), this, SLOT(sSave()));
    connect(_new, SIGNAL(clicked()), this, SLOT(sNew()));
    connect(_edit, SIGNAL(clicked()), this, SLOT(sEdit()));
    connect(_copy, SIGNAL(clicked()), this, SLOT(sCopy()));
    connect(_delete, SIGNAL(clicked()), this, SLOT(sDelete()));
    connect(_number, SIGNAL(lostFocus()), this, SLOT(sNumberChanged()));

    _list->addColumn(tr("#"),           _whsColumn,  Qt::AlignRight,  true,  "pschitem_linenumber"  );
    _list->addColumn(tr("Sched. Date"), _dateColumn, Qt::AlignCenter, true,  "pschitem_scheddate" );
    _list->addColumn(tr("Item Number"), -1,          Qt::AlignLeft,   true,  "item_number"   );
    _list->addColumn(tr("Qty"),         _qtyColumn,  Qt::AlignRight,  true,  "pschitem_qty"  );
    _list->addColumn(tr("Status"),      _whsColumn,  Qt::AlignCenter, true,  "pschitem_status" );

    //If not multi-warehouse hide whs control
    if (!_metrics->boolean("MultiWhs"))
    {
        _warehouseLit->hide();
        _warehouse->hide();
    }

}
Ejemplo n.º 9
0
/*
 *  Constructs a financialLayouts as a child of 'parent', with the
 *  name 'name' and widget flags set to 'f'.
 *
 */
financialLayouts::financialLayouts(QWidget* parent, const char* name, Qt::WFlags fl)
    : XWidget(parent, name, fl)
{
    setupUi(this);

//  (void)statusBar();

    // signals and slots connections
    connect(_new, SIGNAL(clicked()), this, SLOT(sNew()));
    connect(_edit, SIGNAL(clicked()), this, SLOT(sEdit()));
    connect(_delete, SIGNAL(clicked()), this, SLOT(sDelete()));
    connect(_close, SIGNAL(clicked()), this, SLOT(close()));
    connect(_copy, SIGNAL(clicked()), this, SLOT(sCopy()));
    connect(_flhead, SIGNAL(valid(bool)), _copy, SLOT(setEnabled(bool)));
    connect(_flhead, SIGNAL(valid(bool)), _edit, SLOT(setEnabled(bool)));
    connect(_flhead, SIGNAL(valid(bool)), _delete, SLOT(setEnabled(bool)));
    connect(_flhead, SIGNAL(itemSelected(int)), _edit, SLOT(animateClick()));
    connect(_showInactive, SIGNAL(toggled(bool)), this, SLOT(sFillList()));

//  statusBar()->hide();

    _flhead->addColumn(tr("Name"),        (_itemColumn*2), Qt::AlignLeft, true, "flhead_name"  );
    _flhead->addColumn(tr("Description"), -1,          Qt::AlignLeft, true, "flhead_descrip" );
    _flhead->addColumn(tr("Active"), _ynColumn,          Qt::AlignLeft, true, "active" );
    _flhead->addColumn(tr("System"), _ynColumn,          Qt::AlignLeft, true, "system" );

    sFillList();
}
Ejemplo n.º 10
0
budgets::budgets(QWidget* parent, const char* name, Qt::WFlags fl)
    : XWidget(parent, name, fl)
{
  setupUi(this);

  connect(_copy,   SIGNAL(clicked()), this, SLOT(sCopy()));
  connect(_delete, SIGNAL(clicked()), this, SLOT(sDelete()));
  connect(_edit,   SIGNAL(clicked()), this, SLOT(sEdit()));
  connect(_new,    SIGNAL(clicked()), this, SLOT(sNew()));
  connect(_print,  SIGNAL(clicked()), this, SLOT(sPrint()));
  connect(_view,   SIGNAL(clicked()), this, SLOT(sView()));

  _budget->addColumn(tr("Start Date"),_dateColumn, Qt::AlignLeft, true, "startdate");
  _budget->addColumn(tr("End Date"),  _dateColumn, Qt::AlignLeft, true, "enddate");
  _budget->addColumn(tr("Code"),      _itemColumn, Qt::AlignLeft, true, "budghead_name");
  _budget->addColumn(tr("Description"),        -1, Qt::AlignLeft, true, "budghead_descrip");

  if (_privileges->check("MaintainBudgets"))
  {
    connect(_budget, SIGNAL(valid(bool)), _edit, SLOT(setEnabled(bool)));
    connect(_budget, SIGNAL(valid(bool)), _delete, SLOT(setEnabled(bool)));
    connect(_budget, SIGNAL(valid(bool)), _copy, SLOT(setEnabled(bool)));
    connect(_budget, SIGNAL(itemSelected(int)), _edit, SLOT(animateClick()));
  }
  else
  {
    connect(_budget, SIGNAL(itemSelected(int)), _view, SLOT(animateClick()));
    _new->setEnabled(FALSE);
  }

  connect(omfgThis, SIGNAL(budgetsUpdated(int, bool)), this, SLOT(sFillList()));

   sFillList();
}
Ejemplo n.º 11
0
dspPoHistory::dspPoHistory(QWidget* parent, const char* name, Qt::WFlags fl)
    : QMainWindow(parent, name, fl)
{
    setupUi(this);

    (void)statusBar();

    connect(_copy,	SIGNAL(clicked()), this, SLOT(sCopy()));
    connect(_print, SIGNAL(clicked()), this, SLOT(sPrint()));
    connect(_po, SIGNAL(newId(int)), this, SLOT(sFillList()));

    statusBar()->hide();

    _po->setType((cPOOpen | cPOClosed));

    _poitem->addColumn(tr("#"),            _whsColumn,  Qt::AlignCenter );
    _poitem->addColumn(tr("Item/Doc. #"),  _itemColumn, Qt::AlignLeft   );
    _poitem->addColumn(tr("UOM"),          _uomColumn,  Qt::AlignCenter );
    _poitem->addColumn(tr("Due/Recvd."),   _dateColumn, Qt::AlignCenter );
    _poitem->addColumn(tr("Vend. Item #"), -1,          Qt::AlignLeft   );
    _poitem->addColumn(tr("UOM"),          _uomColumn,  Qt::AlignCenter );
    _poitem->addColumn(tr("Ordered"),      _qtyColumn,  Qt::AlignRight  );
    _poitem->addColumn(tr("Received"),     _qtyColumn,  Qt::AlignRight  );
    _poitem->addColumn(tr("Returned"),     _qtyColumn,  Qt::AlignRight  );
}
Ejemplo n.º 12
0
costCategories::costCategories(QWidget* parent, const char* name, Qt::WFlags fl)
    : XWidget(parent, name, fl)
{
  setupUi(this);

  connect(_edit, SIGNAL(clicked()), this, SLOT(sEdit()));
  connect(_view, SIGNAL(clicked()), this, SLOT(sView()));
  connect(_delete, SIGNAL(clicked()), this, SLOT(sDelete()));
  connect(_print, SIGNAL(clicked()), this, SLOT(sPrint()));
  connect(_new, SIGNAL(clicked()), this, SLOT(sNew()));
  connect(_copy, SIGNAL(clicked()), this, SLOT(sCopy()));
  connect(_costcat, SIGNAL(populateMenu(QMenu*,QTreeWidgetItem*,int)), this, SLOT(sPopulateMenu(QMenu*)));
  
  _costcat->addColumn(tr("Category"), _itemColumn, Qt::AlignLeft, true, "costcat_code");
  _costcat->addColumn(tr("Description"),       -1, Qt::AlignLeft, true, "costcat_descrip");

  if (_privileges->check("MaintainCostCategories"))
  {
    connect(_costcat, SIGNAL(valid(bool)), _edit, SLOT(setEnabled(bool)));
    connect(_costcat, SIGNAL(valid(bool)), _copy, SLOT(setEnabled(bool)));
    connect(_costcat, SIGNAL(valid(bool)), _delete, SLOT(setEnabled(bool)));
    connect(_costcat, SIGNAL(itemSelected(int)), _edit, SLOT(animateClick()));
  }
  else
  {
    _new->setEnabled(FALSE);
    connect(_costcat, SIGNAL(itemSelected(int)), _view, SLOT(animateClick()));
  }

  sFillList();
}
Ejemplo n.º 13
0
salesCategories::salesCategories(QWidget* parent, const char* name, Qt::WFlags fl)
  : XWidget(parent, name, fl)
{
  setupUi(this);


  // signals and slots connections
  connect(_edit, SIGNAL(clicked()), this, SLOT(sEdit()));
  connect(_view, SIGNAL(clicked()), this, SLOT(sView()));
  connect(_delete, SIGNAL(clicked()), this, SLOT(sDelete()));
  connect(_print, SIGNAL(clicked()), this, SLOT(sPrint()));
  connect(_close, SIGNAL(clicked()), this, SLOT(close()));
  connect(_new, SIGNAL(clicked()), this, SLOT(sNew()));
  connect(_copy, SIGNAL(clicked()), this, SLOT(sCopy()));
  connect(_salescat, SIGNAL(valid(bool)), _view, SLOT(setEnabled(bool)));

  _salescat->addColumn(tr("Category"),    _itemColumn, Qt::AlignLeft, true, "salescat_name"   );
  _salescat->addColumn(tr("Description"), -1,          Qt::AlignLeft, true, "salescat_descrip"  );

  if (_privileges->check("MaintainSalesCategories"))
  {
    connect(_salescat, SIGNAL(valid(bool)), _edit, SLOT(setEnabled(bool)));
    connect(_salescat, SIGNAL(valid(bool)), _copy, SLOT(setEnabled(bool)));
    connect(_salescat, SIGNAL(valid(bool)), _delete, SLOT(setEnabled(bool)));
    connect(_salescat, SIGNAL(itemSelected(int)), _edit, SLOT(animateClick()));
  }
  else
  {
    _new->setEnabled(FALSE);
    connect(_salescat, SIGNAL(itemSelected(int)), _view, SLOT(animateClick()));
  }

  sFillList();
}
Ejemplo n.º 14
0
copyItem::copyItem(QWidget* parent, const char* name, bool modal, Qt::WFlags fl)
    : XDialog(parent, name, modal, fl)
{
  setupUi(this);

  connect(_copy, SIGNAL(clicked()), this, SLOT(sCopy()));
  connect(_source, SIGNAL(typeChanged(const QString&)), this, SLOT(sHandleItemType(const QString&)));

  _captive = FALSE;
}
Ejemplo n.º 15
0
/*
 *  Constructs a copyBudget as a child of 'parent', with the
 *  name 'name' and widget flags set to 'f'.
 *
 *  The dialog will by default be modeless, unless you set 'modal' to
 *  true to construct a modal dialog.
 */
copyBudget::copyBudget(QWidget* parent, const char* name, bool modal, Qt::WFlags fl)
    : XDialog(parent, name, modal, fl)
{
  setupUi(this);

  _budgheadid = -1;

  // signals and slots connections
  connect(_copy, SIGNAL(clicked()), this, SLOT(sCopy()));
  connect(_close, SIGNAL(clicked()), this, SLOT(reject()));
}
Ejemplo n.º 16
0
copyContract::copyContract(QWidget* parent, const char* name, bool modal, Qt::WindowFlags fl)
    : XDialog(parent, name, modal, fl)
{
  setupUi(this);

  connect(_buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
  connect(_buttonBox, SIGNAL(accepted()), this, SLOT(sCopy()));

  _contrctid = -1;
  _vendid = -1;
  _captive = false;
}
Ejemplo n.º 17
0
items::items(QWidget* parent, const char* name, Qt::WFlags fl)
    : XWidget(parent, name, fl)
{
  setupUi(this);

  QButtonGroup* _statusGroupInt = new QButtonGroup(this);
  _statusGroupInt->addButton(_showAll);
  _statusGroupInt->addButton(_showPurchased);
  _statusGroupInt->addButton(_showManufactured);
  _statusGroupInt->addButton(_showSold);

  // signals and slots connections
  connect(_item, SIGNAL(populateMenu(QMenu*,QTreeWidgetItem*,int)), this, SLOT(sPopulateMenu(QMenu*)));
  connect(_new, SIGNAL(clicked()), this, SLOT(sNew()));
  connect(_edit, SIGNAL(clicked()), this, SLOT(sEdit()));
  connect(_copy, SIGNAL(clicked()), this, SLOT(sCopy()));
  connect(_showInactive, SIGNAL(toggled(bool)), this, SLOT(sFillList()));
  connect(_statusGroupInt, SIGNAL(buttonClicked(int)), this, SLOT(sFillList()));
  connect(_searchFor, SIGNAL(textChanged(const QString&)), this, SLOT(sSearch(const QString&)));
  connect(_close, SIGNAL(clicked()), this, SLOT(close()));
  connect(_view, SIGNAL(clicked()), this, SLOT(sView()));
  connect(_item, SIGNAL(valid(bool)), _view, SLOT(setEnabled(bool)));
  connect(_delete, SIGNAL(clicked()), this, SLOT(sDelete()));

  _item->addColumn(tr("Item Number"), _itemColumn, Qt::AlignLeft   , true, "item_number" );
  _item->addColumn(tr("Active"),      _ynColumn,   Qt::AlignCenter , true, "item_active" );
  _item->addColumn(tr("Description"), -1,          Qt::AlignLeft   , true, "item_descrip" );
  _item->addColumn(tr("Class Code"),  _dateColumn, Qt::AlignCenter , true, "classcode_code");
  _item->addColumn(tr("Type"),        _itemColumn, Qt::AlignCenter , true, "item_type");
  _item->addColumn(tr("UOM"),         _uomColumn,  Qt::AlignCenter , true, "uom_name");
  _item->setDragString("itemid=");
  
  connect(omfgThis, SIGNAL(itemsUpdated(int, bool)), this, SLOT(sFillList(int, bool)));
  
  if (_privileges->check("MaintainItemMasters"))
  {
    connect(_item, SIGNAL(valid(bool)), _edit, SLOT(setEnabled(bool)));
    connect(_item, SIGNAL(valid(bool)), _copy, SLOT(setEnabled(bool)));
    connect(_item, SIGNAL(itemSelected(int)), _edit, SLOT(animateClick()));
  }
  else
  {
    _new->setEnabled(FALSE);
    connect(_item, SIGNAL(itemSelected(int)), _view, SLOT(animateClick()));
  }

  if (_privileges->check("DeleteItemMasters"))
    connect(_item, SIGNAL(valid(bool)), _delete, SLOT(setEnabled(bool)));

  sFillList();

  _searchFor->setFocus();
}
Ejemplo n.º 18
0
CString CFilePath::QuoteSpaces(CString const &sString)
{
    if (sString.Find(' ')>=0)
    {
        CString sCopy(sString);
        CStringLock Buffer(sCopy, sCopy.GetLength() + 2);
        PathQuoteSpaces(Buffer);
        Buffer.Release();
        return sCopy;
    }

    return sString;
}
Ejemplo n.º 19
0
void MelBanks::ProcessFrame(float *inp_frame, float *ret_features)
{

	// preprocessing in the time domain
	if(z_mean_source)
        {
           sSubtractAverage(vector_size, inp_frame);
        }

        if(preem_coef != 0.0f)
        {
	   sPreemphasisBW(vector_size, inp_frame, preem_coef);
        }

	sMultVect(vector_size, inp_frame, hamming);

	// FFT
	sSet(fft_vector_size, FFT_real, 0.0f);
	sSet(fft_vector_size, FFT_imag, 0.0f);
	sCopy(vector_size, FFT_real, inp_frame);
	cComplex22N(fft_vector_size, FFT_real, FFT_imag, FFT_vector + 1);
	FFT_vector[0] = 0.0f;

	cFour1(FFT_vector, fft_vector_size, -1);

	c2N2Complex(fft_vector_size_2, FFT_vector + 1, FFT_real, FFT_imag);

	cPower(fft_vector_size_2, FFT_real, FFT_imag);
	//sSqrt(MB_FFTVECTORSIZE_2, FFTReal);

	// Get logarithms of energies in critical bands
	_mbApply(mel_banks, FFT_real, out_en, false);

        if(take_log)
        {
	   sLn(nbanks, out_en);
        }
        sCopy(nbanks, ret_features, out_en);
}
Ejemplo n.º 20
0
bool SpeechRec::ProcessTail()
{
        if(mTrapsEnabled)
        {
		ProcessLastBunch();

		if(lastParamVector < 0)
			return false;
	
		int nparams = actualParams->GetNParams();
		int tshift = TR.GetTrapShift();
	
		// repeate last vector tshift times	
		int i;	
		for(i = 0; i < tshift; i++)
		{
	
			if(i != lastParamVector)
				sCopy(nparams, params + i * nparams, params + lastParamVector * nparams);
		}

		TR.CalcFeaturesBunched(params, posteriors, tshift);

		int j;
		for(j = 0; j < tshift * TR.GetNumOuts(); j++)
			posteriors[j] = (*postSoftFunc)(posteriors[j], postSoftArg1, postSoftArg2, postSoftArg3);

		for(j = 0; j < tshift * TR.GetNumOuts(); j++)
			posteriors[j] = (*decSoftFunc)(posteriors[j], decSoftArg1, decSoftArg2, decSoftArg3);

		for(i = 0; i < tshift; i++)
		{
			if(TR.GetDelay() >= TR.GetTrapShift())    
				DE->ProcessFrame(posteriors + i * TR.GetNumOuts());
		}
	
        }
	else
	{
		int i;
		for(i = 0; i < bunchIdx; i++)
		{
			DE->ProcessFrame(params + i * actualParams->GetNParams());
		}
	}

	bunchIdx = 0;
	lastParamVector = -1;

	return true;
}
Ejemplo n.º 21
0
void PLPCoefs::ProcessFrame(float *pInpFrame, float *pOutFrame)
{

   MelBanks::ProcessFrame(pInpFrame, mpEnergies);

//float a[] = {6.728697e+005, 9.397764e+005, 1.477376e+006, 2.738733e+005, 4.895320e+004, 8.109916e+004, 9.704898e+004, 2.696904e+004, 4.563343e+004, 2.192602e+005, 4.360400e+005, 6.248051e+005, 2.641279e+005, 5.159555e+004, 4.087839e+004, 5.961117e+004, 1.200557e+005, 4.983299e+004, 2.235987e+004, 2.777589e+004, 4.005698e+004, 2.035172e+004, 3.305208e+004, 6.939732e+004};
//sCopy(24, mpEnergies, a);

   int nbanks = GetNBanks();

   // limit energies
   sLowerFloor(nbanks, mpEnergies, 1.0f);

   // apply equal laudness curve
   sMultVect(nbanks, mpEnergies, mpEqualLaudnessCurve);

   // compression of energies
   sPower(nbanks, mpEnergies, mCompressFactor);

   // duplicate the first and the last value 
   sShiftRight(nbanks + 1, mpEnergies, 1);
   mpEnergies[0] = mpEnergies[1];
   mpEnergies[nbanks + 1] = mpEnergies[nbanks];

   // IDCT
   ApplyLinTransform(mppIDFTBases, mLPCOrder + 1, GetNBanks() + 2, mpEnergies, mpAutocorrCoefs);
   
   // autocerrelation -> LPC
   float gain = sDurbin(mpAutocorrCoefs, mpLPC, mpTmp, mLPCOrder);
   assert(gain > 0.0f);

   // LPC -> cepstrum
   sLPC2Cepstrum(mLPCOrder, mpLPC, mpCepst);

   // calculate C0
   mpCepst[mLPCOrder] = -logf(1.0f/gain); 

   // appply liftering window
   if(mCepstralLifter != 0.0f)
   {
      sMultVect(mLPCOrder, mpCepst, mpLifteringWindow);
   }

   // cepstral scaling
   if(mCepstralScale != 1.0f)
   {
      sMultiplication(mLPCOrder + 1, mpCepst, mCepstralScale);
   }

   sCopy((mAddC0 ? mLPCOrder + 1 : mLPCOrder), pOutFrame, mpCepst);
}
Ejemplo n.º 22
0
int pop(str_t *str, bstack_t *stack)
{
	//take an element off the stack.  return 0 if there are no elements
	//pass in a pointer to a string.  if necessary, this routine will 
	//reallocate space for the string to accomodate its size.  If this happens
	//the pointer to the string's (likely) new location is automatically
	//updated and returned.
	int i;

	//copy out the string at the top of the stack
	//then free the stack's copy.
	if (stack->num != 0)
	{
		stack->num--;
		if (stack->type == QUEUE)
		{
			//for queues, the top element is always node 0
			sCopy(str,stack->elements[0]);
			sFree(stack->elements[0]);
			free(stack->elements[0]);
			stack->top--;
			//now we need to adjust all the pointers down 1
			for (i=1;i<stack->num;i++)
				stack->elements[i-1] = stack->elements[i];
		}
		else
		{
			sCopy(str,stack->elements[stack->top]);
			//sFree(stack->elements[stack->top]);
			//free(stack->elements[stack->top]);
			stack->top--;
		}
		return 1;
	}
	else
		return 0;
}
Ejemplo n.º 23
0
void split(const std::string& s,
           const std::string& delim,
           std::vector<std::string>& ret)
{
    std::string sCopy(s);
    size_t pos = 0;
    std::string token;
    while ((pos = sCopy.find(delim)) != std::string::npos)
    {
        token = sCopy.substr(0, pos);
        ret.push_back(token);
        sCopy.erase(0, pos + delim.size());
    }
    ret.push_back(sCopy);
}
Ejemplo n.º 24
0
copyTransferOrder::copyTransferOrder(QWidget* parent, const char* name, bool modal, Qt::WFlags fl)
    : XDialog(parent, name, modal, fl)
{
  setupUi(this);

  connect(_copy,	SIGNAL(clicked()), this, SLOT(sCopy()));
  connect(_to,	       SIGNAL(newId(int)), this, SLOT(populate()));

  _captive = FALSE;

  _item->addColumn(tr("#"),       _seqColumn, Qt::AlignRight, true, "toitem_linenumber");
  _item->addColumn(tr("Item"),   _itemColumn, Qt::AlignLeft,  true, "item_number");
  _item->addColumn(tr("Description"),     -1, Qt::AlignLeft,  true, "description");
  _item->addColumn(tr("Ordered"), _qtyColumn, Qt::AlignRight, true, "toitem_qty_ordered");
}
Ejemplo n.º 25
0
/*
 *  Constructs a copyBOO as a child of 'parent', with the
 *  name 'name' and widget flags set to 'f'.
 *
 *  The dialog will by default be modeless, unless you set 'modal' to
 *  true to construct a modal dialog.
 */
copyBOO::copyBOO(QWidget* parent, const char* name, bool modal, Qt::WFlags fl)
    : QDialog(parent, name, modal, fl)
{
  setupUi(this);


  // signals and slots connections
  connect(_copy, SIGNAL(clicked()), this, SLOT(sCopy()));
  connect(_source, SIGNAL(valid(bool)), this, SLOT(sHandleButtons()));
  connect(_target, SIGNAL(valid(bool)), this, SLOT(sHandleButtons()));
  connect(_close, SIGNAL(clicked()), this, SLOT(reject()));

  _captive = FALSE;

  _source->setType(ItemLineEdit::cGeneralManufactured | ItemLineEdit::cGeneralPurchased);
  _target->setType(ItemLineEdit::cGeneralManufactured | ItemLineEdit::cGeneralPurchased);
}
Ejemplo n.º 26
0
/*
 *  Constructs a salesCategories as a child of 'parent', with the
 *  name 'name' and widget flags set to 'f'.
 *
 */
salesCategories::salesCategories(QWidget* parent, const char* name, Qt::WFlags fl)
    : XMainWindow(parent, name, fl)
{
    setupUi(this);

    (void)statusBar();

    // signals and slots connections
    connect(_edit, SIGNAL(clicked()), this, SLOT(sEdit()));
    connect(_view, SIGNAL(clicked()), this, SLOT(sView()));
    connect(_delete, SIGNAL(clicked()), this, SLOT(sDelete()));
    connect(_print, SIGNAL(clicked()), this, SLOT(sPrint()));
    connect(_close, SIGNAL(clicked()), this, SLOT(close()));
    connect(_new, SIGNAL(clicked()), this, SLOT(sNew()));
    connect(_copy, SIGNAL(clicked()), this, SLOT(sCopy()));
    connect(_salescat, SIGNAL(valid(bool)), _view, SLOT(setEnabled(bool)));
    init();
}
Ejemplo n.º 27
0
void items::sPopulateMenu(QMenu *pMenu)
{
  int menuItem;

  menuItem = pMenu->insertItem(tr("Edit..."), this, SLOT(sEdit()), 0);
  if (!_privleges->check("MaintainItemMasters"))
    pMenu->setItemEnabled(menuItem, FALSE);

  menuItem = pMenu->insertItem(tr("View..."), this, SLOT(sView()), 0);

  menuItem = pMenu->insertItem(tr("Copy..."), this, SLOT(sCopy()), 0);
  if (!_privleges->check("MaintainItemMasters"))
    pMenu->setItemEnabled(menuItem, FALSE);

  menuItem = pMenu->insertItem(tr("Delete..."), this, SLOT(sDelete()), 0);
  if (!_privleges->check("MaintainItemMasters"))
    pMenu->setItemEnabled(menuItem, FALSE);
}
Ejemplo n.º 28
0
openSalesOrders::openSalesOrders(QWidget* parent, const char* name, Qt::WFlags fl)
    : XWidget(parent, name, fl)
{
  setupUi(this);
  
  _cust->hide();
  _showGroup->hide();

  connect(_print, SIGNAL(clicked()), this, SLOT(sPrint()));
  connect(_so, SIGNAL(populateMenu(QMenu*,QTreeWidgetItem*,int)), this, SLOT(sPopulateMenu(QMenu*)));
  connect(_edit, SIGNAL(clicked()), this, SLOT(sEdit()));
  connect(_view, SIGNAL(clicked()), this, SLOT(sView()));
  connect(_new, SIGNAL(clicked()), this, SLOT(sNew()));
  connect(_delete, SIGNAL(clicked()), this, SLOT(sDelete()));
  connect(_copy, SIGNAL(clicked()), this, SLOT(sCopy()));
  connect(_autoUpdate, SIGNAL(toggled(bool)), this, SLOT(sHandleAutoUpdate(bool)));
  connect(_showClosed, SIGNAL(toggled(bool)), this, SLOT(sFillList()));

  _so->addColumn(tr("S/O #"),           _orderColumn, Qt::AlignLeft,  true, "cohead_number");
  _so->addColumn(tr("Cust. #"),         _orderColumn, Qt::AlignLeft,  true, "cust_number");
  _so->addColumn(tr("Customer"),         -1,          Qt::AlignLeft,  true, "cohead_billtoname");
  _so->addColumn(tr("Ship-To"),          _itemColumn, Qt::AlignLeft,  false,"cohead_shiptoname");
  _so->addColumn(tr("Cust. P/O Number"), -1         , Qt::AlignLeft,  true, "cohead_custponumber");
  _so->addColumn(tr("Ordered"),          _dateColumn, Qt::AlignCenter,true, "cohead_orderdate");
  _so->addColumn(tr("Scheduled"),        _dateColumn, Qt::AlignCenter,true, "scheddate");
  _so->addColumn(tr("Status"),         _statusColumn, Qt::AlignLeft, false, "status");
  
  if (_privileges->check("MaintainSalesOrders"))
  {
    connect(_so, SIGNAL(valid(bool)), _edit, SLOT(setEnabled(bool)));
    connect(_so, SIGNAL(valid(bool)), _copy, SLOT(setEnabled(bool)));
    connect(_so, SIGNAL(valid(bool)), _delete, SLOT(setEnabled(bool)));
    connect(_so, SIGNAL(itemSelected(int)), _edit, SLOT(animateClick()));
  }
  else
  {
    _new->setEnabled(FALSE);
    connect(_so, SIGNAL(itemSelected(int)), _view, SLOT(animateClick()));
  }

  connect(omfgThis, SIGNAL(salesOrdersUpdated(int, bool)), this, SLOT(sFillList()));

  sHandleAutoUpdate(_autoUpdate->isChecked());
}
Ejemplo n.º 29
0
/*
 *  Constructs a locales as a child of 'parent', with the
 *  name 'name' and widget flags set to 'f'.
 *
 */
locales::locales(QWidget* parent, const char* name, Qt::WFlags fl)
    : XWidget(parent, name, fl)
{
    setupUi(this);

//    (void)statusBar();

    // signals and slots connections
    connect(_locale, SIGNAL(valid(bool)), _delete, SLOT(setEnabled(bool)));
    connect(_close, SIGNAL(clicked()), this, SLOT(close()));
    connect(_new, SIGNAL(clicked()), this, SLOT(sNew()));
    connect(_edit, SIGNAL(clicked()), this, SLOT(sEdit()));
    connect(_delete, SIGNAL(clicked()), this, SLOT(sDelete()));
    connect(_locale, SIGNAL(itemSelected(int)), _edit, SLOT(animateClick()));
    connect(_locale, SIGNAL(valid(bool)), _edit, SLOT(setEnabled(bool)));
    connect(_copy, SIGNAL(clicked()), this, SLOT(sCopy()));
    connect(_locale, SIGNAL(valid(bool)), _copy, SLOT(setEnabled(bool)));
    init();
}
Ejemplo n.º 30
0
/*
 *  Constructs a itemPricingSchedules as a child of 'parent', with the
 *  name 'name' and widget flags set to 'f'.
 *
 */
itemPricingSchedules::itemPricingSchedules(QWidget* parent, const char* name, Qt::WFlags fl)
    : XMainWindow(parent, name, fl)
{
  setupUi(this);

  (void)statusBar();

  // signals and slots connections
  connect(_new, SIGNAL(clicked()), this, SLOT(sNew()));
  connect(_edit, SIGNAL(clicked()), this, SLOT(sEdit()));
  connect(_delete, SIGNAL(clicked()), this, SLOT(sDelete()));
  connect(_showExpired, SIGNAL(toggled(bool)), this, SLOT(sFillList()));
  connect(_searchFor, SIGNAL(textChanged(const QString&)), this, SLOT(sSearch(const QString&)));
  connect(_close, SIGNAL(clicked()), this, SLOT(close()));
  connect(_showFuture, SIGNAL(toggled(bool)), this, SLOT(sFillList()));
  connect(_ipshead, SIGNAL(valid(bool)), _view, SLOT(setEnabled(bool)));
  connect(_view, SIGNAL(clicked()), this, SLOT(sView()));
  connect(_copy, SIGNAL(clicked()), this, SLOT(sCopy()));

  statusBar()->hide();
  
  _ipshead->addColumn(tr("Name"),        _itemColumn, Qt::AlignLeft,   true,  "ipshead_name"   );
  _ipshead->addColumn(tr("Description"), -1,          Qt::AlignLeft,   true,  "ipshead_descrip"   );
  _ipshead->addColumn(tr("Effective"),   _dateColumn, Qt::AlignCenter, true,  "ipshead_effective" );
  _ipshead->addColumn(tr("Expires"),     _dateColumn, Qt::AlignCenter, true,  "ipshead_expires" );

  if (_privileges->check("MaintainPricingSchedules"))
  {
    connect(_ipshead, SIGNAL(valid(bool)), _edit, SLOT(setEnabled(bool)));
    connect(_ipshead, SIGNAL(valid(bool)), _copy, SLOT(setEnabled(bool)));
    connect(_ipshead, SIGNAL(valid(bool)), _delete, SLOT(setEnabled(bool)));
    connect(_ipshead, SIGNAL(itemSelected(int)), _edit, SLOT(animateClick()));
  }
  else
  {
    _new->setEnabled(FALSE);
    connect(_ipshead, SIGNAL(itemSelected(int)), _view, SLOT(animateClick()));
  }

  sFillList();

  _searchFor->setFocus();
}