fixed spaces/tabs mix

This commit is contained in:
Luis Ángel San Martín 2013-08-24 10:30:54 +02:00
parent fa19b4b1ea
commit cd43bd791a
73 changed files with 1337 additions and 1343 deletions

View File

@ -17,21 +17,21 @@ public:
Bookmark():lastPage(0){};
friend QDataStream & operator<< ( QDataStream & out, const Bookmark & bm )
{
out << bm.lastPage;
out << bm.bookmarks;
out << bm.added;
return out;
}
out << bm.lastPage;
out << bm.bookmarks;
out << bm.added;
return out;
}
friend QDataStream & operator>> ( QDataStream & in, Bookmark & bm )
{
in >> bm.lastPage;
in >> bm.bookmarks;
in >> bm.added;
return in;
}
in >> bm.lastPage;
in >> bm.bookmarks;
in >> bm.added;
return in;
}
};
BookmarksList():numMaxBookmarks(400){}
BookmarksList():numMaxBookmarks(400){}
void load();
void save();
void add(const QString & comicID, const Bookmark & b);
@ -46,32 +46,32 @@ private:
class Bookmarks : public QObject
{
Q_OBJECT
Q_OBJECT
protected:
QString comicPath;
//bookmarks setted by the user
QMap<int,QImage> bookmarks;
QList<int> latestBookmarks;
//last page readed
int lastPageIndex;
QImage lastPage;
BookmarksList list;
protected:
QString comicPath;
//bookmarks setted by the user
QMap<int,QImage> bookmarks;
QList<int> latestBookmarks;
//last page readed
int lastPageIndex;
QImage lastPage;
BookmarksList list;
QDateTime added;
public:
Bookmarks();
void setLastPage(int index,const QImage & page);
void setBookmark(int index,const QImage & page);
void removeBookmark(int index);
QList<int> getBookmarkPages() const;
QImage getBookmarkPixmap(int page) const;
QImage getLastPagePixmap() const;
int getLastPage() const;
bool isBookmark(int page);
bool imageLoaded(int page);
void newComic(const QString & path);
void clear();
public:
Bookmarks();
void setLastPage(int index,const QImage & page);
void setBookmark(int index,const QImage & page);
void removeBookmark(int index);
QList<int> getBookmarkPages() const;
QImage getBookmarkPixmap(int page) const;
QImage getLastPagePixmap() const;
int getLastPage() const;
bool isBookmark(int page);
bool imageLoaded(int page);
void newComic(const QString & path);
void clear();
void save();
bool load(const QList<int> & bookmarkIndexes, int lastPage);

View File

@ -10,17 +10,17 @@
#include "bookmarks.h"
BookmarksDialog::BookmarksDialog(QWidget * parent)
:QDialog(parent)
:QDialog(parent)
{
setModal(true);
setModal(true);
//animation = new QPropertyAnimation(this,"windowOpacity");
//animation->setDuration(150);
QHBoxLayout * layout = new QHBoxLayout();
QHBoxLayout * layout = new QHBoxLayout();
//bookmarks
QGridLayout * bookmarksL = new QGridLayout();
//bookmarks
QGridLayout * bookmarksL = new QGridLayout();
pages.push_back(new QLabel(tr("Lastest Page")));
for(int i=0;i<3;i++)
@ -35,10 +35,10 @@ BookmarksDialog::BookmarksDialog(QWidget * parent)
int heightDesktopResolution = QApplication::desktop()->screenGeometry().height();
int height,width;
height = heightDesktopResolution*0.50;
width = height*0.65;
height = heightDesktopResolution*0.50;
width = height*0.65;
coverSize = QSize(width,height);
coverSize = QSize(width,height);
for(int i=0;i<4;i++)
{
@ -57,32 +57,32 @@ BookmarksDialog::BookmarksDialog(QWidget * parent)
bookmarksL->addWidget(images.at(i+1),1,i,Qt::AlignCenter);
//last page
QGridLayout * lp = new QGridLayout();
lp->addWidget(pages.at(0),0,0,Qt::AlignCenter);
lp->addWidget(images.at(0),1,0,Qt::AlignCenter);
//last page
QGridLayout * lp = new QGridLayout();
lp->addWidget(pages.at(0),0,0,Qt::AlignCenter);
lp->addWidget(images.at(0),1,0,Qt::AlignCenter);
layout->addLayout(bookmarksL);
QFrame *f = new QFrame( this );
f->setFrameStyle( QFrame::VLine | QFrame::Sunken );
layout->addWidget(f);
layout->addLayout(lp);
layout->addLayout(bookmarksL);
QFrame *f = new QFrame( this );
f->setFrameStyle( QFrame::VLine | QFrame::Sunken );
layout->addWidget(f);
layout->addLayout(lp);
QHBoxLayout * buttons = new QHBoxLayout();
QHBoxLayout * buttons = new QHBoxLayout();
cancel = new QPushButton(tr("Close"));
//cancel->setFlat(true);
connect(cancel,SIGNAL(clicked()),this,SLOT(hide()));
buttons->addStretch();
buttons->addWidget(cancel);
cancel = new QPushButton(tr("Close"));
//cancel->setFlat(true);
connect(cancel,SIGNAL(clicked()),this,SLOT(hide()));
buttons->addStretch();
buttons->addWidget(cancel);
cancel->setStyleSheet("QPushButton {color:white; border:1px solid #BBBBBB; padding:3px 5px 3px 5px;}");
QVBoxLayout * l = new QVBoxLayout();
QVBoxLayout * l = new QVBoxLayout();
l->addWidget(new QLabel("<font color=\"#FFFFFF\">"+tr("Click on any image to go to the bookmark")+"</font>"),0,Qt::AlignCenter);
l->addLayout(layout);
//l->addLayout(buttons);
l->addLayout(layout);
//l->addLayout(buttons);
QPalette Pal(palette());
// set black background
@ -95,9 +95,9 @@ BookmarksDialog::BookmarksDialog(QWidget * parent)
void BookmarksDialog::setBookmarks(const Bookmarks & bm)
{
lastPage = bm.getLastPage();
if (lastPage > 0)
{
lastPage = bm.getLastPage();
if (lastPage > 0)
{
QPixmap p = QPixmap::fromImage(bm.getLastPagePixmap());
if(p.isNull())
{
@ -109,16 +109,16 @@ void BookmarksDialog::setBookmarks(const Bookmarks & bm)
images.at(0)->setAlignment(Qt::AlignHCenter|Qt::AlignBottom);
images.at(0)->setPixmap(p.scaled(coverSize,Qt::KeepAspectRatio,Qt::SmoothTransformation));
}
}
}
else
{
images.at(0)->setAlignment(Qt::AlignHCenter|Qt::AlignVCenter);
images.at(0)->setPixmap(QPixmap(":/images/notCover.png").scaled(coverSize,Qt::KeepAspectRatio,Qt::SmoothTransformation));
images.at(0)->setPixmap(QPixmap(":/images/notCover.png").scaled(coverSize,Qt::KeepAspectRatio,Qt::SmoothTransformation));
}
QList<int> l = bm.getBookmarkPages();
int s = l.count();
QList<int> l = bm.getBookmarkPages();
int s = l.count();
for(int i=0;i<s;i++)
{
pages.at(i+1)->setText(QString::number(l.at(i)+1));
@ -138,7 +138,7 @@ void BookmarksDialog::setBookmarks(const Bookmarks & bm)
{
pages.at(i+1)->setText("-");
images.at(i+1)->setAlignment(Qt::AlignHCenter|Qt::AlignVCenter);
images.at(i+1)->setPixmap(QPixmap(":/images/notCover.png").scaled(coverSize,Qt::KeepAspectRatio,Qt::SmoothTransformation));
images.at(i+1)->setPixmap(QPixmap(":/images/notCover.png").scaled(coverSize,Qt::KeepAspectRatio,Qt::SmoothTransformation));
}
}

View File

@ -11,35 +11,35 @@
#include "bookmarks.h"
class BookmarksDialog : public QDialog
{
Q_OBJECT
class BookmarksDialog : public QDialog
{
Q_OBJECT
protected:
protected:
QList<QLabel *> pages;
QList<QLabel *> images;
int lastPage;
QPushButton * accept;
QPushButton * cancel;
QPushButton * accept;
QPushButton * cancel;
QSize coverSize;
bool eventFilter(QObject *obj, QEvent *event);
bool eventFilter(QObject *obj, QEvent *event);
void keyPressEvent(QKeyEvent * event);
//QPropertyAnimation * animation;
public:
BookmarksDialog(QWidget * parent = 0);
public:
BookmarksDialog(QWidget * parent = 0);
public slots:
void setBookmarks(const Bookmarks & bookmarks);
void setBookmarks(const Bookmarks & bookmarks);
//void show();
//void hide();
signals:
void goToPage(unsigned int page);
};
void goToPage(unsigned int page);
};
#endif // BOOKMARKS_DIALOG_H

View File

@ -66,7 +66,7 @@ void Configuration::load(const QString & path)
//gotoSlideSize = QSize(220,350); //huge
zoomLevel = 0.5;
adjustToWidth = true;
flowType = Strip;
flowType = Strip;
fullScreen = false;
fitToWidthRatio = 1;
windowSize = QSize(0,0);
@ -107,7 +107,7 @@ void Configuration::load(const QString & path)
if(name==SLIDE_SIZE)
{
int height = line.toInt();
gotoSlideSize = QSize(static_cast<int>(height/SLIDE_ASPECT_RATIO),height);
gotoSlideSize = QSize(static_cast<int>(height/SLIDE_ASPECT_RATIO),height);
}
else
if(name==FIT)
@ -161,13 +161,13 @@ void Configuration::load(const QString & path)
void Configuration::save()
{
QFile f(QCoreApplication::applicationDirPath()+"/YACReader.conf");
if(!f.open(QIODevice::WriteOnly))
{
QMessageBox::critical(NULL,tr("Saving config file...."),tr("There was a problem saving YACReader configuration. Please, check if you have enough permissions in the YACReader root folder."));
}
else
{
QFile f(QCoreApplication::applicationDirPath()+"/YACReader.conf");
if(!f.open(QIODevice::WriteOnly))
{
QMessageBox::critical(NULL,tr("Saving config file...."),tr("There was a problem saving YACReader configuration. Please, check if you have enough permissions in the YACReader root folder."));
}
else
{
QTextStream txtS(&f);
txtS << PATH << "\n";
@ -214,5 +214,5 @@ void Configuration::save()
txtS << ALWAYS_ON_TOP << "\n";
txtS << (int)alwaysOnTop << "\n";
}
}
}

View File

@ -26,12 +26,6 @@
#include "goto_flow_toolbar.h"
#include "goto_flow_decorationbar.h"
/*#define WIDTH 126
#define HEIGHT 200*/
GoToFlow::GoToFlow(QWidget *parent,FlowType flowType)
:GoToFlowWidget(parent),ready(false)

View File

@ -155,39 +155,39 @@ void MagnifyingGlass::updateImage()
}
void MagnifyingGlass::wheelEvent(QWheelEvent * event)
{
switch(event->modifiers())
{
switch(event->modifiers())
{
//size
case Qt::NoModifier:
if(event->delta()<0)
if(event->delta()<0)
sizeUp();
else
else
sizeDown();
break;
//size height
case Qt::ControlModifier:
if(event->delta()<0)
if(event->delta()<0)
heightUp();
else
else
heightDown();
break;
//size width
case Qt::AltModifier:
if(event->delta()<0)
if(event->delta()<0)
widthUp();
else
else
widthDown();
break;
//zoom level
case Qt::ShiftModifier:
if(event->delta()<0)
if(event->delta()<0)
zoomIn();
else
else
zoomOut();
break;
}
updateImage();
event->setAccepted(true);
}
updateImage();
event->setAccepted(true);
}
void MagnifyingGlass::zoomIn()
{
@ -216,28 +216,28 @@ void MagnifyingGlass::sizeDown()
void MagnifyingGlass::heightUp()
{
Viewer * p = (Viewer *)parent();
if(height()<(p->height()*0.90))
resize(width(),height()+15);
Viewer * p = (Viewer *)parent();
if(height()<(p->height()*0.90))
resize(width(),height()+15);
}
void MagnifyingGlass::heightDown()
{
if(height()>80)
resize(width(),height()-15);
if(height()>80)
resize(width(),height()-15);
}
void MagnifyingGlass::widthUp()
{
Viewer * p = (Viewer *)parent();
if(width()<(p->width()*0.90))
resize(width()+30,height());
Viewer * p = (Viewer *)parent();
if(width()<(p->width()*0.90))
resize(width()+30,height());
}
void MagnifyingGlass::widthDown()
{
if(width()>175)
resize(width()-30,height());
if(width()>175)
resize(width()-30,height());
}
void MagnifyingGlass::keyPressEvent(QKeyEvent *event)

View File

@ -15,17 +15,17 @@
#if defined(WIN32) && defined(_DEBUG)
#define _CRTDBG_MAP_ALLOC
#include <stdlib.h>
#include <crtdbg.h>
#define DEBUG_NEW new( _NORMAL_BLOCK, __FILE__, __LINE__ )
#define new DEBUG_NEW
#define _CRTDBG_MAP_ALLOC
#include <stdlib.h>
#include <crtdbg.h>
#define DEBUG_NEW new( _NORMAL_BLOCK, __FILE__, __LINE__ )
#define new DEBUG_NEW
#endif
int main(int argc, char * argv[])
{
#if defined(_MSC_VER) && defined(_DEBUG)
_CrtSetDbgFlag ( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF );
_CrtSetDbgFlag ( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF );
#endif
QApplication app(argc, argv);

View File

@ -21,7 +21,7 @@ public:
NotificationsLabelWidget(QWidget * parent);
public slots:
void flash();
void flash();
void setText(const QString & text);
void updatePosition();
};

View File

@ -44,13 +44,13 @@ PageLabelWidget::PageLabelWidget(QWidget * parent)
move(QPoint((parent->geometry().size().width()-this->width()),-this->height()));
/*QSize size = textLabel->sizeHint();
int w = width(); // returns screen width
int h = height(); // returns screen height
int mw = size.width();
int mh = size.height();
int cw = (w-mw)/2;
int ch = 0;
textLabel->move(cw,ch);*/
int w = width(); // returns screen width
int h = height(); // returns screen height
int mw = size.width();
int mh = size.height();
int cw = (w-mw)/2;
int ch = 0;
textLabel->move(cw,ch);*/
}
void PageLabelWidget::show()

View File

@ -20,7 +20,7 @@ public:
PageLabelWidget(QWidget * parent);
public slots:
void show();
void show();
void hide();
void setText(const QString & text);
void updatePosition();

View File

@ -9,59 +9,59 @@
#include <QTextCodec>
ShortcutsDialog::ShortcutsDialog(QWidget * parent)
:QDialog(parent)//,Qt::FramelessWindowHint)
:QDialog(parent)//,Qt::FramelessWindowHint)
{
setModal(true);
setWindowIcon(QIcon(":/images/shortcuts.png"));
setWindowTitle(tr("YACReader keyboard shortcuts"));
setModal(true);
setWindowIcon(QIcon(":/images/shortcuts.png"));
setWindowTitle(tr("YACReader keyboard shortcuts"));
QVBoxLayout * mainLayout = new QVBoxLayout;
QVBoxLayout * mainLayout = new QVBoxLayout;
close = new QPushButton(tr("Close"));
connect(close,SIGNAL(clicked()),this,SLOT(close()));
close = new QPushButton(tr("Close"));
connect(close,SIGNAL(clicked()),this,SLOT(close()));
QHBoxLayout *bottomLayout = new QHBoxLayout;
bottomLayout->addStretch();
bottomLayout->addWidget(close);
QHBoxLayout *bottomLayout = new QHBoxLayout;
bottomLayout->addStretch();
bottomLayout->addWidget(close);
QHBoxLayout * shortcutsLayout = new QHBoxLayout;
shortcuts = new QTextEdit();
shortcuts = new QTextEdit();
shortcuts->setFrameStyle(QFrame::NoFrame);
//"<p><b>General functions:</b><hr/><b>O</b> : Open comic<br/><b>Esc</b> : Exit</p>"
shortcuts->setReadOnly(true);
shortcutsLayout->addWidget(shortcuts);
//"<p><b>General functions:</b><hr/><b>O</b> : Open comic<br/><b>Esc</b> : Exit</p>"
shortcuts->setReadOnly(true);
shortcutsLayout->addWidget(shortcuts);
//shortcutsLayout->addWidget(shortcuts2);
shortcutsLayout->setSpacing(0);
mainLayout->addLayout(shortcutsLayout);
mainLayout->addLayout(bottomLayout);
mainLayout->addLayout(bottomLayout);
QHBoxLayout *imgMainLayout = new QHBoxLayout;
QLabel * imgLabel = new QLabel();
QPixmap p(":/images/shortcuts.png");
imgLabel->setPixmap(p);
QHBoxLayout *imgMainLayout = new QHBoxLayout;
QLabel * imgLabel = new QLabel();
QPixmap p(":/images/shortcuts.png");
imgLabel->setPixmap(p);
QVBoxLayout * imgLayout = new QVBoxLayout;
QVBoxLayout * imgLayout = new QVBoxLayout;
imgLayout->addWidget(imgLabel);
imgLayout->addStretch();
imgLayout->addStretch();
imgMainLayout->addLayout(imgLayout);
imgMainLayout->addLayout(mainLayout);
imgMainLayout->addLayout(imgLayout);
imgMainLayout->addLayout(mainLayout);
setLayout(imgMainLayout);
setLayout(imgMainLayout);
setFixedSize(QSize(700,500));
setFixedSize(QSize(700,500));
QFile f(":/files/shortcuts.html");
f.open(QIODevice::ReadOnly);
QTextStream txtS(&f);
QFile f(":/files/shortcuts.html");
f.open(QIODevice::ReadOnly);
QTextStream txtS(&f);
txtS.setCodec(QTextCodec::codecForName("UTF-8"));
QString content = txtS.readAll();
QString content = txtS.readAll();
f.close();
f.close();
shortcuts->setHtml(content);
shortcuts->setHtml(content);
setWindowTitle(tr("Keyboard Shortcuts"));
}

View File

@ -31,10 +31,10 @@ YACReaderTranslator::YACReaderTranslator(QWidget * parent)
:QWidget(parent),drag(false)
{
QString scrollBarStyle = "QScrollBar:vertical { border: none; background: #404040; width: 7px; margin: 0 3px 0 0; }"
"QScrollBar::handle:vertical { background: #DDDDDD; width: 7px; min-height: 20px; }"
"QScrollBar::add-line:vertical { border: none; background: #404040; height: 10px; subcontrol-position: bottom; subcontrol-origin: margin; margin: 0 3px 0 0;}"
"QScrollBar::handle:vertical { background: #DDDDDD; width: 7px; min-height: 20px; }"
"QScrollBar::add-line:vertical { border: none; background: #404040; height: 10px; subcontrol-position: bottom; subcontrol-origin: margin; margin: 0 3px 0 0;}"
"QScrollBar::sub-line:vertical { border: none; background: #404040; height: 10px; subcontrol-position: top; subcontrol-origin: margin; margin: 0 3px 0 0;}"
"QScrollBar::sub-line:vertical { border: none; background: #404040; height: 10px; subcontrol-position: top; subcontrol-origin: margin; margin: 0 3px 0 0;}"
"QScrollBar::up-arrow:vertical {border:none;width: 9px;height: 6px;background: url(':/images/folders_view/line-up.png') center top no-repeat;}"
"QScrollBar::down-arrow:vertical {border:none;width: 9px;height: 6px;background: url(':/images/folders_view/line-down.png') center top no-repeat;}"

View File

@ -8,19 +8,19 @@
YACReaderSliderAction::YACReaderSliderAction (QWidget * parent)
:QWidgetAction (0) {
QWidget* pWidget = new QWidget (NULL);
QHBoxLayout* pLayout = new QHBoxLayout();
QWidget* pWidget = new QWidget (NULL);
QHBoxLayout* pLayout = new QHBoxLayout();
pLayout->addStretch();
percentageLabel = new QLabel ("100%");
percentageLabel = new QLabel ("100%");
percentageLabel->setStyleSheet("QLabel { color : white; }");
percentageLabel->setAlignment(Qt::AlignHCenter|Qt::AlignVCenter);
pLayout->addWidget (percentageLabel);
slider = new QSlider(NULL);
pLayout->addWidget (percentageLabel);
slider = new QSlider(NULL);
slider->setOrientation(Qt::Horizontal);
pLayout->addWidget (slider);
pLayout->addWidget (slider);
QString sliderCSS =
@ -31,7 +31,7 @@ YACReaderSliderAction::YACReaderSliderAction (QWidget * parent)
;
slider->setStyleSheet(sliderCSS);
slider->setFixedSize(218,45);
QLabel* imgLabel = new QLabel(pWidget);
QPixmap p(":/images/sliderBackground.png");
imgLabel->resize(p.size());
@ -49,7 +49,7 @@ YACReaderSliderAction::YACReaderSliderAction (QWidget * parent)
pWidget->setMinimumSize(276,45);
setDefaultWidget(pWidget);
setDefaultWidget(pWidget);
slider->setMinimum(50);
slider->setMaximum(100);

View File

@ -15,7 +15,7 @@ private:
public:
YACReaderSliderAction (QWidget * parent = 0);
YACReaderSliderAction (QWidget * parent = 0);
public slots:
void updateText(int value);

View File

@ -1,12 +1,12 @@
<RCC>
<qresource>
<file>../files/about.html</file>
<file>../files/helpYACReader.html</file>
<file>../files/shortcuts.html</file>
</qresource>
<qresource>
<file>../files/about.html</file>
<file>../files/helpYACReader.html</file>
<file>../files/shortcuts.html</file>
</qresource>
<qresource lang="es_ES">
<file alias="/files/about.html">../files/about_es_ES.html</file>
<file alias="/files/helpYACReader.html">../files/helpYACReader_es_ES.html</file>
</qresource>
</RCC>
<qresource lang="es_ES">
<file alias="/files/about.html">../files/about_es_ES.html</file>
<file alias="/files/helpYACReader.html">../files/helpYACReader_es_ES.html</file>
</qresource>
</RCC>

View File

@ -1,77 +1,77 @@
<RCC>
<qresource>
<file>../images/icon.png</file>
<file>../images/goto.png</file>
<file>../images/comicFolder.png</file>
<file>../images/flow1.png</file>
<file>../images/flow2.png</file>
<file>../images/flow3.png</file>
<file>../images/flow4.png</file>
<file>../images/flow5.png</file>
<file>../images/notCover.png</file>
<file>../images/shortcuts.png</file>
<file>../images/close.png</file>
<file>../images/up.png</file>
<file>../images/down.png</file>
<file>../images/numPagesLabel.png</file>
<file>../images/numPagesLabelMedium.png</file>
<file>../images/numPagesLabelBig.png</file>
<file>../images/imgTopLeft.png</file>
<file>../images/imgTopMiddle.png</file>
<file>../images/imgTopRight.png</file>
<file>../images/imgBottomLeft.png</file>
<file>../images/imgBottomMiddle.png</file>
<file>../images/imgBottomRight.png</file>
<file>../images/imgEdit.png</file>
<file>../images/imgCenterSlide.png</file>
<file>../images/imgGoToSlide.png</file>
<file>../images/imgCenterSlidePressed.png</file>
<file>../images/imgGoToSlidePressed.png</file>
<file>../images/sliderBackground.png</file>
<file>../images/sliderGround.png</file>
<file>../images/sliderSubPage.png</file>
<file>../images/sliderAddPage.png</file>
<file>../images/sliderHandle.png</file>
<file>../images/helpImages/open.png</file>
<file>../images/helpImages/openFolder.png</file>
<file>../images/helpImages/next.png</file>
<file>../images/helpImages/prev.png</file>
<file>../images/helpImages/icon.png</file>
<file>../images/helpImages/zoom.png</file>
<file>../images/helpImages/fit.png</file>
<file>../images/helpImages/goto.png</file>
<file>../images/helpImages/help.png</file>
<file>../images/helpImages/center.png</file>
<file>../images/helpImages/options.png</file>
<file>../images/helpImages/comicFolder.png</file>
<file>../images/helpImages/save.png</file>
<file>../images/helpImages/rotateL.png</file>
<file>../images/helpImages/rotateR.png</file>
<file>../images/helpImages/flow1.png</file>
<file>../images/helpImages/flow2.png</file>
<file>../images/helpImages/flow3.png</file>
<file>../images/helpImages/bookmark.png</file>
<file>../images/helpImages/setBookmark.png</file>
<file>../images/helpImages/notCover.png</file>
<file>../images/helpImages/previousComic.png</file>
<file>../images/helpImages/nextComic.png</file>
<file>../images/helpImages/deleteLibrary.png</file>
<file>../images/helpImages/properties.png</file>
<file>../images/helpImages/doublePage.png</file>
<file>../images/helpImages/shortcuts.png</file>
<file>../images/helpImages/keyboard.png</file>
<file>../images/helpImages/mouse.png</file>
<file>../images/helpImages/speaker.png</file>
<file>../images/defaultCover.png</file>
<file>../images/onStartFlowSelection.png</file>
<file>../images/onStartFlowSelection_es.png</file>
<file>../images/useNewFlowButton.png</file>
<file>../images/useOldFlowButton.png</file>
<file>../images/notificationsLabel.png</file>
<file>../images/fromTo.png</file>
<file>../images/dropDownArrow.png</file>
<file>../images/translatorSearch.png</file>
<file>../images/speaker.png</file>
</qresource>
<qresource>
<file>../images/icon.png</file>
<file>../images/goto.png</file>
<file>../images/comicFolder.png</file>
<file>../images/flow1.png</file>
<file>../images/flow2.png</file>
<file>../images/flow3.png</file>
<file>../images/flow4.png</file>
<file>../images/flow5.png</file>
<file>../images/notCover.png</file>
<file>../images/shortcuts.png</file>
<file>../images/close.png</file>
<file>../images/up.png</file>
<file>../images/down.png</file>
<file>../images/numPagesLabel.png</file>
<file>../images/numPagesLabelMedium.png</file>
<file>../images/numPagesLabelBig.png</file>
<file>../images/imgTopLeft.png</file>
<file>../images/imgTopMiddle.png</file>
<file>../images/imgTopRight.png</file>
<file>../images/imgBottomLeft.png</file>
<file>../images/imgBottomMiddle.png</file>
<file>../images/imgBottomRight.png</file>
<file>../images/imgEdit.png</file>
<file>../images/imgCenterSlide.png</file>
<file>../images/imgGoToSlide.png</file>
<file>../images/imgCenterSlidePressed.png</file>
<file>../images/imgGoToSlidePressed.png</file>
<file>../images/sliderBackground.png</file>
<file>../images/sliderGround.png</file>
<file>../images/sliderSubPage.png</file>
<file>../images/sliderAddPage.png</file>
<file>../images/sliderHandle.png</file>
<file>../images/helpImages/open.png</file>
<file>../images/helpImages/openFolder.png</file>
<file>../images/helpImages/next.png</file>
<file>../images/helpImages/prev.png</file>
<file>../images/helpImages/icon.png</file>
<file>../images/helpImages/zoom.png</file>
<file>../images/helpImages/fit.png</file>
<file>../images/helpImages/goto.png</file>
<file>../images/helpImages/help.png</file>
<file>../images/helpImages/center.png</file>
<file>../images/helpImages/options.png</file>
<file>../images/helpImages/comicFolder.png</file>
<file>../images/helpImages/save.png</file>
<file>../images/helpImages/rotateL.png</file>
<file>../images/helpImages/rotateR.png</file>
<file>../images/helpImages/flow1.png</file>
<file>../images/helpImages/flow2.png</file>
<file>../images/helpImages/flow3.png</file>
<file>../images/helpImages/bookmark.png</file>
<file>../images/helpImages/setBookmark.png</file>
<file>../images/helpImages/notCover.png</file>
<file>../images/helpImages/previousComic.png</file>
<file>../images/helpImages/nextComic.png</file>
<file>../images/helpImages/deleteLibrary.png</file>
<file>../images/helpImages/properties.png</file>
<file>../images/helpImages/doublePage.png</file>
<file>../images/helpImages/shortcuts.png</file>
<file>../images/helpImages/keyboard.png</file>
<file>../images/helpImages/mouse.png</file>
<file>../images/helpImages/speaker.png</file>
<file>../images/defaultCover.png</file>
<file>../images/onStartFlowSelection.png</file>
<file>../images/onStartFlowSelection_es.png</file>
<file>../images/useNewFlowButton.png</file>
<file>../images/useOldFlowButton.png</file>
<file>../images/notificationsLabel.png</file>
<file>../images/fromTo.png</file>
<file>../images/dropDownArrow.png</file>
<file>../images/translatorSearch.png</file>
<file>../images/speaker.png</file>
</qresource>
</RCC>

View File

@ -1,28 +1,28 @@
<RCC>
<qresource prefix="/" >
<file>../images/viewer_toolbar/bookmark.png</file>
<file>../images/viewer_toolbar/close.png</file>
<file>../images/viewer_toolbar/doublePage.png</file>
<file>../images/viewer_toolbar/flow.png</file>
<file>../images/viewer_toolbar/full.png</file>
<file>../images/viewer_toolbar/goto.png</file>
<file>../images/viewer_toolbar/help.png</file>
<file>../images/viewer_toolbar/info.png</file>
<file>../images/viewer_toolbar/magnifyingGlass.png</file>
<file>../images/viewer_toolbar/next.png</file>
<file>../images/viewer_toolbar/open.png</file>
<file>../images/viewer_toolbar/openFolder.png</file>
<file>../images/viewer_toolbar/openNext.png</file>
<file>../images/viewer_toolbar/openPrevious.png</file>
<file>../images/viewer_toolbar/options.png</file>
<file>../images/viewer_toolbar/previous.png</file>
<file>../images/viewer_toolbar/rotateL.png</file>
<file>../images/viewer_toolbar/rotateR.png</file>
<file>../images/viewer_toolbar/save.png</file>
<file>../images/viewer_toolbar/shortcuts.png</file>
<file>../images/viewer_toolbar/showBookmarks.png</file>
<file>../images/viewer_toolbar/toHeight.png</file>
<file>../images/viewer_toolbar/toWidth.png</file>
<file>../images/viewer_toolbar/translator.png</file>
<file>../images/viewer_toolbar/bookmark.png</file>
<file>../images/viewer_toolbar/close.png</file>
<file>../images/viewer_toolbar/doublePage.png</file>
<file>../images/viewer_toolbar/flow.png</file>
<file>../images/viewer_toolbar/full.png</file>
<file>../images/viewer_toolbar/goto.png</file>
<file>../images/viewer_toolbar/help.png</file>
<file>../images/viewer_toolbar/info.png</file>
<file>../images/viewer_toolbar/magnifyingGlass.png</file>
<file>../images/viewer_toolbar/next.png</file>
<file>../images/viewer_toolbar/open.png</file>
<file>../images/viewer_toolbar/openFolder.png</file>
<file>../images/viewer_toolbar/openNext.png</file>
<file>../images/viewer_toolbar/openPrevious.png</file>
<file>../images/viewer_toolbar/options.png</file>
<file>../images/viewer_toolbar/previous.png</file>
<file>../images/viewer_toolbar/rotateL.png</file>
<file>../images/viewer_toolbar/rotateR.png</file>
<file>../images/viewer_toolbar/save.png</file>
<file>../images/viewer_toolbar/shortcuts.png</file>
<file>../images/viewer_toolbar/showBookmarks.png</file>
<file>../images/viewer_toolbar/toHeight.png</file>
<file>../images/viewer_toolbar/toWidth.png</file>
<file>../images/viewer_toolbar/translator.png</file>
</qresource>
</RCC>

View File

@ -17,7 +17,7 @@ class ComicFlow : public YACReaderFlow
{
Q_OBJECT
public:
ComicFlow(QWidget* parent = 0,FlowType flowType = CoverFlowLike);
ComicFlow(QWidget* parent = 0,FlowType flowType = CoverFlowLike);
virtual ~ComicFlow();
void setImagePaths(const QStringList& paths);

View File

@ -30,7 +30,7 @@ ComicFlowWidgetSW::ComicFlowWidgetSW(QWidget * parent)
m.rotate(-90);
m.scale(-1,1);
QImage image(":/images/setRead.png");
QImage imageTransformed = image.transformed(m,Qt::SmoothTransformation);
QImage imageTransformed = image.transformed(m,Qt::SmoothTransformation);
setMarkImage(imageTransformed);
}

View File

@ -8,16 +8,16 @@
class ComicsRemover : public QThread
{
Q_OBJECT
Q_OBJECT
public:
explicit ComicsRemover(QModelIndexList & indexList, QList<QString> & paths, QObject *parent = 0);
explicit ComicsRemover(QModelIndexList & indexList, QList<QString> & paths, QObject *parent = 0);
signals:
void remove(int);
void finished();
private:
void run();
void run();
private:
QModelIndexList indexList;

View File

@ -77,7 +77,7 @@ QSqlDatabase DataBaseManagement::createDatabase(QString dest)
DataBaseManagement::createTables(db);
QSqlQuery query("INSERT INTO folder (parentId, name, path) "
"VALUES (1,'root', '/')",db);
"VALUES (1,'root', '/')",db);
}
//query.finish();
//db.close();
@ -196,7 +196,7 @@ bool DataBaseManagement::createTables(QSqlDatabase & database)
//queryDBInfo.finish();
QSqlQuery query("INSERT INTO db_info (version) "
"VALUES ('"VERSION"')",database);
"VALUES ('"VERSION"')",database);
//query.finish();
}
@ -568,7 +568,7 @@ bool DataBaseManagement::updateToCurrentVersion(const QString & fullPath)
//new 7.0 fields
QStringList columnDefs;
columnDefs << "hasBeenOpened BOOLEAN DEFAULT 0"
<< "rating INTEGER DEFAULT 0"
<< "rating INTEGER DEFAULT 0"
<< "currentPage INTEGER DEFAULT 1"
<< "bookmark1 INTEGER DEFAULT -1"
<< "bookmark2 INTEGER DEFAULT -1"

View File

@ -7,7 +7,7 @@
TableItem::TableItem(const QList<QVariant> &data)
{
itemData = data;
itemData = data;
}
//! [0]
@ -22,14 +22,14 @@ TableItem::~TableItem()
//! [5]
int TableItem::columnCount() const
{
return itemData.count();
return itemData.count();
}
//! [5]
//! [6]
QVariant TableItem::data(int column) const
{
return itemData.value(column);
return itemData.value(column);
}
//! [6]
@ -42,6 +42,6 @@ void TableItem::setData(int column,const QVariant & value)
int TableItem::row() const
{
return 0;
return 0;
}
//! [8]

View File

@ -16,23 +16,23 @@ class TableItem;
//! [0]
class TableModel : public QAbstractItemModel
{
Q_OBJECT
Q_OBJECT
public:
TableModel(QObject *parent = 0);
TableModel( QSqlQuery &sqlquery, QObject *parent = 0);
~TableModel();
TableModel( QSqlQuery &sqlquery, QObject *parent = 0);
~TableModel();
QVariant data(const QModelIndex &index, int role) const;
Qt::ItemFlags flags(const QModelIndex &index) const;
QVariant headerData(int section, Qt::Orientation orientation,
int role = Qt::DisplayRole) const;
QModelIndex index(int row, int column,
const QModelIndex &parent = QModelIndex()) const;
QModelIndex parent(const QModelIndex &index) const;
int rowCount(const QModelIndex &parent = QModelIndex()) const;
int columnCount(const QModelIndex &parent = QModelIndex()) const;
QVariant data(const QModelIndex &index, int role) const;
Qt::ItemFlags flags(const QModelIndex &index) const;
QVariant headerData(int section, Qt::Orientation orientation,
int role = Qt::DisplayRole) const;
QModelIndex index(int row, int column,
const QModelIndex &parent = QModelIndex()) const;
QModelIndex parent(const QModelIndex &index) const;
int rowCount(const QModelIndex &parent = QModelIndex()) const;
int columnCount(const QModelIndex &parent = QModelIndex()) const;
void setupModelData(unsigned long long int parentFolder,const QString & databasePath);
//Métodos de conveniencia
@ -61,9 +61,9 @@ public slots:
void updateRating(int rating, QModelIndex mi);
private:
void setupModelData( QSqlQuery &sqlquery);
void setupModelData( QSqlQuery &sqlquery);
ComicDB _getComic(const QModelIndex & mi);
QList<TableItem *> _data;
QList<TableItem *> _data;
QString _databasePath;

View File

@ -39,9 +39,9 @@
****************************************************************************/
/*
treeitem.cpp
treeitem.cpp
A container for items of data supplied by the simple tree model.
A container for items of data supplied by the simple tree model.
*/
#include <QStringList>
@ -52,15 +52,15 @@
//! [0]
TreeItem::TreeItem(const QList<QVariant> &data, TreeItem *parent)
{
parentItem = parent;
itemData = data;
parentItem = parent;
itemData = data;
}
//! [0]
//! [1]
TreeItem::~TreeItem()
{
qDeleteAll(childItems);
qDeleteAll(childItems);
}
//! [1]
@ -91,52 +91,52 @@ void TreeItem::appendChild(TreeItem *item)
}
//childItems.append(item);
//childItems.append(item);
}
//! [2]
//! [3]
TreeItem *TreeItem::child(int row)
{
return childItems.value(row);
return childItems.value(row);
}
//! [3]
//! [4]
int TreeItem::childCount() const
{
return childItems.count();
return childItems.count();
}
//! [4]
//! [5]
int TreeItem::columnCount() const
{
return itemData.count();
return itemData.count();
}
//! [5]
//! [6]
QVariant TreeItem::data(int column) const
{
return itemData.value(column);
return itemData.value(column);
}
//! [6]
//! [7]
TreeItem *TreeItem::parent()
{
return parentItem;
return parentItem;
}
//! [7]
//! [8]
int TreeItem::row() const
{
if (parentItem)
return parentItem->childItems.indexOf(const_cast<TreeItem*>(this));
if (parentItem)
return parentItem->childItems.indexOf(const_cast<TreeItem*>(this));
return 0;
return 0;
}
//! [8]

View File

@ -49,28 +49,28 @@
class TreeItem
{
public:
TreeItem(const QList<QVariant> &data, TreeItem *parent = 0);
~TreeItem();
TreeItem(const QList<QVariant> &data, TreeItem *parent = 0);
~TreeItem();
void appendChild(TreeItem *child);
void appendChild(TreeItem *child);
TreeItem *child(int row);
int childCount() const;
int columnCount() const;
QVariant data(int column) const;
TreeItem *child(int row);
int childCount() const;
int columnCount() const;
QVariant data(int column) const;
QList<QVariant> getData() const;
int row() const;
TreeItem *parent();
int row() const;
TreeItem *parent();
TreeItem *parentItem;
unsigned long long int id;
QList<QString> comicNames;
TreeItem * originalItem;
private:
QList<TreeItem*> childItems;
QList<QVariant> itemData;
QList<TreeItem*> childItems;
QList<QVariant> itemData;
};
//! [0]

View File

@ -39,10 +39,10 @@
****************************************************************************/
/*
treemodel.cpp
treemodel.cpp
Provides a simple tree model to show how to create and use hierarchical
models.
Provides a simple tree model to show how to create and use hierarchical
models.
*/
#include <QtGui>
@ -59,7 +59,7 @@
#define ROOT 1
TreeModel::TreeModel(QObject *parent)
: QAbstractItemModel(parent),rootItem(0),rootBeforeFilter(0),filterEnabled(false),includeComics(false)
: QAbstractItemModel(parent),rootItem(0),rootBeforeFilter(0),filterEnabled(false),includeComics(false)
{
connect(this,SIGNAL(beforeReset()),this,SIGNAL(modelAboutToBeReset()));
connect(this,SIGNAL(reset()),this,SIGNAL(modelReset()));
@ -67,15 +67,15 @@ TreeModel::TreeModel(QObject *parent)
//! [0]
TreeModel::TreeModel( QSqlQuery &sqlquery, QObject *parent)
: QAbstractItemModel(parent),rootItem(0),rootBeforeFilter(0),filterEnabled(false),includeComics(false)
: QAbstractItemModel(parent),rootItem(0),rootBeforeFilter(0),filterEnabled(false),includeComics(false)
{
//lo más probable es que el nodo raíz no necesite tener información
QList<QVariant> rootData;
rootData << "root"; //id 0, padre 0, title "root" (el id, y el id del padre van a ir en la clase TreeItem)
rootItem = new TreeItem(rootData);
QList<QVariant> rootData;
rootData << "root"; //id 0, padre 0, title "root" (el id, y el id del padre van a ir en la clase TreeItem)
rootItem = new TreeItem(rootData);
rootItem->id = ROOT;
rootItem->parentItem = 0;
setupModelData(sqlquery, rootItem);
setupModelData(sqlquery, rootItem);
//sqlquery.finish();
}
//! [0]
@ -91,91 +91,91 @@ TreeModel::~TreeModel()
//! [2]
int TreeModel::columnCount(const QModelIndex &parent) const
{
if (parent.isValid())
return static_cast<TreeItem*>(parent.internalPointer())->columnCount();
else
return rootItem->columnCount();
if (parent.isValid())
return static_cast<TreeItem*>(parent.internalPointer())->columnCount();
else
return rootItem->columnCount();
}
//! [2]
//! [3]
QVariant TreeModel::data(const QModelIndex &index, int role) const
{
if (!index.isValid())
return QVariant();
if (!index.isValid())
return QVariant();
if (role == Qt::DecorationRole)
#ifdef Q_OS_MAC
return QVariant(QFileIconProvider().icon(QFileIconProvider::Folder));
return QVariant(QFileIconProvider().icon(QFileIconProvider::Folder));
#else
return QVariant(QIcon(":/images/folder.png"));
#endif
if (role != Qt::DisplayRole)
return QVariant();
if (role != Qt::DisplayRole)
return QVariant();
TreeItem *item = static_cast<TreeItem*>(index.internalPointer());
TreeItem *item = static_cast<TreeItem*>(index.internalPointer());
return item->data(index.column());
return item->data(index.column());
}
//! [3]
//! [4]
Qt::ItemFlags TreeModel::flags(const QModelIndex &index) const
{
if (!index.isValid())
return 0;
if (!index.isValid())
return 0;
return Qt::ItemIsEnabled | Qt::ItemIsSelectable;
return Qt::ItemIsEnabled | Qt::ItemIsSelectable;
}
//! [4]
//! [5]
QVariant TreeModel::headerData(int section, Qt::Orientation orientation,
int role) const
int role) const
{
if (orientation == Qt::Horizontal && role == Qt::DisplayRole)
return rootItem->data(section);
if (orientation == Qt::Horizontal && role == Qt::DisplayRole)
return rootItem->data(section);
return QVariant();
return QVariant();
}
//! [5]
//! [6]
QModelIndex TreeModel::index(int row, int column, const QModelIndex &parent)
const
const
{
if (!hasIndex(row, column, parent))
return QModelIndex();
if (!hasIndex(row, column, parent))
return QModelIndex();
TreeItem *parentItem;
TreeItem *parentItem;
if (!parent.isValid())
parentItem = rootItem;
else
parentItem = static_cast<TreeItem*>(parent.internalPointer());
if (!parent.isValid())
parentItem = rootItem;
else
parentItem = static_cast<TreeItem*>(parent.internalPointer());
TreeItem *childItem = parentItem->child(row);
if (childItem)
return createIndex(row, column, childItem);
else
return QModelIndex();
TreeItem *childItem = parentItem->child(row);
if (childItem)
return createIndex(row, column, childItem);
else
return QModelIndex();
}
//! [6]
//! [7]
QModelIndex TreeModel::parent(const QModelIndex &index) const
{
if (!index.isValid())
return QModelIndex();
if (!index.isValid())
return QModelIndex();
TreeItem *childItem = static_cast<TreeItem*>(index.internalPointer());
TreeItem *parentItem = childItem->parent();
TreeItem *childItem = static_cast<TreeItem*>(index.internalPointer());
TreeItem *parentItem = childItem->parent();
if (parentItem == rootItem)
return QModelIndex();
if (parentItem == rootItem)
return QModelIndex();
return createIndex(parentItem->row(), 0, parentItem);
return createIndex(parentItem->row(), 0, parentItem);
}
//! [7]
@ -192,16 +192,16 @@ QModelIndex TreeModel::indexFromItem(TreeItem * item,int column)
//! [8]
int TreeModel::rowCount(const QModelIndex &parent) const
{
TreeItem *parentItem;
if (parent.column() > 0)
return 0;
TreeItem *parentItem;
if (parent.column() > 0)
return 0;
if (!parent.isValid())
parentItem = rootItem;
else
parentItem = static_cast<TreeItem*>(parent.internalPointer());
if (!parent.isValid())
parentItem = rootItem;
else
parentItem = static_cast<TreeItem*>(parent.internalPointer());
return parentItem->childCount();
return parentItem->childCount();
}
//! [8]

View File

@ -52,26 +52,26 @@ class TreeItem;
//! [0]
class TreeModel : public QAbstractItemModel
{
Q_OBJECT
Q_OBJECT
public:
TreeModel(QObject *parent = 0);
TreeModel( QSqlQuery &sqlquery, QObject *parent = 0);
~TreeModel();
TreeModel( QSqlQuery &sqlquery, QObject *parent = 0);
~TreeModel();
QVariant data(const QModelIndex &index, int role) const;
Qt::ItemFlags flags(const QModelIndex &index) const;
QVariant headerData(int section, Qt::Orientation orientation,
int role = Qt::DisplayRole) const;
QModelIndex index(int row, int column,
const QModelIndex &parent = QModelIndex()) const;
QModelIndex parent(const QModelIndex &index) const;
QVariant data(const QModelIndex &index, int role) const;
Qt::ItemFlags flags(const QModelIndex &index) const;
QVariant headerData(int section, Qt::Orientation orientation,
int role = Qt::DisplayRole) const;
QModelIndex index(int row, int column,
const QModelIndex &parent = QModelIndex()) const;
QModelIndex parent(const QModelIndex &index) const;
QModelIndex indexFromItem(TreeItem * item, int column);
/*QModelIndex _indexFromItem(TreeItem * item, int column);
int column;*/
int rowCount(const QModelIndex &parent = QModelIndex()) const;
int columnCount(const QModelIndex &parent = QModelIndex()) const;
int rowCount(const QModelIndex &parent = QModelIndex()) const;
int columnCount(const QModelIndex &parent = QModelIndex()) const;
void setupModelData(QString path);
QString getDatabase();
@ -82,11 +82,11 @@ public:
void resetFilter();
bool isFilterEnabled(){return filterEnabled;};
private:
void setupModelData( QSqlQuery &sqlquery, TreeItem *parent);
void setupModelData( QSqlQuery &sqlquery, TreeItem *parent);
void setupFilteredModelData( QSqlQuery &sqlquery, TreeItem *parent);
void setupFilteredModelData();
TreeItem *rootItem; //el árbol
TreeItem *rootItem; //el árbol
QMap<unsigned long long int, TreeItem *> items; //relación entre folders
TreeItem *rootBeforeFilter;

View File

@ -1,12 +1,12 @@
<RCC>
<qresource>
<file>../files/about.html</file>
<file>../files/helpYACReaderLibrary.html</file>
</qresource>
<qresource>
<file>../files/about.html</file>
<file>../files/helpYACReaderLibrary.html</file>
</qresource>
<qresource lang="es_ES">
<file alias="/files/about.html">../files/about_es_ES.html</file>
<file alias="/files/helpYACReaderLibrary.html">../files/helpYACReaderLibrary_es_ES.html</file>
</qresource>
<qresource lang="es_ES">
<file alias="/files/about.html">../files/about_es_ES.html</file>
<file alias="/files/helpYACReaderLibrary.html">../files/helpYACReaderLibrary_es_ES.html</file>
</qresource>
</RCC>

View File

@ -1,25 +1,25 @@
<RCC>
<qresource prefix="/" >
<file>../images/folder.png</file>
<file>../images/icon.png</file>
<file>../images/icon.png</file>
<file>../images/iconLibrary.png</file>
<file>../images/new.png</file>
<file>../images/openLibrary.png</file>
<file>../images/removeLibraryIcon.png</file>
<file>../images/updateLibraryIcon.png</file>
<file>../images/removeLibraryIcon.png</file>
<file>../images/updateLibraryIcon.png</file>
<file>../images/comicFolder.png</file>
<file>../images/notCover.png</file>
<file>../images/edit.png</file>
<file>../images/editIcon.png</file>
<file>../images/editIcon.png</file>
<file>../images/flow1.png</file>
<file>../images/flow2.png</file>
<file>../images/flow3.png</file>
<file>../images/flow4.png</file>
<file>../images/flow5.png</file>
<file>../images/flow4.png</file>
<file>../images/flow5.png</file>
<file>../images/importLibrary.png</file>
<file>../images/importLibraryIcon.png</file>
<file>../images/importLibraryIcon.png</file>
<file>../images/exportLibrary.png</file>
<file>../images/exportLibraryIcon.png</file>
<file>../images/exportLibraryIcon.png</file>
<file>../images/open.png</file>
<file>../images/coversPackage.png</file>
<file>../images/setRead.png</file>
@ -32,27 +32,27 @@
<file>../images/hideComicFlow.png</file>
<file>../images/exportComicsInfo.png</file>
<file>../images/importComicsInfo.png</file>
<file>../images/exportComicsInfoIcon.png</file>
<file>../images/exportComicsInfoIcon.png</file>
<file>../images/importComicsInfoIcon.png</file>
<file>../images/db.png</file>
<file>../images/asignNumber.png</file>
<file>../images/defaultCover.png</file>
<file>../images/iphoneConfig.png</file>
<file>../images/onStartFlowSelection.png</file>
<file>../images/onStartFlowSelection_es.png</file>
<file>../images/useNewFlowButton.png</file>
<file>../images/useOldFlowButton.png</file>
<file>../images/serverConfigBackground.png</file>
<file>../images/noLibrariesIcon.png</file>
<file>../images/noLibrariesLine.png</file>
<file>../images/importingIcon.png</file>
<file>../images/updatingIcon.png</file>
<file>../images/importTopCoversDecoration.png</file>
<file>../images/importBottomCoversDecoration.png</file>
<file>../images/glowLine.png</file>
<file>../images/clearSearch.png</file>
<file>../images/iconSearch.png</file>
<file>../images/readRibbon.png</file>
<file>../images/defaultCover.png</file>
<file>../images/iphoneConfig.png</file>
<file>../images/onStartFlowSelection.png</file>
<file>../images/onStartFlowSelection_es.png</file>
<file>../images/useNewFlowButton.png</file>
<file>../images/useOldFlowButton.png</file>
<file>../images/serverConfigBackground.png</file>
<file>../images/noLibrariesIcon.png</file>
<file>../images/noLibrariesLine.png</file>
<file>../images/importingIcon.png</file>
<file>../images/updatingIcon.png</file>
<file>../images/importTopCoversDecoration.png</file>
<file>../images/importBottomCoversDecoration.png</file>
<file>../images/glowLine.png</file>
<file>../images/clearSearch.png</file>
<file>../images/iconSearch.png</file>
<file>../images/readRibbon.png</file>
<file>../images/readingRibbon.png</file>
<file>../images/shownCovers.png</file>
<file>../images/hiddenCovers.png</file>
@ -60,21 +60,21 @@
<file>../images/setReadButton.png</file>
<file>../images/openInYACReader.png</file>
<!--<file>../images/deleting_progress/imgTopLeft.png</file>
<file>../images/deleting_progress/imgTopMiddle.png</file>
<file>../images/deleting_progress/imgTopRight.png</file>
<file>../images/deleting_progress/imgLeftMiddle.png</file>
<file>../images/deleting_progress/imgRightMiddle.png</file>
<file>../images/deleting_progress/imgBottomLeft.png</file>
<file>../images/deleting_progress/imgBottomMiddle.png</file>
<file>../images/deleting_progress/imgBottomRight.png</file>
<file>../images/deleting_progress/icon.png</file>
<file>../images/social_dialog/close.png</file>
<file>../images/social_dialog/facebook.png</file>
<file>../images/social_dialog/google+.png</file>
<file>../images/social_dialog/icon.png</file>
<file>../images/social_dialog/shadow.png</file>
<file>../images/social_dialog/twitter.png</file>
<file>../images/social_dialog/separator.png</file>-->
<file>../images/deleting_progress/imgTopMiddle.png</file>
<file>../images/deleting_progress/imgTopRight.png</file>
<file>../images/deleting_progress/imgLeftMiddle.png</file>
<file>../images/deleting_progress/imgRightMiddle.png</file>
<file>../images/deleting_progress/imgBottomLeft.png</file>
<file>../images/deleting_progress/imgBottomMiddle.png</file>
<file>../images/deleting_progress/imgBottomRight.png</file>
<file>../images/deleting_progress/icon.png</file>
<file>../images/social_dialog/close.png</file>
<file>../images/social_dialog/facebook.png</file>
<file>../images/social_dialog/google+.png</file>
<file>../images/social_dialog/icon.png</file>
<file>../images/social_dialog/shadow.png</file>
<file>../images/social_dialog/twitter.png</file>
<file>../images/social_dialog/separator.png</file>-->
<file>../images/main_toolbar/divider.png</file>
<file>../images/collapsed_branch_osx.png</file>
<file>../images/expanded_branch_osx.png</file>
@ -87,12 +87,12 @@
<file>../images/collapsed_branch_selected.png</file>
<file>../images/previousCoverPage.png</file>
<file>../images/nextCoverPage.png</file>
<file>../images/rating0.png</file>
<file>../images/rating1.png</file>
<file>../images/rating2.png</file>
<file>../images/rating3.png</file>
<file>../images/rating4.png</file>
<file>../images/rating5.png</file>
<file>../images/rating0.png</file>
<file>../images/rating1.png</file>
<file>../images/rating2.png</file>
<file>../images/rating3.png</file>
<file>../images/rating4.png</file>
<file>../images/rating5.png</file>
<!--<file>../images/busy_background.png</file>-->
</qresource>
</RCC>

View File

@ -4,12 +4,12 @@
<file>../images/main_toolbar/back_disabled.png</file>
<file>../images/main_toolbar/forward.png</file>
<file>../images/main_toolbar/forward_disabled.png</file>
<file>../images/main_toolbar/settings.png</file>
<file>../images/main_toolbar/settings.png</file>
<file>../images/main_toolbar/server.png</file>
<file>../images/main_toolbar/help.png</file>
<file>../images/main_toolbar/fullscreen.png</file>
<file>../images/libraryIcon.png</file>
<file>../images/libraryIcon.png</file>
<file>../images/setRoot.png</file>
<file>../images/expand.png</file>
<file>../images/colapse.png</file>

View File

@ -113,7 +113,7 @@ void ImportLibraryDialog::findPath()
{
path->setText(s);
if(!destPath->text().isEmpty() && !nameEdit->text().isEmpty())
accept->setEnabled(true);
accept->setEnabled(true);
}
}
@ -125,18 +125,18 @@ void ImportLibraryDialog::findDestination()
{
destPath->setText(s);
if(!path->text().isEmpty() && !nameEdit->text().isEmpty())
accept->setEnabled(true);
accept->setEnabled(true);
}
}
void ImportLibraryDialog::nameEntered()
{
if(!nameEdit->text().isEmpty())
{
if(!nameEdit->text().isEmpty())
{
if(!path->text().isEmpty() && !destPath->text().isEmpty())
accept->setEnabled(true);
}
else
accept->setEnabled(true);
}
else
accept->setEnabled(false);
}
@ -152,5 +152,5 @@ void ImportLibraryDialog::close()
void ImportLibraryDialog::closeEvent ( QCloseEvent * e )
{
close();
close();
}

View File

@ -89,14 +89,14 @@ YACReaderActivityIndicatorWidget::YACReaderActivityIndicatorWidget(QWidget * par
ImportWidget::ImportWidget(QWidget *parent) :
QWidget(parent)
QWidget(parent)
{
setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding);
QPalette p(palette());
p.setColor(QPalette::Background, QColor(250,250,250));
setAutoFillBackground(true);
setPalette(p);
p.setColor(QPalette::Background, QColor(250,250,250));
setAutoFillBackground(true);
setPalette(p);
QPixmap icon(":/images/importingIcon.png");
iconLabel = new QLabel();

View File

@ -13,12 +13,12 @@ class QResizeEvent;
class ImportWidget : public QWidget
{
Q_OBJECT
Q_OBJECT
public:
explicit ImportWidget(QWidget *parent = 0);
explicit ImportWidget(QWidget *parent = 0);
signals:
void stop();
void stop();
public slots:
void newComic(const QString & path, const QString & coverPath);
void newCover(const QPixmap & image);
@ -46,7 +46,7 @@ private:
QToolButton * hideButton;
void resizeEvent(QResizeEvent * event);
};
#endif // IMPORT_WIDGET_H

View File

@ -148,14 +148,14 @@ void LibraryCreator::create(QDir dir)
QFileInfo fileInfo = list.at(i);
QString fileName = fileInfo.fileName();
#ifdef Q_OS_MAC
QStringList src = _source.split("/");
QStringList src = _source.split("/");
QString filePath = fileInfo.absoluteFilePath();
QStringList fp = filePath.split("/");
for(int i = 0; i< src.count();i++)
{
fp.removeFirst();
}
QString relativePath = "/" + fp.join("/");
QStringList fp = filePath.split("/");
for(int i = 0; i< src.count();i++)
{
fp.removeFirst();
}
QString relativePath = "/" + fp.join("/");
#else
QString relativePath = QDir::cleanPath(fileInfo.absoluteFilePath()).remove(_source);
#endif

View File

@ -24,8 +24,8 @@
public:
LibraryCreator();
void createLibrary(const QString & source, const QString & target);
void updateLibrary(const QString & source, const QString & target);
void stop();
void updateLibrary(const QString & source, const QString & target);
void stop();
private:
void processLibrary(const QString & source, const QString & target);
enum Mode {CREATOR,UPDATER};
@ -39,19 +39,19 @@
//recursive method
void create(QDir currentDirectory);
void update(QDir currentDirectory);
void run();
void run();
qulonglong insertFolders();//devuelve el id del último folder añadido (último en la ruta)
bool checkCover(const QString & hash);
void insertComic(const QString & relativePath,const QFileInfo & fileInfo);
//qulonglong insertFolder(qulonglong parentId,const Folder & folder);
//qulonglong insertComic(const Comic & comic);
bool stopRunning;
bool stopRunning;
//LibraryCreator está en modo creación si creation == true;
bool creation;
signals:
void finished();
void coverExtracted(QString);
void folderUpdated(QString);
void coverExtracted(QString);
void folderUpdated(QString);
void comicAdded(QString,QString);
void updated();
void created();

View File

@ -43,7 +43,7 @@ int main( int argc, char ** argv )
#endif
if(YACReaderLocalServer::isRunning()) //sólo se permite una instancia de YACReaderLibrary
return 0;
return 0;
YACReaderLocalServer * localServer = new YACReaderLocalServer();

View File

@ -6,14 +6,14 @@
#include <QPushButton>
NoLibrariesWidget::NoLibrariesWidget(QWidget *parent) :
QWidget(parent)
QWidget(parent)
{
setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding);
QPalette p(palette());
p.setColor(QPalette::Background, QColor(250,250,250));
setAutoFillBackground(true);
setPalette(p);
p.setColor(QPalette::Background, QColor(250,250,250));
setAutoFillBackground(true);
setPalette(p);
QPixmap icon(":/images/noLibrariesIcon.png");
QLabel * iconLabel = new QLabel();

View File

@ -5,15 +5,15 @@
class NoLibrariesWidget : public QWidget
{
Q_OBJECT
Q_OBJECT
public:
explicit NoLibrariesWidget(QWidget *parent = 0);
explicit NoLibrariesWidget(QWidget *parent = 0);
signals:
void createNewLibrary();
void createNewLibrary();
void addExistingLibrary();
public slots:
};
#endif // NO_LIBRARIES_WIDGET_H

View File

@ -42,7 +42,7 @@ OptionsDialog::OptionsDialog(QWidget * parent)
setLayout(layout);
//restoreOptions(settings); //load options
//resize(200,0);
//resize(200,0);
setModal (true);
setWindowTitle(tr("Options"));

View File

@ -10,7 +10,7 @@ public:
PackageManager();
void createPackage(const QString & libraryPath,const QString & dest);
void extractPackage(const QString & packagePath,const QString & destDir);
public slots:
public slots:
void cancel();
private:
bool creating;

View File

@ -22,8 +22,8 @@ PropertiesDialog::PropertiesDialog(QWidget * parent)
{
createCoverBox();
createGeneralInfoBox();
createAuthorsBox();
createGeneralInfoBox();
createAuthorsBox();
createPublishingBox();
createButtonBox();
createPlotBox();
@ -123,10 +123,10 @@ void PropertiesDialog::createCoverBox()
QFrame * createLine()
{
QFrame * line = new QFrame();
line->setObjectName(QString::fromUtf8("line"));
//line->setGeometry(QRect(320, 150, 118, 3));
line->setFrameShape(QFrame::HLine);
line->setFrameShadow(QFrame::Sunken);
line->setObjectName(QString::fromUtf8("line"));
//line->setGeometry(QRect(320, 150, 118, 3));
line->setFrameShape(QFrame::HLine);
line->setFrameShadow(QFrame::Sunken);
return line;
}
@ -137,7 +137,7 @@ void PropertiesDialog::createGeneralInfoBox()
QFormLayout *generalInfoLayout = new QFormLayout;
generalInfoLayout->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow);
generalInfoLayout->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow);
//generalInfoLayout->setRowWrapPolicy(QFormLayout::WrapAllRows);
generalInfoLayout->addRow(tr("Title:"), title = new YACReaderFieldEdit());
@ -236,7 +236,7 @@ void PropertiesDialog::createPublishingBox()
QFormLayout *publishingLayout = new QFormLayout;
publishingLayout->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow);
publishingLayout->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow);
QHBoxLayout * date = new QHBoxLayout;
date->addWidget(new QLabel(tr("Day:")));
@ -268,7 +268,7 @@ void PropertiesDialog::createPlotBox()
plotBox = new QWidget;
QFormLayout *plotLayout = new QFormLayout;
plotLayout->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow);
plotLayout->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow);
plotLayout->setRowWrapPolicy(QFormLayout::WrapAllRows);
plotLayout->addRow(tr("Synopsis:"), synopsis = new YACReaderFieldPlainTextEdit());
@ -281,83 +281,83 @@ void PropertiesDialog::createPlotBox()
void PropertiesDialog::createButtonBox()
{
buttonBox = new QDialogButtonBox;
buttonBox = new QDialogButtonBox;
closeButton = buttonBox->addButton(QDialogButtonBox::Close);
closeButton = buttonBox->addButton(QDialogButtonBox::Close);
saveButton = buttonBox->addButton(QDialogButtonBox::Save);
//rotateWidgetsButton = buttonBox->addButton(tr("Rotate &Widgets"),QDialogButtonBox::ActionRole);
//rotateWidgetsButton = buttonBox->addButton(tr("Rotate &Widgets"),QDialogButtonBox::ActionRole);
//connect(rotateWidgetsButton, SIGNAL(clicked()), this, SLOT(rotateWidgets()));
connect(closeButton, SIGNAL(clicked()), this, SLOT(close()));
connect(saveButton, SIGNAL(clicked()), this, SLOT(save()));
//connect(rotateWidgetsButton, SIGNAL(clicked()), this, SLOT(rotateWidgets()));
connect(closeButton, SIGNAL(clicked()), this, SLOT(close()));
connect(saveButton, SIGNAL(clicked()), this, SLOT(save()));
}
QImage blurred(const QImage& image, const QRect& rect, int radius, bool alphaOnly = false)
{
int tab[] = { 14, 10, 8, 6, 5, 5, 4, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2 };
int alpha = (radius < 1) ? 16 : (radius > 17) ? 1 : tab[radius-1];
int tab[] = { 14, 10, 8, 6, 5, 5, 4, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2 };
int alpha = (radius < 1) ? 16 : (radius > 17) ? 1 : tab[radius-1];
QImage result = image.convertToFormat(QImage::Format_ARGB32_Premultiplied);
int r1 = rect.top();
int r2 = rect.bottom();
int c1 = rect.left();
int c2 = rect.right();
QImage result = image.convertToFormat(QImage::Format_ARGB32_Premultiplied);
int r1 = rect.top();
int r2 = rect.bottom();
int c1 = rect.left();
int c2 = rect.right();
int bpl = result.bytesPerLine();
int rgba[4];
unsigned char* p;
int bpl = result.bytesPerLine();
int rgba[4];
unsigned char* p;
int i1 = 0;
int i2 = 3;
int i1 = 0;
int i2 = 3;
if (alphaOnly)
i1 = i2 = (QSysInfo::ByteOrder == QSysInfo::BigEndian ? 0 : 3);
if (alphaOnly)
i1 = i2 = (QSysInfo::ByteOrder == QSysInfo::BigEndian ? 0 : 3);
for (int col = c1; col <= c2; col++) {
p = result.scanLine(r1) + col * 4;
for (int i = i1; i <= i2; i++)
rgba[i] = p[i] << 4;
for (int col = c1; col <= c2; col++) {
p = result.scanLine(r1) + col * 4;
for (int i = i1; i <= i2; i++)
rgba[i] = p[i] << 4;
p += bpl;
for (int j = r1; j < r2; j++, p += bpl)
for (int i = i1; i <= i2; i++)
p[i] = (rgba[i] += ((p[i] << 4) - rgba[i]) * alpha / 16) >> 4;
}
p += bpl;
for (int j = r1; j < r2; j++, p += bpl)
for (int i = i1; i <= i2; i++)
p[i] = (rgba[i] += ((p[i] << 4) - rgba[i]) * alpha / 16) >> 4;
}
for (int row = r1; row <= r2; row++) {
p = result.scanLine(row) + c1 * 4;
for (int i = i1; i <= i2; i++)
rgba[i] = p[i] << 4;
for (int row = r1; row <= r2; row++) {
p = result.scanLine(row) + c1 * 4;
for (int i = i1; i <= i2; i++)
rgba[i] = p[i] << 4;
p += 4;
for (int j = c1; j < c2; j++, p += 4)
for (int i = i1; i <= i2; i++)
p[i] = (rgba[i] += ((p[i] << 4) - rgba[i]) * alpha / 16) >> 4;
}
p += 4;
for (int j = c1; j < c2; j++, p += 4)
for (int i = i1; i <= i2; i++)
p[i] = (rgba[i] += ((p[i] << 4) - rgba[i]) * alpha / 16) >> 4;
}
for (int col = c1; col <= c2; col++) {
p = result.scanLine(r2) + col * 4;
for (int i = i1; i <= i2; i++)
rgba[i] = p[i] << 4;
for (int col = c1; col <= c2; col++) {
p = result.scanLine(r2) + col * 4;
for (int i = i1; i <= i2; i++)
rgba[i] = p[i] << 4;
p -= bpl;
for (int j = r1; j < r2; j++, p -= bpl)
for (int i = i1; i <= i2; i++)
p[i] = (rgba[i] += ((p[i] << 4) - rgba[i]) * alpha / 16) >> 4;
}
p -= bpl;
for (int j = r1; j < r2; j++, p -= bpl)
for (int i = i1; i <= i2; i++)
p[i] = (rgba[i] += ((p[i] << 4) - rgba[i]) * alpha / 16) >> 4;
}
for (int row = r1; row <= r2; row++) {
p = result.scanLine(row) + c2 * 4;
for (int i = i1; i <= i2; i++)
rgba[i] = p[i] << 4;
for (int row = r1; row <= r2; row++) {
p = result.scanLine(row) + c2 * 4;
for (int i = i1; i <= i2; i++)
rgba[i] = p[i] << 4;
p -= 4;
for (int j = c1; j < c2; j++, p -= 4)
for (int i = i1; i <= i2; i++)
p[i] = (rgba[i] += ((p[i] << 4) - rgba[i]) * alpha / 16) >> 4;
}
p -= 4;
for (int j = c1; j < c2; j++, p -= 4)
for (int i = i1; i <= i2; i++)
p[i] = (rgba[i] += ((p[i] << 4) - rgba[i]) * alpha / 16) >> 4;
}
return result;
return result;
}
void PropertiesDialog::setComics(QList<ComicDB> comics)

View File

@ -6,15 +6,15 @@
#include "httprequesthandler.h"
class ErrorController : public HttpRequestHandler {
Q_OBJECT
Q_DISABLE_COPY(ErrorController);
Q_OBJECT
Q_DISABLE_COPY(ErrorController);
public:
/** Constructor */
ErrorController(int errorCode);
/** Constructor */
ErrorController(int errorCode);
/** Generates the response */
void service(HttpRequest& request, HttpResponse& response);
/** Generates the response */
void service(HttpRequest& request, HttpResponse& response);
private:
int error;
};

View File

@ -16,15 +16,15 @@
<p>
Example code for proper response generation:
<code><pre>
response.setStatus(200,"OK"); // optional, because this is the default
response.writeBody("Hello");
response.writeBody("World!",true);
response.setStatus(200,"OK"); // optional, because this is the default
response.writeBody("Hello");
response.writeBody("World!",true);
</pre></code>
<p>
Example how to return an error:
<code><pre>
response.setStatus(500,"server error");
response.write("The request cannot be processed because the servers is broken",true);
response.setStatus(500,"server error");
response.write("The request cannot be processed because the servers is broken",true);
</pre></code>
<p>
For performance reason, writing a single or few large packets is better than writing
@ -34,101 +34,101 @@
*/
class HttpResponse {
Q_DISABLE_COPY(HttpResponse)
Q_DISABLE_COPY(HttpResponse)
public:
/**
Constructor.
@param socket used to write the response
*/
HttpResponse(QTcpSocket* socket);
/**
Constructor.
@param socket used to write the response
*/
HttpResponse(QTcpSocket* socket);
/**
Set a HTTP response header
@param name name of the header
@param value value of the header
*/
void setHeader(QByteArray name, QByteArray value);
/**
Set a HTTP response header
@param name name of the header
@param value value of the header
*/
void setHeader(QByteArray name, QByteArray value);
/**
Set a HTTP response header
@param name name of the header
@param value value of the header
*/
void setHeader(QByteArray name, int value);
/**
Set a HTTP response header
@param name name of the header
@param value value of the header
*/
void setHeader(QByteArray name, int value);
/** Get the map of HTTP response headers */
QMap<QByteArray,QByteArray>& getHeaders();
/** Get the map of HTTP response headers */
QMap<QByteArray,QByteArray>& getHeaders();
/** Get the map of cookies */
QMap<QByteArray,HttpCookie>& getCookies();
/** Get the map of cookies */
QMap<QByteArray,HttpCookie>& getCookies();
/**
Set status code and description. The default is 200,OK.
*/
void setStatus(int statusCode, QByteArray description=QByteArray());
/**
Set status code and description. The default is 200,OK.
*/
void setStatus(int statusCode, QByteArray description=QByteArray());
/**
Write body data to the socket.
<p>
The HTTP status line and headers are sent automatically before the first
byte of the body gets sent.
<p>
If the response contains only a single chunk (indicated by lastPart=true),
the response is transferred in traditional mode with a Content-Length
header, which is automatically added if not already set before.
<p>
Otherwise, each part is transferred in chunked mode.
@param data Data bytes of the body
@param lastPart Indicator, if this is the last part of the response.
*/
void write(QByteArray data, bool lastPart=false);
/**
Write body data to the socket.
<p>
The HTTP status line and headers are sent automatically before the first
byte of the body gets sent.
<p>
If the response contains only a single chunk (indicated by lastPart=true),
the response is transferred in traditional mode with a Content-Length
header, which is automatically added if not already set before.
<p>
Otherwise, each part is transferred in chunked mode.
@param data Data bytes of the body
@param lastPart Indicator, if this is the last part of the response.
*/
void write(QByteArray data, bool lastPart=false);
void writeText(QString text, bool lastPart=false);
/**
Indicates wheter the body has been sent completely. Used by the connection
handler to terminate the body automatically when necessary.
*/
bool hasSentLastPart() const;
/**
Indicates wheter the body has been sent completely. Used by the connection
handler to terminate the body automatically when necessary.
*/
bool hasSentLastPart() const;
/**
Set a cookie. Cookies are sent together with the headers when the first
call to write() occurs.
*/
void setCookie(const HttpCookie& cookie);
/**
Set a cookie. Cookies are sent together with the headers when the first
call to write() occurs.
*/
void setCookie(const HttpCookie& cookie);
private:
/** Request headers */
QMap<QByteArray,QByteArray> headers;
/** Request headers */
QMap<QByteArray,QByteArray> headers;
/** Socket for writing output */
QTcpSocket* socket;
/** Socket for writing output */
QTcpSocket* socket;
/** HTTP status code*/
int statusCode;
/** HTTP status code*/
int statusCode;
/** HTTP status code description */
QByteArray statusText;
/** HTTP status code description */
QByteArray statusText;
/** Indicator whether headers have been sent */
bool sentHeaders;
/** Indicator whether headers have been sent */
bool sentHeaders;
/** Indicator whether the body has been sent completely */
bool sentLastPart;
/** Indicator whether the body has been sent completely */
bool sentLastPart;
/** Cookies */
QMap<QByteArray,HttpCookie> cookies;
/** Cookies */
QMap<QByteArray,HttpCookie> cookies;
/** Write raw data to the socket. This method blocks until all bytes have been passed to the TCP buffer */
bool writeToSocket(QByteArray data);
/** Write raw data to the socket. This method blocks until all bytes have been passed to the TCP buffer */
bool writeToSocket(QByteArray data);
/**
Write the response HTTP status and headers to the socket.
Calling this method is optional, because writeBody() calls
it automatically when required.
*/
void writeHeaders();
/**
Write the response HTTP status and headers to the socket.
Calling this method is optional, because writeBody() calls
it automatically when required.
*/
void writeHeaders();
};

View File

@ -25,72 +25,72 @@ class HttpSession {
public:
/**
Constructor.
@param canStore The session can store data, if this parameter is true.
Otherwise all calls to set() and remove() do not have any effect.
*/
HttpSession(bool canStore=false);
/**
Constructor.
@param canStore The session can store data, if this parameter is true.
Otherwise all calls to set() and remove() do not have any effect.
*/
HttpSession(bool canStore=false);
/**
Copy constructor. Creates another HttpSession object that shares the
data of the other object.
*/
HttpSession(const HttpSession& other);
/**
Copy constructor. Creates another HttpSession object that shares the
data of the other object.
*/
HttpSession(const HttpSession& other);
/**
Copy operator. Detaches from the current shared data and attaches to
the data of the other object.
*/
HttpSession& operator= (const HttpSession& other);
/**
Copy operator. Detaches from the current shared data and attaches to
the data of the other object.
*/
HttpSession& operator= (const HttpSession& other);
/**
Destructor. Detaches from the shared data.
*/
virtual ~HttpSession();
/**
Destructor. Detaches from the shared data.
*/
virtual ~HttpSession();
/** Get the unique ID of this session. This method is thread safe. */
QByteArray getId() const;
/** Get the unique ID of this session. This method is thread safe. */
QByteArray getId() const;
/**
Null sessions cannot store data. All calls to set() and remove()
do not have any effect.This method is thread safe.
*/
bool isNull() const;
/**
Null sessions cannot store data. All calls to set() and remove()
do not have any effect.This method is thread safe.
*/
bool isNull() const;
/** Set a value. This method is thread safe. */
void set(const QByteArray& key, const QVariant& value);
/** Set a value. This method is thread safe. */
void set(const QByteArray& key, const QVariant& value);
/** Remove a value. This method is thread safe. */
void remove(const QByteArray& key);
/** Remove a value. This method is thread safe. */
void remove(const QByteArray& key);
/** Get a value. This method is thread safe. */
QVariant get(const QByteArray& key) const;
/** Get a value. This method is thread safe. */
QVariant get(const QByteArray& key) const;
/** Check if a key exists. This method is thread safe. */
bool contains(const QByteArray& key) const;
/** Check if a key exists. This method is thread safe. */
bool contains(const QByteArray& key) const;
/**
Get a copy of all data stored in this session.
Changes to the session do not affect the copy and vice versa.
This method is thread safe.
*/
QMap<QByteArray,QVariant> getAll() const;
/**
Get a copy of all data stored in this session.
Changes to the session do not affect the copy and vice versa.
This method is thread safe.
*/
QMap<QByteArray,QVariant> getAll() const;
/**
Get the timestamp of last access. That is the time when the last
HttpSessionStore::getSession() has been called.
This method is thread safe.
*/
qint64 getLastAccess() const;
/**
Get the timestamp of last access. That is the time when the last
HttpSessionStore::getSession() has been called.
This method is thread safe.
*/
qint64 getLastAccess() const;
/**
Set the timestamp of last access, to renew the timeout period.
Called by HttpSessionStore::getSession().
This method is thread safe.
*/
void setLastAccess();
/**
Set the timestamp of last access, to renew the timeout period.
Called by HttpSessionStore::getSession().
This method is thread safe.
*/
void setLastAccess();
//AÑADIDO
//sets
@ -157,8 +157,8 @@ private:
};
/** Pointer to the shared data. */
HttpSessionData* dataPtr;
/** Pointer to the shared data. */
HttpSessionData* dataPtr;
};

View File

@ -40,47 +40,47 @@
*/
class StaticFileController : public HttpRequestHandler {
Q_OBJECT
Q_DISABLE_COPY(StaticFileController);
Q_OBJECT
Q_DISABLE_COPY(StaticFileController);
public:
/** Constructor */
StaticFileController(QSettings* settings, QObject* parent = 0);
/** Constructor */
StaticFileController(QSettings* settings, QObject* parent = 0);
/** Generates the response */
void service(HttpRequest& request, HttpResponse& response);
/** Generates the response */
void service(HttpRequest& request, HttpResponse& response);
private:
/** Encoding of text files */
QString encoding;
/** Encoding of text files */
QString encoding;
/** Root directory of documents */
QString docroot;
/** Root directory of documents */
QString docroot;
/** Maximum age of files in the browser cache */
int maxAge;
/** Maximum age of files in the browser cache */
int maxAge;
struct CacheEntry {
QByteArray document;
qint64 created;
};
struct CacheEntry {
QByteArray document;
qint64 created;
};
/** Timeout for each cached file */
int cacheTimeout;
/** Timeout for each cached file */
int cacheTimeout;
/** Maximum size of files in cache, larger files are not cached */
int maxCachedFileSize;
/** Maximum size of files in cache, larger files are not cached */
int maxCachedFileSize;
/** Cache storage */
QCache<QString,CacheEntry> cache;
/** Cache storage */
QCache<QString,CacheEntry> cache;
/** Used to synchronize cache access for threads */
QMutex mutex;
/** Used to synchronize cache access for threads */
QMutex mutex;
/** Set a content-type header in the response depending on the ending of the filename */
void setContentType(QString file, HttpResponse& response) const;
/** Set a content-type header in the response depending on the ending of the filename */
void setContentType(QString file, HttpResponse& response) const;
QString getLocalizedFileName(QString fileName, QString locales, QString path) const;
QString getDeviceAwareFileName(QString fileName, QString device, QString locales, QString path) const;

View File

@ -23,7 +23,7 @@
#include "db_helper.h"
RequestMapper::RequestMapper(QObject* parent)
:HttpRequestHandler(parent) {}
:HttpRequestHandler(parent) {}
void RequestMapper::service(HttpRequest& request, HttpResponse& response) {
QByteArray path=request.getPath();

View File

@ -22,48 +22,48 @@
#define DESCRIPTION "Comic reader and organizer"
void Startup::start() {
// Initialize the core application
QCoreApplication* app = QApplication::instance();
app->setApplicationName(APPNAME);
app->setOrganizationName(ORGANISATION);
QString configFileName=Static::getConfigDir()+"/"+QCoreApplication::applicationName()+".ini";
// Initialize the core application
QCoreApplication* app = QApplication::instance();
app->setApplicationName(APPNAME);
app->setOrganizationName(ORGANISATION);
QString configFileName=Static::getConfigDir()+"/"+QCoreApplication::applicationName()+".ini";
// Configure logging into files
QSettings* mainLogSettings=new QSettings(configFileName,QSettings::IniFormat,app);
mainLogSettings->beginGroup("mainLogFile");
QSettings* debugLogSettings=new QSettings(configFileName,QSettings::IniFormat,app);
debugLogSettings->beginGroup("debugLogFile");
Logger* logger=new DualFileLogger(mainLogSettings,debugLogSettings,10000,app);
logger->installMsgHandler();
// Configure logging into files
QSettings* mainLogSettings=new QSettings(configFileName,QSettings::IniFormat,app);
mainLogSettings->beginGroup("mainLogFile");
QSettings* debugLogSettings=new QSettings(configFileName,QSettings::IniFormat,app);
debugLogSettings->beginGroup("debugLogFile");
Logger* logger=new DualFileLogger(mainLogSettings,debugLogSettings,10000,app);
logger->installMsgHandler();
// Configure template loader and cache
QSettings* templateSettings=new QSettings(configFileName,QSettings::IniFormat,app);
templateSettings->beginGroup("templates");
Static::templateLoader=new TemplateCache(templateSettings,app);
// Configure template loader and cache
QSettings* templateSettings=new QSettings(configFileName,QSettings::IniFormat,app);
templateSettings->beginGroup("templates");
Static::templateLoader=new TemplateCache(templateSettings,app);
// Configure session store
QSettings* sessionSettings=new QSettings(configFileName,QSettings::IniFormat,app);
sessionSettings->beginGroup("sessions");
Static::sessionStore=new HttpSessionStore(sessionSettings,app);
// Configure session store
QSettings* sessionSettings=new QSettings(configFileName,QSettings::IniFormat,app);
sessionSettings->beginGroup("sessions");
Static::sessionStore=new HttpSessionStore(sessionSettings,app);
// Configure static file controller
QSettings* fileSettings=new QSettings(configFileName,QSettings::IniFormat,app);
fileSettings->beginGroup("docroot");
Static::staticFileController=new StaticFileController(fileSettings,app);
// Configure static file controller
QSettings* fileSettings=new QSettings(configFileName,QSettings::IniFormat,app);
fileSettings->beginGroup("docroot");
Static::staticFileController=new StaticFileController(fileSettings,app);
// Configure and start the TCP listener
qDebug("ServiceHelper: Starting service");
QSettings* listenerSettings=new QSettings(configFileName,QSettings::IniFormat,app);
listenerSettings->beginGroup("listener");
listener = new HttpListener(listenerSettings,new RequestMapper(app),app);
// Configure and start the TCP listener
qDebug("ServiceHelper: Starting service");
QSettings* listenerSettings=new QSettings(configFileName,QSettings::IniFormat,app);
listenerSettings->beginGroup("listener");
listener = new HttpListener(listenerSettings,new RequestMapper(app),app);
qDebug("ServiceHelper: Service has started");
qDebug("ServiceHelper: Service has started");
}
void Startup::stop() {
qDebug("ServiceHelper: Service has been stopped");
// QCoreApplication destroys all objects that have been created in start().
qDebug("ServiceHelper: Service has been stopped");
// QCoreApplication destroys all objects that have been created in start().
delete listener;
}

View File

@ -18,12 +18,12 @@ private:
HttpListener * listener;
public:
/** Constructor */
Startup();
/** Constructor */
Startup();
/** Start the server */
void start();
void start();
/** Stop the server */
void stop();
void stop();
QString getPort();
protected:

View File

@ -23,32 +23,32 @@
QList<QString> addresses()
{
struct ifaddrs * ifAddrStruct=NULL;
struct ifaddrs * ifa=NULL;
void * tmpAddrPtr=NULL;
struct ifaddrs * ifa=NULL;
void * tmpAddrPtr=NULL;
QList<QString> localAddreses;
getifaddrs(&ifAddrStruct);
getifaddrs(&ifAddrStruct);
for (ifa = ifAddrStruct; ifa != NULL; ifa = ifa->ifa_next) {
if (ifa ->ifa_addr->sa_family==AF_INET) { // check it is IP4
// is a valid IP4 Address
tmpAddrPtr=&((struct sockaddr_in *)ifa->ifa_addr)->sin_addr;
char addressBuffer[INET_ADDRSTRLEN];
inet_ntop(AF_INET, tmpAddrPtr, addressBuffer, INET_ADDRSTRLEN);
QString add(addressBuffer);
for (ifa = ifAddrStruct; ifa != NULL; ifa = ifa->ifa_next) {
if (ifa ->ifa_addr->sa_family==AF_INET) { // check it is IP4
// is a valid IP4 Address
tmpAddrPtr=&((struct sockaddr_in *)ifa->ifa_addr)->sin_addr;
char addressBuffer[INET_ADDRSTRLEN];
inet_ntop(AF_INET, tmpAddrPtr, addressBuffer, INET_ADDRSTRLEN);
QString add(addressBuffer);
localAddreses.push_back(QString(addressBuffer));
//printf("%s IP Address %s\n", ifa->ifa_name, addressBuffer);
} else if (ifa->ifa_addr->sa_family==AF_INET6) { // check it is IP6
// is a valid IP6 Address
tmpAddrPtr=&((struct sockaddr_in6 *)ifa->ifa_addr)->sin6_addr;
char addressBuffer[INET6_ADDRSTRLEN];
inet_ntop(AF_INET6, tmpAddrPtr, addressBuffer, INET6_ADDRSTRLEN);
//printf("%s IP Address %s\n", ifa->ifa_name, addressBuffer);
}
}
if (ifAddrStruct!=NULL) freeifaddrs(ifAddrStruct);
return localAddreses;
//printf("%s IP Address %s\n", ifa->ifa_name, addressBuffer);
} else if (ifa->ifa_addr->sa_family==AF_INET6) { // check it is IP6
// is a valid IP6 Address
tmpAddrPtr=&((struct sockaddr_in6 *)ifa->ifa_addr)->sin6_addr;
char addressBuffer[INET6_ADDRSTRLEN];
inet_ntop(AF_INET6, tmpAddrPtr, addressBuffer, INET6_ADDRSTRLEN);
//printf("%s IP Address %s\n", ifa->ifa_name, addressBuffer);
}
}
if (ifAddrStruct!=NULL) freeifaddrs(ifAddrStruct);
return localAddreses;
}
#endif
@ -89,7 +89,7 @@ ServerConfigDialog::ServerConfigDialog(QWidget * parent)
//FORM---------------------------------------------------------------------
QWidget * form = new QWidget(this);
QFormLayout * formLayout = new QFormLayout;
QFormLayout * formLayout = new QFormLayout;
/*QLabel * ipLabel = new QLabel(tr("IP address"),this);
ipLabel->move(452,75);
@ -101,22 +101,22 @@ ServerConfigDialog::ServerConfigDialog(QWidget * parent)
ip = new QComboBox(this);
connect(ip,SIGNAL(activated(const QString &)),this,SLOT(regenerateQR(const QString &)));
//ip->move(520,71);
//ip->move(520,71);
#ifndef Q_OS_WIN32
ip->setStyleSheet("QComboBox{font-size:10px;}");
ip->setStyleSheet("QComboBox{font-size:10px;}");
#endif
ip->setSizeAdjustPolicy(QComboBox::AdjustToContents);
ip->setSizeAdjustPolicy(QComboBox::AdjustToContents);
#ifdef Q_OS_WIN32
ip->setMinimumWidth(120);
ip->setMinimumWidth(120);
#else
ip->setFixedSize(120,ip->height());
ip->setFixedSize(120,ip->height());
#endif
port = new QLineEdit("8080",this);
port->setReadOnly(false);
port->setMaximumWidth(50);
port->setMaximumWidth(50);
#ifndef Q_OS_WIN32
port->setStyleSheet("QLineEdit{font-size:10px;}");
port->setStyleSheet("QLineEdit{font-size:10px;}");
#endif
//port->move(520,110);
QValidator *validator = new QIntValidator(1024, 65535, this);
@ -125,7 +125,7 @@ ServerConfigDialog::ServerConfigDialog(QWidget * parent)
//accept->move(514,149);
connect(accept,SIGNAL(pressed()),this,SLOT(updatePort()));
formLayout->addRow(tr("IP address"),ip);
formLayout->addRow(tr("IP address"),ip);
formLayout->addRow(tr("Port"),port);
formLayout->addRow("",accept);
@ -133,7 +133,7 @@ ServerConfigDialog::ServerConfigDialog(QWidget * parent)
#ifdef Q_OS_WIN32
form->move(444,70);
#else
form->move(435,70);
form->move(435,70);
#endif
//END FORM-----------------------------------------------------------------

View File

@ -9,11 +9,11 @@
#include <QAction>
YACReaderMainToolBar::YACReaderMainToolBar(QWidget *parent) :
QWidget(parent)
QWidget(parent)
{
mainLayout = new QHBoxLayout;
mainLayout = new QHBoxLayout;
currentFolder = new QLabel(this);
currentFolder = new QLabel(this);
currentFolder->setAlignment(Qt::AlignCenter);
currentFolder->setStyleSheet(" QLabel {color:#404040; font-size:22px; font-weight:bold;}");
@ -23,92 +23,92 @@ YACReaderMainToolBar::YACReaderMainToolBar(QWidget *parent) :
QString qToolButtonStyleSheet = "QToolButton {border:none;}";
backButton = new QToolButton();
backButton->setStyleSheet(qToolButtonStyleSheet);
backButton = new QToolButton();
backButton->setStyleSheet(qToolButtonStyleSheet);
forwardButton = new QToolButton();
forwardButton->setStyleSheet(qToolButtonStyleSheet);
forwardButton = new QToolButton();
forwardButton->setStyleSheet(qToolButtonStyleSheet);
forwardButton->setDisabled(true);
settingsButton = new QToolButton();
settingsButton->setStyleSheet(qToolButtonStyleSheet);
settingsButton = new QToolButton();
settingsButton->setStyleSheet(qToolButtonStyleSheet);
settingsButton->setIconSize(QSize(24,24));
serverButton = new QToolButton();
serverButton->setStyleSheet(qToolButtonStyleSheet);
serverButton->setIconSize(QSize(17,24));
serverButton = new QToolButton();
serverButton->setStyleSheet(qToolButtonStyleSheet);
serverButton->setIconSize(QSize(17,24));
helpButton = new QToolButton();
helpButton->setStyleSheet(qToolButtonStyleSheet);
helpButton->setIconSize(QSize(14,25));
helpButton = new QToolButton();
helpButton->setStyleSheet(qToolButtonStyleSheet);
helpButton->setIconSize(QSize(14,25));
fullscreenButton = new QToolButton();
fullscreenButton->setStyleSheet(qToolButtonStyleSheet);
fullscreenButton->setIconSize(QSize(24,24));
fullscreenButton = new QToolButton();
fullscreenButton->setStyleSheet(qToolButtonStyleSheet);
fullscreenButton->setIconSize(QSize(24,24));
mainLayout->setMargin(0);
mainLayout->setSpacing(0);
mainLayout->setMargin(0);
mainLayout->setSpacing(0);
mainLayout->addSpacing(12);
mainLayout->addWidget(backButton);
addDivider();
mainLayout->addWidget(forwardButton);
mainLayout->addSpacing(12);
mainLayout->addWidget(backButton);
addDivider();
mainLayout->addWidget(forwardButton);
mainLayout->addSpacing(34);
mainLayout->addWidget(settingsButton);
addWideDivider();
mainLayout->addWidget(serverButton);
addWideDivider();
mainLayout->addWidget(helpButton);
mainLayout->addSpacing(34);
mainLayout->addWidget(settingsButton);
addWideDivider();
mainLayout->addWidget(serverButton);
addWideDivider();
mainLayout->addWidget(helpButton);
mainLayout->addStretch();
mainLayout->addStretch();
mainLayout->addWidget(fullscreenButton);
mainLayout->addSpacing(10);
mainLayout->addWidget(fullscreenButton);
mainLayout->addSpacing(10);
setLayout(mainLayout);
setLayout(mainLayout);
setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed);
setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed);
}
QSize YACReaderMainToolBar::sizeHint() const
{
return QSize(200,40);
return QSize(200,40);
}
void YACReaderMainToolBar::paintEvent(QPaintEvent * event)
{
Q_UNUSED(event);
Q_UNUSED(event);
QPainter painter (this);
painter.fillRect(0,0,width(),height(),QColor("#F0F0F0"));
QPainter painter (this);
painter.fillRect(0,0,width(),height(),QColor("#F0F0F0"));
}
void YACReaderMainToolBar::resizeEvent(QResizeEvent * event)
{
currentFolder->move((event->size().width()-currentFolder->width())/2,(event->size().height()-currentFolder->height())/2);
currentFolder->move((event->size().width()-currentFolder->width())/2,(event->size().height()-currentFolder->height())/2);
}
void YACReaderMainToolBar::addDivider()
{
QPixmap img(":/images/main_toolbar/divider.png");
QLabel * divider = new QLabel();
divider->setPixmap(img);
QPixmap img(":/images/main_toolbar/divider.png");
QLabel * divider = new QLabel();
divider->setPixmap(img);
mainLayout->addSpacing(5);
mainLayout->addWidget(divider);
mainLayout->addSpacing(5);
mainLayout->addSpacing(5);
mainLayout->addWidget(divider);
mainLayout->addSpacing(5);
}
void YACReaderMainToolBar::addWideDivider()
{
mainLayout->addSpacing(3);
addDivider();
mainLayout->addSpacing(3);
mainLayout->addSpacing(3);
addDivider();
mainLayout->addSpacing(3);
}
void YACReaderMainToolBar::setCurrentFolderName(const QString & name)

View File

@ -11,37 +11,37 @@ class QHBoxLayout;
class YACReaderMainToolBar : public QWidget
{
Q_OBJECT
Q_OBJECT
public:
explicit YACReaderMainToolBar(QWidget *parent = 0);
QSize sizeHint() const;
explicit YACReaderMainToolBar(QWidget *parent = 0);
QSize sizeHint() const;
QToolButton * backButton;
QToolButton * forwardButton;
QToolButton * settingsButton;
QToolButton * serverButton;
QToolButton * helpButton;
QToolButton * fullscreenButton;
QToolButton * forwardButton;
QToolButton * settingsButton;
QToolButton * serverButton;
QToolButton * helpButton;
QToolButton * fullscreenButton;
void setCurrentFolderName(const QString & name);
signals:
public slots:
private:
void paintEvent(QPaintEvent *);
void resizeEvent(QResizeEvent *);
void paintEvent(QPaintEvent *);
void resizeEvent(QResizeEvent *);
QHBoxLayout * mainLayout;
QLabel * currentFolder;
QLabel * currentFolder;
void addDivider();
void addWideDivider();
void addDivider();
void addWideDivider();
};
#endif // YACREADER_MAIN_TOOLBAR_H

View File

@ -13,18 +13,18 @@
#define PREVIOUS_VERSION "6.0.0"
HttpVersionChecker::HttpVersionChecker()
:QThread()
:QThread()
{
http = new QHttp(this);
http = new QHttp(this);
connect(http, SIGNAL(requestFinished(int, bool)),
this, SLOT(httpRequestFinished(int, bool)));
connect(http, SIGNAL(requestFinished(int, bool)),
this, SLOT(httpRequestFinished(int, bool)));
connect(http, SIGNAL(responseHeaderReceived(const QHttpResponseHeader &)),
this, SLOT(readResponseHeader(const QHttpResponseHeader &)));
connect(http, SIGNAL(responseHeaderReceived(const QHttpResponseHeader &)),
this, SLOT(readResponseHeader(const QHttpResponseHeader &)));
connect(http, SIGNAL(readyRead(const QHttpResponseHeader &)),
this, SLOT(read(const QHttpResponseHeader &)));
connect(http, SIGNAL(readyRead(const QHttpResponseHeader &)),
this, SLOT(read(const QHttpResponseHeader &)));
}
void HttpVersionChecker::get()
@ -36,33 +36,33 @@ void HttpVersionChecker::get()
void HttpVersionChecker::run()
{
QNetworkAccessManager manager;
QEventLoop q;
QTimer tT;
tT.setSingleShot(true);
connect(&tT, SIGNAL(timeout()), &q, SLOT(quit()));
connect(&manager, SIGNAL(finished(QNetworkReply*)),&q, SLOT(quit()));
QNetworkReply *reply = manager.get(QNetworkRequest(
QUrl("https://bitbucket.org/luisangelsm/yacreader/wiki/Home")));
tT.start(5000); // 5s timeout
q.exec();
if(tT.isActive()){
// download complete
checkNewVersion(reply->readAll());
tT.stop();
} else {
// timeout
}
QEventLoop q;
QTimer tT;
/*QUrl url("http://code.google.com/p/yacreader/downloads/list");
QHttp::ConnectionMode mode = QHttp::ConnectionModeHttp;
http->setHost(url.host(), mode, url.port() == -1 ? 0 : url.port());
QByteArray path = QUrl::toPercentEncoding(url.path(), "!$&'()*+,;=:@/");
if (path.isEmpty())
path = "/";
httpGetId = http->get(path, 0);
tT.setSingleShot(true);
connect(&tT, SIGNAL(timeout()), &q, SLOT(quit()));
connect(&manager, SIGNAL(finished(QNetworkReply*)),&q, SLOT(quit()));
QNetworkReply *reply = manager.get(QNetworkRequest(
QUrl("https://bitbucket.org/luisangelsm/yacreader/wiki/Home")));
tT.start(5000); // 5s timeout
q.exec();
if(tT.isActive()){
// download complete
checkNewVersion(reply->readAll());
tT.stop();
} else {
// timeout
}
/*QUrl url("http://code.google.com/p/yacreader/downloads/list");
QHttp::ConnectionMode mode = QHttp::ConnectionModeHttp;
http->setHost(url.host(), mode, url.port() == -1 ? 0 : url.port());
QByteArray path = QUrl::toPercentEncoding(url.path(), "!$&'()*+,;=:@/");
if (path.isEmpty())
path = "/";
httpGetId = http->get(path, 0);
exec();*/
}
void HttpVersionChecker::readResponseHeader(const QHttpResponseHeader &responseHeader)
@ -71,13 +71,13 @@ void HttpVersionChecker::readResponseHeader(const QHttpResponseHeader &responseH
}
void HttpVersionChecker::read(const QHttpResponseHeader &){
content.append(http->readAll());
content.append(http->readAll());
}
void HttpVersionChecker::httpRequestFinished(int requestId, bool error)
{
#ifdef QT_DEBUG
QString response("YACReader-5.0.0 win32.exe");
QString response("YACReader-5.0.0 win32.exe");
#else
QString response(content);
#endif
@ -89,25 +89,25 @@ void HttpVersionChecker::httpRequestFinished(int requestId, bool error)
bool HttpVersionChecker::checkNewVersion(QString sourceContent)
{
#ifdef Q_OS_WIN32
QRegExp rx(".*YACReader\\-([0-9]+).([0-9]+).([0-9]+)\\.?([0-9]+)?.{0,5}win32.*");
QRegExp rx(".*YACReader\\-([0-9]+).([0-9]+).([0-9]+)\\.?([0-9]+)?.{0,5}win32.*");
#endif
#ifdef Q_OS_LINUX
QRegExp rx(".*YACReader\\-([0-9]+).([0-9]+).([0-9]+)\\.?([0-9]+)?.{0,5}X11.*");
QRegExp rx(".*YACReader\\-([0-9]+).([0-9]+).([0-9]+)\\.?([0-9]+)?.{0,5}X11.*");
#endif
#ifdef Q_OS_MAC
QRegExp rx(".*YACReader\\-([0-9]+).([0-9]+).([0-9]+)\\.?([0-9]+)?.{0,5}Mac.*");
QRegExp rx(".*YACReader\\-([0-9]+).([0-9]+).([0-9]+)\\.?([0-9]+)?.{0,5}Mac.*");
#endif
int index = 0;
bool newVersion = false;
bool sameVersion = true;
int index = 0;
bool newVersion = false;
bool sameVersion = true;
//bool currentVersionIsNewer = false;
#ifdef QT_DEBUG
QString version(PREVIOUS_VERSION);
#else
QString version(VERSION);
QString version(VERSION);
#endif
QStringList sl = version.split(".");
if((index = rx.indexIn(sourceContent))!=-1)

View File

@ -10,21 +10,21 @@
class HttpVersionChecker : public QThread
{
Q_OBJECT
public:
HttpVersionChecker();
bool thereIsNewVersion();
public slots:
void httpRequestFinished(int requestId, bool error);
void readResponseHeader(const QHttpResponseHeader &);
void read(const QHttpResponseHeader &);
void get();
private:
Q_OBJECT
public:
HttpVersionChecker();
bool thereIsNewVersion();
public slots:
void httpRequestFinished(int requestId, bool error);
void readResponseHeader(const QHttpResponseHeader &);
void read(const QHttpResponseHeader &);
void get();
private:
void run();
QHttp *http;
int httpGetId;
QByteArray content;
bool found;
QHttp *http;
int httpGetId;
QByteArray content;
bool found;
bool checkNewVersion(QString sourceContent);
signals:
void newVersionDetected();

View File

@ -25,221 +25,221 @@
/*
int naturalCompare(const QString &_a, const QString &_b, Qt::CaseSensitivity caseSensitivity)
{
// This method chops the input a and b into pieces of
// digits and non-digits (a1.05 becomes a | 1 | . | 05)
// and compares these pieces of a and b to each other
// (first with first, second with second, ...).
//
// This is based on the natural sort order code code by Martin Pool
// http://sourcefrog.net/projects/natsort/
// Martin Pool agreed to license this under LGPL or GPL.
// This method chops the input a and b into pieces of
// digits and non-digits (a1.05 becomes a | 1 | . | 05)
// and compares these pieces of a and b to each other
// (first with first, second with second, ...).
//
// This is based on the natural sort order code code by Martin Pool
// http://sourcefrog.net/projects/natsort/
// Martin Pool agreed to license this under LGPL or GPL.
// FIXME: Using toLower() to implement case insensitive comparison is
// sub-optimal, but is needed because we compare strings with
// localeAwareCompare(), which does not know about case sensitivity.
// A task has been filled for this in Qt Task Tracker with ID 205990.
// http://trolltech.com/developer/task-tracker/index_html?method=entry&id=205990
QString a;
QString b;
if (caseSensitivity == Qt::CaseSensitive) {
a = _a;
b = _b;
} else {
a = _a.toLower();
b = _b.toLower();
}
// FIXME: Using toLower() to implement case insensitive comparison is
// sub-optimal, but is needed because we compare strings with
// localeAwareCompare(), which does not know about case sensitivity.
// A task has been filled for this in Qt Task Tracker with ID 205990.
// http://trolltech.com/developer/task-tracker/index_html?method=entry&id=205990
QString a;
QString b;
if (caseSensitivity == Qt::CaseSensitive) {
a = _a;
b = _b;
} else {
a = _a.toLower();
b = _b.toLower();
}
const QChar* currA = a.unicode(); // iterator over a
const QChar* currB = b.unicode(); // iterator over b
const QChar* currA = a.unicode(); // iterator over a
const QChar* currB = b.unicode(); // iterator over b
if (currA == currB) {
return 0;
}
if (currA == currB) {
return 0;
}
const QChar* begSeqA = currA; // beginning of a new character sequence of a
const QChar* begSeqB = currB;
const QChar* begSeqA = currA; // beginning of a new character sequence of a
const QChar* begSeqB = currB;
while (!currA->isNull() && !currB->isNull()) {
if (currA->unicode() == QChar::ObjectReplacementCharacter) {
return 1;
}
while (!currA->isNull() && !currB->isNull()) {
if (currA->unicode() == QChar::ObjectReplacementCharacter) {
return 1;
}
if (currB->unicode() == QChar::ObjectReplacementCharacter) {
return -1;
}
if (currB->unicode() == QChar::ObjectReplacementCharacter) {
return -1;
}
if (currA->unicode() == QChar::ReplacementCharacter) {
return 1;
}
if (currA->unicode() == QChar::ReplacementCharacter) {
return 1;
}
if (currB->unicode() == QChar::ReplacementCharacter) {
return -1;
}
if (currB->unicode() == QChar::ReplacementCharacter) {
return -1;
}
// find sequence of characters ending at the first non-character
while (!currA->isNull() && !currA->isDigit() && !currA->isPunct() && !currA->isSpace()) {
++currA;
}
// find sequence of characters ending at the first non-character
while (!currA->isNull() && !currA->isDigit() && !currA->isPunct() && !currA->isSpace()) {
++currA;
}
while (!currB->isNull() && !currB->isDigit() && !currB->isPunct() && !currB->isSpace()) {
++currB;
}
while (!currB->isNull() && !currB->isDigit() && !currB->isPunct() && !currB->isSpace()) {
++currB;
}
// compare these sequences
const QStringRef& subA(a.midRef(begSeqA - a.unicode(), currA - begSeqA));
const QStringRef& subB(b.midRef(begSeqB - b.unicode(), currB - begSeqB));
const int cmp = QStringRef::localeAwareCompare(subA, subB);
if (cmp != 0) {
return cmp < 0 ? -1 : +1;
}
// compare these sequences
const QStringRef& subA(a.midRef(begSeqA - a.unicode(), currA - begSeqA));
const QStringRef& subB(b.midRef(begSeqB - b.unicode(), currB - begSeqB));
const int cmp = QStringRef::localeAwareCompare(subA, subB);
if (cmp != 0) {
return cmp < 0 ? -1 : +1;
}
if (currA->isNull() || currB->isNull()) {
break;
}
if (currA->isNull() || currB->isNull()) {
break;
}
// find sequence of characters ending at the first non-character
while (currA->isPunct() || currA->isSpace() || currB->isPunct() || currB->isSpace()) {
if (*currA != *currB) {
return (*currA < *currB) ? -1 : +1;
}
++currA;
++currB;
}
// find sequence of characters ending at the first non-character
while (currA->isPunct() || currA->isSpace() || currB->isPunct() || currB->isSpace()) {
if (*currA != *currB) {
return (*currA < *currB) ? -1 : +1;
}
++currA;
++currB;
}
// now some digits follow...
if ((*currA == '0') || (*currB == '0')) {
// one digit-sequence starts with 0 -> assume we are in a fraction part
// do left aligned comparison (numbers are considered left aligned)
while (1) {
if (!currA->isDigit() && !currB->isDigit()) {
break;
} else if (!currA->isDigit()) {
return +1;
} else if (!currB->isDigit()) {
return -1;
} else if (*currA < *currB) {
return -1;
} else if (*currA > *currB) {
return + 1;
}
++currA;
++currB;
}
} else {
// No digit-sequence starts with 0 -> assume we are looking at some integer
// do right aligned comparison.
//
// The longest run of digits wins. That aside, the greatest
// value wins, but we can't know that it will until we've scanned
// both numbers to know that they have the same magnitude.
// now some digits follow...
if ((*currA == '0') || (*currB == '0')) {
// one digit-sequence starts with 0 -> assume we are in a fraction part
// do left aligned comparison (numbers are considered left aligned)
while (1) {
if (!currA->isDigit() && !currB->isDigit()) {
break;
} else if (!currA->isDigit()) {
return +1;
} else if (!currB->isDigit()) {
return -1;
} else if (*currA < *currB) {
return -1;
} else if (*currA > *currB) {
return + 1;
}
++currA;
++currB;
}
} else {
// No digit-sequence starts with 0 -> assume we are looking at some integer
// do right aligned comparison.
//
// The longest run of digits wins. That aside, the greatest
// value wins, but we can't know that it will until we've scanned
// both numbers to know that they have the same magnitude.
bool isFirstRun = true;
int weight = 0;
while (1) {
if (!currA->isDigit() && !currB->isDigit()) {
if (weight != 0) {
return weight;
}
break;
} else if (!currA->isDigit()) {
if (isFirstRun) {
return *currA < *currB ? -1 : +1;
} else {
return -1;
}
} else if (!currB->isDigit()) {
if (isFirstRun) {
return *currA < *currB ? -1 : +1;
} else {
return +1;
}
} else if ((*currA < *currB) && (weight == 0)) {
weight = -1;
} else if ((*currA > *currB) && (weight == 0)) {
weight = + 1;
}
++currA;
++currB;
isFirstRun = false;
}
}
bool isFirstRun = true;
int weight = 0;
while (1) {
if (!currA->isDigit() && !currB->isDigit()) {
if (weight != 0) {
return weight;
}
break;
} else if (!currA->isDigit()) {
if (isFirstRun) {
return *currA < *currB ? -1 : +1;
} else {
return -1;
}
} else if (!currB->isDigit()) {
if (isFirstRun) {
return *currA < *currB ? -1 : +1;
} else {
return +1;
}
} else if ((*currA < *currB) && (weight == 0)) {
weight = -1;
} else if ((*currA > *currB) && (weight == 0)) {
weight = + 1;
}
++currA;
++currB;
isFirstRun = false;
}
}
begSeqA = currA;
begSeqB = currB;
}
begSeqA = currA;
begSeqB = currB;
}
if (currA->isNull() && currB->isNull()) {
return 0;
}
if (currA->isNull() && currB->isNull()) {
return 0;
}
return currA->isNull() ? -1 : + 1;
return currA->isNull() ? -1 : + 1;
}
*/
static inline QChar getNextChar(const QString &s, int location)
{
return (location < s.length()) ? s.at(location) : QChar();
return (location < s.length()) ? s.at(location) : QChar();
}
int naturalCompare(const QString &s1, const QString &s2, Qt::CaseSensitivity cs)
{
for (int l1 = 0, l2 = 0; l1 <= s1.count() && l2 <= s2.count(); ++l1, ++l2) {
// skip spaces, tabs and 0's
QChar c1 = getNextChar(s1, l1);
while (c1.isSpace())
c1 = getNextChar(s1, ++l1);
QChar c2 = getNextChar(s2, l2);
while (c2.isSpace())
c2 = getNextChar(s2, ++l2);
for (int l1 = 0, l2 = 0; l1 <= s1.count() && l2 <= s2.count(); ++l1, ++l2) {
// skip spaces, tabs and 0's
QChar c1 = getNextChar(s1, l1);
while (c1.isSpace())
c1 = getNextChar(s1, ++l1);
QChar c2 = getNextChar(s2, l2);
while (c2.isSpace())
c2 = getNextChar(s2, ++l2);
if (c1.isDigit() && c2.isDigit()) {
while (c1.digitValue() == 0)
c1 = getNextChar(s1, ++l1);
while (c2.digitValue() == 0)
c2 = getNextChar(s2, ++l2);
if (c1.isDigit() && c2.isDigit()) {
while (c1.digitValue() == 0)
c1 = getNextChar(s1, ++l1);
while (c2.digitValue() == 0)
c2 = getNextChar(s2, ++l2);
int lookAheadLocation1 = l1;
int lookAheadLocation2 = l2;
int currentReturnValue = 0;
// find the last digit, setting currentReturnValue as we go if it isn't equal
for (
QChar lookAhead1 = c1, lookAhead2 = c2;
(lookAheadLocation1 <= s1.length() && lookAheadLocation2 <= s2.length());
lookAhead1 = getNextChar(s1, ++lookAheadLocation1),
lookAhead2 = getNextChar(s2, ++lookAheadLocation2)
) {
bool is1ADigit = !lookAhead1.isNull() && lookAhead1.isDigit();
bool is2ADigit = !lookAhead2.isNull() && lookAhead2.isDigit();
if (!is1ADigit && !is2ADigit)
break;
if (!is1ADigit)
return -1;
if (!is2ADigit)
return 1;
if (currentReturnValue == 0) {
if (lookAhead1 < lookAhead2) {
currentReturnValue = -1;
} else if (lookAhead1 > lookAhead2) {
currentReturnValue = 1;
}
}
}
if (currentReturnValue != 0)
return currentReturnValue;
}
int lookAheadLocation1 = l1;
int lookAheadLocation2 = l2;
int currentReturnValue = 0;
// find the last digit, setting currentReturnValue as we go if it isn't equal
for (
QChar lookAhead1 = c1, lookAhead2 = c2;
(lookAheadLocation1 <= s1.length() && lookAheadLocation2 <= s2.length());
lookAhead1 = getNextChar(s1, ++lookAheadLocation1),
lookAhead2 = getNextChar(s2, ++lookAheadLocation2)
) {
bool is1ADigit = !lookAhead1.isNull() && lookAhead1.isDigit();
bool is2ADigit = !lookAhead2.isNull() && lookAhead2.isDigit();
if (!is1ADigit && !is2ADigit)
break;
if (!is1ADigit)
return -1;
if (!is2ADigit)
return 1;
if (currentReturnValue == 0) {
if (lookAhead1 < lookAhead2) {
currentReturnValue = -1;
} else if (lookAhead1 > lookAhead2) {
currentReturnValue = 1;
}
}
}
if (currentReturnValue != 0)
return currentReturnValue;
}
if (cs == Qt::CaseInsensitive) {
if (!c1.isLower()) c1 = c1.toLower();
if (!c2.isLower()) c2 = c2.toLower();
}
int r = QString::localeAwareCompare(c1, c2);
if (r < 0)
return -1;
if (r > 0)
return 1;
}
// The two strings are the same (02 == 2) so fall back to the normal sort
return QString::compare(s1, s2, cs);
if (cs == Qt::CaseInsensitive) {
if (!c1.isLower()) c1 = c1.toLower();
if (!c2.isLower()) c2 = c2.toLower();
}
int r = QString::localeAwareCompare(c1, c2);
if (r < 0)
return -1;
if (r > 0)
return 1;
}
// The two strings are the same (02 == 2) so fall back to the normal sort
return QString::compare(s1, s2, cs);
}
bool naturalSortLessThanCS( const QString &left, const QString &right )
{

View File

@ -128,8 +128,8 @@ protected:
GLuint defaultTexture;
GLuint markTexture;
GLuint readingTexture;
void initializeGL();
void paintGL();
void initializeGL();
void paintGL();
void timerEvent(QTimerEvent *);
//number of Covers
@ -171,11 +171,11 @@ public:
/*Constructor*/
YACReaderFlowGL(QWidget *parent = 0,struct Preset p = pressetYACReaderFlowDownConfig);
virtual ~YACReaderFlowGL();
virtual ~YACReaderFlowGL();
//size;
QSize minimumSizeHint() const;
//QSize sizeHint() const;
QSize minimumSizeHint() const;
//QSize sizeHint() const;
/*functions*/

View File

@ -166,7 +166,7 @@ QList<QString> CompressedArchive::getFileNames()
int CompressedArchive::getNumFiles()
{
quint32 numItems = 0;
szInterface->archive->GetNumberOfItems(&numItems);
szInterface->archive->GetNumberOfItems(&numItems);
return numItems;
}
QList<QByteArray> CompressedArchive::getAllData(const QVector<quint32> & indexes, ExtractDelegate * delegate)

View File

@ -18,7 +18,7 @@ public slots:
void loadHelp(const QString & path);
private:
QTabWidget *tabWidget;
QTabWidget *tabWidget;
QTextBrowser *aboutText;
QTextBrowser *helpText;
QString fileToString(const QString & path);

View File

@ -23,164 +23,164 @@ void YACReaderBusyWidget::paintEvent(QPaintEvent * event)
}
BusyIndicator::BusyIndicator(QWidget *parent) :
QWidget(parent),
startAngle(0),
m_style(StyleArc)
QWidget(parent),
startAngle(0),
m_style(StyleArc)
{
QSizePolicy policy(QSizePolicy::Preferred, QSizePolicy::Fixed);
policy.setHeightForWidth(true);
setSizePolicy(policy);
QSizePolicy policy(QSizePolicy::Preferred, QSizePolicy::Fixed);
policy.setHeightForWidth(true);
setSizePolicy(policy);
fillColor = palette().color(QPalette::WindowText);
fillColor = palette().color(QPalette::WindowText);
timer.setInterval(16);
connect(&timer, SIGNAL(timeout()), this, SLOT(rotate()));
timer.start();
timer.setInterval(16);
connect(&timer, SIGNAL(timeout()), this, SLOT(rotate()));
timer.start();
}
void BusyIndicator::rotate()
{
startAngle += 9;
startAngle %= 360;
update();
startAngle += 9;
startAngle %= 360;
update();
}
void BusyIndicator::setIndicatorStyle(IndicatorStyle style)
{
m_style = style;
update();
m_style = style;
update();
}
void BusyIndicator::setColor(QColor color)
{
fillColor = color;
fillColor = color;
}
const BusyIndicator::IndicatorStyle BusyIndicator::indicatorStyle() const
{
return m_style;
return m_style;
}
QPixmap BusyIndicator::generatePixmap(int side)
{
QPixmap pixmap(QSize(side, side));
pixmap.fill(QColor(255, 255, 255, 0));
QPixmap pixmap(QSize(side, side));
pixmap.fill(QColor(255, 255, 255, 0));
QPainter painter(&pixmap);
painter.setRenderHint(QPainter::Antialiasing);
QPainter painter(&pixmap);
painter.setRenderHint(QPainter::Antialiasing);
painter.translate(side / 2, side / 2);
painter.scale(side / 200.0, side / 200.0);
painter.translate(side / 2, side / 2);
painter.scale(side / 200.0, side / 200.0);
switch (m_style) {
case StyleRect:
drawRectStyle(&painter);
break;
case StyleEllipse:
drawEllipseStyle(&painter);
break;
case StyleArc:
drawArcStyle(&painter);
break;
}
return pixmap;
switch (m_style) {
case StyleRect:
drawRectStyle(&painter);
break;
case StyleEllipse:
drawEllipseStyle(&painter);
break;
case StyleArc:
drawArcStyle(&painter);
break;
}
return pixmap;
}
void BusyIndicator::drawRectStyle(QPainter *painter)
{
// QColor color = palette().color(QPalette::WindowText);
QColor color = fillColor;
QBrush brush(color);
painter->setPen(Qt::NoPen);
// QColor color = palette().color(QPalette::WindowText);
QColor color = fillColor;
QBrush brush(color);
painter->setPen(Qt::NoPen);
painter->rotate(startAngle);
painter->rotate(startAngle);
float angle = 0;
while (angle < 360) {
painter->setBrush(brush);
painter->drawRect(-8, -100, 16, 35);
float angle = 0;
while (angle < 360) {
painter->setBrush(brush);
painter->drawRect(-8, -100, 16, 35);
painter->rotate(30);
angle += 30;
painter->rotate(30);
angle += 30;
color.setAlphaF(angle / 360);
brush.setColor(color);
}
color.setAlphaF(angle / 360);
brush.setColor(color);
}
}
void BusyIndicator::drawEllipseStyle(QPainter *painter)
{
// QColor color = palette().color(QPalette::WindowText);
QColor color = fillColor;
QBrush brush(color);
painter->setPen(Qt::NoPen);
// QColor color = palette().color(QPalette::WindowText);
QColor color = fillColor;
QBrush brush(color);
painter->setPen(Qt::NoPen);
painter->rotate(startAngle);
painter->rotate(startAngle);
float angle = 0;
while (angle < 360) {
painter->setBrush(brush);
painter->drawEllipse(-10, -100, 30, 30);
float angle = 0;
while (angle < 360) {
painter->setBrush(brush);
painter->drawEllipse(-10, -100, 30, 30);
painter->rotate(30);
angle += 30;
painter->rotate(30);
angle += 30;
color.setAlphaF(angle / 360);
brush.setColor(color);
}
color.setAlphaF(angle / 360);
brush.setColor(color);
}
}
void BusyIndicator::drawArcStyle(QPainter *painter)
{
// QColor color = palette().color(QPalette::WindowText);
QColor color = fillColor;
QConicalGradient gradient(0, 0, -startAngle);
gradient.setColorAt(0, color);
color.setAlpha(0);
gradient.setColorAt(0.8, color);
color.setAlpha(255);
gradient.setColorAt(1, color);
// QColor color = palette().color(QPalette::WindowText);
QColor color = fillColor;
QConicalGradient gradient(0, 0, -startAngle);
gradient.setColorAt(0, color);
color.setAlpha(0);
gradient.setColorAt(0.8, color);
color.setAlpha(255);
gradient.setColorAt(1, color);
QPen pen;
pen.setWidth(30);
pen.setBrush(QBrush(gradient));
painter->setPen(pen);
QPen pen;
pen.setWidth(30);
pen.setBrush(QBrush(gradient));
painter->setPen(pen);
painter->drawArc(-85, -85, 170, 170, 0 * 16, 360 * 16);
painter->drawArc(-85, -85, 170, 170, 0 * 16, 360 * 16);
}
void BusyIndicator::paintEvent(QPaintEvent *)
{
QString key = QString("%1:%2:%3:%4:%5")
.arg(metaObject()->className())
.arg(width())
.arg(height())
.arg(startAngle)
.arg(m_style);
QString key = QString("%1:%2:%3:%4:%5")
.arg(metaObject()->className())
.arg(width())
.arg(height())
.arg(startAngle)
.arg(m_style);
QPixmap pixmap;
QPainter painter(this);
painter.setRenderHint(QPainter::Antialiasing);
QPixmap pixmap;
QPainter painter(this);
painter.setRenderHint(QPainter::Antialiasing);
int side = qMin(width(), height());
int side = qMin(width(), height());
if(!QPixmapCache::find(key, &pixmap)) {
pixmap = generatePixmap(side);
QPixmapCache::insert(key, pixmap);
}
if(!QPixmapCache::find(key, &pixmap)) {
pixmap = generatePixmap(side);
QPixmapCache::insert(key, pixmap);
}
painter.translate(width() / 2 - side / 2, height() / 2 - side / 2);
painter.translate(width() / 2 - side / 2, height() / 2 - side / 2);
painter.drawPixmap(0, 0, side, side, pixmap);
painter.drawPixmap(0, 0, side, side, pixmap);
}
QSize BusyIndicator::minimumSizeHint() const
{
return QSize(30, 30);
return QSize(30, 30);
}
QSize BusyIndicator::sizeHint() const
{
return QSize(30, 30);
return QSize(30, 30);
}

View File

@ -14,37 +14,37 @@ public:
class BusyIndicator : public QWidget
{
Q_OBJECT
Q_OBJECT
public:
enum IndicatorStyle{StyleRect, StyleEllipse, StyleArc};
enum IndicatorStyle{StyleRect, StyleEllipse, StyleArc};
explicit BusyIndicator(QWidget *parent = 0);
explicit BusyIndicator(QWidget *parent = 0);
void paintEvent(QPaintEvent *);
QSize minimumSizeHint() const;
QSize sizeHint() const;
void paintEvent(QPaintEvent *);
QSize minimumSizeHint() const;
QSize sizeHint() const;
void setIndicatorStyle(IndicatorStyle);
void setColor(QColor color);
const IndicatorStyle indicatorStyle() const;
void setIndicatorStyle(IndicatorStyle);
void setColor(QColor color);
const IndicatorStyle indicatorStyle() const;
signals:
private slots:
void rotate();
void rotate();
private:
QPixmap generatePixmap(int sideLength);
void drawRectStyle(QPainter *painter);
void drawEllipseStyle(QPainter *painter);
void drawArcStyle(QPainter *painter);
QPixmap generatePixmap(int sideLength);
void drawRectStyle(QPainter *painter);
void drawEllipseStyle(QPainter *painter);
void drawArcStyle(QPainter *painter);
QTimer timer;
int startAngle;
QTimer timer;
int startAngle;
IndicatorStyle m_style;
IndicatorStyle m_style;
QColor fillColor;
QColor fillColor;
};
#endif // BUSYINDICATOR_H

View File

@ -8,20 +8,20 @@
#include <QPainter>
YACReaderDeletingProgress::YACReaderDeletingProgress(QWidget *parent) :
QWidget(parent)
QWidget(parent)
{
QVBoxLayout * contentLayout = new QVBoxLayout(this);
QLabel * iconLabel = new QLabel();
QPixmap icon(":/images/deleting_progress/icon.png");
iconLabel->setPixmap(icon);
QPixmap icon(":/images/deleting_progress/icon.png");
iconLabel->setPixmap(icon);
iconLabel->setStyleSheet("QLabel {padding:0px; margin:0px;}");
textMessage = new QLabel(tr("Please wait, deleting in progress..."));
textMessage = new QLabel(tr("Please wait, deleting in progress..."));
textMessage->setStyleSheet("QLabel {color:#ABABAB; padding:0 0 0 0px; margin:0px; font-size:18px; font-weight:bold;}");
QProgressBar * progressBar = new QProgressBar();
QProgressBar * progressBar = new QProgressBar();
progressBar->setTextVisible(false);
progressBar->setFixedHeight(6);
@ -32,18 +32,18 @@ YACReaderDeletingProgress::YACReaderDeletingProgress(QWidget *parent) :
"QProgressBar { border: none; border-radius: 3px; background: #ABABAB; margin:0; margin-left:16; margin-right:16px;}"
"QProgressBar::chunk {background-color: #FFC745; border: none; border-radius: 3px;}");
QPushButton * button = new QPushButton(tr("cancel"));
QPushButton * button = new QPushButton(tr("cancel"));
button->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);
contentLayout->addSpacing(16);
contentLayout->addWidget(iconLabel,0,Qt::AlignHCenter);
contentLayout->addSpacing(11);
contentLayout->addWidget(textMessage,0,Qt::AlignHCenter);
contentLayout->addWidget(textMessage,0,Qt::AlignHCenter);
contentLayout->addSpacing(13);
contentLayout->addWidget(progressBar);
contentLayout->addWidget(progressBar);
contentLayout->addSpacing(13);
contentLayout->addWidget(button,0,Qt::AlignHCenter);
contentLayout->addWidget(button,0,Qt::AlignHCenter);
contentLayout->addSpacing(18);
contentLayout->setMargin(0);
@ -60,16 +60,16 @@ void YACReaderDeletingProgress::paintEvent(QPaintEvent * event)
int borderTop, borderRight, borderBottom, borderLeft;
QPixmap pL(":/images/deleting_progress/imgTopLeft.png");
QPixmap pM(":/images/deleting_progress/imgTopMiddle.png");
QPixmap pR(":/images/deleting_progress/imgTopRight.png");
QPixmap pM(":/images/deleting_progress/imgTopMiddle.png");
QPixmap pR(":/images/deleting_progress/imgTopRight.png");
QPixmap pLM(":/images/deleting_progress/imgLeftMiddle.png");
QPixmap pRM(":/images/deleting_progress/imgRightMiddle.png");
QPixmap pBL(":/images/deleting_progress/imgBottomLeft.png");
QPixmap pBM(":/images/deleting_progress/imgBottomMiddle.png");
QPixmap pBR(":/images/deleting_progress/imgBottomRight.png");
QPixmap pBM(":/images/deleting_progress/imgBottomMiddle.png");
QPixmap pBR(":/images/deleting_progress/imgBottomRight.png");
borderTop = pL.height();
borderRight = pRM.width();

View File

@ -7,12 +7,12 @@ class QLabel;
class YACReaderDeletingProgress : public QWidget
{
Q_OBJECT
Q_OBJECT
public:
explicit YACReaderDeletingProgress(QWidget *parent = 0);
QSize sizeHint() const;
explicit YACReaderDeletingProgress(QWidget *parent = 0);
QSize sizeHint() const;
signals:
public slots:
protected:
@ -20,7 +20,7 @@ protected:
private:
QLabel * textMessage;
};
#endif // YACREADER_DELETING_PROGRESS_H

View File

@ -16,12 +16,12 @@ YACReaderFieldEdit::YACReaderFieldEdit(QWidget * parent)
void YACReaderFieldEdit::focusInEvent(QFocusEvent* e)
{
if (e->reason() == Qt::MouseFocusReason)
{
setModified(true);
{
setModified(true);
setPlaceholderText("");
}
}
QLineEdit::focusInEvent(e);
QLineEdit::focusInEvent(e);
}
void YACReaderFieldEdit::clear()

View File

@ -15,13 +15,13 @@ YACReaderFieldPlainTextEdit::YACReaderFieldPlainTextEdit(QWidget * parent)
void YACReaderFieldPlainTextEdit::focusInEvent(QFocusEvent* e)
{
if (e->reason() == Qt::MouseFocusReason || e->reason() == Qt::TabFocusReason)
{
document()->setModified(true);
{
document()->setModified(true);
if(toPlainText()==tr("Click to overwrite"))
setPlainText("");
}
}
QPlainTextEdit::focusInEvent(e);
QPlainTextEdit::focusInEvent(e);
}
void YACReaderFieldPlainTextEdit::focusOutEvent(QFocusEvent* e)

View File

@ -9,7 +9,7 @@ class YACReaderFlow : public PictureFlow
{
Q_OBJECT
public:
YACReaderFlow(QWidget * parent,FlowType flowType = CoverFlowLike);
YACReaderFlow(QWidget * parent,FlowType flowType = CoverFlowLike);
void mousePressEvent(QMouseEvent* event);
void mouseDoubleClickEvent(QMouseEvent* event);

View File

@ -6,7 +6,7 @@
#include <QMouseEvent>
YACReaderLibraryItemWidget::YACReaderLibraryItemWidget(QString n/*ame*/, QString p/*ath*/, QWidget *parent) :
QWidget(parent),name(n),path(p),isSelected(false)
QWidget(parent),name(n),path(p),isSelected(false)
{
QHBoxLayout * mainLayout = new QHBoxLayout;
mainLayout->setMargin(0);
@ -134,7 +134,7 @@ void YACReaderLibraryItemWidget::deselect()
void YACReaderLibraryItemWidget::select()
{
#ifdef Q_OS_MAC
QString styleSheet ="color: white; background-color:qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #6BAFE4, stop: 1 #3984D2); border-top: 2px solid qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #5EA3DF, stop: 1 #73B8EA); border-left:none;border-right:none;border-bottom:1px solid #3577C2;";
QString styleSheet ="color: white; background-color:qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #6BAFE4, stop: 1 #3984D2); border-top: 2px solid qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #5EA3DF, stop: 1 #73B8EA); border-left:none;border-right:none;border-bottom:1px solid #3577C2;";
#else
QString styleSheet = "color: white; background-color:#2E2E2E; font-weight:bold;";
#endif

View File

@ -10,21 +10,21 @@ class QEvent;
class YACReaderLibraryItemWidget : public QWidget
{
Q_OBJECT
Q_OBJECT
public:
YACReaderLibraryItemWidget(QString name, QString path, QWidget *parent = 0);
YACReaderLibraryItemWidget(QString name, QString path, QWidget *parent = 0);
QString name;
QString path;
signals:
void selected(QString,QString);
void selected(QString,QString);
void showOptions();
public slots:
void showUpDownButtons(bool show);
//bool eventFilter(QObject *object, QEvent *event);
//bool eventFilter(QObject *object, QEvent *event);
void select();
void deselect();
void setName(const QString & name);

View File

@ -7,7 +7,7 @@
#include "qnaturalsorting.h"
YACReaderLibraryListWidget::YACReaderLibraryListWidget(QWidget *parent) :
QWidget(parent),currentLibraryIndex(-1)
QWidget(parent),currentLibraryIndex(-1)
{
QVBoxLayout * mainLayout = new QVBoxLayout;
mainLayout->setSpacing(0);

View File

@ -8,13 +8,13 @@ class QMouseEvent;
class YACReaderLibraryListWidget : public QWidget
{
Q_OBJECT
Q_OBJECT
public:
explicit YACReaderLibraryListWidget(QWidget *parent = 0);
explicit YACReaderLibraryListWidget(QWidget *parent = 0);
signals:
void currentIndexChanged(QString text);
public slots:
QString currentText();
int findText(QString text);
@ -30,7 +30,7 @@ private:
int currentLibraryIndex;
QList < YACReaderLibraryItemWidget* > librariesList;
void deselectAllBut(int index);
};
#endif // YACREADER_LIBRARY_LIST_WIDGET_H

View File

@ -5,45 +5,45 @@
#include <QLabel>
YACReaderSearchLineEdit::YACReaderSearchLineEdit(QWidget *parent)
: QLineEdit(parent)
: QLineEdit(parent)
{
clearButton = new QToolButton(this);
clearButton = new QToolButton(this);
searchLabel = new QLabel(this);
QPixmap pixmap(":/images/clearSearch.png");
QPixmap pixmap(":/images/clearSearch.png");
QPixmap pixmapIcon(":/images/iconSearch.png");
searchLabel->setStyleSheet("QLabel { border: none; padding: 0px; }");
searchLabel->setPixmap(pixmapIcon);
clearButton->setIcon(QIcon(pixmap));
clearButton->setIconSize(pixmap.size());
clearButton->setCursor(Qt::ArrowCursor);
clearButton->setStyleSheet("QToolButton { border: none; padding: 0px; }");
clearButton->hide();
connect(clearButton, SIGNAL(clicked()), this, SLOT(clear()));
connect(this, SIGNAL(textChanged(const QString&)), this, SLOT(updateCloseButton(const QString&)));
int frameWidth = style()->pixelMetric(QStyle::PM_DefaultFrameWidth);
clearButton->setIcon(QIcon(pixmap));
clearButton->setIconSize(pixmap.size());
clearButton->setCursor(Qt::ArrowCursor);
clearButton->setStyleSheet("QToolButton { border: none; padding: 0px; }");
clearButton->hide();
connect(clearButton, SIGNAL(clicked()), this, SLOT(clear()));
connect(this, SIGNAL(textChanged(const QString&)), this, SLOT(updateCloseButton(const QString&)));
int frameWidth = style()->pixelMetric(QStyle::PM_DefaultFrameWidth);
#ifdef Q_OS_MAC
setStyleSheet(QString("QLineEdit {border-top:1px solid #9F9F9F; border-bottom:1px solid #ACACAC; border-right:1px solid #ACACAC; border-left:1px solid #ACACAC; border-radius: 10px; background-color:qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #CACACA, stop: 0.15 #FFFFFF); padding-left: %1px; padding-right: %2px; padding-bottom: 1px; margin-bottom: 1px;} ").arg(searchLabel->sizeHint().width() + frameWidth + 6).arg(clearButton->sizeHint().width() + frameWidth + 2));
setStyleSheet(QString("QLineEdit {border-top:1px solid #9F9F9F; border-bottom:1px solid #ACACAC; border-right:1px solid #ACACAC; border-left:1px solid #ACACAC; border-radius: 10px; background-color:qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #CACACA, stop: 0.15 #FFFFFF); padding-left: %1px; padding-right: %2px; padding-bottom: 1px; margin-bottom: 1px;} ").arg(searchLabel->sizeHint().width() + frameWidth + 6).arg(clearButton->sizeHint().width() + frameWidth + 2));
#else
setStyleSheet(QString("QLineEdit {border:none; background-color:qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #CACACA, stop: 0.15 #FFFFFF);; padding-left: %1px; padding-right: %2px; padding-bottom: 1px; margin-bottom: 0px;} ").arg(searchLabel->sizeHint().width() + frameWidth + 6).arg(clearButton->sizeHint().width() + frameWidth + 2));
#endif
QSize msz = minimumSizeHint();
setMinimumSize(qMax(msz.width(), clearButton->sizeHint().height() + frameWidth * 2 + 2),
qMax(msz.height(), clearButton->sizeHint().height() + frameWidth * 2 + 2));
QSize msz = minimumSizeHint();
setMinimumSize(qMax(msz.width(), clearButton->sizeHint().height() + frameWidth * 2 + 2),
qMax(msz.height(), clearButton->sizeHint().height() + frameWidth * 2 + 2));
#ifdef Q_OS_MAC
setMaximumWidth(300);
setMaximumWidth(300);
#endif
}
void YACReaderSearchLineEdit::resizeEvent(QResizeEvent *)
{
QSize sz = clearButton->sizeHint();
int frameWidth = style()->pixelMetric(QStyle::PM_DefaultFrameWidth);
clearButton->move(rect().right() - frameWidth - sz.width(),
(rect().bottom() + 1 - sz.height())/2);
QSize sz = clearButton->sizeHint();
int frameWidth = style()->pixelMetric(QStyle::PM_DefaultFrameWidth);
clearButton->move(rect().right() - frameWidth - sz.width(),
(rect().bottom() + 1 - sz.height())/2);
QSize szl = searchLabel->sizeHint();
searchLabel->move(6,(rect().bottom() + 1 - szl.height())/2);
@ -51,5 +51,5 @@ void YACReaderSearchLineEdit::resizeEvent(QResizeEvent *)
void YACReaderSearchLineEdit::updateCloseButton(const QString& text)
{
clearButton->setVisible(!text.isEmpty());
clearButton->setVisible(!text.isEmpty());
}

View File

@ -8,19 +8,19 @@ class QLabel;
class YACReaderSearchLineEdit : public QLineEdit
{
Q_OBJECT
Q_OBJECT
public:
YACReaderSearchLineEdit(QWidget *parent = 0);
YACReaderSearchLineEdit(QWidget *parent = 0);
protected:
void resizeEvent(QResizeEvent *);
void resizeEvent(QResizeEvent *);
private slots:
void updateCloseButton(const QString &text);
void updateCloseButton(const QString &text);
private:
QToolButton *clearButton;
QToolButton *clearButton;
QLabel * searchLabel;
};

View File

@ -11,9 +11,9 @@ class YACReaderTitledToolBar;
class YACReaderSideBar : public QWidget
{
Q_OBJECT
Q_OBJECT
public:
explicit YACReaderSideBar(QWidget *parent = 0);
explicit YACReaderSideBar(QWidget *parent = 0);
QSize sizeHint() const;
YACReaderTreeView * foldersView;
@ -21,14 +21,14 @@ public:
YACReaderSearchLineEdit * foldersFilter;
YACReaderTitledToolBar * librariesTitle;
YACReaderTitledToolBar * foldersTitle;
signals:
public slots:
protected:
void paintEvent(QPaintEvent *);
};
#endif // YACREADER_SIDEBAR_H

View File

@ -10,44 +10,44 @@
DropShadowLabel::DropShadowLabel(QWidget* parent) :
QLabel(parent)
QLabel(parent)
{ }
void DropShadowLabel::drawText(QPainter *painter,
QPoint offset)
QPoint offset)
{
Q_ASSERT(painter != 0);
Q_ASSERT(painter != 0);
// Draw shadow.
painter->setPen(QPen(textColor));
painter->drawText(rect().translated(offset),
alignment(), text());
// Draw shadow.
painter->setPen(QPen(textColor));
painter->drawText(rect().translated(offset),
alignment(), text());
}
void DropShadowLabel::drawTextEffect(QPainter *painter,
QPoint offset)
QPoint offset)
{
Q_ASSERT(painter != 0);
Q_ASSERT(painter != 0);
// Draw shadow.
painter->setPen(QPen(dropShadowColor));
painter->drawText(rect().translated(offset),
alignment(), text());
// Draw shadow.
painter->setPen(QPen(dropShadowColor));
painter->drawText(rect().translated(offset),
alignment(), text());
}
void DropShadowLabel::paintEvent(QPaintEvent *event)
{
Q_UNUSED(event);
Q_UNUSED(event);
QPainter painter(this);
painter.setFont(font());
//TODO find where is the '3' comming from?
drawTextEffect(&painter, QPoint(contentsMargins().left(), 1));
drawText(&painter, QPoint(contentsMargins().left(), 0));
QPainter painter(this);
painter.setFont(font());
//TODO find where is the '3' comming from?
drawTextEffect(&painter, QPoint(contentsMargins().left(), 1));
drawText(&painter, QPoint(contentsMargins().left(), 0));
}
void DropShadowLabel::setColor(const QColor & color)
{
textColor = color;
textColor = color;
}
void DropShadowLabel::setDropShadowColor(const QColor & color)
@ -58,7 +58,7 @@ void DropShadowLabel::setDropShadowColor(const QColor & color)
YACReaderTitledToolBar::YACReaderTitledToolBar(const QString & title, QWidget *parent) :
QWidget(parent)
QWidget(parent)
{
QHBoxLayout * mainLayout = new QHBoxLayout;
mainLayout->setMargin(0);
@ -67,15 +67,15 @@ YACReaderTitledToolBar::YACReaderTitledToolBar(const QString & title, QWidget *p
QString styleSheet = "QWidget {border:0px;}";
setStyleSheet(styleSheet);
nameLabel = new DropShadowLabel(this);
nameLabel = new DropShadowLabel(this);
nameLabel->setText(title);
#ifdef Q_OS_MAC
QString nameLabelStyleSheet = "QLabel {padding:0 0 0 10px; margin:0px; font-size:11px; font-weight:bold;}";
nameLabel->setColor(QColor("#707E8C"));
QString nameLabelStyleSheet = "QLabel {padding:0 0 0 10px; margin:0px; font-size:11px; font-weight:bold;}";
nameLabel->setColor(QColor("#707E8C"));
nameLabel->setDropShadowColor(QColor("#F9FAFB"));
#else
QString nameLabelStyleSheet = "QLabel {padding:0 0 0 10px; margin:0px; font-size:11px; font-weight:bold;}";
nameLabel->setColor(QColor("#BDBFBF"));
QString nameLabelStyleSheet = "QLabel {padding:0 0 0 10px; margin:0px; font-size:11px; font-weight:bold;}";
nameLabel->setColor(QColor("#BDBFBF"));
nameLabel->setDropShadowColor(QColor("#000000"));
#endif
nameLabel->setStyleSheet(nameLabelStyleSheet);
@ -101,7 +101,7 @@ void YACReaderTitledToolBar::addAction(QAction * action)
tb->setSizePolicy(QSizePolicy::Minimum,QSizePolicy::Minimum);
//tb->setStyleSheet("QToolButton:hover {background-color:#C5C5C5;}");
mainLayout->addWidget(tb);
mainLayout->addWidget(tb);
}
void YACReaderTitledToolBar::addSpacing(int spacing)

View File

@ -11,35 +11,35 @@ class QIcon;
class DropShadowLabel : public QLabel
{
Q_OBJECT
Q_OBJECT
public:
DropShadowLabel(QWidget* parent = 0);
void paintEvent(QPaintEvent *event);
void setColor(const QColor & color);
DropShadowLabel(QWidget* parent = 0);
void paintEvent(QPaintEvent *event);
void setColor(const QColor & color);
void setDropShadowColor(const QColor & color);
private:
QColor dropShadowColor;
QColor textColor;
void drawText(QPainter *painter, QPoint offset);
void drawTextEffect(QPainter* painter, QPoint offset);
QColor textColor;
void drawText(QPainter *painter, QPoint offset);
void drawTextEffect(QPainter* painter, QPoint offset);
};
class YACReaderTitledToolBar : public QWidget
{
Q_OBJECT
Q_OBJECT
public:
explicit YACReaderTitledToolBar(const QString & title, QWidget *parent = 0);
explicit YACReaderTitledToolBar(const QString & title, QWidget *parent = 0);
signals:
public slots:
void addAction(QAction * action);
void addAction(QAction * action);
void addSpacing(int space);
private:
DropShadowLabel * nameLabel;
DropShadowLabel * nameLabel;
};
#endif // YACREADER_TITLED_TOOLBAR_H