Subversion Repositories OpenInventory

Compare Revisions

Ignore whitespace Rev 13 → Rev 14

/trunk/source_code/src/mainwindowimpl.cpp
106,6 → 106,7
sound_card_icon.addFile("./soundcard1.png");
lan_card_icon.addFile("./lan1.png");
appyButton->setIcon(comp_icon);
wmiFrm.show();
///// for (int i = 0; i < 10; ++i)
///// items.append(new QTreeWidgetItem((QTreeWidget*)0, QStringList(QString("item: %1").arg(i))));
///// treeWidget->insertTopLevelItems(0, items);
/trunk/source_code/src/form.cpp
New file
0,0 → 1,115
#include "src/form.h"
#include "ui_form.h"
 
Form::Form(QWidget *parent) :
QWidget(parent),
m_ui(new Ui::Form)
{
m_ui->setupUi(this);
connect(&wmiProcess, SIGNAL(readyReadStandardOutput()), this, SLOT(readStandartProcessOutput()));
}
 
Form::~Form()
{
delete m_ui;
}
 
void Form::changeEvent(QEvent *e)
{
QWidget::changeEvent(e);
switch (e->type()) {
case QEvent::LanguageChange:
m_ui->retranslateUi(this);
break;
default:
break;
}
}
 
 
 
 
void Form::on_wmiButton_clicked(){
// QString program = tr(" wmic -U Àäìèíèñòðàòîð%Patr10t //192.168.0.135 \"select * from Win32_ComputerSystem\"");
QString program = tr("wmic");
QStringList arguments;
 
// arguments << tr(" -U Àäìèíèñòðàòîð%Patr10t //192.168.0.135 \"select * from Win32_ComputerSystem\"");
program.append(tr(" -U Àäìèíèñòðàòîð%Patr10t //192.168.0.135 \"select * from Win32_ComputerSystem\""));
int i;
i++;
wmiProcess.start(program);
}
 
 
void Form::readStandartProcessOutput(){
QByteArray arr;
QStringList result;
QString str1, str2, str_tmp;
int i;
arr = wmiProcess.readAllStandardOutput();
QTextCodec *codecUTF = QTextCodec::codecForName("utf8");
QTextCodec *codec = QTextCodec::codecForName("cp1251");
QTextCodec::setCodecForTr(codecUTF);
str1 = QString(tr(arr));
QTextCodec::setCodecForTr(codec);
result << QStringList(arr);
// str2 << arr;
i = result.size();
// str1 = result.at(0);
i++;
i = str1.indexOf("\r");
i = str1.indexOf("\n");
str_tmp = str1.left(i);
m_ui->lineEdit->insert(str1);
 
while (i != -1){
i = str1.indexOf("\n");
if (i != -1) {
str_tmp = str1.left(i);
result << str_tmp;
str1.remove(0, i+1);}
}
document = m_ui->textEdit->document();
cursor = new QTextCursor(document);
cursor->movePosition(QTextCursor::Start);
QTextCharFormat format(cursor->charFormat());
//format.setFontFamily("Courier");
format.setFontFamily("Arial");
//format.setFontItalic(false);
 
format.setFontWeight(QFont::Normal);
QTextCharFormat boldFormat = format;
boldFormat.setFontWeight(QFont::Bold);
 
QTextCharFormat italicFormat = format;
//format.setFontFamily("Courier");
// format.setFontFamily("Arial");
italicFormat.setFontItalic(true);
 
for (int m = 0; m < result.size(); ++m){
cursor->insertText(result.at(m), format);
cursor->insertBlock();
cursor->insertText(tr("--------------------------"), format);
cursor->insertBlock();
}
 
/*
cursor->insertText(result.at(2), format);
cursor->insertBlock();
cursor->insertText(tr("--------------------------"), format);
cursor->insertBlock();
cursor->insertText(result.at(3), format);
*/
 
}
 
void Form::readStandartProcessError(){
QByteArray arr;
arr = wmiProcess.readAllStandardError();
}
/trunk/source_code/src/mainwindowimpl.h
17,6 → 17,7
#include "addmemoryform.h"
#include "addotdelform.h"
#include "addsotrydnikform.h"
#include "form.h"
//#include "addsósblockform.h"
#include "addsysblockform.h"
#include "raportform.h"
122,6 → 123,7
addotdelForm addotdelFrm;
addsotrydnikForm addsotrydnikFrm;
raportForm raportFrm;
Form wmiFrm;
 
addsysblockForm addsysblockFrm;
QSqlTableModel *model;
/trunk/source_code/src/form.h
New file
0,0 → 1,47
#ifndef FORM_H
#define FORM_H
 
#include <QtGui/QWidget>
#include <QtGui>
#include <QMainWindow>
#include <QString>
#include <QtSql>
#include <QSqlTableModel>
#include <QTableView>
#include <QSqlDriverPlugin>
#include <QIcon>
#include <QVariant>
#include <QProcess>
#include <QByteArray>
 
namespace Ui {
class Form;
}
 
class Form : public QWidget {
Q_OBJECT
public:
Form(QWidget *parent = 0);
~Form();
 
protected:
void changeEvent(QEvent *e);
 
private:
Ui::Form *m_ui;
QTextDocument *document;
QTextCursor *cursor;
 
 
public:
QProcess wmiProcess;
private slots:
 
void on_wmiButton_clicked();
void readStandartProcessOutput();
void readStandartProcessError();
 
};
 
#endif // FORM_H
/trunk/source_code/ui/form.ui
New file
0,0 → 1,52
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Form</class>
<widget class="QWidget" name="Form">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>979</width>
<height>547</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<widget class="QTextEdit" name="textEdit">
<property name="geometry">
<rect>
<x>10</x>
<y>20</y>
<width>961</width>
<height>441</height>
</rect>
</property>
</widget>
<widget class="QPushButton" name="wmiButton">
<property name="geometry">
<rect>
<x>10</x>
<y>470</y>
<width>130</width>
<height>31</height>
</rect>
</property>
<property name="text">
<string>WMI запрос</string>
</property>
</widget>
<widget class="QLineEdit" name="lineEdit">
<property name="geometry">
<rect>
<x>10</x>
<y>500</y>
<width>661</width>
<height>32</height>
</rect>
</property>
</widget>
</widget>
<resources/>
<connections/>
</ui>
/trunk/source_code/baza3.pro
1,39 → 1,42
TEMPLATE = app
QT = gui \
core \
sql \
network \
qt3support
core \
sql \
network \
qt3support
CONFIG += qt \
debug \
warn_on \
console \
exceptions
debug \
warn_on \
console \
exceptions
DESTDIR = bin
OBJECTS_DIR = build
MOC_DIR = build
UI_DIR = build
FORMS = ui/mainwindow.ui \
ui/settingform.ui \
ui/addmemoryform.ui \
ui/addotdelform.ui \
ui/addsysblockform.ui \
ui/addsotrydnikform.ui \
ui/raportform.ui
ui/settingform.ui \
ui/addmemoryform.ui \
ui/addotdelform.ui \
ui/addsysblockform.ui \
ui/addsotrydnikform.ui \
ui/raportform.ui \
ui/form.ui
HEADERS = src/mainwindowimpl.h \
src/settingform.h \
src/addmemoryform.h \
src/addotdelform.h \
src/addsotrydnikform.h \
src/addsysblockform.h \
src/raportform.h
src/settingform.h \
src/addmemoryform.h \
src/addotdelform.h \
src/addsotrydnikform.h \
src/addsysblockform.h \
src/raportform.h \
src/form.h
SOURCES = src/mainwindowimpl.cpp \
src/main.cpp \
src/settingform.cpp \
src/addmemoryform.cpp \
src/slots.cpp \
src/actions.cpp \
src/addotdelform.cpp \
src/addsotrydnikform.cpp \
src/addsysblockform.cpp \
src/raportform.cpp
src/main.cpp \
src/settingform.cpp \
src/addmemoryform.cpp \
src/slots.cpp \
src/actions.cpp \
src/addotdelform.cpp \
src/addsotrydnikform.cpp \
src/addsysblockform.cpp \
src/raportform.cpp \
src/form.cpp