diff --git a/debian/control.qt5 b/debian/control.qt5 index 04dc4fe..78c55d8 100644 --- a/debian/control.qt5 +++ b/debian/control.qt5 @@ -8,7 +8,7 @@ Homepage: https://code.google.com/p/qt-webkit-kiosk/ Package: qt-webkit-kiosk Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends}, phonon-backend-gstreamer +Depends: ${shlibs:Depends}, ${misc:Depends} Description: It's one-window browser writen on Qt5 & QtWebkit This is simple browser written on Qt5 & QtWebkit. Usualy runing in fullscreen mode, but supports maximized and fixed size window mode. diff --git a/setup.pro b/setup.pro index de62faa..107d8f2 100644 --- a/setup.pro +++ b/setup.pro @@ -12,6 +12,7 @@ CONFIG(debug, debug|release) { message(Debug build) } else { # here comes release specific statements + message(Release build) CONFIG -= debug DEFINES += QT_NO_DEBUG_OUTPUT } diff --git a/src/anyoption.cpp b/src/anyoption.cpp index 86974b5..2c02cdc 100644 --- a/src/anyoption.cpp +++ b/src/anyoption.cpp @@ -391,7 +391,7 @@ AnyOption::useCommandArgs( int _argc, QStringList _argv) } void -AnyOption::useFiileName( const char *_filename ) +AnyOption::useFileName( const char *_filename ) { filename = _filename; file_set = true; @@ -952,7 +952,7 @@ AnyOption::processFile() bool AnyOption::processFile( const char *filename ) { - useFiileName(filename ); + useFileName(filename ); return ( processFile() ); } diff --git a/src/embedded_server.cpp b/src/embedded_server.cpp deleted file mode 100644 index 428051d..0000000 --- a/src/embedded_server.cpp +++ /dev/null @@ -1,56 +0,0 @@ -#include "embedded_server.h" -#include - -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(); - } -} diff --git a/src/embedded_server.h b/src/embedded_server.h deleted file mode 100644 index f2e326a..0000000 --- a/src/embedded_server.h +++ /dev/null @@ -1,28 +0,0 @@ -#ifndef EMBEDDED_SERVER_H -#define EMBEDDED_SERVER_H - -/** - * Qapplication for Embedded GUI server - */ - -#include -#include -#include - -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 diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index e5fa5dc..d522b82 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -855,9 +855,6 @@ void MainWindow::attachJavascripts() QString file_name; quint32 countScripts = 0; - QWebElement bodyElem = view->page()->mainFrame()->findFirstElement("body"); - QString content = ""; - while (scriptsIterator.hasNext()) { file_name = scriptsIterator.next(); @@ -911,9 +908,6 @@ void MainWindow::attachStyles() QFileInfo finfo = QFileInfo(); quint32 countStyles = 0; - QWebElement headElem = view->page()->mainFrame()->findFirstElement("head"); - QString content = ""; - while (stylesIterator.hasNext()) { file_name = stylesIterator.next(); diff --git a/src/player/multimedia.cpp b/src/player/multimedia.cpp index 115d1b5..31d57be 100644 --- a/src/player/multimedia.cpp +++ b/src/player/multimedia.cpp @@ -1,5 +1,5 @@ #include "config.h" -#include "qplayer.h" +#include "multimedia.h" QPlayer::QPlayer() { diff --git a/src/player/multimedia.h b/src/player/multimedia.h index 976a166..1dba273 100644 --- a/src/player/multimedia.h +++ b/src/player/multimedia.h @@ -1,8 +1,15 @@ -#ifndef QPLAYER_H -#define QPLAYER_H +#ifndef QPLAYER_MULTIMEDIA_H +#define QPLAYER_MULTIMEDIA_H + +/** + * Sould be used only with Qt-5.0+ + * Qt 4 don't have MediaPlayer + */ #include +#ifdef QT5 #include +#endif class QPlayer : public QObject { @@ -21,4 +28,4 @@ class QPlayer : public QObject }; -#endif // QPLAYER_H +#endif // QPLAYER_MULTIMEDIA_H diff --git a/src/player/null.cpp b/src/player/null.cpp index dc4a015..906e191 100644 --- a/src/player/null.cpp +++ b/src/player/null.cpp @@ -7,4 +7,5 @@ QPlayer::QPlayer() void QPlayer::play(QString soundFile) { + Q_UNUSED(soundFile); } diff --git a/src/qt-embedded-server.cpp b/src/qt-embedded-server.cpp deleted file mode 100644 index 2de075e..0000000 --- a/src/qt-embedded-server.cpp +++ /dev/null @@ -1,40 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Sergey Dryabzhinsky. -** All rights reserved. -** Contact: Sergey Dryabzhinsky (sergey.dryabzhinsky@gmail.com) -** -** $QT_BEGIN_LICENSE:LGPL$ -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** If you have questions regarding the use of this file, please contact -** Sergey at sergey.dryabzhinsky@gmail.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "config.h" -#include -#include -#include "embedded_server.h" - - -int main(int argc, char * argv[]) -{ - EmbeddedServer app(argc, argv); - app.setApplicationName("Simple Qt GUI embedded server"); - app.setApplicationVersion(VERSION); - - QObject::connect(qApp, SIGNAL(aboutToQuit()), - &app, SLOT(aboutToQuitSlot())); - - int ret = app.exec(); - qDebug() << "Application return:" << ret; -} diff --git a/src/qt-embedded-server.pro b/src/qt-embedded-server.pro deleted file mode 100644 index cc3dc9d..0000000 --- a/src/qt-embedded-server.pro +++ /dev/null @@ -1,46 +0,0 @@ -#------------------------------------------------- -# -# Project created by Sergey 2014-03-22T07:29:00 -# -#------------------------------------------------- - - -QT += core gui - -CONFIG += console -TARGET = qt-embedded-server -TEMPLATE = app -VERSION = 1.99.0 - -isEmpty( PREFIX ) { - PREFIX = /usr/local -} - - -CONFIG(debug, debug|release) { -# here comes debug specific statements - message(Debug build) -} else { -# here comes release specific statements - CONFIG -= debug - DEFINES += QT_NO_DEBUG_OUTPUT -} - -message(Qt version: $$[QT_VERSION]) -message(Qt is installed in $$[QT_INSTALL_PREFIX]) -message(Settings:) -message( PREFIX: $${PREFIX}) -message( TARGET: $${TARGET}) -message( VERSION: $${VERSION}) - -DEFINES += VERSION=\\\"$${VERSION}\\\" - -SOURCES += embedded_server.cpp qt-embedded-server.cpp - -HEADERS += config.h embedded_server.h - -# INSTALL - -target.path = $${PREFIX}/bin - -INSTALLS += target diff --git a/src/qt-webkit-kiosk.pro b/src/qt-webkit-kiosk.pro index 2b9b919..616bfbe 100644 --- a/src/qt-webkit-kiosk.pro +++ b/src/qt-webkit-kiosk.pro @@ -4,16 +4,14 @@ # #------------------------------------------------- - -QT += core gui network webkit - -contains(QT_VERSION, ^5\\.[0-9]\\..*) { -QT += multimedia widgets webkitwidgets printsupport -DEFINES += QT5 -} +QT = core gui network webkit +contains(QT_VERSION, ^5\\.[0-9]\\..*) { + QT += widgets webkitwidgets printsupport + DEFINES += QT5 +} -CONFIG += console +CONFIG += console link_pkgconfig TARGET = qt-webkit-kiosk TEMPLATE = app VERSION = 1.99.0 @@ -27,47 +25,100 @@ CONFIG(debug, debug|release) { DEFINES += QT_NO_DEBUG_OUTPUT } -message(Qt version: $$[QT_VERSION]) -message(Qt is installed in $$[QT_INSTALL_PREFIX]) -message(Settings:) -message( PREFIX: $${PREFIX}) -message( TARGET: $${TARGET}) -message( VERSION: $${VERSION}) - DEFINES += VERSION=\\\"$${VERSION}\\\" +PLAYER = NONE + !win32 { + isEmpty( PREFIX ) { + PREFIX = /usr/local + } + ICON = $${PREFIX}/share/icons/$${TARGET}.png DEFINES += RESOURCES=\\\"$${PREFIX}/share/$${TARGET}/\\\" DEFINES += ICON=\\\"$${ICON}\\\" + +contains(QT_VERSION, ^5\\.[0-9]\\..*) { + packagesExist(QtMultimedia QtMultimedia4 Qt5Multimedia) { + message('Multimedia framework found. Using Multimedia-player.') + DEFINES += PLAYER_MULTIMEDIA + QT += multimedia + PLAYER = MULTIMEDIA + SOURCES += player/multimedia.cpp + HEADERS += player/multimedia.h + } +} + contains(PLAYER, NONE) { + packagesExist(phonon phonon4) { + message('Phonon framework found. Using Phonon-player.') + DEFINES += PLAYER_PHONON + QT += phonon + PLAYER = PHONON + SOURCES += player/phonon.cpp + HEADERS += player/phonon.h + } + } + packagesExist(QtTest QtTest4 Qt5Test) { + message('Test framework found.') + DEFINES += USE_TESTLIB + QT += testlib + } else { + warning('No QtTest framework found! Will not do hacks with window...') + } } win32 { ICON = ./$${TARGET}.png DEFINES += RESOURCES=\\\"./\\\" DEFINES += ICON=\\\"$${ICON}\\\" + +# Windows don't have pkg-config +# So we check generic paths... + +contains(QT_VERSION, ^5\\.[0-9]\\..*) { + exists($$[QT_INSTALL_PREFIX]\\bin\\Qt*Multimedia*) { + message('Multimedia framework found. Using Multimedia-player.') + DEFINES += PLAYER_MULTIMEDIA + QT += multimedia + PLAYER = MULTIMEDIA + SOURCES += player/multimedia.cpp + HEADERS += player/multimedia.h + } +} + contains(PLAYER, NONE) { + exists($$[QT_INSTALL_PREFIX]\\bin\\phonon*) { + message('Phonon framework found. Using Phonon-player.') + DEFINES += PLAYER_PHONON + QT += phonon + PLAYER = PHONON + SOURCES += player/phonon.cpp + HEADERS += player/phonon.h + } + } + exists($$[QT_INSTALL_PREFIX]\\bin\\Qt*Test*) { + message('Test framework found.') + DEFINES += USE_TESTLIB + QT += testlib + } else { + warning('No QtTest framework found! Will not do hacks with window...') + } +} + +message(Qt player: $${PLAYER}) + +contains(PLAYER, NONE) { + warning('No multimedia framework found! Using NULL-player.') + DEFINES += PLAYER_NULL + SOURCES += player/null.cpp + HEADERS += player/null.h } - -packagesExist(phonon) { - message('Phonon framework found. Using Phonon-player.') - DEFINES += PLAYER_PHONON - QT += phonon - SOURCES += player/phonon.cpp - HEADERS += player/phonon.h -} else { - warning('No phonon framework found! Using NULL-player.') - DEFINES += PLAYER_NULL - SOURCES += player/null.cpp - HEADERS += player/null.h -} - -packagesExist(QtTest) { - message('Test framework found.') - DEFINES += USE_TESTLIB - QT += testlib -} else { - warning('No QtTest framework found! Will not do hacks with window...') -} - + +message(Qt version: $$[QT_VERSION]) +message(Qt is installed in $$[QT_INSTALL_PREFIX]) +message(Settings:) +message(- QT : $${QT}) +message(- PREFIX : $${PREFIX}) +message(- TARGET : $${TARGET}) +message(- VERSION: $${VERSION}) SOURCES += main.cpp\ mainwindow.cpp \ @@ -88,6 +139,10 @@ HEADERS += mainwindow.h \ unixsignals.h \ socketpair.h +# DEBUG +#message(- SOURCES: $${SOURCES}) +#message(- HEADERS: $${HEADERS}) + # INSTALL target.path = $${PREFIX}/bin