summaryrefslogtreecommitdiffstats
path: root/afb-client/bower_components/foundation-icon-fonts/svgs/fi-comments.svg
blob: 737e427e44e0b7a39cce61e55373d4e017461b6a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 17.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0)  -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
	 width="100px" height="100px" viewBox="0 0 100 100" enable-background="new 0 0 100 100" xml:space="preserve">
<g>
	<path d="M94.974,17.838c-0.127-1.257-1.16-2.241-2.443-2.277v-0.007H39.624c-1.315,0-2.384,1.004-2.513,2.284h-0.026v13.139h22.342
		c1.174,0,2.127,0.896,2.243,2.039h0.023v29.232h11.009l6.488,6.487c0.456,0.677,1.229,1.122,2.106,1.122
		c1.402,0,2.538-1.136,2.538-2.537v-5.072h8.698V62.24c1.197-0.033,2.188-0.889,2.417-2.027H95V17.838H94.974z"/>
	<path d="M54.44,35.964H7.204v0.006c-1.144,0.031-2.067,0.91-2.181,2.033H5v37.835h0.046c0.205,1.015,1.09,1.779,2.158,1.809v0.006
		h7.765v4.529c0,1.25,1.015,2.265,2.266,2.265c0.783,0,1.474-0.398,1.88-1.002l5.792-5.792H54.44c1.096,0,2.011-0.78,2.22-1.815
		h0.045V38.003h-0.023C56.568,36.859,55.614,35.964,54.44,35.964z"/>
</g>
</svg>
round-color: #fff0f0 } /* Literal.String */ .highlight .na { color: #336699 } /* Name.Attribute */ .highlight .nb { color: #003388 } /* Name.Builtin */ .highlight .nc { color: #bb0066; font-weight: bold } /* Name.Class */ .highlight .no { color: #003366; font-weight: bold } /* Name.Constant */ .highlight .nd { color: #555555 } /* Name.Decorator */ .highlight .ne { color: #bb0066; font-weight: bold } /* Name.Exception */ .highlight .nf { color: #0066bb; font-weight: bold } /* Name.Function */ .highlight .nl { color: #336699; font-style: italic } /* Name.Label */ .highlight .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */ .highlight .py { color: #336699; font-weight: bold } /* Name.Property */ .highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */ .highlight .nv { color: #336699 } /* Name.Variable */ .highlight .ow { color: #008800 } /* Operator.Word */ .highlight .w { color: #bbbbbb } /* Text.Whitespace */ .highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */ .highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */ .highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */ .highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ .highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ .highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */ .highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ .highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ .highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */ }
/*
 * Copyright (C) 2017 Konsulko Group
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#include "mastervolume.h"
#include <QJsonObject>
#include <QTimer>
#include <QtDebug>

#define MASTER_CONTROL "Master Playback"

MasterVolume::MasterVolume(QObject* parent)
	: QObject(parent)
	, m_volume{50}
{
	connect(&m_client, SIGNAL(connected()), this, SLOT(onClientConnected()));
	connect(&m_client, SIGNAL(disconnected()), this, SLOT(onClientDisconnected()));
	connect(&m_client, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(onClientError(QAbstractSocket::SocketError)));
	connect(&m_client, SIGNAL(eventReceived(QString, const QJsonValue&)), this, SLOT(onClientEventReceived(QString, const QJsonValue&)));
}

void MasterVolume::open(const QUrl& url)
{
	m_url = url;
	TryOpen();
}

qint32 MasterVolume::getVolume() const
{
	return m_volume;
}

void MasterVolume::setVolume(qint32 volume)
{
	if (m_volume != volume)
	{
		m_volume = volume;
		QJsonObject arg;
		arg.insert("control", MASTER_CONTROL);
		double v = (double) volume / 100.0;
		arg.insert("value", v);
		m_client.call("audiomixer", "volume", arg);
	}
}

void MasterVolume::onClientConnected()
{
	QJsonObject arg;
	arg.insert("control", MASTER_CONTROL);
	m_client.call("audiomixer", "volume", arg, [this](bool r, const QJsonValue& v) {
		if (r && v.isObject()) {
			int volume = v.toObject()["response"].toObject()["volume"].toDouble() * 100;
			volume = qBound(0, volume, 100);
			if (m_volume != volume)
			{
				m_volume = volume;
				emit VolumeChanged();
			}
		}

		QJsonObject arg;
		arg.insert("event", "volume_changed");
		m_client.call("audiomixer", "subscribe", arg);
	});
}

void MasterVolume::onClientDisconnected()
{
	qDebug() << "MasterVolume::onClientDisconnected!";
	QTimer::singleShot(1000, this, SLOT(TryOpen()));
}

void MasterVolume::onClientError(QAbstractSocket::SocketError se)
{
	qDebug() << "MasterVolume::onClientError: " << se;
}

void MasterVolume::onClientEventReceived(QString name, const QJsonValue& data)
{
	qDebug() << "MasterVolume::onClientEventReceived[" << name << "]: " << data;
	if (name == "audiomixer/volume_changed")
	{
		QString ctlName = data.toObject()["control"].toString();

		if (ctlName != MASTER_CONTROL)
			return;

		int volume = data.toObject()["value"].toDouble() * 100;
		volume = qBound(0, volume, 100);
		if (m_volume != volume)
		{
			m_volume = volume;
			emit VolumeChanged();
		}
	}
}

void MasterVolume::TryOpen()
{
	m_client.open(m_url);
}