Commit f1855092 authored by Jonah Brüchert's avatar Jonah Brüchert 🌳

Rebase on app template

parent 85f45993
project(plasma-angelfish)
project(angelfish)
cmake_minimum_required(VERSION 2.8.12)
set(KF5_MIN_VERSION "5.18.0")
set(QT_MIN_VERSION "5.5.0")
################# Disallow in-source build #################
if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
message(FATAL_ERROR "angelfish requires an out of source build. Please create a separate build directory and run 'cmake path_to_plasma-mobile [options]' there.")
message(FATAL_ERROR "This application requires an out of source build. Please create a separate build directory.")
endif()
include(CPack)
include(FeatureSummary)
find_package(PkgConfig)
################# set KDE specific information #################
......@@ -19,11 +19,17 @@ find_package(ECM 0.0.8 REQUIRED NO_MODULE)
# where to look first for cmake modules, before ${CMAKE_ROOT}/Modules/ is checked
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR})
include(ECMSetupVersion)
include(ECMGenerateHeaders)
include(KDEInstallDirs)
include(KDECMakeSettings)
include(KDECompilerSettings)
include(ECMPoQmTools)
include(KDECompilerSettings NO_POLICY_SCOPE)
find_package(Qt5 REQUIRED NO_MODULE COMPONENTS Core Quick Test Gui)
################# Find dependencies #################
find_package(Qt5 ${QT_MIN_VERSION} REQUIRED NO_MODULE COMPONENTS Core Quick Test Gui Svg QuickControls2 WebEngine)
find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS Kirigami2 CoreAddons)
################# Enable C++11 features for clang and gcc #################
......@@ -31,27 +37,11 @@ if(UNIX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -std=c++0x")
endif()
################# now find all used packages #################
set (QT_MIN_VERSION "5.4.0")
find_package(Qt5WebEngine CONFIG)
set_package_properties(Qt5WebEngine PROPERTIES
TYPE OPTIONAL
)
add_feature_info("Qt5WebEngine" Qt5WebEngine_FOUND "Required for building the Angelfish webbrowser")
find_package(KF5 REQUIRED COMPONENTS
KIO Plasma Declarative I18n Kirigami2)
#########################################################################
################# build and install #################
add_subdirectory(src)
add_subdirectory(autotests)
install(PROGRAMS org.kde.mobile.angelfish.desktop DESTINATION ${KDE_INSTALL_APPDIR})
install(FILES org.kde.mobile.angelfish.appdata.xml DESTINATION ${KDE_INSTALL_METAINFODIR})
if(Qt5WebEngine_FOUND)
add_subdirectory(src)
add_subdirectory(autotests)
install(PROGRAMS org.kde.mobile.angelfish.desktop DESTINATION ${KDE_INSTALL_APPDIR})
plasma_install_package(package org.kde.mobile.angelfish packages package)
endif()
feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES)
include(ECMAddTests)
find_package(Qt5 ${REQUIRED_QT_VERSION} CONFIG REQUIRED Test)
......
......@@ -52,7 +52,7 @@ class UrlModelTest : public QObject
foreach (int k, model->roleNames().keys()) {
UrlModel *urlmodel = static_cast<UrlModel*>(model);
auto *urlmodel = static_cast<UrlModel*>(model);
const QString ks = urlmodel->key(k);
QVariant ori = vm[ks];
......
<?xml version="1.0" encoding="utf-8"?>
<component type="desktop-application">
<id>org.kde.mobile.angelfish</id>
<name>Kirigami Example Application</name>
<summary>A short summary describing what this software is about</summary>
<metadata_license>A permissive license for this metadata, e.g. "FSFAP"</metadata_license>
<project_license>The license of this software as SPDX string, e.g. "GPL-3+"</project_license>
<developer_name>The software vendor name, e.g. "ACME Corporation"</developer_name>
<description>
<p>Multiple paragraphs of long description, describing this software component.</p>
<p>You can also use ordered and unordered lists:</p>
<ul>
<li>Feature 1</li>
<li>Feature 2</li>
</ul>
<p>Keep in mind to XML-escape characters, and that this is not HTML markup.</p>
</description>
</component>
{
"id": "org.kde.mobile.angelfish",
"runtime": "org.kde.Platform",
"runtime-version": "5.11",
"sdk": "org.kde.Sdk",
"command": "angelfish",
"tags": ["nightly"],
"desktop-file-name-suffix": " (Nightly)",
"finish-args": [
"--share=ipc",
"--share=network",
"--socket=x11",
"--socket=wayland",
"--device=dri",
"--filesystem=home",
"--talk-name=org.freedesktop.Notifications"
],
"separate-locales": false,
"modules": [
{
"name": "angelfish",
"buildsystem": "cmake-ninja",
"builddir": true,
"sources": [ { "type": "dir", "path": ".", "skip": [".git"] } ]
}
]
}
/***************************************************************************
* *
* Copyright 2014-2015 Sebastian Kügler <sebas@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) any later version. *
* *
* 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, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . *
* *
***************************************************************************/
import QtQuick 2.3
//import QtWebEngine 1.0
import QtQuick.Controls 2.0 as Controls
import QtQuick.Layouts 1.0
//import QtQuick.Window 2.1
//import QtQuick.Controls.Private 1.0
import org.kde.kirigami 2.4 as Kirigami
Controls.ToolButton {
id: button
property alias iconSource: iconItem.source
signal released
signal pressed
signal triggered
Layout.fillWidth: true
Layout.preferredHeight: buttonSize
property bool isActive: false
property bool isPressed: false
MouseArea {
id: buttonMouse
hoverEnabled: true
anchors.fill: parent
onPressed: {
//print("Pressed " + icon)
isActive = true;
isPressed = true;
button.pressed(mouse);
}
onReleased: {
//print("Released TRIGGER!")
isActive = false;
isPressed = false;
//button.clicked(mouse);
button.triggered(mouse);
}
onEntered: {
//print("Enter")
//if (buttonMouse.pressed) {
isActive = true
//}
}
onExited: {
//print("Enter")
//if (buttonMouse.pressed) {
isActive = false
//}
}
}
Kirigami.Icon {
id: iconItem
anchors.fill: parent
visible: text == ""
}
RowLayout {
id: layoutRow
anchors.fill: parent
Kirigami.Icon {
id: rowIcon
Layout.preferredWidth: parent.width / 4
Layout.fillWidth: false
source: iconItem.source
}
visible: text != ""
}
}
[Desktop Entry]
Name=Angelfish Web Browser
Comment=Mobile web browser
GenericName=Web Browser
GenericName[bs]=Čitač veba
GenericName[ca]=Navegador web
GenericName[ca@valencia]=Navegador web
GenericName[cs]=Webový prohlížeč
GenericName[da]=Webbrowser
GenericName[de]=Webbrowser
GenericName[el]=Περιηγητής ιστού
GenericName[en_GB]=Web Browser
GenericName[es]=Navegador web
GenericName[et]=Veebibrauser
GenericName[fi]=Verkkoselain
GenericName[fr]=Navigateur web
GenericName[ga]=Brabhsálaí Gréasáin
GenericName[gl]=Navegador web
GenericName[hu]=Webböngésző
GenericName[it]=Browser Web
GenericName[kk]=Веб-шолғышы
GenericName[km]=កម្មវិធី​រុករក​បណ្ដាញ
GenericName[ko]=웹 브라우저
GenericName[lt]=Žiniatinklio naršyklė
GenericName[mr]=वेब ब्राऊजर
GenericName[nb]=Nettleser
GenericName[nds]=Nettkieker
GenericName[nl]=Webbrowser
GenericName[pa]=ਵੈੱਬ ਬਰਾਊਜ਼ਰ
GenericName[pl]=Przeglądarka internetowa
GenericName[pt]=Navegador Web
GenericName[pt_BR]=Navegador Web
GenericName[ro]=Navigator web
GenericName[sk]=Webový prehliadač
GenericName[sl]=Spletni brskalnik
GenericName[sv]=Webbläsare
GenericName[tr]=Web Tarayıcı
GenericName[ug]=توركۆرگۈ
GenericName[uk]=Переглядач інтернету
GenericName[wa]=Betchteu waibe
GenericName[x-test]=xxWeb Browserxx
GenericName[zh_CN]=网页浏览器
GenericName[zh_TW]=網頁瀏覽器
Encoding=UTF-8
Type=Service
Icon=internet-web-browser
X-KDE-PluginInfo-Author=Sebastian Kügler
X-KDE-PluginInfo-Email=sebas@kde.org
X-KDE-PluginInfo-Name=org.kde.mobile.angelfish
X-KDE-PluginInfo-Version=0.1
X-KDE-PluginInfo-Website=https://plasma-mobile.org
X-KDE-PluginInfo-Category=Online Services
X-KDE-PluginInfo-Depends=
X-KDE-PluginInfo-License=GPL
X-KDE-PluginInfo-EnabledByDefault=true
X-Plasma-MainScript=ui/webbrowser.qml
# These are only needed here, consider porting away from both!
find_package(Qt5 REQUIRED NO_MODULE COMPONENTS Gui WebEngine)
set(angelfish_SRCS
main.cpp
browsermanager.cpp
urlmodel.cpp
view.cpp
)
)
add_executable(angelfish ${angelfish_SRCS})
qt5_add_resources(RESOURCES resources.qrc)
target_link_libraries(angelfish
Qt5::Quick
Qt5::Gui
Qt5::WebEngine
KF5::Plasma
KF5::Declarative
KF5::I18n
)
add_executable(angelfish ${angelfish_SRCS} ${RESOURCES})
target_link_libraries(angelfish Qt5::Core Qt5::Qml Qt5::Quick Qt5::Svg Qt5::WebEngine)
install( TARGETS angelfish ${INSTALL_TARGETS_DEFAULT_ARGS} )
install(TARGETS angelfish ${KF5_INSTALL_TARGETS_DEFAULT_ARGS})
......@@ -22,14 +22,12 @@
#include <QDebug>
#include <QUrl>
#include <KDirWatch>
using namespace AngelFish;
BrowserManager::BrowserManager(QObject *parent)
: QObject(parent),
m_bookmarks(0),
m_history(0)
m_bookmarks(nullptr),
m_history(nullptr)
{
}
......
......@@ -37,6 +37,7 @@ Item {
spacing: Kirigami.Units.smallSpacing
interactive: height < contentHeight
clip: false
model: browserManager.bookmarks
......
......@@ -20,12 +20,8 @@
***************************************************************************/
import QtQuick 2.3
//import QtWebEngine 1.0
import QtQuick.Controls 2.0 as Controls
//import QtQuick.Controls.Styles 1.0
import QtQuick.Layouts 1.0
//import QtQuick.Window 2.1
//import QtQuick.Controls.Private 1.0
import org.kde.kirigami 2.0 as Kirigami
......@@ -40,7 +36,7 @@ Item {
Behavior on height { NumberAnimation { duration: Kirigami.Units.longDuration; easing.type: Easing.InOutQuad} }
Rectangle { anchors.fill: parent; color: theme.backgroundColor; }
Rectangle { anchors.fill: parent; color: Kirigami.Theme.backgroundColor; }
ColumnLayout {
......
......@@ -20,12 +20,9 @@
***************************************************************************/
import QtQuick 2.3
//import QtQuick.Controls 1.0
//import QtWebEngine 1.0
import QtQuick.Layouts 1.0
import org.kde.kirigami 2.2 as Kirigami
Item {
// id: options
......@@ -39,6 +36,7 @@ Item {
spacing: Kirigami.Units.smallSpacing
interactive: height < contentHeight
clip: true
model: browserManager.history
......@@ -47,5 +45,4 @@ Item {
}
}
Component.onCompleted: print("History.qml complete.");
}
......@@ -25,8 +25,6 @@ import QtWebEngine 1.4
import QtQuick.Controls 2.0 as Controls
import org.kde.kirigami 2.0 as Kirigami
//import org.kde.plasma.components 2.0 as PlasmaComponents
//import org.kde.plasma.extras 2.0 as PlasmaExtras
Item {
......@@ -34,14 +32,14 @@ Item {
property string errorCode: ""
property bool navigationShown: errorCode != "" || webBrowser.url == "" || true
property bool navigationShown: errorCode != "" || webBrowser.url === "" || true
property int expandedHeight: Kirigami.Units.gridUnit * 2.5
property int buttonSize: Kirigami.Units.gridUnit * 2
Behavior on height { NumberAnimation { duration: Kirigami.Units.longDuration; easing.type: Easing.InOutQuad} }
Rectangle { anchors.fill: parent; color: theme.backgroundColor; }
Rectangle { anchors.fill: parent; color: Kirigami.Theme.backgroundColor; }
RowLayout {
id: layout
......@@ -134,15 +132,9 @@ Item {
Layout.preferredWidth: buttonSize
Layout.preferredHeight: buttonSize
Kirigami.Icon {
id: menuIcon
source: "open-menu-symbolic"
anchors.fill: parent
}
iconSource: "open-menu-symbolic"
checked: options.state != "hidden"
//onClicked: options.state = (options.state != "hidden" ? "hidden" : targetState)
onPressed: options.state = (options.state != "hidden" ? "hidden" : targetState)
onClicked: options.state = (options.state != "hidden" ? "hidden" : targetState)
}
}
......
......@@ -16,33 +16,39 @@
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . *
* *
***************************************************************************/
#ifndef BROWSERVIEW_H
#define BROWSERVIEW_H
#include <QQuickView>
import QtQuick 2.3
import QtQuick.Controls 2.2 as Controls
import QtQuick.Layouts 1.0
#include <Plasma/Package>
import org.kde.kirigami 2.4 as Kirigami
namespace AngelFish {
class View : public QQuickView
{
Q_OBJECT
Controls.ToolButton {
id: button
public:
explicit View(const QString &url, QWindow *parent = 0 );
~View();
property alias iconSource: iconItem.source
Q_SIGNALS:
void titleChanged(const QString&);
Layout.fillWidth: true
Layout.preferredHeight: buttonSize
private:
Plasma::Package m_package;
QQuickItem* m_browserRootItem;
};
Kirigami.Icon {
id: iconItem
anchors.fill: parent
visible: text == ""
}
RowLayout {
id: layoutRow
anchors.fill: parent
Kirigami.Icon {
id: rowIcon
Layout.preferredWidth: parent.width * 0.25
Layout.fillWidth: false
source: iconItem.source
}
visible: text != ""
}
}
#endif // BROWSERVIEW_H
......@@ -20,12 +20,8 @@
***************************************************************************/
import QtQuick 2.3
//import QtWebEngine 1.0
//import QtQuick.Controls 1.0
//import QtQuick.Controls.Styles 1.0
import QtQuick.Layouts 1.0
//import QtQuick.Window 2.1
//import QtQuick.Controls.Private 1.0
import org.kde.kirigami 2.0 as Kirigami
......@@ -52,9 +48,7 @@ ColumnLayout {
enabled: currentWebView.canGoBack
iconSource: "go-previous"
onClicked: currentWebView.goBack()
onTriggered: {
print("Booh")
onClicked: {
options.state = "hidden";
currentWebView.goBack()
}
......@@ -63,13 +57,10 @@ ColumnLayout {
OptionButton {
id: forwardButton
// Layout.fillWidth: true
// Layout.preferredHeight: buttonSize
enabled: currentWebView.canGoForward
iconSource: "go-next"
onTriggered: {
onClicked: {
options.state = "hidden";
currentWebView.goForward()
}
......@@ -79,12 +70,9 @@ ColumnLayout {
OptionButton {
id: reloadButton
// Layout.fillWidth: true
// Layout.preferredHeight: buttonSize
iconSource: currentWebView.loading ? "process-stop" : "view-refresh"
onTriggered: {
onClicked: {
options.state = "hidden";
currentWebView.loading ? currentWebView.stop() : currentWebView.reload()
}
......@@ -94,12 +82,9 @@ ColumnLayout {
OptionButton {
id: bookmarkButton
// Layout.fillWidth: true
// Layout.preferredHeight: buttonSize
iconSource: "bookmarks"
onTriggered: {
onClicked: {
print("Adding bookmark");
var request = new Object;// FIXME
request.url = currentWebView.url;
......@@ -115,11 +100,6 @@ ColumnLayout {
}
// RowLayout {
//
// Layout.fillHeight: false
// Layout.preferredWidth: parent.width
Item {
Layout.preferredHeight: Kirigami.Units.smallSpacing
Layout.fillWidth: true
......@@ -129,7 +109,7 @@ ColumnLayout {
iconSource: "tab-duplicate"
Layout.fillWidth: true
Layout.preferredHeight: buttonSize
onTriggered: {
onClicked: {
contentView.state = "tabs"
options.state = "hidden"
}
......@@ -141,7 +121,7 @@ ColumnLayout {
iconSource: "bookmarks"
Layout.fillWidth: true
Layout.preferredHeight: buttonSize
onTriggered: {
onClicked: {
contentView.state = "bookmarks"
options.state = "hidden"
}
......@@ -153,7 +133,7 @@ ColumnLayout {
iconSource: "view-history"
Layout.fillWidth: true
Layout.preferredHeight: buttonSize
onTriggered: {
onClicked: {
contentView.state = "history"
options.state = "hidden"
}
......@@ -167,7 +147,7 @@ ColumnLayout {
Layout.preferredHeight: buttonSize
text: i18n("Settings")
checked: contentView.state == "settings"
onTriggered: {
onClicked: {
contentView.state = "settings"
options.state = "hidden"
}
......
......@@ -20,26 +20,18 @@
***************************************************************************/
import QtQuick 2.3
import QtQuick.Controls 2.0 as Controls
import QtQuick.Layouts 1.0
import QtQuick.Controls 2.4 as Controls
import QtQuick.Layouts 1.11
import org.kde.plasma.components 2.0 as PlasmaComponents
import org.kde.kirigami 2.0 as Kirigami
import org.kde.kirigami 2.2 as Kirigami
GridLayout {
ColumnLayout {
id: settingsPage
columns: 2
Controls.Label {
Controls.CheckDelegate {
text: "Enable javascript"
Layout.fillWidth: true
Layout.preferredHeight: Kirigami.Units.gridUnit * 2
}
Controls.CheckBox {
Layout.preferredHeight: Kirigami.Units.gridUnit * 2
Layout.preferredWidth: Kirigami.Units.gridUnit * 2
onCheckedChanged: {
var settings = currentWebView.settings;
settings.javascriptEnabled = checked;
......@@ -48,18 +40,11 @@ GridLayout {
Component.onCompleted: {
<