示例#1
0
MdiEditor::MdiEditor(QApplication* app,QWidget *parent)
: QMainWindow(parent)
{

	_app=app;
	readyLabel=NULL;
	new_pro=save_pro=mod_para=NULL;
	imageEditorL = new ImageEditor('L');
	imageEditorR = new ImageEditor('R');
	imageEditorM = new HalfwayImage('M');
	widgetA = new QWidget();
	imageEditorA = new RenderWidget();
	ctrbar=new CCtrBar();

	for(int i=0;i<MAX_LAYER;i++)
	{
		match_thread[i]=NULL;
		match_thread_GPU[i]=NULL;
		poison_thread[i]=NULL;
		qpath_thread[i]=NULL;
	}


	createDockWidget();
	createMenuBar();
	createStatusBar();
	gpu_flag=FALSE;
	gpu_cap=CudaInit();

	connect(imageEditorL,SIGNAL(sigUpdate()),this,SLOT(updateALL()));
	connect(imageEditorR,SIGNAL(sigUpdate()),this,SLOT(updateALL()));
	connect(imageEditorM,SIGNAL(sigUpdate()),this,SLOT(updateALL()));
	connect(ctrbar,SIGNAL(sigUpdate()),this,SLOT(updateALL()));
	connect(imageEditorL,SIGNAL(sigModified()),this,SLOT(PtModified()));
	connect(imageEditorR,SIGNAL(sigModified()),this,SLOT(PtModified()));
	connect(imageEditorM,SIGNAL(sigModified()),this,SLOT(PtModified()));
	connect(imageEditorL,SIGNAL(sigLayerReorder(char, bool,float, float)),this,SLOT(ReorderLayer(char, bool,float, float)));
	connect(imageEditorR,SIGNAL(sigLayerReorder(char, bool,float, float)),this,SLOT(ReorderLayer(char, bool,float, float)));
	connect(ctrbar,SIGNAL(sigStatusChange(int)),imageEditorA,SLOT(StatusChange(int)));
	connect(ctrbar,SIGNAL(sigRangeChange(int)),imageEditorA,SLOT(RangeChange(int)));
	connect(imageEditorA,SIGNAL(sigRecordFinished()),ctrbar,SLOT(record_finished()));
	connect(imageEditorA,SIGNAL(sigRecordFinished()),this,SLOT(AutoQuit()));

	layer_num=0;
	layer_index=0;

	clear();
    setWindowTitle(tr("Pixel Morph"));
	showMaximized();

}
示例#2
0
system::system(QWidget *parent) :
    QWidget(parent)

{
    connect(&timer, SIGNAL(timeout()), this, SLOT(updateALL()));
    timer.start(1);
}
示例#3
0
 void MdiEditor::SetResults(int index)
 {
	 if(layer_index==index)
	 {
		 imageEditorM->setImage(pyramids,index,index);
		 QString path;

		 path.sprintf("%s\\%d",pro_path.toLatin1().data(),index);

		 imageEditorA->set(path,pyramids,index,index,&parameters[index]);

		 if (thread_flag[index]==0)
		 {
			 delete readyLabel;
			 readyLabel = new QLabel(tr("Please create/load a project"));
			 statusBar()->addWidget(readyLabel, 1);
			 imageDockEditorM->setPalette(QPalette(QColor ( 219, 219, 219 )));
			 imageDockEditorA->setPalette(QPalette(QColor ( 219, 219, 219 )));
		 }
		 else if(thread_flag[index]==1)
		 {
			 float percentage = 0;
			 if(gpu_flag&&match_thread_GPU[layer_index])
				percentage=(float)match_thread_GPU[index]->_current_iter/(float)match_thread_GPU[index]->_total_iter*100;
			if(!gpu_flag&&match_thread[layer_index])
				percentage=(float)match_thread[index]->_current_iter/(float)match_thread[index]->_total_iter*100;
			 delete readyLabel;
			 QString str;
			 str.sprintf("optimizing %f%%",percentage);
			 readyLabel = new QLabel(str);
			 statusBar()->addWidget(readyLabel);
			 imageDockEditorM->setPalette(QPalette(QColor ( 255, 0, 0 )));
			 imageDockEditorA->setPalette(QPalette(QColor ( 255, 0, 0 )));
		 }

		 else if(thread_flag[index]<4)
		 {
			 delete readyLabel;
			 readyLabel = new QLabel(tr("optimization finished, post-processing"));
			 statusBar()->addWidget(readyLabel, 1);
			 imageDockEditorM->setPalette(QPalette(QColor ( 255, 255, 0 )));
			 imageDockEditorA->setPalette(QPalette(QColor ( 255, 255, 0 )));
		 }
		 else
		 {
			 delete readyLabel;
			 readyLabel = new QLabel(tr("Completed"));
			 statusBar()->addWidget(readyLabel, 1);
			 imageDockEditorM->setPalette(QPalette(QColor ( 0, 255, 0 )));
			 imageDockEditorA->setPalette(QPalette(QColor ( 0, 255, 0 )));

			 if (_auto)
			 {
				 ctrbar->_status=0;
				 imageEditorA->StatusChange(0);
			 }
		 }

		  updateALL();
	 }
 }