Palacios Public Git Repository

To checkout Palacios execute

  git clone http://v3vee.org/palacios/palacios.web/palacios.git
This will give you the master branch. You probably want the devel branch or one of the release branches. To switch to the devel branch, simply execute
  cd palacios
  git checkout --track -b devel origin/devel
The other branches are similar.


Palacios GUI Added
[palacios.git] / linux_usr / gui / palacios / vm_view.cpp
1 #include <QDebug>
2 #include <QWidget>
3 #include <QStringList>
4 #include <QCloseEvent>
5 #include <QResizeEvent>
6
7 #include "newpalacios.h"
8
9 VmXConsoleParent::VmXConsoleParent(QString name, QWidget* parent)
10         : QWidget(parent) {
11         
12         mVmName = name;
13         
14         QVBoxLayout* l = new QVBoxLayout;
15         mConsole = new VmConsoleWidget(this);
16         l->addWidget(mConsole);
17         l->setStretchFactor(mConsole, 1000);
18         
19         this->setLayout(l);
20         this->setWindowTitle(name);
21         
22         connect(this, SIGNAL(windowClosing()), mConsole,
23                 SLOT(mainWindowClosing()));
24 }
25
26 void VmXConsoleParent::showWidget(int mode, QString devfile, QString streamName) {
27         mConsole->start(mode, devfile, streamName);
28                 
29         // Workaround for QProcess error
30         mIsConsoleRunning = true;
31 }
32
33 bool VmXConsoleParent::isRunning() {
34         // FIXME: For some reason QProcess does not seem to return the correct state
35         // Qprocess->state() should give the correct state of the running process
36         // but currently there is a problem with geting the right state.
37         // For the time being a boolean flag is used to represent the state (running/not running)
38                 
39         //return mConsole->isRunning();
40         return mIsConsoleRunning;
41 }
42
43 QString VmXConsoleParent::getVmName() {
44         return mVmName;
45 }
46
47 void VmXConsoleParent::closeEvent(QCloseEvent* event) {
48         // Workaround for QProcess error
49         /*if (!tryTerminate())
50                 qDebug() << "Warning: could not terminate process...there could be a leak";
51         else
52                 qDebug() << "Process terminated";*/
53                 
54         mIsConsoleRunning = false;
55         emit windowClosingWithId(mVmName);
56         emit windowClosing();
57         event->accept();
58 }