Rev 243 | Rev 249 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 243 | Rev 248 | ||
---|---|---|---|
Line 1819... | Line 1819... | ||
1819 | 1819 | ||
1820 | 1820 | ||
1821 | TWmiVideoCard MainWindow::getWmiVideoGard(QString host, QString user_name, QString password){ |
1821 | TWmiVideoCard MainWindow::getWmiVideoGard(QString host, QString user_name, QString password){ |
1822 | TWmiVideoCard result;
|
1822 | TWmiVideoCard result;
|
1823 | bool ok; |
1823 | bool ok; |
- | 1824 | QString ansver_string;
|
|
1824 | // wmiThread.moveToThread(&wmiThread);
|
1825 | // wmiThread.moveToThread(&wmiThread);
|
1825 | wmiThread.setHost(host); // çàäàåì õîñò |
1826 | wmiThread.setHost(host); // çàäàåì õîñò |
1826 | wmiThread.setUser(user_name);//çàäàåì èìÿ ïîëüçîâàòåëÿ |
1827 | wmiThread.setUser(user_name);//çàäàåì èìÿ ïîëüçîâàòåëÿ |
1827 | wmiThread.setPassword( password); |
1828 | wmiThread.setPassword( password); |
1828 | wmiThread.setWmiString(tr("select * from Win32_ComputerSystem")); |
1829 | wmiThread.setWmiString(tr("select Name, AdapterCompatibility, AdapterRAM, VideoProcessor from Win32_VideoController")); |
1829 | wmiThread.start(QThread::NormalPriority); |
1830 | wmiThread.start(QThread::NormalPriority); |
1830 | //for (;;) {if (wmiThread.isStopped()) break;}
|
1831 | //for (;;) {if (wmiThread.isStopped()) break;}
|
1831 | int t; |
1832 | int t; |
1832 | t++; |
1833 | t++; |
1833 | 1834 | ||
1834 | 1835 | ||
1835 | ok = wmiThread.wait(10000); |
1836 | ok = wmiThread.wait(10000); |
1836 | if (ok){ |
1837 | if (ok){ |
- | 1838 | QTextDocument * wmiDoc = ui->textEdit_2->document(); |
|
- | 1839 | QTextCursor * wmiCursor; |
|
- | 1840 | QStringList split_new_line; // |
|
- | 1841 | QStringList fields_list; //â ýòîì ñïèñêå ñîõðàíèì ïîëÿ |
|
- | 1842 | QStringList values_list; //à â ýòîì ñïèñêå - çíà÷åíèÿ |
|
- | 1843 | wmiCursor = new QTextCursor(wmiDoc); |
|
- | 1844 | ansver_string = wmiThread.resultString(); |
|
- | 1845 | wmiCursor->insertText(ansver_string); |
|
- | 1846 | split_new_line = ansver_string.split("\n", QString::SkipEmptyParts); // ðàçáèâàåíì îòâåò íà ñòðîêè |
|
- | 1847 | if(split_new_line.count()>2) { |
|
- | 1848 | QString tmp_str;
|
|
- | 1849 | tmp_str = split_new_line.at(1); |
|
- | 1850 | fields_list = tmp_str.split("|"); |
|
- | 1851 | tmp_str = split_new_line.at(2); |
|
- | 1852 | values_list = tmp_str.split("|"); |
|
- | 1853 | int index_tmp; |
|
- | 1854 | index_tmp = fields_list.indexOf(tr("AdapterCompatibility")); // ïðîèçâîäèòåëü |
|
- | 1855 | if (index_tmp!=-1) result.manufacturer = values_list.at(index_tmp); |
|
- | 1856 | index_tmp = fields_list.indexOf(tr("Name")); // íàçâàíèå âèäåîêàðòû |
|
- | 1857 | if (index_tmp!=-1) result.name = values_list.at(index_tmp); |
|
- | 1858 | index_tmp = fields_list.indexOf(tr("VideoProcessor")); // ìîäåëü |
|
- | 1859 | if (index_tmp!=-1) result.model = values_list.at(index_tmp); |
|
- | 1860 | index_tmp = fields_list.indexOf(tr("AdapterRAM")); // ìîäåëü |
|
- | 1861 | if (index_tmp!=-1) result.video_ram = QVariant(values_list.at(index_tmp)).asInt(); |
|
- | 1862 | return result; |
|
- | 1863 | }
|
|
- | 1864 | else return result; //ïîëó÷èëè íå êîððåêòíûé îòâåò |
|
1837 | int m; |
1865 | int m; |
1838 | m++; |
1866 | m++; |
1839 | }
|
1867 | }
|
1840 | else { |
1868 | else { |
1841 | wmiThread.stop(); |
1869 | wmiThread.stop(); |