Experimental frontend
This commit is contained in:
parent
7c2e2fb726
commit
de9671e26a
6 changed files with 244 additions and 0 deletions
|
@ -40,6 +40,10 @@ add_subdirectory(kio)
|
|||
add_subdirectory(icon)
|
||||
add_subdirectory(interfaces)
|
||||
|
||||
option(EXPERIMENTALAPP_ENABLED OFF)
|
||||
if(EXPERIMENTALAPP_ENABLED)
|
||||
add_subdirectory(app)
|
||||
endif()
|
||||
add_subdirectory(daemon)
|
||||
add_subdirectory(plugins)
|
||||
add_subdirectory(plasmoid)
|
||||
|
|
9
app/CMakeLists.txt
Normal file
9
app/CMakeLists.txt
Normal file
|
@ -0,0 +1,9 @@
|
|||
find_package(KF5 COMPONENTS Declarative)
|
||||
|
||||
qt5_add_resources(kcapp_SRCS resources.qrc)
|
||||
|
||||
add_executable(kcapp main.cpp ${kcapp_SRCS})
|
||||
target_link_libraries(kcapp Qt5::Quick Qt5::Widgets KF5::Declarative KF5::CoreAddons KF5::I18n)
|
||||
|
||||
install(TARGETS kcapp ${INSTALL_TARGETS_DEFAULT_ARGS})
|
||||
# install(PROGRAMS kcapp.desktop DESTINATION ${XDG_APPS_INSTALL_DIR} )
|
49
app/main.cpp
Normal file
49
app/main.cpp
Normal file
|
@ -0,0 +1,49 @@
|
|||
/*
|
||||
* Copyright (C) 2014 Aleix Pol Gonzalez <aleixpol@blue-systems.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include <QApplication>
|
||||
#include <QQmlApplicationEngine>
|
||||
#include <QCommandLineParser>
|
||||
#include <KDeclarative/KDeclarative>
|
||||
#include <KAboutData>
|
||||
#include <KLocalizedString>
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QApplication app(argc, argv);
|
||||
KAboutData aboutData("kdeconnect-kde", i18n("Awesome App"), "1.0", i18n("KDE Connect App"), KAboutLicense::GPL, i18n("(c) 2015, Aleix Pol Gonzalez"));
|
||||
aboutData.addAuthor(i18n("Aleix Pol Gonzalez"), i18n("Maintainer"), "aleixpol@kde.org");
|
||||
KAboutData::setApplicationData(aboutData);
|
||||
|
||||
{
|
||||
QCommandLineParser parser;
|
||||
aboutData.setupCommandLine(&parser);
|
||||
parser.addVersionOption();
|
||||
parser.addHelpOption();
|
||||
parser.process(app);
|
||||
aboutData.processCommandLine(&parser);
|
||||
}
|
||||
|
||||
QQmlApplicationEngine engine(QUrl("qrc:/qml/main.qml"));
|
||||
|
||||
KDeclarative::KDeclarative kdeclarative;
|
||||
kdeclarative.setDeclarativeEngine(&engine);
|
||||
kdeclarative.setupBindings();
|
||||
|
||||
return app.exec();
|
||||
}
|
55
app/qml/DeviceDelegate.qml
Normal file
55
app/qml/DeviceDelegate.qml
Normal file
|
@ -0,0 +1,55 @@
|
|||
/*
|
||||
* Copyright 2015 Aleix Pol Gonzalez <aleixpol@kde.org>
|
||||
*
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
import QtQuick 2.2
|
||||
import QtQuick.Controls 1.2
|
||||
import QtQuick.Layouts 1.2
|
||||
import org.kde.kquickcontrolsaddons 2.0
|
||||
import org.kde.kdeconnect 1.0
|
||||
|
||||
Item
|
||||
{
|
||||
height: info.height
|
||||
signal clicked
|
||||
QIconItem {
|
||||
id: icon
|
||||
width: 40
|
||||
height: 40
|
||||
icon: iconName
|
||||
}
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onClicked: parent.clicked()
|
||||
}
|
||||
ColumnLayout {
|
||||
id: info
|
||||
anchors {
|
||||
left: icon.right
|
||||
top: parent.top
|
||||
right: parent.right
|
||||
}
|
||||
property bool expand: false
|
||||
Label {
|
||||
Layout.fillWidth: true
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
text: display + "\n" + toolTip
|
||||
}
|
||||
}
|
||||
}
|
121
app/qml/main.qml
Normal file
121
app/qml/main.qml
Normal file
|
@ -0,0 +1,121 @@
|
|||
/*
|
||||
* Copyright 2015 Aleix Pol Gonzalez <aleixpol@kde.org>
|
||||
*
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
import QtQuick 2.2
|
||||
import QtQuick.Controls 1.1
|
||||
import QtQuick.Layouts 1.1
|
||||
import org.kde.kdeconnect 1.0
|
||||
|
||||
ApplicationWindow
|
||||
{
|
||||
id: root
|
||||
visible: true
|
||||
width: 400
|
||||
height: 500
|
||||
|
||||
StackView {
|
||||
id: stack
|
||||
anchors {
|
||||
fill: parent
|
||||
margins: 5
|
||||
}
|
||||
initialItem: ScrollView {
|
||||
Layout.fillHeight: true
|
||||
ListView {
|
||||
id: devicesView
|
||||
spacing: 5
|
||||
model: DevicesSortProxyModel {
|
||||
sourceModel: DevicesModel {
|
||||
id: connectDeviceModel
|
||||
displayFilter: DevicesModel.StatusReachable
|
||||
}
|
||||
}
|
||||
delegate: DeviceDelegate {
|
||||
width: parent.width
|
||||
onClicked: {
|
||||
var data = {
|
||||
item: deviceViewComponent,
|
||||
properties: {currentDevice: device}
|
||||
};
|
||||
stack.push(data);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Component {
|
||||
id: deviceViewComponent
|
||||
ColumnLayout {
|
||||
id: deviceView
|
||||
property QtObject currentDevice
|
||||
Button {
|
||||
text: "<"
|
||||
onClicked: stack.pop()
|
||||
}
|
||||
Loader {
|
||||
Layout.fillHeight: true
|
||||
Layout.fillWidth: true
|
||||
|
||||
sourceComponent: currentDevice.isPaired ? trustedDevice : untrustedDevice
|
||||
Component {
|
||||
id: trustedDevice
|
||||
ColumnLayout {
|
||||
id: trustedView
|
||||
Layout.fillHeight: true
|
||||
Layout.fillWidth: true
|
||||
|
||||
Button {
|
||||
text: i18n("Un-Pair")
|
||||
onClicked: deviceView.currentDevice.unpair()
|
||||
}
|
||||
Button {
|
||||
text: i18n("Send Ping")
|
||||
onClicked: deviceView.currentDevice.pluginCall("ping", "sendPing");
|
||||
}
|
||||
Button {
|
||||
text: i18n("Open Multimedia Remote Control")
|
||||
enabled: false
|
||||
}
|
||||
Button {
|
||||
text: i18n("Remote touch and keyboard")
|
||||
enabled: false
|
||||
}
|
||||
|
||||
Item { Layout.fillHeight: true }
|
||||
}
|
||||
}
|
||||
Component {
|
||||
id: untrustedDevice
|
||||
ColumnLayout {
|
||||
id: untrustedView
|
||||
Layout.fillHeight: true
|
||||
Layout.fillWidth: true
|
||||
|
||||
Button {
|
||||
text: i18n("Pair")
|
||||
onClicked: deviceView.currentDevice.requestPair()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
6
app/resources.qrc
Normal file
6
app/resources.qrc
Normal file
|
@ -0,0 +1,6 @@
|
|||
<!DOCTYPE RCC><RCC version="1.0">
|
||||
<qresource>
|
||||
<file>qml/main.qml</file>
|
||||
<file>qml/DeviceDelegate.qml</file>
|
||||
</qresource>
|
||||
</RCC>
|
Loading…
Reference in a new issue