Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Weixuan Xiao
kdeconnect-kde
Commits
800de883
Commit
800de883
authored
Jun 25, 2013
by
Albert Vaca Cintora
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
DBus communication working
parent
df12667f
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
98 additions
and
17 deletions
+98
-17
daemon/daemon.cpp
daemon/daemon.cpp
+7
-4
kcm/CMakeLists.txt
kcm/CMakeLists.txt
+1
-0
kcm/kcm.cpp
kcm/kcm.cpp
+9
-13
kcm/kcm.h
kcm/kcm.h
+2
-0
kcm/wizard.cpp
kcm/wizard.cpp
+40
-0
kcm/wizard.h
kcm/wizard.h
+39
-0
No files found.
daemon/daemon.cpp
View file @
800de883
...
...
@@ -24,6 +24,7 @@
#include "packagereceivers/pausemusicpackagereceiver.h"
#include "announcers/avahiannouncer.h"
#include "announcers/fakeannouncer.h"
#include "devicelinks/echodevicelink.h"
#include <QtNetwork/QUdpSocket>
#include <QFile>
...
...
@@ -38,7 +39,8 @@
K_PLUGIN_FACTORY
(
AndroidShineFactory
,
registerPlugin
<
Daemon
>
();)
K_EXPORT_PLUGIN
(
AndroidShineFactory
(
"androidshine"
,
"androidshine"
))
void
Daemon
::
linkTo
(
DeviceLink
*
dl
)
{
void
Daemon
::
linkTo
(
DeviceLink
*
dl
)
{
linkedDevices
.
append
(
dl
);
...
...
@@ -86,8 +88,6 @@ QString Daemon::listVisibleDevices()
ret
<<
std
::
setw
(
20
)
<<
"Name"
;
ret
<<
std
::
endl
;
emit
deviceAdded
(
"hola"
,
"hola"
);
Q_FOREACH
(
Device
*
d
,
visibleDevices
)
{
ret
<<
std
::
setw
(
20
)
<<
d
->
id
().
toStdString
();
ret
<<
std
::
setw
(
20
)
<<
d
->
name
().
toStdString
();
...
...
@@ -101,6 +101,7 @@ QString Daemon::listVisibleDevices()
bool
Daemon
::
pairDevice
(
QString
id
)
{
//TODO
linkedDevices
.
append
(
new
EchoDeviceLink
(
new
Device
(
id
,
"fake-to-the-max"
)));
return
true
;
}
...
...
@@ -109,7 +110,9 @@ QString Daemon::listLinkedDevices()
QString
ret
;
Q_FOREACH
(
DeviceLink
*
dl
,
linkedDevices
)
{
ret
+=
dl
->
device
()
->
name
()
+
"("
+
dl
->
device
()
->
id
()
+
")"
;
if
(
!
ret
.
isEmpty
())
ret
+=
"
\n
"
;
//ret += dl->device()->name() + "(" + dl->device()->id() + ")";
ret
+=
dl
->
device
()
->
id
();
}
return
ret
;
...
...
kcm/CMakeLists.txt
View file @
800de883
set
(
kcm_SRCS
kcm.cpp
wizard.cpp
)
qt4_add_dbus_interface
(
...
...
kcm/kcm.cpp
View file @
800de883
...
...
@@ -20,6 +20,7 @@
#include "kcm.h"
#include "ui_kcm.h"
#include "ui_wizard.h"
#include <QtGui/QLabel>
#include <QtGui/QMenu>
...
...
@@ -39,7 +40,8 @@ K_EXPORT_PLUGIN(KdeConnectKcmFactory("kdeconnect-kcm", "kdeconnect-kcm"))
KdeConnectKcm
::
KdeConnectKcm
(
QWidget
*
parent
,
const
QVariantList
&
)
:
KCModule
(
KdeConnectKcmFactory
::
componentData
(),
parent
)
,
dbusInterface
(
"org.kde.kded"
,
"/modules/androidshine"
,
QDBusConnection
::
sessionBus
(),
this
)
,
dbusInterface
(
"org.kde.kdeconnect"
,
"/modules/androidshine"
,
QDBusConnection
::
sessionBus
(),
this
)
,
wizard
(
this
)
{
m_ui
=
new
Ui
::
KdeConnectKcmUi
();
...
...
@@ -48,18 +50,11 @@ KdeConnectKcm::KdeConnectKcm(QWidget *parent, const QVariantList&)
m_model
=
new
QStandardItemModel
(
this
);
m_ui
->
deviceList
->
setIconSize
(
QSize
(
32
,
32
));
m_ui
->
deviceList
->
setModel
(
m_model
);
//m_ui->deviceList->setSelectionModel(m_selectionModel);
connect
(
&
dbusInterface
,
SIGNAL
(
deviceAdded
(
QString
,
QString
)),
this
,
SLOT
(
deviceAdded
(
QString
)));
connect
(
&
dbusInterface
,
SIGNAL
(
deviceRemoved
(
QString
,
QString
)),
this
,
SLOT
(
deviceRemoved
(
QString
)));
// dbusInterface.pairDevice("holalala");
//TODO: Listen to the objectManager signals objectAdded and objectRemoved, que el daemon exportara
//dbusInterface = new QDBusInterface("com.hal.wlan", "/com/hal/wlan/com/hal/wlan", "com.hal.wlan", QDBusConnection::SessionBus(), this);
//dbusInterface->connection().connect("com.hal.wlan", "/com/hal/wlan/com/hal/wlan", "com.hal.wlan", "status_changed", this, SLOT(deviceAdded())
//m_selectionModel = new QItemSelectionModel(m_model);
//connect(m_selectionModel, SIGNAL(currentChanged(QModelIndex,QModelIndex)), SLOT(currentChanged(QModelIndex,QModelIndex)));
//m_selectionModel->setCurrentIndex(m_model->index(0), QItemSelectionModel::SelectCurrent);
connect
(
&
dbusInterface
,
SIGNAL
(
deviceAdded
(
QString
,
QString
)),
this
,
SLOT
(
deviceAdded
(
QString
,
QString
)));
connect
(
&
dbusInterface
,
SIGNAL
(
deviceRemoved
(
QString
)),
this
,
SLOT
(
deviceRemoved
(
QString
)));
connect
(
m_ui
->
removeButton
,
SIGNAL
(
clicked
(
bool
)),
this
,
SLOT
(
removeButtonClicked
()));
connect
(
m_ui
->
addButton
,
SIGNAL
(
clicked
(
bool
)),
this
,
SLOT
(
addButtonClicked
()));
...
...
@@ -73,7 +68,7 @@ KdeConnectKcm::~KdeConnectKcm()
void
KdeConnectKcm
::
addButtonClicked
()
{
m_model
->
appendRow
(
new
QStandardItem
(
"lalal"
));
}
void
KdeConnectKcm
::
removeButtonClicked
()
...
...
@@ -88,7 +83,8 @@ void KdeConnectKcm::currentChanged(const QModelIndex& current, const QModelIndex
void
KdeConnectKcm
::
deviceAdded
(
QString
id
,
QString
name
)
//TODO: Rebre mes coses...
{
m_model
->
appendRow
(
new
QStandardItem
(
"hola"
));
//m_model->appendRow(new QStandardItem(id));
wizard
.
show
();
}
void
KdeConnectKcm
::
deviceRemoved
(
QString
id
)
...
...
kcm/kcm.h
View file @
800de883
...
...
@@ -26,6 +26,7 @@
#include <kcmodule.h>
#include "wizard.h"
#include "daemoninterface.h"
class
Create
;
...
...
@@ -59,6 +60,7 @@ private:
OrgKdeKdeconnectInterface
dbusInterface
;
Ui
::
KdeConnectKcmUi
*
m_ui
;
QStandardItemModel
*
m_model
;
AddDeviceWizard
wizard
;
};
...
...
kcm/wizard.cpp
0 → 100644
View file @
800de883
/*
* Copyright 2013 Albert Vaca <albertvaka@gmail.com>
*
* 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 2 of
* the License or (at your option) version 3 or any later version
* accepted by the membership of KDE e.V. (or its successor approved
* by the membership of KDE e.V.), which shall act as a proxy
* defined in Section 14 of version 3 of the license.
*
* 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 <http://www.gnu.org/licenses/>.
*/
#include "wizard.h"
#include <QDebug>
#include "ui_wizard.h"
AddDeviceWizard
::
AddDeviceWizard
(
QWidget
*
parent
)
:
QWizard
(
parent
)
{
qDebug
()
<<
"HA"
;
m_wizard
=
new
Ui
::
Wizard
();
m_wizard
->
setupUi
(
this
);
}
AddDeviceWizard
::~
AddDeviceWizard
()
{
delete
m_wizard
;
}
kcm/wizard.h
0 → 100644
View file @
800de883
/*
* Copyright 2013 Albert Vaca <albertvaka@gmail.com>
*
* 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 2 of
* the License or (at your option) version 3 or any later version
* accepted by the membership of KDE e.V. (or its successor approved
* by the membership of KDE e.V.), which shall act as a proxy
* defined in Section 14 of version 3 of the license.
*
* 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 <http://www.gnu.org/licenses/>.
*/
#ifndef WIZARD_H
#define WIZARD_H
#include <QWizard>
namespace
Ui
{
class
Wizard
;
}
class
AddDeviceWizard
:
public
QWizard
{
public:
AddDeviceWizard
(
QWidget
*
parent
);
~
AddDeviceWizard
();
private:
Ui
::
Wizard
*
m_wizard
;
};
#endif // WIZARD_H
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment