From bd3bb4892fd610a705395d8378fb6ad1acb7f4ba Mon Sep 17 00:00:00 2001 From: trialuser02 Date: Mon, 17 Feb 2014 12:05:48 +0000 Subject: raise main window when starting another instance w/o params, added -- git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@4105 90c681e8-e032-0410-971d-27865f9a5e38 --- src/app/qmmpstarter.cpp | 31 +++++++++++++------------------ 1 file changed, 13 insertions(+), 18 deletions(-) (limited to 'src/app/qmmpstarter.cpp') diff --git a/src/app/qmmpstarter.cpp b/src/app/qmmpstarter.cpp index 7751d0262..4b463ab27 100644 --- a/src/app/qmmpstarter.cpp +++ b/src/app/qmmpstarter.cpp @@ -213,27 +213,22 @@ void QMMPStarter::savePosition() void QMMPStarter::writeCommand() { - if (!argString.isEmpty()) + QString workingDir = QDir::currentPath() + "\n"; + QByteArray barray; + barray.append(workingDir.toUtf8 ()); + barray.append(argString.isEmpty() ? "--show-mw" : argString.toUtf8 ()); + while(!barray.isEmpty()) { - QString workingDir = QDir::currentPath() + "\n"; - - QByteArray barray; - barray.append(workingDir.toUtf8 ()); - barray.append(argString.toUtf8 ()); - while(!barray.isEmpty()) - { - qint64 size = m_socket->write(barray); - barray.remove(0, size); - } - m_socket->flush(); - //reading answer - if(m_socket->waitForReadyRead(1500)) - cout << m_socket->readAll().data(); + qint64 size = m_socket->write(barray); + barray.remove(0, size); } - else - { + m_socket->flush(); + //reading answer + if(m_socket->waitForReadyRead(1500)) + cout << m_socket->readAll().data(); + + if (argString.isEmpty()) printUsage(); - } exit(0); } -- cgit v1.2.3-13-gbd6f