Skip to content

Instantly share code, notes, and snippets.

View mbairaq's full-sized avatar

Mohammed BAIRAQ mbairaq

View GitHub Profile
@KambizAsadzadeh
KambizAsadzadeh / data.json
Last active September 1, 2023 17:33
How to parse JSON inside C++ and QML
{
"model": [
{
"id": 1,
"name": "Kambiz",
"family": "Asadzadeh"
},
{
"id": 2,
"name": "Hamed",
@tniessen
tniessen / service.md
Created October 1, 2016 11:46
Using the "service" tool with ADB and why to avoid it

As it turns out, it is not trivial to control the audio volume of an Android device using ADB. At the time of writing, the only way appears to be using the service tool. Actually, the service command allows to "connect" to a number of services (104 on Android 6.0.1) and invoke functions. Not knowing much about this tool, I managed to completely mute all sounds and speakers of my Nexus 5, and I was stuck without any sound for quite some time. I did not find a way to unmute the sound from within the system UI, so I got to dive a little deeper into this.

If you know which service you want to use, you then need to find its interface declaration. The command

service list

gives you a list of all services with the associated interfaces, if applicable:

...

26 backup: [android.app.backup.IBackupManager]

@austriancoder
austriancoder / item.cpp
Created May 2, 2016 07:10
QMetaEnum: Serializing C++ Enums
const QString Item::type() const
{
const QMetaObject &mo = Item::staticMetaObject;
int index = mo.indexOfEnumerator("Type");
QMetaEnum metaEnum = mo.enumerator(index);
return metaEnum.valueToKey(m_type);
}
void Item::setType(const QString &type)
@vannell
vannell / downloader.cpp
Created June 29, 2014 16:12
Qt download test
#include "downloader.hpp"
#include <QNetworkRequest>
#include <QNetworkReply>
#include <QUrl>
#include <QVariant>
#include <QDebug>
Downloader::Downloader(QObject *parent) :
QObject(parent)
{
@ynonp
ynonp / main.cpp
Created December 27, 2013 15:14
QProcess output example
#include <QCoreApplication>
#include <QtCore/QtCore>
#include "monitor.h"
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
QProcess p;
p.start("/bin/ls");