mirror of
https://github.com/YACReader/yacreader
synced 2025-06-03 17:18:23 -04:00
A?adida las opciones de control de imagen al di?logo de opciones, falta maquetarlo
adecuadamente.
This commit is contained in:
parent
77fee07968
commit
eaa86b2169
@ -63,6 +63,7 @@ void MainWindowViewer::setupUI()
|
|||||||
connect(optionsDialog,SIGNAL(accepted()),viewer,SLOT(updateOptions()));
|
connect(optionsDialog,SIGNAL(accepted()),viewer,SLOT(updateOptions()));
|
||||||
connect(optionsDialog,SIGNAL(fitToWidthRatioChanged(float)),viewer,SLOT(updateFitToWidthRatio(float)));
|
connect(optionsDialog,SIGNAL(fitToWidthRatioChanged(float)),viewer,SLOT(updateFitToWidthRatio(float)));
|
||||||
connect(optionsDialog, SIGNAL(optionsChanged()),this,SLOT(reloadOptions()));
|
connect(optionsDialog, SIGNAL(optionsChanged()),this,SLOT(reloadOptions()));
|
||||||
|
connect(optionsDialog,SIGNAL(changedImageOptions()),viewer,SLOT(updateImageOptions()));
|
||||||
|
|
||||||
optionsDialog->restoreOptions(settings);
|
optionsDialog->restoreOptions(settings);
|
||||||
shortcutsDialog = new ShortcutsDialog(this);
|
shortcutsDialog = new ShortcutsDialog(this);
|
||||||
|
@ -18,8 +18,10 @@ OptionsDialog::OptionsDialog(QWidget * parent)
|
|||||||
|
|
||||||
QWidget * pageGeneral = new QWidget();
|
QWidget * pageGeneral = new QWidget();
|
||||||
QWidget * pageFlow = new QWidget();
|
QWidget * pageFlow = new QWidget();
|
||||||
|
QWidget * pageImage = new QWidget();
|
||||||
QVBoxLayout * layoutGeneral = new QVBoxLayout();
|
QVBoxLayout * layoutGeneral = new QVBoxLayout();
|
||||||
QVBoxLayout * layoutFlow = new QVBoxLayout();;
|
QVBoxLayout * layoutFlow = new QVBoxLayout();
|
||||||
|
QVBoxLayout * layoutImage = new QVBoxLayout();
|
||||||
|
|
||||||
QGroupBox *slideSizeBox = new QGroupBox(tr("\"Go to flow\" size"));
|
QGroupBox *slideSizeBox = new QGroupBox(tr("\"Go to flow\" size"));
|
||||||
//slideSizeLabel = new QLabel(,this);
|
//slideSizeLabel = new QLabel(,this);
|
||||||
@ -73,6 +75,31 @@ OptionsDialog::OptionsDialog(QWidget * parent)
|
|||||||
connect(selectBackgroundColorButton, SIGNAL(clicked()), colorDialog, SLOT(show()));
|
connect(selectBackgroundColorButton, SIGNAL(clicked()), colorDialog, SLOT(show()));
|
||||||
colorBox->setLayout(colorSelection);
|
colorBox->setLayout(colorSelection);
|
||||||
|
|
||||||
|
brightnessS = new QSlider();
|
||||||
|
brightnessS->setMinimum(0);
|
||||||
|
brightnessS->setMaximum(100);
|
||||||
|
brightnessS->setPageStep(1);
|
||||||
|
brightnessS->setOrientation(Qt::Horizontal);
|
||||||
|
brightnessS->setTracking(false);
|
||||||
|
connect(brightnessS,SIGNAL(valueChanged(int)),this,SLOT(brightnessChanged(int)));
|
||||||
|
|
||||||
|
contrastS = new QSlider();
|
||||||
|
contrastS->setMinimum(0);
|
||||||
|
contrastS->setMaximum(250);
|
||||||
|
contrastS->setPageStep(1);
|
||||||
|
contrastS->setOrientation(Qt::Horizontal);
|
||||||
|
contrastS->setTracking(false);
|
||||||
|
connect(contrastS,SIGNAL(valueChanged(int)),this,SLOT(contrastChanged(int)));
|
||||||
|
|
||||||
|
gammaS = new QSlider();
|
||||||
|
gammaS->setMinimum(0);
|
||||||
|
gammaS->setMaximum(250);
|
||||||
|
gammaS->setPageStep(1);
|
||||||
|
gammaS->setOrientation(Qt::Horizontal);
|
||||||
|
gammaS->setTracking(false);
|
||||||
|
connect(gammaS,SIGNAL(valueChanged(int)),this,SLOT(gammaChanged(int)));
|
||||||
|
//connect(brightnessS,SIGNAL(valueChanged(int)),this,SIGNAL(changedOptions()));
|
||||||
|
|
||||||
QHBoxLayout * buttons = new QHBoxLayout();
|
QHBoxLayout * buttons = new QHBoxLayout();
|
||||||
buttons->addStretch();
|
buttons->addStretch();
|
||||||
buttons->addWidget(new QLabel(tr("Restart is needed")));
|
buttons->addWidget(new QLabel(tr("Restart is needed")));
|
||||||
@ -88,12 +115,18 @@ OptionsDialog::OptionsDialog(QWidget * parent)
|
|||||||
layoutFlow->addWidget(gl);
|
layoutFlow->addWidget(gl);
|
||||||
layoutFlow->addWidget(useGL);
|
layoutFlow->addWidget(useGL);
|
||||||
layoutFlow->addStretch();
|
layoutFlow->addStretch();
|
||||||
|
layoutImage->addWidget(brightnessS);
|
||||||
|
layoutImage->addWidget(contrastS);
|
||||||
|
layoutImage->addWidget(gammaS);
|
||||||
|
layoutImage->addStretch();
|
||||||
|
|
||||||
pageGeneral->setLayout(layoutGeneral);
|
pageGeneral->setLayout(layoutGeneral);
|
||||||
pageFlow->setLayout(layoutFlow);
|
pageFlow->setLayout(layoutFlow);
|
||||||
|
pageImage->setLayout(layoutImage);
|
||||||
|
|
||||||
tabWidget->addTab(pageGeneral,tr("General"));
|
tabWidget->addTab(pageGeneral,tr("General"));
|
||||||
tabWidget->addTab(pageFlow,tr("Page Flow"));
|
tabWidget->addTab(pageFlow,tr("Page Flow"));
|
||||||
|
tabWidget->addTab(pageImage,tr("Immage adjustment"));
|
||||||
|
|
||||||
layout->addWidget(tabWidget);
|
layout->addWidget(tabWidget);
|
||||||
layout->addLayout(buttons);
|
layout->addLayout(buttons);
|
||||||
@ -165,6 +198,10 @@ void OptionsDialog::restoreOptions(QSettings * settings)
|
|||||||
|
|
||||||
updateColor(settings->value(BACKGROUND_COLOR).value<QColor>());
|
updateColor(settings->value(BACKGROUND_COLOR).value<QColor>());
|
||||||
fitToWidthRatioS->setSliderPosition(settings->value(FIT_TO_WIDTH_RATIO).toFloat()*100);
|
fitToWidthRatioS->setSliderPosition(settings->value(FIT_TO_WIDTH_RATIO).toFloat()*100);
|
||||||
|
|
||||||
|
brightnessS->setValue(settings->value(BRIGHTNESS,0).toInt());
|
||||||
|
contrastS->setValue(settings->value(CONTRAST,100).toInt());
|
||||||
|
gammaS->setValue(settings->value(GAMMA,100).toInt());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -185,4 +222,25 @@ void OptionsDialog::fitToWidthRatio(int value)
|
|||||||
{
|
{
|
||||||
Configuration::getConfiguration().setFitToWidthRatio(value/100.0);
|
Configuration::getConfiguration().setFitToWidthRatio(value/100.0);
|
||||||
emit(fitToWidthRatioChanged(value/100.0));
|
emit(fitToWidthRatioChanged(value/100.0));
|
||||||
|
}
|
||||||
|
|
||||||
|
void OptionsDialog::brightnessChanged(int value)
|
||||||
|
{
|
||||||
|
QSettings settings(QCoreApplication::applicationDirPath()+"/YACReader.ini",QSettings::IniFormat);
|
||||||
|
settings.setValue(BRIGHTNESS,value);
|
||||||
|
emit(changedImageOptions());
|
||||||
|
}
|
||||||
|
|
||||||
|
void OptionsDialog::contrastChanged(int value)
|
||||||
|
{
|
||||||
|
QSettings settings(QCoreApplication::applicationDirPath()+"/YACReader.ini",QSettings::IniFormat);
|
||||||
|
settings.setValue(CONTRAST,value);
|
||||||
|
emit(changedImageOptions());
|
||||||
|
}
|
||||||
|
|
||||||
|
void OptionsDialog::gammaChanged(int value)
|
||||||
|
{
|
||||||
|
QSettings settings(QCoreApplication::applicationDirPath()+"/YACReader.ini",QSettings::IniFormat);
|
||||||
|
settings.setValue(GAMMA,value);
|
||||||
|
emit(changedImageOptions());
|
||||||
}
|
}
|
@ -37,15 +37,25 @@ Q_OBJECT
|
|||||||
|
|
||||||
QColorDialog * colorDialog;
|
QColorDialog * colorDialog;
|
||||||
|
|
||||||
|
QSlider * brightnessS;
|
||||||
|
|
||||||
|
QSlider * contrastS;
|
||||||
|
|
||||||
|
QSlider * gammaS;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void saveOptions();
|
void saveOptions();
|
||||||
void restoreOptions(QSettings * settings);
|
void restoreOptions(QSettings * settings);
|
||||||
void findFolder();
|
void findFolder();
|
||||||
void updateColor(const QColor & color);
|
void updateColor(const QColor & color);
|
||||||
void fitToWidthRatio(int value);
|
void fitToWidthRatio(int value);
|
||||||
|
void brightnessChanged(int value);
|
||||||
|
void contrastChanged(int value);
|
||||||
|
void gammaChanged(int value);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void changedOptions();
|
void changedOptions();
|
||||||
|
void changedImageOptions();
|
||||||
void fitToWidthRatioChanged(float ratio);
|
void fitToWidthRatioChanged(float ratio);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -10,6 +10,8 @@
|
|||||||
#define NL 2
|
#define NL 2
|
||||||
#define NR 2
|
#define NR 2
|
||||||
|
|
||||||
|
#include "yacreader_global.h"
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
inline const T& kClamp( const T& x, const T& low, const T& high )
|
inline const T& kClamp( const T& x, const T& low, const T& high )
|
||||||
{
|
{
|
||||||
@ -238,8 +240,8 @@ QImage BrightnessFilter::setFilter(const QImage & image)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result;*/
|
return result;*/
|
||||||
|
QSettings settings(QCoreApplication::applicationDirPath()+"/YACReader.ini",QSettings::IniFormat);
|
||||||
return changeBrightness(image,50);
|
return changeBrightness(image,settings.value(BRIGHTNESS,0).toInt());
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@ -309,8 +311,8 @@ QImage ContrastFilter::setFilter(const QImage & image)
|
|||||||
}
|
}
|
||||||
|
|
||||||
return result;*/
|
return result;*/
|
||||||
|
QSettings settings(QCoreApplication::applicationDirPath()+"/YACReader.ini",QSettings::IniFormat);
|
||||||
return changeContrast(image,level);
|
return changeContrast(image,settings.value(CONTRAST,100).toInt());
|
||||||
}
|
}
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// ContrastFilter
|
// ContrastFilter
|
||||||
@ -322,7 +324,8 @@ GammaFilter::GammaFilter(int l)
|
|||||||
|
|
||||||
QImage GammaFilter::setFilter(const QImage & image)
|
QImage GammaFilter::setFilter(const QImage & image)
|
||||||
{
|
{
|
||||||
return changeGamma(image,level);
|
QSettings settings(QCoreApplication::applicationDirPath()+"/YACReader.ini",QSettings::IniFormat);
|
||||||
|
return changeGamma(image,settings.value(GAMMA,100).toInt());
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@ -438,7 +441,9 @@ Render::Render()
|
|||||||
pageRenders.push_back(0);
|
pageRenders.push_back(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
//filters.push_back(new GammaFilter(250));
|
filters.push_back(new BrightnessFilter());
|
||||||
|
filters.push_back(new ContrastFilter());
|
||||||
|
filters.push_back(new GammaFilter());
|
||||||
}
|
}
|
||||||
|
|
||||||
//Este método se encarga de forzar el renderizado de las páginas.
|
//Este método se encarga de forzar el renderizado de las páginas.
|
||||||
@ -822,7 +827,7 @@ void Render::fillBuffer()
|
|||||||
pageRenders[currentPageBufferedIndex+i]==0 &&
|
pageRenders[currentPageBufferedIndex+i]==0 &&
|
||||||
pagesReady[currentIndex+1]) //preload next pages
|
pagesReady[currentIndex+1]) //preload next pages
|
||||||
{
|
{
|
||||||
pageRenders[currentPageBufferedIndex+i] = new PageRender(currentIndex+i,comic->getRawData()->at(currentIndex+i),buffer[currentPageBufferedIndex+i],imageRotation);
|
pageRenders[currentPageBufferedIndex+i] = new PageRender(currentIndex+i,comic->getRawData()->at(currentIndex+i),buffer[currentPageBufferedIndex+i],imageRotation,filters);
|
||||||
connect(pageRenders[currentPageBufferedIndex],SIGNAL(pageReady(int)),this,SLOT(prepareAvailablePage(int)));
|
connect(pageRenders[currentPageBufferedIndex],SIGNAL(pageReady(int)),this,SLOT(prepareAvailablePage(int)));
|
||||||
pageRenders[currentPageBufferedIndex+i]->start();
|
pageRenders[currentPageBufferedIndex+i]->start();
|
||||||
}
|
}
|
||||||
@ -833,7 +838,7 @@ void Render::fillBuffer()
|
|||||||
pageRenders[currentPageBufferedIndex-i]==0 &&
|
pageRenders[currentPageBufferedIndex-i]==0 &&
|
||||||
pagesReady[currentIndex-1]) //preload previous pages
|
pagesReady[currentIndex-1]) //preload previous pages
|
||||||
{
|
{
|
||||||
pageRenders[currentPageBufferedIndex-i] = new PageRender(currentIndex-i,comic->getRawData()->at(currentIndex-i),buffer[currentPageBufferedIndex-i],imageRotation);
|
pageRenders[currentPageBufferedIndex-i] = new PageRender(currentIndex-i,comic->getRawData()->at(currentIndex-i),buffer[currentPageBufferedIndex-i],imageRotation,filters);
|
||||||
connect(pageRenders[currentPageBufferedIndex],SIGNAL(pageReady(int)),this,SLOT(prepareAvailablePage(int)));
|
connect(pageRenders[currentPageBufferedIndex],SIGNAL(pageReady(int)),this,SLOT(prepareAvailablePage(int)));
|
||||||
pageRenders[currentPageBufferedIndex-i]->start();
|
pageRenders[currentPageBufferedIndex-i]->start();
|
||||||
}
|
}
|
||||||
@ -851,9 +856,9 @@ void Render::fillBufferDoublePage()
|
|||||||
(pagesReady[currentIndex+2*i] && pagesReady[qMin(currentIndex+(2*i)+1,(int)comic->numPages()-1)])) //preload next pages
|
(pagesReady[currentIndex+2*i] && pagesReady[qMin(currentIndex+(2*i)+1,(int)comic->numPages()-1)])) //preload next pages
|
||||||
{
|
{
|
||||||
if(currentIndex+(2*i)+1 > comic->numPages()-1)
|
if(currentIndex+(2*i)+1 > comic->numPages()-1)
|
||||||
pageRenders[currentPageBufferedIndex+i] = new DoublePageRender(currentIndex+2*i,comic->getRawData()->at(currentIndex+(2*i)),QByteArray(),buffer[currentPageBufferedIndex+i],imageRotation);
|
pageRenders[currentPageBufferedIndex+i] = new DoublePageRender(currentIndex+2*i,comic->getRawData()->at(currentIndex+(2*i)),QByteArray(),buffer[currentPageBufferedIndex+i],imageRotation,filters);
|
||||||
else
|
else
|
||||||
pageRenders[currentPageBufferedIndex+i] = new DoublePageRender(currentIndex+2*i,comic->getRawData()->at(currentIndex+(2*i)),comic->getRawData()->at(currentIndex+(2*i)+1),buffer[currentPageBufferedIndex+i],imageRotation);
|
pageRenders[currentPageBufferedIndex+i] = new DoublePageRender(currentIndex+2*i,comic->getRawData()->at(currentIndex+(2*i)),comic->getRawData()->at(currentIndex+(2*i)+1),buffer[currentPageBufferedIndex+i],imageRotation,filters);
|
||||||
connect(pageRenders[currentPageBufferedIndex],SIGNAL(pageReady(int)),this,SLOT(prepareAvailablePage(int)));
|
connect(pageRenders[currentPageBufferedIndex],SIGNAL(pageReady(int)),this,SLOT(prepareAvailablePage(int)));
|
||||||
pageRenders[currentPageBufferedIndex+i]->start();
|
pageRenders[currentPageBufferedIndex+i]->start();
|
||||||
}
|
}
|
||||||
@ -865,9 +870,9 @@ void Render::fillBufferDoublePage()
|
|||||||
(pagesReady[qMax(currentIndex-2*i,0)] && pagesReady[qMin(currentIndex-(2*i)+1,(int)comic->numPages()-1)])) //preload previous pages
|
(pagesReady[qMax(currentIndex-2*i,0)] && pagesReady[qMin(currentIndex-(2*i)+1,(int)comic->numPages()-1)])) //preload previous pages
|
||||||
{
|
{
|
||||||
if(currentIndex-2*i == -1)
|
if(currentIndex-2*i == -1)
|
||||||
pageRenders[currentPageBufferedIndex-i] = new DoublePageRender(0,QByteArray(),comic->getRawData()->at(0),buffer[currentPageBufferedIndex-i],imageRotation);
|
pageRenders[currentPageBufferedIndex-i] = new DoublePageRender(0,QByteArray(),comic->getRawData()->at(0),buffer[currentPageBufferedIndex-i],imageRotation,filters);
|
||||||
else
|
else
|
||||||
pageRenders[currentPageBufferedIndex-i] = new DoublePageRender(currentIndex-2*i,comic->getRawData()->at(currentIndex-(2*i)),comic->getRawData()->at(currentIndex-(2*i)+1),buffer[currentPageBufferedIndex-i],imageRotation);
|
pageRenders[currentPageBufferedIndex-i] = new DoublePageRender(currentIndex-2*i,comic->getRawData()->at(currentIndex-(2*i)),comic->getRawData()->at(currentIndex-(2*i)+1),buffer[currentPageBufferedIndex-i],imageRotation,filters);
|
||||||
connect(pageRenders[currentPageBufferedIndex],SIGNAL(pageReady(int)),this,SLOT(prepareAvailablePage(int)));
|
connect(pageRenders[currentPageBufferedIndex],SIGNAL(pageReady(int)),this,SLOT(prepareAvailablePage(int)));
|
||||||
pageRenders[currentPageBufferedIndex-i]->start();
|
pageRenders[currentPageBufferedIndex-i]->start();
|
||||||
}
|
}
|
||||||
@ -932,4 +937,13 @@ void Render::save()
|
|||||||
Bookmarks * Render::getBookmarks()
|
Bookmarks * Render::getBookmarks()
|
||||||
{
|
{
|
||||||
return comic->bm;
|
return comic->bm;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Render::reload()
|
||||||
|
{
|
||||||
|
if(comic)
|
||||||
|
{
|
||||||
|
invalidate();
|
||||||
|
update();
|
||||||
|
}
|
||||||
}
|
}
|
@ -147,6 +147,7 @@ public slots:
|
|||||||
void removeBookmark();
|
void removeBookmark();
|
||||||
void save();
|
void save();
|
||||||
void reset();
|
void reset();
|
||||||
|
void reload();
|
||||||
Bookmarks * getBookmarks();
|
Bookmarks * getBookmarks();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
@ -736,6 +736,13 @@ void Viewer::updateConfig(QSettings * settings)
|
|||||||
QPalette palette;
|
QPalette palette;
|
||||||
palette.setColor(backgroundRole(), Configuration::getConfiguration().getBackgroundColor());
|
palette.setColor(backgroundRole(), Configuration::getConfiguration().getBackgroundColor());
|
||||||
setPalette(palette);
|
setPalette(palette);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void Viewer::updateImageOptions()
|
||||||
|
{
|
||||||
|
render->reload();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Viewer::setBookmarks()
|
void Viewer::setBookmarks()
|
||||||
|
@ -77,6 +77,7 @@ virtual void mouseReleaseEvent ( QMouseEvent * event );
|
|||||||
void updateConfig(QSettings * settings);
|
void updateConfig(QSettings * settings);
|
||||||
void showMessageErrorOpening();
|
void showMessageErrorOpening();
|
||||||
void setBookmarks();
|
void setBookmarks();
|
||||||
|
void updateImageOptions();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool information;
|
bool information;
|
||||||
|
@ -21,6 +21,9 @@
|
|||||||
#define BACKGROUND_COLOR "BACKGROUND_COLOR"
|
#define BACKGROUND_COLOR "BACKGROUND_COLOR"
|
||||||
#define ALWAYS_ON_TOP "ALWAYS_ON_TOP"
|
#define ALWAYS_ON_TOP "ALWAYS_ON_TOP"
|
||||||
#define SHOW_TOOLBARS "SHOW_TOOLBARS"
|
#define SHOW_TOOLBARS "SHOW_TOOLBARS"
|
||||||
|
#define BRIGHTNESS "BRIGHTNESS"
|
||||||
|
#define CONTRAST "CONTRAST"
|
||||||
|
#define GAMMA "GAMMA"
|
||||||
|
|
||||||
#define FLOW_TYPE_GL "FLOW_TYPE_GL"
|
#define FLOW_TYPE_GL "FLOW_TYPE_GL"
|
||||||
#define Y_POSITION "Y_POSITION"
|
#define Y_POSITION "Y_POSITION"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user