Exemplo n.º 1
0
void tableView::RedoTable()
{
   clear();

   if (pDoc->m_meta_graph->viewingProcessed()) {
      const AttributeTable& table = pDoc->m_meta_graph->getAttributeTable();
      const AttributeIndex& index = table.m_display_index;
      int col = pDoc->m_meta_graph->getDisplayedAttribute();
	  int i;

      m_column_count = table.getColumnCount();
	  setColumnCount(m_column_count+1);
      connect(horizontalHeader(), SIGNAL(sectionClicked(int)), this, SLOT(colum_Sort(int)));
	  verticalHeader()->hide();

	  QTableWidgetItem *Item = new QTableWidgetItem("Ref Number");
	  Item->setTextAlignment(Qt::AlignLeft);
	  setHorizontalHeaderItem(0, Item);

	  for (i = 0; i < m_column_count; i++) {
         QTableWidgetItem *Item = new QTableWidgetItem(QString("%1").arg(table.getColumnName(i).c_str()));
		 Item->setTextAlignment(Qt::AlignLeft);
		 setHorizontalHeaderItem(i+1, Item);
      }

	  m_row_count = table.getRowCount();
	  setRowCount(m_row_count);
	  PrepareCache(0, m_curr_row);
   }
}
Exemplo n.º 2
0
int CMOBV::GetSignal( int nIndex, UINT * pnCode )
{
	if( pnCode )	*pnCode	=	ITSC_NOTHING;
	if( !m_pKData || nIndex < 0 || nIndex >= m_pKData->GetSize() )
		return ITS_NOTHING;

	PrepareCache( 0, -1, FALSE );
	
	int	nMaxDays	=	max( m_nDays1 , m_nDays2 );
	double	dLiminalLow = 0, dLiminalHigh = 0;
	if( !IntensityPreparePrice( nIndex, pnCode, nMaxDays, ITS_GETMINMAXDAYRANGE, &dLiminalLow, &dLiminalHigh, 0.5, 0.5 ) )
		return ITS_NOTHING;

	double	dPriceNow	=	m_pKData->MaindataAt(nIndex);

	if( dPriceNow < dLiminalLow
		&& ( IsGoldenFork( nIndex, m_pdCache1, m_pdCache2 ) || IsGoldenFork( nIndex, m_pdCache2, m_pdCache3 ) ) )
	{	// 低位金叉
		if( pnCode )	*pnCode	=	ITSC_GOLDENFORK;
		return m_itsGoldenFork;
	}
	if( dPriceNow > dLiminalHigh
		&& ( IsDeadFork( nIndex, m_pdCache1, m_pdCache2 ) || IsDeadFork( nIndex, m_pdCache2, m_pdCache3 ) ) )
	{	// 高位死叉
		if( pnCode )	*pnCode	=	ITSC_DEADFORK;
		return m_itsDeadFork;
	}

	return	ITS_NOTHING;
}
Exemplo n.º 3
0
int tableView::OnRedraw(int wParam, int lParam)
{
   bool done = false;
   if (pDoc->GetRemenuFlag(QGraphDoc::VIEW_TABLE)) {
      pDoc->SetRemenuFlag(QGraphDoc::VIEW_TABLE,false);
      // this is big: start from scratch...
      RedoTable();
      done = true;
   }
   int flag = pDoc->GetRedrawFlag(QGraphDoc::VIEW_TABLE);
   if (flag != QGraphDoc::REDRAW_DONE) {
      //
      while (!pDoc->SetRedrawFlag(QGraphDoc::VIEW_TABLE,QGraphDoc::REDRAW_DONE)) {
         // prefer waitformultipleobjects here
      }
      //
      if (!done && lParam != (long) this) {
         if (wParam == QGraphDoc::NEW_TABLE) {
            // this is big start from scratch...
            RedoTable();
            done = true;
         }
         else {
            // redo the cache and redisplay
            PrepareCache(0, m_curr_row);
         }
      }
   }

   return 0;
}
Exemplo n.º 4
0
void tableView::scrollContentsBy(int dx, int dy)
{
	if(!dy){
		QTableWidget::scrollContentsBy(dx, 0);
		return;
	}
	PrepareCache(m_curr_row, m_curr_row - dy);
	m_curr_row -= dy;
	QTableWidget::scrollContentsBy(dx, dy);
}
Exemplo n.º 5
0
void tableView::colum_Sort(int col_id)
{
	if (col_id - 1 != pDoc->m_meta_graph->getDisplayedAttribute())
	{
		pDoc->m_meta_graph->setDisplayedAttribute(col_id - 1);
		clearContents();
		PrepareCache(0, m_curr_row);
		return;

		RedoTable();
	}
}
// -----------------------------------------------------------------------------
// RSIPSecChallengeResolver::OpenL
// -----------------------------------------------------------------------------
//
void RSIPSecChallengeResolver::OpenL( const MSIPSecUser& aUser )
    {
    CSIPResponse& response = iContext->SIPResponse();
    RStringF algorithm;
	RStringF qop;
	TBool digestInSecServer =
		GetDigestParamsFromSecurityServer( response, algorithm, qop );

    ResetAndDestroy();
    const RStringF proxyAuth =
    	SIPStrings::StringF( SipStrConsts::EProxyAuthenticateHeader );

    TBool digestInAuthHeaders( EFalse );
    
    TInt challengeCount = 0;    
    if ( response.HeaderCount( proxyAuth ) > 0 )
        {
    	TSglQueIter< CSIPHeaderBase > authHeaders =
    		response.Headers( proxyAuth );
    	FindAndCreateChallengesL( authHeaders, CSIPSecDigest::EProxy,
    	                          challengeCount, algorithm, qop, 
    	                          digestInAuthHeaders );
        }

    const RStringF wwwAuth =
    	SIPStrings::StringF( SipStrConsts::EWWWAuthenticateHeader );
    if ( response.HeaderCount( wwwAuth ) > 0 &&
    	 challengeCount < KSIPSecMaxChallengesPerResponse )
        {
    	TSglQueIter< CSIPHeaderBase > authHeaders = response.Headers( wwwAuth );
    	FindAndCreateChallengesL( authHeaders, CSIPSecDigest::EEndPoint, 
    	                          challengeCount, algorithm, qop,
    	                          digestInAuthHeaders );
        }

    PrepareCache( aUser );

	// If 401/407 has no www-authenticate or proxy-authenticate headers or all
	// challenges are ignored => error.
	if ( ( digestInSecServer || digestInAuthHeaders ) &&
		 ( response.ResponseCode() == 401 || response.ResponseCode() == 407 ) &&
		 Count() == 0 )
        {
        User::Leave( KErrSIPForbidden );
        }	
    }
Exemplo n.º 7
0
int COBV::GetSignal( int nIndex, UINT * pnCode )
{
	if( pnCode )	*pnCode	=	ITSC_NOTHING;
	PrepareCache( 0, -1, FALSE );

	if( IsDeviateOnBottom( nIndex, m_pdCache1, m_pdCache2 ) )
	{	// 底背离
		if( pnCode )	*pnCode	=	ITSC_DEVIATEONBOTTOM;
		return m_itsDeviateOnBottom;
	}
	if( IsDeviateOnTop( nIndex, m_pdCache1, m_pdCache2 ) )
	{	// 顶背离
		if( pnCode )	*pnCode	=	ITSC_DEVIATEONTOP;
		return m_itsDeviateOnTop;
	}

	return	ITS_NOTHING;
}
Exemplo n.º 8
0
void tableView::itemChanged(QTableWidgetItem * item)
{
	if(in_update) return;
	int row = item->row();
	int col = item->column();
	if(col == 0)
	{
		pvecint x;
		AttributeTable& table = pDoc->m_meta_graph->getAttributeTable();
		AttributeIndex& index = table.m_display_index;
		x.push_back(table.getRowKey(index[row].index));
		pDoc->m_meta_graph->setSelSet(x);
		pDoc->SetRedrawFlag(QGraphDoc::VIEW_ALL,QGraphDoc::REDRAW_POINTS, QGraphDoc::NEW_SELECTION, this);
		PrepareCache(0, m_curr_row);
	}
	else
	{
         wchar_t *endptr;
         // first reset contents:
         double value = wcstod((wchar_t*)item->text().utf16(), &endptr); // AT: Unicode conversion -- this doesn't look safe -- edittext is a CString!
         if (endptr == (wchar_t*)item->text().utf16()) {
			QMessageBox::warning(this, tr("Warning"), tr("Cannot convert text to number"), QMessageBox::Ok, QMessageBox::Ok);
            return;
         }

         MetaGraph *graph = pDoc->m_meta_graph;
         if (graph && graph->viewingProcessed()) {
            // go for the change:
            AttributeTable &table = graph->getAttributeTable();
            double value2 = table.getValue(table.m_display_index[row].index, col-1);
            if (value2 == 0 || fabs((value / value2) - 1.0) > 1e-5) {
               table.changeValue(table.m_display_index[row].index, col-1, value);
               pDoc->modifiedFlag = true;
            }

			RedoTable();
            // note: this as caller will prevent us from redrawing ourself:
            // could be either new data or new selection, just go for a big redraw:
            pDoc->SetRedrawFlag(QGraphDoc::VIEW_ALL, QGraphDoc::REDRAW_GRAPH, QGraphDoc::NEW_DATA,this);
		}
	}
}
Exemplo n.º 9
0
int CPVI::GetSignal( int nIndex, UINT * pnCode )
{
	PrepareCache( 0, -1, FALSE );
	// 金叉死叉
	return GetForkSignal( nIndex, m_itsGoldenFork, m_itsDeadFork, pnCode );
}