mirror of
https://github.com/YACReader/yacreader
synced 2025-07-19 05:24:57 -04:00
creado yacreader_global.h
reestructuraci?n de parte del c?digo cambio a Qt 4.8.3 uso de QSettings en YACReader, falta leer la configuraci?n desde qsettings
This commit is contained in:
@ -18,10 +18,6 @@ HEADERS += comic.h \
|
||||
magnifying_glass.h \
|
||||
main_window_viewer.h \
|
||||
viewer.h \
|
||||
../common/pictureflow.h \
|
||||
../common/custom_widgets.h \
|
||||
../common/check_new_version.h \
|
||||
../common/qnaturalsorting.h \
|
||||
goto_flow.h \
|
||||
options_dialog.h \
|
||||
bookmarks.h \
|
||||
@ -29,9 +25,14 @@ HEADERS += comic.h \
|
||||
render.h \
|
||||
shortcuts_dialog.h \
|
||||
translator.h \
|
||||
../common/goto_flow_widget.h \
|
||||
goto_flow_gl.h \
|
||||
../common/yacreader_flow_gl.h
|
||||
goto_flow_widget.h \
|
||||
../common/pictureflow.h \
|
||||
../common/custom_widgets.h \
|
||||
../common/check_new_version.h \
|
||||
../common/qnaturalsorting.h \
|
||||
../common/yacreader_flow_gl.h \
|
||||
../common/yacreader_global.h
|
||||
|
||||
SOURCES += comic.cpp \
|
||||
configuration.cpp \
|
||||
@ -40,10 +41,6 @@ SOURCES += comic.cpp \
|
||||
main.cpp \
|
||||
main_window_viewer.cpp \
|
||||
viewer.cpp \
|
||||
../common/pictureflow.cpp \
|
||||
../common/custom_widgets.cpp \
|
||||
../common/check_new_version.cpp \
|
||||
../common/qnaturalsorting.cpp \
|
||||
goto_flow.cpp \
|
||||
options_dialog.cpp \
|
||||
bookmarks.cpp \
|
||||
@ -51,8 +48,12 @@ SOURCES += comic.cpp \
|
||||
render.cpp \
|
||||
shortcuts_dialog.cpp \
|
||||
translator.cpp \
|
||||
../common/goto_flow_widget.cpp \
|
||||
goto_flow_gl.cpp \
|
||||
goto_flow_widget.cpp \
|
||||
../common/pictureflow.cpp \
|
||||
../common/custom_widgets.cpp \
|
||||
../common/check_new_version.cpp \
|
||||
../common/qnaturalsorting.cpp \
|
||||
../common/yacreader_flow_gl.cpp
|
||||
|
||||
RESOURCES += images.qrc \
|
||||
|
@ -47,7 +47,7 @@ void Configuration::load(const QString & path)
|
||||
//gotoSlideSize = QSize(220,350); //huge
|
||||
zoomLevel = 0.5;
|
||||
adjustToWidth = true;
|
||||
flowType = PictureFlow::Strip;
|
||||
flowType = Strip;
|
||||
fullScreen = false;
|
||||
fitToWidthRatio = 1;
|
||||
windowSize = QSize(0,0);
|
||||
@ -95,7 +95,7 @@ void Configuration::load(const QString & path)
|
||||
adjustToWidth = line.toInt();
|
||||
else
|
||||
if(name==FLOW_TYPE)
|
||||
flowType = (PictureFlow::FlowType)line.toInt();
|
||||
flowType = (FlowType)line.toInt();
|
||||
else
|
||||
if(name==FULLSCREEN)
|
||||
fullScreen = line.toInt();
|
||||
|
@ -3,7 +3,9 @@
|
||||
#include <QString>
|
||||
#include <QSize>
|
||||
#include <QObject>
|
||||
#include "pictureflow.h"
|
||||
#include <QPoint>
|
||||
#include <QColor>
|
||||
#include "yacreader_global.h"
|
||||
|
||||
#define CONF_FILE_PATH "."
|
||||
#define SLIDE_ASPECT_RATIO 1.585
|
||||
@ -20,7 +22,7 @@
|
||||
float zoomLevel;
|
||||
bool adjustToWidth;
|
||||
bool fullScreen;
|
||||
PictureFlow::FlowType flowType;
|
||||
FlowType flowType;
|
||||
float fitToWidthRatio;
|
||||
QPoint windowPos;
|
||||
QSize windowSize;
|
||||
@ -50,8 +52,8 @@
|
||||
void setZoomLevel(float zl) { zoomLevel = zl;};
|
||||
bool getAdjustToWidth() {return adjustToWidth;};
|
||||
void setAdjustToWidth(bool atw=true) {adjustToWidth = atw;};
|
||||
PictureFlow::FlowType getFlowType(){return flowType;};
|
||||
void setFlowType(PictureFlow::FlowType type){flowType = type;};
|
||||
FlowType getFlowType(){return flowType;};
|
||||
void setFlowType(FlowType type){flowType = type;};
|
||||
bool getFullScreen(){return fullScreen;};
|
||||
void setFullScreen(bool f){fullScreen = f;};
|
||||
float getFitToWidthRatio(){return fitToWidthRatio;};
|
||||
|
@ -18,7 +18,7 @@ QMutex mutexGoToFlow;
|
||||
|
||||
|
||||
|
||||
GoToFlow::GoToFlow(QWidget *parent,PictureFlow::FlowType flowType)
|
||||
GoToFlow::GoToFlow(QWidget *parent,FlowType flowType)
|
||||
:GoToFlowWidget(parent),ready(false)
|
||||
{
|
||||
updateTimer = new QTimer;
|
||||
@ -269,7 +269,7 @@ void GoToFlow::wheelEvent(QWheelEvent * event)
|
||||
event->accept();
|
||||
}
|
||||
|
||||
void GoToFlow::setFlowType(PictureFlow::FlowType flowType)
|
||||
void GoToFlow::setFlowType(FlowType flowType)
|
||||
{
|
||||
flow->setFlowType(flowType);
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ class GoToFlow : public GoToFlowWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
GoToFlow(QWidget* parent = 0,PictureFlow::FlowType flowType = PictureFlow::CoverFlowLike);
|
||||
GoToFlow(QWidget* parent = 0,FlowType flowType = CoverFlowLike);
|
||||
bool ready; //comic is ready for read.
|
||||
void keyPressEvent(QKeyEvent* event);
|
||||
bool eventFilter(QObject *target, QEvent *event);
|
||||
@ -56,7 +56,7 @@ private:
|
||||
void reset();
|
||||
void setNumSlides(unsigned int slides);
|
||||
void setImageReady(int index,const QByteArray & image);
|
||||
void setFlowType(PictureFlow::FlowType flowType);
|
||||
void setFlowType(FlowType flowType);
|
||||
void updateSize();
|
||||
void updateConfig(QSettings * settings);
|
||||
signals:
|
||||
|
@ -19,6 +19,8 @@ MainWindowViewer::MainWindowViewer()
|
||||
|
||||
void MainWindowViewer::loadConfiguration()
|
||||
{
|
||||
settings = new QSettings("YACReader.ini",QSettings::IniFormat);
|
||||
|
||||
Configuration & config = Configuration::getConfiguration();
|
||||
currentDirectory = config.getDefaultPath();
|
||||
fullscreen = config.getFullScreen();
|
||||
@ -26,9 +28,6 @@ void MainWindowViewer::loadConfiguration()
|
||||
|
||||
void MainWindowViewer::setupUI()
|
||||
{
|
||||
settings = new QSettings("YACReader.ini",QSettings::IniFormat);
|
||||
settings->beginGroup("config");
|
||||
|
||||
setWindowIcon(QIcon(":/images/icon.png"));
|
||||
|
||||
viewer = new Viewer(this);
|
||||
|
@ -109,6 +109,7 @@ class ShortcutsDialog;
|
||||
void dragEnterEvent(QDragEnterEvent *event);
|
||||
|
||||
QSettings * settings;
|
||||
|
||||
protected:
|
||||
virtual void closeEvent ( QCloseEvent * event );
|
||||
public:
|
||||
|
@ -96,18 +96,19 @@ void OptionsDialog::findFolder()
|
||||
|
||||
void OptionsDialog::saveOptions()
|
||||
{
|
||||
Configuration & conf = Configuration::getConfiguration();
|
||||
conf.setDefaultPath(pathEdit->text());
|
||||
conf.setGotoSlideSize(QSize(static_cast<int>(slideSize->sliderPosition()*SLIDE_ASPECT_RATIO),slideSize->sliderPosition()));
|
||||
settings->setValue("goToFlowSize",QSize(static_cast<int>(slideSize->sliderPosition()*SLIDE_ASPECT_RATIO),slideSize->sliderPosition()));
|
||||
if(sw->radio1->isChecked())
|
||||
conf.setFlowType(PictureFlow::CoverFlowLike);
|
||||
settings->setValue("flowTypeSW",0);
|
||||
if(sw->radio2->isChecked())
|
||||
conf.setFlowType(PictureFlow::Strip);
|
||||
settings->setValue("flowTypeSW",1);
|
||||
if(sw->radio3->isChecked())
|
||||
conf.setFlowType(PictureFlow::StripOverlapped);
|
||||
conf.setFitToWidthRatio(fitToWidthRatioS->sliderPosition()/100.0);
|
||||
conf.setBackgroundColor(colorDialog->currentColor());
|
||||
conf.save();
|
||||
settings->setValue("flowTypeSW",2);
|
||||
|
||||
settings->setValue("path",pathEdit->text());
|
||||
|
||||
settings->setValue("color",colorDialog->currentColor());
|
||||
settings->setValue("adjustToWidthRatio",fitToWidthRatioS->sliderPosition()/100.0);
|
||||
|
||||
close();
|
||||
emit(accepted());
|
||||
}
|
||||
@ -115,24 +116,28 @@ void OptionsDialog::saveOptions()
|
||||
void OptionsDialog::restoreOptions(QSettings * settings)
|
||||
{
|
||||
YACReaderOptionsDialog::restoreOptions(settings);
|
||||
|
||||
Configuration & conf = Configuration::getConfiguration();
|
||||
|
||||
slideSize->setSliderPosition(conf.getGotoSlideSize().height());
|
||||
fitToWidthRatioS->setSliderPosition(conf.getFitToWidthRatio()*100);
|
||||
pathEdit->setText(conf.getDefaultPath());
|
||||
updateColor(Configuration::getConfiguration().getBackgroundColor());
|
||||
switch(conf.getFlowType()){
|
||||
case PictureFlow::CoverFlowLike:
|
||||
|
||||
slideSize->setSliderPosition(settings->value("goToFlowSize").toSize().height());
|
||||
switch(settings->value("flowTypeSW").toInt())
|
||||
{
|
||||
case 0:
|
||||
sw->radio1->setChecked(true);
|
||||
break;
|
||||
case PictureFlow::Strip:
|
||||
case 1:
|
||||
sw->radio2->setChecked(true);
|
||||
break;
|
||||
case PictureFlow::StripOverlapped:
|
||||
case 2:
|
||||
sw->radio3->setChecked(true);
|
||||
break;
|
||||
default:
|
||||
sw->radio1->setChecked(true);
|
||||
break;
|
||||
}
|
||||
|
||||
pathEdit->setText(settings->value("path").toString());
|
||||
|
||||
updateColor(settings->value("color").value<QColor>());
|
||||
fitToWidthRatioS->setSliderPosition(settings->value("adjustToWidthRatio").toFloat()*100);
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user