Хранилища Subversion OpenInventory

Сравнить редакции

Не учитывать пробелы Редакция 134 → Редакция 135

/trunk/ClassEditor/classeditor.cpp
12,8 → 12,14
// settdialog = new SettingsDialog(this);
///////////////////////////////////////////////////// settdialog.show();
sql.setDatabaseName(tr("an_db"));
 
readSettings();
 
// sql.setDatabaseName(tr("an_db"));
 
 
 
 
/*
field = new TableField(tr("Ñîòðóäíèêè"), this);
field->setNotNull(true);
85,12 → 91,22
 
QString errorString;
 
sql.setDatabaseName(tr("an_db"));
// sql.setDatabaseName(tr("an_db"));
 
sql.setDatabaseName(baseName);
// sql.setDatabaseName(tr("inventory"));
sql.setHostName(tr("localhost"));
sql.setUserName(tr("an"));
sql.setPassword(tr("393939"));
 
// sql.setHostName(tr("localhost"));
sql.setHostName(hostName);
 
// sql.setUserName(tr("an"));
 
sql.setUserName(userName);
 
// sql.setPassword(tr("393939"));
 
sql.setPassword(password);
 
bool ok;
ok = sql.connect();
if (!ok) {
257,7 → 273,11
 
 
 
if (mymodel->rowCount() > 0) currIndexOfClassesTable = mymodel->index(0, 1);
if (mymodel->rowCount() > 0) {
 
 
 
currIndexOfClassesTable = mymodel->index(0, 1);
QModelIndex index_temp;
 
 
313,6 → 333,8
ui->tableView_3->setModel(modelForPointers);
ui->tableView_3->resizeColumnsToContents();
 
}
 
//connect(ui->tableView, SIGNAL(clicked(const QModelIndex)), this, SLOT(on_tableView_clicked(const QModelIndex)));
connect(mymodel, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(on_myModel_dataChanged(QModelIndex,QModelIndex)));
connect(modelForDescription, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(on_modelForDescription_dataChanged(QModelIndex,QModelIndex)));
334,7 → 356,12
connect(ClassEditor::modelForPointers, SIGNAL(field_changed()), this, SLOT(on_field_changed())); // â òàáëèöå óêàçàòåëåé ïðîèçîøëè èçìåíåíèÿ
 
 
connect(ui->getsettingAct, SIGNAL(triggered()), this, SLOT(getSetting())); // âûáîð â ãëàâíîé ôîðìå â ìåíþ "Áàçà äàííûõ" ïóíêòà "Ïàðàìåòðû ñîåäèíåíèÿ"
connect(setFrm.pushButton, SIGNAL(clicked()), this, SLOT(applySetting()));
 
 
 
 
}
 
 
538,6 → 565,38
 
modelForPointers->submitAll();
 
 
 
 
 
 
 
 
/*
 
str_fltr = tr("ClassIdentifer = ");
modelForPointers->setInctance(Inctance_str); // ïåðåäàåì â ìîäåëü ïîëåé èìÿ òåêóùåé òàáëèöû-õðàíèëèùà
str_fltr.append(class_indx);
str_fltr.append(tr(" AND FieldType = \"pointer\""));
// str_fltr.append( tr(" FieldType = pointer "));
 
 
 
modelForPointers->setFilter(str_fltr);
modelForPointers->select();
ui->tableView_3->setModel(modelForPointers);
ui->tableView_3->resizeColumnsToContents();
*/
 
 
 
 
// modelForPointers->select();
 
 
 
 
 
ClassEditor::refreshInctance();
 
 
931,3 → 990,114
 
}
 
 
// Ñ÷èòûâàåì íàñòðîéêè
 
void ClassEditor::readSettings()
{
QSettings settings("Trolltech", "Application Example");
baseName = settings.value("baseName", "an_db").toString();
userName = settings.value("userName", "an").toString();
password = settings.value("password", "393939").toString();
tableName = settings.value("tableName", "inventar").toString();
hostName = settings.value("hostName", "server").toString();
// resize(size);
// move(pos);tableName
}
 
 
void ClassEditor::writeSettings()
{
QSettings settings("Trolltech", "Application Example");
settings.setValue("baseName", baseName);
settings.setValue("userName", userName);
settings.setValue("password", password);
settings.setValue("tableName", tableName);
settings.setValue("hostName", hostName);
}
 
 
void ClassEditor::applySetting()
{
bool ok;
baseName = setFrm.lineEdit->text();
userName = setFrm.lineEdit_2->text();
password = setFrm.lineEdit_3->text();
// tableName = setFrm->lineEdit_4->text();
hostName = setFrm.lineEdit_5->text();
writeSettings();
 
sql.close(); // ðàçðûâàåì ñîåäèíåíèå ñ áàçîé
 
sql.setDatabaseName(baseName);
// sql.setDatabaseName(tr("inventory"));
 
// sql.setHostName(tr("localhost"));
sql.setHostName(hostName);
 
// sql.setUserName(tr("an"));
 
sql.setUserName(userName);
 
// sql.setPassword(tr("393939"));
 
sql.setPassword(password);
 
ok = sql.connect();
if (!ok) {
QMessageBox::critical( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå.
this, // Ðîäèòåëüñêèé âèäæåò.
QObject::tr("Database Error"), // Çàãîëîâîê.
sql.lasError()); // Òåêñò ñîîáùåíèÿ.
 
}
else {
 
QMessageBox::information( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå.
this, // Ðîäèòåëüñêèé âèäæåò.
QObject::tr("Database Connect"), // Çàãîëîâîê.
QObject::tr("Ñîåäèíåíèå ñ áàçîé äàííûõ óñïåøíî óñòàíîâëåíî.")); // Òåêñò ñîîáùåíèÿ.
 
 
 
 
 
}
 
 
mymodel->select();
model->select();
modelForDescription->select();
 
//////////// ok=openDataBase();
//////////// if (!ok) return;
// // // ui->treeWidget->clear(); // î÷èùàåì äåðåâî ñ ìîäåëüþ
 
// // // buildPreviewModel(tr("Ìîÿ ìîäåëü"), tr("1"));
//////////// class_list_map.clear(); // î÷èùàåì ñïèñîê êëàññîâ
//////////// initComboBox();
// // // getDatabaseData();
// delete setFrm;
setFrm.close();
}
 
void ClassEditor::getSetting()
{
// setFrm = new settingForm;
// // // connect(setFrm.pushButton, SIGNAL(clicked()), this, SLOT(applySetting()));
setFrm.lineEdit->setText(baseName);
setFrm.lineEdit_2->setText(userName);
setFrm.lineEdit_3->setText(password);
// setFrm->lineEdit_4->setText(tableName);
setFrm.lineEdit_5->setText(hostName);
setFrm.show();
 
 
 
}
 
 
void ClassEditor::initDataBase(){ // íàñòðîéêà ïàðàìåòðîâ ñîåäèíåíèÿ è óñòàíîâêà ñîåäèíåíèÿ
 
 
}