示例#1
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__);
	}
}
示例#2
0
void OperationListWidget::notifyUpdateOnModel(void)
{
	updateOperationList();
	emit s_operationExecuted();
}