[elvystrac] r1728 - pdf-presentation-branch merged!

  • From: elvys@xxxxxxxxxxxxxxxxxxxxxx
  • To: elvystrac@xxxxxxxxxxxxx
  • Date: Mon, 15 Feb 2010 08:47:27 +0100

Author: JirkaH
Date: 2010-02-15 08:47:27 +0100 (Mon, 15 Feb 2010)
New Revision: 1728

Added:
   trunk/client/elvys-client/src/logotabbar.cpp
   trunk/client/elvys-client/src/logotabbar.h
   trunk/client/elvys-client/src/pdfpresentationdocument.cpp
   trunk/client/elvys-client/src/pdfpresentationdocument.h
   trunk/client/elvys-client/src/pdfpresentationviewer.cpp
   trunk/client/elvys-client/src/pdfpresentationviewer.h
Modified:
   trunk/client/elvys-client/src/
   trunk/client/elvys-client/src/Makefile
   trunk/client/elvys-client/src/abstractmaintainer.cpp
   trunk/client/elvys-client/src/appconfigdata.cpp
   trunk/client/elvys-client/src/autodeleter.cpp
   trunk/client/elvys-client/src/category.cpp
   trunk/client/elvys-client/src/categorymaintainerdoc.cpp
   trunk/client/elvys-client/src/categorymaintainerlayout.cpp
   trunk/client/elvys-client/src/categorymanager.cpp
   trunk/client/elvys-client/src/categorymanager.h
   trunk/client/elvys-client/src/constants.h
   trunk/client/elvys-client/src/documentmaintainer.cpp
   trunk/client/elvys-client/src/documentmaintainer.h
   trunk/client/elvys-client/src/dynamictext.cpp
   trunk/client/elvys-client/src/elvys.cpp
   trunk/client/elvys-client/src/filecachemaintainer.cpp
   trunk/client/elvys-client/src/http.cpp
   trunk/client/elvys-client/src/layoutmaintainer.cpp
   trunk/client/elvys-client/src/main.cpp
   trunk/client/elvys-client/src/modechanger.cpp
   trunk/client/elvys-client/src/pageselector.h
   trunk/client/elvys-client/src/panel.cpp
   trunk/client/elvys-client/src/pdfdocument.cpp
   trunk/client/elvys-client/src/pdffiller.cpp
   trunk/client/elvys-client/src/pdffiller.h
   trunk/client/elvys-client/src/pdfpage.cpp
   trunk/client/elvys-client/src/pdfviewer.cpp
   trunk/client/elvys-client/src/pdfviewer.h
   trunk/client/elvys-client/src/pdfzoomed.cpp
   trunk/client/elvys-client/src/pdfzoomed.h
   trunk/client/elvys-client/src/screenshooter.cpp
   trunk/client/elvys-client/src/serialcontrols.cpp
   trunk/client/elvys-client/src/src.pro
   trunk/client/elvys-client/src/statisticsdata.cpp
   trunk/client/elvys-client/src/videodocument.cpp
   trunk/client/elvys-client/src/xmlabstractparser.cpp
   trunk/client/elvys-client/src/xmlappparser.cpp
   trunk/client/elvys-client/src/xmlcatdocparser.cpp
   trunk/client/elvys-client/src/xmlcatlayoutparser.cpp
   trunk/client/elvys-client/src/xmldocumentparser.cpp
   trunk/client/elvys-client/src/xmldocumentparser.h
   trunk/client/elvys-client/src/xmlfilecacheparser.cpp
   trunk/client/elvys-client/src/xmllayoutparser.cpp
   trunk/client/elvys-client/src/xmlpaneldocparser.cpp
Log:
pdf-presentation-branch merged!



Property changes on: trunk/client/elvys-client/src
___________________________________________________________________
Added: svn:mergeinfo
   + /branches/client/pdf-presentation-branch/elvys-client/src:1705-1727
/branches/client/pdf-prezentation-branch/elvys-client/src:1704

Modified: trunk/client/elvys-client/src/Makefile
===================================================================
--- trunk/client/elvys-client/src/Makefile      2010-02-15 07:44:43 UTC (rev 
1727)
+++ trunk/client/elvys-client/src/Makefile      2010-02-15 07:47:27 UTC (rev 
1728)
@@ -1,6 +1,6 @@
 #############################################################################
 # Makefile for building: ../bin/elvys-client
-# Generated by qmake (2.01a) (Qt 4.5.3) on: Wed Feb 10 10:48:49 2010
+# Generated by qmake (2.01a) (Qt 4.5.3) on: Sun Feb 14 20:14:17 2010
 # Project:  src.pro
 # Template: app
 # Command: /usr/bin/qmake -spec /usr/share/qt4/mkspecs/linux-g++ -unix 
CONFIG+=debug_and_release -o Makefile src.pro

Modified: trunk/client/elvys-client/src/abstractmaintainer.cpp
===================================================================
--- trunk/client/elvys-client/src/abstractmaintainer.cpp        2010-02-15 
07:44:43 UTC (rev 1727)
+++ trunk/client/elvys-client/src/abstractmaintainer.cpp        2010-02-15 
07:47:27 UTC (rev 1728)
@@ -59,13 +59,13 @@
                }
                QFile::rename(xmlNameTemp, xmlName);
        } else {
-               qDebug() << "Neco je spatne, soubor " << xmlNameTemp << " 
neexistuje" ;
+               ////qDebug() << "Neco je spatne, soubor " << xmlNameTemp << " 
neexistuje" ;
        }
 }
 
 
 void AbstractMaintainer::readDownloadedXML(QString & id) {
-       qDebug() << Q_FUNC_INFO << "New data!!!" << id;
+       ////qDebug() << Q_FUNC_INFO << "New data!!!" << id;
 
        if ( fileTemp->size() != 0 ) {
                if (! fileTemp->isOpen()) {

Modified: trunk/client/elvys-client/src/appconfigdata.cpp
===================================================================
--- trunk/client/elvys-client/src/appconfigdata.cpp     2010-02-15 07:44:43 UTC 
(rev 1727)
+++ trunk/client/elvys-client/src/appconfigdata.cpp     2010-02-15 07:47:27 UTC 
(rev 1728)
@@ -35,6 +35,7 @@
        palFocused.setColor( QPalette::Light, QColor( 0, 120, 255 ) ); //vnejsi 
vpravo
        palFocused.setColor( QPalette::Dark, QColor( 0, 200, 255 ) ); //vnitrni 
vpravo
        palFocused.setColor( QPalette::Mid, QColor( 0, 80, 255 ) ); //uprostred 
+       palFocused.setColor( QPalette::WindowText, QColor(0, 120, 255));
 }
 
 

Modified: trunk/client/elvys-client/src/autodeleter.cpp
===================================================================
--- trunk/client/elvys-client/src/autodeleter.cpp       2010-02-15 07:44:43 UTC 
(rev 1727)
+++ trunk/client/elvys-client/src/autodeleter.cpp       2010-02-15 07:47:27 UTC 
(rev 1728)
@@ -102,18 +102,18 @@
        _dir = QDir(dirName);
 
        if (! _dir.exists(_dirName)) {
-               qDebug() << Q_FUNC_INFO << "no such directory:" << dirName;
+               ////qDebug() << Q_FUNC_INFO << "no such directory:" << dirName;
                return;
        }
 
 #ifdef Q_OS_UNIX
        struct statvfs stat;
        if ( statvfs(dirName.toLocal8Bit().constData(), &stat) != 0) {
-               qDebug() << Q_FUNC_INFO << "Error getting filesystem size:" << 
strerror(errno);
+               ////qDebug() << Q_FUNC_INFO << "Error getting filesystem size:" 
<< strerror(errno);
                return;
        }
        if (_baseSize == BASE_SIZE_UNDEF) {
-               qDebug() << stat.f_bavail << stat.f_bsize;
+               ////qDebug() << stat.f_bavail << stat.f_bsize;
                _baseSize = (qint64)stat.f_bavail * (qint64)stat.f_bsize;
                _baseSize /=  Q_INT64_C(1024);
        }

Modified: trunk/client/elvys-client/src/category.cpp
===================================================================
--- trunk/client/elvys-client/src/category.cpp  2010-02-15 07:44:43 UTC (rev 
1727)
+++ trunk/client/elvys-client/src/category.cpp  2010-02-15 07:47:27 UTC (rev 
1728)
@@ -174,7 +174,7 @@
 void Category::panelLayoutDestroyed() {
        --panelLayoutsToDestroy;
        if (panelLayoutsToDestroy == 0) {
-               qDebug() << "all panels successfully destroyed";
+               ////qDebug() << "all panels successfully destroyed";
                emit allowNewLayout(true);
        }
 }
@@ -340,7 +340,7 @@
 
        panelLayoutsToDestroy = panels.count();
 
-       qDebug() << "Category" << objectName() << "destroying current layout" ;
+       ////qDebug() << "Category" << objectName() << "destroying current 
layout" ;
 
        foreach(panel, panels) {                        
                panel->destroyLayout();
@@ -443,7 +443,7 @@
        panelsFound.insert(panelId, true);
 
        if ( (panel = findChild<Panel *>(QString::number(panelId))) == NULL ) {
-               qDebug() << "Category" << objectName() << ": no such panel" << 
panelId << ". Creating new one";
+               ////qDebug() << "Category" << objectName() << ": no such panel" 
<< panelId << ". Creating new one";
                panel = newPanel(panelId);
        }
 

Modified: trunk/client/elvys-client/src/categorymaintainerdoc.cpp
===================================================================
--- trunk/client/elvys-client/src/categorymaintainerdoc.cpp     2010-02-15 
07:44:43 UTC (rev 1727)
+++ trunk/client/elvys-client/src/categorymaintainerdoc.cpp     2010-02-15 
07:47:27 UTC (rev 1728)
@@ -43,7 +43,7 @@
        }
 
        //zkusim znovu sosnout novy document
-       qDebug() << Q_FUNC_INFO << " downloading new config.";
+       ////qDebug() << Q_FUNC_INFO << " downloading new config.";
 
        http->downloadPOST("documentConfig", address, xmlNameTemp, userAgent);
 }

Modified: trunk/client/elvys-client/src/categorymaintainerlayout.cpp
===================================================================
--- trunk/client/elvys-client/src/categorymaintainerlayout.cpp  2010-02-15 
07:44:43 UTC (rev 1727)
+++ trunk/client/elvys-client/src/categorymaintainerlayout.cpp  2010-02-15 
07:47:27 UTC (rev 1728)
@@ -45,7 +45,7 @@
        }
 
        //zkusim znovu sosnout novy document
-       qDebug() << Q_FUNC_INFO << " downloading new config.";  
+       ////qDebug() << Q_FUNC_INFO << " downloading new config.";      
 
        http->downloadPOST("categoryConfig", address, xmlNameTemp, userAgent);
 }

Modified: trunk/client/elvys-client/src/categorymanager.cpp
===================================================================
--- trunk/client/elvys-client/src/categorymanager.cpp   2010-02-15 07:44:43 UTC 
(rev 1727)
+++ trunk/client/elvys-client/src/categorymanager.cpp   2010-02-15 07:47:27 UTC 
(rev 1728)
@@ -13,24 +13,24 @@
        connect(catDocMaint, SIGNAL(newCategoryDocuments(int,int)), this, 
SLOT(gotNewCategoryDocuments(int,int)));
        setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
 
-       tabBar = new QTabBar();
-       tabBar->setDocumentMode(true);
-       tabBar->setExpanding(true);     
-       tabBar->setDrawBase(true);
-       setTabBar(tabBar);
+       QString logoFileName = "data/logo.png";
+       tBar = new LogoTabBar(this, logoFileName, "PNG");
+       tBar->setDocumentMode(true);
+       tBar->setExpanding(true);
+       tBar->setDrawBase(true);        
+       setTabBar(tBar);
        setTabPosition(QTabWidget::South);
 
        QFont font;
 
        font.setPointSize(TAB_FONT_SIZE);
-       tabBar->setFont(font);
-
+       tBar->setFont(font);
 }
 
 CategoryManager::~CategoryManager() {
        delete catLayoutMaint;
        delete catDocMaint;
-       delete tabBar;
+       delete tBar;
 }
 
 void CategoryManager::manage() {
@@ -271,7 +271,6 @@
        cat->readDocumentConfig(catDocMaint->fileName(), 
catDocMaint->charOffset(), layId);
 }
 
-
 void CategoryManager::keyPressEvent ( QKeyEvent * event ) {
        int tabCount = count();
 

Modified: trunk/client/elvys-client/src/categorymanager.h
===================================================================
--- trunk/client/elvys-client/src/categorymanager.h     2010-02-15 07:44:43 UTC 
(rev 1727)
+++ trunk/client/elvys-client/src/categorymanager.h     2010-02-15 07:47:27 UTC 
(rev 1728)
@@ -8,8 +8,10 @@
 #include <QMap>
 #include "categorymaintainerdoc.h"
 #include "categorymaintainerlayout.h"
+#include "logotabbar.h"
 #include "category.h"
 
+
 class CategoryManager : public QTabWidget {
        Q_OBJECT
 
@@ -35,9 +37,9 @@
                QStringList getUsedFilesList();
 
        protected:
-               void keyPressEvent ( QKeyEvent * event );
+               void keyPressEvent ( QKeyEvent * event );                       
        
 
-       private:
+       private:                
                void updateFontSize();          
                Category * newCategory(int id, QString &name);
                void manageOrder();
@@ -46,7 +48,7 @@
                CategoryMaintainerDoc * catDocMaint;
                CategoryMaintainerLayout * catLayoutMaint;
 
-               QTabBar * tabBar;
+               LogoTabBar * tBar;
                QMap<int, int> orderMap;
                QList<Category *> categories;
                QMap<int, bool> categoriesFound;

Modified: trunk/client/elvys-client/src/constants.h
===================================================================
--- trunk/client/elvys-client/src/constants.h   2010-02-15 07:44:43 UTC (rev 
1727)
+++ trunk/client/elvys-client/src/constants.h   2010-02-15 07:47:27 UTC (rev 
1728)
@@ -19,7 +19,7 @@
  * recommended size is as much as you can stand :-)
 */
 
-#define PIXMAP_CACHE_LIMIT (1024*800)
+#define PIXMAP_CACHE_LIMIT (1024*200)
 
 /** scale factor for zooming-in and zooming-out*/
 #define SCALE_FACTOR 1.2L
@@ -30,6 +30,8 @@
 /** What is the minimum font size for category and panel descriptions */
 #define TAB_FONT_SIZE 14
 
+#define KEY_SEPERATOR "."
+
 #define ELVYS_VERSION "1.0-b1"
 
 #endif

Modified: trunk/client/elvys-client/src/documentmaintainer.cpp
===================================================================
--- trunk/client/elvys-client/src/documentmaintainer.cpp        2010-02-15 
07:44:43 UTC (rev 1727)
+++ trunk/client/elvys-client/src/documentmaintainer.cpp        2010-02-15 
07:47:27 UTC (rev 1728)
@@ -9,6 +9,7 @@
 #include "statistics.h"
 #include "document.h"
 #include "pdfdocument.h"
+#include "pdfpresentationdocument.h"
 #include "dummydocument.h"
 #include "statictext.h"
 #include "dynamictext.h"
@@ -53,11 +54,17 @@
 
 void DocumentMaintainer::setPages(QString & _toId, QList<int> & _pages, int 
mainPage) {
        //TODO udelat setPages virtualni!!!!
-       PDFDocument * doc = panel->findChild<PDFDocument *>(_toId);
+       /** @todo this is really ugly and should be rewritten using one common 
base to PDFDocuments!
+         */
+
+       PDFDocument * doc = panel->findChild<PDFDocument *>(_toId);     
+       PDFPresentationDocument * doc2 = 
panel->findChild<PDFPresentationDocument *>(_toId);
        if ( doc != NULL) {
                doc->setPages(_pages, mainPage);
+       } else if ( doc2 != NULL) {
+               doc2->setPages(_pages, mainPage);
        } else {
-               qWarning() << "PDF document on position" << _toId << "doesn't 
exist!";
+               qWarning() << "PDF document/presentation on position" << _toId 
<< "doesn't exist!";
        }
 }
 
@@ -81,13 +88,23 @@
        }
 }
 
+void DocumentMaintainer::setPeriod(QString &toId, int period) {
+       PDFPresentationDocument * pdfPres = 
panel->findChild<PDFPresentationDocument *>(toId);
 
+       if ( pdfPres == NULL ) {
+               qWarning() << Q_FUNC_INFO << "PDF Presentation document on 
position" << toId << "doesn't exist!";\
+       } else {
+               pdfPres->setPeriod(period);
+       }
+}
+
+
 void DocumentMaintainer::closeOldDocuments() {
        int id; 
        QString sId;
        QList<int> docIDs = docsToDelete.keys();
 
-       qDebug() << "close all";
+       //qDebug() << "close all";
 
        foreach(id, docIDs) {
                docsToDelete.remove(id);
@@ -105,7 +122,7 @@
                return;
        }
 
-       qDebug() << "closing document" << toId << doc;
+       //qDebug() << "closing document" << toId << doc;
 
        if (doc->isZoomed()) {
                doc->setZoomable(false);
@@ -157,6 +174,10 @@
        }
 }
 
+void DocumentMaintainer::newPDFPresentation(QString & to_id, QString & docId, 
QString & name) {
+       newDownloadableDocument<PDFPresentationDocument>(to_id, docId, name);
+}
+
 void DocumentMaintainer::newPDFDocument(QString & to_id, QString & docId, 
QString & name) {
        newDownloadableDocument<PDFDocument>(to_id, docId, name);
 }
@@ -167,6 +188,7 @@
 
 void DocumentMaintainer::newDownloadableDocument(QString & to_id, QString & 
docId, QString & name) {
        Document * doc = findChild<Document *>(to_id);
+       PDFPresentationDocument * pdfPresentation;
        PDFDocument * pdfDoc;
        VideoDocument * videoDoc;
 
@@ -174,6 +196,8 @@
                newDownloadableDocument<PDFDocument>(to_id, docId, name);
        } else if ( (videoDoc = qobject_cast<VideoDocument *>(doc)) != 0) {
                newDownloadableDocument<VideoDocument>(to_id, docId, name);
+       } else if ( (pdfPresentation = qobject_cast<PDFPresentationDocument 
*>(doc)) != 0) {
+               newDownloadableDocument<PDFPresentationDocument>(to_id, docId, 
name);
        }
 
 }
@@ -219,13 +243,13 @@
 
 void DocumentMaintainer::connectSignals() {
 
-/* POZOR NA TOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO */
-
        connect((XMLDocumentParser *)parser, SIGNAL(setPages(QString &, 
QList<int> &, int)), this, SLOT(setPages(QString &, QList<int> &, int)));
+       connect((XMLDocumentParser *)parser, SIGNAL(setPeriod(QString &, int)), 
this, SLOT(setPeriod(QString&, int)));
        connect((XMLDocumentParser *)parser, SIGNAL(setStartAt(QString &, 
qint64)), this, SLOT(setStartAt(QString&, qint64)));
        connect((XMLDocumentParser *)parser, SIGNAL(setAutoStart(QString &, 
bool)), this, SLOT(setAutoStart(QString&, bool)));
        connect((XMLDocumentParser *)parser, SIGNAL(noneDocument(QString &)), 
this, SLOT (closeDocument(QString & )));
        connect((XMLDocumentParser *)parser, SIGNAL(newPDFDocument(QString &, 
QString &, QString&)), this, SLOT(newPDFDocument(QString &, QString &, 
QString&)));
+       connect((XMLDocumentParser *)parser, SIGNAL(newPDFPresentation(QString 
&, QString &, QString&)), this, SLOT(newPDFPresentation(QString &, QString &, 
QString&)));
        connect((XMLDocumentParser *)parser, SIGNAL(newVideoDocument(QString &, 
QString &, QString&)), this, SLOT(newVideoDocument(QString &, QString &, 
QString&)));
 
        connect((XMLDocumentParser *)parser, SIGNAL(newStaticText(QString&, 
QString&, QString&, int, QString&, QString &)),
@@ -236,11 +260,13 @@
 
 void DocumentMaintainer::disconnectSignals() {
        disconnect((XMLDocumentParser *)parser, SIGNAL(noneDocument(QString&)), 
this, SLOT (closeDocument(QString& )));
+       disconnect((XMLDocumentParser *)parser, SIGNAL(setPeriod(QString &, 
int)), this, SLOT(setPeriod(QString&, int)));
        disconnect((XMLDocumentParser *)parser, SIGNAL(setStartAt(QString &, 
qint64)), this, SLOT(setStartAt(QString&, qint64)));
        disconnect((XMLDocumentParser *)parser, SIGNAL(setAutoStart(QString &, 
bool)), this, SLOT(setAutoStart(QString&, bool)));
        disconnect((XMLDocumentParser *)parser, SIGNAL(setPages(QString&, 
QList<int> &, int)), this, SLOT(setPages(QString&, QList<int> &, int)));
 
        disconnect((XMLDocumentParser *)parser, SIGNAL(newPDFDocument(QString&, 
QString &, QString&)), this, SLOT(newPDFDocument(QString&, QString &, 
QString&)));
+       disconnect((XMLDocumentParser *)parser, 
SIGNAL(newPDFPresentation(QString &, QString &, QString&)), this, 
SLOT(newPDFPresentation(QString &, QString &, QString&)));
        disconnect((XMLDocumentParser *)parser, SIGNAL(newVideoDocument(QString 
&, QString &, QString&)), this, SLOT(newVideoDocument(QString &, QString &, 
QString&)));
        disconnect((XMLDocumentParser *)parser, SIGNAL(newStaticText(QString&, 
QString&, QString&, int, QString&, QString &)),
                this, SLOT(newStaticText(QString&, QString&, QString&, int, 
QString&, QString &)));

Modified: trunk/client/elvys-client/src/documentmaintainer.h
===================================================================
--- trunk/client/elvys-client/src/documentmaintainer.h  2010-02-15 07:44:43 UTC 
(rev 1727)
+++ trunk/client/elvys-client/src/documentmaintainer.h  2010-02-15 07:47:27 UTC 
(rev 1728)
@@ -27,7 +27,9 @@
                void setPages(QString & toId, QList<int> & _pages, int 
mainPage);
                void setAutoStart(QString & toId, bool autoStart);
                void setStartAt(QString & toId, qint64 startAt);
+               void setPeriod(QString & toId, int period);
                void newPDFDocument(QString &, QString &, QString & );
+               void newPDFPresentation(QString & to_id, QString & docId, 
QString & name);
                void newVideoDocument(QString &, QString &, QString & );
                void newDownloadableDocument(QString &, QString &, QString &);
                void newStaticText(QString &, QString&, QString&, int, 
QString&, QString & );

Modified: trunk/client/elvys-client/src/dynamictext.cpp
===================================================================
--- trunk/client/elvys-client/src/dynamictext.cpp       2010-02-15 07:44:43 UTC 
(rev 1727)
+++ trunk/client/elvys-client/src/dynamictext.cpp       2010-02-15 07:47:27 UTC 
(rev 1728)
@@ -112,7 +112,7 @@
        }
 
        _name = name;
-       qDebug() << "LOADING DYNAMIC TEEEEEXT:" << _name;
+       //qDebug() << "LOADING DYNAMIC TEEEEEXT:" << _name;
        text = _name;
        manageFont();
        secondText = false;

Modified: trunk/client/elvys-client/src/elvys.cpp
===================================================================
--- trunk/client/elvys-client/src/elvys.cpp     2010-02-15 07:44:43 UTC (rev 
1727)
+++ trunk/client/elvys-client/src/elvys.cpp     2010-02-15 07:47:27 UTC (rev 
1728)
@@ -30,7 +30,7 @@
 
 
 Elvys::Elvys() {
-       qDebug() << "Creating elvys class...";
+       //qDebug() << "Creating elvys class...";
        layout = new QVBoxLayout();
 
        appMaint = new AppMaintainer(); 
@@ -46,7 +46,7 @@
        this->setLayout(layout);
 
 
-       qDebug() <<  "current thread  (GUI):" << QThread::currentThread();
+       //qDebug() <<  "current thread  (GUI):" << QThread::currentThread();
 
        //documentMaint->maintain();
 
@@ -82,7 +82,7 @@
 void Elvys::keyPressEvent ( QKeyEvent * event ) {      
        switch( event->key()) {
                case Qt::Key_Q:
-                       qDebug() << "Quit requested, closing";
+                       //qDebug() << "Quit requested, closing";
                        exit(0);
                        break;
                default:

Modified: trunk/client/elvys-client/src/filecachemaintainer.cpp
===================================================================
--- trunk/client/elvys-client/src/filecachemaintainer.cpp       2010-02-15 
07:44:43 UTC (rev 1727)
+++ trunk/client/elvys-client/src/filecachemaintainer.cpp       2010-02-15 
07:47:27 UTC (rev 1728)
@@ -52,7 +52,7 @@
        }
 
        //zkusim znovu sosnout novy document
-       qDebug() << Q_FUNC_INFO << " downloading new config.";
+       //qDebug() << Q_FUNC_INFO << " downloading new config.";
 
        http->downloadPOST("fileCacheConfig", address, xmlNameTemp, userAgent);
 }

Modified: trunk/client/elvys-client/src/http.cpp
===================================================================
--- trunk/client/elvys-client/src/http.cpp      2010-02-15 07:44:43 UTC (rev 
1727)
+++ trunk/client/elvys-client/src/http.cpp      2010-02-15 07:47:27 UTC (rev 
1728)
@@ -74,7 +74,7 @@
        }
 
        http->setHost(address.host, address.port);
-       qDebug() << "downloading document " <<  id;
+       //qDebug() << "downloading document " <<  id;
 
        tmpFile = new QFile(realFileName);
 
@@ -106,14 +106,14 @@
 void Http::downloadPOST(const QString & id, const HttpAddress & address, 
QString & fileName, QString & userAgent) {
        mtx.lock();
        if (transfers.contains(id)) { //transfer for this file already exists
-               qDebug() << "HTTP: transfer for id" << id << "already exists" 
<< "(downloading to " << transfers[id]->fileName() << ")";
+               //qDebug() << "HTTP: transfer for id" << id << "already exists" 
<< "(downloading to " << transfers[id]->fileName() << ")";
                mtx.unlock();
                return;
        }               
        mtx.unlock();
 
        if (numDownloads() > MAX_DOWNLOADS) {
-               qDebug() << Q_FUNC_INFO << "There are too many transfers at the 
moment (" << numDownloads() << "), queueing.";
+               //qDebug() << Q_FUNC_INFO << "There are too many transfers at 
the moment (" << numDownloads() << "), queueing.";
                HttpReq req;
                req.address = address;
                req.fileName = fileName;
@@ -159,7 +159,7 @@
 
        uploadsCount++;
 
-       qDebug() << "uploading document " <<  id;
+       //qDebug() << "uploading document " <<  id;
 
        QHttpRequestHeader header("POST", address.path);
 
@@ -186,7 +186,7 @@
 
        mtx.lock();
        if (transfers.contains(id)) { //transfer for this file already exists
-               qDebug() << "HTTP: transfer for id" << id << "already exists";
+               //qDebug() << "HTTP: transfer for id" << id << "already exists";
                mtx.unlock();
                return;
        }
@@ -194,7 +194,7 @@
 
 
        if (numUploads() > MAX_DOWNLOADS) {
-               qDebug() << Q_FUNC_INFO << "There are too many transfers at the 
moment (" << numUploads() << "), queueing.";
+               //qDebug() << Q_FUNC_INFO << "There are too many transfers at 
the moment (" << numUploads() << "), queueing.";
                HttpReq req;
                req.address = address;
                req.id = id;
@@ -226,7 +226,7 @@
 void Http::reqTimeout() {
        
        if ( state() == QHttp::Connected && docDownloads.count() == 0) {
-               qDebug() << "HTTPP: Everything went ok, closing" ;
+               //qDebug() << "HTTPP: Everything went ok, closing" ;
                close();
                return;
        }
@@ -242,7 +242,7 @@
 */
 
 void Http::stateChanged(int state) {
-       //qDebug() << "state changed:" << state;
+       ////qDebug() << "state changed:" << state;
 }
 
 void Http::getDocumentReal(docIdentifier & docIdent) {
@@ -273,11 +273,11 @@
 
        downloadsCount++;
 
-       qDebug() << "getting document " <<  filename;
+       //qDebug() << "getting document " <<  filename;
 
        http->setHost(address.host, address.port);
-       qDebug()<< Q_FUNC_INFO << "Host:" << address.host;
-       qDebug() << Q_FUNC_INFO << "path: " << address.path;
+       //qDebug()<< Q_FUNC_INFO << "Host:" << address.host;
+       //qDebug() << Q_FUNC_INFO << "path: " << address.path;
 
        reqId = http->get(QString(address.path) + "/" + filename, file);
 
@@ -294,7 +294,7 @@
 
        mtx.lock();
        if (transfers.contains(filename)) { //transfer for this file already 
exists
-               qDebug() << Q_FUNC_INFO << "Transfer for " << filename << 
"already exists.";
+               //qDebug() << Q_FUNC_INFO << "Transfer for " << filename << 
"already exists.";
                mtx.unlock();
                return;
        }
@@ -305,7 +305,7 @@
        docIdent.docId = docId; 
 
        if (numDownloads() > MAX_DOWNLOADS) {
-               qDebug() << Q_FUNC_INFO << "There are too many transfers at the 
moment (" << numDownloads() << "), queueing.";
+               //qDebug() << Q_FUNC_INFO << "There are too many transfers at 
the moment (" << numDownloads() << "), queueing.";
                HttpReq req;
                req.address = AppConfig::getInstance()->getDataAddress();
                req.fileName = filename;
@@ -369,8 +369,8 @@
        if ( docDownloads.find(id) != docDownloads.end()) {             
                if (error || (responseHeader.statusCode() != 200)) { //error
                        file = docDownloads[id].file;
-                       qDebug() << Q_FUNC_INFO << "Error downloading document 
filename:" << file->fileName() << "." << http->errorString();
-                       qDebug() << Q_FUNC_INFO << "http status code:" << 
responseHeader.statusCode();
+                       //qDebug() << Q_FUNC_INFO << "Error downloading 
document filename:" << file->fileName() << "." << http->errorString();
+                       //qDebug() << Q_FUNC_INFO << "http status code:" << 
responseHeader.statusCode();
                        file->remove();
                        file->close();
                        delete file;
@@ -395,7 +395,7 @@
                file = transfers[downloads[id]];
                file->close();          
                if (error || (responseHeader.statusCode() != 200)) {
-                       qDebug() << Q_FUNC_INFO << "Error downloading" << 
http->errorString() << ". HTTP code:" << responseHeader.statusCode();
+                       //qDebug() << Q_FUNC_INFO << "Error downloading" << 
http->errorString() << ". HTTP code:" << responseHeader.statusCode();
                        file->remove();
                        delete file;
 

Modified: trunk/client/elvys-client/src/layoutmaintainer.cpp
===================================================================
--- trunk/client/elvys-client/src/layoutmaintainer.cpp  2010-02-15 07:44:43 UTC 
(rev 1727)
+++ trunk/client/elvys-client/src/layoutmaintainer.cpp  2010-02-15 07:47:27 UTC 
(rev 1728)
@@ -48,7 +48,7 @@
                        return;
                }
                newLayoutAllowed = true;
-               qDebug() << "layout maintainer allowed" ;
+               //qDebug() << "layout maintainer allowed" ;
 
                connect((XMLLayoutParser *)parser, SIGNAL(newDocument(QString 
&, QRectF &)), docuManager, SLOT(addLayoutDocument(QString &, QRectF &)));
 
@@ -76,20 +76,20 @@
 
 void LayoutMaintainer::manageIdRevision(int id, int revision) {
        if ( id == layoutID && revision == layoutRevision ) { // seems like 
layout we already have
-               qDebug() << "layout stejne ID a revize" ;
+               //qDebug() << "layout stejne ID a revize" ;
                parser->stopReading(true);
        } else if ( id != layoutID && revision != layoutRevision ) { // new 
layout
-               qDebug() << "layout jine ID i revize" ;
+               //qDebug() << "layout jine ID i revize" ;
                emit layoutAboutToChange();
                emit newIdRevision(id, revision);
        } else if ( id != layoutID ) { //revisions match, but it is just a 
chance
-               qDebug() << "layout jine ID" ;
+               //qDebug() << "layout jine ID" ;
                emit layoutAboutToChange();
                emit newId(id);
 
        } else if ( revision != layoutRevision ) {      //only revision numbers 
are not the same
                                                //but we will still change 
whole layout
-               qDebug() << "layout jina revize" ;
+               //qDebug() << "layout jina revize" ;
                emit layoutAboutToChange();
                emit newRevision(revision);
        }

Copied: trunk/client/elvys-client/src/logotabbar.cpp (from rev 1727, 
branches/client/pdf-presentation-branch/elvys-client/src/logotabbar.cpp)
===================================================================
--- trunk/client/elvys-client/src/logotabbar.cpp                                
(rev 0)
+++ trunk/client/elvys-client/src/logotabbar.cpp        2010-02-15 07:47:27 UTC 
(rev 1728)
@@ -0,0 +1,35 @@
+#include "logotabbar.h"
+
+/** Class constructor.
+  @param parent parent widget
+  @param fileName file name of the image that should be shown on the bar
+  @param format format of the image. Uses the same syntax as Qt functions (see 
QPixmap::load for example)
+  */
+
+LogoTabBar::LogoTabBar(QWidget * parent, QString & fileName, const char * 
format) : QTabBar(parent) {
+       cornerOrigPixmap.load(fileName, format);        
+}
+
+
+/** Reimplementation of resizeEvent. It makes sure that the image is rescaled 
corectlly
+  @param event structure containg information about the event
+  */
+
+void LogoTabBar::resizeEvent(QResizeEvent * event) {
+       cornerPixmap = cornerOrigPixmap.scaled(size(), Qt::KeepAspectRatio, 
Qt::SmoothTransformation);
+       event->ignore();
+}
+
+/** Reimplementation of paintEvent. It actualy does the painting of the image. 
Please note that the original QTabBar::paintEvent is called
+  to preserve the look of potentionaly styled bars.
+  @param event structure containg information about the event
+  */
+
+void LogoTabBar::paintEvent(QPaintEvent * event) {
+       QPainter painter;
+       QTabBar::paintEvent(event);
+       setUsesScrollButtons(false);
+       painter.begin(this);
+       painter.drawPixmap(width() - cornerPixmap.width(), height()- 
cornerPixmap.height(), cornerPixmap);
+       painter.end();
+}

Copied: trunk/client/elvys-client/src/logotabbar.h (from rev 1727, 
branches/client/pdf-presentation-branch/elvys-client/src/logotabbar.h)
===================================================================
--- trunk/client/elvys-client/src/logotabbar.h                          (rev 0)
+++ trunk/client/elvys-client/src/logotabbar.h  2010-02-15 07:47:27 UTC (rev 
1728)
@@ -0,0 +1,29 @@
+#ifndef LOGOTABBAR_H
+#define LOGOTABBAR_H
+
+#include <QTabBar>
+#include <QPaintEvent>
+#include <QResizeEvent>
+#include <QPainter>
+#include <QString>
+
+/** This is fairly simple extension of QTabBar. It is given a picture that 
will be displayed in the right corner of the widget.
+  It has basicaly same purpose as CornerWidget, but in case of using Qt 
StyleSheet feature, it is much more predicable and stable.
+
+  The picture is automatically resized (keeping its aspect ratio) to fill into 
tab bar.
+  */
+
+class LogoTabBar : public QTabBar {
+       public:
+       LogoTabBar(QWidget * widget, QString & fileName, const char * format);
+
+       protected:
+       void paintEvent(QPaintEvent * event);
+       void resizeEvent(QResizeEvent * event);
+
+       private:
+       QPixmap cornerOrigPixmap, cornerPixmap;
+};
+
+
+#endif // LOGOTABBAR_H

Modified: trunk/client/elvys-client/src/main.cpp
===================================================================
--- trunk/client/elvys-client/src/main.cpp      2010-02-15 07:44:43 UTC (rev 
1727)
+++ trunk/client/elvys-client/src/main.cpp      2010-02-15 07:47:27 UTC (rev 
1728)
@@ -42,7 +42,7 @@
                 break;
         }
 
-   line2 = "["+ QTime::currentTime().toString("hh:mm:ss") +"] "+ line2;
+   line2 = "["+ QTime::currentTime().toString("hh:mm:ss.zzz") +"] "+ line2;
    std::cout << line2.toLocal8Bit().data() << std::endl;
 }
 
@@ -61,8 +61,8 @@
        QString fileName = "data/style.css";
        QFile file(fileName);
 
-       qDebug() << "Starting...";              
-       qDebug() << "Setting style sheet";
+       //qDebug() << "Starting...";            
+       //qDebug() << "Setting style sheet";
        if ( ! file.open(QFile::ReadOnly)) {
                qWarning() << "Cannot open file:" << fileName;
        } else {
@@ -76,8 +76,9 @@
 //     Saver * saver = new Saver();
 //     saver->setWidget(&elvys);
 
-       elvys.showFullScreen();
-       //elvys.show();
+//     elvys.showFullScreen();
+       elvys.setGeometry(0,0,400,300);
+       elvys.show();
 
        return app.exec();
 //     QObject::connect(&timer, SIGNAL(timeout()), saver, SLOT(render()));

Modified: trunk/client/elvys-client/src/modechanger.cpp
===================================================================
--- trunk/client/elvys-client/src/modechanger.cpp       2010-02-15 07:44:43 UTC 
(rev 1727)
+++ trunk/client/elvys-client/src/modechanger.cpp       2010-02-15 07:47:27 UTC 
(rev 1728)
@@ -31,7 +31,7 @@
 
        QTime smallerTime = dayMode <= nightMode ? dayMode : nightMode;
 
-       qDebug() << "Checking mode change..." ;
+       //qDebug() << "Checking mode change..." ;
        if (smallerTime == dayMode) {
                if ( currTime >= dayMode && currTime <= nightMode ) {
                        AppConfig::getInstance()->setCurrentMode(Day);

Modified: trunk/client/elvys-client/src/pageselector.h
===================================================================
--- trunk/client/elvys-client/src/pageselector.h        2010-02-15 07:44:43 UTC 
(rev 1727)
+++ trunk/client/elvys-client/src/pageselector.h        2010-02-15 07:47:27 UTC 
(rev 1728)
@@ -9,6 +9,27 @@
                inline bool operator== ( PageSelector & other ) const {
                        return ( other.pageNum == pageNum && other.desSize == 
desSize && other.desc == desc);
                }
+               inline bool operator< (const PageSelector & other ) const {
+                       if ( pageNum == other.pageNum ) {
+                               if ( desSize == other.desSize ) {
+                                       if (desc == other.desc) {
+                                               return false;
+                                       } else {
+                                               return desc < other.desc;
+                                       }
+                               } else {
+                                       //QSize doesnt support operator <, so 
we will "define" one
+                                       if (desSize.width() == 
other.desSize.width()) {
+                                               // height cannot be equal, see 
comparison above
+                                               return desSize.height() < 
other.desSize.height();
+                                       } else {
+                                               return desSize.width() < 
other.desSize.width();
+                                       }
+                               }
+                       } else {
+                               return pageNum < other.pageNum;
+                       }
+               }
 
        int pageNum;
        QSize desSize; //desired size

Modified: trunk/client/elvys-client/src/panel.cpp
===================================================================
--- trunk/client/elvys-client/src/panel.cpp     2010-02-15 07:44:43 UTC (rev 
1727)
+++ trunk/client/elvys-client/src/panel.cpp     2010-02-15 07:47:27 UTC (rev 
1728)
@@ -235,12 +235,12 @@
        int docCount = documents.count();
        int i = 0;
 
-       qDebug() << "destroying current layout" ;
+       //qDebug() << "destroying current layout" ;
 
         while (it != documents.end() ) {
                        doc = *it;
                if ( ! doc->isZoomed() ) {
-                       qDebug() << "destroying document no." << 
doc->objectName();
+                       //qDebug() << "destroying document no." << 
doc->objectName();
                        delete doc;
                        documents.erase(it);
                        i++;

Modified: trunk/client/elvys-client/src/pdfdocument.cpp
===================================================================
--- trunk/client/elvys-client/src/pdfdocument.cpp       2010-02-15 07:44:43 UTC 
(rev 1727)
+++ trunk/client/elvys-client/src/pdfdocument.cpp       2010-02-15 07:47:27 UTC 
(rev 1728)
@@ -54,9 +54,9 @@
 
        connect(pdfFiller, SIGNAL(badPDF(QString )), this, 
SLOT(handleBadPDF(QString )));
 
+       connect(pdfViewer, SIGNAL(imageGenerated(PageSelector)), pdfFiller, 
SLOT(cachePage(PageSelector)));
        //mtx oriented connects
-       connect(pdfFiller, SIGNAL(imageGenerationStarted()), this, 
SLOT(mutexLock()));
-       connect(pdfFiller, SIGNAL(imageGenerationFinished()), this, 
SLOT(mutexUnlock()));
+
        connect(pdfFiller, SIGNAL(pagesAboutToDelete()), this, 
SLOT(mutexLock()));
        connect(pdfFiller, SIGNAL(pagesDeleted()), this, SLOT(mutexUnlock()));
        connect(pdfViewer, SIGNAL(imageGenerationStarted()), this, 
SLOT(mutexLock()));  
@@ -86,7 +86,7 @@
 
        if ( retval)  {
 
-               
pdfFiller->updatePageSizes(AppConfig::getInstance()->getZoomWidth(parentWidget()),
 AppConfig::getInstance()->getZoomHeight(parentWidget()));
+               pdfFiller->updatePageSizes(width(), height(), 
AppConfig::getInstance()->getZoomWidth(parentWidget()), 
AppConfig::getInstance()->getZoomHeight(parentWidget()));
        }
        update();
 }
@@ -101,7 +101,7 @@
                for (int i = 0; i < _pageNumbers.size(); ++i) {
                        if ( pages.at(i)!= _pageNumbers[i]) {
                                same = false;
-                               qDebug() << "PDFFiller Nestejne cisla stranek";
+                               //qDebug() << "PDFFiller Nestejne cisla 
stranek";
                                break;
                        }
                }
@@ -136,7 +136,7 @@
 
 void PDFDocument::mutexLock() {
        if (imgMtx.tryLock() == false) {
-               qDebug() << Q_FUNC_INFO << 
"...........................................POTENTIONAL DEAD LOCK 
PREVENTED!!!!.......................................";
+               //qDebug() << Q_FUNC_INFO << 
"...........................................POTENTIONAL DEAD LOCK 
PREVENTED!!!!.......................................";
                imgMtx.lock();
        }
 }
@@ -200,7 +200,7 @@
        int offset = 2 * area.frameWidth();
 
        pdfFiller->clear();
-       
pdfFiller->updatePageSizes(AppConfig::getInstance()->getZoomWidth(parentWidget()),AppConfig::getInstance()->getZoomHeight(parentWidget())
 -offset);
+       pdfFiller->updatePageSizes(width(), height(), 
AppConfig::getInstance()->getZoomWidth(parentWidget()),AppConfig::getInstance()->getZoomHeight(parentWidget())
 -offset);
        pdfViewer->setGeometry(geometry());
 }
 

Modified: trunk/client/elvys-client/src/pdffiller.cpp
===================================================================
--- trunk/client/elvys-client/src/pdffiller.cpp 2010-02-15 07:44:43 UTC (rev 
1727)
+++ trunk/client/elvys-client/src/pdffiller.cpp 2010-02-15 07:47:27 UTC (rev 
1728)
@@ -52,7 +52,7 @@
                delete pageNormal;
        }
        cache.clear();
-       qDebug() << "pdffiller deleted";
+       //qDebug() << "pdffiller deleted";
 }
 
 
@@ -65,10 +65,10 @@
 void PDFFiller::loadPage(int pageNum, QSize size, QString desc) {
        PageSelector selector;
 
-       qDebug() << "load page triggered" << pageNum << "size" << size << 
"desc:" << desc;
+       //qDebug() << "load page triggered" << pageNum << "size" << size << 
"desc:" << desc;
 
        if (pdf == NULL) {
-               qDebug() << Q_FUNC_INFO << "pdf is not load yet, so I can't 
load requested page no." << pageNum;
+               //qDebug() << Q_FUNC_INFO << "pdf is not load yet, so I can't 
load requested page no." << pageNum;
                return;
        }
 
@@ -121,7 +121,10 @@
   */
 
 void PDFFiller::clearCache() {
+       mutexCond.lock();
+       //qDebug() << "cache size" << cache.keys().size();
        cache.clear();
+       mutexCond.unlock();
 }
 
 /**
@@ -134,20 +137,24 @@
        int limit;
 
        QString fullname = QString(AppConfig::getInstance()->getLocalDataDir()) 
+ filename;
-       
+       mutexCond.lock();
+
        mutexPDF.lock();
        err = pdfLoadFile(&pdf, fullname.toLocal8Bit()); 
        mutexPDF.unlock();
 
        if (err != pdfOk) {
-               qDebug() << "Cannot load PDF file" <<  fullname << ". Is path 
ok?";
+               //qDebug() << "Cannot load PDF file" <<  fullname << ". Is path 
ok?";
                if (QFile::exists(fullname)) {
                        QFile::remove(fullname);
-               }               
+               }
+               mutexToLoad.lock();
                toLoadList.clear();
+               mutexToLoad.unlock();
                ready = false;
                emit badPDF(filename);
                close();
+               mutexCond.unlock();
                return false;
        }
 
@@ -177,10 +184,27 @@
 //     mutexPages->unlock();
 
        restart = false;
+       mutexCond.unlock();
        condition.wakeOne();
        return true;
 }
 
+
+void PDFFiller::cachePage(PageSelector selector) {
+       PDFPage * page;
+
+       mutexCond.lock();
+       if ( pagesNotCached.contains(selector)) {
+               page = pagesNotCached.take(selector);
+               page->height();
+               cache.insert(selector, page, page->getImage()->numBytes() / 
1024);
+               mutexCond.unlock();
+       } else {
+               mutexCond.unlock();
+       }
+}
+
+
 /**
  * Main function of worker thread. This function is called automatically after 
calling start(). 
  * It makes initialization and waits for commands to load pages.
@@ -192,14 +216,14 @@
        int toLoad = -1; ///< page sequence number
        int toLoadReal = -1; ///< real page number in document  
 
-       qDebug() << "tread jede " <<  endl;
+       //qDebug() << "tread jede " <<  endl;
        restart = false;
        if ( ! makeInit() ) {
                QThread::exit();
                return;
        }
 
-       qDebug() << "za initem";
+       //qDebug() << "za initem";
        forever {
                mutexCond.lock();
                // i am woken up here
@@ -207,7 +231,7 @@
                if ( !ready ) {
                        rendering = false;
                        if (quit) {
-                               qDebug() << "PDFFiller: Real quit of working 
thread";
+                               //qDebug() << "PDFFiller: Real quit of working 
thread";
                                mutexCond.unlock();
                                QThread::exit();
                                return;
@@ -233,7 +257,7 @@
                // lets recognize the reason why we were waken up
                if (restart) { 
                        if (isRunning()) {  // we should clean up after ourselfs
-                               qDebug() << "running - uklidim po sobe" ;
+                               //qDebug() << "running - uklidim po sobe" ;
                                mutexPages->lock();
                                pages.clear();
 
@@ -262,7 +286,7 @@
                        mutexCond.unlock();                     
                        continue;
                } else if (quit) {
-                       qDebug() << "REAL QUIT";
+                       //qDebug() << "REAL QUIT";
                        rendering = false;
                        mutexCond.unlock();
                        QThread::exit();
@@ -279,16 +303,21 @@
                toLoadReal = pages[toLoad];
                
 
-               qDebug() << "Rendering PAGE no." << toLoad << "at size" 
<<selector.desSize << "from " << filename;
+               //qDebug() << "Rendering PAGE no." << toLoad << "at size" 
<<selector.desSize << "from " << filename;
 
-               if ( ( page = cache[selector] ) == 0 ) { // still dont have 
this page loaded
-                       qDebug() << "neni, nacitam " << toLoad ;
+               if ( ( page = cache[selector] ) == 0 &&  ! 
pagesNotCached.contains(selector)) { // still dont have this page loaded
+                       //qDebug() << "neni, nacitam " << toLoad ;
                        pageSt = zoom(selector.desSize.width(), 
selector.desSize.height(), Page, toLoadReal);
-                       page = new PDFPage(pageSt.qImg, pageSt.docW, 
pageSt.docH);                      
-                       cache.insert(selector, page, 
page->getImage()->numBytes() / 1024);
-                       emit pageLoaded(selector, page);
+                       if ( pageSt.qImg != NULL ) { //loading was sucessfull
+                               page = new PDFPage(pageSt.qImg, pageSt.docW, 
pageSt.docH);
+                               pagesNotCached.insert(selector, page);
+                               emit pageLoaded(selector, page);
+                       }
                } else {
-                       qDebug() << "je." ;
+                       if (page == 0) { // the page is in pagesNotCached 
hashMap:
+                               page = pagesNotCached[selector];
+                       }
+                       //qDebug() << "je." ;
                        emit pageLoaded(selector, page);
                }               
                toLoadList.remove(toLoad);
@@ -351,7 +380,7 @@
        docW = (int) ((docW72/proportion) + 0.5);
        docH = (int) ((docH72/proportion) + 0.5);
 
-       qDebug() << "new docW x docH:" << docW << "x" << docH;
+       //qDebug() << "new docW x docH:" << docW << "x" << docH;
 }
 
 
@@ -369,9 +398,10 @@
 
 PageStruct PDFFiller::zoom(int w, int h, PDFRender which, int page) {
        PageStruct pageSt;
-       char * pdfImg;
-       double docW72, docH72;
-       int limit;
+       char * pdfImg = NULL;
+       PDFImageHeader hdr;
+       double docW72, docH72;  
+       int retval;
        double dpi = 0;
 
        mutexPDF.lock();
@@ -382,20 +412,19 @@
        normalizeDimensions(docW72, docH72, w, h, pageSt.docW, pageSt.docH, 
dpi);
 
        if ( which == First ) {
-               limit = 1;
                docNormalW = pageSt.docW;
                docNormalH = pageSt.docH;
-       } else if ( which == FirstBig ) {
-               limit = 1;
-       } else if (which == Page) {
-               limit = 1;
        }
 
-       pdfConvertPageToBitmap2(pdf, page, dpi, pdfImageRGB, 0, 4, 0, &hdr, 
&pdfImg);
+       if ( (retval = pdfConvertPageToBitmap2(pdf, page, dpi, pdfImageRGB, 0, 
4, 0, &hdr, &pdfImg)) != pdfOk) {
+               qWarning() << "Error converting page to bitmap!!!!!! Returned 
value:" << retval;
+               pageSt.docH = 0;
+               pageSt.docW = 0;
+               pageSt.qImg = NULL;
+       }       
+
        pageSt.qImg =(uchar *) pdfImg;
-       mutexPDF.unlock();
-//     qImg = convertToQRGB(pdfImg, docW, docH, bpl, QImage::Format_RGB32); // 
nastavi mi qImg
-//     pdfFreeMemory(pdfImg);
+       mutexPDF.unlock();      
        return pageSt;
 }
 
@@ -417,7 +446,7 @@
                for (int i = 0; i < _pages.size(); ++i) {
                        if ( pages.at(i)!= _pages[i]) {
                                same = false;
-                               qDebug() << "PDFFiller Nestejne cisla stranek";
+                               //qDebug() << "PDFFiller Nestejne cisla 
stranek";
                                break;
                        }
                }
@@ -484,11 +513,14 @@
 /** Computes normalized (keep aspect ratio, but stretch as much as possible) 
page dimension for all
   * pages in document
   */
-void PDFFiller::updatePageSizes(int zoomW, int zoomH) {
-       int sumHeight = 0;
+void PDFFiller::updatePageSizes(int w, int h, int zoomedW, int zoomedH) {
+       int sumZoomedHeight = 0;
        int maxWidth = 0;
-       int docW;
-       int docH;
+       int maxHeight = 0;
+       int maxZoomedWidth = 0;
+       int maxZoomedHeight = 0;
+       int docZoomedW, docW;
+       int docZoomedH, docH;
        double docW72, docH72;
        double dpi;
 
@@ -503,17 +535,29 @@
        for (int i = 0; i < pages.size(); ++i) {
                docW72 = pdfGetPageWidth(pdf, pages[i]);
                docH72 = pdfGetPageHeight(pdf, pages[i]);
-               normalizeDimensions(docW72, docH72, zoomW, zoomH, docW, docH, 
dpi);
-               sumHeight += docH;
+               normalizeDimensions(docW72, docH72, zoomedW, zoomedH, 
docZoomedW, docZoomedH, dpi);
+               normalizeDimensions(docW72, docH72, w, h, docW, docH, dpi);
+               sumZoomedHeight += docZoomedH;
+               if (docZoomedW > maxZoomedWidth) {
+                       maxZoomedWidth = docZoomedW;
+               }
                if (docW > maxWidth) {
                        maxWidth = docW;
                }
-               //qDebug() << "Page dimension " << i << docW << docH;
-               emit pageDimension(i, docW, docH);
+               if (docZoomedH > maxZoomedHeight) {
+                       maxZoomedHeight = docZoomedH;
+               }
+               if (docH > maxHeight) {
+                       maxHeight = docH;
+               }
+               ////qDebug() << "Page dimension " << i << docW << docH;
+               emit pageDimension(i, docZoomedW, docZoomedH);
        }
        mutexPDF.unlock();
 
-       emit zoomedSize(maxWidth, sumHeight + SEP_HEIGHT*(pages.size()-1));
+       emit zoomedSize(maxZoomedWidth, sumZoomedHeight + 
SEP_HEIGHT*(pages.size()-1));
+       emit zoomedSizeRect(maxZoomedWidth, maxZoomedHeight);
+       emit sizeRect(maxWidth, maxHeight);
 }
 
 
@@ -565,7 +609,7 @@
        mutexCond.lock(); //wait for worker thread to pause
 
 
-       qDebug() << "loading..." << name;       
+       //qDebug() << "loading..." << name;     
        emit changeReady(false);
        filename = name;
        ready = true;

Modified: trunk/client/elvys-client/src/pdffiller.h
===================================================================
--- trunk/client/elvys-client/src/pdffiller.h   2010-02-15 07:44:43 UTC (rev 
1727)
+++ trunk/client/elvys-client/src/pdffiller.h   2010-02-15 07:47:27 UTC (rev 
1728)
@@ -6,6 +6,7 @@
 #include <QImage>
 #include <QCache>
 #include <QHash>
+#include <QMap>
 #include <QList>
 #include <QWaitCondition>
 #include "document.h"
@@ -44,10 +45,10 @@
                void pageLoaded(PageSelector selector, PDFPage * page);
                void zoomedSize(int width, int height);
                void zoomedSizeFirstPage(int width, int height);
-               void pageDimension(int page, int docW, int docH);
-               void init();
-               void imageGenerationStarted();
-               void imageGenerationFinished();
+               void zoomedSizeRect(int width, int height);
+               void sizeRect(int maxWidth, int maxHeight);
+               void pageDimension(int page, int docW, int docH);               
+               void init();            
                void pagesAboutToDelete();
                void pagesDeleted();
                void badPDF(QString filename);
@@ -55,6 +56,7 @@
 
        public slots:
                void loadPage(int pageNum, QSize size, QString desc);
+               void cachePage(PageSelector  selector);
        public:
 
 
@@ -63,7 +65,7 @@
                ~PDFFiller();
                void load(QString name);
                bool setPages(QList <int> & _pages, int _mainPage);
-               void updatePageSizes(int zoomW, int zoomH);
+               void updatePageSizes(int w, int h, int zoomedW, int zoomedH);
                bool makeInit();
                void clear();
                void close();
@@ -101,8 +103,7 @@
 
 
 // pdf-specific promenne:
-               PDFHandle pdf;
-               PDFImageHeader hdr;
+               PDFHandle pdf;          
 
                int docNormalW;
                int docNormalH;
@@ -110,6 +111,7 @@
                PDFPage * pageNormal;
                
                QCache<PageSelector, PDFPage> cache;
+               QMap<PageSelector, PDFPage *> pagesNotCached;
 };
 
 #endif

Modified: trunk/client/elvys-client/src/pdfpage.cpp
===================================================================
--- trunk/client/elvys-client/src/pdfpage.cpp   2010-02-15 07:44:43 UTC (rev 
1727)
+++ trunk/client/elvys-client/src/pdfpage.cpp   2010-02-15 07:47:27 UTC (rev 
1728)
@@ -40,7 +40,7 @@
  */
 
 PDFPage::~PDFPage() {
-       qDebug() << "DELETING PAGE" ;
+       //qDebug() << "DELETING PAGE";
        delete image;
        pdfFreeMemory(qImg);
 }

Copied: trunk/client/elvys-client/src/pdfpresentationdocument.cpp (from rev 
1727, 
branches/client/pdf-presentation-branch/elvys-client/src/pdfpresentationdocument.cpp)
===================================================================
--- trunk/client/elvys-client/src/pdfpresentationdocument.cpp                   
        (rev 0)
+++ trunk/client/elvys-client/src/pdfpresentationdocument.cpp   2010-02-15 
07:47:27 UTC (rev 1728)
@@ -0,0 +1,196 @@
+#include "pdfpresentationdocument.h"
+
+#include "appconfig.h"
+#include "pageselector.h"
+#include <XpdfRasterizer.h>
+
+PDFPresentationDocument::PDFPresentationDocument(Document * doc, int _docId) : 
Document(doc) {
+
+       docId = _docId; 
+       qRegisterMetaType<PageSelector>( "PageSelector" );
+
+       pdfFiller = new PDFFiller(doc->width(), doc->height());
+       pdfPresViewer = new PDFPresentationViewer(parentWidget(), 
doc->geometry());
+
+       connect(pdfFiller, SIGNAL(requestPages()), this, SLOT(setPages()));
+       connect(pdfFiller, SIGNAL(zoomedSizeRect(int, int)), pdfPresViewer, 
SLOT(setZoomedSize(int, int)));
+       connect(pdfFiller, SIGNAL(sizeRect(int,int)), pdfPresViewer, 
SLOT(setSizeRect(int,int)));
+       connect(pdfFiller, SIGNAL(pageLoaded(PageSelector  , PDFPage *)), 
pdfPresViewer, SLOT(pageReady(PageSelector , PDFPage *)));
+
+       connect(pdfPresViewer, SIGNAL(getPage(int, QSize, QString)), pdfFiller, 
SLOT(loadPage(int, QSize, QString)));
+
+       // event oriented connects
+       connect(pdfPresViewer, SIGNAL(zoomEvent()), this, 
SLOT(zoomEventHandler()));
+       connect(pdfPresViewer, SIGNAL(unZoomEvent()), this, 
SLOT(unZoomEventHandler()));
+
+       connect(pdfFiller, SIGNAL(badPDF(QString )), this, 
SLOT(handleBadPDF(QString )));
+
+       connect(pdfPresViewer, SIGNAL(imageGenerated(PageSelector)), pdfFiller, 
SLOT(cachePage(PageSelector)));
+
+
+       //mtx oriented connects 
+       connect(pdfFiller, SIGNAL(pagesAboutToDelete()), this, 
SLOT(mutexLock()));
+       connect(pdfFiller, SIGNAL(pagesDeleted()), this, SLOT(mutexUnlock()));
+       connect(pdfPresViewer, SIGNAL(imageGenerationStarted()), this, 
SLOT(mutexLock()));
+       connect(pdfPresViewer, SIGNAL(imageGenerationFinished()), this, 
SLOT(mutexUnlock()));
+}
+
+PDFPresentationDocument::~PDFPresentationDocument() {
+       close();
+
+       delete pdfPresViewer;
+       pdfPresViewer = NULL;
+       delete pdfFiller;
+       pdfFiller = NULL;
+}
+
+int PDFPresentationDocument::period() {
+       return pdfPresViewer->period();
+}
+
+void PDFPresentationDocument::setPeriod(int period) {
+       pdfPresViewer->setPeriod(period);
+}
+
+void PDFPresentationDocument::setPages() {
+       bool retval;
+
+       retval = pdfFiller->setPages(pages, pages.first());
+       pdfPresViewer->setPages(pages);
+       if ( retval)  { //there was a change in pages list
+               pdfFiller->updatePageSizes(width(), height(), 
AppConfig::getInstance()->getZoomWidth(parentWidget()), 
AppConfig::getInstance()->getZoomHeight(parentWidget()));
+       }
+       update();
+}
+
+void PDFPresentationDocument::setPages(QList <int> & _pageNumbers, int 
_mainPage) {
+       Q_UNUSED(_mainPage);
+       bool same = true;
+
+       mtx.lock();
+       if (pages.size() < _pageNumbers.size()) {
+               same = false;
+       } else {
+               for (int i = 0; i < _pageNumbers.size(); ++i) {
+                       if ( pages.at(i)!= _pageNumbers[i]) {
+                               same = false;
+                               //qDebug() << "PDFFiller Nestejne cisla 
stranek";
+                               break;
+                       }
+               }
+       }
+
+       if (same) {
+               mtx.unlock();
+               return;
+       }
+// there were some changes
+       pages.clear();
+       for (int i = 0; i < _pageNumbers.size(); ++i) {
+               pages.insert(i, _pageNumbers[i]);
+       }
+
+
+       mtx.unlock();
+
+       setPages();
+}
+
+void PDFPresentationDocument::reLoad() {
+
+       if (pdfPresViewer->isZoomed()) { // je to zoomnute - musim pockat, az 
se to vrati
+               
QTimer::singleShot(AppConfig::getInstance()->getDocumentPeriod()*100, this, 
SLOT(reLoad()));
+       } else {                
+               pdfFiller->load(_name);
+       }
+}
+
+void PDFPresentationDocument::mutexLock() {
+       if (imgMtx.tryLock() == false) {
+               qWarning() << Q_FUNC_INFO << 
"........................................................POTENTIONAL DEAD LOCK 
PREVENTED!!!!............................................................";
+               imgMtx.lock();
+       }
+}
+
+void PDFPresentationDocument::mutexUnlock() {
+       imgMtx.unlock();
+}
+
+void PDFPresentationDocument::load(QString _name, int _docId) {
+       docId = _docId;
+       load(_name);
+}
+
+void PDFPresentationDocument::load(QString name) {
+
+       if ( _name == name ) { //trying to load same pdf document
+               return;
+       }
+
+       _name = name;
+       if (pdfPresViewer->isZoomed()) { // je to zoomnute - musim pockat, az 
se to vrati
+               
QTimer::singleShot(AppConfig::getInstance()->getDocumentPeriod()*100, this, 
SLOT(reLoad()));
+       } else {                
+               pdfFiller->load(_name);
+               pdfPresViewer->load(_name);
+               if (! pdfFiller->isRunning()) {
+                       pdfFiller->start();
+               }
+       }
+}
+
+bool PDFPresentationDocument::isZoomed() {
+       if ( pdfPresViewer ) {
+               return pdfPresViewer->isZoomed();
+       } else {
+               return false;
+       }
+}
+
+void PDFPresentationDocument::setZoomable(bool _zoomable) {
+       if ( pdfPresViewer ) {
+               pdfPresViewer->setZoomable(_zoomable);
+       }
+}
+
+int PDFPresentationDocument::close() {
+       if ( _name != "" ) {
+               pdfPresViewer->close();
+               pdfFiller->close();
+               _name = "";
+               emit exhibitCompleteEvent(docId, objectName().toInt());
+       }
+
+       return 0;
+}
+
+void PDFPresentationDocument::resizeEvent(QResizeEvent *event) {
+       Q_UNUSED(event);                
+
+       pdfFiller->clear();
+       pdfFiller->updatePageSizes(width(), height(), 
AppConfig::getInstance()->getZoomWidth(parentWidget()),AppConfig::getInstance()->getZoomHeight(parentWidget()));
+       pdfPresViewer->setGeometry(geometry());
+}
+
+void PDFPresentationDocument::hideEvent(QHideEvent * event) {  
+       pdfPresViewer->setAutoRotating(false);
+       pdfFiller->clearCache();        
+}
+
+void PDFPresentationDocument::zoomEventHandler() {
+       emit zoomEvent(docId, objectName().toInt());
+}
+
+void PDFPresentationDocument::unZoomEventHandler() {
+       emit unZoomEvent(docId, objectName().toInt());
+}
+
+void PDFPresentationDocument::handleBadPDF(QString filename) {
+       Q_UNUSED(filename);
+       close();
+}
+
+
+QString PDFPresentationDocument::getFileName() {
+       return getName();
+}

Copied: trunk/client/elvys-client/src/pdfpresentationdocument.h (from rev 1727, 
branches/client/pdf-presentation-branch/elvys-client/src/pdfpresentationdocument.h)
===================================================================
--- trunk/client/elvys-client/src/pdfpresentationdocument.h                     
        (rev 0)
+++ trunk/client/elvys-client/src/pdfpresentationdocument.h     2010-02-15 
07:47:27 UTC (rev 1728)
@@ -0,0 +1,57 @@
+#ifndef PDFPRESENTATIONDOCUMENT_H
+#define PDFPRESENTATIONDOCUMENT_H
+
+#include "document.h"
+#include "pdfpresentationviewer.h"
+#include "pdffiller.h"
+#include "pdfpage.h"
+
+class PDFPresentationDocument : public Document {
+       Q_OBJECT
+
+       signals:
+               void exhibitCompleteEvent(int documentId, int layoutPosition);
+
+       public slots:
+               virtual void load(QString name);
+               void load(QString _name, int _docId);
+               void reLoad();
+               void zoomEventHandler();
+               void unZoomEventHandler();
+               void handleBadPDF(QString );
+               void mutexLock();
+               void mutexUnlock();
+               virtual int close();
+               void setPages();
+               void setPages(QList <int>  & _pageNumbers, int mainPage);
+
+       signals:
+               void zoomEvent(int documentId, int layoutPos);
+               void unZoomEvent(int documentId, int layoutPos);
+
+       public:
+               /// @todo delete this constructor
+               PDFPresentationDocument(QWidget * parent, int _x, int _y, int 
_w, int _h);
+               PDFPresentationDocument(Document * doc, int docId);
+               virtual ~PDFPresentationDocument();
+               virtual bool isZoomed();
+               virtual void setZoomable(bool _zoomable);
+               virtual QString getFileName();
+               void setPeriod(int period);
+               int period();
+
+       protected:
+               virtual void resizeEvent(QResizeEvent * event);
+               virtual void hideEvent(QHideEvent *event);
+
+       private:
+               PDFPresentationViewer * pdfPresViewer;
+               PDFFiller * pdfFiller;          
+
+               QList<int> pages;               
+               int docId;
+               QMutex imgMtx;
+               QMutex mtx;
+};
+
+#endif // PDFPRESENTATIONDOCUMENT_H

Copied: trunk/client/elvys-client/src/pdfpresentationviewer.cpp (from rev 1727, 
branches/client/pdf-presentation-branch/elvys-client/src/pdfpresentationviewer.cpp)
===================================================================
--- trunk/client/elvys-client/src/pdfpresentationviewer.cpp                     
        (rev 0)
+++ trunk/client/elvys-client/src/pdfpresentationviewer.cpp     2010-02-15 
07:47:27 UTC (rev 1728)
@@ -0,0 +1,708 @@
+#include <QImage>
+#include <QtGlobal>
+#include <QTest>
+#include <QLabel>
+#include <QPixmap>
+#include <QPainter>
+#include <QPen>
+#include <QFrame>
+#include <QLayout>
+#include <QFont>
+#include <QScrollArea>
+#include <QStylePainter>
+#include <QKeyEvent>
+#include <QScrollBar>
+#include <QPaintEngine>
+
+#include <math.h>
+
+#include "pdfpresentationviewer.h"
+#include "appconfig.h"
+#include "constants.h"
+
+
+PDFPresentationViewer::PDFPresentationViewer(QWidget * parent, const QRect & 
rect) : QLabel (parent) {
+       closed = false;
+       origSize = rect;
+       currentPage = 0;
+       _period = 10;
+       inPageTransition = false;
+       alfa = 0;
+
+       zoomed = false;
+       zoomable = true;
+       toBeZoomed = false;
+
+       alfa = 0;
+       timeOpened = 0; 
+       setGeometry(origSize);
+       setParent(parent);
+       pageKeyBase = "PDF_PRESENTATION_VIEWER";
+       pageKeyCur = "CUR";
+       pageKeyPrev = "PREV";
+       pageKeyNext = "NEXT";
+
+       setSizePolicy(QSizePolicy( QSizePolicy::Ignored, QSizePolicy::Ignored));
+       setFocusPolicy(Qt::StrongFocus);
+
+       connect(&closeWatcher, SIGNAL(timeout()), this, 
SLOT(closeEnlargement()));
+       connect(&fadeEffect, SIGNAL(timeout()), this, SLOT(doFadeEffect()));
+
+       setFrameStyle(QFrame::StyledPanel | QFrame::Plain);
+       setAlignment(Qt::AlignCenter);
+
+       if ( hasFocus() ) {
+               setPalette(AppConfig::getInstance()->getPaletteFocused());
+       }
+       setVisible(true);
+
+       connect(&nextTimer, SIGNAL(timeout()), this, SLOT(nextPageTimer()));
+       nextTimer.start(_period*1000);
+}
+
+PDFPresentationViewer::~PDFPresentationViewer() {
+       closed = true;
+       if (nextTimer.isActive()) {
+               nextTimer.stop();
+       }
+       if (fadeEffect.isActive()) {
+               fadeEffect.stop();
+       }
+       if (closeWatcher.isActive()) {
+               closeWatcher.stop();
+       }
+}
+
+void PDFPresentationViewer::setKeyBase(QString keyBase) {
+       pageKeyBase = keyBase;
+}
+
+/** Returns the change in page numbers that it is queued. For example, it 
returns possitive number, if there are
+  more Next movements than Previous movements. It returns 0 if number of 
changes to Next page and Previous page are equal. It returns exact number;
+
+  @return change in page numbers that is queued
+  */
+
+int PDFPresentationViewer::queuedChange() {
+       ElvysNs::Position movement;
+       int change = 0;
+
+       foreach ( movement, pageChanges) {
+               if (movement == ElvysNs::Next) {
+                       change++;
+               } else if ( movement == ElvysNs::Previous ) {
+                       change --;
+               }
+       }
+
+       return change;
+}
+
+
+QString PDFPresentationViewer::getPageKey(const QSize & size, const QString & 
identifier) {
+       return pageKeyBase + identifier + QString::number(size.width()) + 
KEY_SEPERATOR + QString::number(size.height());
+}
+
+
+/** Request of rendering current page of the document. This page will be 
displayed once rendered.
+  */
+
+void PDFPresentationViewer::getCurrentPage() {
+       emit getPage(currentPage, size(), getPageKey(size(), pageKeyCur));
+}
+
+/** Request the next page of the PDF. This page will NOT be displayed once 
rendered, it will just be cached and ready.
+  If the current page is the last one allowed, it does nothing.
+  */
+
+void PDFPresentationViewer::getNextPage() {
+       if (currentPage != pages.size() -1) { //we are still not at the end
+               emit getPage(currentPage +1, size(), getPageKey(size(), 
pageKeyNext));
+       } else {
+               nextPixmap = QPixmap();
+       }
+}
+
+/** Request the next page of the PDF. This page will NOT be displayed once 
rendered, it will just be cached and ready.
+  If the current page is the first one allowed, it does nothing.
+  */
+
+void PDFPresentationViewer::getPreviousPage() {
+       if ( currentPage != 0 ) { // we are not on the first page
+               emit getPage(currentPage -1, size(), getPageKey(size(), 
pageKeyPrev));
+       } else {
+               previousPixmap = QPixmap();
+       }
+}
+
+void PDFPresentationViewer::previousPage() {
+       if (pages.size() == 0) {
+               return;
+       }
+       if (currentPage == 0) { //we are already on the first page
+               return;
+       }
+       if ( currentPage + queuedChange() <= 0 ) {
+               return;
+       }
+       pageChanges.append(ElvysNs::Previous);
+       manageMovements();
+}
+
+/** Loads and displays previous page. If the current page is the last page of 
the document, it does nothing.
+  */
+
+void PDFPresentationViewer::previousPageReal() {               
+       currentPage -= 1;       
+       pageMovement = ElvysNs::Previous;
+       nextPixmap = currentPixmap;
+       currentPixmap = previousPixmap; 
+       startFadeEffect();
+       getPreviousPage();
+       showPDF();
+}
+
+/** Add request to move to queue
+*/
+
+void PDFPresentationViewer::nextPage() {
+       if (pages.size() == 0) {
+               return;
+       }
+       if (currentPage == pages.size() -1) {
+               return;
+       }
+       if ( currentPage + queuedChange() >= pages.size() - 1 ) {
+               return;
+       }
+       pageChanges.append(ElvysNs::Next);
+       manageMovements();
+}
+
+/** Loads and displays next page. It does not check anything, it is up to 
caller! This function should
+  always be used only throght nextPage().
+  */
+
+void PDFPresentationViewer::nextPageReal() {   
+       currentPage += 1;       
+       pageMovement = ElvysNs::Next;
+       previousPixmap = currentPixmap;
+       currentPixmap = nextPixmap;
+       startFadeEffect();
+       getNextPage();
+       showPDF();
+}
+
+/** This displayes nextPage and also makes sure if timer's period should be 
adjust or not
+ */
+
+void PDFPresentationViewer::nextPageTimer() {
+       if ( nextTimer.interval() != _period * 1000) {
+               nextTimer.setInterval(_period * 1000);
+       }
+
+       if ( currentPage == pages.size() -1 && pageChanges.size() == 0 ) { // 
we reached end of the document already and no movements are queued
+               currentPage = 0;
+               getCurrentPage();
+               getNextPage();
+               getPreviousPage();
+       } else {
+               nextPage();
+       }
+}
+
+void PDFPresentationViewer::startFadeEffect() {
+       inPageTransition = true;
+       if ( ! fadeEffect.isActive()) {
+               fadeEffect.start(20);
+       }
+}
+
+void PDFPresentationViewer::pageReady(PageSelector selector, PDFPage * page) {
+       QPixmap myPixmap;
+       QString key;
+
+       if (closed) {
+               return;
+       }
+
+       if ( ! selector.desc.contains(pageKeyBase)) { //this page was not 
requested by us
+               return;
+       }
+
+       //qDebug() << Q_FUNC_INFO << selector.desc << selector.desSize << 
selector.pageNum;
+
+       if (selector.desc.contains(pageKeyCur)) {
+               key = getPageKey(size(), pageKeyCur);           
+       } else if (selector.desc.contains(pageKeyNext)) {
+               key = getPageKey(size(), pageKeyCur);           
+       } else if (selector.desc.contains(pageKeyPrev)) {
+               key = getPageKey(size(), pageKeyCur);           
+       }
+
+/*     if (QPixmapCache::find(key, myPixmap) == true) { //we have it already
+               return;
+       }
+*/
+
+       emit imageGenerationStarted();
+       myPixmap = QPixmap::fromImage(*page->getImage()); ///< @todo better 
observe this place, as it may fail here (image inside page could have already 
been deleted)
+       emit imageGenerationFinished();
+       emit imageGenerated(selector);
+
+       if (selector.desc.contains(pageKeyCur)) {       
+               QPixmapCache::insert(key, myPixmap);
+               currentPixmap = myPixmap;
+               showPDF();
+               update();
+       } else if (selector.desc.contains(pageKeyNext)) {               
+               QPixmapCache::insert(key, myPixmap);
+               nextPixmap = myPixmap;
+       } else if (selector.desc.contains(pageKeyPrev)) {               
+               QPixmapCache::insert(key, myPixmap);
+               previousPixmap = myPixmap;
+       }
+
+       manageMovements();
+}
+
+/** This is to provide maximum width and height of the pages in the document 
(not necessarily the same page) in normal mode.
+It sets geometry of the widget.
+  @param width maximum width of page in the document
+  @param height maximum height of page in the document
+  */
+
+void PDFPresentationViewer::setSizeRect(int width, int height) {
+       w = width;
+       h = height;     
+}
+
+void PDFPresentationViewer::setZoomedSize(int width, int height) {
+       zoomW = width;
+       zoomH = height;
+}
+
+/**
+  If not zoomed, it sets currentPage to zero and redisplay it. If zoomed, this 
a timer is started to ensure this action will take place
+  as soon as possible.
+  */
+
+void PDFPresentationViewer::reloadPages() {
+       if (zoomed) {
+               QTimer::singleShot(1000, this, SLOT(reloadPages()));            
+       } else {
+               currentPage = 0;
+               getCurrentPage();
+               getNextPage();
+       }
+}
+
+
+/** Sets list of pages to display.
+  * @param _pageNumbers list of pages
+   */
+
+void PDFPresentationViewer::setPages(QList<int> & _pageNumbers) {
+       bool same = true;
+       Page page;
+
+       // do we have the same list, so no change is needed?
+       if (pages.size() < _pageNumbers.size()) {
+               same = false;
+       } else {
+               for (int i = 0; i < _pageNumbers.size(); ++i) {
+                       if ( pages.at(i).num != _pageNumbers[i]) {
+                               same = false;                           
+                               break;
+                       }
+               }
+       }
+
+       if (same) {
+               return;
+       }
+
+       pages.clear();
+
+       page.h = 0;
+       page.w = 0;
+
+       for (int i = 0; i < _pageNumbers.size(); ++i) {
+               page.num = _pageNumbers[i];
+               pages.insert(i,page);
+       }
+
+       //we might be displaying something different now
+       reloadPages();  
+}
+
+
+QRect PDFPresentationViewer::getZoomedGeometry() {
+       int newX;
+       int newY;
+       int overlap = 0;
+       QWidget * parW = parentWidget();                
+
+       int centerX = origSize.x() + origSize.width() / 2; ///< center of my 
widget
+       int zoomWHalf = zoomW / 2; ///< half width of zoomed image
+
+       if ( (overlap = (centerX + zoomWHalf) - parW->width()) > 0 ) { // it 
wouldnt fit the screen! Move left
+               //we know that center needs to be in centerX - overlap
+               //so new docX can be counted from it
+               newX = (centerX - overlap) - zoomWHalf;
+       } else if ( (overlap = (centerX - zoomWHalf)) < 0 ) { //we are of the 
screen
+               newX = 0;
+       } else { //center it
+               newX = centerX - zoomWHalf;
+       }
+
+       if ( (origSize.y() + AppConfig::getInstance()->getZoomHeight(parW)) > 
parW->height() ) {
+               newY = 0;
+       } else {
+               newY = origSize.y();
+       }
+
+       if (zoomH < AppConfig::getInstance()->getZoomHeight(parW) ) {
+               //qDebug() << QRect(newX, newY, zoomW, zoomH);
+               return QRect(newX, newY, zoomW, zoomH);
+       } else {
+               //qDebug() << QRect(newX, newY, zoomW, zoomH);
+               return QRect(newX, newY, zoomW, 
AppConfig::getInstance()->getZoomHeight(parW));
+       }
+}
+
+
+/** Shows zoomed or normal-sized pdf document. This function sets right 
geometry of windows and also sets image to QLabel. Zoomed image is
+  * positioned at the center of widget area, if possible (fits the window), 
otherwise it is moved to the left as needed. Actual
+  * drawing is done in paintEvent.
+  */
+
+void PDFPresentationViewer::showPDF() {        
+
+       setPixmap(currentPixmap);       
+       alfa = 0;
+       if ( ! zoomed) {
+               move(origSize.center().x() - w/2, origSize.center().y() -h/2);
+               setGeometry(x(), y(), w, h);
+       }
+
+       //load also other pages
+       if ( nextPixmap.isNull()) {
+               getNextPage();
+       }
+       if ( previousPixmap.isNull()) {
+               getPreviousPage();
+       }
+
+       update();
+}
+
+void PDFPresentationViewer::keyPressEvent ( QKeyEvent * event ) {
+
+       if ( ! zoomed ) {
+               if ( event->key() == Qt::Key_Return) {                  
+                       zoom();
+               } else {
+                       event->ignore(); // required step, so we can navigate 
in whole kiosk
+               }
+               return;
+       }
+       // zoomed
+       timeOpened = 0; 
+
+       switch (event->key()) {
+               case Qt::Key_Down:              
+                       previousPage();
+                       break;
+               case Qt::Key_Up:
+                       nextPage();
+                       break;
+               case Qt::Key_Left:
+                       previousPage();
+                       break;
+               case Qt::Key_PageUp:
+                       nextPage();
+                       break;
+               case Qt::Key_Right:
+                       nextPage();
+                       break;
+               case Qt::Key_PageDown:
+                       previousPage();
+                       break;          
+               case Qt::Key_Backspace:
+                       unzoom();
+                       break;
+               default:
+                       if (!zoomed) { // do not propagate key events if we are 
zoomed
+                               event->ignore();
+                       }
+       }
+}
+
+/** Stops or start rotating the pages. It does nothing if rotating is already 
stopped/started.
+  @arg enabled wheter rotating of pages should start or stop.
+  */
+void PDFPresentationViewer::setAutoRotating(bool enabled) {
+       if ( ! enabled) {
+               nextTimer.stop();
+       } else {
+               if ( ! nextTimer.isActive()) {
+                       nextTimer.start(_period);
+               }
+       }
+}
+
+
+/** Hide event reimplementation. It stops changing of pages.
+  @param event structure containing event information
+  */
+
+void PDFPresentationViewer::hideEvent(QHideEvent * event) {
+
+
+       nextTimer.stop();
+}
+
+/** Show event reimplementation. It starts changing of pages, if not started 
already
+  @param event structure containing event information
+  */
+
+void PDFPresentationViewer::showEvent(QShowEvent * event) {
+       Q_UNUSED(event);
+
+       if ( ! nextTimer.isActive() ) {
+               nextTimer.start(_period);
+       }
+}
+
+
+void PDFPresentationViewer::unzoom() {
+       if ( zoomed ) {
+               emit unZoomEvent();
+               closeWatcher.stop();
+               timeOpened = 0;
+               zoomed = false;
+               setGeometry(origSize);
+               getCurrentPage();
+               setBorderFocused();
+       }
+}
+
+void PDFPresentationViewer::zoom() {
+       if ( ! zoomed ) {
+               if ( ! zoomable ) {
+                       //qDebug() << "Nemuzu zvetsovat, nejsem ve stavu 
zoomable" ;
+                       return;
+               }
+               emit zoomEvent();
+               closeWatcher.start(1000);               
+               zoomed = true;          
+               setGeometry(getZoomedGeometry());
+               getCurrentPage();
+               setBorder(false);
+               raise();
+               showPDF();
+       }
+}
+
+void PDFPresentationViewer::manageMovements() {
+       if (inPageTransition) {         
+               return;
+       }
+       if ( ! pageChanges.empty() ) {  
+               switch ( pageChanges.takeFirst()) {
+                       case ElvysNs::Next:
+                               nextPageReal();
+                       break;
+                       case ElvysNs::Previous:
+                               previousPageReal();
+                       break;
+                       default:
+                       break;
+               }
+       }
+       if ( ! pageChanges.empty() ) {
+               manageMovements();
+       }
+}
+
+void PDFPresentationViewer::mousePressEvent ( QMouseEvent * event ) {
+       if (event->button() == Qt::LeftButton) {
+               zoom();
+       } else if ( event->button() == Qt::RightButton) {
+               unzoom();
+       }
+}
+
+void PDFPresentationViewer::setBorder(bool focused) {
+       if (focused) {          
+               setFrameStyle(QFrame::Panel | QFrame::Plain);
+               setLineWidth(AppConfig::getInstance()->getAppWidth() / 380);    
        
+               setPalette( AppConfig::getInstance()->getPaletteFocused() );
+       } else {
+               setLineWidth(1);
+               setMidLineWidth(1);
+               setFrameStyle(QFrame::StyledPanel | QFrame::Plain);
+               setPalette( AppConfig::getInstance()->getPaletteNotFocused());
+       }
+}
+
+void PDFPresentationViewer::setBorderFocused() {
+       setBorder(hasFocus());
+}
+
+void PDFPresentationViewer::resizeEvent(QResizeEvent * event) {
+       Q_UNUSED(event);
+
+       if (! zoomed ) { // I might get called in zoomed state          
+
+               origSize = geometry();          
+       }
+
+       getNextPage();
+       getPreviousPage();
+
+       update();
+}
+
+
+void PDFPresentationViewer::focusInEvent( QFocusEvent * event ) {
+       Q_UNUSED(event);
+
+       if ( zoomed ) { //nechceme nastavovat ramecek
+               return;
+       }
+       setBorderFocused();
+}
+
+void PDFPresentationViewer::focusOutEvent( QFocusEvent * event ) {
+       Q_UNUSED(event);
+
+       setBorderFocused();
+       if ( zoomed ) {
+               setFocus();
+       }
+       //qDebug() << event->reason();
+}
+
+void PDFPresentationViewer::doFadeEffect() {           
+       alfa += 25;
+       update();
+}
+
+void PDFPresentationViewer::closeEnlargement() {
+       if ( timeOpened >= AppConfig::getInstance()->getDocumentTimeOut() ) {
+               unzoom();
+       } else {
+               timeOpened++;
+       }
+}
+
+/** Enables or disables zooming
+  @arg _zoomable true if zooming should be enabled, false otherwise
+  */
+
+void PDFPresentationViewer::setZoomable(bool _zoomable) {
+       zoomable = _zoomable;
+}
+
+/** Returns true if widget is zoomed, false otherwise;
+  @return returns true if widget is zoomed, false otherwise;
+  */
+
+bool PDFPresentationViewer::isZoomed() {
+       return zoomed;
+}
+
+void PDFPresentationViewer::stopFadeEffect() {
+       if (fadeEffect.isActive()) {
+               fadeEffect.stop();
+               inPageTransition = false;
+               alfa = 0;
+       }
+       //setPixmap(currentPixmap);
+       update();
+       manageMovements();
+}
+
+void PDFPresentationViewer::paintEvent(QPaintEvent * event) {
+
+       if (inPageTransition) {
+               if (alfa >= 255) {                      
+                       alfa = 255;
+               }
+
+               if ( pixmap() != NULL) {
+                       clear();
+               }
+
+               QPainter painter(this);
+               QPixmap pixmap;         
+
+               if (pageMovement == ElvysNs::Next) {
+                       pixmap = previousPixmap;
+               } else if (pageMovement == ElvysNs::Previous) {
+                       pixmap = nextPixmap;
+               }               
+
+               QPoint change = rect().center() - pixmap.rect().center();       
        
+               QPoint change2 = rect().center() - 
currentPixmap.rect().center();
+
+               painter.drawPixmap(change, pixmap);
+               painter.setOpacity((qreal)alfa / 255.0);
+               painter.drawPixmap(change2, currentPixmap);
+               painter.end();
+
+               if (alfa == 255) {
+                       stopFadeEffect();
+               }
+               QLabel::paintEvent(event);
+       } else {
+               if (pixmap() == NULL) {
+                       setPixmap(currentPixmap);
+               }
+               if ( QPixmapCache::find(getPageKey(size(), pageKeyCur)) == 
false) {
+                       getCurrentPage();
+                       return;
+               }               
+               QLabel::paintEvent(event);
+       }
+}
+
+/** Sets period for presentation (page change). It will take effect at next 
timer's timeout (ie. it will not affect current period immediately)
+  @param period period to be set
+  */
+
+void PDFPresentationViewer::setPeriod(int period) {
+       _period = period;       
+}
+
+int PDFPresentationViewer::period() {
+       return _period;
+}
+
+void PDFPresentationViewer::close() {
+       closed = true;
+       zoomable = false;
+       setPixmap(NULL);
+       setFocusPolicy(Qt::NoFocus);
+       clearFocus();
+       update();
+}
+
+void PDFPresentationViewer::load(QString & filename) {
+       Q_UNUSED(filename);
+
+       zoomable = true;
+       closed = false;
+
+       setFocusPolicy(Qt::StrongFocus);
+       if ( QApplication::focusWidget() == NULL ) {
+               setFocus();
+       } else {
+               if ( qobject_cast<Document *>(QApplication::focusWidget()) == 
NULL ) { //no document has focus
+                       setFocus();
+               }
+       }
+       update();
+}

Copied: trunk/client/elvys-client/src/pdfpresentationviewer.h (from rev 1727, 
branches/client/pdf-presentation-branch/elvys-client/src/pdfpresentationviewer.h)
===================================================================
--- trunk/client/elvys-client/src/pdfpresentationviewer.h                       
        (rev 0)
+++ trunk/client/elvys-client/src/pdfpresentationviewer.h       2010-02-15 
07:47:27 UTC (rev 1728)
@@ -0,0 +1,135 @@
+#ifndef PDFPRESENTATIONVIEWER_H
+#define PDFPRESENTATIONVIEWER_H
+
+#include <QImage>
+#include <QLabel>
+#include <QScrollArea>
+#include <QWidget>
+#include <QPixmapCache>
+#include <QTimer>
+#include <QList>
+#include <QRect>
+
+#include "document.h"
+#include "pageselector.h"
+#include "pdfpage.h"
+#include "page.h"
+
+
+#include <XpdfRasterizer.h>
+
+namespace ElvysNs {
+       enum Position { Next, Current, Previous};
+}
+
+
+/** Trida zodpovedna za spravne zobrazeni pdfdokumentu.....
+ */      
+class PDFPresentationViewer : public QLabel {
+       Q_OBJECT
+
+       signals:
+               void getPage(int pageNum, QSize size, QString desc);            
        
+               void imageGenerationStarted();
+               void imageGenerationFinished();
+               void imageGenerated(PageSelector selector);
+               void unZoomEvent();
+               void zoomEvent();
+
+       public slots:
+               void pageReady(PageSelector selector, PDFPage * page);
+               void setZoomedSize(int, int);
+               void setSizeRect(int, int);
+               void setKeyBase(QString keyBase);
+               void nextPage();
+               void nextPageTimer();
+               void previousPage();
+
+       private slots:
+               void doFadeEffect();
+               void closeEnlargement();
+               void reloadPages();
+
+       public:
+               PDFPresentationViewer(QWidget * parent, const QRect & rect);
+               virtual ~PDFPresentationViewer();
+               bool isZoomed();
+               void setZoomable(bool _zoomable);
+               void close();
+               void load(QString & filename);
+               void setPeriod(int period);
+               int period();
+               void setAutoRotating(bool enabled);
+               void setPages(QList <int> & _pageNumbers);
+
+
+       protected:
+               void mousePressEvent( QMouseEvent * event );
+               void keyPressEvent( QKeyEvent * event );
+               void paintEvent(QPaintEvent * event);
+               void resizeEvent(QResizeEvent * event);
+               void hideEvent(QHideEvent * event);
+               void showEvent(QShowEvent * event);
+               virtual void focusInEvent ( QFocusEvent * event );
+               virtual void focusOutEvent ( QFocusEvent * event );
+
+       private:
+               int queuedChange();
+               void nextPageReal();
+               void previousPageReal();
+               void getNextPage();
+               void getPreviousPage();
+               void getCurrentPage();
+               void manageMovements();
+               void stopFadeEffect();
+               void startFadeEffect();
+               QRect getZoomedGeometry();
+               QString getPageKey(const QSize & size, const QString & 
identifier = "");
+               void zoom();
+               void unzoom();
+               void showPDF();
+               void setBorderFocused();
+               void setBorder(bool focused);           
+
+               QRect origSize;
+               QRect myGeometry;
+               QString pageKeyBase;
+               QString pageKeyCur;
+               QString pageKeyNext;
+               QString pageKeyPrev;
+
+               int currentPage;
+               int _period;
+               bool inPageTransition;
+               bool closed;
+               ElvysNs::Position pageMovement;
+               QList<ElvysNs::Position> pageChanges;
+
+               int w;
+               int h;
+
+               int zoomW; //maximalni sirka
+               int zoomH; //celkova delka
+
+               int pageW; //velikost prvni zvetsene stranky
+               int pageH;
+
+               int timeOpened;
+
+               bool toBeZoomed;
+               bool zoomable; // pokud uz je nactena aspon first page big 
stranka a nejakej ten buffer
+               bool zoomed;
+
+               QVector<Page> pages;
+               int alfa;
+
+
+               QPixmap currentPixmap;
+               QPixmap previousPixmap;
+               QPixmap nextPixmap;             
+               QTimer fadeEffect;
+               QTimer nextTimer;
+               QTimer closeWatcher;
+};
+
+#endif // PDFPRESENTATIONVIEWER_H

Modified: trunk/client/elvys-client/src/pdfviewer.cpp
===================================================================
--- trunk/client/elvys-client/src/pdfviewer.cpp 2010-02-15 07:44:43 UTC (rev 
1727)
+++ trunk/client/elvys-client/src/pdfviewer.cpp 2010-02-15 07:47:27 UTC (rev 
1728)
@@ -29,11 +29,12 @@
        zoomed = false;
        zoomable = true;
        toBeZoomed = false;     
+       closed = false;
 
        scaled = 0;
 
        pdfZoomed = NULL;
-       alfa = 1;
+       alfa = 0;
        timeOpened = 0;
        scroll = NULL;
        setGeometry(origSize);
@@ -78,11 +79,17 @@
                return;
        }       
 
-       qDebug() << Q_FUNC_INFO << selector.desc << selector.desSize << 
selector.pageNum;       
+       if (closed) {
+               return;
+       }
 
+       //qDebug() << Q_FUNC_INFO << selector.desc << selector.desSize << 
selector.pageNum;     
+
        emit imageGenerationStarted();
        myPixmap = QPixmap::fromImage(*page->getImage()); ///< @todo better 
observe this place, as it fails here
        emit imageGenerationFinished(); 
+       emit imageGenerated(selector);
+
        if (selector.desc.contains(SMALL_PAGE_IDENTIFIER)) { //small page
                QPixmapCache::insert(getPageKey(myPixmap.size(), 
SMALL_PAGE_IDENTIFIER) ,myPixmap);
                if ( ! zoomed ) {                       
@@ -195,7 +202,7 @@
                this->setGeometry(rect);
                fadeEffect.start(15);
        } else {                                
-               alfa = 1;
+               alfa = 0;
                if (scroll != NULL ) {
                        QWidget * wid = scroll->takeWidget();
                        
wid->setParent(AppConfig::getInstance()->getMainWidget()); /** This deserves 
comment - this is to prevent zoomEvent to pdfZoomed (==wid) next time it will 
be zoomed.
@@ -219,7 +226,7 @@
 
        if ( ! zoomed ) {
                if ( event->key() == Qt::Key_Return) {
-                       qDebug() << "nekdo mi tu zmackl enter!!!" ;
+                       //qDebug() << "nekdo mi tu zmackl enter!!!" ;
                        zoom();
                } else {
                        event->ignore(); // required step, so we can navigate 
in whole kiosk
@@ -301,13 +308,13 @@
 
 void PDFViewer::zoom() {
        if (pdfZoomed == NULL ) {
-               qDebug() << "Nemuzu zvetsovat, neni nastaveny widget PDFZoomed" 
;
+               //qDebug() << "Nemuzu zvetsovat, neni nastaveny widget 
PDFZoomed" ;
                return;
        }
 
        if ( ! zoomed ) {
                if ( ! zoomable ) {                     
-                       qDebug() << "Nemuzu zvetsovat, nejsem ve stavu 
zoomable" ;
+                       //qDebug() << "Nemuzu zvetsovat, nejsem ve stavu 
zoomable" ;
                        return;
                }
                emit zoomEvent();
@@ -320,7 +327,7 @@
                }
                scaled++;
                emit scale(SCALE_FACTOR);
-               qDebug() << "vertical slider poss:" << 
scroll->verticalScrollBar()->sliderPosition();
+               //qDebug() << "vertical slider poss:" << 
scroll->verticalScrollBar()->sliderPosition();
                //let's take care of image position - we will try to keep focus 
on the middle of an image
                adjustScrollBar(scroll->verticalScrollBar(), SCALE_FACTOR);
                adjustScrollBar(scroll->horizontalScrollBar(), SCALE_FACTOR);
@@ -338,9 +345,8 @@
 
 void PDFViewer::setBorder(bool focused) {
        if (focused) {
-               setFrameStyle(QFrame::Box | QFrame::Raised);
-               setLineWidth(3);
-               setMidLineWidth(3);
+               setFrameStyle(QFrame::Panel | QFrame::Plain);
+               setLineWidth(AppConfig::getInstance()->getAppWidth() / 380);
                setPalette( AppConfig::getInstance()->getPaletteFocused() );
        } else {
                setLineWidth(1);
@@ -472,17 +478,19 @@
 }
 
 void PDFViewer::close() {      
-       zoomable = false;       
-       update();
+       closed = true;
+       zoomable = false;               
        setPixmap(NULL);
        setFocusPolicy(Qt::NoFocus);
        clearFocus();
+       update();
 }
 
 void PDFViewer::load(QString & filename) {
        Q_UNUSED(filename);
 
        zoomable = true;        
+       closed = false;
 
        setFocusPolicy(Qt::StrongFocus);                
        if ( QApplication::focusWidget() == NULL ) {

Modified: trunk/client/elvys-client/src/pdfviewer.h
===================================================================
--- trunk/client/elvys-client/src/pdfviewer.h   2010-02-15 07:44:43 UTC (rev 
1727)
+++ trunk/client/elvys-client/src/pdfviewer.h   2010-02-15 07:47:27 UTC (rev 
1728)
@@ -30,6 +30,7 @@
                void getPage(int pageNum, QSize size, QString desc);
                void imageGenerationStarted();
                void imageGenerationFinished();
+               void imageGenerated(PageSelector selector);
                void unZoomEvent();
                void zoomEvent();
                void scale(double scaleFactor);
@@ -89,6 +90,7 @@
                bool toBeZoomed;
                bool zoomable; // pokud uz je nactena aspon first page big 
stranka a nejakej ten buffer
                bool zoomed;
+               bool closed;
 
 
                int alfa;

Modified: trunk/client/elvys-client/src/pdfzoomed.cpp
===================================================================
--- trunk/client/elvys-client/src/pdfzoomed.cpp 2010-02-15 07:44:43 UTC (rev 
1727)
+++ trunk/client/elvys-client/src/pdfzoomed.cpp 2010-02-15 07:47:27 UTC (rev 
1728)
@@ -281,12 +281,12 @@
 
                mtx.lock();
                if ( QPixmapCache::find ( key, pixmap ) == true ) { // pixmap 
is already there!
-                       qDebug() << "pixmap for" << pageNum << "is already 
there!";
+                       //qDebug() << "pixmap for" << pageNum << "is already 
there!";
                        mtx.unlock();
                        return;
                }
 
-               qDebug() << "pixmap for" << pageNum << "is not yet there";
+               //qDebug() << "pixmap for" << pageNum << "is not yet there";
                QImage * image = page->getImage();
                pixmap = QPixmap::fromImage(*image);
                if ( ! QPixmapCache::insert(key, pixmap))  {
@@ -334,14 +334,14 @@
                for (int i = 0; i < _pageNumbers.size(); ++i) {
                        if ( pages.at(i).num != _pageNumbers[i]) {
                                same = false;
-                               qDebug() << "Nestejne cisla stranek";
+                               //qDebug() << "Nestejne cisla stranek";
                                break;
                        }
                }
        }
 
        if (same) {
-               qDebug() << "Stejne cisla stranek";
+               //qDebug() << "Stejne cisla stranek";
                return;
        }
 

Modified: trunk/client/elvys-client/src/pdfzoomed.h
===================================================================
--- trunk/client/elvys-client/src/pdfzoomed.h   2010-02-15 07:44:43 UTC (rev 
1727)
+++ trunk/client/elvys-client/src/pdfzoomed.h   2010-02-15 07:47:27 UTC (rev 
1728)
@@ -17,8 +17,6 @@
 #include "page.h"
 #include "pageselector.h"
 
-#define KEY_SEPERATOR "."
-
 class PDFZoomed : public QWidget {
        Q_OBJECT
 

Modified: trunk/client/elvys-client/src/screenshooter.cpp
===================================================================
--- trunk/client/elvys-client/src/screenshooter.cpp     2010-02-15 07:44:43 UTC 
(rev 1727)
+++ trunk/client/elvys-client/src/screenshooter.cpp     2010-02-15 07:47:27 UTC 
(rev 1728)
@@ -45,7 +45,7 @@
        QByteArray bytes;
        QBuffer buffer(&bytes);
 
-       qDebug() << "MAKING screenshot!!! " ;
+       //qDebug() << "MAKING screenshot!!! " ;
        buffer.open(QIODevice::WriteOnly);
        pixmap = QPixmap::grabWindow(QApplication::desktop()->winId());
        pixmap = pixmap.scaled (pixmap.size() / 2, Qt::KeepAspectRatio, 
Qt::SmoothTransformation);
@@ -59,6 +59,6 @@
        QString userAgent = QString("Screenshot") + 
QString("%1").arg(AppConfig::getInstance()->getMachineID());
        HttpAddress address = AppConfig::getInstance()->getScreenshotAddress();
 
-       qDebug() << data.size();
+       //qDebug() << data.size();
        uploader->upload(httpId, address, data, userAgent);
 }

Modified: trunk/client/elvys-client/src/serialcontrols.cpp
===================================================================
--- trunk/client/elvys-client/src/serialcontrols.cpp    2010-02-15 07:44:43 UTC 
(rev 1727)
+++ trunk/client/elvys-client/src/serialcontrols.cpp    2010-02-15 07:47:27 UTC 
(rev 1728)
@@ -22,7 +22,7 @@
 
        bool succ = serialPort.open(QIODevice::ReadOnly);
        if ( ! succ ) {
-               qDebug() << "Nemuzu otevrit zarizeni " << 
AppConfig::getInstance()->getSerialPortName().toLocal8Bit().constData() ;
+               //qDebug() << "Nemuzu otevrit zarizeni " << 
AppConfig::getInstance()->getSerialPortName().toLocal8Bit().constData() ;
                quit = true;
                return;
        }

Modified: trunk/client/elvys-client/src/src.pro
===================================================================
--- trunk/client/elvys-client/src/src.pro       2010-02-15 07:44:43 UTC (rev 
1727)
+++ trunk/client/elvys-client/src/src.pro       2010-02-15 07:47:27 UTC (rev 
1728)
@@ -45,7 +45,10 @@
     videodocument.cpp \
     autodeleter.cpp \
     xmlfilecacheparser.cpp \
-    filecachemaintainer.cpp
+    filecachemaintainer.cpp \
+    logotabbar.cpp \
+    pdfpresentationdocument.cpp \
+    pdfpresentationviewer.cpp
 HEADERS += elvys.h \
     pdfdocument.h \
     pdffiller.h \
@@ -93,7 +96,10 @@
     videodocument.h \
     autodeleter.h \
     xmlfilecacheparser.h \
-    filecachemaintainer.h
+    filecachemaintainer.h \
+    logotabbar.h \
+    pdfpresentationdocument.h \
+    pdfpresentationviewer.h
 TEMPLATE = app
 CONFIG += warn_on \
     thread \

Modified: trunk/client/elvys-client/src/statisticsdata.cpp
===================================================================
--- trunk/client/elvys-client/src/statisticsdata.cpp    2010-02-15 07:44:43 UTC 
(rev 1727)
+++ trunk/client/elvys-client/src/statisticsdata.cpp    2010-02-15 07:47:27 UTC 
(rev 1728)
@@ -20,7 +20,7 @@
        ok = db.open();
 
        if ( ! ok ) {
-               qDebug() << "Fatal error: Unable to open database " << 
DATABASE_NAME << ":" << db.lastError().text();
+               //qDebug() << "Fatal error: Unable to open database " << 
DATABASE_NAME << ":" << db.lastError().text();
                exit(1);
        }
 
@@ -30,7 +30,7 @@
        //make sure right table exists:
        ok = query.exec(CREATE_TABLE_QUERY);
        if ( ! ok ) {
-               qDebug() << "Fatal error: Unable to create table " << 
TABLE_NAME << ":" << query.lastError().text();
+               //qDebug() << "Fatal error: Unable to create table " << 
TABLE_NAME << ":" << query.lastError().text();
                exit(1);
        }
 
@@ -40,8 +40,8 @@
 
        ok = queryUpdate.exec();
        if ( ! ok ) {
-               qDebug() << "Query execution failed: " << 
queryUpdate.lastError();
-               qDebug() << queryUpdate.executedQuery();
+               //qDebug() << "Query execution failed: " << 
queryUpdate.lastError();
+               //qDebug() << queryUpdate.executedQuery();
        }
 
 
@@ -139,8 +139,8 @@
 
        ok = query.exec();
        if ( !ok ) {
-               qDebug() << "Query execution failed: " << query.lastError();
-               qDebug() << query.executedQuery();
+               //qDebug() << "Query execution failed: " << query.lastError();
+               //qDebug() << query.executedQuery();
        }
 }
 
@@ -171,8 +171,8 @@
        ok = query.exec();
 
        if ( !ok ) {
-               qDebug() << "Query execution failed: " << query.lastError();
-               qDebug() << query.lastQuery();
+               //qDebug() << "Query execution failed: " << query.lastError();
+               //qDebug() << query.lastQuery();
        }
 }
 
@@ -201,8 +201,8 @@
        ok = query.exec();
 
        if ( !ok ) {
-               qDebug() << "Query execution failed: " << query.lastError();
-               qDebug() << query.executedQuery();
+               //qDebug() << "Query execution failed: " << query.lastError();
+               //qDebug() << query.executedQuery();
        }
 }
 
@@ -225,8 +225,8 @@
        ok = query.exec();
 
        if ( !ok ) {
-               qDebug() << "Query execution failed: " << query.lastError();
-               qDebug() << query.executedQuery();
+               //qDebug() << "Query execution failed: " << query.lastError();
+               //qDebug() << query.executedQuery();
        }
 }
 
@@ -254,8 +254,8 @@
        ok = query.exec();
 
        if ( !ok ) {
-               qDebug() << "Query execution failed: " << query.lastError();
-               qDebug() << query.executedQuery();
+               //qDebug() << "Query execution failed: " << query.lastError();
+               //qDebug() << query.executedQuery();
        }
 }
 
@@ -279,13 +279,13 @@
 
        ok = query.exec();
        if ( !ok ) {
-               qDebug() << "Query execution failed: " << query.lastError();
-               qDebug() << query.executedQuery();
+               //qDebug() << "Query execution failed: " << query.lastError();
+               //qDebug() << query.executedQuery();
        }
 
        if ( ! query.first() ) { //empty query
-               qDebug() << query.executedQuery();
-               qDebug() << documentId << layoutId << layoutPosition << 
AppConfig::getInstance()->getCurrentModeString();
+               //qDebug() << query.executedQuery();
+               //qDebug() << documentId << layoutId << layoutPosition << 
AppConfig::getInstance()->getCurrentModeString();
                query.prepare("INSERT INTO " TABLE_NAME " VALUES " 
INSERT_BINDING);
                query.bindValue(":elvys_id", 
AppConfig::getInstance()->getMachineID());
                query.bindValue(":layout_id", layoutId);
@@ -316,8 +316,8 @@
        }
 
        if ( !ok ) {
-               qDebug() << "Query execution failed: " << query.lastError();
-               qDebug() << query.executedQuery();
+               //qDebug() << "Query execution failed: " << query.lastError();
+               //qDebug() << query.executedQuery();
        }
 }
 
@@ -335,8 +335,8 @@
 
        ok = query.exec("SELECT * FROM " TABLE_NAME " WHERE ( action_end != 0 
OR action_type =\"" EXHIBIT_EVENT "\" ) AND uploading = 0");
        if ( ! ok ) {
-               qDebug() << "Query execution failed: " << query.lastError();
-               qDebug() << query.executedQuery();
+               //qDebug() << "Query execution failed: " << query.lastError();
+               //qDebug() << query.executedQuery();
        }
 
        if ( query.next() == false ) {
@@ -371,14 +371,14 @@
 
        ok = queryUpdate.exec();
        if ( ! ok ) {
-               qDebug() << "Query execution failed: " << 
queryUpdate.lastError();
-               qDebug() << queryUpdate.executedQuery();
+               //qDebug() << "Query execution failed: " << 
queryUpdate.lastError();
+               //qDebug() << queryUpdate.executedQuery();
        }
 
        HttpAddress address = AppConfig::getInstance()->getStatisticsAddress();
        QString userAgent = QString("Statistic") + 
QString("%1").arg(AppConfig::getInstance()->getMachineID());
        uploader->upload(httpId, address, *array, userAgent);
-       qDebug() << array->data();
+       //qDebug() << array->data();
        delete array;
        delete xmlWriter;
 }
@@ -396,8 +396,8 @@
 
        ok = query.exec();
        if ( ! ok ) {
-               qDebug() << "Query execution failed: " << query.lastError();
-               qDebug() << query.executedQuery();
+               //qDebug() << "Query execution failed: " << query.lastError();
+               //qDebug() << query.executedQuery();
        }
 }
 
@@ -414,7 +414,7 @@
 
        ok = query.exec();
        if ( ! ok ) {
-               qDebug() << "Query execution failed: " << query.lastError();
-               qDebug() << query.executedQuery();
+               //qDebug() << "Query execution failed: " << query.lastError();
+               //qDebug() << query.executedQuery();
        }
 }

Modified: trunk/client/elvys-client/src/videodocument.cpp
===================================================================
--- trunk/client/elvys-client/src/videodocument.cpp     2010-02-15 07:44:43 UTC 
(rev 1727)
+++ trunk/client/elvys-client/src/videodocument.cpp     2010-02-15 07:47:27 UTC 
(rev 1728)
@@ -285,10 +285,9 @@
 
 void VideoDocument::setBorder(bool focused) {
        if (focused) {
-               setPalette( AppConfig::getInstance()->getPaletteFocused());
-               setFrameStyle(QFrame::Box | QFrame::Raised);
-               setLineWidth(3);
-               setMidLineWidth(3);
+               setFrameStyle(QFrame::Panel | QFrame::Plain);
+               setLineWidth(AppConfig::getInstance()->getAppWidth() / 380);    
        
+               setPalette( AppConfig::getInstance()->getPaletteFocused() );
        } else {
                setPalette( AppConfig::getInstance()->getPaletteNotFocused());
                setLineWidth(1);

Modified: trunk/client/elvys-client/src/xmlabstractparser.cpp
===================================================================
--- trunk/client/elvys-client/src/xmlabstractparser.cpp 2010-02-15 07:44:43 UTC 
(rev 1727)
+++ trunk/client/elvys-client/src/xmlabstractparser.cpp 2010-02-15 07:47:27 UTC 
(rev 1728)
@@ -62,7 +62,7 @@
                emit readCompleted();
        }
        if ( !stopped && error() ) {
-                qDebug() << "ERROR:" << errorString();
+                //qDebug() << "ERROR:" << errorString();
                 emit readFailed();
        }
        if ( /* ! error() && */ ! stopped ) { // Bug v Qt 4.3.2 [179320]

Modified: trunk/client/elvys-client/src/xmlappparser.cpp
===================================================================
--- trunk/client/elvys-client/src/xmlappparser.cpp      2010-02-15 07:44:43 UTC 
(rev 1727)
+++ trunk/client/elvys-client/src/xmlappparser.cpp      2010-02-15 07:47:27 UTC 
(rev 1728)
@@ -18,7 +18,7 @@
 
 bool XMLAppParser::readXML() {
 
-       qDebug() << "CTU APP XML" ;
+       //qDebug() << "CTU APP XML" ;
 
        while (!atEnd()) {
                readNext();
@@ -32,14 +32,14 @@
                                        break;
                                }
                        } else {
-                               qDebug() << Q_FUNC_INFO << "WTF, jinej XML 
dokument " ;
-                               qDebug() << Q_FUNC_INFO << "Jmeno hlavniho 
elementu: " << name();
-                               qDebug() << attributes().value("elvysVersion");
+                               //qDebug() << Q_FUNC_INFO << "WTF, jinej XML 
dokument " ;
+                               //qDebug() << Q_FUNC_INFO << "Jmeno hlavniho 
elementu: " << name();
+                               //qDebug() << 
attributes().value("elvysVersion");
                                raiseError(QString("Tenhle soubor neni 
AppConfig XML pro Elvys v") + ELVYS_VERSION);
                        }
                }
        }
-       qDebug() << Q_FUNC_INFO << "XML APP docten" ;
+       //qDebug() << Q_FUNC_INFO << "XML APP docten" ;
 
      return !error();
 }
@@ -53,7 +53,7 @@
                readNext();
        
                if (isEndElement()) {
-                       qDebug() << "endelement:" << name();
+                       //qDebug() << "endelement:" << name();
                        break;
                }
        
@@ -64,22 +64,22 @@
                                }
                        } else if (name() == "machine_id") {
                                if ( ! readMachineId() ) { //spatne rozliseni
-                                       readNext();qDebug() << "Chyba pri 
nacitani machine_id!" ;
+                                       readNext();//qDebug() << "Chyba pri 
nacitani machine_id!" ;
                                        return false;
                                }
                        } else if (name() == "data_url") {
                                if ( ! readDataUrl() ) {
-                                       qDebug() << "Chyba pri nacitani 
data_dir!" ;
+                                       //qDebug() << "Chyba pri nacitani 
data_dir!" ;
                                        return false;
                                }                               
                        } else if (name() == "screenshot") {
                                if ( ! readScreenshot() ) {
-                                       qDebug() << "Chyba pri nacitani 
elementu screenshot!" ;
+                                       //qDebug() << "Chyba pri nacitani 
elementu screenshot!" ;
                                        return false;
                                }
                        } else if (name() == "statistics") {
                                if ( ! readStatistics() ) {
-                                       qDebug() << "Chyba pri nacitani 
elementu screenshot!" ;
+                                       //qDebug() << "Chyba pri nacitani 
elementu screenshot!" ;
                                        return false;
                                }
                        } else if (name() == "category_config") {
@@ -100,7 +100,7 @@
                                }
                        } else if (name() == "night_mode") {
                                if ( ! readNightMode() ) {
-                                       qDebug() << "Chyba pri nacitani 
elementu night_mode!" ;
+                                       //qDebug() << "Chyba pri nacitani 
elementu night_mode!" ;
                                        return false;
                                }
                        } else if (name() == "background") {
@@ -108,7 +108,7 @@
                                skipElement();
                                //skipCurrentElement();
                        } else {
-                               qDebug() << Q_FUNC_INFO << "NOT IMPLEMENTED??? 
" << name();
+                               //qDebug() << Q_FUNC_INFO << "NOT 
IMPLEMENTED??? " << name();
                                return false;
                        }
                }

Modified: trunk/client/elvys-client/src/xmlcatdocparser.cpp
===================================================================
--- trunk/client/elvys-client/src/xmlcatdocparser.cpp   2010-02-15 07:44:43 UTC 
(rev 1727)
+++ trunk/client/elvys-client/src/xmlcatdocparser.cpp   2010-02-15 07:47:27 UTC 
(rev 1728)
@@ -5,7 +5,7 @@
 
 bool XMLCatDocParser::readXML() {
 
-       qDebug() << "Ctu Category Doc XML" ;
+       //qDebug() << "Ctu Category Doc XML" ;
        while (!atEnd()) {
                readNext();
                if (isEndElement()) {
@@ -19,13 +19,13 @@
                                        break;
                                }
                        } else {
-                               qDebug() << Q_FUNC_INFO << ":WTF, jinej XML 
dokument " ;
-                               qDebug() << Q_FUNC_INFO << ":Jmeno hlavniho 
elementu: " << name().toString().toLocal8Bit().constData() ;
+                               //qDebug() << Q_FUNC_INFO << ":WTF, jinej XML 
dokument " ;
+                               //qDebug() << Q_FUNC_INFO << ":Jmeno hlavniho 
elementu: " << name().toString().toLocal8Bit().constData() ;
                                raiseError(QString("Tenhle soubor neni 
DocumentCatConfig XML pro Elvys v") + ELVYS_VERSION);
                        }
                }
        }
-       qDebug() << Q_FUNC_INFO<< ":XML docten";
+       //qDebug() << Q_FUNC_INFO<< ":XML docten";
 
        if (error()) {
                qWarning() <<  Q_FUNC_INFO << errorString() << 
characterOffset();

Modified: trunk/client/elvys-client/src/xmlcatlayoutparser.cpp
===================================================================
--- trunk/client/elvys-client/src/xmlcatlayoutparser.cpp        2010-02-15 
07:44:43 UTC (rev 1727)
+++ trunk/client/elvys-client/src/xmlcatlayoutparser.cpp        2010-02-15 
07:47:27 UTC (rev 1728)
@@ -5,7 +5,7 @@
 
 bool XMLCatLayoutParser::readXML() {
 
-       qDebug() << "Ctu Category Layout XML" ; 
+       //qDebug() << "Ctu Category Layout XML" ;       
        while (!atEnd()) {
                readNext();
                if (isEndElement()) {
@@ -19,13 +19,13 @@
                                        break;
                                }
                        } else {
-                               qDebug() << Q_FUNC_INFO <<  "WTF, jinej XML 
dokument " ;
-                               qDebug() << Q_FUNC_INFO <<  "Jmeno hlavniho 
elementu: " << name().toString().toLocal8Bit().constData() ;
+                               //qDebug() << Q_FUNC_INFO <<  "WTF, jinej XML 
dokument " ;
+                               //qDebug() << Q_FUNC_INFO <<  "Jmeno hlavniho 
elementu: " << name().toString().toLocal8Bit().constData() ;
                                raiseError(QString("Tenhle soubor neni 
LayoutCatConfig XML pro Elvys v") + ELVYS_VERSION);
                        }
                }
        }
-       qDebug() << Q_FUNC_INFO <<  "XML file docten";
+       //qDebug() << Q_FUNC_INFO <<  "XML file docten";
 
        if (error()) {
                qWarning() << errorString();

Modified: trunk/client/elvys-client/src/xmldocumentparser.cpp
===================================================================
--- trunk/client/elvys-client/src/xmldocumentparser.cpp 2010-02-15 07:44:43 UTC 
(rev 1727)
+++ trunk/client/elvys-client/src/xmldocumentparser.cpp 2010-02-15 07:47:27 UTC 
(rev 1728)
@@ -22,7 +22,7 @@
        while (!atEnd()) {
                readNext();
                if (isEndElement()) {
-                       qDebug() << Q_FUNC_INFO << "error? :END DOCUMENT:" << 
name().toString().toLocal8Bit().constData() ;
+                       //qDebug() << Q_FUNC_INFO << "error? :END DOCUMENT:" << 
name().toString().toLocal8Bit().constData() ;
                        break;
                }
                if (isStartElement()) {
@@ -31,7 +31,7 @@
                                emit haveLayoutId(layoutId);
                                if ( ! stopped ) { // predchozi commit mohl 
vyvolat stopnuti
                                        if ( ! readDocument()) {
-                                               qDebug() << Q_FUNC_INFO << 
":chyba cteni XML DOC!!!" ;
+                                               //qDebug() << Q_FUNC_INFO << 
":chyba cteni XML DOC!!!" ;
                                                raiseError(QObject::tr("Doslo k 
chybe..."));
                                                break;
                                        } else { // everything goes right, stop 
reading explicitly
@@ -42,13 +42,13 @@
                                        break;
                                }
                        } else {
-                               qDebug() << "WTF, jinej XML dokument " << 
name().toString();
+                               //qDebug() << "WTF, jinej XML dokument " << 
name().toString();
                                QString err = "Tenhle soubor neni Document XML 
pro Elvys v" + QString(ELVYS_VERSION);
                                raiseError(QObject::tr(err.toLocal8Bit()));
                        }
                }
        }
-       qDebug() << "XML DOC docten" ;
+       //qDebug() << "XML DOC docten" ;
 
        return !error();
 }
@@ -68,6 +68,8 @@
                if (isStartElement()) {
                        if (name() == "pdf_doc") {
                                readPDFDocument();
+                       } else if (name() == "pdf_presentation") {
+                               readPDFPresentation();
                        } else if (name() == "html_doc") {
                                readHTMLDocument();
                        } else if (name() == "static_text") {
@@ -81,7 +83,7 @@
                                emit noneDocument(toId);
                                readNext(); // prectu end element
                        } else {
-                               qDebug() << "XMLDocumentParser - NOT 
IMPLEMENTED??? " << name().toString();
+                               //qDebug() << "XMLDocumentParser - NOT 
IMPLEMENTED??? " << name().toString();
                                return false;
                        }
                }
@@ -98,7 +100,7 @@
        bool autoStart = false;
 
        toId = attributes().value("to_id").toString();
-       qDebug() << "ID Video dokumentu je " << toId ;
+       //qDebug() << "ID Video dokumentu je " << toId ;
 
        while (!atEnd()) {
                readNext();
@@ -136,7 +138,7 @@
                                startAt = readElementText().toLongLong();
                                emit setStartAt(toId, startAt);
                        } else {
-                               qDebug() << Q_FUNC_INFO << "NOT IMPLEMENTED???" 
<< name().toString();
+                               //qDebug() << Q_FUNC_INFO << "NOT 
IMPLEMENTED???" << name().toString();
                                return false;
                        }
                }
@@ -151,7 +153,7 @@
        Q_ASSERT(isStartElement() && name() == "pdf_doc");
 
        toId = attributes().value("to_id").toString();
-       qDebug() << "ID PDF dokumentu je " << toId ;
+       //qDebug() << "ID PDF dokumentu je " << toId ;
        
        while (!atEnd()) {
                readNext();
@@ -180,7 +182,7 @@
                                readElementText();
                                readNext(); // end element
                        } else {
-                               qDebug() << Q_FUNC_INFO << "NOT IMPLEMENTED???" 
<< name().toString();
+                               //qDebug() << Q_FUNC_INFO << "NOT 
IMPLEMENTED???" << name().toString();
                                return false;
                        }
                }
@@ -188,6 +190,64 @@
        return true;
 }
 
+
+bool XMLDocumentParser::readPDFPresentation() {
+       QString filename;
+       QString docId;
+       int period = 0;
+       Q_ASSERT(isStartElement() && name() == "pdf_presentation");
+
+       toId = attributes().value("to_id").toString();
+       //qDebug() << "ID PDF presentation is " << toId ;
+
+       while (!atEnd()) {
+               readNext();
+
+               if (isEndElement()) {
+                       break;
+               }
+
+               if (isStartElement()) {
+                       if (name() == "id") {
+                               docId = readElementText();
+                               if ( docId != "" && filename != "") {
+                                       emit newPDFPresentation(toId, docId, 
filename);
+                               }
+                               readNext();
+                       } else if (name() == "name") {
+                               filename = readElementText();
+                               if ( docId != "" && filename != "") {
+                                       emit newPDFPresentation(toId, docId, 
filename);
+                               }
+                               readNext(); //end element
+                       } else if (name() == "pages") {
+                               readPages();
+                       } else if (name() == "period") {
+                               period = readPeriod();
+                               if ( docId != "" && filename != "") {
+                                       emit newPDFPresentation(toId, docId, 
filename);
+                               }
+                               emit setPeriod(toId, period);
+                       } else if (name() == "orig-name") {
+                         //ignore it now
+                               readElementText();
+                               readNext(); // end element
+                       } else {
+                               //qDebug() << Q_FUNC_INFO << "NOT 
IMPLEMENTED???" << name().toString();
+                               return false;
+                       }
+               }
+       }
+       return true;
+}
+
+int XMLDocumentParser::readPeriod() {
+       Q_ASSERT(isStartElement() && name() == "period");
+
+       return readElementText().toInt();
+       readNext(); //end element
+}
+
 bool XMLDocumentParser::readHTMLDocument() {
        skipElement();
        //skipCurrentElement();
@@ -218,7 +278,7 @@
                                mainPage = readElementText().toInt();
                                readNext(); //end element
                        } else {
-                               qDebug() << "XMLDocumentParser - NOT 
IMPLEMENTED - readpages ??? " << name().toString().toLocal8Bit().constData() ;
+                               //qDebug() << "XMLDocumentParser - NOT 
IMPLEMENTED - readpages ??? " << name().toString().toLocal8Bit().constData() ;
                                return false;
                        }
                }
@@ -280,12 +340,12 @@
        if (! attributes().value("bgcolor").isNull()) {
                colorNameBg = attributes().value("bgcolor").toString();
        }
-       qDebug() << "ID Static textu je " << toId ;
+       //qDebug() << "ID Static textu je " << toId ;
        
        text = readElementText();
        readNext();
 
-       qDebug() << "emiting loadstatictext" ;
+       //qDebug() << "emiting loadstatictext" ;
        emit newStaticText(toId, text, fontName, size, colorName, colorNameBg);
        return true;
 }
@@ -319,7 +379,7 @@
        if (! attributes().value("order").isNull()) {
                order = attributes().value("order").toString();
        }
-       qDebug() << "ID Dynamic textu je " << toId ;
+       //qDebug() << "ID Dynamic textu je " << toId ;
        
        text = readElementText();
        readNext();

Modified: trunk/client/elvys-client/src/xmldocumentparser.h
===================================================================
--- trunk/client/elvys-client/src/xmldocumentparser.h   2010-02-15 07:44:43 UTC 
(rev 1727)
+++ trunk/client/elvys-client/src/xmldocumentparser.h   2010-02-15 07:47:27 UTC 
(rev 1728)
@@ -15,6 +15,8 @@
        signals:
                void setPages(QString & toId, QList<int> & _pages, int 
mainPage);
                void newPDFDocument(QString & toId, QString & docId, QString & 
_name);
+               void newPDFPresentation(QString & toId, QString & docId, 
QString & _name);
+               void setPeriod(QString & toId, int period);
                void setAutoStart(QString & toId, bool autoStart);
                void setStartAt(QString & toId, qint64 startAt);
                void newVideoDocument(QString & toId, QString & docId, QString 
& _name);
@@ -33,11 +35,13 @@
                bool readDocument();
                QString readName();
                bool readPDFDocument();
+               bool readPDFPresentation();
                bool readHTMLDocument();
                bool readStaticText();
                bool readVideo();
                bool readDynamicText();
                bool readPages();
+               int readPeriod();
 
                QList<int> readPage();
 

Modified: trunk/client/elvys-client/src/xmlfilecacheparser.cpp
===================================================================
--- trunk/client/elvys-client/src/xmlfilecacheparser.cpp        2010-02-15 
07:44:43 UTC (rev 1727)
+++ trunk/client/elvys-client/src/xmlfilecacheparser.cpp        2010-02-15 
07:47:27 UTC (rev 1728)
@@ -9,7 +9,7 @@
 }
 
 bool XMLFileCacheParser::readXML() {
-       qDebug() << "CTU APP XML" ;
+       //qDebug() << "CTU APP XML" ;
 
        while (!atEnd()) {
                readNext();
@@ -20,14 +20,14 @@
                        if (name() == "file-cache-config" && 
attributes().value("elvysVersion") == ELVYS_VERSION ) {
                                readFileCacheConfig();
                        } else {
-                               qDebug() << Q_FUNC_INFO << "WTF, jinej XML 
dokument " ;
-                               qDebug() << Q_FUNC_INFO << "Jmeno hlavniho 
elementu: " << name();
-                               qDebug() << attributes().value("elvysVersion");
+                               //qDebug() << Q_FUNC_INFO << "WTF, jinej XML 
dokument " ;
+                               //qDebug() << Q_FUNC_INFO << "Jmeno hlavniho 
elementu: " << name();
+                               //qDebug() << 
attributes().value("elvysVersion");
                                raiseError(QString("Tenhle soubor neni 
AppConfig XML pro Elvys v") + ELVYS_VERSION);
                        }
                }
        }
-       qDebug() << Q_FUNC_INFO << "XML APP docten" ;
+       //qDebug() << Q_FUNC_INFO << "XML APP docten" ;
 
        return !error();
 }
@@ -47,7 +47,7 @@
                        if (name() == "file") {
                                readFile();
                        } else {
-                               qDebug() << Q_FUNC_INFO << "NOT IMPLEMENTED??? 
" << name();
+                               //qDebug() << Q_FUNC_INFO << "NOT 
IMPLEMENTED??? " << name();
                                QString errMsg = "Unexpected element: ";
                                errMsg.append(name());
                                raiseError(errMsg);

Modified: trunk/client/elvys-client/src/xmllayoutparser.cpp
===================================================================
--- trunk/client/elvys-client/src/xmllayoutparser.cpp   2010-02-15 07:44:43 UTC 
(rev 1727)
+++ trunk/client/elvys-client/src/xmllayoutparser.cpp   2010-02-15 07:47:27 UTC 
(rev 1728)
@@ -40,7 +40,7 @@
                                emit haveIdRevision(id, revision);
                                if ( ! stopped ) { // somebody might stop me 
based on same ID
                                        if ( ! readLayout()) {
-                                               qDebug() << "LayoutParser: 
doslo k chybe..." ;
+                                               //qDebug() << "LayoutParser: 
doslo k chybe..." ;
                                                raiseError(QObject::tr("Blize 
nespecifikovana chyba ;-)"));
                                                break;
                                        } else { // everything goes right, stop 
reading explicitly
@@ -48,15 +48,15 @@
                                        }
                                }
                        } else {
-                               qDebug() << Q_FUNC_INFO << "WTF, jinej XML 
dokument " ;
-                               qDebug() << Q_FUNC_INFO << "Jmeno hlavniho 
elementu: " << name();
+                               //qDebug() << Q_FUNC_INFO << "WTF, jinej XML 
dokument " ;
+                               //qDebug() << Q_FUNC_INFO << "Jmeno hlavniho 
elementu: " << name();
                                QString err = "Tenhle soubor neni Layout XML 
pro Elvys v" + QString(ELVYS_VERSION);
                                raiseError(QObject::tr(err.toLocal8Bit()));
                        }
                }
        }
 
-       qDebug() << Q_FUNC_INFO << "xml docteno";
+       //qDebug() << Q_FUNC_INFO << "xml docteno";
 
        if ( !stopped && error() ) {
                qWarning() << Q_FUNC_INFO << errorString();
@@ -72,20 +72,20 @@
                readNext();
        
                if (isEndElement()) {
-                       qDebug() << Q_FUNC_INFO << "end element: " <<  name();
+                       //qDebug() << Q_FUNC_INFO << "end element: " <<  name();
                        break;
                }
        
                if (isStartElement()) {
                        if (name() == "aspect-ratio") {
                                if ( ! readAspectRatio() ) { //spatne rozliseni
-                                       qDebug() << "WARNING Spatne rozliseni 
layoutu, nesedi to na moje rozliseni!" ;
+                                       //qDebug() << "WARNING Spatne rozliseni 
layoutu, nesedi to na moje rozliseni!" ;
                                        //return false;
                                }
                        } else if (name() == "doc") {
                                readDocument();
                        } else {
-                               qDebug() << "XMLLayoutParser - NOT 
IMPLEMENTED??? " << name().toString().toLocal8Bit().constData();
+                               //qDebug() << "XMLLayoutParser - NOT 
IMPLEMENTED??? " << name().toString().toLocal8Bit().constData();
                                return false;
                        }
                }
@@ -95,7 +95,7 @@
 
 bool XMLLayoutParser::readAspectRatio() {
        bool returnValue;
-       qDebug() << "App width: " << 
QString("%1").arg(AppConfig::getInstance()->getAppWidth()).toLocal8Bit().constData();
+       //qDebug() << "App width: " << 
QString("%1").arg(AppConfig::getInstance()->getAppWidth()).toLocal8Bit().constData();
        Q_ASSERT(isStartElement() && name() == "aspect-ratio");
 
        double aspectR = AppConfig::getInstance()->getAppWidth() / 
(double)AppConfig::getInstance()->getAppHeight();

Modified: trunk/client/elvys-client/src/xmlpaneldocparser.cpp
===================================================================
--- trunk/client/elvys-client/src/xmlpaneldocparser.cpp 2010-02-15 07:44:43 UTC 
(rev 1727)
+++ trunk/client/elvys-client/src/xmlpaneldocparser.cpp 2010-02-15 07:47:27 UTC 
(rev 1728)
@@ -5,7 +5,7 @@
 
 bool XMLPanelDocParser::readXML() {
 
-       qDebug() << "Ctu Panel Doc XML" ;
+       ////qDebug() << "Ctu Panel Doc XML" ;
        while (!atEnd()) {
                readNext();
 
@@ -22,13 +22,13 @@
                                        break;
                                }
                        } else {
-                               qDebug() << Q_FUNC_INFO << "WTF, jinej XML 
dokument " ;
-                               qDebug() << Q_FUNC_INFO << "Jmeno hlavniho 
elementu: " << name().toString().toLocal8Bit().constData() ;
+                               ////qDebug() << Q_FUNC_INFO << "WTF, jinej XML 
dokument " ;
+                               ////qDebug() << Q_FUNC_INFO << "Jmeno hlavniho 
elementu: " << name().toString().toLocal8Bit().constData() ;
                                raiseError(QString("Tenhle soubor neni 
DocumentCatPanelConfig XML pro Elvys v") + ELVYS_VERSION);
                        }
                }
        }
-       qDebug() << "XML Panel Doc docten";
+       ////qDebug() << "XML Panel Doc docten";
 
        if (error()) {
                qWarning() << Q_FUNC_INFO << errorString();


Other related posts:

  • » [elvystrac] r1728 - pdf-presentation-branch merged! - elvys