diff --git a/YACReader/goto_flow_gl.cpp b/YACReader/goto_flow_gl.cpp index 2145a9a0..082ecb57 100644 --- a/YACReader/goto_flow_gl.cpp +++ b/YACReader/goto_flow_gl.cpp @@ -99,7 +99,10 @@ void GoToFlowGL::keyPressEvent(QKeyEvent* event) QCoreApplication::sendEvent(this->parent(),event); break; 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(); diff --git a/YACReader/main_window_viewer.cpp b/YACReader/main_window_viewer.cpp index c3686fb2..f0d0fa13 100644 --- a/YACReader/main_window_viewer.cpp +++ b/YACReader/main_window_viewer.cpp @@ -69,6 +69,9 @@ void MainWindowViewer::setupUI() createActions(); createToolBars(); + + setWindowTitle("YACReader"); + if(QCoreApplication::argc()>1) { //TODO: new method open(QString) @@ -76,6 +79,9 @@ void MainWindowViewer::setupUI() currentDirectory = pathFile; QFileInfo fi(pathFile); getSiblingComics(fi.absolutePath(),fi.fileName()); + + setWindowTitle("YACReader - " + fi.fileName()); + viewer->open(pathFile); enableActions(); } @@ -89,7 +95,6 @@ void MainWindowViewer::setupUI() viewer->setFocusPolicy(Qt::StrongFocus); - setWindowTitle("YACReader"); if(Configuration::getConfiguration().getAlwaysOnTop()) { @@ -397,6 +402,9 @@ void MainWindowViewer::openComicFromPath(QString pathFile) currentDirectory = pathFile; QFileInfo fi(pathFile); getSiblingComics(fi.absolutePath(),fi.fileName()); + + setWindowTitle("YACReader - " + fi.fileName()); + viewer->open(pathFile); enableActions(); } @@ -416,6 +424,9 @@ void MainWindowViewer::openFolderFromPath(QString pathDir) currentDirectory = pathDir; //TODO ?? QFileInfo fi(pathDir); getSiblingComics(fi.absolutePath(),fi.fileName()); + + setWindowTitle("YACReader - " + fi.fileName()); + viewer->open(pathDir); enableActions(); } @@ -590,6 +601,8 @@ void MainWindowViewer::openPreviousComic() viewer->open(previousComicPath); QFileInfo fi(previousComicPath); getSiblingComics(fi.absolutePath(),fi.fileName()); + + setWindowTitle("YACReader - " + fi.fileName()); } } @@ -600,6 +613,8 @@ void MainWindowViewer::openNextComic() viewer->open(nextComicPath); QFileInfo fi(nextComicPath); getSiblingComics(fi.absolutePath(),fi.fileName()); + + setWindowTitle("YACReader - " + fi.fileName()); } } diff --git a/YACReader/options_dialog.cpp b/YACReader/options_dialog.cpp index eabe3b14..e19e26f9 100644 --- a/YACReader/options_dialog.cpp +++ b/YACReader/options_dialog.cpp @@ -79,6 +79,9 @@ OptionsDialog::OptionsDialog(QWidget * parent) setLayout(layout); + //disable vSyncCheck + gl->vSyncCheck->hide(); + //restoreOptions(); //load options resize(400,0); setModal (true); diff --git a/YACReaderLibrary/comic_flow_widget.cpp b/YACReaderLibrary/comic_flow_widget.cpp index 10d01a75..73bd10bc 100644 --- a/YACReaderLibrary/comic_flow_widget.cpp +++ b/YACReaderLibrary/comic_flow_widget.cpp @@ -269,6 +269,10 @@ void ComicFlowWidgetGL::updateConfig(QSettings * settings) } 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()) { diff --git a/YACReaderLibrary/library_window.cpp b/YACReaderLibrary/library_window.cpp index 6dc525bc..55883463 100644 --- a/YACReaderLibrary/library_window.cpp +++ b/YACReaderLibrary/library_window.cpp @@ -186,7 +186,7 @@ void LibraryWindow::doLayout() setCentralWidget(sHorizontal); //FINAL LAYOUT------------------------------------------------------------- - fullScreenToolTip = new QLabel(this); + fullScreenToolTip = new QLabel(comicFlow); fullScreenToolTip->setText(tr(" press 'F' to close fullscreen mode ")); fullScreenToolTip->setPalette(QPalette(QColor(0,0,0))); fullScreenToolTip->setFont(QFont("courier new",15,234)); @@ -291,7 +291,7 @@ void LibraryWindow::createActions() removeLibraryAction->setToolTip(tr("Remove current library from your collection")); 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->setShortcut(Qt::Key_Return); openComicAction->setIcon(QIcon(":/images/icon.png")); @@ -325,7 +325,7 @@ void LibraryWindow::createActions() showPropertiesAction->setShortcut(Qt::Key_P); 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->setShortcut(Qt::Key_F); toggleFullScreenAction->setIcon(QIcon(":/images/fit.png")); @@ -398,6 +398,12 @@ void LibraryWindow::createActions() hideComicViewAction->setCheckable(true); hideComicViewAction->setChecked(false); //------------------------------------------------------------------------- + + comicFlow->addAction(toggleFullScreenAction); + comicFlow->addAction(openComicAction); + + + comicFlow->setContextMenuPolicy(Qt::ActionsContextMenu); } //TODO unificar con disableActions @@ -1144,6 +1150,7 @@ void LibraryWindow::toFullScreen() comicFlow->show(); comicFlow->setFocus(Qt::OtherFocusReason); + fullScreenToolTip->move((width()-fullScreenToolTip->width())/2,0); fullScreenToolTip->adjustSize(); fullScreenToolTip->show(); @@ -1151,13 +1158,14 @@ void LibraryWindow::toFullScreen() void LibraryWindow::toNormal() { + fullScreenToolTip->hide(); comicFlow->hide(); comicFlow->setSlideSize(slideSizeW); comicFlow->setCenterIndex(comicFlow->centerIndex()); comicFlow->render(); comics->show(); left->show(); - fullScreenToolTip->hide(); + libraryToolBar->show(); comicFlow->show(); diff --git a/YACReaderLibrary/library_window.h b/YACReaderLibrary/library_window.h index 92fff750..bc27aaae 100644 --- a/YACReaderLibrary/library_window.h +++ b/YACReaderLibrary/library_window.h @@ -50,8 +50,9 @@ private: PropertiesDialog * propertiesDialog; bool fullscreen; bool importedCovers; //if true, the library is read only (not updates,open comic or properties) - YACReaderTreeSearch * proxyFilter; - YACReaderSortComics * proxySort; + //Ya no se usan proxies, el rendimiento de la BD es suficiente + //YACReaderTreeSearch * proxyFilter; + //YACReaderSortComics * proxySort; PackageManager * packageManager; ComicFlowWidget * comicFlow; diff --git a/common/custom_widgets.cpp b/common/custom_widgets.cpp index a5a51f09..6f746835 100644 --- a/common/custom_widgets.cpp +++ b/common/custom_widgets.cpp @@ -23,7 +23,10 @@ - +////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// HelpAboutDialog::HelpAboutDialog(QWidget * parent) :QDialog(parent) { @@ -80,6 +83,10 @@ QString HelpAboutDialog::fileToString(const QString & path) return content; } +////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// void delTree(QDir dir) { dir.setFilter(QDir::AllDirs|QDir::Files|QDir::Hidden|QDir::NoDotAndDotDot); @@ -100,6 +107,10 @@ void delTree(QDir dir) } } +////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// YACReaderIconProvider::YACReaderIconProvider() :QFileIconProvider() { @@ -133,6 +144,10 @@ QString YACReaderIconProvider::type(const QFileInfo & info) const return QFileIconProvider::type(info); } +////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// YACReaderFlow::YACReaderFlow(QWidget * parent,FlowType flowType) : PictureFlow(parent,flowType) {} void YACReaderFlow::mousePressEvent(QMouseEvent* event) @@ -151,6 +166,10 @@ void YACReaderFlow::mouseDoubleClickEvent(QMouseEvent* event) emit selected(centerIndex()); } +////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// YACReaderComicDirModel::YACReaderComicDirModel( const QStringList & nameFilters, QDir::Filters filters, QDir::SortFlags sort, QObject * parent ) :QDirModel(nameFilters,filters,sort,parent) { @@ -173,7 +192,10 @@ QFileInfo YACReaderComicDirModel::fileInfo ( const QModelIndex & index ) const return fileInfo; } - +////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// YACReaderComicViewDelegate::YACReaderComicViewDelegate(QObject * parent) :QItemDelegate(parent) { @@ -269,6 +291,10 @@ QRect YACReaderComicViewDelegate::textLayoutBounds(const QStyleOptionViewItemV2 return rect; } +////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// YACReaderTreeSearch::YACReaderTreeSearch(QObject * parent) :QSortFilterProxyModel(parent),cache(new ModelIndexCache()) { @@ -334,6 +360,10 @@ void YACReaderTreeSearch::softReset() //invalidateFilter(); } +////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// ModelIndexCache::ModelIndexCache() :cache() { @@ -361,6 +391,10 @@ void ModelIndexCache::clear() cache.clear(); } +////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// YACReaderSortComics::YACReaderSortComics(QObject * parent) :QSortFilterProxyModel(parent) { @@ -379,7 +413,10 @@ bool YACReaderSortComics::lessThan(const QModelIndex &left, const QModelIndex &r } -//-------------------------------------------- +////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// YACReaderFieldEdit::YACReaderFieldEdit(QWidget * parent) :QLineEdit(parent) @@ -416,7 +453,10 @@ void YACReaderFieldEdit::setDisabled(bool disabled) QLineEdit::setDisabled(disabled); } -//-------------------------------------------- +////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// YACReaderFieldPlainTextEdit::YACReaderFieldPlainTextEdit(QWidget * parent) :QPlainTextEdit(parent) @@ -468,7 +508,10 @@ void YACReaderFieldPlainTextEdit::setDisabled(bool disabled) QPlainTextEdit::setDisabled(disabled); } - +////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// YACReaderSpinSliderWidget::YACReaderSpinSliderWidget(QWidget * parent) :QWidget(parent) { @@ -501,7 +544,9 @@ void YACReaderSpinSliderWidget::setRange(int lowValue, int topValue, int step) void YACReaderSpinSliderWidget::setValue(int value) { + disconnect(spinBox, SIGNAL(valueChanged(int)), this, SIGNAL(valueChanged(int))); spinBox->setValue(value); + connect(spinBox, SIGNAL(valueChanged(int)), this, SIGNAL(valueChanged(int))); } void YACReaderSpinSliderWidget::setText(const QString & text) @@ -519,8 +564,10 @@ QSize YACReaderSpinSliderWidget::minimumSizeHint() const return QSize(220, 25); } -//---------------------------------------------------------------------------- - +////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// YACReaderOptionsDialog::YACReaderOptionsDialog(QWidget * parent) :QDialog(parent) { @@ -549,6 +596,12 @@ YACReaderOptionsDialog::YACReaderOptionsDialog(QWidget * parent) connect(gl->radionModern,SIGNAL(toggled(bool)),this,SLOT(setModernConfig())); 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,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(optionsChanged())); + connect(gl->vSyncCheck,SIGNAL(stateChanged(int)),this,SLOT(saveUseVSync(int))); } void YACReaderOptionsDialog::savePerformance(int value) @@ -592,6 +646,26 @@ void YACReaderOptionsDialog::savePerformance(int 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() { emit(optionsChanged()); @@ -701,7 +775,13 @@ void YACReaderOptionsDialog::restoreOptions(QSettings * settings) 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()); + FlowType flowType; switch(settings->value(FLOW_TYPE_GL).toInt()) { @@ -805,6 +885,8 @@ void YACReaderOptionsDialog::setClassicConfig() settings->setValue(FLOW_TYPE_GL,CoverFlowLike); gl->setValues(presetYACReaderFlowClassicConfig); + + saveFlowParameters(); } void YACReaderOptionsDialog::setStripeConfig() @@ -812,6 +894,8 @@ void YACReaderOptionsDialog::setStripeConfig() settings->setValue(FLOW_TYPE_GL,Strip); gl->setValues(presetYACReaderFlowStripeConfig); + + saveFlowParameters(); } void YACReaderOptionsDialog::setOverlappedStripeConfig() @@ -819,6 +903,8 @@ void YACReaderOptionsDialog::setOverlappedStripeConfig() settings->setValue(FLOW_TYPE_GL,StripOverlapped); gl->setValues(presetYACReaderFlowOverlappedStripeConfig); + + saveFlowParameters(); } void YACReaderOptionsDialog::setModernConfig() @@ -826,6 +912,8 @@ void YACReaderOptionsDialog::setModernConfig() settings->setValue(FLOW_TYPE_GL,Modern); gl->setValues(defaultYACReaderFlowConfig); + + saveFlowParameters(); } void YACReaderOptionsDialog::setRouletteConfig() @@ -833,10 +921,15 @@ void YACReaderOptionsDialog::setRouletteConfig() settings->setValue(FLOW_TYPE_GL,Roulette); gl->setValues(pressetYACReaderFlowDownConfig); + + saveFlowParameters(); } -///---------------------------------------------------------- +////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// YACReaderGLFlowConfigWidget::YACReaderGLFlowConfigWidget(QWidget * parent /* = 0 */) :QWidget(parent) { @@ -962,7 +1055,7 @@ YACReaderGLFlowConfigWidget::YACReaderGLFlowConfigWidget(QWidget * parent /* = 0 lightStrength = new YACReaderSpinSliderWidget(this); 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,SLOT(saveLightStrength(int))); @@ -996,10 +1089,10 @@ YACReaderGLFlowConfigWidget::YACReaderGLFlowConfigWidget(QWidget * parent /* = 0 groupBoxesLayout->addWidget(groupBox); groupBoxesLayout->addWidget(optionsGroupBox); - QHBoxLayout * performance = new QHBoxLayout; - performance->addWidget(new QLabel(tr("Low Performance"))); - performance->addWidget(performanceSlider = new QSlider(Qt::Horizontal)); - performance->addWidget(new QLabel(tr("High Performance"))); + QHBoxLayout * performanceSliderLayout = new QHBoxLayout; + performanceSliderLayout->addWidget(new QLabel(tr("Low Performance"))); + performanceSliderLayout->addWidget(performanceSlider = new QSlider(Qt::Horizontal)); + performanceSliderLayout->addWidget(new QLabel(tr("High Performance"))); performanceSlider->setMinimum(0); performanceSlider->setMaximum(3); @@ -1008,12 +1101,25 @@ YACReaderGLFlowConfigWidget::YACReaderGLFlowConfigWidget(QWidget * parent /* = 0 performanceSlider->setTickInterval(1); 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(optionsChanged())); + performanceGroupBox->setLayout(performanceLayout); layout->addLayout(groupBoxesLayout); - layout->addLayout(performance); + layout->addWidget(performanceGroupBox); layout->setContentsMargins(0,0,0,0); @@ -1037,7 +1143,10 @@ void YACReaderGLFlowConfigWidget::setValues(Preset preset) maxAngle->setValue(preset.viewAngle); } -//----------------------------------------------------------------------------- +////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// YACReaderFlowConfigWidget::YACReaderFlowConfigWidget(QWidget * parent ) :QWidget(parent) { diff --git a/common/custom_widgets.h b/common/custom_widgets.h index ac5d95ad..24739425 100644 --- a/common/custom_widgets.h +++ b/common/custom_widgets.h @@ -32,6 +32,10 @@ #include "yacreader_flow_gl.h" +////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// class QToolBarStretch : public QWidget { public: @@ -43,6 +47,10 @@ public: } }; +////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// class HelpAboutDialog : public QDialog { Q_OBJECT @@ -60,6 +68,10 @@ private: QString fileToString(const QString & path); }; +////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// class YACReaderIconProvider : public QFileIconProvider { public: @@ -69,6 +81,10 @@ public: virtual QString type ( const QFileInfo & info ) const; }; +////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// class YACReaderFlow : public PictureFlow { Q_OBJECT @@ -82,6 +98,10 @@ signals: void selected(unsigned int centerIndex); }; +////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// class YACReaderComicDirModel : public QDirModel { Q_OBJECT @@ -91,6 +111,10 @@ Q_OBJECT QFileInfo fileInfo ( const QModelIndex & index ) const; }; +////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// class YACReaderComicViewDelegate : public QItemDelegate { Q_OBJECT @@ -100,6 +124,10 @@ class YACReaderComicViewDelegate : public QItemDelegate QRect textLayoutBounds(const QStyleOptionViewItemV2 &option) const; }; +////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// class ModelIndexCache { @@ -118,7 +146,10 @@ private: QHash cache; }; - +////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// class YACReaderTreeSearch : public QSortFilterProxyModel { Q_OBJECT @@ -135,6 +166,10 @@ private: ModelIndexCache * cache; }; +////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// class YACReaderSortComics : public QSortFilterProxyModel { Q_OBJECT @@ -143,10 +178,16 @@ class YACReaderSortComics : public QSortFilterProxyModel protected: bool lessThan(const QModelIndex &left, const QModelIndex &right) const; }; - +////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// void delTree(QDir dir); - +////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// class YACReaderFieldEdit : public QLineEdit { Q_OBJECT @@ -161,6 +202,10 @@ private: }; +////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// class YACReaderFieldPlainTextEdit : public QPlainTextEdit { Q_OBJECT @@ -192,6 +237,10 @@ private: // } //}; +////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// class YACReaderSpinSliderWidget : public QWidget { Q_OBJECT @@ -212,6 +261,10 @@ signals: }; +////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// class YACReaderFlowConfigWidget : public QWidget { Q_OBJECT @@ -223,6 +276,10 @@ public: YACReaderFlowConfigWidget(QWidget * parent = 0); }; +////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// class YACReaderGLFlowConfigWidget : public QWidget { Q_OBJECT @@ -249,11 +306,16 @@ public: YACReaderSpinSliderWidget * maxAngle; QSlider * performanceSlider; + QCheckBox * vSyncCheck; public slots: void setValues(Preset preset); }; +////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// class YACReaderOptionsDialog : public QDialog { Q_OBJECT @@ -275,6 +337,7 @@ public slots: virtual void saveOptions(); protected slots: virtual void savePerformance(int value); + virtual void saveUseVSync(int b); virtual void saveUseGL(int b); virtual void saveXRotation(int value); virtual void saveYPosition(int value); @@ -296,6 +359,7 @@ protected slots: virtual void setClassicConfigSW(); virtual void setStripeConfigSW(); virtual void setOverlappedStripeConfigSW(); + virtual void saveFlowParameters(); signals: void optionsChanged(); diff --git a/common/yacreader_flow_gl.cpp b/common/yacreader_flow_gl.cpp index 950ae267..0066d0eb 100644 --- a/common/yacreader_flow_gl.cpp +++ b/common/yacreader_flow_gl.cpp @@ -191,7 +191,7 @@ struct Preset pressetYACReaderFlowDownConfig = { }; /*Constructor*/ 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; config = p; @@ -512,7 +512,6 @@ void YACReaderFlowGL::draw() glMatrixMode(GL_MODELVIEW); glLoadIdentity(); - glBegin( GL_TRIANGLES ); glColor4f( 1.0f, 1.0f, 1.0f, 1.0f ); @@ -528,7 +527,6 @@ void YACReaderFlowGL::draw() glMatrixMode(GL_PROJECTION); glPopMatrix(); glMatrixMode(GL_MODELVIEW); - } void YACReaderFlowGL::showPrevious() @@ -720,6 +718,13 @@ void YACReaderFlowGL::reset() } +void YACReaderFlowGL::reload() +{ + int n = numObjects; + reset(); + populate(n); +} + //slots void YACReaderFlowGL::setCF_RX(int value) { @@ -809,22 +814,33 @@ void YACReaderFlowGL::setPreset(const Preset & p) void YACReaderFlowGL::setPerformance(Performance performance) { - this->performance = performance; - - //if(performance = ultraHigh) - //{ - // QGLFormat f = format(); - // f.setSwapInterval(1); - // setFormat(f); - //} - //else - //{ - // QGLFormat f = format(); - // f.setSwapInterval(0); - // setFormat(f); - //} + if(this->performance != performance) + { + this->performance = performance; + reload(); + } } +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) { showMarks = value; @@ -949,10 +965,8 @@ void YACReaderFlowGL::mousePressEvent(QMouseEvent *event) } else if(posX <=-0.5) showPrevious(); - } else if(event->button() == Qt::RightButton) - { - marks[currentSelected] = !marks[currentSelected]; - } + } else + QGLWidget::mousePressEvent(event); } void YACReaderFlowGL::mouseDoubleClickEvent(QMouseEvent* event) @@ -973,9 +987,11 @@ void YACReaderComicFlowGL::setImagePaths(QStringList paths) worker->reset(); reset(); numObjects = 0; - populate(paths.size()); + if(lazyPopulateObjects!=-1) + YACReaderFlowGL::populate(paths.size()); + lazyPopulateObjects = paths.size(); this->paths = paths; - numObjects = paths.size(); + //numObjects = paths.size(); } @@ -1158,8 +1174,8 @@ void YACReaderPageFlowGL::updateImageData() void YACReaderPageFlowGL::populate(int n) { worker->reset(); - //if(lazyPopulateObjects!=-1) - //YACReaderFlowGL::populate(n); + if(lazyPopulateObjects!=-1) + YACReaderFlowGL::populate(n); lazyPopulateObjects = n; imagesReady = QVector (n,false); rawImages = QVector (n); diff --git a/common/yacreader_flow_gl.h b/common/yacreader_flow_gl.h index 5b2c47ce..04c2f072 100644 --- a/common/yacreader_flow_gl.h +++ b/common/yacreader_flow_gl.h @@ -139,6 +139,7 @@ protected: CFImage * cfImages; Performance performance; + bool bUseVSync; /*** Animation Settings ***/ Preset config; @@ -234,11 +235,12 @@ public: void setPerformance(Performance performance); - + void useVSync(bool b); virtual void updateImageData() = 0; void reset(); + void reload(); //interface with yacreaderlibrary, compatibility void setShowMarks(bool value); diff --git a/common/yacreader_global.h b/common/yacreader_global.h index a5ceec8a..18ee7c44 100644 --- a/common/yacreader_global.h +++ b/common/yacreader_global.h @@ -35,6 +35,7 @@ #define USE_OPEN_GL "USE_OPEN_GL" #define X_ROTATION "X_ROTATION" #define Y_COVER_OFFSET "Y_COVER_OFFSET" +#define V_SYNC "V_SYNC" enum FlowType {