Exemplo n.º 1
0
void ConnectionsConfigWidget::handleConnection(void)
{
	Connection *conn=nullptr;

	try
	{
		if(!update_tb->isVisible())
		{
			conn=new Connection;
			this->configureConnection(conn);
			connections_cmb->addItem(QIcon(QString(":icones/icones/server.png")), conn->getConnectionId());
			connections.push_back(conn);
		}
		else
		{
			conn=connections.at(connections_cmb->currentIndex());
			this->configureConnection(conn);
			connections_cmb->setItemText(connections_cmb->currentIndex(), conn->getConnectionId());
		}

		this->newConnection();
		edit_tb->setEnabled(connections_cmb->count() > 0);
		remove_tb->setEnabled(connections_cmb->count() > 0);
		setConfigurationChanged(true);
	}
	catch(Exception &e)
	{
		if(add_tb->isVisible())
			delete(conn);

		throw Exception(e.getErrorMessage(),e.getErrorType(),__PRETTY_FUNCTION__,__FILE__,__LINE__, &e);
	}
}
Exemplo n.º 2
0
void ConnectionsConfigWidget::enableConnectionTest(void)
{
	test_tb->setEnabled(!alias_edt->text().isEmpty() &&
						!host_edt->text().isEmpty() &&
						!user_edt->text().isEmpty() &&
						!conn_db_edt->text().isEmpty());
	add_tb->setEnabled(test_tb->isEnabled());
	update_tb->setEnabled(test_tb->isEnabled());

	if(!isConfigurationChanged())
		setConfigurationChanged(true);
}
Exemplo n.º 3
0
void AppearanceConfigWidget::restoreDefaults(void)
{
	try
	{
		BaseConfigWidget::restoreDefaults(GlobalAttributes::OBJECTS_STYLE_CONF);
		this->loadConfiguration();
		setConfigurationChanged(true);
	}
	catch(Exception &e)
	{
		throw Exception(e.getErrorMessage(),e.getErrorType(),__PRETTY_FUNCTION__,__FILE__,__LINE__, &e);
	}
}
Exemplo n.º 4
0
void ConnectionsConfigWidget::removeConnection(void)
{
	if(connections_cmb->currentIndex() >= 0)
	{
		Connection *conn=nullptr;
		conn=connections.at(connections_cmb->currentIndex());
		connections.erase(connections.begin() + connections_cmb->currentIndex());
		connections_cmb->removeItem(connections_cmb->currentIndex());
		delete(conn);
		this->newConnection();
		setConfigurationChanged(true);
	}
}
Exemplo n.º 5
0
void SnippetsConfigWidget::removeAllSnippets(void)
{
  Messagebox msg_box;

  msg_box.show(trUtf8("Do you really want to remove all snippets?"),
               Messagebox::CONFIRM_ICON, Messagebox::YES_NO_BUTTONS);

  if(msg_box.result()==QDialog::Accepted)
  {
    config_params.clear();
    filterSnippets(0);
    setConfigurationChanged(true);
  }
}
Exemplo n.º 6
0
void AppearanceConfigWidget::applyFontStyle(void)
{
	QFont font;

	font=font_cmb->currentFont();
	font.setBold(bold_chk->isChecked());
	font.setItalic(italic_chk->isChecked());
	font.setUnderline(underline_chk->isChecked());
	font.setPointSizeF(font_size_spb->value());

	conf_items[element_cmb->currentIndex()].font_fmt.setFont(font);
	BaseObjectView::setFontStyle(conf_items[element_cmb->currentIndex()].conf_id,
			conf_items[element_cmb->currentIndex()].font_fmt);

	model->setObjectsModified();
	scene->update();
	setConfigurationChanged(true);
}
Exemplo n.º 7
0
void AppearanceConfigWidget::applyElementColor(unsigned color_idx, QColor color)
{
	if(conf_items[element_cmb->currentIndex()].obj_conf)
	{
		conf_items[element_cmb->currentIndex()].colors[color_idx]=color;
		BaseObjectView::setElementColor(conf_items[element_cmb->currentIndex()].conf_id, color, color_idx);
		updatePlaceholderItem();
	}
	else
	{
		conf_items[element_cmb->currentIndex()].font_fmt.setForeground(color);
		BaseObjectView::setFontStyle(conf_items[element_cmb->currentIndex()].conf_id,
				conf_items[element_cmb->currentIndex()].font_fmt);
	}

	model->setObjectsModified();
	scene->update();
	setConfigurationChanged(true);
}
Exemplo n.º 8
0
void SnippetsConfigWidget::handleSnippet(void)
{
  QString orig_id=snippets_cmb->currentData().toString();
  attribs_map snippet;

  snippet=getSnippetAttributes();

  if(isSnippetValid(snippet, orig_id))
  {  
    config_params[id_edt->text()]=snippet;

    //If the operation is update and the snippet id changed, remove the original one
    if(sender()==update_tb && id_edt->text() != orig_id)
      config_params.erase(orig_id);

    filterSnippets(filter_cmb->currentIndex());
    resetForm();
    setConfigurationChanged(true);
  }
}
Exemplo n.º 9
0
void ConnectionsConfigWidget::duplicateConnection(void)
{
	Connection *conn=nullptr, *new_conn=nullptr;

	try
	{
		conn=connections.at(connections_cmb->currentIndex());
		new_conn=new Connection;
		(*new_conn)=(*conn);
		connections.push_back(new_conn);

		new_conn->setConnectionParam(Connection::PARAM_ALIAS, QString("cp_%1").arg(conn->getConnectionParam(Connection::PARAM_ALIAS)));
		connections_cmb->addItem(QIcon(QString(":icones/icones/server.png")), new_conn->getConnectionId());
		connections_cmb->setCurrentIndex(connections_cmb->count()-1);
		setConfigurationChanged(true);
	}
	catch(Exception &e)
	{
		if(new_conn)
			delete(new_conn);

		throw Exception(e.getErrorMessage(),e.getErrorType(),__PRETTY_FUNCTION__,__FILE__,__LINE__, &e);
	}
}
Exemplo n.º 10
0
void SnippetsConfigWidget::removeSnippet(void)
{
  config_params.erase(snippets_cmb->currentData().toString());
  filterSnippets(filter_cmb->currentIndex());
  setConfigurationChanged(true);
}