Rev 249 | Rev 251 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 249 | Rev 250 | ||
---|---|---|---|
Line 1016... | Line 1016... | ||
1016 | 1016 | ||
1017 | vCard = MainWindow::getWmiVideoGard("192.168.0.11", tr("Àäìèíèñòðàòîð"), "!s-Leg01@Z"); |
1017 | vCard = MainWindow::getWmiVideoGard("192.168.0.11", tr("Àäìèíèñòðàòîð"), "!s-Leg01@Z"); |
1018 | int i; |
1018 | int i; |
1019 | i++; |
1019 | i++; |
1020 | 1020 | ||
- | 1021 | ||
- | 1022 | ||
1021 | }
|
1023 | }
|
1022 | 1024 | ||
1023 | 1025 | ||
1024 | void MainWindow::on_sql_mogel_dataChanged ( const QModelIndex & topLeft, const QModelIndex & bottomRight ){ // èçìåíèëè ñâîéñòâà îáúåêòà èëè äîáàâèëè íîâûé îáúåêò |
1026 | void MainWindow::on_sql_mogel_dataChanged ( const QModelIndex & topLeft, const QModelIndex & bottomRight ){ // èçìåíèëè ñâîéñòâà îáúåêòà èëè äîáàâèëè íîâûé îáúåêò |
1025 | int i; |
1027 | int i; |
Line 1580... | Line 1582... | ||
1580 | return result_str; |
1582 | return result_str; |
1581 | 1583 | ||
1582 | }
|
1584 | }
|
1583 | 1585 | ||
1584 | 1586 | ||
- | 1587 | void MainWindow::initWmiTree() { |
|
- | 1588 | ||
- | 1589 | QSqlQuery q;
|
|
- | 1590 | QString sqlStr;
|
|
- | 1591 | QString classID;
|
|
- | 1592 | QString inctance;
|
|
- | 1593 | int field_id; |
|
- | 1594 | bool ok; |
|
- | 1595 | int field_ip, field_user_name, field_password; |
|
- | 1596 | ||
- | 1597 | ||
- | 1598 | sqlStr = tr("select * from `ListOfClasses` where `ListOfClasses`.`ClassName` = 'WmiHost'"); |
|
- | 1599 | ok = q.prepare(sqlStr); |
|
- | 1600 | ok = q.exec(); |
|
- | 1601 | if (!ok){ |
|
- | 1602 | QMessageBox::critical( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå. |
|
- | 1603 | this, // Ðîäèòåëüñêèé âèäæåò. |
|
- | 1604 | QObject::tr("Database Error"), // Çàãîëîâîê. |
|
- | 1605 | q.lastError().text()); // Òåêñò ñîîáùåíèÿ. |
|
- | 1606 | return; |
|
- | 1607 | }
|
|
- | 1608 | ||
- | 1609 | field_id = q.record().indexOf(tr("ID")); |
|
- | 1610 | if (field_id == -1) return; |
|
- | 1611 | else while (q.next()){ |
|
- | 1612 | classID = q.value(field_id).asString(); |
|
- | 1613 | ||
- | 1614 | }
|
|
- | 1615 | ||
- | 1616 | inctance = MainWindow::getClassInctance(classID); |
|
- | 1617 | if(inctance.isEmpty()) return; |
|
- | 1618 | sqlStr = tr("select * from `"); |
|
- | 1619 | sqlStr.append(inctance); |
|
- | 1620 | sqlStr.append(tr("`")); |
|
- | 1621 | ok = q.prepare(sqlStr); |
|
- | 1622 | ok = q.exec(); |
|
- | 1623 | if (!ok){ |
|
- | 1624 | QMessageBox::critical( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå. |
|
- | 1625 | this, // Ðîäèòåëüñêèé âèäæåò. |
|
- | 1626 | QObject::tr("Database Error"), // Çàãîëîâîê. |
|
- | 1627 | q.lastError().text()); // Òåêñò ñîîáùåíèÿ. |
|
- | 1628 | return; |
|
- | 1629 | }
|
|
- | 1630 | ||
- | 1631 | ||
- | 1632 | ||
- | 1633 | field_id = q.record().indexOf(tr("ID")); |
|
- | 1634 | field_ip = q.record().indexOf(tr("IP")); |
|
- | 1635 | field_user_name = q.record().indexOf(tr("Ëîãèí")); |
|
- | 1636 | field_password = q.record().indexOf(tr("Ïàðîëü")); |
|
- | 1637 | ||
- | 1638 | while (q.next()){ |
|
- | 1639 | QString ID_str, IP_str, user_name_str, password_str;
|
|
- | 1640 | QTreeWidgetItem * itm_tmp; |
|
- | 1641 | IP_str = q.value(field_ip).asString(); |
|
- | 1642 | user_name_str = q.value(field_user_name).asString(); |
|
- | 1643 | password_str = q.value(field_password).asString(); |
|
- | 1644 | ||
- | 1645 | itm_tmp = new QTreeWidgetItem(ui->treeWidget_3); |
|
- | 1646 | itm_tmp->setText(0, IP_str); |
|
- | 1647 | itm_tmp->setCheckState(0, Qt::Checked ); |
|
- | 1648 | ||
- | 1649 | ||
- | 1650 | ||
- | 1651 | ||
- | 1652 | ||
- | 1653 | TWmiVideoCard vCard;
|
|
- | 1654 | ||
- | 1655 | ||
- | 1656 | ||
- | 1657 | vCard = MainWindow::getWmiVideoGard(IP_str, user_name_str, password_str); |
|
- | 1658 | ||
- | 1659 | if (!vCard.name.isEmpty()) { |
|
- | 1660 | QTreeWidgetItem * itm_video; |
|
- | 1661 | QTreeWidgetItem * itm_video_ram; |
|
- | 1662 | QTreeWidgetItem * itm_video_model; |
|
- | 1663 | QTreeWidgetItem * itm_video_manufacturer; |
|
- | 1664 | QString tmp_str;
|
|
- | 1665 | tmp_str = tr("Âèäåîêàðòà: "); |
|
- | 1666 | tmp_str.append(vCard.name); |
|
- | 1667 | itm_video = new QTreeWidgetItem(itm_tmp); |
|
- | 1668 | itm_video->setText(0, tmp_str); |
|
- | 1669 | ||
- | 1670 | tmp_str = tr("Ïðîèçâîäèòåëü: "); |
|
- | 1671 | tmp_str.append(vCard.manufacturer); |
|
- | 1672 | ||
- | 1673 | itm_video_manufacturer = new QTreeWidgetItem(itm_video); |
|
- | 1674 | itm_video_manufacturer->setText(0, tmp_str); |
|
- | 1675 | ||
- | 1676 | itm_video_ram = new QTreeWidgetItem(itm_video); |
|
- | 1677 | ||
- | 1678 | tmp_str = tr("Ìîäåëü: "); |
|
- | 1679 | tmp_str.append(vCard.model); |
|
- | 1680 | itm_video_model = new QTreeWidgetItem(itm_video); |
|
- | 1681 | itm_video_model->setText(0, tmp_str); |
|
- | 1682 | ||
- | 1683 | ||
- | 1684 | ||
- | 1685 | tmp_str = tr("Âèäåîïàìÿòü (Ìá): "); |
|
- | 1686 | tmp_str.append(QVariant(vCard.video_ram /1048576).asString()); |
|
- | 1687 | ||
- | 1688 | itm_video_ram->setText(0, tmp_str); |
|
- | 1689 | ||
- | 1690 | ||
- | 1691 | ||
- | 1692 | }
|
|
- | 1693 | ||
- | 1694 | ||
- | 1695 | ||
- | 1696 | int i; |
|
- | 1697 | i++; |
|
- | 1698 | ||
- | 1699 | }
|
|
- | 1700 | ||
- | 1701 | ||
- | 1702 | ||
- | 1703 | ||
- | 1704 | }
|