diff --git a/YACReader/configuration.cpp b/YACReader/configuration.cpp index 29a9c03a..c98e0568 100644 --- a/YACReader/configuration.cpp +++ b/YACReader/configuration.cpp @@ -7,28 +7,10 @@ #include #include - - -#define PATH "PATH" -#define MAG_GLASS_SIZE "MAG_GLASS_SIZE" -#define ZOOM_LEVEL "ZOOM_LEVEL" -#define SLIDE_SIZE "SLIDE_SIZE" -#define FIT "FIT" -#define FLOW_TYPE "FLOW_TYPE" -#define FULLSCREEN "FULLSCREEN" -#define FIT_TO_WIDTH_RATIO "FIT_TO_WIDTH_RATIO" -#define POS "POS" -#define SIZE "SIZE" -#define MAXIMIZED "MAXIMIZED" -#define DOUBLE_PAGE "DOUBLE_PAGE" -#define ADJUST_TO_FULL_SIZE "ADJUST_TO_FULL_SIZE" -#define BACKGROUND_COLOR "BACKGROUND_COLOR" -#define ALWAYS_ON_TOP "ALWAYS_ON_TOP" - Configuration::Configuration() { //read configuration - load("/YACReader.conf"); + //load("/YACReader.conf"); } Configuration::Configuration(const Configuration & conf) @@ -36,6 +18,41 @@ Configuration::Configuration(const Configuration & conf) //nothing } +void Configuration::load(QSettings * settings) +{ + this->settings = settings; + + //TODO set defaults + if(!settings->contains(PATH)) + settings->setValue(PATH,"."); + if(!settings->contains(GO_TO_FLOW_SIZE)) + settings->setValue(GO_TO_FLOW_SIZE,QSize(126,200)); + if(!settings->contains(MAG_GLASS_SIZE)) + settings->setValue(MAG_GLASS_SIZE,QSize(350,175)); + if(!settings->contains(ZOOM_LEVEL)) + settings->setValue(MAG_GLASS_SIZE,QSize(350,175)); + if(!settings->contains(FIT)) + settings->setValue(FIT,true); + if(!settings->contains(FLOW_TYPE)) + settings->setValue(FLOW_TYPE,0); + if(!settings->contains(FULLSCREEN)) + settings->setValue(FULLSCREEN,false); + if(!settings->contains(FIT_TO_WIDTH_RATIO)) + settings->setValue(FIT_TO_WIDTH_RATIO,1); + if(!settings->contains(Y_WINDOW_SIZE)) + settings->setValue(Y_WINDOW_SIZE,QSize(0,0)); + if(!settings->contains(MAXIMIZED)) + settings->setValue(MAXIMIZED,false); + if(!settings->contains(DOUBLE_PAGE)) + settings->setValue(DOUBLE_PAGE,false); + if(!settings->contains(ADJUST_TO_FULL_SIZE)) + settings->setValue(ADJUST_TO_FULL_SIZE,false); + if(!settings->contains(BACKGROUND_COLOR)) + settings->setValue(BACKGROUND_COLOR,QColor(0,0,0)); + if(!settings->contains(ALWAYS_ON_TOP)) + settings->setValue(ALWAYS_ON_TOP,false); +} + void Configuration::load(const QString & path) { //load default configuration @@ -103,13 +120,13 @@ void Configuration::load(const QString & path) if(name==FIT_TO_WIDTH_RATIO) fitToWidthRatio = line.toFloat(); else - if(name==POS) + if(name==Y_WINDOW_POS) { QStringList l = line.split(','); windowPos = QPoint(l[0].toInt(),l[1].toInt()); } else - if(name==SIZE) + if(name==Y_WINDOW_SIZE) { QStringList l = line.split(','); windowSize = QSize(l[0].toInt(),l[1].toInt()); @@ -175,10 +192,10 @@ void Configuration::save() txtS << FIT_TO_WIDTH_RATIO << "\n"; txtS << fitToWidthRatio << "\n"; - txtS << POS << "\n"; + txtS << Y_WINDOW_POS << "\n"; txtS << windowPos.x() << "," << windowPos.y() << "\n"; - txtS << SIZE << "\n"; + txtS << Y_WINDOW_SIZE << "\n"; txtS << windowSize.width() << "," << windowSize.height() << "\n"; txtS << MAXIMIZED << "\n"; diff --git a/YACReader/configuration.h b/YACReader/configuration.h index ffe7ca64..b90a0f52 100644 --- a/YACReader/configuration.h +++ b/YACReader/configuration.h @@ -5,6 +5,8 @@ #include #include #include +#include + #include "yacreader_global.h" #define CONF_FILE_PATH "." @@ -15,6 +17,8 @@ Q_OBJECT private: + QSettings * settings; + QString defaultPath; //configuration properties QSize magnifyingGlassSize; @@ -36,42 +40,45 @@ Configuration(const Configuration & conf); void load(const QString & path = CONF_FILE_PATH); + public: static Configuration & getConfiguration() { static Configuration configuration; return configuration; }; - QString getDefaultPath() { return defaultPath; }; - void setDefaultPath(QString defaultPath){this->defaultPath = defaultPath;}; - QSize getMagnifyingGlassSize() { return magnifyingGlassSize;}; - void setMagnifyingGlassSize(const QSize & mgs) { magnifyingGlassSize = mgs;}; - QSize getGotoSlideSize() { return gotoSlideSize;}; - void setGotoSlideSize(const QSize & gss) { gotoSlideSize = gss;}; - float getZoomLevel() { return zoomLevel;}; - void setZoomLevel(float zl) { zoomLevel = zl;}; - bool getAdjustToWidth() {return adjustToWidth;}; - void setAdjustToWidth(bool atw=true) {adjustToWidth = atw;}; - FlowType getFlowType(){return flowType;}; - void setFlowType(FlowType type){flowType = type;}; - bool getFullScreen(){return fullScreen;}; - void setFullScreen(bool f){fullScreen = f;}; - float getFitToWidthRatio(){return fitToWidthRatio;}; - void setFitToWidthRatio(float r){fitToWidthRatio = r;}; - QPoint getPos(){return windowPos;}; - void setPos(QPoint p){windowPos = p;}; - QSize getSize(){return windowSize;}; - void setSize(QSize s){windowSize = s;}; - bool getMaximized(){return maximized;}; - void setMaximized(bool b){maximized = b;}; - bool getDoublePage(){return doublePage;}; - void setDoublePage(bool b){doublePage = b;}; - void setAdjustToFullSize(bool b){adjustToFullSize = b;}; - bool getAdjustToFullSize(){return adjustToFullSize;}; - void setBackgroundColor(const QColor& color){backgroundColor = color;}; - QColor getBackgroundColor(){return backgroundColor;}; - void setAlwaysOnTop(bool b){alwaysOnTop = b;}; - bool getAlwaysOnTop(){return alwaysOnTop;}; + void load(QSettings * settings); + QString getDefaultPath() { return settings->value(PATH).toString(); }; + void setDefaultPath(QString defaultPath){settings->setValue(PATH,defaultPath);}; + QSize getMagnifyingGlassSize() { return settings->value(MAG_GLASS_SIZE).toSize();}; + void setMagnifyingGlassSize(const QSize & mgs) { settings->setValue(MAG_GLASS_SIZE,mgs);}; + QSize getGotoSlideSize() { return settings->value(GO_TO_FLOW_SIZE).toSize();}; + void setGotoSlideSize(const QSize & gss) { settings->setValue(GO_TO_FLOW_SIZE,gss);}; + float getZoomLevel() { return settings->value(ZOOM_LEVEL).toFloat();}; + void setZoomLevel(float zl) { settings->setValue(ZOOM_LEVEL,zl);}; + bool getAdjustToWidth() {return settings->value(FIT).toBool();}; + void setAdjustToWidth(bool atw=true) {settings->setValue(FIT,atw);}; + FlowType getFlowType(){return (FlowType)settings->value(FLOW_TYPE_SW).toInt();}; + void setFlowType(FlowType type){settings->setValue(FLOW_TYPE_SW,type);}; + bool getFullScreen(){return settings->value(FULLSCREEN).toBool();}; + void setFullScreen(bool f){settings->setValue(FULLSCREEN,f);}; + float getFitToWidthRatio(){return settings->value(FIT_TO_WIDTH_RATIO).toFloat();}; + void setFitToWidthRatio(float r){settings->setValue(FIT_TO_WIDTH_RATIO,r);}; + QPoint getPos(){return settings->value(Y_WINDOW_POS).toPoint();}; + void setPos(QPoint p){settings->setValue(Y_WINDOW_POS,p);}; + QSize getSize(){return settings->value(Y_WINDOW_SIZE).toSize();}; + void setSize(QSize s){settings->setValue(Y_WINDOW_SIZE,s);}; + bool getMaximized(){return settings->value(MAXIMIZED).toBool();}; + void setMaximized(bool b){settings->setValue(MAXIMIZED,b);}; + bool getDoublePage(){return settings->value(DOUBLE_PAGE).toBool();}; + void setDoublePage(bool b){settings->setValue(DOUBLE_PAGE,b);}; + bool getAdjustToFullSize(){return settings->value(ADJUST_TO_FULL_SIZE).toBool();}; + void setAdjustToFullSize(bool b){settings->setValue(ADJUST_TO_FULL_SIZE,b);}; + QColor getBackgroundColor(){return settings->value(BACKGROUND_COLOR).value();}; + void setBackgroundColor(const QColor& color){settings->value(BACKGROUND_COLOR,color);}; + bool getAlwaysOnTop(){return settings->value(ALWAYS_ON_TOP).toBool();}; + void setAlwaysOnTop(bool b){ settings->setValue(ALWAYS_ON_TOP,b);}; + void save(); }; diff --git a/YACReader/goto_flow.cpp b/YACReader/goto_flow.cpp index 2d203184..ca1b8195 100644 --- a/YACReader/goto_flow.cpp +++ b/YACReader/goto_flow.cpp @@ -77,6 +77,8 @@ GoToFlow::GoToFlow(QWidget *parent,FlowType flowType) connect(edit,SIGNAL(returnPressed()),goToButton,SIGNAL(clicked())); this->setCursor(QCursor(Qt::ArrowCursor)); + + } void GoToFlow::goTo() diff --git a/YACReader/goto_flow_gl.cpp b/YACReader/goto_flow_gl.cpp new file mode 100644 index 00000000..2145a9a0 --- /dev/null +++ b/YACReader/goto_flow_gl.cpp @@ -0,0 +1,229 @@ +#include "goto_flow_gl.h" + +#include +#include +#include +#include +#include + +#include "configuration.h" + +GoToFlowGL::GoToFlowGL(QWidget* parent, FlowType flowType) + :GoToFlowWidget(parent) +{ + //worker = new PageLoader; + + QVBoxLayout * layout = new QVBoxLayout(this); + flow = new YACReaderPageFlowGL(this); + //flow->populate(50); + //flow->setReflectionEffect(PictureFlow::PlainReflection); + imageSize = Configuration::getConfiguration().getGotoSlideSize(); + + flow->setSlideSize(imageSize); + connect(flow,SIGNAL(centerIndexChanged(int)),this,SLOT(setPageNumber(int))); + connect(flow,SIGNAL(selected(unsigned int)),this,SLOT(goTo())); + + QHBoxLayout * bottom = new QHBoxLayout(this); + bottom->addStretch(); + bottom->addWidget(new QLabel(tr("Page : "),this)); + bottom->addWidget(edit = new QLineEdit(this)); + v = new QIntValidator(this); + v->setBottom(1); + edit->setValidator(v); + edit->setAlignment(Qt::AlignRight|Qt::AlignVCenter); + edit->setFixedWidth(40); + edit->setSizePolicy(QSizePolicy(QSizePolicy::Fixed,QSizePolicy::Minimum)); + + centerButton = new QPushButton(this); + centerButton->setIcon(QIcon(":/images/center.png")); + connect(centerButton,SIGNAL(clicked()),this,SLOT(centerSlide())); + bottom->addWidget(centerButton); + + goToButton = new QPushButton(this); + goToButton->setIcon(QIcon(":/images/goto.png")); + connect(goToButton,SIGNAL(clicked()),this,SLOT(goTo())); + bottom->addWidget(goToButton); + + bottom->addStretch(); + + layout->addWidget(flow); + layout->addLayout(bottom); + layout->setStretchFactor(flow,1); + layout->setStretchFactor(bottom,0); + layout->setMargin(0); + layout->setSpacing(0); + setLayout(layout); + this->setAutoFillBackground(true); + resize(static_cast(5*imageSize.width()),static_cast(imageSize.height()*1.7)); + + //install eventFilter + flow->installEventFilter(this); + edit->installEventFilter(this); + centerButton->installEventFilter(this); + goToButton->installEventFilter(this); + + connect(edit,SIGNAL(returnPressed()),goToButton,SIGNAL(clicked())); + + this->setCursor(QCursor(Qt::ArrowCursor)); +} + +bool GoToFlowGL::eventFilter(QObject *target, QEvent *event) +{ + if (event->type() == QEvent::KeyPress) + { + QKeyEvent *keyEvent = static_cast(event); + int key = keyEvent->key(); + if((key==Qt::Key_Return)|| + (key==Qt::Key_Enter)|| + (key==Qt::Key_Space)|| + (key==Qt::Key_Left)|| + (key==Qt::Key_Right)|| + (key==Qt::Key_S)) + this->keyPressEvent(keyEvent); + } + return QWidget::eventFilter(target, event); +} + +void GoToFlowGL::keyPressEvent(QKeyEvent* event) +{ + switch (event->key()) + { + case Qt::Key_Return: case Qt::Key_Enter: + goTo(); + centerSlide(); + break; + case Qt::Key_Space: + centerSlide(); + break; + case Qt::Key_S: + QCoreApplication::sendEvent(this->parent(),event); + break; + case Qt::Key_Left: case Qt::Key_Right: + QCoreApplication::sendEvent(flow,event); + } + + event->accept(); +} + +void GoToFlowGL::goTo() +{ + emit(goToPage(edit->text().toInt())); +} + +void GoToFlowGL::reset() +{ + flow->reset(); +} + +void GoToFlowGL::centerSlide() +{ + int page = edit->text().toInt()-1; + flow->setCenterIndex(page); +} + +void GoToFlowGL::centerSlide(int slide) +{ + if(flow->centerIndex()!=slide) + { + flow->setCenterIndex(slide); + } +} +void GoToFlowGL::setPageNumber(int page) +{ + edit->setText(QString::number(page+1)); +} + +void GoToFlowGL::setFlowType(FlowType flowType) +{ + if(flowType == CoverFlowLike) + flow->setPreset(presetYACReaderFlowClassicConfig); + else if(flowType == Strip) + flow->setPreset(presetYACReaderFlowStripeConfig); + else if(flowType == StripOverlapped) + flow->setPreset(presetYACReaderFlowOverlappedStripeConfig); + else + flow->setPreset(defaultYACReaderFlowConfig); +} + +void GoToFlowGL::setNumSlides(unsigned int slides) +{ + flow->populate(slides); + v->setTop(slides); +} +void GoToFlowGL::setImageReady(int index,const QByteArray & imageData) +{ + flow->rawImages[index] = imageData; + flow->imagesReady[index] = true; + + //QImage image; + //image.loadFromData(imageData); + //float x = 1; + //float y = 1 * (float(image.height())/image.width()); + //image = image.scaledToWidth(128,Qt::SmoothTransformation); + //flow->replace("cover",flow->bindTexture(image,GL_TEXTURE_2D,GL_RGB,QGLContext::LinearFilteringBindOption | QGLContext::MipmapBindOption),x,y,index); +} +void GoToFlowGL::updateSize() +{ + +} + +void GoToFlowGL::updateConfig(QSettings * settings) +{ + Performance performance = medium; + + switch (settings->value(PERFORMANCE).toInt()) + { + case 0: + performance = low; + break; + case 1: + performance = medium; + break; + case 2: + performance = high; + break; + case 3: + performance = ultraHigh; + break; + } + + flow->setPerformance(performance); + + switch (settings->value(FLOW_TYPE_GL).toInt()) + { + case 0: + flow->setPreset(presetYACReaderFlowClassicConfig); + return; + case 1: + flow->setPreset(presetYACReaderFlowStripeConfig); + return; + case 2: + flow->setPreset(presetYACReaderFlowOverlappedStripeConfig); + return; + case 3: + flow->setPreset(defaultYACReaderFlowConfig); + return; + case 4: + flow->setPreset(pressetYACReaderFlowDownConfig); + return; + } + + + //custom config + + flow->setCF_RX(settings->value(X_ROTATION).toInt()); + flow->setCF_Y(settings->value(Y_POSITION).toInt()); + flow->setX_Distance(settings->value(COVER_DISTANCE).toInt()); + flow->setCenter_Distance(settings->value(CENTRAL_DISTANCE).toInt()); + flow->setCF_Z(settings->value(ZOOM_LEVEL).toInt()); + flow->setY_Distance(settings->value(Y_COVER_OFFSET).toInt()); + flow->setZ_Distance(settings->value(Z_COVER_OFFSET).toInt()); + flow->setRotation(settings->value(COVER_ROTATION).toInt()); + flow->setFadeOutDist(settings->value(FADE_OUT_DIST).toInt()); + flow->setLightStrenght(settings->value(LIGHT_STRENGTH).toInt()); + flow->setMaxAngle(settings->value(MAX_ANGLE).toInt()); + +/* flow->setVisibility(settings->value("visibilityDistance").toInt()); + flow->setLightStrenght(settings->value("lightStrength").toInt())*/; + +} \ No newline at end of file diff --git a/YACReader/goto_flow_gl.h b/YACReader/goto_flow_gl.h new file mode 100644 index 00000000..087544fd --- /dev/null +++ b/YACReader/goto_flow_gl.h @@ -0,0 +1,46 @@ +#ifndef __GOTO_FLOW_GL_H +#define __GOTO_FLOW_GL_H + +#include "yacreader_global.h" +#include "goto_flow_widget.h" +#include "yacreader_flow_gl.h" + +class QLineEdit; +class QIntValidator; +class QPushButton; +class QPushButton; +class QSize; + +class GoToFlowGL : public GoToFlowWidget +{ + Q_OBJECT +public: + GoToFlowGL(QWidget* parent = 0,FlowType flowType = CoverFlowLike); + void reset(); + void centerSlide(); + void centerSlide(int slide); + void setPageNumber(int page); + void setFlowType(FlowType flowType); + void setNumSlides(unsigned int slides); + void setImageReady(int index,const QByteArray & image); + void updateSize(); + void goTo(); + bool eventFilter(QObject *target, QEvent *event); + void keyPressEvent(QKeyEvent* event); + void updateConfig(QSettings * settings); + +signals: + void goToPage(unsigned int page); +private: + YACReaderPageFlowGL * flow; + + QLineEdit * edit; + QIntValidator * v; + QPushButton * centerButton; + QPushButton * goToButton; + //Comic * comic; + QSize imageSize; + +}; + +#endif \ No newline at end of file diff --git a/YACReader/goto_flow_widget.cpp b/YACReader/goto_flow_widget.cpp new file mode 100644 index 00000000..30d9070f --- /dev/null +++ b/YACReader/goto_flow_widget.cpp @@ -0,0 +1,9 @@ +#include "goto_flow_widget.h" + +GoToFlowWidget::GoToFlowWidget(QWidget * parent) + :QWidget(parent) +{ + QPalette palette; + palette.setColor(backgroundRole(), Qt::black); + setPalette(palette); +} diff --git a/YACReader/goto_flow_widget.h b/YACReader/goto_flow_widget.h new file mode 100644 index 00000000..570adb0f --- /dev/null +++ b/YACReader/goto_flow_widget.h @@ -0,0 +1,27 @@ +#ifndef __GOTO_FLOW_WIDGET_H +#define __GOTO_FLOW_WIDGET_H + +#include +#include +#include "yacreader_global.h" + +class GoToFlowWidget : public QWidget +{ + Q_OBJECT +public: + GoToFlowWidget(QWidget * paret = 0); +public slots: + virtual void reset() = 0; + virtual void centerSlide() = 0; + virtual void centerSlide(int slide) = 0; + virtual void setPageNumber(int page) = 0; + virtual void setFlowType(FlowType flowType) = 0; + virtual void setNumSlides(unsigned int slides) = 0; + virtual void setImageReady(int index,const QByteArray & image) = 0; + virtual void updateSize() = 0; + virtual void goTo() = 0; + virtual void updateConfig(QSettings * settings) = 0; + +}; + +#endif diff --git a/YACReader/main_window_viewer.cpp b/YACReader/main_window_viewer.cpp index b5c3ef4c..c3686fb2 100644 --- a/YACReader/main_window_viewer.cpp +++ b/YACReader/main_window_viewer.cpp @@ -22,6 +22,7 @@ void MainWindowViewer::loadConfiguration() settings = new QSettings("YACReader.ini",QSettings::IniFormat); Configuration & config = Configuration::getConfiguration(); + config.load(settings); currentDirectory = config.getDefaultPath(); fullscreen = config.getFullScreen(); } diff --git a/YACReader/options_dialog.cpp b/YACReader/options_dialog.cpp index bdf89ab9..eabe3b14 100644 --- a/YACReader/options_dialog.cpp +++ b/YACReader/options_dialog.cpp @@ -96,29 +96,30 @@ void OptionsDialog::findFolder() void OptionsDialog::saveOptions() { - settings->setValue("goToFlowSize",QSize(static_cast(slideSize->sliderPosition()*SLIDE_ASPECT_RATIO),slideSize->sliderPosition())); + + settings->setValue(GO_TO_FLOW_SIZE,QSize(static_cast(slideSize->sliderPosition()/SLIDE_ASPECT_RATIO),slideSize->sliderPosition())); + if(sw->radio1->isChecked()) - settings->setValue("flowTypeSW",0); + settings->setValue(FLOW_TYPE_SW,0); if(sw->radio2->isChecked()) - settings->setValue("flowTypeSW",1); + settings->setValue(FLOW_TYPE_SW,1); if(sw->radio3->isChecked()) - settings->setValue("flowTypeSW",2); + settings->setValue(FLOW_TYPE_SW,2); - settings->setValue("path",pathEdit->text()); + settings->setValue(PATH,pathEdit->text()); - settings->setValue("color",colorDialog->currentColor()); - settings->setValue("adjustToWidthRatio",fitToWidthRatioS->sliderPosition()/100.0); + settings->setValue(BACKGROUND_COLOR,colorDialog->currentColor()); + settings->setValue(FIT_TO_WIDTH_RATIO,fitToWidthRatioS->sliderPosition()/100.0); - close(); - emit(accepted()); + YACReaderOptionsDialog::saveOptions(); } void OptionsDialog::restoreOptions(QSettings * settings) { YACReaderOptionsDialog::restoreOptions(settings); - slideSize->setSliderPosition(settings->value("goToFlowSize").toSize().height()); - switch(settings->value("flowTypeSW").toInt()) + slideSize->setSliderPosition(settings->value(GO_TO_FLOW_SIZE).toSize().height()); + switch(settings->value(FLOW_TYPE_SW).toInt()) { case 0: sw->radio1->setChecked(true); @@ -134,10 +135,10 @@ void OptionsDialog::restoreOptions(QSettings * settings) break; } - pathEdit->setText(settings->value("path").toString()); + pathEdit->setText(settings->value(PATH).toString()); - updateColor(settings->value("color").value()); - fitToWidthRatioS->setSliderPosition(settings->value("adjustToWidthRatio").toFloat()*100); + updateColor(settings->value(BACKGROUND_COLOR).value()); + fitToWidthRatioS->setSliderPosition(settings->value(FIT_TO_WIDTH_RATIO).toFloat()*100); } diff --git a/YACReader/viewer.cpp b/YACReader/viewer.cpp index 94ad439f..4702bc62 100644 --- a/YACReader/viewer.cpp +++ b/YACReader/viewer.cpp @@ -67,10 +67,9 @@ drag(false) goToDialog = new GoToDialog(this); QSettings * settings = new QSettings("YACReader.ini",QSettings::IniFormat); - settings->beginGroup("config"); //CONFIG GOTO_FLOW-------------------------------------------------------- - if(settings->contains("useOpenGL") && settings->value("useOpenGL").toBool() == true) + if(settings->contains(USE_OPEN_GL) && settings->value(USE_OPEN_GL).toBool() == true) goToFlow = new GoToFlowGL(this,Configuration::getConfiguration().getFlowType()); else goToFlow = new GoToFlow(this,Configuration::getConfiguration().getFlowType()); diff --git a/YACReaderLibrary/comic_flow_widget.cpp b/YACReaderLibrary/comic_flow_widget.cpp new file mode 100644 index 00000000..10d01a75 --- /dev/null +++ b/YACReaderLibrary/comic_flow_widget.cpp @@ -0,0 +1,322 @@ +#include "comic_flow_widget.h" + +ComicFlowWidget::ComicFlowWidget(QWidget * parent) + :QWidget(parent) +{ + +} + +ComicFlowWidgetSW::ComicFlowWidgetSW(QWidget * parent) + :ComicFlowWidget(parent) +{ + flow = new ComicFlow(parent); + + connect(flow,SIGNAL(centerIndexChanged(int)),this,SIGNAL(centerIndexChanged(int))); + connect(flow,SIGNAL(selected(unsigned int)),this,SIGNAL(selected(unsigned int))); + + QVBoxLayout * l = new QVBoxLayout; + l->addWidget(flow); + setLayout(l); + + //TODO eleminar "padding" + QPalette Pal(palette()); + // set black background + Pal.setColor(QPalette::Background, Qt::black); + setAutoFillBackground(true); + setPalette(Pal); +} + +QSize ComicFlowWidgetSW::minimumSizeHint() const +{ + return flow->minimumSizeHint(); +} +QSize ComicFlowWidgetSW::sizeHint() const +{ + return flow->sizeHint(); +} + +void ComicFlowWidgetSW::setShowMarks(bool value) +{ + flow->setShowMarks(value); +} +void ComicFlowWidgetSW::setMarks(QVector marks) +{ + flow->setMarks(marks); +} +void ComicFlowWidgetSW::setMarkImage(QImage & image) +{ + flow->setMarkImage(image); +} +void ComicFlowWidgetSW::markSlide(int index) +{ + flow->markSlide(index); +} +void ComicFlowWidgetSW::unmarkSlide(int index) +{ + flow->unmarkSlide(index); +} +void ComicFlowWidgetSW::setSlideSize(QSize size) +{ + flow->setSlideSize(size); +} +void ComicFlowWidgetSW::clear() +{ + flow->clear(); +} +void ComicFlowWidgetSW::setImagePaths(QStringList paths) +{ + flow->setImagePaths(paths); +} +void ComicFlowWidgetSW::setCenterIndex(int index) +{ + flow->setCenterIndex(index); +} +void ComicFlowWidgetSW::showSlide(int index) +{ + flow->showSlide(index); +} +int ComicFlowWidgetSW::centerIndex() +{ + return flow->centerIndex(); +} +void ComicFlowWidgetSW::updateMarks() +{ + flow->updateMarks(); +} +void ComicFlowWidgetSW::setFlowType(FlowType flowType) +{ + flow->setFlowType(flowType); +} +void ComicFlowWidgetSW::render() +{ + flow->render(); +} +void ComicFlowWidgetSW::keyPressEvent(QKeyEvent* event) +{ + flow->keyPressEvent(event); +} +void ComicFlowWidgetSW::paintEvent(QPaintEvent *event) +{ + flow->paintEvent(event); +} +void ComicFlowWidgetSW::mousePressEvent(QMouseEvent* event) +{ + flow->mousePressEvent(event); +} +void ComicFlowWidgetSW::resizeEvent(QResizeEvent* event) +{ + flow->resizeEvent(event); +} +void ComicFlowWidgetSW::mouseDoubleClickEvent(QMouseEvent* event) +{ + flow->mouseDoubleClickEvent(event); +} +void ComicFlowWidgetSW::updateConfig(QSettings * settings) +{ + switch (settings->value(FLOW_TYPE_SW).toInt()) + { + case 0: + flow->setFlowType(CoverFlowLike); + return; + case 1: + flow->setFlowType(Strip); + return; + case 2: + flow->setFlowType(StripOverlapped); + return; + } +} + + +////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// +///OpenGL ComicFlow +////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// + +ComicFlowWidgetGL::ComicFlowWidgetGL(QWidget * parent) + :ComicFlowWidget(parent) +{ + flow = new YACReaderComicFlowGL(parent); + + connect(flow,SIGNAL(centerIndexChanged(int)),this,SIGNAL(centerIndexChanged(int))); + connect(flow,SIGNAL(selected(unsigned int)),this,SIGNAL(selected(unsigned int))); + + QVBoxLayout * l = new QVBoxLayout; + l->addWidget(flow); + l->setContentsMargins(0,0,0,0); + setLayout(l); + + //TODO eleminar "padding" + QPalette Pal(palette()); + // set black background + Pal.setColor(QPalette::Background, Qt::black); + setAutoFillBackground(true); + setPalette(Pal); +} + +QSize ComicFlowWidgetGL::minimumSizeHint() const +{ + return flow->minimumSizeHint(); +} +QSize ComicFlowWidgetGL::sizeHint() const +{ + return flow->sizeHint(); +} + +void ComicFlowWidgetGL::setShowMarks(bool value) +{ + flow->setShowMarks(value); +} +void ComicFlowWidgetGL::setMarks(QVector marks) +{ + flow->setMarks(marks); +} +void ComicFlowWidgetGL::setMarkImage(QImage & image) +{ + flow->setMarkImage(image); +} +void ComicFlowWidgetGL::markSlide(int index) +{ + flow->markSlide(index); +} +void ComicFlowWidgetGL::unmarkSlide(int index) +{ + flow->unmarkSlide(index); +} +void ComicFlowWidgetGL::setSlideSize(QSize size) +{ + flow->setSlideSize(size); +} +void ComicFlowWidgetGL::clear() +{ + flow->clear(); +} +void ComicFlowWidgetGL::setImagePaths(QStringList paths) +{ + flow->setImagePaths(paths); +} +void ComicFlowWidgetGL::setCenterIndex(int index) +{ + flow->setCenterIndex(index); +} +void ComicFlowWidgetGL::showSlide(int index) +{ + flow->showSlide(index); +} +int ComicFlowWidgetGL::centerIndex() +{ + return flow->centerIndex(); +} +void ComicFlowWidgetGL::updateMarks() +{ + flow->updateMarks(); +} +void ComicFlowWidgetGL::setFlowType(FlowType flowType) +{ + if(flowType == CoverFlowLike) + flow->setPreset(presetYACReaderFlowClassicConfig); + else if(flowType == Strip) + flow->setPreset(presetYACReaderFlowStripeConfig); + else if(flowType == StripOverlapped) + flow->setPreset(presetYACReaderFlowOverlappedStripeConfig); + else + flow->setPreset(defaultYACReaderFlowConfig); +} +void ComicFlowWidgetGL::render() +{ + flow->render(); +} +void ComicFlowWidgetGL::keyPressEvent(QKeyEvent* event) +{ + flow->keyPressEvent(event); +} +void ComicFlowWidgetGL::paintEvent(QPaintEvent *event) +{ + //flow->paintEvent(event); +} +void ComicFlowWidgetGL::mousePressEvent(QMouseEvent* event) +{ + flow->mousePressEvent(event); +} +void ComicFlowWidgetGL::resizeEvent(QResizeEvent* event) +{ + flow->resizeGL(event->size().width(),event->size().height()); +} +void ComicFlowWidgetGL::mouseDoubleClickEvent(QMouseEvent* event) +{ + flow->mouseDoubleClickEvent(event); +} + +void ComicFlowWidgetGL::updateConfig(QSettings * settings) +{ + Performance performance = medium; + + switch (settings->value(PERFORMANCE).toInt()) + { + case 0: + performance = low; + break; + case 1: + performance = medium; + break; + case 2: + performance = high; + break; + case 3: + performance = ultraHigh; + break; + } + + flow->setPerformance(performance); + + switch (settings->value(FLOW_TYPE_GL).toInt()) + { + case 0: + flow->setPreset(presetYACReaderFlowClassicConfig); + return; + case 1: + flow->setPreset(presetYACReaderFlowStripeConfig); + return; + case 2: + flow->setPreset(presetYACReaderFlowOverlappedStripeConfig); + return; + case 3: + flow->setPreset(defaultYACReaderFlowConfig); + return; + case 4: + flow->setPreset(pressetYACReaderFlowDownConfig); + return; + } + + + //custom config + + flow->setCF_RX(settings->value(X_ROTATION).toInt()); + flow->setCF_Y(settings->value(Y_POSITION).toInt()); + flow->setX_Distance(settings->value(COVER_DISTANCE).toInt()); + flow->setCenter_Distance(settings->value(CENTRAL_DISTANCE).toInt()); + flow->setCF_Z(settings->value(ZOOM_LEVEL).toInt()); + flow->setY_Distance(settings->value(Y_COVER_OFFSET).toInt()); + flow->setZ_Distance(settings->value(Z_COVER_OFFSET).toInt()); + flow->setRotation(settings->value(COVER_ROTATION).toInt()); + flow->setFadeOutDist(settings->value(FADE_OUT_DIST).toInt()); + flow->setLightStrenght(settings->value(LIGHT_STRENGTH).toInt()); + flow->setMaxAngle(settings->value(MAX_ANGLE).toInt()); + +/* flow->setVisibility(settings->value("visibilityDistance").toInt()); + flow->setLightStrenght(settings->value("lightStrength").toInt())*/; + +} + +//void ComicFlowWidgetGL::setCF_RX(int value){ flow->setCF_RX(value);} +//void ComicFlowWidgetGL::setCF_RY(int value){ flow->setCF_RY(value);} +//void ComicFlowWidgetGL::setCF_RZ(int value){ flow->setCF_RZ(value);} +//void ComicFlowWidgetGL::setZoom(int zoom){ flow->setZoom(zoom);} +//void ComicFlowWidgetGL::setRotation(int angle){ flow->setRotation(angle);} +//void ComicFlowWidgetGL::setX_Distance(int distance){ flow->setX_Distance(distance);} +//void ComicFlowWidgetGL::setCenter_Distance(int distance){ flow->setCenter_Distance(distance);} +//void ComicFlowWidgetGL::setZ_Distance(int distance){ flow->setZ_Distance(distance);} +//void ComicFlowWidgetGL::setCF_Y(int value){ flow->setCF_Y(value);} +//void ComicFlowWidgetGL::setY_Distance(int value){ flow->setY_Distance(value);} +//void ComicFlowWidgetGL::setPreset(const Preset & p){ flow->setPreset(p);} \ No newline at end of file diff --git a/YACReaderLibrary/comic_flow_widget.h b/YACReaderLibrary/comic_flow_widget.h new file mode 100644 index 00000000..f9689bb6 --- /dev/null +++ b/YACReaderLibrary/comic_flow_widget.h @@ -0,0 +1,123 @@ +#ifndef __COMIC_FLOW_WIDGET_H +#define __COMIC_FLOW_WIDGET_H + + +#include + +#include "pictureflow.h" +#include "comic_flow.h" +#include "yacreader_flow_gl.h" + +class ComicFlowWidget : public QWidget +{ + Q_OBJECT +public: + ComicFlowWidget(QWidget * paret = 0); + +public slots: + virtual void setShowMarks(bool value) = 0; + virtual void setMarks(QVector marks) = 0; + virtual void setMarkImage(QImage & image) = 0; + virtual void markSlide(int index) = 0; + virtual void unmarkSlide(int index) = 0; + virtual void setSlideSize(QSize size) = 0; + virtual void clear() = 0; + virtual void setImagePaths(QStringList paths) = 0; + virtual void setCenterIndex(int index) = 0; + virtual void showSlide(int index) = 0; + virtual int centerIndex() = 0; + virtual void updateMarks() = 0; + virtual void setFlowType(FlowType flowType) = 0; + virtual void render() = 0; + virtual void updateConfig(QSettings * settings) = 0; +signals: + void centerIndexChanged(int); + void selected(unsigned int); +}; + + +class ComicFlowWidgetSW : public ComicFlowWidget +{ + Q_OBJECT +private: + ComicFlow * flow; +public: + ComicFlowWidgetSW(QWidget * parent = 0); + + void setShowMarks(bool value); + void setMarks(QVector marks); + void setMarkImage(QImage & image); + void markSlide(int index); + void unmarkSlide(int index); + void setSlideSize(QSize size); + void clear(); + void setImagePaths(QStringList paths); + void setCenterIndex(int index); + void showSlide(int index); + int centerIndex(); + void updateMarks(); + void setFlowType(FlowType flowType); + void render(); + void updateConfig(QSettings * settings); +protected: + void keyPressEvent(QKeyEvent* event); + void paintEvent(QPaintEvent *event); + void mousePressEvent(QMouseEvent* event); + void resizeEvent(QResizeEvent* event); + void mouseDoubleClickEvent(QMouseEvent* event); + QSize minimumSizeHint() const; + QSize sizeHint() const; +}; + +class ComicFlowWidgetGL : public ComicFlowWidget +{ + Q_OBJECT +private: + YACReaderComicFlowGL * flow; +public: + ComicFlowWidgetGL(QWidget * parent = 0); + + void setShowMarks(bool value); + void setMarks(QVector marks); + void setMarkImage(QImage & image); + void markSlide(int index); + void unmarkSlide(int index); + void setSlideSize(QSize size); + void clear(); + void setImagePaths(QStringList paths); + void setCenterIndex(int index); + void showSlide(int index); + int centerIndex(); + void updateMarks(); + void setFlowType(FlowType flowType); + void render(); + void updateConfig(QSettings * settings); +//public slots: +// void setCF_RX(int value); +// //the Y Rotation of the Coverflow +// void setCF_RY(int value); +// //the Z Rotation of the Coverflow +// void setCF_RZ(int value); +// //perspective +// void setZoom(int zoom); +// void setRotation(int angle); +// //sets the distance between the covers +// void setX_Distance(int distance); +// //sets the distance between the centered and the non centered covers +// void setCenter_Distance(int distance); +// //sets the pushback amount +// void setZ_Distance(int distance); +// void setCF_Y(int value); +// void setY_Distance(int value); +// void setPreset(const Preset & p); +protected: + void keyPressEvent(QKeyEvent* event); + void paintEvent(QPaintEvent *event); + void mousePressEvent(QMouseEvent* event); + void resizeEvent(QResizeEvent* event); + void mouseDoubleClickEvent(QMouseEvent* event); + QSize minimumSizeHint() const; + QSize sizeHint() const; +}; + +#endif \ No newline at end of file diff --git a/YACReaderLibrary/library_window.cpp b/YACReaderLibrary/library_window.cpp index 152bfd0a..df0b8cd0 100644 --- a/YACReaderLibrary/library_window.cpp +++ b/YACReaderLibrary/library_window.cpp @@ -54,7 +54,7 @@ void LibraryWindow::doLayout() QSplitter * sHorizontal = new QSplitter(Qt::Horizontal); //spliter principal //TODO: flowType is a global variable //CONFIG COMIC_FLOW-------------------------------------------------------- - if(settings->contains("useOpenGL") && settings->value("useOpenGL").toBool() == true) + if(settings->contains(USE_OPEN_GL) && settings->value(USE_OPEN_GL).toBool() == true) comicFlow = new ComicFlowWidgetGL(0); else comicFlow = new ComicFlowWidgetSW(0); diff --git a/YACReaderLibrary/server/controllers/pagecontroller.cpp b/YACReaderLibrary/server/controllers/pagecontroller.cpp index 16a92d94..10aeeeab 100644 --- a/YACReaderLibrary/server/controllers/pagecontroller.cpp +++ b/YACReaderLibrary/server/controllers/pagecontroller.cpp @@ -29,7 +29,6 @@ void PageController::service(HttpRequest& request, HttpResponse& response) response.setHeader("Content-Type", "yacreader/page"); QByteArray pageData = comicFile->getRawPage(page); QDataStream data(pageData); - int i=0; char buffer[65536]; while (!data.atEnd()) { int len = data.readRawData(buffer,65536); diff --git a/common/custom_widgets.cpp b/common/custom_widgets.cpp index 38d4adc6..a5a51f09 100644 --- a/common/custom_widgets.cpp +++ b/common/custom_widgets.cpp @@ -125,6 +125,8 @@ QIcon YACReaderIconProvider::icon(const QFileInfo & info) const return QIcon(":/images/folder.png"); if(info.isFile()) return QIcon(":/images/icon.png"); + + return QFileIconProvider::icon(info); } QString YACReaderIconProvider::type(const QFileInfo & info) const { @@ -536,9 +538,9 @@ YACReaderOptionsDialog::YACReaderOptionsDialog(QWidget * parent) connect(useGL,SIGNAL(stateChanged(int)),this,SLOT(saveUseGL(int))); //sw CONNECTIONS - connect(sw->radio1,SIGNAL(toggled(bool)),this,SLOT(setClassicConfig())); - connect(sw->radio2,SIGNAL(toggled(bool)),this,SLOT(setStripeConfig())); - connect(sw->radio3,SIGNAL(toggled(bool)),this,SLOT(setOverlappedStripeConfig())); + connect(sw->radio1,SIGNAL(toggled(bool)),this,SLOT(setClassicConfigSW())); + connect(sw->radio2,SIGNAL(toggled(bool)),this,SLOT(setStripeConfigSW())); + connect(sw->radio3,SIGNAL(togg+led(bool)),this,SLOT(setOverlappedStripeConfigSW())); //gl CONNECTIONS connect(gl->radioClassic,SIGNAL(toggled(bool)),this,SLOT(setClassicConfig())); @@ -587,7 +589,7 @@ YACReaderOptionsDialog::YACReaderOptionsDialog(QWidget * parent) void YACReaderOptionsDialog::savePerformance(int value) { - settings->setValue("performance",value); + settings->setValue(PERFORMANCE,value); } void YACReaderOptionsDialog::saveOptions() @@ -610,65 +612,65 @@ void YACReaderOptionsDialog::saveUseGL(int b) } resize(0,0); - settings->setValue("useOpenGL",b); + settings->setValue(USE_OPEN_GL,b); } void YACReaderOptionsDialog::saveXRotation(int value) { - settings->setValue("flowType",Custom); - settings->setValue("xRotation",gl->xRotation->getValue()); + settings->setValue(FLOW_TYPE_GL,Custom); + settings->setValue(X_ROTATION,value); } void YACReaderOptionsDialog::saveYPosition(int value) { - settings->setValue("flowType",Custom); - settings->setValue("yPosition",gl->yPosition->getValue()); + settings->setValue(FLOW_TYPE_GL,Custom); + settings->setValue(Y_POSITION,value); } void YACReaderOptionsDialog::saveCoverDistance(int value) { - settings->setValue("flowType",Custom); - settings->setValue("coverDistance",gl->coverDistance->getValue()); + settings->setValue(FLOW_TYPE_GL,Custom); + settings->setValue(COVER_DISTANCE,value); } void YACReaderOptionsDialog::saveCentralDistance(int value) { - settings->setValue("flowType",Custom); - settings->setValue("centralDistance",gl->centralDistance->getValue()); + settings->setValue(FLOW_TYPE_GL,Custom); + settings->setValue(CENTRAL_DISTANCE,value); } void YACReaderOptionsDialog::saveZoomLevel(int value) { - settings->setValue("flowType",Custom); - settings->setValue("zoomLevel",gl->zoomLevel->getValue()); + settings->setValue(FLOW_TYPE_GL,Custom); + settings->setValue(ZOOM_LEVEL,value); } void YACReaderOptionsDialog::saveYCoverOffset(int value) { - settings->setValue("flowType",Custom); - settings->setValue("yCoverOffset",gl->yCoverOffset->getValue()); + settings->setValue(FLOW_TYPE_GL,Custom); + settings->setValue(Y_COVER_OFFSET,value); } void YACReaderOptionsDialog::saveZCoverOffset(int value) { - settings->setValue("flowType",Custom); - settings->setValue("zCoverOffset",gl->zCoverOffset->getValue()); + settings->setValue(FLOW_TYPE_GL,Custom); + settings->setValue(Z_COVER_OFFSET,value); } void YACReaderOptionsDialog::saveCoverRotation(int value) { - settings->setValue("flowType",Custom); - settings->setValue("coverRotation",gl->coverRotation->getValue()); + settings->setValue(FLOW_TYPE_GL,Custom); + settings->setValue(COVER_ROTATION,value); } void YACReaderOptionsDialog::saveFadeOutDist(int value) { - settings->setValue("flowType",Custom); - settings->setValue("fadeOutDist",gl->fadeOutDist->getValue()); + settings->setValue(FLOW_TYPE_GL,Custom); + settings->setValue(FADE_OUT_DIST,value); } void YACReaderOptionsDialog::saveLightStrength(int value) { - settings->setValue("flowType",Custom); - settings->setValue("lightStrength",gl->lightStrength->getValue()); + settings->setValue(FLOW_TYPE_GL,Custom); + settings->setValue(LIGHT_STRENGTH,value); } void YACReaderOptionsDialog::saveMaxAngle(int value) { - settings->setValue("flowType",Custom); - settings->setValue("maxAngle",gl->maxAngle->getValue()); + settings->setValue(FLOW_TYPE_GL,Custom); + settings->setValue(MAX_ANGLE,value); } void YACReaderOptionsDialog::restoreOptions(QSettings * settings) @@ -677,7 +679,7 @@ void YACReaderOptionsDialog::restoreOptions(QSettings * settings) //FLOW CONFIG - if(settings->contains("useOpenGL") && settings->value("useOpenGL").toInt() == Qt::Checked) + if(settings->contains(USE_OPEN_GL) && settings->value(USE_OPEN_GL).toInt() == Qt::Checked) { sw->setVisible(false); gl->setVisible(true); @@ -691,7 +693,7 @@ void YACReaderOptionsDialog::restoreOptions(QSettings * settings) } - if(!settings->contains("flowType")) + if(!settings->contains(FLOW_TYPE_GL)) { setClassicConfig(); gl->radioClassic->setChecked(true); @@ -699,9 +701,9 @@ void YACReaderOptionsDialog::restoreOptions(QSettings * settings) return; } - gl->performanceSlider->setValue(settings->value("performance").toInt()); + gl->performanceSlider->setValue(settings->value(PERFORMANCE).toInt()); FlowType flowType; - switch(settings->value("flowType").toInt()) + switch(settings->value(FLOW_TYPE_GL).toInt()) { case 0: flowType = CoverFlowLike; @@ -770,49 +772,65 @@ void YACReaderOptionsDialog::restoreOptions(QSettings * settings) void YACReaderOptionsDialog::loadConfig() { - gl->xRotation->setValue(settings->value("xRotation").toInt()); - gl->yPosition->setValue(settings->value("yPosition").toInt()); - gl->coverDistance->setValue(settings->value("coverDistance").toInt()); - gl->centralDistance->setValue(settings->value("centralDistance").toInt()); - gl->zoomLevel->setValue(settings->value("zoomLevel").toInt()); - gl->yCoverOffset->setValue(settings->value("yCoverOffset").toInt()); - gl->zCoverOffset->setValue(settings->value("zCoverOffset").toInt()); - gl->coverRotation->setValue(settings->value("coverRotation").toInt()); - gl->fadeOutDist->setValue(settings->value("fadeOutDist").toInt()); - gl->lightStrength->setValue(settings->value("lightStrength").toInt()); - gl->maxAngle->setValue(settings->value("maxAngle").toInt()); + gl->xRotation->setValue(settings->value(X_ROTATION).toInt()); + gl->yPosition->setValue(settings->value(Y_POSITION).toInt()); + gl->coverDistance->setValue(settings->value(COVER_DISTANCE).toInt()); + gl->centralDistance->setValue(settings->value(CENTRAL_DISTANCE).toInt()); + gl->zoomLevel->setValue(settings->value(ZOOM_LEVEL).toInt()); + gl->yCoverOffset->setValue(settings->value(Y_COVER_OFFSET).toInt()); + gl->zCoverOffset->setValue(settings->value(Z_COVER_OFFSET).toInt()); + gl->coverRotation->setValue(settings->value(COVER_ROTATION).toInt()); + gl->fadeOutDist->setValue(settings->value(FADE_OUT_DIST).toInt()); + gl->lightStrength->setValue(settings->value(LIGHT_STRENGTH).toInt()); + gl->maxAngle->setValue(settings->value(MAX_ANGLE).toInt()); } + +void YACReaderOptionsDialog::setClassicConfigSW() +{ + settings->setValue(FLOW_TYPE_SW,CoverFlowLike); +} + +void YACReaderOptionsDialog::setStripeConfigSW() +{ + settings->setValue(FLOW_TYPE_SW,Strip); +} + +void YACReaderOptionsDialog::setOverlappedStripeConfigSW() +{ + settings->setValue(FLOW_TYPE_SW,StripOverlapped); +} + void YACReaderOptionsDialog::setClassicConfig() { - settings->setValue("flowType",CoverFlowLike); + settings->setValue(FLOW_TYPE_GL,CoverFlowLike); gl->setValues(presetYACReaderFlowClassicConfig); } void YACReaderOptionsDialog::setStripeConfig() { - settings->setValue("flowType",Strip); + settings->setValue(FLOW_TYPE_GL,Strip); gl->setValues(presetYACReaderFlowStripeConfig); } void YACReaderOptionsDialog::setOverlappedStripeConfig() { - settings->setValue("flowType",StripOverlapped); + settings->setValue(FLOW_TYPE_GL,StripOverlapped); gl->setValues(presetYACReaderFlowOverlappedStripeConfig); } void YACReaderOptionsDialog::setModernConfig() { - settings->setValue("flowType",Modern); + settings->setValue(FLOW_TYPE_GL,Modern); gl->setValues(defaultYACReaderFlowConfig); } void YACReaderOptionsDialog::setRouletteConfig() { - settings->setValue("flowType",Roulette); + settings->setValue(FLOW_TYPE_GL,Roulette); gl->setValues(pressetYACReaderFlowDownConfig); } diff --git a/common/custom_widgets.h b/common/custom_widgets.h index 2c8e992c..ac5d95ad 100644 --- a/common/custom_widgets.h +++ b/common/custom_widgets.h @@ -293,6 +293,9 @@ protected slots: virtual void setOverlappedStripeConfig(); virtual void setModernConfig(); virtual void setRouletteConfig(); + virtual void setClassicConfigSW(); + virtual void setStripeConfigSW(); + virtual void setOverlappedStripeConfigSW(); signals: void optionsChanged(); diff --git a/common/pictureflow.cpp b/common/pictureflow.cpp index 8f74b337..5f308b84 100644 --- a/common/pictureflow.cpp +++ b/common/pictureflow.cpp @@ -367,7 +367,7 @@ void PictureFlowAnimator::start(int slide) { step = (target < state->centerSlide.slideIndex) ? -1 : 1; animateTimer.setSingleShot(true); - animateTimer.start(0); //TODO comprobar rendimiento, originalmente era 30 + animateTimer.start(30); //TODO comprobar rendimiento, originalmente era 30 animating = true; } } diff --git a/common/yacreader_flow_gl.cpp b/common/yacreader_flow_gl.cpp index f201d413..c34e5325 100644 --- a/common/yacreader_flow_gl.cpp +++ b/common/yacreader_flow_gl.cpp @@ -12,182 +12,182 @@ /*** Position Configuration ***/ struct Preset defaultYACReaderFlowConfig = { - 0.08, //Animation_step sets the speed of the animation - 1.5, //Animation_speedup sets the acceleration of the animation - 0.1, //Animation_step_max sets the maximum speed of the animation - 3, //Animation_Fade_out_dis sets the distance of view + 0.08f, //Animation_step sets the speed of the animation + 1.5f, //Animation_speedup sets the acceleration of the animation + 0.1f, //Animation_step_max sets the maximum speed of the animation + 3.f, //Animation_Fade_out_dis sets the distance of view - 1.5, //pre_rotation sets the rotation increasion - 3, //View_rotate_light_strenght sets the light strenght on rotation - 0.01, //View_rotate_add sets the speed of the rotation - 0.02, //View_rotate_sub sets the speed of reversing the rotation - 20, //View_angle sets the maximum view angle + 1.5f, //pre_rotation sets the rotation increasion + 3.f, //View_rotate_light_strenght sets the light strenght on rotation + 0.01f, //View_rotate_add sets the speed of the rotation + 0.02f, //View_rotate_sub sets the speed of reversing the rotation + 20.f, //View_angle sets the maximum view angle - 0, //CF_X the X Position of the Coverflow - 0, //CF_Y the Y Position of the Coverflow - -12, //CF_Z the Z Position of the Coverflow + 0.f, //CF_X the X Position of the Coverflow + 0.f, //CF_Y the Y Position of the Coverflow + -12.f, //CF_Z the Z Position of the Coverflow - 15, //CF_RX the X Rotation of the Coverflow - 0, //CF_RY the Y Rotation of the Coverflow - 0, //CF_RZ the Z Rotation of the Coverflow + 15.f, //CF_RX the X Rotation of the Coverflow + 0.f, //CF_RY the Y Rotation of the Coverflow + 0.f, //CF_RZ the Z Rotation of the Coverflow - -50, //Rotation sets the rotation of each cover - 0.18, //X_Distance sets the distance between the covers - 1, //Center_Distance sets the distance between the centered and the non centered covers - 0.1, //Z_Distance sets the pushback amount - 0.0, //Y_Distance sets the elevation amount + -50.f, //Rotation sets the rotation of each cover + 0.18f, //X_Distance sets the distance between the covers + 1.f, //Center_Distance sets the distance between the centered and the non centered covers + 0.1f, //Z_Distance sets the pushback amount + 0.0f, //Y_Distance sets the elevation amount - 30 //zoom level + 30.f //zoom level }; struct Preset presetYACReaderFlowClassicConfig = { - 0.08, //Animation_step sets the speed of the animation - 1.5, //Animation_speedup sets the acceleration of the animation - 0.1, //Animation_step_max sets the maximum speed of the animation - 2, //Animation_Fade_out_dis sets the distance of view + 0.08f, //Animation_step sets the speed of the animation + 1.5f, //Animation_speedup sets the acceleration of the animation + 0.1f, //Animation_step_max sets the maximum speed of the animation + 2.f, //Animation_Fade_out_dis sets the distance of view - 1.5, //pre_rotation sets the rotation increasion - 3, //View_rotate_light_strenght sets the light strenght on rotation - 0.08, //View_rotate_add sets the speed of the rotation - 0.08, //View_rotate_sub sets the speed of reversing the rotation - 30, //View_angle sets the maximum view angle + 1.5f, //pre_rotation sets the rotation increasion + 3.f, //View_rotate_light_strenght sets the light strenght on rotation + 0.08f, //View_rotate_add sets the speed of the rotation + 0.08f, //View_rotate_sub sets the speed of reversing the rotation + 30.f, //View_angle sets the maximum view angle - 0, //CF_X the X Position of the Coverflow - -0.2, //CF_Y the Y Position of the Coverflow - -7, //CF_Z the Z Position of the Coverflow + 0.f, //CF_X the X Position of the Coverflow + -0.2f, //CF_Y the Y Position of the Coverflow + -7.f, //CF_Z the Z Position of the Coverflow - 0, //CF_RX the X Rotation of the Coverflow - 0, //CF_RY the Y Rotation of the Coverflow - 0, //CF_RZ the Z Rotation of the Coverflow + 0.f, //CF_RX the X Rotation of the Coverflow + 0.f, //CF_RY the Y Rotation of the Coverflow + 0.f, //CF_RZ the Z Rotation of the Coverflow - -40, //Rotation sets the rotation of each cover - 0.18, //X_Distance sets the distance between the covers - 1, //Center_Distance sets the distance between the centered and the non centered covers - 0.1, //Z_Distance sets the pushback amount - 0.0, //Y_Distance sets the elevation amount + -40.f, //Rotation sets the rotation of each cover + 0.18f, //X_Distance sets the distance between the covers + 1.f, //Center_Distance sets the distance between the centered and the non centered covers + 0.1f, //Z_Distance sets the pushback amount + 0.0f, //Y_Distance sets the elevation amount - 22 //zoom level + 22.f //zoom level }; struct Preset presetYACReaderFlowStripeConfig = { - 0.08, //Animation_step sets the speed of the animation - 1.5, //Animation_speedup sets the acceleration of the animation - 0.1, //Animation_step_max sets the maximum speed of the animation - 6, //Animation_Fade_out_dis sets the distance of view + 0.08f, //Animation_step sets the speed of the animation + 1.5f, //Animation_speedup sets the acceleration of the animation + 0.1f, //Animation_step_max sets the maximum speed of the animation + 6.f, //Animation_Fade_out_dis sets the distance of view - 1.5, //pre_rotation sets the rotation increasion - 4, //View_rotate_light_strenght sets the light strenght on rotation - 0.08, //View_rotate_add sets the speed of the rotation - 0.08, //View_rotate_sub sets the speed of reversing the rotation - 30, //View_angle sets the maximum view angle + 1.5f, //pre_rotation sets the rotation increasion + 4.f, //View_rotate_light_strenght sets the light strenght on rotation + 0.08f, //View_rotate_add sets the speed of the rotation + 0.08f, //View_rotate_sub sets the speed of reversing the rotation + 30.f, //View_angle sets the maximum view angle - 0, //CF_X the X Position of the Coverflow - -0.2, //CF_Y the Y Position of the Coverflow - -7, //CF_Z the Z Position of the Coverflow + 0.f, //CF_X the X Position of the Coverflow + -0.2f, //CF_Y the Y Position of the Coverflow + -7.f, //CF_Z the Z Position of the Coverflow - 0, //CF_RX the X Rotation of the Coverflow - 0, //CF_RY the Y Rotation of the Coverflow - 0, //CF_RZ the Z Rotation of the Coverflow + 0.f, //CF_RX the X Rotation of the Coverflow + 0.f, //CF_RY the Y Rotation of the Coverflow + 0.f, //CF_RZ the Z Rotation of the Coverflow - 0, //Rotation sets the rotation of each cover - 1.1, //X_Distance sets the distance between the covers - 0.2, //Center_Distance sets the distance between the centered and the non centered covers - 0.01, //Z_Distance sets the pushback amount - 0.0, //Y_Distance sets the elevation amount + 0.f, //Rotation sets the rotation of each cover + 1.1f, //X_Distance sets the distance between the covers + 0.2f, //Center_Distance sets the distance between the centered and the non centered covers + 0.01f, //Z_Distance sets the pushback amount + 0.0f, //Y_Distance sets the elevation amount - 22 //zoom level + 22.f //zoom level }; struct Preset presetYACReaderFlowOverlappedStripeConfig = { - 0.08, //Animation_step sets the speed of the animation - 1.5, //Animation_speedup sets the acceleration of the animation - 0.1, //Animation_step_max sets the maximum speed of the animation - 2, //Animation_Fade_out_dis sets the distance of view + 0.08f, //Animation_step sets the speed of the animation + 1.5f, //Animation_speedup sets the acceleration of the animation + 0.1f, //Animation_step_max sets the maximum speed of the animation + 2.f, //Animation_Fade_out_dis sets the distance of view - 1.5, //pre_rotation sets the rotation increasion - 3, //View_rotate_light_strenght sets the light strenght on rotation - 0.08, //View_rotate_add sets the speed of the rotation - 0.08, //View_rotate_sub sets the speed of reversing the rotation - 30, //View_angle sets the maximum view angle + 1.5f, //pre_rotation sets the rotation increasion + 3.f, //View_rotate_light_strenght sets the light strenght on rotation + 0.08f, //View_rotate_add sets the speed of the rotation + 0.08f, //View_rotate_sub sets the speed of reversing the rotation + 30.f, //View_angle sets the maximum view angle - 0, //CF_X the X Position of the Coverflow - -0.2, //CF_Y the Y Position of the Coverflow - -7, //CF_Z the Z Position of the Coverflow + 0.f, //CF_X the X Position of the Coverflow + -0.2f, //CF_Y the Y Position of the Coverflow + -7.f, //CF_Z the Z Position of the Coverflow - 0, //CF_RX the X Rotation of the Coverflow - 0, //CF_RY the Y Rotation of the Coverflow - 0, //CF_RZ the Z Rotation of the Coverflow + 0.f, //CF_RX the X Rotation of the Coverflow + 0.f, //CF_RY the Y Rotation of the Coverflow + 0.f, //CF_RZ the Z Rotation of the Coverflow - 0, //Rotation sets the rotation of each cover - 0.18, //X_Distance sets the distance between the covers - 1, //Center_Distance sets the distance between the centered and the non centered covers - 0.1, //Z_Distance sets the pushback amount - 0.0, //Y_Distance sets the elevation amount + 0.f, //Rotation sets the rotation of each cover + 0.18f, //X_Distance sets the distance between the covers + 1.f, //Center_Distance sets the distance between the centered and the non centered covers + 0.1f, //Z_Distance sets the pushback amount + 0.0f, //Y_Distance sets the elevation amount - 22 //zoom level + 22.f //zoom level }; struct Preset pressetYACReaderFlowUpConfig = { - 0.08, //Animation_step sets the speed of the animation - 1.5, //Animation_speedup sets the acceleration of the animation - 0.1, //Animation_step_max sets the maximum speed of the animation - 2.5, //Animation_Fade_out_dis sets the distance of view + 0.08f, //Animation_step sets the speed of the animation + 1.5f, //Animation_speedup sets the acceleration of the animation + 0.1f, //Animation_step_max sets the maximum speed of the animation + 2.5f, //Animation_Fade_out_dis sets the distance of view - 1.5, //pre_rotation sets the rotation increasion - 3, //View_rotate_light_strenght sets the light strenght on rotation - 0.08, //View_rotate_add sets the speed of the rotation - 0.08, //View_rotate_sub sets the speed of reversing the rotation - 5, //View_angle sets the maximum view angle + 1.5f, //pre_rotation sets the rotation increasion + 3.f, //View_rotate_light_strenght sets the light strenght on rotation + 0.08f, //View_rotate_add sets the speed of the rotation + 0.08f, //View_rotate_sub sets the speed of reversing the rotation + 5.f, //View_angle sets the maximum view angle - 0, //CF_X the X Position of the Coverflow - -0.2, //CF_Y the Y Position of the Coverflow - -7, //CF_Z the Z Position of the Coverflow + 0.f, //CF_X the X Position of the Coverflow + -0.2f, //CF_Y the Y Position of the Coverflow + -7.f, //CF_Z the Z Position of the Coverflow - 0, //CF_RX the X Rotation of the Coverflow - 0, //CF_RY the Y Rotation of the Coverflow - 0, //CF_RZ the Z Rotation of the Coverflow + 0.f, //CF_RX the X Rotation of the Coverflow + 0.f, //CF_RY the Y Rotation of the Coverflow + 0.f, //CF_RZ the Z Rotation of the Coverflow - -50, //Rotation sets the rotation of each cover - 0.18, //X_Distance sets the distance between the covers - 1, //Center_Distance sets the distance between the centered and the non centered covers - 0.1, //Z_Distance sets the pushback amount - -0.1, //Y_Distance sets the elevation amount + -50.f, //Rotation sets the rotation of each cover + 0.18f, //X_Distance sets the distance between the covers + 1.f, //Center_Distance sets the distance between the centered and the non centered covers + 0.1f, //Z_Distance sets the pushback amount + -0.1f, //Y_Distance sets the elevation amount - 22 //zoom level + 22.f //zoom level }; struct Preset pressetYACReaderFlowDownConfig = { - 0.08, //Animation_step sets the speed of the animation - 1.5, //Animation_speedup sets the acceleration of the animation - 0.1, //Animation_step_max sets the maximum speed of the animation - 2.5, //Animation_Fade_out_dis sets the distance of view + 0.08f, //Animation_step sets the speed of the animation + 1.5f, //Animation_speedup sets the acceleration of the animation + 0.1f, //Animation_step_max sets the maximum speed of the animation + 2.5f, //Animation_Fade_out_dis sets the distance of view - 1.5, //pre_rotation sets the rotation increasion - 3, //View_rotate_light_strenght sets the light strenght on rotation - 0.08, //View_rotate_add sets the speed of the rotation - 0.08, //View_rotate_sub sets the speed of reversing the rotation - 5, //View_angle sets the maximum view angle + 1.5f, //pre_rotation sets the rotation increasion + 3.f, //View_rotate_light_strenght sets the light strenght on rotation + 0.08f, //View_rotate_add sets the speed of the rotation + 0.08f, //View_rotate_sub sets the speed of reversing the rotation + 5.f, //View_angle sets the maximum view angle - 0, //CF_X the X Position of the Coverflow - -0.2, //CF_Y the Y Position of the Coverflow - -7, //CF_Z the Z Position of the Coverflow + 0.f, //CF_X the X Position of the Coverflow + -0.2f, //CF_Y the Y Position of the Coverflow + -7.f, //CF_Z the Z Position of the Coverflow - 0, //CF_RX the X Rotation of the Coverflow - 0, //CF_RY the Y Rotation of the Coverflow - 0, //CF_RZ the Z Rotation of the Coverflow + 0.f, //CF_RX the X Rotation of the Coverflow + 0.f, //CF_RY the Y Rotation of the Coverflow + 0.f, //CF_RZ the Z Rotation of the Coverflow - -50, //Rotation sets the rotation of each cover - 0.18, //X_Distance sets the distance between the covers - 1, //Center_Distance sets the distance between the centered and the non centered covers - 0.1, //Z_Distance sets the pushback amount - 0.1, //Y_Distance sets the elevation amount + -50.f, //Rotation sets the rotation of each cover + 0.18f, //X_Distance sets the distance between the covers + 1.f, //Center_Distance sets the distance between the centered and the non centered covers + 0.1f, //Z_Distance sets the pushback amount + 0.1f, //Y_Distance sets the elevation amount - 22 //zoom level + 22.f //zoom level }; /*Constructor*/ YACReaderFlowGL::YACReaderFlowGL(QWidget *parent,struct Preset p) @@ -198,21 +198,21 @@ YACReaderFlowGL::YACReaderFlowGL(QWidget *parent,struct Preset p) currentSelected = 0; - centerPos.x = 0; - centerPos.y = 0; - centerPos.z = 1; - centerPos.rot = 0; + centerPos.x = 0.f; + centerPos.y = 0.f; + centerPos.z = 1.f; + centerPos.rot = 0.f; /*** Style ***/ - shadingTop = 0.8; - shadingBottom = 0.02; - reflectionUp = 0; - reflectionBottom = 0.6; + shadingTop = 0.8f; + shadingBottom = 0.02f; + reflectionUp = 0.f; + reflectionBottom = 0.6f; /*** System variables ***/ numObjects = 0; - CFImage Dummy; - viewRotate = 0; + //CFImage Dummy; + viewRotate = 0.f; viewRotateActive = 0; stepBackup = config.animationStep/config.animationSpeedUp; @@ -301,8 +301,8 @@ void YACReaderFlowGL::resizeGL(int width, int height) #ifdef QT_OPENGL_ES_1 //glOrthof(-0.5, +0.5, -0.5, +0.5, 4.0, 15.0); #else - float sideX = ((float(width)/height)/2)*1.5; - float sideY = 0.5*1.5; + //float sideX = ((float(width)/height)/2)*1.5; + //float sideY = 0.5*1.5; gluPerspective(20.0, (float)width / (float)height, 1.0, 200.0); //glOrtho(-sideX, sideX, -sideY+0.2, +sideY+0.2, 4, 11.0); @@ -395,22 +395,22 @@ void YACReaderFlowGL::drawCover(CFImage *CF) //esquina inferior izquierda glColor4f(LDOWN*opacity,LDOWN*opacity,LDOWN*opacity,1); glTexCoord2f(0.0f, 1.0f); - glVertex3f(w/2*-1, -0.5, 0); + glVertex3f(w/2.f*-1.f, -0.5f, 0.f); //esquina inferior derecha glColor4f(RDOWN*opacity,RDOWN*opacity,RDOWN*opacity,1); glTexCoord2f(1.0f, 1.0f); - glVertex3f(w/2, -0.5, 0); + glVertex3f(w/2.f, -0.5f, 0.f); //esquina superior derecha glColor4f(RUP*opacity,RUP*opacity,RUP*opacity,1); glTexCoord2f(1.0f, 0.0f); - glVertex3f(w/2, -0.5+h, 0); + glVertex3f(w/2.f, -0.5f+h, 0.f); //esquina superior izquierda glColor4f(LUP*opacity,LUP*opacity,LUP*opacity,1); glTexCoord2f(0.0f, 0.0f); - glVertex3f(w/2*-1, -0.5+h, 0); + glVertex3f(w/2.f*-1.f, -0.5f+h, 0.f); glEnd(); @@ -422,20 +422,20 @@ void YACReaderFlowGL::drawCover(CFImage *CF) //esquina inferior izquierda glColor4f(LUP*opacity*reflectionUp,LUP*opacity*reflectionUp,LUP*opacity*reflectionUp,opacity*reflectionUp); glTexCoord2f(0.0f, 0.0f); - glVertex3f(w/2*-1, -0.5-h, 0); + glVertex3f(w/2.f*-1.f, -0.5f-h, 0.f); //esquina inferior derecha glTexCoord2f(1.0f, 0.0f); - glVertex3f(w/2, -0.5-h, 0); + glVertex3f(w/2.f, -0.5f-h, 0.f); //esquina superior derecha glColor4f(opacity*reflectionBottom,opacity*reflectionBottom,opacity*reflectionBottom,opacity*reflectionBottom); glTexCoord2f(1.0f, 1.0f); - glVertex3f(w/2, -0.5, 0); + glVertex3f(w/2.f, -0.5f, 0.f); //esquina superior izquierda glTexCoord2f(0.0f, 1.0f); - glVertex3f(w/2*-1, -0.5, 0); + glVertex3f(w/2.f*-1.f, -0.5f, 0.f); glEnd(); glDisable(GL_TEXTURE_2D); @@ -449,22 +449,22 @@ void YACReaderFlowGL::drawCover(CFImage *CF) //esquina inferior izquierda glColor4f(LDOWN*opacity,LDOWN*opacity,LDOWN*opacity,1); glTexCoord2f(0.0f, 1.0f); - glVertex3f(w/2-0.2, -0.5, 0.0001); + glVertex3f(w/2.f-0.2f, -0.5f, 0.0001f); //esquina inferior derecha glColor4f(RDOWN*opacity,RDOWN*opacity,RDOWN*opacity,1); glTexCoord2f(1.0f, 1.0f); - glVertex3f(w/2, -0.5, 0.0001); + glVertex3f(w/2.f, -0.5f, 0.0001f); //esquina superior derecha glColor4f(RUP*opacity,RUP*opacity,RUP*opacity,1); glTexCoord2f(1.0f, 0.0f); - glVertex3f(w/2, -0.3, 0.0001); + glVertex3f(w/2.f, -0.3f, 0.0001f); //esquina superior izquierda glColor4f(LUP*opacity,LUP*opacity,LUP*opacity,1); glTexCoord2f(0.0f, 0.0f); - glVertex3f(w/2-0.2, -0.3, 0.0001); + glVertex3f(w/2.f-0.2f, -0.3f, 0.0001f); glEnd(); glDisable(GL_TEXTURE_2D); @@ -515,10 +515,10 @@ void YACReaderFlowGL::draw() glBegin( GL_TRIANGLES ); - glColor4f( 1.0, 1.0, 1.0, 1.0 ); - glVertex2f( -0.03, 0.98); - glVertex2f( 0.03, 0.98); - glVertex2f( 0, 0.949); + glColor4f( 1.0f, 1.0f, 1.0f, 1.0f ); + glVertex2f( -0.03f, 0.98f); + glVertex2f( 0.03f, 0.98f); + glVertex2f( 0.f, 0.949f); glEnd(); @@ -605,6 +605,7 @@ void YACReaderFlowGL::updatePositions() if(abs (cfImages[currentSelected].current.x - cfImages[currentSelected].animEnd.x) < 1)//viewRotate < 0.2) { + cleanupAnimation(); if(updateCount >= 0) //TODO parametrizar { @@ -682,7 +683,7 @@ void YACReaderFlowGL::populate(int n) { emit centerIndexChanged(0); float x = 1; - float y = 1 * (700/480.0); + float y = 1 * (700.f/480.0f); int i; for(i = 0;iaccept(); } YACReaderComicFlowGL::YACReaderComicFlowGL(QWidget *parent,struct Preset p ) @@ -1173,12 +1175,6 @@ QImage ImageLoaderGL::loadImage(const QString& fileName) QImage image; bool result = image.load(fileName); - //QGLPixelBuffer * pb = new QGLPixelBuffer(image.size(),flow->format(),flow); - //resultTexture = pb->bindTexture(image,GL_TEXTURE_2D); - - //resultTexture = flow->bindTexture(image,GL_TEXTURE_2D); - - //TODO parametrizar switch(flow->performance) { case low: @@ -1277,14 +1273,21 @@ QImage ImageLoaderByteArrayGL::loadImage(const QByteArray& raw) QImage image; bool result = image.loadFromData(raw); - //QGLPixelBuffer * pb = new QGLPixelBuffer(image.size(),flow->format(),flow); - //resultTexture = pb->bindTexture(image,GL_TEXTURE_2D); - - //resultTexture = flow->bindTexture(image,GL_TEXTURE_2D); - - //TODO parametrizar - image = image.scaledToWidth(128,Qt::SmoothTransformation); - + switch(flow->performance) + { + case low: + image = image.scaledToWidth(128,Qt::SmoothTransformation); + break; + case medium: + image = image.scaledToWidth(196,Qt::SmoothTransformation); + break; + case high: + image = image.scaledToWidth(256,Qt::SmoothTransformation); + break; + case ultraHigh: + image = image.scaledToWidth(320,Qt::SmoothTransformation); + break; + } if(!result) return QImage(); diff --git a/common/yacreader_flow_gl.h b/common/yacreader_flow_gl.h index d7549e81..5b2c47ce 100644 --- a/common/yacreader_flow_gl.h +++ b/common/yacreader_flow_gl.h @@ -18,7 +18,7 @@ class QGLContext; class WidgetLoader; class ImageLoaderByteArrayGL; -typedef enum Performance +enum Performance { low=0, medium, @@ -27,7 +27,7 @@ typedef enum Performance }; //Cover Vector -typedef struct RVect{ +struct RVect{ float x; float y; float z; @@ -35,7 +35,7 @@ typedef struct RVect{ }; //the cover info struct -typedef struct CFImage{ +struct CFImage{ GLuint img; char name[256]; diff --git a/common/yacreader_global.h b/common/yacreader_global.h new file mode 100644 index 00000000..a5ceec8a --- /dev/null +++ b/common/yacreader_global.h @@ -0,0 +1,50 @@ +#ifndef __YACREADER_GLOBAL_H +#define __YACREADER_GLOBAL_H + +#define VERSION "5.0.0" + +#define PATH "PATH" +#define MAG_GLASS_SIZE "MAG_GLASS_SIZE" +#define ZOOM_LEVEL "ZOOM_LEVEL" +#define SLIDE_SIZE "SLIDE_SIZE" +#define GO_TO_FLOW_SIZE "GO_TO_FLOW_SIZE" +#define FLOW_TYPE_SW "FLOW_TYPE_SW" +#define FIT "FIT" +#define FLOW_TYPE "FLOW_TYPE" +#define FULLSCREEN "FULLSCREEN" +#define FIT_TO_WIDTH_RATIO "FIT_TO_WIDTH_RATIO" +#define Y_WINDOW_POS "POS" +#define Y_WINDOW_SIZE "SIZE" +#define MAXIMIZED "MAXIMIZED" +#define DOUBLE_PAGE "DOUBLE_PAGE" +#define ADJUST_TO_FULL_SIZE "ADJUST_TO_FULL_SIZE" +#define BACKGROUND_COLOR "BACKGROUND_COLOR" +#define ALWAYS_ON_TOP "ALWAYS_ON_TOP" + +#define FLOW_TYPE_GL "FLOW_TYPE_GL" +#define Y_POSITION "Y_POSITION" +#define COVER_DISTANCE "COVER_DISTANCE" +#define CENTRAL_DISTANCE "CENTRAL_DISTANCE" +#define ZOOM_LEVEL "ZOOM_LEVEL" +#define Z_COVER_OFFSET "Z_COVER_OFFSET" +#define COVER_ROTATION "COVER_ROTATION" +#define FADE_OUT_DIST "FADE_OUT_DIST" +#define LIGHT_STRENGTH "LIGHT_STRENGTH" +#define MAX_ANGLE "MAX_ANGLE" +#define PERFORMANCE "PERFORMANCE" +#define USE_OPEN_GL "USE_OPEN_GL" +#define X_ROTATION "X_ROTATION" +#define Y_COVER_OFFSET "Y_COVER_OFFSET" + + enum FlowType + { + CoverFlowLike=0, + Strip, + StripOverlapped, + Modern, + Roulette, + Custom + }; + +#endif +