forked from panahbiru/oma-welcome
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from OpenMandrivaSoftware/master
Fix various syntax errors -- </html> should go into HTML, not bash
- Loading branch information
Showing
15 changed files
with
76 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#include "Page.h" | ||
#include <QProcess> | ||
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); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#ifndef _PAGE_H_ | ||
#define _PAGE_H_ 1 | ||
#include <QWebEnginePage> | ||
|
||
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#include <QApplication> | ||
#include <QWebEngineView> | ||
#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; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -93,5 +93,5 @@ | |
<a href="community.sh.htm" class="button">$next</a> | ||
</div> | ||
</body> | ||
EOF | ||
</html> | ||
EOF |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -94,5 +94,5 @@ | |
<a href="community.sh.htm" class="button">$next</a> | ||
</div> | ||
</body> | ||
EOF | ||
</html> | ||
EOF |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -94,5 +94,5 @@ | |
<a href="community.sh.htm" class="button">$next</a> | ||
</div> | ||
</body> | ||
EOF | ||
</html> | ||
EOF |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -95,4 +95,3 @@ | |
</body> | ||
</html> | ||
EOF | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -93,5 +93,5 @@ | |
<a href="community.sh.htm" class="button">$next</a> | ||
</div> | ||
</body> | ||
EOF | ||
</html> | ||
EOF |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -101,5 +101,5 @@ | |
<a href="community.sh.htm" class="button">$next</a> | ||
</div> | ||
</body> | ||
EOF | ||
</html> | ||
EOF |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -93,5 +93,5 @@ | |
<a href="community.sh.htm" class="button">$next</a> | ||
</div> | ||
</body> | ||
EOF | ||
</html> | ||
EOF |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -71,5 +71,5 @@ | |
<a href="community.sh.htm" class="button">$next</a> | ||
</div> | ||
</body> | ||
EOF | ||
</html> | ||
EOF |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -91,5 +91,5 @@ | |
<a href="execute close$" class="button">$endapp</a> | ||
</div> | ||
</body> | ||
</html> | ||
EOF |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -87,5 +87,5 @@ | |
<a href="apps-office.sh.htm" class="button">$next</a> | ||
</div> | ||
</body> | ||
EOF | ||
</html> | ||
EOF |