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);
}
Пример #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);
}
Пример #3
0
void DatabaseImportForm::handleImportFinished(Exception e)
{	
	if(!e.getErrorMessage().isEmpty())
	{
		Messagebox msgbox;
		msgbox.show(e, e.getErrorMessage(), Messagebox::ALERT_ICON);
	}

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

	finishImport(trUtf8("Importing process sucessfuly ended!"));
	ico_lbl->setPixmap(QPixmap(QString(":/icones/icones/msgbox_info.png")));

  import_helper.closeConnection();
  import_thread->quit();
  timer.stop();

	this->accept();
}
void DatabaseImportForm::handleImportFinished(Exception e)
{	
	if(!e.getErrorMessage().isEmpty())
	{
		Messagebox msgbox;
		msgbox.show(e, e.getErrorMessage(), Messagebox::ALERT_ICON);
	}

	model_wgt->rearrangeSchemas(QPointF(origin_sb->value(), origin_sb->value()),
															tabs_per_row_sb->value(), sch_per_row_sb->value(), obj_spacing_sb->value());
	model_wgt->getDatabaseModel()->setInvalidated(false);

	finishImport(trUtf8("Importing process sucessfuly ended!"));
	ico_lbl->setPixmap(QPixmap(PgModelerUiNS::getIconPath("msgbox_info")));

	import_helper->closeConnection();
	import_thread->quit();
	import_thread->wait();

	this->accept();
}
Пример #5
0
void SQLToolWidget::showError(Exception &e)
{
    QListWidgetItem *item=new QListWidgetItem(QIcon(":/icones/icones/msgbox_erro.png"), e.getErrorMessage());
    msgoutput_lst->clear();
    msgoutput_lst->addItem(item);
    msgoutput_lst->setVisible(true);
    results_parent->setVisible(false);
    export_tb->setEnabled(false);
}
Пример #6
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__);
	}
}
Пример #7
0
void MessageBox::show(Exception e, const QString &msg, unsigned icon_type)
{
	deque<Exception> list;
	deque<Exception>::reverse_iterator itr,itr_end;
	QTreeWidgetItem *item=NULL,*item1=NULL,*item2=NULL;
	QLabel *label=NULL;
	int idx=0;
	Exception *ex=NULL;
	QString str_aux, title;
	QFont font=this->font();

	show_errors_txt_tb->blockSignals(true);
	show_errors_txt_tb->setChecked(false);
	show_errors_txt_tb->blockSignals(false);

	exceptions_txt->setPlainText(e.getExceptionsText());

	e.getExceptionsList(list);

	itr=list.rbegin();
	itr_end=list.rend();

	while(itr!=itr_end)
	{
		ex=&(*itr);

		item=new QTreeWidgetItem;
		str_aux=QString("[%1] - %2")
						.arg(idx)
						.arg(ex->getMethod());
		item->setIcon(0,QPixmap(QString(":/icones/icones/funcao.png")));
		exceptions_trw->insertTopLevelItem(0,item);
		label=new QLabel;
		label->setFont(font);
		label->setWordWrap(true);
		label->setText(str_aux);
		exceptions_trw->setItemWidget(item, 0, label);

		item1=new QTreeWidgetItem(item);
		item1->setIcon(0,QPixmap(QString(":/icones/icones/codigofonte.png")));
		item1->setText(0,ex->getFile() + " (" + ex->getLine() + ")");

		item2=new QTreeWidgetItem(item);
		item2->setIcon(0,QPixmap(QString(":/icones/icones/msgbox_alerta.png")));
		item2->setText(0,Exception::getErrorCode(ex->getErrorType()) +
									 " (" + QString("%1").arg(ex->getErrorType()) + ")");

		item1=new QTreeWidgetItem(item);
		item1->setIcon(0,QPixmap(":/icones/icones/msgbox_erro.png"));
		label=new QLabel;
		label->setWordWrap(true);
		label->setFont(font);
		label->setStyleSheet("color: #ff0000;");
		exceptions_trw->setItemWidget(item1, 0, label);
		label->setText(ex->getErrorMessage());

		if(!ex->getExtraInfo().isEmpty())
		{
			item1=new QTreeWidgetItem(item);
			item1->setIcon(0,QPixmap(QString(":/icones/icones/msgbox_info.png")));
			label=new QLabel;
			label->setWordWrap(true);
			label->setFont(font);
			label->setStyleSheet("color: #000080;");
			exceptions_trw->setItemWidget(item1, 0, label);
			label->setText(ex->getExtraInfo());
		}

		itr++;
		idx++;
	}

	switch(icon_type)
	{
		case ERROR_ICON:
			title=trUtf8("Error");
		break;

		case ALERT_ICON:
			title=trUtf8("Alert");
		break;

		case INFO_ICON:
			title=trUtf8("Information");
		break;

		default:
			title="";
		break;
	}

	if(msg.isEmpty())
		str_aux=e.getErrorMessage();
	else
		str_aux=msg;

	this->show(title,str_aux,icon_type,OK_BUTTON);
}
Пример #8
0
    void InputArray::handleError(Exception const& x,
                                 boost::shared_ptr<ChunkIterator> cIter,
                                 AttributeID i)
    {
        SCIDB_ASSERT(_chunkLoader);
        string const& msg = x.getErrorMessage();
        Attributes const& attrs = desc.getAttributes();
        LOG4CXX_ERROR(logger, "Failed to convert attribute " << attrs[i].getName()
                      << " at position " << _chunkLoader->getFileOffset()
                      << " line " << _chunkLoader->getLine()
                      << " column " << _chunkLoader->getColumn() << ": " << msg);

        if (++nErrors > maxErrors) {
            if (maxErrors) {
                throw USER_EXCEPTION(SCIDB_SE_EXECUTION, SCIDB_LE_OP_INPUT_ERROR16);
            } else {
                // If no maxErrors limit was set, show the original error.
                x.raise();
            }
        }

        Value errVal;
        if (attrs[i].isNullable()) {
            errVal.setNull();
        } else {
            errVal.setSize(TypeLibrary::getType(attrs[i].getType()).byteSize());
            errVal = TypeLibrary::getDefaultValue(attrs[i].getType());
        }
        cIter->writeItem(errVal);

        if (shadowArray) {
            if (shadowChunkIterators.empty()) {
                shared_ptr<Query> query(Query::getValidQueryPtr(_query));
                if (shadowArrayIterators.empty()) {
                    shadowArrayIterators.resize(nAttrs+1);
                    for (size_t j = 0; j < nAttrs; j++) {
                        shadowArrayIterators[j] = shadowArray->getIterator(j);
                    }
                    shadowArrayIterators[nAttrs] = shadowArray->getIterator(nAttrs);
                }
                shadowChunkIterators.resize(nAttrs+1);
                Coordinates const& chunkPos = _chunkLoader->getChunkPos();
                for (size_t j = 0; j < nAttrs; j++) {
                    shadowChunkIterators[j] =
                       shadowArrayIterators[j]->newChunk(chunkPos, 0).getIterator(query,
                                                                                  ChunkIterator::NO_EMPTY_CHECK|
                                                                                  ChunkIterator::SEQUENTIAL_WRITE);
                }
                shadowChunkIterators[nAttrs] =
                   shadowArrayIterators[nAttrs]->newChunk(chunkPos, 0).getIterator(query,
                                                                                   ChunkIterator::SEQUENTIAL_WRITE);
            }
            Coordinates const& currPos = cIter->getPosition();
            if (lastBadAttr < 0) {
                Value rowOffset;
                rowOffset.setInt64(_chunkLoader->getFileOffset());
                shadowChunkIterators[nAttrs]->setPosition(currPos);
                shadowChunkIterators[nAttrs]->writeItem(rowOffset);
            }
            strVal.setNull();
            while (AttributeID(++lastBadAttr) < i) {
                shadowChunkIterators[lastBadAttr]->setPosition(currPos);
                shadowChunkIterators[lastBadAttr]->writeItem(strVal);
            }
            shadowChunkIterators[i]->setPosition(currPos);
            strVal.setString(msg.c_str());
            shadowChunkIterators[i]->writeItem(strVal);
        }
    }
Пример #9
0
void Messagebox::show(Exception e, const QString &msg, unsigned icon_type, unsigned buttons, const QString &yes_lbl, const QString &no_lbl, const QString &cancel_lbl,
                      const QString &yes_ico, const QString &no_ico, const QString &cancel_ico)
{
	vector<Exception> list;
	vector<Exception>::reverse_iterator itr,itr_end;
	QTreeWidgetItem *item=nullptr,*item1=nullptr,*item2=nullptr;
	QLabel *label=nullptr;
	int idx=0;
	Exception *ex=nullptr;
	QString str_aux, title;
	QFont font=this->font();

  show_raw_info_tb->blockSignals(true);
  show_raw_info_tb->setChecked(false);
  show_raw_info_tb->blockSignals(false);

  raw_info_txt->setPlainText(e.getExceptionsText());

	e.getExceptionsList(list);

	itr=list.rbegin();
	itr_end=list.rend();

	while(itr!=itr_end)
	{
		ex=&(*itr);

		item=new QTreeWidgetItem;
		str_aux=QString("[%1] - %2")
						.arg(idx)
						.arg(ex->getMethod());
		item->setIcon(0,QPixmap(QString(":/icones/icones/funcao.png")));
		exceptions_trw->insertTopLevelItem(0,item);
		label=new QLabel;
		label->setFont(font);
		label->setWordWrap(true);
		label->setText(str_aux);
		exceptions_trw->setItemWidget(item, 0, label);

		item1=new QTreeWidgetItem(item);
		item1->setIcon(0,QPixmap(QString(":/icones/icones/codigofonte.png")));
		item1->setText(0,ex->getFile() + " (" + ex->getLine() + ")");

		item2=new QTreeWidgetItem(item);
		item2->setIcon(0,QPixmap(QString(":/icones/icones/msgbox_alerta.png")));
		item2->setText(0,Exception::getErrorCode(ex->getErrorType()) +
									 " (" + QString("%1").arg(ex->getErrorType()) + ")");

		item1=new QTreeWidgetItem(item);
		item1->setIcon(0,QPixmap(":/icones/icones/msgbox_erro.png"));
		label=new QLabel;
		label->setWordWrap(true);
		label->setFont(font);
		label->setStyleSheet("color: #ff0000;");
		exceptions_trw->setItemWidget(item1, 0, label);
		label->setText(ex->getErrorMessage());

		if(!ex->getExtraInfo().isEmpty())
		{
			item1=new QTreeWidgetItem(item);
			item1->setIcon(0,QPixmap(QString(":/icones/icones/msgbox_info.png")));
			label=new QLabel;
			label->setWordWrap(true);
			label->setFont(font);
			label->setStyleSheet("color: #000080;");
			label->setTextInteractionFlags(Qt::TextSelectableByMouse);
			exceptions_trw->setItemWidget(item1, 0, label);
			label->setText(ex->getExtraInfo());
		}

		itr++;
		idx++;
	}

	switch(icon_type)
	{
		case ERROR_ICON:
			title=trUtf8("Error");
		break;

		case ALERT_ICON:
			title=trUtf8("Alert");
		break;

		case INFO_ICON:
			title=trUtf8("Information");
		break;

		default:
			title="";
		break;
	}

	if(msg.isEmpty())
		str_aux=e.getErrorMessage();
	else
		str_aux=msg;

	if(str_aux.contains("`") && str_aux.contains("'"))
	{
		str_aux.replace("`", "<strong>");
		str_aux.replace("\'","</strong>");
		str_aux.replace("(", "<em>(");
		str_aux.replace(")", ")</em>");
	}

  this->show(title, str_aux, icon_type, buttons, yes_lbl, no_lbl, cancel_lbl, yes_ico, no_ico, cancel_ico);
}