corregido problema de lag con "check new version"

corregido bug que causaba que las marcas de leidos no se viesen bajo determinadas
circustancias

sincronizadas los sliders de ajustar a lo ancho

corregido bug que causaba que los mensajes isCover e isLast no se mostrasen en
modo de doble p?gina
This commit is contained in:
Luis Ángel San Martín 2013-03-08 17:50:52 +01:00
parent ccf9ffa4bc
commit a664eaf90e
10 changed files with 43 additions and 10 deletions

View File

@ -16,6 +16,7 @@ GoToFlowGL::GoToFlowGL(QWidget* parent, FlowType flowType)
{ {
flow = new YACReaderPageFlowGL(this); flow = new YACReaderPageFlowGL(this);
flow->setShowMarks(false);
imageSize = Configuration::getConfiguration().getGotoSlideSize(); imageSize = Configuration::getConfiguration().getGotoSlideSize();

View File

@ -94,7 +94,7 @@ void MainWindowViewer::setupUI()
connect(versionChecker,SIGNAL(newVersionDetected()), connect(versionChecker,SIGNAL(newVersionDetected()),
this,SLOT(newVersion())); this,SLOT(newVersion()));
//versionChecker->get(); //TODO versionChecker->get(); //TODO
viewer->setFocusPolicy(Qt::StrongFocus); viewer->setFocusPolicy(Qt::StrongFocus);
@ -332,6 +332,8 @@ void MainWindowViewer::createToolBars()
tb2->setMenu(menu); tb2->setMenu(menu);
connect(sliderAction,SIGNAL(fitToWidthRatioChanged(float)),viewer,SLOT(updateFitToWidthRatio(float))); connect(sliderAction,SIGNAL(fitToWidthRatioChanged(float)),viewer,SLOT(updateFitToWidthRatio(float)));
connect(optionsDialog,SIGNAL(fitToWidthRatioChanged(float)),sliderAction,SLOT(updateFitToWidthRatio(float)));
//tb2->addAction(); //tb2->addAction();
tb2->setPopupMode(QToolButton::MenuButtonPopup); tb2->setPopupMode(QToolButton::MenuButtonPopup);

View File

@ -263,4 +263,13 @@ void OptionsDialog::resetImageConfig()
settings.setValue(CONTRAST,100); settings.setValue(CONTRAST,100);
settings.setValue(GAMMA,100); settings.setValue(GAMMA,100);
emit(changedImageOptions()); emit(changedImageOptions());
}
void OptionsDialog::show()
{
//TODO solucionar el tema de las settings, esto sólo debería aparecer en una única línea de código
QSettings *s = new QSettings(QCoreApplication::applicationDirPath()+"/YACReader.ini",QSettings::IniFormat);
fitToWidthRatioS->setSliderPosition(settings->value(FIT_TO_WIDTH_RATIO).toFloat()*100);
QDialog::show();
delete s;
} }

View File

@ -53,6 +53,7 @@ Q_OBJECT
void contrastChanged(int value); void contrastChanged(int value);
void gammaChanged(int value); void gammaChanged(int value);
void resetImageConfig(); void resetImageConfig();
void show();
signals: signals:
void changedOptions(); void changedOptions();

View File

@ -635,6 +635,8 @@ void Render::nextPage()
currentIndex = nextPage; currentIndex = nextPage;
update(); update();
} }
else
emit isLast();
} }
//si se solicita la página anterior, se calcula cuál debe ser en función de si se lee en modo a doble página o no. //si se solicita la página anterior, se calcula cuál debe ser en función de si se lee en modo a doble página o no.
//la página sólo se renderiza, si realmente ha cambiado. //la página sólo se renderiza, si realmente ha cambiado.
@ -663,6 +665,8 @@ void Render::previousPage()
currentIndex = previousPage; currentIndex = previousPage;
update(); update();
} }
else
emit isCover();
} }
unsigned int Render::getIndex() unsigned int Render::getIndex()
{ {
@ -742,8 +746,7 @@ void Render::goTo(int index)
void Render::rotateRight() void Render::rotateRight()
{ {
imageRotation = (imageRotation+90) % 360; imageRotation = (imageRotation+90) % 360;
invalidate(); reload();
update();
} }
void Render::rotateLeft() void Render::rotateLeft()
{ {
@ -751,8 +754,7 @@ void Render::rotateLeft()
imageRotation = 270; imageRotation = 270;
else else
imageRotation = imageRotation - 90; imageRotation = imageRotation - 90;
invalidate(); reload();
update();
} }
//Actualiza el buffer, añadiendo las imágenes (vacías) necesarias para su posterior renderizado y //Actualiza el buffer, añadiendo las imágenes (vacías) necesarias para su posterior renderizado y
@ -890,7 +892,7 @@ void Render::invalidate()
{ {
if(pageRenders[i]!=0) if(pageRenders[i]!=0)
{ {
pageRenders[i]->terminate(); pageRenders[i]->wait();
delete pageRenders[i]; delete pageRenders[i];
pageRenders[i] = 0; pageRenders[i] = 0;
} }

View File

@ -68,4 +68,11 @@ void YACReaderSliderAction::updateText(int value)
percentageLabel->setText(QString("%1 %").arg(value)); percentageLabel->setText(QString("%1 %").arg(value));
Configuration::getConfiguration().setFitToWidthRatio(value/100.0); Configuration::getConfiguration().setFitToWidthRatio(value/100.0);
emit(fitToWidthRatioChanged(value / 100.0f)); emit(fitToWidthRatioChanged(value / 100.0f));
}
void YACReaderSliderAction::updateFitToWidthRatio(float v)
{
int value = v*100;
slider->setValue(value);
percentageLabel->setText(QString("%1 %").arg(value));
} }

View File

@ -12,12 +12,14 @@ class YACReaderSliderAction : public QWidgetAction
private: private:
QLabel * percentageLabel; QLabel * percentageLabel;
QSlider * slider; QSlider * slider;
public: public:
YACReaderSliderAction (QWidget * parent = 0); YACReaderSliderAction (QWidget * parent = 0);
public slots: public slots:
void updateText(int value); void updateText(int value);
void updateFitToWidthRatio(float v);
signals: signals:

View File

@ -7,7 +7,7 @@
#define PREVIOUS_VERSION "5.0.0" #define PREVIOUS_VERSION "5.0.0"
HttpVersionChecker::HttpVersionChecker() HttpVersionChecker::HttpVersionChecker()
:QWidget() :QThread()
{ {
http = new QHttp(this); http = new QHttp(this);
@ -22,6 +22,12 @@ HttpVersionChecker::HttpVersionChecker()
} }
void HttpVersionChecker::get() void HttpVersionChecker::get()
{
this->start();
}
void HttpVersionChecker::run()
{ {
QUrl url("http://code.google.com/p/yacreader/downloads/list"); QUrl url("http://code.google.com/p/yacreader/downloads/list");
QHttp::ConnectionMode mode = QHttp::ConnectionModeHttp; QHttp::ConnectionMode mode = QHttp::ConnectionModeHttp;
@ -30,6 +36,7 @@ void HttpVersionChecker::get()
if (path.isEmpty()) if (path.isEmpty())
path = "/"; path = "/";
httpGetId = http->get(path, 0); httpGetId = http->get(path, 0);
exec();
} }
void HttpVersionChecker::readResponseHeader(const QHttpResponseHeader &responseHeader) void HttpVersionChecker::readResponseHeader(const QHttpResponseHeader &responseHeader)
{ {
@ -48,6 +55,7 @@ void HttpVersionChecker::httpRequestFinished(int requestId, bool error)
QString response(content); QString response(content);
#endif #endif
checkNewVersion(response); checkNewVersion(response);
exit();
} }
//TODO escribir prueba unitaria //TODO escribir prueba unitaria

View File

@ -5,10 +5,10 @@
#include <QHttp> #include <QHttp>
#include <QHttpResponseHeader> #include <QHttpResponseHeader>
#include <QByteArray> #include <QByteArray>
#include <QThread>
#include "yacreader_global.h" #include "yacreader_global.h"
class HttpVersionChecker : public QWidget class HttpVersionChecker : public QThread
{ {
Q_OBJECT Q_OBJECT
public: public:
@ -20,6 +20,7 @@
void read(const QHttpResponseHeader &); void read(const QHttpResponseHeader &);
void get(); void get();
private: private:
void run();
QHttp *http; QHttp *http;
int httpGetId; int httpGetId;
QByteArray content; QByteArray content;

View File

@ -711,7 +711,7 @@ void YACReaderFlowGL::populate(int n)
}*/ }*/
loaded = QVector<bool>(n,false); loaded = QVector<bool>(n,false);
marks = QVector<bool>(n,false); //marks = QVector<bool>(n,false);