Пример #1
0
V new_pair(V first, V second)
{
	V t = make_new_value(T_PAIR, true, sizeof(V) * 2);
	toFirst(t) = first;
	toSecond(t) = second;
	return t;
}
Пример #2
0
Файл: hashmap.c Проект: gvx/deja
uint32_t get_hash(V v)
{
	int t = getType(v);
	if (t == T_STR)
	{
		return need_hash(v);
	}
	else if (t == T_NUM)
	{
		return (uint32_t)toNumber(v);
	}
	else if (t == T_PAIR)
	{
		return get_hash(toFirst(v)) + get_hash(toSecond(v));
	}
	else if (t == T_FRAC)
	{
		return toNumerator(v) ^ toDenominator(v);
	}
	else
	{
		return (unsigned long)v >> 4;
		/* This discards 4 bits.
		 * The reason is that allocated addresses are usually
		 * aligned to some extent.
		 * It might get rid of some entropy, though the original
		 * amount was probably low enough already.
		 * If you have a better solution, please share.
		 */
	}
}
Пример #3
0
Файл: persist.c Проект: gvx/deja
bool persist_collect_(V original, HashMap *hm)
{
    int type = getType(original);
    HashMap *hmv;
    Bucket *b;
    int i;
    if (type == T_SCOPE || type == T_FUNC || type == T_CFUNC)
    {
        return false;
    }
    if (get_hashmap(hm, original) != NULL)
    {
        return true;
    }
    set_hashmap(hm, original, intToV(-pair_ordinal(original)-1));
    switch(type)
    {
    case T_STR:
    case T_IDENT:
    case T_NUM:
    case T_FRAC:
        break;
    case T_LIST:
        for (i = 0; i < toStack(original)->used; i++)
        {
            if (!persist_collect_(toStack(original)->nodes[i], hm))
            {
                return false;
            }
        }
        break;
    case T_DICT:
        hmv = toHashMap(original);
        if (hmv->map != NULL)
        {
            for (i = 0; i < hmv->size; i++)
            {
                b = hmv->map[i];
                while(b != NULL)
                {
                    if (!persist_collect_(b->key, hm) ||!persist_collect_(b->value, hm))
                    {
                        return false;
                    }
                    b = b->next;
                }
            }
        }
        break;
    case T_PAIR:
        if (!persist_collect_(toFirst(original), hm) || !persist_collect_(toSecond(original), hm))
            return false;
        break;
    }
    return true;
}
Пример #4
0
long int pair_ordinal(V p)
{
	if (getType(p) != T_PAIR)
	{
		return 0;
	}
	int o1 = pair_ordinal(toFirst(p));
	int o2 = pair_ordinal(toSecond(p));
	return (o1 > o2 ? o1 : o2) + 1;
}
Пример #5
0
SqlItemView::SqlItemView(QWidget * parent)
	: QWidget(parent),
	m_row(0),
	m_changing(false),
	m_model(0)
{
	setupUi(this);

	connect(firstButton, SIGNAL(clicked()),
			this, SLOT(toFirst()));
	connect(previousButton, SIGNAL(clicked()),
			this, SLOT(toPrevious()));

	connect(nextButton, SIGNAL(clicked()),
			this, SLOT(toNext()));
	connect(lastButton, SIGNAL(clicked()),
			this, SLOT(toLast()));
	connect(qApp, SIGNAL(focusChanged(QWidget*,QWidget*)),
			 this, SLOT(aApp_focusChanged(QWidget*,QWidget*)));
}
Пример #6
0
docItem::docItem(QList<int> _list, int _curr, int _doc, QWidget *parent):QDialog(parent){
    ui.setupUi(this);
    list = _list;
    curr = _curr;
    doc = _doc;

    QSqlQuery _v(QString("select docs.vid from docs where docs.id = \'%1\'").arg(doc));
    _v.next();
    vid = _v.value(0).toInt();

    ui.spinBox_id_book->hide();
    ui.tableWidget_res->setColumnHidden(0, true);    
    ui.tableWidget_res->setColumnHidden(7, true);
    ui.tableWidget_res->setColumnHidden(8, true);

    if (vid == 1){
        ui.tableWidget_res->setColumnHidden(6, true);
        ui.radioButton_identifier->hide();
    } else if (vid == 2){
        ui.lineEdit_place->hide();
        ui.label_3->hide();
        ui.lineEdit_identifier->setReadOnly(true);
    }

    openItem();

    readSetting();
    connect(ui.pushButton_close, SIGNAL(clicked()), this, SLOT(close()));
    connect(ui.lineEdit_search, SIGNAL(textEdited(QString)), this, SLOT(searchBook(QString)));
    connect(ui.tableWidget_res, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(selectBook()));

    connect(ui.pushButton_save, SIGNAL(clicked()), this, SLOT(saveItem()));
    connect(ui.pushButton_del, SIGNAL(clicked()), this, SLOT(deleteItem()));

    connect(ui.pushButton_toFirst, SIGNAL(clicked()), this, SLOT(toFirst()));
    connect(ui.pushButton_toLast, SIGNAL(clicked()), this, SLOT(toLast()));
    connect(ui.pushButton_toNext, SIGNAL(clicked()), this, SLOT(toNext()));
    connect(ui.pushButton_toPrev, SIGNAL(clicked()), this, SLOT(toPrev()));

}
Пример #7
0
EmployeeForm::EmployeeForm(int id, QWidget *parent)
    : QDialog(parent)
{
    nameEdit = new QLineEdit;

    nameLabel = new QLabel(tr("Na&me:"));
    nameLabel->setBuddy(nameEdit);

    departmentComboBox = new QComboBox;

    departmentLabel = new QLabel(tr("Depar&tment:"));
    departmentLabel->setBuddy(departmentComboBox);

    extensionLineEdit = new QLineEdit;
	extensionLineEdit->setValidator(
								new QIntValidator(0, 99999, this));

    extensionLabel = new QLabel(tr("E&xtension:"));
    extensionLabel->setBuddy(extensionLineEdit);

    emailEdit = new QLineEdit;

    emailLabel = new QLabel(tr("&Email:"));
    emailLabel->setBuddy(emailEdit);

    startDateEdit = new QDateEdit;
    startDateEdit->setCalendarPopup(true);
    QDate today = QDate::currentDate();
	startDateEdit->setDateRange(
			today.addDays(-90), today.addDays(90));

    startDateLabel = new QLabel(tr("&Start Date:"));
    startDateLabel->setBuddy(startDateEdit);

    firstButton = new QPushButton(tr("<< &First"));
    previousButton = new QPushButton(tr("< &Previous"));
    nextButton = new QPushButton(tr("&Next >"));
    lastButton = new QPushButton(tr("&Last >>"));

    addButton = new QPushButton(tr("&Add"));
    deleteButton = new QPushButton(tr("&Delete"));
    closeButton = new QPushButton(tr("&Close"));

    buttonBox = new QDialogButtonBox;
    buttonBox->addButton(addButton, QDialogButtonBox::ActionRole);
    buttonBox->addButton(deleteButton, QDialogButtonBox::ActionRole);
    buttonBox->addButton(closeButton, QDialogButtonBox::AcceptRole);

    tableModel = new QSqlRelationalTableModel(this);
    tableModel->setTable("employee");
    tableModel->setRelation(Employee_DepartmentId,
                            QSqlRelation("department", "id", "name"));
    tableModel->setSort(Employee_Name, Qt::AscendingOrder);
    tableModel->select();

    QSqlTableModel *relationModel =
            tableModel->relationModel(Employee_DepartmentId);
    departmentComboBox->setModel(relationModel);
    departmentComboBox->setModelColumn(
            relationModel->fieldIndex("name"));

    mapper = new QDataWidgetMapper(this);
    mapper->setSubmitPolicy(QDataWidgetMapper::AutoSubmit);
    mapper->setModel(tableModel);
    mapper->setItemDelegate(new QSqlRelationalDelegate(this));
    mapper->addMapping(nameEdit, Employee_Name);
    mapper->addMapping(departmentComboBox, Employee_DepartmentId);
    mapper->addMapping(extensionLineEdit, Employee_Extension);
    mapper->addMapping(emailEdit, Employee_Email);
    mapper->addMapping(startDateEdit, Employee_StartDate);

	if (id != -1)
	{
		for (int row = 0; row < tableModel->rowCount(); ++row)
		{
            QSqlRecord record = tableModel->record(row);
            if (record.value(Employee_Id).toInt() == id) {
                mapper->setCurrentIndex(row);
                break;
            }
        }
	 }
	else
	{
        mapper->toFirst();
    }

    connect(firstButton, SIGNAL(clicked()), mapper, SLOT(toFirst()));
    connect(previousButton, SIGNAL(clicked()),
            mapper, SLOT(toPrevious()));
    connect(nextButton, SIGNAL(clicked()), mapper, SLOT(toNext()));
    connect(lastButton, SIGNAL(clicked()), mapper, SLOT(toLast()));

	connect(addButton, SIGNAL(clicked()),
			this, SLOT(addEmployee()));
    connect(deleteButton, SIGNAL(clicked()),
            this, SLOT(deleteEmployee()));
    connect(closeButton, SIGNAL(clicked()), this, SLOT(accept()));

    QHBoxLayout *topButtonLayout = new QHBoxLayout;
    topButtonLayout->setContentsMargins(20, 0, 20, 5);
    topButtonLayout->addStretch();
    topButtonLayout->addWidget(firstButton);
    topButtonLayout->addWidget(previousButton);
    topButtonLayout->addWidget(nextButton);
    topButtonLayout->addWidget(lastButton);
    topButtonLayout->addStretch();

    QGridLayout *mainLayout = new QGridLayout;
    mainLayout->addLayout(topButtonLayout, 0, 0, 1, 3);
    mainLayout->addWidget(nameLabel, 1, 0);
    mainLayout->addWidget(nameEdit, 1, 1, 1, 2);
    mainLayout->addWidget(departmentLabel, 2, 0);
    mainLayout->addWidget(departmentComboBox, 2, 1, 1, 2);
    mainLayout->addWidget(extensionLabel, 3, 0);
    mainLayout->addWidget(extensionLineEdit, 3, 1);
    mainLayout->addWidget(emailLabel, 4, 0);
    mainLayout->addWidget(emailEdit, 4, 1, 1, 2);
    mainLayout->addWidget(startDateLabel, 5, 0);
    mainLayout->addWidget(startDateEdit, 5, 1);
    mainLayout->addWidget(buttonBox, 7, 0, 1, 3);
    mainLayout->setRowMinimumHeight(6, 10);
    mainLayout->setRowStretch(6, 1);
    mainLayout->setColumnStretch(2, 1);
    setLayout(mainLayout);

    if (id == -1) {
        nextButton->setFocus();
    } else {
        nameEdit->setFocus();
    }

    setWindowTitle(tr("Edit Employees"));
}
Пример #8
0
// Another constructor for string list iterator.
strlistiterator::strlistiterator (strlist * s) {
  _strlist = s;
  toLast ();
  toFirst ();
}
Пример #9
0
// Constructor for string list iterator.
strlistiterator::strlistiterator (strlist & s) {
  _strlist = &s;
  toLast ();
  toFirst ();
}
Пример #10
0
valuelistiterator<type_t>::valuelistiterator (valuelist<type_t> & v) {
  _valuelist = &v;
  toLast ();
  toFirst ();
}
Пример #11
0
PaymentForm::PaymentForm(QSqlRelationalTableModel *modelCome, int id,
                         QWidget *parent)
    : QDialog(parent),
    ui(new Ui::PaymentDialog)
{
    ui->setupUi(this);

    model = modelCome;

    QSqlTableModel *relModel = model->relationModel(Payment_Customer_id);
    ui->customerComboBox->setModel(relModel);
    ui->customerComboBox->setModelColumn(relModel->fieldIndex("surname"));

    relModel = model->relationModel(Payment_Work_id - 1);
    ui->workComboBox->setModel(relModel);
    ui->workComboBox->setModelColumn(relModel->fieldIndex("name"));

    ui->priceEdit->setValidator(new QIntValidator(0, 999999, this));

    mapper = new QDataWidgetMapper(this);
    mapper->setModel(model);
    mapper->addMapping(ui->customerComboBox, Payment_Customer_id);
    mapper->addMapping(ui->workComboBox, Payment_Work_id - 1);
    mapper->addMapping(ui->dateEdit, Payment_Date - 1);
    mapper->addMapping(ui->priceEdit, Payment_Price - 1);
    mapper->setSubmitPolicy(QDataWidgetMapper::AutoSubmit);
    mapper->setItemDelegate(new QSqlRelationalDelegate(this));

    if (id != -1) {
        for (int row = 0; row < model->rowCount(); ++row) {
            QSqlRecord record = model->record(row);
            if (record.value(Payment_Payment_id).toInt() == id) {
                mapper->setCurrentIndex(row);
                break;
            }
        }
    } else {
        mapper->toFirst();
    }

    connect(ui->firstButton, SIGNAL(clicked()), mapper, SLOT(toFirst()));
    connect(ui->previousButton, SIGNAL(clicked()),
            mapper, SLOT(toPrevious()));
    connect(ui->nextButton, SIGNAL(clicked()), mapper, SLOT(toNext()));
    connect(ui->lastButton, SIGNAL(clicked()), mapper, SLOT(toLast()));
    connect(ui->addButton, SIGNAL(clicked()), this, SLOT(addRecord()));
    connect(ui->deleteButton, SIGNAL(clicked()),
            this, SLOT(deleteRecord()));
    connect(ui->closeButton, SIGNAL(clicked()), this, SLOT(accept()));
    connect(mapper, SIGNAL(currentIndexChanged(int)),
            this, SLOT(updateButtons(int)));
    connect(ui->workComboBox, SIGNAL(currentIndexChanged(int)),
            this, SLOT(updateFields(int)));

    if (id == -1) {
        ui->nextButton->setFocus();
    } else {
        ui->customerComboBox->setFocus();
    }
    int row = mapper->currentIndex();
    updateButtons(row);

    if (row == -1) {
        addRecord();
    }
}
Пример #12
0
ptrlistiterator<type_t>::ptrlistiterator (ptrlist<type_t> & p) {
  _ptrlist = &p;
  toLast ();
  toFirst ();
}
Пример #13
0
Файл: persist.c Проект: gvx/deja
void write_object(FILE *file, V obj, HashMap *hm)
{
    int t = getType(obj);
    union double_or_uint64_t num;
    ITreeNode *id = NULL;
    NewString *s = NULL;
    Stack *st;
    HashMap *hmv;
    int8_t n8;
    uint8_t l8;
    int32_t n32;
    uint32_t l32;
    int64_t n64;
    uint64_t l64;
    int i;
    Bucket *b;

    char type = t;

    switch (t)
    {
    case T_NUM:
        if (canBeSmallInt(obj))
            type |= TYPE_SHORT;
        break;
    case T_IDENT:
        id = toIdent(obj);
        if (id->length < 256)
            type |= TYPE_SHORT;
        break;
    case T_STR:
        s = toNewString(obj);
        if (s->size < 256)
            type |= TYPE_SHORT;
        break;
    case T_FRAC:
        if (toNumerator(obj) < 128 && toNumerator(obj) >= -128 &&
                toDenominator(obj) < 256)
            type |= TYPE_SHORT;
        break;
    }

    fwrite(&type, 1, 1, file);

    switch (t)
    {
    case T_IDENT:
        if (type & TYPE_SHORT)
        {
            l8 = id->length;
            fwrite(&l8, 1, 1, file);
        }
        else
        {
            l32 = id->length;
            l32 = htonl(l32);
            fwrite(&l32, 4, 1, file);
        }
        fwrite(&id->data, id->length, 1, file);
        break;
    case T_STR:
        if (type & TYPE_SHORT)
        {
            l8 = s->size;
            fwrite(&l8, 1, 1, file);
        }
        else
        {
            l32 = s->size;
            l32 = htonl(l32);
            fwrite(&l32, 4, 1, file);
        }
        fwrite(s->text, s->size, 1, file);
        break;
    case T_NUM:
        if (type & TYPE_SHORT)
        {
            n32 = toInt(obj);
            n32 = htonl(n32);
            fwrite(((char*)&n32) + 1, 3, 1, file);
        }
        else
        {
            num.d = toNumber(obj);
            num.i = htonll(num.i);
            fwrite(&num, 8, 1, file);
        }
        break;
    case T_FRAC:
        if (type & TYPE_SHORT)
        {
            n8 = toNumerator(obj);
            fwrite(&n8, 1, 1, file);
            l8 = toDenominator(obj);
            fwrite(&l8, 1, 1, file);
        }
        else
        {
            n64 = toNumerator(obj);
            n64 = htonl(n64);
            fwrite(&n64, 8, 1, file);
            l64 = toDenominator(obj);
            l64 = htonl(l64);
            fwrite(&l64, 8, 1, file);
        }
        break;
    case T_PAIR:
        write_ref(file, toFirst(obj), hm);
        write_ref(file, toSecond(obj), hm);
        break;
    case T_LIST:
        st = toStack(obj);
        l32 = st->used;
        l32 = htonl(l32);
        fwrite(&l32, 4, 1, file);
        for (i = 0; i < st->used; i++)
        {
            write_ref(file, st->nodes[i], hm);
        }
        break;
    case T_DICT:
        hmv = toHashMap(obj);
        l32 = hmv->used;
        l32 = htonl(l32);
        fwrite(&l32, 4, 1, file);
        if (hmv->map != NULL)
        {
            for (i = 0; i < hmv->size; i++)
            {
                b = hmv->map[i];
                while(b != NULL)
                {
                    write_ref(file, b->key, hm);
                    write_ref(file, b->value, hm);
                    b = b->next;
                }
            }
        }
        break;
    }
}
Пример #14
0
MovimentoEditDialog::MovimentoEditDialog(QSqlRelationalTableModel* model,
													  ColumnIndexes & colInd,
													  int curRow,
													  bool canSubmit, QWidget *parent)
	: QDialog(parent)
	, ui(new Ui::MovimentoEditDialog)
	, m_movModel(model)
	, m_insert(curRow<0) // se linha < 0, então é inserção, do contrário é edição
	, m_canSubmit(canSubmit)
	, m_colInd(colInd)
{
	ui->setupUi(this);


	if ( m_insert )
		ui->movimentoNavGroup->hide(); // se vai inserir, não haverá havegação.

	// seta as comboBox para que sejam alimentadas pelo relacionamento correspondente
	// exibindo a coluna "nome" ao inves de "id":

	// nomes de clientes na respectiva combo:
	QSqlTableModel *cliRelationModel =
									m_movModel->relationModel(m_colInd.movClienteId);
	ui->clienteCombo->setModel(cliRelationModel);
	ui->clienteCombo->setModelColumn(cliRelationModel->fieldIndex("name"));
	// como o relation model só duas colunas (chave e valor), poderia:
	//ui->clienteCombo->setModelColumn(1); // índice da coluna valor
	
	ui->clienteCombo->model()->sort(cliRelationModel->fieldIndex("name"), Qt::AscendingOrder);

	// tipos de movimento na respectiva combo:
	QSqlTableModel *tipoRelationModel = m_movModel->relationModel(m_colInd.movTipoId);
	ui->tipoCombo->setModel(tipoRelationModel);
	ui->tipoCombo->setModelColumn(tipoRelationModel->fieldIndex("name"));
	ui->tipoCombo->model()->sort(tipoRelationModel->fieldIndex("name"), Qt::AscendingOrder);

	// * ^^ Nos 2 "relationModel" acima, temos sempre duas colunas: "chave" e "valor associado".

	// cria um mapeador que relacionará widgets "sem-model" com
	// as colunas respectivas do model:
	m_movMapper = new QDataWidgetMapper(this);

	// "submitPolicy": "auto" ou "manual"; se "auto" irá completar alterações se a linha selecionada for alterada
	m_movMapper->setSubmitPolicy(QDataWidgetMapper::ManualSubmit); // "manual" -> teremos que chamar "submit" no momento apropriado.
	// define o "model" a ser usado pelo "mapper":
	m_movMapper->setModel(m_movModel);
	// define o delegate que permite exibir colunas relacionadas em comboBox's
	m_movMapper->setItemDelegate(new QSqlRelationalDelegate(this));

	// mapeia cada widget necessário para a coluna respectiva no model:
	m_movMapper->addMapping(ui->clienteCombo, m_colInd.movClienteId);
	m_movMapper->addMapping(ui->tipoCombo, m_colInd.movTipoId);
	m_movMapper->addMapping(ui->movDate, m_colInd.movDate);
	m_movMapper->addMapping(ui->descrEdit, m_colInd.movDescription);

	// conecta os botões de navegação diretamente aos slots do "mapper"
	// (neste caso, não é necessário criar novos slots para isso, exceto se quisermos fazer algo diferenciado)
	if ( !m_insert )
	{
		connect(ui->movimentoNavFirstBtn, SIGNAL(clicked()),
																			m_movMapper, SLOT(toFirst()));
		connect(ui->movimentoNavPrevBtn, SIGNAL(clicked()),
																			m_movMapper, SLOT(toPrevious()));
		connect(ui->movimentoNavNextBtn, SIGNAL(clicked()),
																			m_movMapper, SLOT(toNext()));
		connect(ui->movimentoNavLastBtn, SIGNAL(clicked()),
																			m_movMapper, SLOT(toLast()));
	}

	// se for inserir, deve criar nova linha no model
	if ( m_insert ) // INSERIR
	{
		// insere uma nova linha no model (caso o insert seja cancelado, deverá ser removida):
		curRow = m_movModel->rowCount(); // altera curRow para o total de linhas
		// rowCount -> total de linhas -> uma nova linha no final:
		m_movModel->insertRow(curRow);

		// em inclusão, seta widgets de data (para forçar o default):
		ui->movDate->setDate( QDate::currentDate() );

		setWindowTitle("INCLUIR novo movimento - "); // título do diálogo
	}
	else  // ALTERAR
		setWindowTitle("ALTERAR um movimento - ");  // título do diálogo

	QSqlDatabase db = m_movModel->database();
	setWindowTitle( windowTitle() + db.driverName());

	m_movMapper->setCurrentIndex(curRow); // seta a "row" do mapper

	// desabilta a opção do menu de sistema "fechar" ("X");
	// desse modo só poderá fechar o diálogo com os botões "OK" e "CANCELAR"
	// e não precisaremos redefinir a virtual "closeEvent" para finalzação
	Qt::WindowFlags flags = windowFlags();
	flags |=  Qt::CustomizeWindowHint;  // acrescenta: flags customizados
	flags &= ~Qt::WindowCloseButtonHint;  // desabilita: closeButton
	setWindowFlags(flags);

}
/**
 * 隧道管理界面类实现
 * 继承自QWidget
 * @author fanxiang
 * @version 1.0.0
 * @date 2013-08-18
 */
ManageTunnelWidget::ManageTunnelWidget(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::ManageTunnelWidget)
{
    ui->setupUi(this);

    mapper = new QDataWidgetMapper(this);

    linesModel = NULL;
    tunnelsModel = NULL;
    curvesModel = NULL;

    loadLinesData();
    loadTunnelData();

    /* 开始选中查找模式为学号模式 */
    ui->radioButton->click();

    /* 开始不能修改 */
    currentRow = 0;
    changed = false;
    saveType = Save_Modify;
    cannotModify();

    /* 线路及隧道数据列表更新信号槽 */
    connect(ui->linesView, SIGNAL(clicked(QModelIndex)), this, SLOT(updateTunnelsView(const QModelIndex &)));
    // 【作废】updateCurvesView已在setCurrentMapper中调用
    //connect(ui->tunnelsView, SIGNAL(clicked(QModelIndex)), this, SLOT(updateCurvesView(const QModelIndex &)));

    /* 添加删除隧道槽 */
    connect(ui->newTunnelButton, SIGNAL(clicked()), this, SLOT(newTunnel()));
    connect(ui->deleteTunnelButton, SIGNAL(clicked()), this, SLOT(deleteTunnel()));
    /* 添加删除隧道对应曲线槽 */
    //connect(ui->curvesView, SIGNAL(itemChanged(QTableWidgetItem*)), this, SLOT(changeCurveData()));
    connect(ui->newCurveButton, SIGNAL(clicked()), this, SLOT(newCurve()));
    connect(ui->deleteCurveButton, SIGNAL(clicked()), this, SLOT(deleteCurve()));

    /* 刷新线路隧道 */
    connect(ui->refreshButton, SIGNAL(clicked()), this, SLOT(refreshLinesView()));

    /* 具体隧道信息信号槽 */
    connect(ui->tunnelsView, SIGNAL(clicked(QModelIndex)), this, SLOT(showTunnelDetail(const QModelIndex &)));
    //connect(ui->stumajorcombobox, SIGNAL(currentIndexChanged(const QString &)), this, SLOT(updateStuClasses(const QString &)));

    /* 修改隧道信息信号槽 */
    connect(ui->lineEdit_tunnelid, SIGNAL(textChanged(QString)), this, SLOT(canSave()));
    connect(ui->lineEdit_name, SIGNAL(textChanged(QString)), this, SLOT(canSave()));
    connect(ui->lineEdit_IDstd, SIGNAL(textChanged(QString)), this, SLOT(canSave()));
    connect(ui->lineEdit_startPoint, SIGNAL(textChanged(QString)), this, SLOT(canSave()));
    connect(ui->lineEdit_endPoint, SIGNAL(textChanged(QString)), this, SLOT(canSave()));
    connect(ui->combobox_isNewLine, SIGNAL(currentIndexChanged(int)), this, SLOT(canSave()));
    connect(ui->combobox_lineType, SIGNAL(currentIndexChanged(int)), this, SLOT(canSave()));
    connect(ui->radioButton_isDoubleLine, SIGNAL(clicked()), this, SLOT(canSave()));
    connect(ui->radioButton_isSingleLine, SIGNAL(clicked()), this, SLOT(canSave()));
    connect(ui->radioButton_isUpLink, SIGNAL(clicked()), this, SLOT(canSave()));
    connect(ui->radioButton_isDownLink, SIGNAL(clicked()), this, SLOT(canSave()));
    connect(ui->radioButton_isBridge, SIGNAL(clicked()), this, SLOT(canSave()));
    connect(ui->radioButton_notBridge, SIGNAL(clicked()), this, SLOT(canSave()));

    // 隧道中的曲线界面双击修改后,也可点击保存按钮
    connect(ui->curvesView, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(canSave()));

    connect(ui->firstButton, SIGNAL(clicked()), this, SLOT(toFirst()));
    connect(ui->previousButton, SIGNAL(clicked()), this, SLOT(toPrevious()));
    connect(ui->nextButton, SIGNAL(clicked()), this, SLOT(toNext()));
    connect(ui->lastButton, SIGNAL(clicked()), this, SLOT(toLast()));

    connect(ui->modifyButton, SIGNAL(clicked()), this, SLOT(canModify()));

    /* 查找隧道槽 */
    connect(ui->findButton, SIGNAL(clicked()), this, SLOT(findTunnel()));
    connect(ui->findEdit,SIGNAL(textEdited(QString)),this,SLOT(showAllLines()));
    /* 编辑桥梁槽 */
    connect(ui->editBridgeClearanceButton, SIGNAL(clicked()), this, SLOT(editBridgeClearance()));
}