Subversion Repositories OpenInventory

Rev

Rev 248 | Rev 250 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
239 pingvin 1
#ifndef WMITHREAD_H
2
#define WMITHREAD_H
3
 
4
#include <QThread>
5
#include <QProcess>
6
#include <QMutex>
242 pingvin 7
#include <QDebug>
243 pingvin 8
#include <QEventLoop>
9
#include "woker.h"
239 pingvin 10
 
11
class WmiThread : public QThread
12
{
13
    Q_OBJECT
14
public:
15
    explicit WmiThread(QObject *parent = 0);
16
    void run();
17
    void stop();
18
    void setHost(QString new_host){host = new_host;}
19
    void setUser(QString new_user){user_name = new_user;}
20
    void setPassword(QString new_password){password = new_password;}
21
    QByteArray buffer(){return p_buffer;}
22
    void clearBuffer(){p_buffer.clear();}
241 pingvin 23
    bool isError(){return error;}
242 pingvin 24
    bool isStopped(){
25
        mutex.lock();
26
        return stopped;
27
        mutex.unlock();
28
 
248 pingvin 29
                        }
241 pingvin 30
    void setWmiString(QString new_wmi_string){wmi_string = new_wmi_string;}
248 pingvin 31
    QString resultString(){
249 pingvin 32
                           // static QTextCodec *codec = QTextCodec::codecForName("cp1251");
33
                           // static QTextCodec *codecUTF = QTextCodec::codecForName("utf8");
34
                           // QTextCodec::setCodecForTr(codecUTF);
248 pingvin 35
                            return QString(tr(p_buffer));
249 pingvin 36
                           // QTextCodec::setCodecForTr(codec);
248 pingvin 37
                            }
243 pingvin 38
volatile bool stopped;
239 pingvin 39
private:
243 pingvin 40
 
239 pingvin 41
    volatile bool error;
243 pingvin 42
 
242 pingvin 43
   QProcess process;
239 pingvin 44
    QString host;
45
    QString user_name;
46
    QString password;
47
    QMutex mutex;
48
    QByteArray p_buffer; //   ,       ()
241 pingvin 49
    QString wmi_string;  //   wmi-
239 pingvin 50
 
51
signals:
52
 
53
public slots:
241 pingvin 54
    void readStandartProcessOutput();
55
    void readStandartProcessError();
243 pingvin 56
    void wokerIsStopped();
239 pingvin 57
 
58
private slots:
59
 
60
 
241 pingvin 61
 
239 pingvin 62
};
63
 
64
#endif // WMITHREAD_H