From b796bbc803613c3061b08b6c3c2a9883724f4684 Mon Sep 17 00:00:00 2001 From: Johann Latocha Date: Tue, 1 Mar 2011 23:03:20 +0100 Subject: 1) cmd-switch to use a window manager 2) openslx logo added --- src/main.cpp | 32 ++++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-) (limited to 'src/main.cpp') diff --git a/src/main.cpp b/src/main.cpp index faef051..83525a6 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -4,6 +4,7 @@ #include #include #include +#include #include #include @@ -32,13 +33,14 @@ int main(int argc, char *argv[]) { std::string usage(a.translate( "Console", "Usage: vmchooser [ OPTIONS | FILE ]\n\n" - " -d, --default name of default session\n" - " -P, --pool name of the environment\n" - " -p, --path path to vmware .xml files\n" - " -x, --xpath path of X Session .desktop files\n" - " -s, --size window size x\n" - " -v, --version print version and exit\n" - " -h, --help print usage information and exit\n" + " -d, --default name of default session\n" + " -P, --pool name of the environment\n" + " -p, --path path to vmware .xml files\n" + " -x, --xpath path of X Session .desktop files\n" + " -s, --size window size x\n" + " -w, --windowmgr use window manager\n" + " -v, --version print version and exit\n" + " -h, --help print usage information and exit\n" "\nFILE can be a vmware .xml or an X .desktop file\n") .toUtf8().data()); @@ -90,6 +92,13 @@ int main(int argc, char *argv[]) { } } + // TODO: parse args => command_line_options.cpp + QString windowmgr; + if (cmdOptions.contains("windowmgr")) { + windowmgr = cmdOptions.value("windowmgr"); + } + + // read configuration file: // file supplied as command line option or // user vmchooser.conf or @@ -162,7 +171,7 @@ int main(int argc, char *argv[]) { QList xsessions(XSession::readSessions(xSessionPath)); QList vsessions(VSession::readXmlDir(vSessionPath)); - Dialog w; + Dialog w(windowmgr); w.resize(width, height); if (xsessions.empty() && vsessions.empty()) { std::cerr << a.translate( @@ -189,5 +198,12 @@ int main(int argc, char *argv[]) { } w.selectSession(defaultSession); w.show(); + + // center dialog on screen + QRect desktopRect = QApplication::desktop()->availableGeometry(&w); + QPoint center = desktopRect.center(); + w.move(center.x()-w.width()*0.5, center.y()-w.height()*0.5); + a.setActiveWindow(&w); + return a.exec(); } -- cgit v1.2.3-55-g7522