diff --git a/android/AndroidManifest.xml b/android/AndroidManifest.xml new file mode 100644 index 0000000..591be35 --- /dev/null +++ b/android/AndroidManifest.xml @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/android/res/drawable-hdpi/icon.png b/android/res/drawable-hdpi/icon.png new file mode 100644 index 0000000..63ae9c7 Binary files /dev/null and b/android/res/drawable-hdpi/icon.png differ diff --git a/android/res/drawable-ldpi/icon.png b/android/res/drawable-ldpi/icon.png new file mode 100644 index 0000000..d07fc2c Binary files /dev/null and b/android/res/drawable-ldpi/icon.png differ diff --git a/android/res/drawable-mdpi/icon.png b/android/res/drawable-mdpi/icon.png new file mode 100644 index 0000000..477e39c Binary files /dev/null and b/android/res/drawable-mdpi/icon.png differ diff --git a/android/res/drawable-xhdpi/icon.png b/android/res/drawable-xhdpi/icon.png new file mode 100644 index 0000000..0274faa Binary files /dev/null and b/android/res/drawable-xhdpi/icon.png differ diff --git a/android/res/drawable-xxhdpi/icon.png b/android/res/drawable-xxhdpi/icon.png new file mode 100644 index 0000000..99a3a8a Binary files /dev/null and b/android/res/drawable-xxhdpi/icon.png differ diff --git a/android/src/com/github/codestation/qcma/QcmaNotification.java b/android/src/com/github/codestation/qcma/QcmaNotification.java new file mode 100644 index 0000000..3286923 --- /dev/null +++ b/android/src/com/github/codestation/qcma/QcmaNotification.java @@ -0,0 +1,34 @@ +package com.github.codestation.qcma; + +import android.content.Context; +import android.content.DialogInterface; +import android.widget.Toast; +import android.app.AlertDialog; + +public class QcmaNotification extends org.qtproject.qt5.android.bindings.QtActivity +{ + private static QcmaNotification m_instance; + + public QcmaNotification() + { + m_instance = this; + } + + public static void showToast(String message) + { + Context context = m_instance.getApplicationContext(); + Toast toast = Toast.makeText(context, message, Toast.LENGTH_SHORT); + toast.show(); + } + + public static void showDialog(String message) + { + AlertDialog.Builder builder = new AlertDialog.Builder(m_instance); + builder.setPositiveButton("OK", new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int id) { + } + }); + builder.setMessage(message).setTitle("QCMA message"); + AlertDialog dialog = builder.create(); + } +} diff --git a/src/androidmessage.cpp b/src/androidmessage.cpp new file mode 100644 index 0000000..d0aa014 --- /dev/null +++ b/src/androidmessage.cpp @@ -0,0 +1,45 @@ +/* + * QCMA: Cross-platform content manager assistant for the PS Vita + * + * Copyright (C) 2013 Codestation + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "androidmessage.h" + +#include + +AndroidMessage::AndroidMessage(QObject *parent) : + QObject(parent) +{ +} + +void AndroidMessage::showToast(const QString &message) +{ + QAndroidJniObject javaMessage = QAndroidJniObject::fromString(message); + QAndroidJniObject::callStaticMethod("com/github/codestation/qcma/QcmaNotification", + "showToast", + "(Ljava/lang/String;)V", + javaMessage.object()); +} + +void AndroidMessage::showDialog(const QString &message) +{ + QAndroidJniObject javaMessage = QAndroidJniObject::fromString(message); + QAndroidJniObject::callStaticMethod("com/github/codestation/qcma/QcmaNotification", + "showDialog", + "(Ljava/lang/String;)V", + javaMessage.object()); +} diff --git a/src/androidmessage.h b/src/androidmessage.h new file mode 100644 index 0000000..86678e7 --- /dev/null +++ b/src/androidmessage.h @@ -0,0 +1,36 @@ +/* + * QCMA: Cross-platform content manager assistant for the PS Vita + * + * Copyright (C) 2013 Codestation + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef ANDROIDMESSAGE_H +#define ANDROIDMESSAGE_H + +#include + +class AndroidMessage : public QObject +{ + Q_OBJECT +public: + explicit AndroidMessage(QObject *parent = 0); + +public slots: + void showToast(const QString &message); + void showDialog(const QString &message); +}; + +#endif // ANDROIDMESSAGE_H diff --git a/src/cmautils.cpp b/src/cmautils.cpp index 0275180..1c31d18 100644 --- a/src/cmautils.cpp +++ b/src/cmautils.cpp @@ -28,7 +28,13 @@ #ifdef Q_OS_WIN32 #include #else +#ifndef __ANDROID__ #include +#else +#include +#define statvfs statfs +#define fstatvfs fstatfs +#endif #endif bool getDiskSpace(const QString &dir, quint64 *free, quint64 *total)