-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
LCM1999
committed
Sep 30, 2019
1 parent
2dbb1fb
commit b9ae3aa
Showing
9 changed files
with
116 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#include "mainwindow.h" | ||
#include "process.h" | ||
#include "processthread.h" | ||
#include <QMetaType> | ||
|
||
#include <QDebug> | ||
|
||
using namespace std; | ||
|
||
process_thread::process_thread(char *name, QTreeView *treeV){ | ||
this->vm_name = QString(name); | ||
this->isRun = true; | ||
QStandardItemModel* model = new QStandardItemModel(treeV); | ||
this->model = model; | ||
qRegisterMetaType<vector<process_struct>>("vector<process_struct>"); | ||
} | ||
|
||
void process_thread::run(){ | ||
vector<process_struct> this_procList; | ||
while(isRun){ | ||
this_procList= getProcessList((vm_name.toLatin1()).data()); | ||
// QVariant data; | ||
// data.setValue(this_procList); | ||
emit refresh(this_procList); | ||
this->sleep(10); | ||
} | ||
} | ||
|
||
void process_thread::stop(){ | ||
isRun = false; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#include "mainwindow.h" | ||
#include "processthread.h" | ||
#include <QDebug> | ||
void MainWindow::openListingPro() { | ||
pthread = new process_thread((vm_name->toLatin1()).data(),ui->treeView_2); | ||
connect(pthread,SIGNAL(refresh(vector<process_struct>)),this,SLOT(refreshlist(vector<process_struct>))); | ||
pthread->start(); | ||
} | ||
void MainWindow::stopListingPro() { | ||
pthread->stop(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#ifndef PROCESSTHREAD_H | ||
#define PROCESSTHREAD_H | ||
|
||
#include <QThread> | ||
#include <QTreeView> | ||
#include <QStandardItemModel> | ||
#include <QStringLiteral> | ||
#include <QString> | ||
#include "process.h" | ||
|
||
|
||
class process_thread : public QThread{ | ||
Q_OBJECT | ||
public: | ||
process_thread(char* name, QTreeView* treeV); | ||
void run(); | ||
void stop(); | ||
bool isRun; | ||
QString vm_name; | ||
QStandardItemModel* model; | ||
|
||
signals: | ||
void refresh(vector<process_struct> proclist); | ||
}; | ||
|
||
#endif // PROCESSTHREAD_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters