mirror of
https://github.com/YACReader/yacreader
synced 2025-07-19 05:24:57 -04:00
opciones y configuraci?n integrados completamente con QSettings
goToFlow ya es sensible al nivel de rendimiento a?adidos al repositorio ficheros que faltaban corregidos varios warnings en la compilaci?n
This commit is contained in:
@ -7,28 +7,10 @@
|
||||
#include <QStringList>
|
||||
#include <QMessageBox>
|
||||
|
||||
|
||||
|
||||
#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";
|
||||
|
@ -5,6 +5,8 @@
|
||||
#include <QObject>
|
||||
#include <QPoint>
|
||||
#include <QColor>
|
||||
#include <QSettings>
|
||||
|
||||
#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<QColor>();};
|
||||
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();
|
||||
|
||||
};
|
||||
|
@ -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()
|
||||
|
229
YACReader/goto_flow_gl.cpp
Normal file
229
YACReader/goto_flow_gl.cpp
Normal file
@ -0,0 +1,229 @@
|
||||
#include "goto_flow_gl.h"
|
||||
|
||||
#include <QLineEdit>
|
||||
#include <QIntValidator>
|
||||
#include <QPushButton>
|
||||
#include <QPushButton>
|
||||
#include <QSize>
|
||||
|
||||
#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<int>(5*imageSize.width()),static_cast<int>(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<QKeyEvent *>(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())*/;
|
||||
|
||||
}
|
46
YACReader/goto_flow_gl.h
Normal file
46
YACReader/goto_flow_gl.h
Normal file
@ -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
|
9
YACReader/goto_flow_widget.cpp
Normal file
9
YACReader/goto_flow_widget.cpp
Normal file
@ -0,0 +1,9 @@
|
||||
#include "goto_flow_widget.h"
|
||||
|
||||
GoToFlowWidget::GoToFlowWidget(QWidget * parent)
|
||||
:QWidget(parent)
|
||||
{
|
||||
QPalette palette;
|
||||
palette.setColor(backgroundRole(), Qt::black);
|
||||
setPalette(palette);
|
||||
}
|
27
YACReader/goto_flow_widget.h
Normal file
27
YACReader/goto_flow_widget.h
Normal file
@ -0,0 +1,27 @@
|
||||
#ifndef __GOTO_FLOW_WIDGET_H
|
||||
#define __GOTO_FLOW_WIDGET_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <QSettings>
|
||||
#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
|
@ -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();
|
||||
}
|
||||
|
@ -96,29 +96,30 @@ void OptionsDialog::findFolder()
|
||||
|
||||
void OptionsDialog::saveOptions()
|
||||
{
|
||||
settings->setValue("goToFlowSize",QSize(static_cast<int>(slideSize->sliderPosition()*SLIDE_ASPECT_RATIO),slideSize->sliderPosition()));
|
||||
|
||||
settings->setValue(GO_TO_FLOW_SIZE,QSize(static_cast<int>(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<QColor>());
|
||||
fitToWidthRatioS->setSliderPosition(settings->value("adjustToWidthRatio").toFloat()*100);
|
||||
updateColor(settings->value(BACKGROUND_COLOR).value<QColor>());
|
||||
fitToWidthRatioS->setSliderPosition(settings->value(FIT_TO_WIDTH_RATIO).toFloat()*100);
|
||||
}
|
||||
|
||||
|
||||
|
@ -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());
|
||||
|
Reference in New Issue
Block a user