Commit 5d221997 authored by SR's avatar SR
Browse files

add option to start minimized (-m)

parent a7e2c047
......@@ -69,11 +69,16 @@ int main(int argc, char **argv)
{
QCommandLineParser parser;
parser.setApplicationDescription("A virtual keyboard");
parser.addHelpOption();
parser.addOption(
{{"l", "loginhelper"},
QCoreApplication::translate("main", "Stand alone version for use with KDM or XDM.\n"
"See qtvkbd Handbook for information on how to use this option.")}
);
parser.addOption(
{{"m", "minimized"},
QCoreApplication::translate("main", "Start minimized.")}
);
QStringList arguments;
for (int a = 0; a < argc; ++a)
{
......@@ -82,11 +87,13 @@ int main(int argc, char **argv)
parser.parse(arguments);
bool is_login = parser.isSet("loginhelper");
if (!is_login) {
bool minimized = parser.isSet("minimized");
if (is_login) {
findLoginWindow();
}
QtvkbdApp app(argc, argv, is_login);
QtvkbdApp app(argc, argv, minimized, is_login);
parser.process(app);
return app.exec();
......
......@@ -21,7 +21,7 @@
#include "qtvkbdapp.h"
#include <QDebug>
//#include <QDebug>
#include <QDesktopWidget>
#include <QDomDocument>
#include <QFile>
......@@ -46,7 +46,7 @@ QList<VButton*> modKeys;
// TODO: Allow only one application instance
QtvkbdApp::QtvkbdApp(int &argc, char **argv, bool loginhelper) : QApplication(argc, argv), is_login(loginhelper)
QtvkbdApp::QtvkbdApp(int &argc, char **argv, bool minimized, bool loginhelper) : QApplication(argc, argv), is_login(loginhelper)
{
signalMapper = new QSignalMapper(this);
......@@ -168,12 +168,12 @@ QtvkbdApp::QtvkbdApp(int &argc, char **argv, bool loginhelper) : QApplication(ar
QDesktopWidget *pDesktop = QApplication::desktop();
QRect screenGeometry = pDesktop->availableGeometry(pDesktop->underMouse());
qDebug() << "ScreenGeometry: " << screenGeometry;
//qDebug() << "ScreenGeometry: " << screenGeometry;
QPoint bottomRight = screenGeometry.bottomRight()-QPoint(defaultSize.width(), defaultSize.height());
QRect widgetGeometry(bottomRight, defaultSize);
qDebug() << "widgetGeometry: " << widgetGeometry;
//qDebug() << "widgetGeometry: " << widgetGeometry;
QRect c_geometry = cfg.value("geometry", widgetGeometry).toRect();
if (!screenGeometry.contains(c_geometry, true)) {
......@@ -214,11 +214,11 @@ QtvkbdApp::QtvkbdApp(int &argc, char **argv, bool loginhelper) : QApplication(ar
xkbd->start();
if (!is_login) {
bool vis = cfg.value("visible", QVariant(true)).toBool();
if (!vis ) {
widget->showMinimized();
//bool vis = cfg.value("visible", QVariant(true)).toBool();
//if (!vis || minimized) {
if (minimized) {
widget->showMinimized();
widget->setVisible(false);
}
widget->setWindowTitle("qtvkbd");
tray->show();
......
......@@ -41,7 +41,7 @@ class QtvkbdApp : public QApplication
Q_OBJECT
public:
QtvkbdApp(int &argc, char **argv, bool loginhelper=false);
QtvkbdApp(int &argc, char **argv, bool minimized=false, bool loginhelper=false);
~QtvkbdApp();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment