a?adida opci?n vsync (problema de rendimiento en modo de ventana)

corregido bug en la gesti?n de eventos de teclado de goToFlow

el nombre del fichero de c?mics se muestra ahora en el t?tulo de la ventana de
YACReader
This commit is contained in:
Luis Ángel San Martín 2012-10-15 18:30:12 +02:00
parent 9d5985133a
commit 047457da93
11 changed files with 278 additions and 52 deletions

View File

@ -99,7 +99,10 @@ void GoToFlowGL::keyPressEvent(QKeyEvent* event)
QCoreApplication::sendEvent(this->parent(),event); QCoreApplication::sendEvent(this->parent(),event);
break; break;
case Qt::Key_Left: case Qt::Key_Right: case Qt::Key_Left: case Qt::Key_Right:
QCoreApplication::sendEvent(flow,event); //if(event->modifiers() == Qt::ControlModifier)
//flow->keyPressEvent(event);
//QCoreApplication::sendEvent(flow,event);
break;
} }
event->accept(); event->accept();

View File

@ -69,6 +69,9 @@ void MainWindowViewer::setupUI()
createActions(); createActions();
createToolBars(); createToolBars();
setWindowTitle("YACReader");
if(QCoreApplication::argc()>1) if(QCoreApplication::argc()>1)
{ {
//TODO: new method open(QString) //TODO: new method open(QString)
@ -76,6 +79,9 @@ void MainWindowViewer::setupUI()
currentDirectory = pathFile; currentDirectory = pathFile;
QFileInfo fi(pathFile); QFileInfo fi(pathFile);
getSiblingComics(fi.absolutePath(),fi.fileName()); getSiblingComics(fi.absolutePath(),fi.fileName());
setWindowTitle("YACReader - " + fi.fileName());
viewer->open(pathFile); viewer->open(pathFile);
enableActions(); enableActions();
} }
@ -89,7 +95,6 @@ void MainWindowViewer::setupUI()
viewer->setFocusPolicy(Qt::StrongFocus); viewer->setFocusPolicy(Qt::StrongFocus);
setWindowTitle("YACReader");
if(Configuration::getConfiguration().getAlwaysOnTop()) if(Configuration::getConfiguration().getAlwaysOnTop())
{ {
@ -397,6 +402,9 @@ void MainWindowViewer::openComicFromPath(QString pathFile)
currentDirectory = pathFile; currentDirectory = pathFile;
QFileInfo fi(pathFile); QFileInfo fi(pathFile);
getSiblingComics(fi.absolutePath(),fi.fileName()); getSiblingComics(fi.absolutePath(),fi.fileName());
setWindowTitle("YACReader - " + fi.fileName());
viewer->open(pathFile); viewer->open(pathFile);
enableActions(); enableActions();
} }
@ -416,6 +424,9 @@ void MainWindowViewer::openFolderFromPath(QString pathDir)
currentDirectory = pathDir; //TODO ?? currentDirectory = pathDir; //TODO ??
QFileInfo fi(pathDir); QFileInfo fi(pathDir);
getSiblingComics(fi.absolutePath(),fi.fileName()); getSiblingComics(fi.absolutePath(),fi.fileName());
setWindowTitle("YACReader - " + fi.fileName());
viewer->open(pathDir); viewer->open(pathDir);
enableActions(); enableActions();
} }
@ -590,6 +601,8 @@ void MainWindowViewer::openPreviousComic()
viewer->open(previousComicPath); viewer->open(previousComicPath);
QFileInfo fi(previousComicPath); QFileInfo fi(previousComicPath);
getSiblingComics(fi.absolutePath(),fi.fileName()); getSiblingComics(fi.absolutePath(),fi.fileName());
setWindowTitle("YACReader - " + fi.fileName());
} }
} }
@ -600,6 +613,8 @@ void MainWindowViewer::openNextComic()
viewer->open(nextComicPath); viewer->open(nextComicPath);
QFileInfo fi(nextComicPath); QFileInfo fi(nextComicPath);
getSiblingComics(fi.absolutePath(),fi.fileName()); getSiblingComics(fi.absolutePath(),fi.fileName());
setWindowTitle("YACReader - " + fi.fileName());
} }
} }

View File

@ -79,6 +79,9 @@ OptionsDialog::OptionsDialog(QWidget * parent)
setLayout(layout); setLayout(layout);
//disable vSyncCheck
gl->vSyncCheck->hide();
//restoreOptions(); //load options //restoreOptions(); //load options
resize(400,0); resize(400,0);
setModal (true); setModal (true);

View File

@ -269,6 +269,10 @@ void ComicFlowWidgetGL::updateConfig(QSettings * settings)
} }
flow->setPerformance(performance); flow->setPerformance(performance);
if(!settings->contains(V_SYNC))
flow->useVSync(false);
else
flow->useVSync(settings->value(V_SYNC).toBool());
switch (settings->value(FLOW_TYPE_GL).toInt()) switch (settings->value(FLOW_TYPE_GL).toInt())
{ {

View File

@ -186,7 +186,7 @@ void LibraryWindow::doLayout()
setCentralWidget(sHorizontal); setCentralWidget(sHorizontal);
//FINAL LAYOUT------------------------------------------------------------- //FINAL LAYOUT-------------------------------------------------------------
fullScreenToolTip = new QLabel(this); fullScreenToolTip = new QLabel(comicFlow);
fullScreenToolTip->setText(tr("<font color='white'> press 'F' to close fullscreen mode </font>")); fullScreenToolTip->setText(tr("<font color='white'> press 'F' to close fullscreen mode </font>"));
fullScreenToolTip->setPalette(QPalette(QColor(0,0,0))); fullScreenToolTip->setPalette(QPalette(QColor(0,0,0)));
fullScreenToolTip->setFont(QFont("courier new",15,234)); fullScreenToolTip->setFont(QFont("courier new",15,234));
@ -291,7 +291,7 @@ void LibraryWindow::createActions()
removeLibraryAction->setToolTip(tr("Remove current library from your collection")); removeLibraryAction->setToolTip(tr("Remove current library from your collection"));
removeLibraryAction->setIcon(QIcon(":/images/removeLibrary.png")); removeLibraryAction->setIcon(QIcon(":/images/removeLibrary.png"));
openComicAction = new QAction(this); openComicAction = new QAction(tr("Open current comic"),this);
openComicAction->setToolTip(tr("Open current comic on YACReader")); openComicAction->setToolTip(tr("Open current comic on YACReader"));
openComicAction->setShortcut(Qt::Key_Return); openComicAction->setShortcut(Qt::Key_Return);
openComicAction->setIcon(QIcon(":/images/icon.png")); openComicAction->setIcon(QIcon(":/images/icon.png"));
@ -325,7 +325,7 @@ void LibraryWindow::createActions()
showPropertiesAction->setShortcut(Qt::Key_P); showPropertiesAction->setShortcut(Qt::Key_P);
showPropertiesAction->setIcon(QIcon(":/images/properties.png")); showPropertiesAction->setIcon(QIcon(":/images/properties.png"));
toggleFullScreenAction = new QAction(this); toggleFullScreenAction = new QAction(tr("Fullscreen mode on/off"),this);
toggleFullScreenAction->setToolTip(tr("Fullscreen mode on/off (F)")); toggleFullScreenAction->setToolTip(tr("Fullscreen mode on/off (F)"));
toggleFullScreenAction->setShortcut(Qt::Key_F); toggleFullScreenAction->setShortcut(Qt::Key_F);
toggleFullScreenAction->setIcon(QIcon(":/images/fit.png")); toggleFullScreenAction->setIcon(QIcon(":/images/fit.png"));
@ -398,6 +398,12 @@ void LibraryWindow::createActions()
hideComicViewAction->setCheckable(true); hideComicViewAction->setCheckable(true);
hideComicViewAction->setChecked(false); hideComicViewAction->setChecked(false);
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
comicFlow->addAction(toggleFullScreenAction);
comicFlow->addAction(openComicAction);
comicFlow->setContextMenuPolicy(Qt::ActionsContextMenu);
} }
//TODO unificar con disableActions //TODO unificar con disableActions
@ -1144,6 +1150,7 @@ void LibraryWindow::toFullScreen()
comicFlow->show(); comicFlow->show();
comicFlow->setFocus(Qt::OtherFocusReason); comicFlow->setFocus(Qt::OtherFocusReason);
fullScreenToolTip->move((width()-fullScreenToolTip->width())/2,0); fullScreenToolTip->move((width()-fullScreenToolTip->width())/2,0);
fullScreenToolTip->adjustSize(); fullScreenToolTip->adjustSize();
fullScreenToolTip->show(); fullScreenToolTip->show();
@ -1151,13 +1158,14 @@ void LibraryWindow::toFullScreen()
void LibraryWindow::toNormal() void LibraryWindow::toNormal()
{ {
fullScreenToolTip->hide();
comicFlow->hide(); comicFlow->hide();
comicFlow->setSlideSize(slideSizeW); comicFlow->setSlideSize(slideSizeW);
comicFlow->setCenterIndex(comicFlow->centerIndex()); comicFlow->setCenterIndex(comicFlow->centerIndex());
comicFlow->render(); comicFlow->render();
comics->show(); comics->show();
left->show(); left->show();
fullScreenToolTip->hide();
libraryToolBar->show(); libraryToolBar->show();
comicFlow->show(); comicFlow->show();

View File

@ -50,8 +50,9 @@ private:
PropertiesDialog * propertiesDialog; PropertiesDialog * propertiesDialog;
bool fullscreen; bool fullscreen;
bool importedCovers; //if true, the library is read only (not updates,open comic or properties) bool importedCovers; //if true, the library is read only (not updates,open comic or properties)
YACReaderTreeSearch * proxyFilter; //Ya no se usan proxies, el rendimiento de la BD es suficiente
YACReaderSortComics * proxySort; //YACReaderTreeSearch * proxyFilter;
//YACReaderSortComics * proxySort;
PackageManager * packageManager; PackageManager * packageManager;
ComicFlowWidget * comicFlow; ComicFlowWidget * comicFlow;

View File

@ -23,7 +23,10 @@
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
HelpAboutDialog::HelpAboutDialog(QWidget * parent) HelpAboutDialog::HelpAboutDialog(QWidget * parent)
:QDialog(parent) :QDialog(parent)
{ {
@ -80,6 +83,10 @@ QString HelpAboutDialog::fileToString(const QString & path)
return content; return content;
} }
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
void delTree(QDir dir) void delTree(QDir dir)
{ {
dir.setFilter(QDir::AllDirs|QDir::Files|QDir::Hidden|QDir::NoDotAndDotDot); dir.setFilter(QDir::AllDirs|QDir::Files|QDir::Hidden|QDir::NoDotAndDotDot);
@ -100,6 +107,10 @@ void delTree(QDir dir)
} }
} }
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
YACReaderIconProvider::YACReaderIconProvider() YACReaderIconProvider::YACReaderIconProvider()
:QFileIconProvider() :QFileIconProvider()
{ {
@ -133,6 +144,10 @@ QString YACReaderIconProvider::type(const QFileInfo & info) const
return QFileIconProvider::type(info); return QFileIconProvider::type(info);
} }
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
YACReaderFlow::YACReaderFlow(QWidget * parent,FlowType flowType) : PictureFlow(parent,flowType) {} YACReaderFlow::YACReaderFlow(QWidget * parent,FlowType flowType) : PictureFlow(parent,flowType) {}
void YACReaderFlow::mousePressEvent(QMouseEvent* event) void YACReaderFlow::mousePressEvent(QMouseEvent* event)
@ -151,6 +166,10 @@ void YACReaderFlow::mouseDoubleClickEvent(QMouseEvent* event)
emit selected(centerIndex()); emit selected(centerIndex());
} }
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
YACReaderComicDirModel::YACReaderComicDirModel( const QStringList & nameFilters, QDir::Filters filters, QDir::SortFlags sort, QObject * parent ) YACReaderComicDirModel::YACReaderComicDirModel( const QStringList & nameFilters, QDir::Filters filters, QDir::SortFlags sort, QObject * parent )
:QDirModel(nameFilters,filters,sort,parent) :QDirModel(nameFilters,filters,sort,parent)
{ {
@ -173,7 +192,10 @@ QFileInfo YACReaderComicDirModel::fileInfo ( const QModelIndex & index ) const
return fileInfo; return fileInfo;
} }
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
YACReaderComicViewDelegate::YACReaderComicViewDelegate(QObject * parent) YACReaderComicViewDelegate::YACReaderComicViewDelegate(QObject * parent)
:QItemDelegate(parent) :QItemDelegate(parent)
{ {
@ -269,6 +291,10 @@ QRect YACReaderComicViewDelegate::textLayoutBounds(const QStyleOptionViewItemV2
return rect; return rect;
} }
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
YACReaderTreeSearch::YACReaderTreeSearch(QObject * parent) YACReaderTreeSearch::YACReaderTreeSearch(QObject * parent)
:QSortFilterProxyModel(parent),cache(new ModelIndexCache()) :QSortFilterProxyModel(parent),cache(new ModelIndexCache())
{ {
@ -334,6 +360,10 @@ void YACReaderTreeSearch::softReset()
//invalidateFilter(); //invalidateFilter();
} }
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
ModelIndexCache::ModelIndexCache() ModelIndexCache::ModelIndexCache()
:cache() :cache()
{ {
@ -361,6 +391,10 @@ void ModelIndexCache::clear()
cache.clear(); cache.clear();
} }
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
YACReaderSortComics::YACReaderSortComics(QObject * parent) YACReaderSortComics::YACReaderSortComics(QObject * parent)
:QSortFilterProxyModel(parent) :QSortFilterProxyModel(parent)
{ {
@ -379,7 +413,10 @@ bool YACReaderSortComics::lessThan(const QModelIndex &left, const QModelIndex &r
} }
//-------------------------------------------- //////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
YACReaderFieldEdit::YACReaderFieldEdit(QWidget * parent) YACReaderFieldEdit::YACReaderFieldEdit(QWidget * parent)
:QLineEdit(parent) :QLineEdit(parent)
@ -416,7 +453,10 @@ void YACReaderFieldEdit::setDisabled(bool disabled)
QLineEdit::setDisabled(disabled); QLineEdit::setDisabled(disabled);
} }
//-------------------------------------------- //////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
YACReaderFieldPlainTextEdit::YACReaderFieldPlainTextEdit(QWidget * parent) YACReaderFieldPlainTextEdit::YACReaderFieldPlainTextEdit(QWidget * parent)
:QPlainTextEdit(parent) :QPlainTextEdit(parent)
@ -468,7 +508,10 @@ void YACReaderFieldPlainTextEdit::setDisabled(bool disabled)
QPlainTextEdit::setDisabled(disabled); QPlainTextEdit::setDisabled(disabled);
} }
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
YACReaderSpinSliderWidget::YACReaderSpinSliderWidget(QWidget * parent) YACReaderSpinSliderWidget::YACReaderSpinSliderWidget(QWidget * parent)
:QWidget(parent) :QWidget(parent)
{ {
@ -501,7 +544,9 @@ void YACReaderSpinSliderWidget::setRange(int lowValue, int topValue, int step)
void YACReaderSpinSliderWidget::setValue(int value) void YACReaderSpinSliderWidget::setValue(int value)
{ {
disconnect(spinBox, SIGNAL(valueChanged(int)), this, SIGNAL(valueChanged(int)));
spinBox->setValue(value); spinBox->setValue(value);
connect(spinBox, SIGNAL(valueChanged(int)), this, SIGNAL(valueChanged(int)));
} }
void YACReaderSpinSliderWidget::setText(const QString & text) void YACReaderSpinSliderWidget::setText(const QString & text)
@ -519,8 +564,10 @@ QSize YACReaderSpinSliderWidget::minimumSizeHint() const
return QSize(220, 25); return QSize(220, 25);
} }
//---------------------------------------------------------------------------- //////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
YACReaderOptionsDialog::YACReaderOptionsDialog(QWidget * parent) YACReaderOptionsDialog::YACReaderOptionsDialog(QWidget * parent)
:QDialog(parent) :QDialog(parent)
{ {
@ -549,6 +596,12 @@ YACReaderOptionsDialog::YACReaderOptionsDialog(QWidget * parent)
connect(gl->radionModern,SIGNAL(toggled(bool)),this,SLOT(setModernConfig())); connect(gl->radionModern,SIGNAL(toggled(bool)),this,SLOT(setModernConfig()));
connect(gl->radioDown,SIGNAL(toggled(bool)),this,SLOT(setRouletteConfig())); connect(gl->radioDown,SIGNAL(toggled(bool)),this,SLOT(setRouletteConfig()));
connect(gl->radioClassic,SIGNAL(toggled(bool)),this,SIGNAL(optionsChanged()));
connect(gl->radioStripe,SIGNAL(toggled(bool)),this,SIGNAL(optionsChanged()));
connect(gl->radioOver,SIGNAL(toggled(bool)),this,SIGNAL(optionsChanged()));
connect(gl->radionModern,SIGNAL(toggled(bool)),this,SIGNAL(optionsChanged()));
connect(gl->radioDown,SIGNAL(toggled(bool)),this,SIGNAL(optionsChanged()));
connect(gl->xRotation,SIGNAL(valueChanged(int)),this,SIGNAL(optionsChanged())); connect(gl->xRotation,SIGNAL(valueChanged(int)),this,SIGNAL(optionsChanged()));
connect(gl->xRotation,SIGNAL(valueChanged(int)),this,SLOT(saveXRotation(int))); connect(gl->xRotation,SIGNAL(valueChanged(int)),this,SLOT(saveXRotation(int)));
@ -585,6 +638,7 @@ YACReaderOptionsDialog::YACReaderOptionsDialog(QWidget * parent)
connect(gl->performanceSlider, SIGNAL(valueChanged(int)),this,SLOT(savePerformance(int))); connect(gl->performanceSlider, SIGNAL(valueChanged(int)),this,SLOT(savePerformance(int)));
connect(gl->performanceSlider, SIGNAL(valueChanged(int)),this,SLOT(optionsChanged())); connect(gl->performanceSlider, SIGNAL(valueChanged(int)),this,SLOT(optionsChanged()));
connect(gl->vSyncCheck,SIGNAL(stateChanged(int)),this,SLOT(saveUseVSync(int)));
} }
void YACReaderOptionsDialog::savePerformance(int value) void YACReaderOptionsDialog::savePerformance(int value)
@ -592,6 +646,26 @@ void YACReaderOptionsDialog::savePerformance(int value)
settings->setValue(PERFORMANCE,value); settings->setValue(PERFORMANCE,value);
} }
void YACReaderOptionsDialog::saveUseVSync(int b)
{
settings->setValue(V_SYNC,b);
}
void YACReaderOptionsDialog::saveFlowParameters()
{
settings->setValue(X_ROTATION,gl->xRotation->getValue());
settings->setValue(Y_POSITION,gl->yPosition->getValue());
settings->setValue(COVER_DISTANCE,gl->coverDistance->getValue());
settings->setValue(CENTRAL_DISTANCE,gl->centralDistance->getValue());
settings->setValue(ZOOM_LEVEL,gl->zoomLevel->getValue());
settings->setValue(Y_COVER_OFFSET,gl->yCoverOffset->getValue());
settings->setValue(Z_COVER_OFFSET,gl->zCoverOffset->getValue());
settings->setValue(COVER_ROTATION,gl->coverRotation->getValue());
settings->setValue(FADE_OUT_DIST,gl->fadeOutDist->getValue());
settings->setValue(LIGHT_STRENGTH,gl->lightStrength->getValue());
settings->setValue(MAX_ANGLE,gl->maxAngle->getValue());
}
void YACReaderOptionsDialog::saveOptions() void YACReaderOptionsDialog::saveOptions()
{ {
emit(optionsChanged()); emit(optionsChanged());
@ -701,7 +775,13 @@ void YACReaderOptionsDialog::restoreOptions(QSettings * settings)
return; return;
} }
if(settings->contains(V_SYNC) && settings->value(V_SYNC).toInt() == Qt::Checked)
gl->vSyncCheck->setChecked(true);
else
gl->vSyncCheck->setChecked(false);
gl->performanceSlider->setValue(settings->value(PERFORMANCE).toInt()); gl->performanceSlider->setValue(settings->value(PERFORMANCE).toInt());
FlowType flowType; FlowType flowType;
switch(settings->value(FLOW_TYPE_GL).toInt()) switch(settings->value(FLOW_TYPE_GL).toInt())
{ {
@ -805,6 +885,8 @@ void YACReaderOptionsDialog::setClassicConfig()
settings->setValue(FLOW_TYPE_GL,CoverFlowLike); settings->setValue(FLOW_TYPE_GL,CoverFlowLike);
gl->setValues(presetYACReaderFlowClassicConfig); gl->setValues(presetYACReaderFlowClassicConfig);
saveFlowParameters();
} }
void YACReaderOptionsDialog::setStripeConfig() void YACReaderOptionsDialog::setStripeConfig()
@ -812,6 +894,8 @@ void YACReaderOptionsDialog::setStripeConfig()
settings->setValue(FLOW_TYPE_GL,Strip); settings->setValue(FLOW_TYPE_GL,Strip);
gl->setValues(presetYACReaderFlowStripeConfig); gl->setValues(presetYACReaderFlowStripeConfig);
saveFlowParameters();
} }
void YACReaderOptionsDialog::setOverlappedStripeConfig() void YACReaderOptionsDialog::setOverlappedStripeConfig()
@ -819,6 +903,8 @@ void YACReaderOptionsDialog::setOverlappedStripeConfig()
settings->setValue(FLOW_TYPE_GL,StripOverlapped); settings->setValue(FLOW_TYPE_GL,StripOverlapped);
gl->setValues(presetYACReaderFlowOverlappedStripeConfig); gl->setValues(presetYACReaderFlowOverlappedStripeConfig);
saveFlowParameters();
} }
void YACReaderOptionsDialog::setModernConfig() void YACReaderOptionsDialog::setModernConfig()
@ -826,6 +912,8 @@ void YACReaderOptionsDialog::setModernConfig()
settings->setValue(FLOW_TYPE_GL,Modern); settings->setValue(FLOW_TYPE_GL,Modern);
gl->setValues(defaultYACReaderFlowConfig); gl->setValues(defaultYACReaderFlowConfig);
saveFlowParameters();
} }
void YACReaderOptionsDialog::setRouletteConfig() void YACReaderOptionsDialog::setRouletteConfig()
@ -833,10 +921,15 @@ void YACReaderOptionsDialog::setRouletteConfig()
settings->setValue(FLOW_TYPE_GL,Roulette); settings->setValue(FLOW_TYPE_GL,Roulette);
gl->setValues(pressetYACReaderFlowDownConfig); gl->setValues(pressetYACReaderFlowDownConfig);
saveFlowParameters();
} }
///---------------------------------------------------------- //////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
YACReaderGLFlowConfigWidget::YACReaderGLFlowConfigWidget(QWidget * parent /* = 0 */) YACReaderGLFlowConfigWidget::YACReaderGLFlowConfigWidget(QWidget * parent /* = 0 */)
:QWidget(parent) :QWidget(parent)
{ {
@ -962,7 +1055,7 @@ YACReaderGLFlowConfigWidget::YACReaderGLFlowConfigWidget(QWidget * parent /* = 0
lightStrength = new YACReaderSpinSliderWidget(this); lightStrength = new YACReaderSpinSliderWidget(this);
lightStrength->setText(tr("Light")); lightStrength->setText(tr("Light"));
lightStrength->setRange(-10,10); lightStrength->setRange(0,10);
//connect(lightStrength,SIGNAL(valueChanged(int)),this,SIGNAL(optionsChanged())); //connect(lightStrength,SIGNAL(valueChanged(int)),this,SIGNAL(optionsChanged()));
//connect(lightStrength,SIGNAL(valueChanged(int)),this,SLOT(saveLightStrength(int))); //connect(lightStrength,SIGNAL(valueChanged(int)),this,SLOT(saveLightStrength(int)));
@ -996,10 +1089,10 @@ YACReaderGLFlowConfigWidget::YACReaderGLFlowConfigWidget(QWidget * parent /* = 0
groupBoxesLayout->addWidget(groupBox); groupBoxesLayout->addWidget(groupBox);
groupBoxesLayout->addWidget(optionsGroupBox); groupBoxesLayout->addWidget(optionsGroupBox);
QHBoxLayout * performance = new QHBoxLayout; QHBoxLayout * performanceSliderLayout = new QHBoxLayout;
performance->addWidget(new QLabel(tr("Low Performance"))); performanceSliderLayout->addWidget(new QLabel(tr("Low Performance")));
performance->addWidget(performanceSlider = new QSlider(Qt::Horizontal)); performanceSliderLayout->addWidget(performanceSlider = new QSlider(Qt::Horizontal));
performance->addWidget(new QLabel(tr("High Performance"))); performanceSliderLayout->addWidget(new QLabel(tr("High Performance")));
performanceSlider->setMinimum(0); performanceSlider->setMinimum(0);
performanceSlider->setMaximum(3); performanceSlider->setMaximum(3);
@ -1008,12 +1101,25 @@ YACReaderGLFlowConfigWidget::YACReaderGLFlowConfigWidget(QWidget * parent /* = 0
performanceSlider->setTickInterval(1); performanceSlider->setTickInterval(1);
performanceSlider->setTickPosition(QSlider::TicksRight); performanceSlider->setTickPosition(QSlider::TicksRight);
QHBoxLayout * vSyncLayout = new QHBoxLayout;
vSyncCheck = new QCheckBox(tr("Use VSync (improve the image quality in fullscreen mode, worse performance)"));
vSyncLayout->addStretch();
vSyncLayout->addWidget(vSyncCheck);
QVBoxLayout * performanceLayout = new QVBoxLayout;
performanceLayout->addLayout(performanceSliderLayout);
performanceLayout->addLayout(vSyncLayout);
QGroupBox *performanceGroupBox = new QGroupBox(tr("Performance:"));
//connect(performanceSlider, SIGNAL(valueChanged(int)),this,SLOT(savePerformance(int))); //connect(performanceSlider, SIGNAL(valueChanged(int)),this,SLOT(savePerformance(int)));
//connect(performanceSlider, SIGNAL(valueChanged(int)),this,SLOT(optionsChanged())); //connect(performanceSlider, SIGNAL(valueChanged(int)),this,SLOT(optionsChanged()));
performanceGroupBox->setLayout(performanceLayout);
layout->addLayout(groupBoxesLayout); layout->addLayout(groupBoxesLayout);
layout->addLayout(performance); layout->addWidget(performanceGroupBox);
layout->setContentsMargins(0,0,0,0); layout->setContentsMargins(0,0,0,0);
@ -1037,7 +1143,10 @@ void YACReaderGLFlowConfigWidget::setValues(Preset preset)
maxAngle->setValue(preset.viewAngle); maxAngle->setValue(preset.viewAngle);
} }
//----------------------------------------------------------------------------- //////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
YACReaderFlowConfigWidget::YACReaderFlowConfigWidget(QWidget * parent ) YACReaderFlowConfigWidget::YACReaderFlowConfigWidget(QWidget * parent )
:QWidget(parent) :QWidget(parent)
{ {

View File

@ -32,6 +32,10 @@
#include "yacreader_flow_gl.h" #include "yacreader_flow_gl.h"
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
class QToolBarStretch : public QWidget class QToolBarStretch : public QWidget
{ {
public: public:
@ -43,6 +47,10 @@ public:
} }
}; };
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
class HelpAboutDialog : public QDialog class HelpAboutDialog : public QDialog
{ {
Q_OBJECT Q_OBJECT
@ -60,6 +68,10 @@ private:
QString fileToString(const QString & path); QString fileToString(const QString & path);
}; };
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
class YACReaderIconProvider : public QFileIconProvider class YACReaderIconProvider : public QFileIconProvider
{ {
public: public:
@ -69,6 +81,10 @@ public:
virtual QString type ( const QFileInfo & info ) const; virtual QString type ( const QFileInfo & info ) const;
}; };
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
class YACReaderFlow : public PictureFlow class YACReaderFlow : public PictureFlow
{ {
Q_OBJECT Q_OBJECT
@ -82,6 +98,10 @@ signals:
void selected(unsigned int centerIndex); void selected(unsigned int centerIndex);
}; };
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
class YACReaderComicDirModel : public QDirModel class YACReaderComicDirModel : public QDirModel
{ {
Q_OBJECT Q_OBJECT
@ -91,6 +111,10 @@ Q_OBJECT
QFileInfo fileInfo ( const QModelIndex & index ) const; QFileInfo fileInfo ( const QModelIndex & index ) const;
}; };
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
class YACReaderComicViewDelegate : public QItemDelegate class YACReaderComicViewDelegate : public QItemDelegate
{ {
Q_OBJECT Q_OBJECT
@ -100,6 +124,10 @@ class YACReaderComicViewDelegate : public QItemDelegate
QRect textLayoutBounds(const QStyleOptionViewItemV2 &option) const; QRect textLayoutBounds(const QStyleOptionViewItemV2 &option) const;
}; };
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
class ModelIndexCache class ModelIndexCache
{ {
@ -118,7 +146,10 @@ private:
QHash<QString, CacheData> cache; QHash<QString, CacheData> cache;
}; };
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
class YACReaderTreeSearch : public QSortFilterProxyModel class YACReaderTreeSearch : public QSortFilterProxyModel
{ {
Q_OBJECT Q_OBJECT
@ -135,6 +166,10 @@ private:
ModelIndexCache * cache; ModelIndexCache * cache;
}; };
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
class YACReaderSortComics : public QSortFilterProxyModel class YACReaderSortComics : public QSortFilterProxyModel
{ {
Q_OBJECT Q_OBJECT
@ -143,10 +178,16 @@ class YACReaderSortComics : public QSortFilterProxyModel
protected: protected:
bool lessThan(const QModelIndex &left, const QModelIndex &right) const; bool lessThan(const QModelIndex &left, const QModelIndex &right) const;
}; };
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
void delTree(QDir dir); void delTree(QDir dir);
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
class YACReaderFieldEdit : public QLineEdit class YACReaderFieldEdit : public QLineEdit
{ {
Q_OBJECT Q_OBJECT
@ -161,6 +202,10 @@ private:
}; };
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
class YACReaderFieldPlainTextEdit : public QPlainTextEdit class YACReaderFieldPlainTextEdit : public QPlainTextEdit
{ {
Q_OBJECT Q_OBJECT
@ -192,6 +237,10 @@ private:
// } // }
//}; //};
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
class YACReaderSpinSliderWidget : public QWidget class YACReaderSpinSliderWidget : public QWidget
{ {
Q_OBJECT Q_OBJECT
@ -212,6 +261,10 @@ signals:
}; };
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
class YACReaderFlowConfigWidget : public QWidget class YACReaderFlowConfigWidget : public QWidget
{ {
Q_OBJECT Q_OBJECT
@ -223,6 +276,10 @@ public:
YACReaderFlowConfigWidget(QWidget * parent = 0); YACReaderFlowConfigWidget(QWidget * parent = 0);
}; };
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
class YACReaderGLFlowConfigWidget : public QWidget class YACReaderGLFlowConfigWidget : public QWidget
{ {
Q_OBJECT Q_OBJECT
@ -249,11 +306,16 @@ public:
YACReaderSpinSliderWidget * maxAngle; YACReaderSpinSliderWidget * maxAngle;
QSlider * performanceSlider; QSlider * performanceSlider;
QCheckBox * vSyncCheck;
public slots: public slots:
void setValues(Preset preset); void setValues(Preset preset);
}; };
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
class YACReaderOptionsDialog : public QDialog class YACReaderOptionsDialog : public QDialog
{ {
Q_OBJECT Q_OBJECT
@ -275,6 +337,7 @@ public slots:
virtual void saveOptions(); virtual void saveOptions();
protected slots: protected slots:
virtual void savePerformance(int value); virtual void savePerformance(int value);
virtual void saveUseVSync(int b);
virtual void saveUseGL(int b); virtual void saveUseGL(int b);
virtual void saveXRotation(int value); virtual void saveXRotation(int value);
virtual void saveYPosition(int value); virtual void saveYPosition(int value);
@ -296,6 +359,7 @@ protected slots:
virtual void setClassicConfigSW(); virtual void setClassicConfigSW();
virtual void setStripeConfigSW(); virtual void setStripeConfigSW();
virtual void setOverlappedStripeConfigSW(); virtual void setOverlappedStripeConfigSW();
virtual void saveFlowParameters();
signals: signals:
void optionsChanged(); void optionsChanged();

View File

@ -191,7 +191,7 @@ struct Preset pressetYACReaderFlowDownConfig = {
}; };
/*Constructor*/ /*Constructor*/
YACReaderFlowGL::YACReaderFlowGL(QWidget *parent,struct Preset p) YACReaderFlowGL::YACReaderFlowGL(QWidget *parent,struct Preset p)
:QGLWidget(QGLFormat(QGL::SampleBuffers), parent),numObjects(0),lazyPopulateObjects(-1) :QGLWidget(QGLFormat(QGL::SampleBuffers), parent),numObjects(0),lazyPopulateObjects(-1),bUseVSync(false)
{ {
updateCount = 0; updateCount = 0;
config = p; config = p;
@ -512,7 +512,6 @@ void YACReaderFlowGL::draw()
glMatrixMode(GL_MODELVIEW); glMatrixMode(GL_MODELVIEW);
glLoadIdentity(); glLoadIdentity();
glBegin( GL_TRIANGLES ); glBegin( GL_TRIANGLES );
glColor4f( 1.0f, 1.0f, 1.0f, 1.0f ); glColor4f( 1.0f, 1.0f, 1.0f, 1.0f );
@ -528,7 +527,6 @@ void YACReaderFlowGL::draw()
glMatrixMode(GL_PROJECTION); glMatrixMode(GL_PROJECTION);
glPopMatrix(); glPopMatrix();
glMatrixMode(GL_MODELVIEW); glMatrixMode(GL_MODELVIEW);
} }
void YACReaderFlowGL::showPrevious() void YACReaderFlowGL::showPrevious()
@ -720,6 +718,13 @@ void YACReaderFlowGL::reset()
} }
void YACReaderFlowGL::reload()
{
int n = numObjects;
reset();
populate(n);
}
//slots //slots
void YACReaderFlowGL::setCF_RX(int value) void YACReaderFlowGL::setCF_RX(int value)
{ {
@ -809,22 +814,33 @@ void YACReaderFlowGL::setPreset(const Preset & p)
void YACReaderFlowGL::setPerformance(Performance performance) void YACReaderFlowGL::setPerformance(Performance performance)
{ {
this->performance = performance; if(this->performance != performance)
{
//if(performance = ultraHigh) this->performance = performance;
//{ reload();
// QGLFormat f = format(); }
// f.setSwapInterval(1);
// setFormat(f);
//}
//else
//{
// QGLFormat f = format();
// f.setSwapInterval(0);
// setFormat(f);
//}
} }
void YACReaderFlowGL::useVSync(bool b)
{
if(bUseVSync != b)
{
bUseVSync = b;
if(b)
{
QGLFormat f = format();
f.setSwapInterval(1);
setFormat(f);
}
else
{
QGLFormat f = format();
f.setSwapInterval(0);
setFormat(f);
}
reload();
}
}
void YACReaderFlowGL::setShowMarks(bool value) void YACReaderFlowGL::setShowMarks(bool value)
{ {
showMarks = value; showMarks = value;
@ -949,10 +965,8 @@ void YACReaderFlowGL::mousePressEvent(QMouseEvent *event)
} }
else if(posX <=-0.5) else if(posX <=-0.5)
showPrevious(); showPrevious();
} else if(event->button() == Qt::RightButton) } else
{ QGLWidget::mousePressEvent(event);
marks[currentSelected] = !marks[currentSelected];
}
} }
void YACReaderFlowGL::mouseDoubleClickEvent(QMouseEvent* event) void YACReaderFlowGL::mouseDoubleClickEvent(QMouseEvent* event)
@ -973,9 +987,11 @@ void YACReaderComicFlowGL::setImagePaths(QStringList paths)
worker->reset(); worker->reset();
reset(); reset();
numObjects = 0; numObjects = 0;
populate(paths.size()); if(lazyPopulateObjects!=-1)
YACReaderFlowGL::populate(paths.size());
lazyPopulateObjects = paths.size();
this->paths = paths; this->paths = paths;
numObjects = paths.size(); //numObjects = paths.size();
} }
@ -1158,8 +1174,8 @@ void YACReaderPageFlowGL::updateImageData()
void YACReaderPageFlowGL::populate(int n) void YACReaderPageFlowGL::populate(int n)
{ {
worker->reset(); worker->reset();
//if(lazyPopulateObjects!=-1) if(lazyPopulateObjects!=-1)
//YACReaderFlowGL::populate(n); YACReaderFlowGL::populate(n);
lazyPopulateObjects = n; lazyPopulateObjects = n;
imagesReady = QVector<bool> (n,false); imagesReady = QVector<bool> (n,false);
rawImages = QVector<QByteArray> (n); rawImages = QVector<QByteArray> (n);

View File

@ -139,6 +139,7 @@ protected:
CFImage * cfImages; CFImage * cfImages;
Performance performance; Performance performance;
bool bUseVSync;
/*** Animation Settings ***/ /*** Animation Settings ***/
Preset config; Preset config;
@ -234,11 +235,12 @@ public:
void setPerformance(Performance performance); void setPerformance(Performance performance);
void useVSync(bool b);
virtual void updateImageData() = 0; virtual void updateImageData() = 0;
void reset(); void reset();
void reload();
//interface with yacreaderlibrary, compatibility //interface with yacreaderlibrary, compatibility
void setShowMarks(bool value); void setShowMarks(bool value);

View File

@ -35,6 +35,7 @@
#define USE_OPEN_GL "USE_OPEN_GL" #define USE_OPEN_GL "USE_OPEN_GL"
#define X_ROTATION "X_ROTATION" #define X_ROTATION "X_ROTATION"
#define Y_COVER_OFFSET "Y_COVER_OFFSET" #define Y_COVER_OFFSET "Y_COVER_OFFSET"
#define V_SYNC "V_SYNC"
enum FlowType enum FlowType
{ {