summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohann Latocha2011-03-01 01:52:37 +0100
committerJohann Latocha2011-03-01 01:52:37 +0100
commitab473de90a2d884c517f48f5921b9a82b1270aad (patch)
tree80b65795681928ad985365a49a8c5176e7a05479
parentFix for issue #781 (diff)
downloadvmchooser-ab473de90a2d884c517f48f5921b9a82b1270aad.tar.gz
vmchooser-ab473de90a2d884c517f48f5921b9a82b1270aad.tar.xz
vmchooser-ab473de90a2d884c517f48f5921b9a82b1270aad.zip
[Fix] Startup problems with xsession (Quick&Dirty)
-rw-r--r--.gitignore3
-rw-r--r--CMakeLists.txt15
-rw-r--r--default.desktop7
-rw-r--r--src/dialog.cpp2
-rw-r--r--src/vsession.cpp9
-rw-r--r--src/vsession.h2
-rw-r--r--src/xsession.cpp12
-rw-r--r--src/xsession.h2
8 files changed, 35 insertions, 17 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..3245ec2
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,3 @@
+.cproject
+.project
+build/
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0f26a29..25e8cce 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -5,11 +5,7 @@ project(vmchooser)
set(CMAKE_BUILD_TYPE Debug)
set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g -Wall -Wextra -Werror")
-set(CMAKE_CXX_FLAGS_RELEASE "-O3 -march=native -Wall -Wextra -Werror")
-
-set(CMAKE_VERBOSE_MAKEFILE TRUE)
-set(OPENSLX_ROOT "../../../..")
-#set(OPENSLX_ROOT "~/hiwi/openslx")
+set(CMAKE_CXX_FLAGS_RELEASE "-O2")
file(GLOB_RECURSE VMCHOOSER_SOURCES src/*.cpp)
file(GLOB_RECURSE VMCHOOSER_MOC_HEADERS src/*.h)
@@ -79,9 +75,6 @@ add_executable(vmchooser
target_link_libraries(vmchooser
${QT_LIBRARIES}
)
-
-#install(TARGETS vmchooser RUNTIME DESTINATION
-# "${OPENSLX_ROOT}/openslx/trunk/os-plugins/plugins/vmchooser/files/")
-
-install(TARGETS vmchooser RUNTIME DESTINATION
- "${CMAKE_BINARY_DIR}")
+
+install(TARGETS vmchooser RUNTIME DESTINATION bin)
+install(FILES default.desktop DESTINATION /usr/share/xsessions)
diff --git a/default.desktop b/default.desktop
new file mode 100644
index 0000000..ab2c948
--- /dev/null
+++ b/default.desktop
@@ -0,0 +1,7 @@
+[Desktop Entry]
+Name=RZ VMChooser
+Comment=This session logs you into VMChooser
+Exec=vmchooser
+TryExec=vmchooser
+Icon=
+Type=Applicatio \ No newline at end of file
diff --git a/src/dialog.cpp b/src/dialog.cpp
index 6820e49..0e888cb 100644
--- a/src/dialog.cpp
+++ b/src/dialog.cpp
@@ -63,7 +63,7 @@ void Dialog::on_treeView_activated(QModelIndex index) {
writePVSSettings();
}
writeSessionName(s->shortDescription());
- close();
+ setVisible(false);
} else {
QMessageBox::warning(
this, trUtf8("vmchooser"),
diff --git a/src/vsession.cpp b/src/vsession.cpp
index 31602ed..16a8a97 100644
--- a/src/vsession.cpp
+++ b/src/vsession.cpp
@@ -16,6 +16,7 @@
bool VSession::init(const QString& xml, const QString& baseDirPath) {
this->baseDirPath_ = baseDirPath;
+ _process = new QProcess();
return this->doc_.setContent(xml);
}
@@ -275,8 +276,12 @@ bool VSession::run() const {
tmpfile.close();
tmpfile.setAutoRemove(false);
- return QProcess::startDetached(runVmScript,
- QStringList(tmpfile.fileName()));
+ _process->start(runVmScript, QStringList(tmpfile.fileName()));
+ QObject::connect(_process, SIGNAL(finished(int, QProcess::ExitStatus)), QApplication::instance(), SLOT(quit()));
+ if (_process->state() == QProcess::Starting || QProcess::Running)
+ return true;
+ else
+ return false;
}
QList<Session*> VSession::readXmlFile(const QString& filepath) {
diff --git a/src/vsession.h b/src/vsession.h
index 344b552..99e8e20 100644
--- a/src/vsession.h
+++ b/src/vsession.h
@@ -61,6 +61,8 @@ class VSession : public Session {
private:
QDomDocument doc_;
QString baseDirPath_;
+
+ QProcess *_process;
};
#endif /*VMCHOOSER_VSESSION_H_*/
diff --git a/src/xsession.cpp b/src/xsession.cpp
index a888e91..37fad17 100644
--- a/src/xsession.cpp
+++ b/src/xsession.cpp
@@ -65,6 +65,8 @@ bool XSession::init(const QString& filename) {
this->comment_ = comment;
this->icon_ = icon;
+ _process = new QProcess();
+
return true;
}
@@ -99,16 +101,20 @@ QString XSession::icon() const {
}
bool XSession::run() const {
- return QProcess::startDetached(this->exec_);
+ _process->start(this->exec_);
+ QObject::connect(_process, SIGNAL(finished(int, QProcess::ExitStatus)), QApplication::instance(), SLOT(quit()));
+ if (_process->state() == QProcess::Starting || QProcess::Running)
+ return true;
+ else
+ return false;
}
QList<Session*> XSession::readSessions(const QString& path) {
QList<Session*> retval;
foreach (QFileInfo fi, QDir(path).entryInfoList(QStringList("*.desktop"))) {
- if (fi.baseName().compare("default.desktop") == 0) {
+ if (fi.baseName().compare("default") == 0) {
continue;
}
-
XSession* session = new XSession;
if (session->init(fi.absoluteFilePath())) {
retval.append(session);
diff --git a/src/xsession.h b/src/xsession.h
index a3aa31b..dbdacf1 100644
--- a/src/xsession.h
+++ b/src/xsession.h
@@ -38,6 +38,8 @@ class XSession : public Session {
QString exec_;
QString comment_;
QString icon_;
+
+ QProcess *_process;
};
#endif /*VMCHOOSER_XSESSION_H_*/