Skip to content

Commit

Permalink
Updated sources with support for Qt4 from old branch
Browse files Browse the repository at this point in the history
  • Loading branch information
Sergey Dryabzhinsky committed Jul 5, 2014
1 parent b623f49 commit 017c879
Show file tree
Hide file tree
Showing 30 changed files with 1,993 additions and 1,642 deletions.
9 changes: 8 additions & 1 deletion debian/changelog
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
qt-webkit-kiosk (1.99.0-1sergey1) unstable; urgency=medium

* Version 1.99.0
* Try to combine Qt4 and Qt5 code

-- Sergey Dryabzhinsky <[email protected]> Sat, 05 Jul 2014 18:59:18 +0400

qt-webkit-kiosk (1.05.15-1sergey1) unstable; urgency=low

* Version 1.05.15:
+ Merge changes from 1.4.11
- Fixed signal handling - use socketpair for every listening signal...

-- Sergey Dryabzhinsky <[email protected]> Web, 19 Mar 2014 02:20:00 +0400
-- Sergey Dryabzhinsky <[email protected]> Wed, 19 Mar 2014 02:20:00 +0400

qt-webkit-kiosk (1.05.14-1sergey1) unstable; urgency=low

Expand Down
17 changes: 17 additions & 0 deletions debian/control.qt4
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
Source: qt-webkit-kiosk
Section: web
Priority: extra
Maintainer: Sergey Dryabzginsky <[email protected]>
Build-Depends: debhelper (>= 7.0.0), libqt4-dev (>=4.7.0), libqtwebkit-dev, libphonon-dev, libqt4-test
Standards-Version: 3.9.2
Homepage: https://code.google.com/p/qt-webkit-kiosk/

Package: qt-webkit-kiosk
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, phonon-backend-gstreamer
Description: It's one-window browser writen on Qt4 & QtWebkit
This is simple browser written on Qt4 & QtWebkit.
Usualy runing in fullscreen mode, but supports maximized and fixed size window mode.
This browser uses only one, "main" window. So, no popups, no plugins in separate processes, like Chrome do.
Supports several parameters via configuration file: proxy, user-agent, click sound.
Also supports hiding printer dialog and uses default or defined printer.
File renamed without changes.
17 changes: 9 additions & 8 deletions resources/qt-webkit-kiosk.ini
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@
homepage=default.html

; Delay load homepage on startup
startup_load_delayed=false
startup_load_delayed=true
; Delay in msec
startup_load_delay=200
startup_load_delay=100

java=false
javascript=true
; handle window.open?
javascript_can_open_windows=false
; canch link and follow. no new windows.
javascript_can_open_windows=true
; handle window.close ?
javascript_can_close_windows=false
webgl=false
Expand Down Expand Up @@ -68,7 +69,7 @@ enable=false
;link-clicked=link-clicked.wav

[cache]
enable=false
enable=true
; Full path to cache directory
location=cache
; Max cache size in bytes
Expand All @@ -82,7 +83,7 @@ clean-on-exit=false
organization=Organization
organization-domain=www.example.com
name=QtWebkitKiosk
version=1.05.15
version=1.99.0

[printing]
enable=false
Expand Down Expand Up @@ -121,12 +122,12 @@ stay_on_top=false
;minimum-height=200

; Try to avoid some bogus Windows behaviour when taskbar become visible after window fullscreened...
startup_resize_delayed=false
startup_resize_delayed=true
; Delay in msec
startup_resize_delay=100
startup_resize_delay=200

; Try to hide window scrollbars for any content overflow. Scrolling works only with keyboard keys. If they not disabled.
hide_scrollbars=false
hide_scrollbars=true

; Try to hide selection
disable_selection=true
Expand Down
5 changes: 0 additions & 5 deletions setup.pro
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,6 @@
#
#-------------------------------------------------

contains(QT_VERSION, ^4\\.[0-9]\\..*) {
message("Cannot build Qt Webkit Kiosk with Qt version $${QT_VERSION}.")
error("Use at least Qt 5.0.")
}

TEMPLATE = subdirs
CONFIG += ordered warn_on

Expand Down
30 changes: 15 additions & 15 deletions src/anyoption.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -376,18 +376,18 @@ AnyOption::useCommandArgs( int _argc, char **_argv )
void
AnyOption::useCommandArgs( int _argc, QStringList _argv)
{
// Copy input to output
argv = new char*[_argv.size() + 1];
for (int i = 0; i < _argv.size(); i++) {
argv[i] = new char[strlen(_argv.at(i).toStdString().c_str())+1];
memcpy(argv[i], _argv.at(i).toStdString().c_str(), strlen(_argv.at(i).toStdString().c_str())+1);
}
argv[_argv.size()] = ((char)NULL);
// Copy input to output
argv = new char*[_argv.size() + 1];
for (int i = 0; i < _argv.size(); i++) {
argv[i] = new char[strlen(_argv.at(i).toStdString().c_str())+1];
memcpy(argv[i], _argv.at(i).toStdString().c_str(), strlen(_argv.at(i).toStdString().c_str())+1);
}
argv[_argv.size()] = ((char)NULL);

argc = _argc;
command_set = true;
appname = argv[0];
if(argc > 1) hasoptions = true;
argc = _argc;
command_set = true;
appname = argv[0];
if(argc > 1) hasoptions = true;
}

void
Expand Down Expand Up @@ -609,10 +609,10 @@ AnyOption::processCommandArgs(int max_args)
}

void
AnyOption::processCommandArgs(int _argc, char **_argv)
AnyOption::processCommandArgs( int _argc, char **_argv)
{
useCommandArgs( _argc, _argv );
processCommandArgs();
useCommandArgs( _argc, _argv );
processCommandArgs();
}

void
Expand All @@ -623,7 +623,7 @@ AnyOption::processCommandArgs( int _argc, char **_argv, int max_args )
}

void
AnyOption::processCommandArgs(int _argc, QStringList _argv)
AnyOption::processCommandArgs( int _argc, QStringList _argv)
{
useCommandArgs( _argc, _argv );
processCommandArgs();
Expand Down
8 changes: 4 additions & 4 deletions src/anyoption.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ class AnyOption
*/

void useCommandArgs( int _argc, char **_argv );
void useCommandArgs(int _argc, QStringList _argv );
void useFiileName( const char *_filename );
void useCommandArgs( int _argc, QStringList _argv );
void useFileName( const char *_filename );

/*
* turn off the POSIX style options
Expand Down Expand Up @@ -133,8 +133,8 @@ class AnyOption
*/
void processCommandArgs( int _argc, char **_argv );
void processCommandArgs( int _argc, char **_argv, int max_args );
void processCommandArgs(int _argc, QStringList _argv );
bool processFile( const char *_filename );
void processCommandArgs( int _argc, QStringList _argv );
bool processFile( const char *_filename );

/*
* get the value of the options
Expand Down
2 changes: 1 addition & 1 deletion src/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#endif

#ifndef VERSION
#define VERSION "0.0.0"
#define VERSION "1.99.0"
#endif

#endif
56 changes: 56 additions & 0 deletions src/embedded_server.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#include "embedded_server.h"
#include <QDebug>

EmbeddedServer::EmbeddedServer( int & argc, char ** argv )
: QApplication(argc, argv, QApplication::GuiServer)
{
connect(&startup, SIGNAL(timeout()), this, SLOT(startupSlot()));
startup.setInterval(1);
startup.setSingleShot(true);
startup.start(1);

process.setProcessChannelMode(QProcess::ForwardedChannels);
connect(&process, SIGNAL(stateChanged(QProcess::ProcessState)), this, SLOT(stateChangedSlot(QProcess::ProcessState)));
}

void EmbeddedServer::startupSlot()
{
QStringList cmd(QCoreApplication::arguments());
qDebug() << "Command line arguments:" << cmd.join(" ");
// Remove app cmd
cmd.removeFirst();
if (cmd.size() and cmd.first() == "-qws") {
cmd.removeFirst();
}
if (!cmd.size()) {
qDebug() << "No program in commandline arguments to execute!";
exit(0);
return;
}

QString program = cmd.first();
cmd.removeFirst();

qDebug() << "Start:" << endl << " program:" << program << endl << " arguments:" << cmd.join(" ");

process.start(program, cmd);
}

void EmbeddedServer::stateChangedSlot(QProcess::ProcessState newState)
{
if (newState == QProcess::Running) {
qDebug() << "Process started...";
}
if (newState == QProcess::NotRunning) {
qDebug() << "Process not running... Exiting...";
exit(0);
}
}

void EmbeddedServer::aboutToQuitSlot()
{
if (process.state() == QProcess::Running) {
qDebug() << "Process is running... Terminate it.";
process.terminate();
}
}
28 changes: 28 additions & 0 deletions src/embedded_server.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#ifndef EMBEDDED_SERVER_H
#define EMBEDDED_SERVER_H

/**
* Qapplication for Embedded GUI server
*/

#include <QApplication>
#include <QTimer>
#include <QProcess>

class EmbeddedServer: public QApplication
{
Q_OBJECT
public:
EmbeddedServer( int & argc, char ** argv );

private slots:
void startupSlot();
void stateChangedSlot(QProcess::ProcessState newState);
void aboutToQuitSlot();

private:
QTimer startup;
QProcess process;
};

#endif // EMBEDDED_SERVER_H
5 changes: 5 additions & 0 deletions src/fakewebview.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@
#define FAKEWEBVIEW_H

#include <QtNetwork>

#ifdef QT5
#include <QtWebKitWidgets/QWebView>
#else
#include <QWebView>
#endif

class FakeWebView : public QWebView
{
Expand Down
8 changes: 6 additions & 2 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,11 @@ bool launch(AnyOption *cmdopts)

cmdopts->setVersion(VERSION);

#ifdef QT5
cmdopts->processCommandArgs( QCoreApplication::arguments().length(), QCoreApplication::arguments() );
#else
cmdopts->processCommandArgs( QCoreApplication::argc(), QCoreApplication::argv() );
#endif

if (cmdopts->getFlag('h') || cmdopts->getFlag("help")) {
qDebug(">> Help option in command prompt...");
Expand Down Expand Up @@ -88,8 +92,8 @@ int main(int argc, char * argv[])
browser->init(cmdopts);

// executes browser.cleanupSlot() when the Qt framework emits aboutToQuit() signal.
QObject::connect(qApp, SIGNAL(aboutToQuit()),
browser, SLOT(cleanupSlot()));
QObject::connect(qApp, SIGNAL(aboutToQuit()),
browser, SLOT(cleanupSlot()));

int ret = app.exec();
qDebug() << "Application return:" << ret;
Expand Down
Loading

0 comments on commit 017c879

Please sign in to comment.