Ejemplo n.º 1
0
MessageBox::MessageBox(QWidget *parent, Qt::WindowFlags f) : QDialog(parent, f)
{
	setupUi(this);
	cancelled=false;
	connect(yes_ok_btn,SIGNAL(clicked()),this,SLOT(handleYesOkClick()));
	connect(no_btn,SIGNAL(clicked()),this,SLOT(handleNoCancelClick()));
	connect(cancel_btn,SIGNAL(clicked()),this,SLOT(handleNoCancelClick()));
	connect(show_errors_tb,SIGNAL(clicked()),this,SLOT(showExceptionList()));
	connect(show_errors_tb,SIGNAL(toggled(bool)),show_errors_txt_tb,SLOT(setVisible(bool)));
	connect(show_errors_txt_tb,SIGNAL(toggled(bool)),this,SLOT(showExceptionList(void)));
	show_errors_tb->setVisible(false);
	show_errors_txt_tb->setVisible(false);
}
Ejemplo n.º 2
0
Messagebox::Messagebox(QWidget *parent, Qt::WindowFlags f) : QDialog(parent, f)
{
	setupUi(this);
  this->setWindowFlags(Qt::Dialog | Qt::WindowTitleHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint);
	cancelled=false;
	connect(yes_ok_btn,SIGNAL(clicked()),this,SLOT(handleYesOkClick()));
	connect(no_btn,SIGNAL(clicked()),this,SLOT(handleNoCancelClick()));
	connect(cancel_btn,SIGNAL(clicked()),this,SLOT(handleNoCancelClick()));
	connect(show_errors_tb,SIGNAL(clicked()),this,SLOT(showExceptionList()));
  connect(show_errors_tb,SIGNAL(toggled(bool)),show_raw_info_tb,SLOT(setVisible(bool)));
  connect(show_raw_info_tb,SIGNAL(toggled(bool)),this,SLOT(showExceptionList(void)));
	show_errors_tb->setVisible(false);
  show_raw_info_tb->setVisible(false);
}
Ejemplo n.º 3
0
void MessageBox::show(const QString &title, const QString &msg, unsigned icon_type, unsigned buttons)
{
	QString icon_name;

	switch(buttons)
	{
		case YES_NO_BUTTONS:
			no_btn->setText(trUtf8("&No"));
			yes_ok_btn->setText(trUtf8("&Yes"));
		break;

		case OK_CANCEL_BUTTONS:
			cancel_btn->setText(trUtf8("&Cancel"));
			yes_ok_btn->setText(trUtf8("&Ok"));
		break;

		case ALL_BUTTONS:
			cancel_btn->setText(trUtf8("&Cancel"));
			no_btn->setText(trUtf8("&No"));
			yes_ok_btn->setText(trUtf8("&Yes"));
		break;

		default:
		case OK_BUTTON:
			yes_ok_btn->setText(trUtf8("&Ok"));
		break;
	}

	no_btn->setVisible(buttons==YES_NO_BUTTONS || buttons==ALL_BUTTONS);
	cancel_btn->setVisible(buttons==OK_CANCEL_BUTTONS || buttons==ALL_BUTTONS);

	switch(icon_type)
	{
		case ERROR_ICON:
			icon_name="msgbox_erro.png";
		break;

		case INFO_ICON:
			icon_name="msgbox_info.png";
		break;

		case ALERT_ICON:
			icon_name="msgbox_alerta.png";
		break;

		case CONFIRM_ICON:
			icon_name="msgbox_quest.png";
		break;

		default:
			icon_name="";
		break;
	}

	cancelled=false;

	if(icon_name!="")
		icon_lbl->setPixmap(QPixmap((":/icones/icones/" + icon_name)));

	msg_lbl->setText(msg);

	this->resize(this->minimumWidth(),this->minimumHeight());
	this->setWindowTitle("pgModeler - " + title);
	this->objs_group_wgt->setCurrentIndex(0);
	this->show_errors_tb->setChecked(false);
	this->show_errors_tb->setVisible((exceptions_trw->topLevelItemCount() > 0));
	showExceptionList();

	QDialog::exec();
}
Ejemplo n.º 4
0
void Messagebox::show(const QString &title, 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)
{
	QString icon_name;

  if(!yes_lbl.isEmpty())
    yes_ok_btn->setText(yes_lbl);
  else
    yes_ok_btn->setText(buttons==OK_BUTTON ? trUtf8("&Ok") : trUtf8("&Yes"));

  yes_ok_btn->setIcon(!yes_ico.isEmpty() ? QIcon(yes_ico) : QPixmap(":/icones/icones/confirmar.png"));

  no_btn->setText(!no_lbl.isEmpty() ? no_lbl : trUtf8("&No"));
  no_btn->setIcon(!no_ico.isEmpty() ? QIcon(no_ico) :QPixmap(":/icones/icones/fechar1.png") );

  cancel_btn->setText(!cancel_lbl.isEmpty() ? cancel_lbl : trUtf8("&Cancel"));
  cancel_btn->setIcon(!cancel_ico.isEmpty() ? QIcon(cancel_ico) : QPixmap(":/icones/icones/cancelar.png"));

	no_btn->setVisible(buttons==YES_NO_BUTTONS || buttons==ALL_BUTTONS);
	cancel_btn->setVisible(buttons==OK_CANCEL_BUTTONS || buttons==ALL_BUTTONS);
  this->adjustSize();

	switch(icon_type)
	{
		case ERROR_ICON:
			icon_name="msgbox_erro.png";
		break;

		case INFO_ICON:
			icon_name="msgbox_info.png";
		break;

		case ALERT_ICON:
			icon_name="msgbox_alerta.png";
		break;

		case CONFIRM_ICON:
			icon_name="msgbox_quest.png";
		break;

		default:
			icon_name="";
		break;
	}

	cancelled=false;
	icon_lbl->setVisible(!icon_name.isEmpty());

	if(icon_name!="")
		icon_lbl->setPixmap(QPixmap((":/icones/icones/" + icon_name)));

	msg_lbl->setText(msg);

	this->resize(this->minimumWidth(),this->minimumHeight());
	this->setWindowTitle("pgModeler - " + title);
	this->objs_group_wgt->setCurrentIndex(0);
	this->show_errors_tb->setChecked(false);
	this->show_errors_tb->setVisible((exceptions_trw->topLevelItemCount() > 0));
	showExceptionList();

	QDialog::exec();
}