mirror of
https://github.com/YACReader/yacreader
synced 2025-06-04 01:28:55 -04:00
El estado de la toolbar se almacena ahora en la configuraci?n.
Se ha modificado el escroll vertical para que s?a fluido (wheel).
This commit is contained in:
parent
bd1edd440b
commit
040764e1f5
@ -51,6 +51,8 @@ void Configuration::load(QSettings * settings)
|
|||||||
settings->setValue(BACKGROUND_COLOR,QColor(0,0,0));
|
settings->setValue(BACKGROUND_COLOR,QColor(0,0,0));
|
||||||
if(!settings->contains(ALWAYS_ON_TOP))
|
if(!settings->contains(ALWAYS_ON_TOP))
|
||||||
settings->setValue(ALWAYS_ON_TOP,false);
|
settings->setValue(ALWAYS_ON_TOP,false);
|
||||||
|
if(!settings->contains(SHOW_TOOLBARS))
|
||||||
|
settings->setValue(SHOW_TOOLBARS, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Configuration::load(const QString & path)
|
void Configuration::load(const QString & path)
|
||||||
|
@ -78,6 +78,8 @@
|
|||||||
void setBackgroundColor(const QColor& color){settings->value(BACKGROUND_COLOR,color);};
|
void setBackgroundColor(const QColor& color){settings->value(BACKGROUND_COLOR,color);};
|
||||||
bool getAlwaysOnTop(){return settings->value(ALWAYS_ON_TOP).toBool();};
|
bool getAlwaysOnTop(){return settings->value(ALWAYS_ON_TOP).toBool();};
|
||||||
void setAlwaysOnTop(bool b){ settings->setValue(ALWAYS_ON_TOP,b);};
|
void setAlwaysOnTop(bool b){ settings->setValue(ALWAYS_ON_TOP,b);};
|
||||||
|
bool getShowToolbars(){return settings->value(SHOW_TOOLBARS).toBool();};
|
||||||
|
void setShowToolbars(bool b){return settings->setValue(SHOW_TOOLBARS,b);};
|
||||||
|
|
||||||
void save();
|
void save();
|
||||||
|
|
||||||
|
@ -107,6 +107,11 @@ void MainWindowViewer::setupUI()
|
|||||||
showMaximized();
|
showMaximized();
|
||||||
|
|
||||||
setAcceptDrops(true);
|
setAcceptDrops(true);
|
||||||
|
|
||||||
|
if(Configuration::getConfiguration().getShowToolbars() && !Configuration::getConfiguration().getFullScreen())
|
||||||
|
showToolBars();
|
||||||
|
else
|
||||||
|
hideToolBars();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindowViewer::createActions()
|
void MainWindowViewer::createActions()
|
||||||
@ -535,7 +540,8 @@ void MainWindowViewer::toNormal()
|
|||||||
viewer->fullscreen = false;//TODO, change by the right use of windowState();
|
viewer->fullscreen = false;//TODO, change by the right use of windowState();
|
||||||
//viewer->hideMagnifyingGlass();
|
//viewer->hideMagnifyingGlass();
|
||||||
showNormal();
|
showNormal();
|
||||||
showToolBars();
|
if(Configuration::getConfiguration().getShowToolbars())
|
||||||
|
showToolBars();
|
||||||
viewer->show();
|
viewer->show();
|
||||||
if(viewer->magnifyingGlassIsVisible())
|
if(viewer->magnifyingGlassIsVisible())
|
||||||
viewer->showMagnifyingGlass();
|
viewer->showMagnifyingGlass();
|
||||||
@ -543,6 +549,8 @@ void MainWindowViewer::toNormal()
|
|||||||
void MainWindowViewer::toggleToolBars()
|
void MainWindowViewer::toggleToolBars()
|
||||||
{
|
{
|
||||||
toolbars?hideToolBars():showToolBars();
|
toolbars?hideToolBars():showToolBars();
|
||||||
|
|
||||||
|
Configuration::getConfiguration().setShowToolbars(toolbars);
|
||||||
}
|
}
|
||||||
void MainWindowViewer::hideToolBars()
|
void MainWindowViewer::hideToolBars()
|
||||||
{
|
{
|
||||||
|
@ -110,6 +110,7 @@ drag(false)
|
|||||||
|
|
||||||
//animations
|
//animations
|
||||||
verticalScroller = new QPropertyAnimation(verticalScrollBar(), "sliderPosition");
|
verticalScroller = new QPropertyAnimation(verticalScrollBar(), "sliderPosition");
|
||||||
|
connect(verticalScroller,SIGNAL(valueChanged (const QVariant &)),this,SIGNAL(backgroundChanges()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Viewer::createConnections()
|
void Viewer::createConnections()
|
||||||
@ -343,26 +344,14 @@ void Viewer::keyPressEvent(QKeyEvent *event)
|
|||||||
|
|
||||||
void Viewer::wheelEvent(QWheelEvent * event)
|
void Viewer::wheelEvent(QWheelEvent * event)
|
||||||
{
|
{
|
||||||
if(render->hasLoadedComic())
|
if(render->hasLoadedComic())
|
||||||
{
|
|
||||||
if((event->delta()<0)&&(verticalScrollBar()->sliderPosition()==verticalScrollBar()->maximum()))
|
|
||||||
{
|
{
|
||||||
if(wheelStop)
|
if((event->delta()<0)&&(verticalScrollBar()->sliderPosition()==verticalScrollBar()->maximum()))
|
||||||
{
|
{
|
||||||
next();
|
if(wheelStop)
|
||||||
event->accept();
|
|
||||||
wheelStop = false;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
wheelStop = true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
if((event->delta()>0)&&(verticalScrollBar()->sliderPosition()==verticalScrollBar()->minimum()))
|
|
||||||
{
|
|
||||||
if(wheelStop)
|
|
||||||
{
|
{
|
||||||
prev();
|
next();
|
||||||
|
verticalScroller->stop();
|
||||||
event->accept();
|
event->accept();
|
||||||
wheelStop = false;
|
wheelStop = false;
|
||||||
return;
|
return;
|
||||||
@ -370,10 +359,40 @@ void Viewer::wheelEvent(QWheelEvent * event)
|
|||||||
else
|
else
|
||||||
wheelStop = true;
|
wheelStop = true;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if((event->delta()>0)&&(verticalScrollBar()->sliderPosition()==verticalScrollBar()->minimum()))
|
||||||
|
{
|
||||||
|
if(wheelStop)
|
||||||
|
{
|
||||||
|
prev();
|
||||||
|
verticalScroller->stop();
|
||||||
|
event->accept();
|
||||||
|
wheelStop = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
wheelStop = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
QAbstractScrollArea::wheelEvent(event);
|
int deltaNotFinished = 0;
|
||||||
emit backgroundChanges();
|
if(verticalScroller->state() == QAbstractAnimation::Running)
|
||||||
}
|
{
|
||||||
|
deltaNotFinished = verticalScroller->startValue().toInt() - verticalScroller->endValue().toInt();
|
||||||
|
verticalScroller->stop();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int currentPos = verticalScrollBar()->sliderPosition();
|
||||||
|
verticalScroller->setDuration(250);
|
||||||
|
verticalScroller->setStartValue(currentPos);
|
||||||
|
verticalScroller->setEndValue(currentPos - event->delta() - deltaNotFinished);
|
||||||
|
|
||||||
|
verticalScroller->start();
|
||||||
|
|
||||||
|
//QAbstractScrollArea::wheelEvent(event);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Viewer::resizeEvent(QResizeEvent * event)
|
void Viewer::resizeEvent(QResizeEvent * event)
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
#define ADJUST_TO_FULL_SIZE "ADJUST_TO_FULL_SIZE"
|
#define ADJUST_TO_FULL_SIZE "ADJUST_TO_FULL_SIZE"
|
||||||
#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 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