5 #include <QResizeEvent>
7 #include "newpalacios.h"
9 VmXConsoleParent::VmXConsoleParent(QString name, QWidget* parent)
14 QVBoxLayout* l = new QVBoxLayout;
15 mConsole = new VmConsoleWidget(this);
16 l->addWidget(mConsole);
17 l->setStretchFactor(mConsole, 1000);
20 this->setWindowTitle(name);
22 connect(this, SIGNAL(windowClosing()), mConsole,
23 SLOT(mainWindowClosing()));
26 void VmXConsoleParent::showWidget(int mode, QString devfile, QString streamName) {
27 mConsole->start(mode, devfile, streamName);
29 // Workaround for QProcess error
30 mIsConsoleRunning = true;
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)
39 //return mConsole->isRunning();
40 return mIsConsoleRunning;
43 QString VmXConsoleParent::getVmName() {
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";
52 qDebug() << "Process terminated";*/
54 mIsConsoleRunning = false;
55 emit windowClosingWithId(mVmName);