From 472fe3ded907ab6de33a63dce7fe1d8b09e28c37 Mon Sep 17 00:00:00 2001 From: Fabian Schillinger Date: Mon, 8 Nov 2010 13:38:45 +0100 Subject: modified showprocesses --- src/gui/processWidget.cpp | 10 ---------- src/gui/processesStartDialog.cpp | 24 +----------------------- src/pvs.cpp | 17 ++++++++--------- 3 files changed, 9 insertions(+), 42 deletions(-) (limited to 'src') diff --git a/src/gui/processWidget.cpp b/src/gui/processWidget.cpp index ac0b419..38dd2ae 100644 --- a/src/gui/processWidget.cpp +++ b/src/gui/processWidget.cpp @@ -128,16 +128,6 @@ void ProcessWidget::stopProcess() } //tell client to update his list sendCommand("SHOWPROCESSES", ""); - /* - QMessageBox::StandardButton start = QMessageBox::question(0, - tr("PVS Start Process"), tr("Do you want to stop the process: ") + prowui->processTable->item(prowui->processTable->currentRow(),1)->text() + - tr(" on this Client?"), - QMessageBox::Ok | QMessageBox::Cancel, QMessageBox::Ok); - if (start == QMessageBox::Ok) - { - sendCommand("KILLPROCESS", prowui->processTable->item(prowui->processTable->currentRow(),0)->text()); - sendCommand("SHOWPROCESSES", ""); - }*/ } } diff --git a/src/gui/processesStartDialog.cpp b/src/gui/processesStartDialog.cpp index f176f7e..d1a7017 100644 --- a/src/gui/processesStartDialog.cpp +++ b/src/gui/processesStartDialog.cpp @@ -23,36 +23,14 @@ ProcessesStartDialog::ProcessesStartDialog(QWidget *parent) : procStartUi(new Ui::ProcessesStartDialog) { procStartUi->setupUi(this); - /*textLabel = new QLabel; - textLabel->setText("Process to start:"); - - messageEdit = new QLineEdit; - - layout = new QGridLayout; - - sendButton = new QPushButton(tr("Start")); - cancelButton = new QPushButton(tr("Cancel")); - - connect( sendButton, SIGNAL( clicked()), this, SLOT( send())); - connect( cancelButton, SIGNAL( clicked()), this, SLOT( NotSend())); - - layout->addWidget(textLabel,0,0); - layout->addWidget(messageEdit,1,0); - layout->addWidget(cancelButton,2,1); - layout->addWidget(sendButton,2,0); - - setLayout(layout); - setWindowTitle(tr("PVS start Process"));*/ - connect( procStartUi->sendButton, SIGNAL( clicked()), this, SLOT( send())); connect( procStartUi->cancelButton, SIGNAL( clicked()), this, SLOT( notSend())); procStartUi->listOfProcessesButton->hide(); - //connect( procStartUi->listOfProcessesButton, SIGNAL( clicked()), this, SLOT( listProcesses())); } ProcessesStartDialog::~ProcessesStartDialog() { - //delete procstartui; + // } void ProcessesStartDialog::send() diff --git a/src/pvs.cpp b/src/pvs.cpp index 611aa86..32e1b4b 100755 --- a/src/pvs.cpp +++ b/src/pvs.cpp @@ -941,7 +941,6 @@ QString PVS::getConfigValue(QString key) void PVS::showProc() { QString settings = getConfigValue("RemoteProcess/filter"); - _pvsServerConnection->sendMessage(PVSMsg(PVSCOMMAND, "PROCESSES", "SHOW "+settings)); QStringList filter = settings.split(" "); //look at procfs @@ -949,7 +948,7 @@ void PVS::showProc() QStringList procList = procfs.entryList(); int uid = getuid(); bool write; - if (procList.length() < 1) + if (procList.length() < 1) //if we can't read procfs for any reason { _pvsServerConnection->sendMessage(PVSMsg(PVSCOMMAND, "PROCESSES", "SHOW ERROR")); return; @@ -974,20 +973,20 @@ void PVS::showProc() { name = line.remove(0,6); tempSend.append(tempFolder).append(QString("<#>")).append(line).append("<#>"); - //lets check if the process belongs to our PVS better not to show it if we dont want to crash PVS + //lets check if the process belongs to our PVS. better not to show it if we dont want to crash PVS } else if (line.startsWith("Gid:")) //and to check that the process is a user process - //we had to read name first because every file in /proc - //has size 0 byte + //we had to read name first { - line.remove(0,5); - if (line.startsWith(QString::number(uid))) + line.remove(QRegExp("\\D")); //remove all non-digit characters (letters+whitespaces) + int llength = line.size(); + line.remove(llength/4,llength); + if (line == QString::number(uid)) write = true; else break; - } line = in.readLine(); } - if (write) + if (write) //check if user belongs to pvs { for (int i=0;i