2
* Copyright (C) 2013 Canonical, Ltd.
4
* This program is free software: you can redistribute it and/or modify it
5
* under the terms of the GNU General Public License version 3, as published
6
* by the Free Software Foundation.
8
* This program is distributed in the hope that it will be useful, but
9
* WITHOUT ANY WARRANTY; without even the implied warranties of
10
* MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
11
* PURPOSE. See the GNU General Public License for more details.
13
* You should have received a copy of the GNU General Public License along
14
* with this program. If not, see <http://www.gnu.org/licenses/>.
16
* Author: Pete Woods <pete.woods@canonical.com>
19
#include <common/NameObject.h>
21
#include <QDBusMetaType>
23
using namespace hud::common;
25
QDBusArgument & operator<<(QDBusArgument &argument,
26
const NameObject &nameObject) {
27
argument.beginStructure();
28
argument << nameObject.m_name << nameObject.m_object;
29
argument.endStructure();
33
const QDBusArgument & operator>>(const QDBusArgument &argument,
34
NameObject &nameObject) {
35
argument.beginStructure();
36
argument >> nameObject.m_name >> nameObject.m_object;
37
argument.endStructure();
44
NameObject::NameObject() {
47
NameObject::NameObject(const QString &name, const QDBusObjectPath &object) :
48
m_name(name), m_object(object) {
51
NameObject::NameObject(const NameObject &other) :
52
m_name(other.m_name), m_object(other.m_object) {
55
NameObject & NameObject::operator=(const NameObject &other) {
56
m_name = other.m_name;
57
m_object = other.m_object;
61
bool NameObject::operator==(const NameObject &other) const {
62
return m_name == other.m_name && m_object == other.m_object;
65
NameObject::~NameObject() {
68
void NameObject::registerMetaTypes() {
69
qRegisterMetaType<NameObject>();
70
qDBusRegisterMetaType<NameObject>();
72
qRegisterMetaType<QList<NameObject>>();
73
qDBusRegisterMetaType<QList<NameObject>>();