Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
Jujuyeh authored Aug 10, 2017
1 parent ef776c9 commit 5139a7e
Show file tree
Hide file tree
Showing 37 changed files with 5,948 additions and 0 deletions.
80 changes: 80 additions & 0 deletions webapp-creator/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
project(webapp-creator C CXX)
cmake_minimum_required(VERSION 2.8.9)

# Do not remove this line, its required for the correct functionality of the Ubuntu-SDK
set(UBUNTU_MANIFEST_PATH "manifest.json.in" CACHE INTERNAL "Tells QtCreator location and name of the manifest file")
set (CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")

find_package(Qt5Core)
find_package(Qt5Qml)
find_package(Qt5Quick)
# find_package(ubuntu-sdk-libs)

# Automatically create moc files
set(CMAKE_AUTOMOC ON)

# Components PATH
execute_process(
COMMAND dpkg-architecture -qDEB_HOST_MULTIARCH
OUTPUT_VARIABLE ARCH_TRIPLET
OUTPUT_STRIP_TRAILING_WHITESPACE
)

set(QT_IMPORTS_DIR "lib/${ARCH_TRIPLET}")

option(INSTALL_TESTS "Install the tests on make install" on)

set(APP_NAME webapp-creator)
set(APP_ID "webapp-creator.jujuyeh")
set(WEBAPP-CREATOR_DIR "share/qml/webapp-creator")
set(MAIN_QML "Main.qml")
set(ICON "graphics/webapp-creator.svg")

# Set install paths
set(CMAKE_INSTALL_PREFIX /)
set(DATA_DIR /)
set(DESKTOP_DIR ${DATA_DIR})
set(DESKTOP_FILE_NAME "webapp-creator.desktop")

set(EXEC "qmlscene %U ${WEBAPP-CREATOR_DIR}/${MAIN_QML}")

# This command figures out the target architecture for use in the manifest file
execute_process(
COMMAND dpkg-architecture -qDEB_HOST_ARCH
OUTPUT_VARIABLE CLICK_ARCH
OUTPUT_STRIP_TRAILING_WHITESPACE
)

configure_file(manifest.json.in ${CMAKE_CURRENT_BINARY_DIR}/manifest.json)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/manifest.json
DESTINATION ${CMAKE_INSTALL_PREFIX})

install(DIRECTORY "app/graphics" DESTINATION ${DATA_DIR})
install(DIRECTORY "app/extras" DESTINATION ${DATA_DIR})
install(FILES "webapp-creator.apparmor" DESTINATION ${DATA_DIR})
install(FILES "wac-contenthub.json" DESTINATION ${DATA_DIR})
install(FILES "app/placeholder-app-icon.svg" DESTINATION ${WEBAPP-CREATOR_DIR})
install(FILES "app/graphics/ci.svg" DESTINATION ${WEBAPP-CREATOR_DIR})
install(FILES "app/graphics/ju.svg" DESTINATION ${WEBAPP-CREATOR_DIR})

add_subdirectory(app)
add_subdirectory(backend)
add_subdirectory(po)

add_custom_target("autopilot" chmod +x ${CMAKE_SOURCE_DIR}/app/tests/autopilot/run
COMMAND ${CMAKE_SOURCE_DIR}/app/tests/autopilot/run
DEPENDS Webapp_Creatorbackend Webapp_Creatorbackend-qmldir
WORKING_DIRECTORY ./app)

add_custom_target("check"
COMMAND /usr/bin/qmltestrunner -input ${CMAKE_SOURCE_DIR}/backend/tests/unit -import ${CMAKE_BINARY_DIR}/backend
COMMAND /usr/bin/qmltestrunner -input ${CMAKE_SOURCE_DIR}/app/tests/unit -import ${CMAKE_BINARY_DIR}/backend
DEPENDS Webapp_Creatorbackend Webapp_Creatorbackend-qmldir
WORKING_DIRECTORY ./app)

add_custom_target("run" /usr/bin/qmlscene -I ${CMAKE_BINARY_DIR}/backend ${CMAKE_SOURCE_DIR}/app/Main.qml
DEPENDS Webapp_Creatorbackend Webapp_Creatorbackend-qmldir
WORKING_DIRECTORY ./app)

# No op custom target for all not compiled files, so they show up in the QtCreator project tree
add_custom_target("webapp-creator_ClickFiles" ALL SOURCES "webapp-creator.apparmor" "manifest.json.in")
786 changes: 786 additions & 0 deletions webapp-creator/CMakeLists.txt.user

Large diffs are not rendered by default.

18 changes: 18 additions & 0 deletions webapp-creator/app/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
file(GLOB QML_JS_FILES *.qml *.js)

# Make the files visible on qtcreator
add_custom_target(webapp-creator_QMlFiles ALL SOURCES ${QML_JS_FILES})

# Substitute variables in the desktop file
configure_file(${DESKTOP_FILE_NAME}.in ${CMAKE_CURRENT_BINARY_DIR}/${DESKTOP_FILE_NAME}.in)

install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${DESKTOP_FILE_NAME} DESTINATION ${DESKTOP_DIR})
install(FILES ${QML_JS_FILES} DESTINATION ${WEBAPP-CREATOR_DIR})

# Make the autpilot files visible in qtcreator
file(GLOB_RECURSE AUTOPILOT_TEST_FILES *.py)
add_custom_target(webapp-creator_AutopilotFiles ALL SOURCES ${AUTOPILOT_TEST_FILES})

# Make the unit test files visible in qtcreator
file(GLOB_RECURSE UNIT_TEST_FILES tests/unit/*.qml)
add_custom_target(webapp-creator_UnitTestFiles ALL SOURCES ${UNIT_TEST_FILES})
78 changes: 78 additions & 0 deletions webapp-creator/app/ImportPage.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
/*
* Copyright (C) 2016 Stefano Verzegnassi
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License 3 as published by
* the Free Software Foundation.
*
* 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.4
import Ubuntu.Components 1.3
import Ubuntu.Content 1.3



Page {
id: picker
property var activeTransfer

property var url
property var handler
property var contentType

signal cancel()
signal imported(string fileUrl)

header: PageHeader {
title: i18n.tr("Choose")
}

ContentPeerPicker {
anchors { fill: parent; topMargin: picker.header.height }
visible: parent.visible
showTitle: false
contentType: picker.contentType //ContentType.Pictures
handler: picker.handler //ContentHandler.Source

onPeerSelected: {
peer.selectionType = ContentTransfer.Single
picker.activeTransfer = peer.request()
picker.activeTransfer.stateChanged.connect(function() {
if (picker.activeTransfer.state === ContentTransfer.InProgress) {
console.log("In progress");
picker.activeTransfer.items = picker.activeTransfer.items[0].url = url;
picker.activeTransfer.state = ContentTransfer.Charged;
}
if (picker.activeTransfer.state === ContentTransfer.Charged) {
console.log("Charged");
picker.imported(picker.activeTransfer.items[0].url)
console.log(picker.activeTransfer.items[0].url)
picker.activeTransfer = null
}
})
}


onCancelPressed: {
pageStack.pop()
}
}

ContentTransferHint {
id: transferHint
anchors.fill: parent
activeTransfer: picker.activeTransfer
}
Component {
id: resultComponent
ContentItem {}
}
}
Loading

0 comments on commit 5139a7e

Please sign in to comment.