void DatabaseImportForm::captureThreadError(Exception e)
{
	QPixmap ico;
	QTreeWidgetItem *item=nullptr;

	if(!create_model)
		model_wgt->rearrangeSchemas(QPointF(origin_sb->value(), origin_sb->value()),
									tabs_per_row_sb->value(), sch_per_row_sb->value(), obj_spacing_sb->value());

	destroyModelWidget();
	finishImport(trUtf8("Importing process aborted!"));

	ico=QPixmap(PgModelerUiNS::getIconPath("msgbox_erro"));
	ico_lbl->setPixmap(ico);

	item=PgModelerUiNS::createOutputTreeItem(output_trw, PgModelerUiNS::formatMessage(e.getErrorMessage()), ico, nullptr, false, true);
	PgModelerUiNS::createExceptionsTree(output_trw, e, item);

	//Destroy the current import thread and helper to avoid reuse
	destroyThread();

	//Recreates a new import thread and helper to force user to reconfigure the import
	createThread();

	database_cmb->setCurrentIndex(0);
	throw Exception(e.getErrorMessage(), e.getErrorType(),__PRETTY_FUNCTION__,__FILE__,__LINE__, &e);
}
Ejemplo n.º 2
0
void DatabaseImportForm::captureThreadError(Exception e)
{
	destroyModelWidget();
	finishImport(trUtf8("Importing process aborted!"));
	ico_lbl->setPixmap(QPixmap(QString(":/icones/icones/msgbox_erro.png")));
	throw Exception(e.getErrorMessage(), e.getErrorType(),__PRETTY_FUNCTION__,__FILE__,__LINE__, &e);
}
Ejemplo n.º 3
0
void OperationList::redoOperation(void)
{
	if(isRedoAvailable())
	{
		Operation *operation=NULL;
		bool chain_active=false;
		Exception error;
		unsigned chain_size=0, pos=0;

		if(!this->signalsBlocked())
			chain_size=getChainSize();

		do
		{
			//Gets the current operation
			operation=operations[current_index];

			/* If it is detected that the operation is chained with other
			and active chaining flag is cleared marks the flag to start
			the execution several operations at once */
			if(!ignore_chain && !chain_active &&
				 operation->chain_type!=Operation::NO_CHAIN)
				chain_active=true;

			/* If the chaining is active and the current operation is not part of
			chain or it is at the start of chain, aborts execution of the operation */
			else if(chain_active &&
							(operation->chain_type==Operation::CHAIN_START ||
							 operation->chain_type==Operation::NO_CHAIN))
				break;

			try
			{
				if(chain_size > 0)
				{
					//Emits a signal with the current progress of operation execution
					pos++;
					emit s_operationExecuted((pos/static_cast<float>(chain_size))*100,
																	 trUtf8("Redoing operation on object:: %1 (%2)")
																	 .arg(operation->pool_obj->getName())
																	 .arg(operation->pool_obj->getTypeName()),
																	 operation->pool_obj->getObjectType());
				}

				//Executes the redo operation (second argument as 'true')
				executeOperation(operation, true);
			}
			catch(Exception &e)
			{
				error=e;
			}
			current_index++;
		}
		/* Performs the operations while the current operation is part of chain
		 or the redo option is available */
		while(!ignore_chain && isRedoAvailable()  && operation->chain_type!=Operation::NO_CHAIN);

		if(error.getErrorType()!=ERR_CUSTOM)
			throw Exception(error.getErrorMessage(), error.getErrorType(),__PRETTY_FUNCTION__,__FILE__,__LINE__);
	}
}