Reply
Thread Tools
Posts: 34 | Thanked: 12 times | Joined on Sep 2009 @ Portugal, Porto
#1
I want to run an aplication using the information i got in aplication.desktop file. Per example for circus game i got the following information:

Name: "Circus"
Exec: "/usr/bin/single-instance /usr/bin/incrediblecircus"
Icon: "incrediblecircus"

How i use the QProcess to run /usr/bin/single-instance /usr/bin/incrediblecircus ?! Thanks

EDITED: It worked my bad :| but per example with maps it doesn't work:

Code:
 QProcess p;
    //p.start("/usr/bin/single-instance /usr/bin/incrediblecircus");
    p.start("/usr/bin/invoker --type=e /usr/bin/maps -u %U");
    p.waitForFinished(-1);
    QString output = p.readAllStandardOutput();
    qDebug() << output;
    qDebug() << "e:" + p.readAllStandardError();
The error:
""
"e:1324345036614 QEventLoop: Cannot be used without QApplication
1324345036636 QDBusConnection: system D-Bus connection created before QCoreApplication. Application may misbehave.
1324345036661 "[ERROR] Unsupported uri at void AppState::setGeoParamsUri(const QString&)"
1324345036705 Using the meego graphics system
1324345036812 MApplicationService: registerService() registering failed
"
QProcess: Destroyed while process is still running.
 
marxian's Avatar
Posts: 2,448 | Thanked: 9,523 times | Joined on Aug 2010 @ Wigan, UK
#2
Originally Posted by metRo_ View Post
I want to run an aplication using the information i got in aplication.desktop file. Per example for circus game i got the following information:

Name: "Circus"
Exec: "/usr/bin/single-instance /usr/bin/incrediblecircus"
Icon: "incrediblecircus"

How i use the QProcess to run /usr/bin/single-instance /usr/bin/incrediblecircus ?! Thanks

EDITED: It worked my bad :| but per example with maps it doesn't work:

Code:
 QProcess p;
    //p.start("/usr/bin/single-instance /usr/bin/incrediblecircus");
    p.start("/usr/bin/invoker --type=e /usr/bin/maps -u %U");
    p.waitForFinished(-1);
    QString output = p.readAllStandardOutput();
    qDebug() << output;
    qDebug() << "e:" + p.readAllStandardError();
The error:
The problem is that you are including the arguments in the program name. In the desktop file, the %U refers to a URI that is passed to the program when it is launched. If you want to launch Maps without any arguments, you should use

Code:
p.start("/usr/bin/invoker --type=e /usr/bin/maps");
If you want to pass an argument, you should use

Code:
QStringList args;
args << "-u" << your_argument;
p.start("/usr/bin/invoker --type=e /usr/bin/maps", args);
__________________
'Men of high position are allowed, by a special act of grace, to accomodate their reasoning to the answer they need. Logic is only required in those of lesser rank.' - J K Galbraith

My website

GitHub
 
Posts: 34 | Thanked: 12 times | Joined on Sep 2009 @ Portugal, Porto
#3
Originally Posted by marxian View Post
The problem is that you are including the arguments in the program name. In the desktop file, the %U refers to a URI that is passed to the program when it is launched. If you want to launch Maps without any arguments, you should use

Code:
p.start("/usr/bin/invoker --type=e /usr/bin/maps");
If you want to pass an argument, you should use

Code:
QStringList args;
args << "-u" << your_argument;
p.start("/usr/bin/invoker --type=e /usr/bin/maps", args);
Thanks

I knew that i need to pass the arguments as a argument of the function start but my problem is that i don't know what to do with "/usr/bin/invoker --type=e"

thanks again
 
Posts: 34 | Thanked: 12 times | Joined on Sep 2009 @ Portugal, Porto
#4
I can't run notes app per example :s

QStringList args;
args << "-showWindow" << "%U";
p->start("/usr/bin/invoker --wait-term --delay=10 --type=m /usr/bin/notes", args);

and still doesn't work if not include the arguments :s

Can you help me?
 
Reply


 
Forum Jump


All times are GMT. The time now is 10:46.