summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRainer Keller <rainer.keller@theqtcompany.com>2015-06-03 10:55:29 +0200
committerRainer Keller <rainer.keller@theqtcompany.com>2015-08-18 07:18:13 +0000
commit6b5ef93020d471fe21152e2428e2f0c5bc7dc24d (patch)
tree0c9afae9cf7f717f8cf830f69cb1181bafa2a99f
parent26b255dd1a53a8f276c0e33bda896945600b404d (diff)
Remove Android code
Change-Id: I8a69405655483c6bbd9f402df4a06a1020b6bebe Reviewed-by: aavit <eirik.aavitsland@theqtcompany.com>
-rw-r--r--main.cpp9
-rw-r--r--process.cpp74
-rw-r--r--process.h9
3 files changed, 2 insertions, 90 deletions
diff --git a/main.cpp b/main.cpp
index 17862ad..a1188f0 100644
--- a/main.cpp
+++ b/main.cpp
@@ -38,11 +38,7 @@
#define PID_FILE "/data/user/.appcontroller"
#define FEATURES "restart perf eglresize qmldebugservices"
-#ifdef Q_OS_ANDROID
- #define B2QT_PREFIX "/data/user/b2qt"
-#else
- #define B2QT_PREFIX "/usr/bin/b2qt"
-#endif
+#define B2QT_PREFIX "/usr/bin/b2qt"
static int serverSocket = -1;
@@ -66,7 +62,6 @@ static void usage()
"--show-platform Show platform information\n"
"--make-default Make this application the default on boot\n"
"--remove-default Restore the default application\n"
- "--print-debug Print debug messages to stdout on Android\n"
"--version Print version information\n"
"--detach Start application as usual, then go into background\n"
"--restart Restart the current running application or an\n"
@@ -386,8 +381,6 @@ int main(int argc, char **argv)
return 0;
else
return 1;
- } else if (arg == "--print-debug") {
- config.flags |= Config::PrintDebugMessages;
} else if (arg == "--version") {
printf("Appcontroller version: " GIT_VERSION "\nGit revision: " GIT_HASH "\nFeatures: " FEATURES "\n");
return 0;
diff --git a/process.cpp b/process.cpp
index d3d8fdb..2ee9246 100644
--- a/process.cpp
+++ b/process.cpp
@@ -144,12 +144,8 @@ void Process::forwardProcessOutput(qintptr fd, const QByteArray &data)
size -= written;
constData += written;
}
-
- if (mConfig.flags.testFlag(Config::PrintDebugMessages))
- qDebug() << data;
}
-
void Process::readyReadStandardOutput()
{
forwardProcessOutput(mStdoutFd, mProcess->readAllStandardOutput());
@@ -214,11 +210,7 @@ void Process::finished(int exitCode, QProcess::ExitStatus exitStatus)
void Process::startup()
{
-#ifdef Q_OS_ANDROID
- QProcessEnvironment pe = interactiveProcessEnvironment();
-#else
QProcessEnvironment pe = QProcessEnvironment::systemEnvironment();
-#endif
QStringList args = mStartupArguments;
mBeingRestarted = false;
@@ -341,69 +333,3 @@ void Process::setStdoutFd(qintptr stdoutFd)
{
mStdoutFd = stdoutFd;
}
-
-QProcessEnvironment Process::interactiveProcessEnvironment() const
-{
- QProcessEnvironment env;
-
- QProcess process;
- process.start("sh");
- if (!process.waitForStarted(3000)) {
- printf("Could not start shell.\n");
- return env;
- }
-
- process.write("source /system/etc/mkshrc\n");
- process.write("export -p\n");
- process.closeWriteChannel();
-
- printf("waiting for process to finish\n");
- if (!process.waitForFinished(1000)) {
- printf("did not finish: terminate\n");
- process.terminate();
- if (!process.waitForFinished(1000)) {
- printf("did not terminate: kill\n");
- process.kill();
- if (!process.waitForFinished(1000)) {
- printf("Could not stop process.\n");
- }
- }
- }
-
- QList<QByteArray> list = process.readAllStandardOutput().split('\n');
- if (list.isEmpty())
- printf("Failed to read environment output\n");
-
- foreach (QByteArray entry, list) {
- if (entry.startsWith("export ")) {
- entry = entry.mid(7);
- } else if (entry.startsWith("declare -x ")) {
- entry = entry.mid(11);
- } else {
- continue;
- }
-
- QByteArray key;
- QByteArray value;
- int index = entry.indexOf('=');
-
- if (index > 0) {
- key = entry.left(index);
- value = entry.mid(index + 1);
- } else {
- key = entry;
- // value is empty
- }
-
- // Remove simple escaping.
- // This is not complete.
- if (value.startsWith('\'') and value.endsWith('\''))
- value = value.mid(1, value.size()-2);
- else if (value.startsWith('"') and value.endsWith('"'))
- value = value.mid(1, value.size()-2);
-
- env.insert(key, value);
- }
-
- return env;
-}
diff --git a/process.h b/process.h
index 10fc13b..46bea62 100644
--- a/process.h
+++ b/process.h
@@ -27,23 +27,17 @@
class QSocketNotifier;
struct Config {
- enum Flag {
- PrintDebugMessages = 0x01
- };
- Q_DECLARE_FLAGS(Flags, Flag)
-
enum DebugInterface{
LocalDebugInterface,
PublicDebugInterface
};
- Config() : platform("unknown"), flags(0), debugInterface(LocalDebugInterface) { }
+ Config() : platform("unknown"), debugInterface(LocalDebugInterface) { }
QString base;
QString platform;
QMap<QString,QString> env;
QStringList args;
- Flags flags;
DebugInterface debugInterface;
};
@@ -71,7 +65,6 @@ private slots:
private:
void forwardProcessOutput(qintptr fd, const QByteArray &data);
void startup();
- QProcessEnvironment interactiveProcessEnvironment() const;
QProcess *mProcess;
int mDebuggee;
bool mDebug;