Редакция 237 | Редакция 241 | К новейшей редакции | Весь файл | Не учитывать пробелы | Содержимое файла | Авторство | Последнее изменение | Открыть журнал | RSS
Редакция 237 | Редакция 238 | ||
---|---|---|---|
Строка 94... | Строка 94... | ||
94 | 94 | ||
95 | model_is_build = true; |
95 | model_is_build = true; |
96 | connect(sql_mogel, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(on_sql_mogel_dataChanged(QModelIndex,QModelIndex))); |
96 | connect(sql_mogel, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(on_sql_mogel_dataChanged(QModelIndex,QModelIndex))); |
97 | connect(model_for_ListModelsTable, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(on_model_for_ListModelsTable_dataChanged(QModelIndex,QModelIndex))); |
97 | connect(model_for_ListModelsTable, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(on_model_for_ListModelsTable_dataChanged(QModelIndex,QModelIndex))); |
98 | connect(filter_model, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(on_filter_model_dataChanged(QModelIndex,QModelIndex))); |
98 | connect(filter_model, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(on_filter_model_dataChanged(QModelIndex,QModelIndex))); |
- | 99 | connect(&wmiProcess, SIGNAL(readyReadStandardOutput()), this, SLOT(readStandartProcessOutput())); |
|
- | 100 | ||
99 | 101 | ||
100 | 102 | ||
101 | ui->pushButton_3->setEnabled(false); |
103 | ui->pushButton_3->setEnabled(false); |
102 | ui->pushButton_4->setEnabled(false); |
104 | ui->pushButton_4->setEnabled(false); |
103 | 105 | ||
Строка 1714... | Строка 1716... | ||
1714 | }
|
1716 | }
|
1715 | 1717 | ||
1716 | return result_list; |
1718 | return result_list; |
1717 | 1719 | ||
1718 | }
|
1720 | }
|
- | 1721 | ||
- | 1722 | ||
- | 1723 | ||
- | 1724 | void MainWindow::readStandartProcessOutput(){ |
|
- | 1725 | ||
- | 1726 | QTextDocument * wmiDoc = ui->textEdit_2->document(); |
|
- | 1727 | QTextCursor * wmiCursor; |
|
- | 1728 | wmiCursor = new QTextCursor(wmiDoc); |
|
- | 1729 | ||
- | 1730 | QByteArray arr;
|
|
- | 1731 | QStringList result, fields, values;
|
|
- | 1732 | QString str1, str2;
|
|
- | 1733 | int i; |
|
- | 1734 | arr = wmiProcess.readAllStandardOutput(); |
|
- | 1735 | QTextCodec *codecUTF = QTextCodec::codecForName("utf8"); |
|
- | 1736 | QTextCodec *codec = QTextCodec::codecForName("cp1251"); |
|
- | 1737 | QTextCodec::setCodecForTr(codecUTF); |
|
- | 1738 | str1 = QString(tr(arr)); |
|
- | 1739 | result = str1.split("\n", QString::SkipEmptyParts); |
|
- | 1740 | if (result.count()>2){ |
|
- | 1741 | ||
- | 1742 | ||
- | 1743 | ||
- | 1744 | ||
- | 1745 | QString tmp_str;
|
|
- | 1746 | QTextTable * wmi_table; |
|
- | 1747 | int fields_count, row_count; |
|
- | 1748 | tmp_str = result.at(1); |
|
- | 1749 | fields = tmp_str.split("|"); |
|
- | 1750 | fields_count = fields.count(); |
|
- | 1751 | row_count = result.count()-1; // ïåðâóþ ñòðîêó (íàçâàíèå êëàññà) îòîáðàæàòü íå áóäåì |
|
- | 1752 | wmi_table = wmiCursor->insertTable(row_count, fields_count); |
|
- | 1753 | for(int n = 0; n < fields.count(); n++) { // çàïîëíÿåì "øàïêó" òàáëèöû |
|
- | 1754 | *wmiCursor = wmi_table->cellAt(0, n).firstCursorPosition(); |
|
- | 1755 | wmiCursor->insertText(fields.at(n)); |
|
- | 1756 | }
|
|
- | 1757 | // tmp_str = result.at(2);
|
|
- | 1758 | // values = tmp_str.split("|");
|
|
- | 1759 | ||
- | 1760 | ||
- | 1761 | for (int m=2; m< result.count(); m++){ |
|
- | 1762 | ||
- | 1763 | tmp_str = result.at(m); |
|
- | 1764 | values = tmp_str.split("|"); |
|
- | 1765 | ||
- | 1766 | for(int n = 0; n < values.count(); n++){ |
|
- | 1767 | *wmiCursor = wmi_table->cellAt(m-1, n).firstCursorPosition(); |
|
- | 1768 | ||
- | 1769 | // wmiCursor->insertText(fields.at(n));
|
|
- | 1770 | // wmiCursor->insertText(tr(": "));
|
|
- | 1771 | wmiCursor->insertText(values.at(n)); |
|
- | 1772 | // wmiCursor->insertText(tr("\n"));
|
|
- | 1773 | ||
- | 1774 | }
|
|
- | 1775 | ||
- | 1776 | ||
- | 1777 | ||
- | 1778 | }
|
|
- | 1779 | ||
- | 1780 | ||
- | 1781 | ||
- | 1782 | }
|
|
- | 1783 | QTextCodec::setCodecForTr(codec); |
|
- | 1784 | ||
- | 1785 | ||
- | 1786 | ||
- | 1787 | ||
- | 1788 | ||
- | 1789 | ||
- | 1790 | ||
- | 1791 | ||
- | 1792 | ||
- | 1793 | // result = QStringList(arr);
|
|
- | 1794 | // str2 << arr;
|
|
- | 1795 | //i = result.size();
|
|
- | 1796 | // str1 = result.at(0);
|
|
- | 1797 | i++; |
|
- | 1798 | //lineEdit->insert(str1);
|
|
- | 1799 | ||
- | 1800 | }
|
|
- | 1801 | ||
- | 1802 | void MainWindow::readStandartProcessError(){ |
|
- | 1803 | QByteArray arr;
|
|
- | 1804 | arr = wmiProcess.readAllStandardError(); |
|
- | 1805 | ||
- | 1806 | }
|