diff --git a/CMakeLists.txt b/CMakeLists.txt index 05b00e4fc..df7dd500f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) diff --git a/app/CMakeLists.txt b/app/CMakeLists.txt new file mode 100644 index 000000000..e1c45d838 --- /dev/null +++ b/app/CMakeLists.txt @@ -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} ) diff --git a/app/main.cpp b/app/main.cpp new file mode 100644 index 000000000..b23bf7055 --- /dev/null +++ b/app/main.cpp @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2014 Aleix Pol Gonzalez + * + * 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 +#include +#include +#include +#include +#include + +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(); +} diff --git a/app/qml/DeviceDelegate.qml b/app/qml/DeviceDelegate.qml new file mode 100644 index 000000000..9cf862fef --- /dev/null +++ b/app/qml/DeviceDelegate.qml @@ -0,0 +1,55 @@ +/* + * Copyright 2015 Aleix Pol Gonzalez + * + * 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 . + */ + +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 + } + } +} diff --git a/app/qml/main.qml b/app/qml/main.qml new file mode 100644 index 000000000..43a0d6db1 --- /dev/null +++ b/app/qml/main.qml @@ -0,0 +1,121 @@ +/* + * Copyright 2015 Aleix Pol Gonzalez + * + * 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 . + */ + +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() + } + } + } + } + } + } +} diff --git a/app/resources.qrc b/app/resources.qrc new file mode 100644 index 000000000..0e02918db --- /dev/null +++ b/app/resources.qrc @@ -0,0 +1,6 @@ + + + qml/main.qml + qml/DeviceDelegate.qml + +