diff --git a/launcher/CMakeLists.txt b/launcher/CMakeLists.txt new file mode 100644 index 00000000..b19aa4b6 --- /dev/null +++ b/launcher/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.5) +project(om-welcome) + +set(CMAKE_AUTOMOC ON) +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +add_definitions(-std=gnu++14) + +find_package(Qt5 COMPONENTS Core Gui Widgets WebEngineWidgets REQUIRED) +add_executable(om-welcome main.cpp Page.cpp) +qt5_use_modules(om-welcome Core Gui Widgets WebEngineWidgets) diff --git a/launcher/Page.cpp b/launcher/Page.cpp new file mode 100644 index 00000000..d70b2451 --- /dev/null +++ b/launcher/Page.cpp @@ -0,0 +1,28 @@ +#include "Page.h" +#include +using namespace std; + +bool Page::acceptNavigationRequest(QUrl const &url, NavigationType type, bool isMainFrame) { + if(url.isLocalFile()) { + open(url.path()); + return false; + } + return true; +} + +void Page::open(QString file) { + cerr << "Page::Open " << qPrintable(file) << endl; + if(!file.contains("://") && !file.startsWith("/")) + file="/usr/share/oma-welcome/" + file; + + if(file.startsWith('/') && (file.endsWith(".sh.htm") || file.endsWith(".sh.html"))) { + QProcess p(this); + p.setWorkingDirectory(file.section('/', 0, -2)); + p.start("/bin/bash", QStringList() << "-c" << file, QProcess::ReadOnly); + p.waitForFinished(60000); + setContent(p.readAllStandardOutput().replace("target=\"hidden\" ", ""), "text/html", QUrl("file://" + file)); + } else if(file.endsWith(".run")) { + QProcess::startDetached("/bin/bash", QStringList() << "-c" << file); + } else + QWebEnginePage::load(file); +} diff --git a/launcher/Page.h b/launcher/Page.h new file mode 100644 index 00000000..c635430f --- /dev/null +++ b/launcher/Page.h @@ -0,0 +1,13 @@ +#ifndef _PAGE_H_ +#define _PAGE_H_ 1 +#include + +class Page:public QWebEnginePage { + Q_OBJECT +public: + Page(QObject *parent=0):QWebEnginePage(parent) {} + void open(QString file); +protected: + bool acceptNavigationRequest(QUrl const &url, NavigationType type, bool isMainFrame) override; +}; +#endif diff --git a/launcher/main.cpp b/launcher/main.cpp new file mode 100644 index 00000000..4a785bca --- /dev/null +++ b/launcher/main.cpp @@ -0,0 +1,14 @@ +#include +#include +#include "Page.h" + +int main(int argc, char **argv) { + QApplication app(argc, argv); + QWebEngineView *l=new QWebEngineView(0); + Page *p=new Page(l); + l->setPage(p); + p->open("index.sh.htm"); + l->show(); + app.exec(); + delete l; +} diff --git a/usr/share/oma-welcome/apps-development.sh.htm b/usr/share/oma-welcome/apps-development.sh.htm index ac1fb2be..5dd6370b 100755 --- a/usr/share/oma-welcome/apps-development.sh.htm +++ b/usr/share/oma-welcome/apps-development.sh.htm @@ -93,5 +93,5 @@ $next -EOF +EOF diff --git a/usr/share/oma-welcome/apps-gaming.sh.htm b/usr/share/oma-welcome/apps-gaming.sh.htm index a8d9a3c1..52695b58 100755 --- a/usr/share/oma-welcome/apps-gaming.sh.htm +++ b/usr/share/oma-welcome/apps-gaming.sh.htm @@ -94,5 +94,5 @@ $next -EOF +EOF diff --git a/usr/share/oma-welcome/apps-graphics.sh.htm b/usr/share/oma-welcome/apps-graphics.sh.htm index 3426e71f..83547648 100755 --- a/usr/share/oma-welcome/apps-graphics.sh.htm +++ b/usr/share/oma-welcome/apps-graphics.sh.htm @@ -94,5 +94,5 @@ $next -EOF +EOF diff --git a/usr/share/oma-welcome/apps-internet.sh.htm b/usr/share/oma-welcome/apps-internet.sh.htm index b2433426..eac66470 100755 --- a/usr/share/oma-welcome/apps-internet.sh.htm +++ b/usr/share/oma-welcome/apps-internet.sh.htm @@ -95,4 +95,3 @@ EOF - diff --git a/usr/share/oma-welcome/apps-multimedia.sh.htm b/usr/share/oma-welcome/apps-multimedia.sh.htm index b6e58aad..030cfffd 100755 --- a/usr/share/oma-welcome/apps-multimedia.sh.htm +++ b/usr/share/oma-welcome/apps-multimedia.sh.htm @@ -93,5 +93,5 @@ $next -EOF +EOF diff --git a/usr/share/oma-welcome/apps-office.sh.htm b/usr/share/oma-welcome/apps-office.sh.htm index bdf5c19c..239ac2a1 100755 --- a/usr/share/oma-welcome/apps-office.sh.htm +++ b/usr/share/oma-welcome/apps-office.sh.htm @@ -101,5 +101,5 @@ $next -EOF +EOF diff --git a/usr/share/oma-welcome/apps-utilitarios.sh.htm b/usr/share/oma-welcome/apps-utilitarios.sh.htm index a0e9a561..6db4dc81 100755 --- a/usr/share/oma-welcome/apps-utilitarios.sh.htm +++ b/usr/share/oma-welcome/apps-utilitarios.sh.htm @@ -83,5 +83,5 @@

$cabecalho03 $(head -1 /README |cut -d " " -f1-3) $cabecal $next -EOF +EOF diff --git a/usr/share/oma-welcome/apps-utility.sh.htm b/usr/share/oma-welcome/apps-utility.sh.htm index c80c3855..b672d68c 100755 --- a/usr/share/oma-welcome/apps-utility.sh.htm +++ b/usr/share/oma-welcome/apps-utility.sh.htm @@ -93,5 +93,5 @@ $next -EOF +EOF diff --git a/usr/share/oma-welcome/apps.sh.htm b/usr/share/oma-welcome/apps.sh.htm index c2111821..cf572ad2 100755 --- a/usr/share/oma-welcome/apps.sh.htm +++ b/usr/share/oma-welcome/apps.sh.htm @@ -71,5 +71,5 @@ $next -EOF +EOF diff --git a/usr/share/oma-welcome/community.sh.htm b/usr/share/oma-welcome/community.sh.htm index 954a2339..bf92f62c 100755 --- a/usr/share/oma-welcome/community.sh.htm +++ b/usr/share/oma-welcome/community.sh.htm @@ -91,5 +91,5 @@ $endapp - +EOF diff --git a/usr/share/oma-welcome/conf.sh.htm b/usr/share/oma-welcome/conf.sh.htm index c9616dfb..1061fe58 100755 --- a/usr/share/oma-welcome/conf.sh.htm +++ b/usr/share/oma-welcome/conf.sh.htm @@ -87,5 +87,5 @@ $next -EOF +EOF