예제 #1
0
void CFileListView::ShowFileInfo( FileInfo& Item )
{
	UInt32 nIndex = 0;

	DeleteAllItems();

	if(m_FileStack.size() > 1)
	{
		InsertItem(nIndex, "..",1);
		SetSubItem(nIndex, 1, DIR_STR);
		SetSubItem(nIndex, 2, DIR_STR);
		++nIndex;
	}

	for (UInt32 i = 0; i < Item.Chlids.size(); ++i,++nIndex)
	{
		FileInfo& info = Item.Chlids[i];
		InsertItem(nIndex, info.szName, info.nFileSize ? 0 : 1);

		if(info.nFileSize > 0)
		{
			SetSubItem(nIndex, 1, (char*)ConvertSize(info.nFileSize));
			SetSubItem(nIndex, 2, (char*)ConvertSize(info.nCompSize));
			SetSubItem(nIndex, 4, info.bDataComplete ? "Y" : "N");
		}
		else
		{
			SetSubItem(nIndex, 1, DIR_STR);
			SetSubItem(nIndex, 2, DIR_STR);
		}

		if(info.FileTime != 0)
			SetSubItem(nIndex, 3, (char*)ConvertTime(&(info.FileTime)));
	}
}
예제 #2
0
void TxtTabular::parsefrom(StrPtr icols, StrPtr icontent)
{
	QString cols=icols;
	colaligns.reset();
	while (qstrlen(cols)>0)
	{
		bool processed=false;
		if ((!processed)&&(cols[0]=='|'))
		{
			vertlineleftfrom.add(colaligns.G_count());
			cols.substring(1,cols.G_length());
			processed=true;
		}
		if ((!processed)&&(cols[0]=='l'))
		{ 
			colaligns.add(-1); fixedcolsizes.add(-1); 
			cols.substring(1,cols.G_length());
			processed=true;
		}
		if ((!processed)&&(cols[0]=='c'))
		{ 
			colaligns.add(0); fixedcolsizes.add(-1); 
			cols.substring(1,cols.G_length());
			processed=true;
		}
		if ((!processed)&&(cols[0]=='r'))
		{ 
			colaligns.add(+1); fixedcolsizes.add(-1); 
			cols.substring(1,cols.G_length());
			processed=true;
		}
		if ((!processed)&&(cols[0]=='p'))
		{
			cols.substring(1,cols.G_length());
			QString substr;
			colaligns.add(-1);
			getargument(cols,substr,true);
			fixedcolsizes.add(ConvertSize(substr,fnt));
			processed=true;
		}
	}

	colcount=colaligns.G_count();

	QString content;content=icontent;

	while (content.G_length()>0)
	{
		QString linetxt;
		content.splitstring(_qstr("\\\\"),linetxt);
		eatstartspaces(linetxt);
		if (trykeyword(linetxt,_qstr("\\hline")))
		{
			horlinetopof.add(lines.G_count());
			eatstartspaces(linetxt);
		}
		if (linetxt.G_length()>0)
		{
			TabularLine *line=new TabularLine;lines.add(line);
			int curcolnr=0;
			while (linetxt.G_length()>0)
			{
				QString celltxt;
				linetxt.splitstring(_qstr("&"),celltxt);
				eatstartspaces(celltxt);eatendspaces(celltxt);
				TabularCell *cell=new TabularCell(env,fnt);
				cell->colnr_start=curcolnr;cell->colnr_end=curcolnr;
				if (trykeyword(celltxt,_qstr("\\multicolumn")))
				{
					QString arg_num,arg_align,arg_content;
					getargument(celltxt,arg_num,true);
					getargument(celltxt,arg_align,true);
					getargument(celltxt,arg_content,true);
					if (arg_align[0]=='l') cell->align=-1;
					if (arg_align[0]=='c') cell->align= 0;
					if (arg_align[0]=='r') cell->align=+1;
					cell->colnr_end=cell->colnr_start+qstr2int(arg_num)-1;
					celltxt=arg_content;
				}
				cell->parsefrom(celltxt);
				line->cells.add(cell);
				curcolnr++;
				if (curcolnr>colcount) colcount=curcolnr;
			}
		}
	}

}