mirror of
https://github.com/YACReader/yacreader
synced 2025-07-18 21:14:33 -04:00
unificaci?n de las partes comunes en los di?logos de configuraci?n
This commit is contained in:
@ -8,7 +8,7 @@
|
||||
|
||||
|
||||
OptionsDialog::OptionsDialog(QWidget * parent)
|
||||
:QDialog(parent)
|
||||
:YACReaderOptionsDialog(parent)
|
||||
{
|
||||
QVBoxLayout * layout = new QVBoxLayout(this);
|
||||
|
||||
@ -32,48 +32,6 @@ OptionsDialog::OptionsDialog(QWidget * parent)
|
||||
|
||||
connect(pathFindButton,SIGNAL(clicked()),this,SLOT(findFolder()));
|
||||
|
||||
accept = new QPushButton(tr("Save"));
|
||||
cancel = new QPushButton(tr("Cancel"));
|
||||
connect(accept,SIGNAL(clicked()),this,SLOT(saveOptions()));
|
||||
connect(cancel,SIGNAL(clicked()),this,SLOT(restoreOptions()));
|
||||
connect(cancel,SIGNAL(clicked()),this,SLOT(close()));
|
||||
|
||||
QGroupBox *groupBox = new QGroupBox(tr("How to show pages in GoToFlow:"));
|
||||
|
||||
radio1 = new QRadioButton(tr("CoverFlow look"));
|
||||
radio2 = new QRadioButton(tr("Stripe look"));
|
||||
radio3 = new QRadioButton(tr("Overlapped Stripe look"));
|
||||
|
||||
|
||||
QVBoxLayout *vbox = new QVBoxLayout;
|
||||
QHBoxLayout * opt1 = new QHBoxLayout;
|
||||
opt1->addWidget(radio1);
|
||||
QLabel * lOpt1 = new QLabel();
|
||||
lOpt1->setPixmap(QPixmap(":/images/flow1.png"));
|
||||
opt1->addStretch();
|
||||
opt1->addWidget(lOpt1);
|
||||
vbox->addLayout(opt1);
|
||||
|
||||
QHBoxLayout * opt2 = new QHBoxLayout;
|
||||
opt2->addWidget(radio2);
|
||||
QLabel * lOpt2 = new QLabel();
|
||||
lOpt2->setPixmap(QPixmap(":/images/flow2.png"));
|
||||
opt2->addStretch();
|
||||
opt2->addWidget(lOpt2);
|
||||
vbox->addLayout(opt2);
|
||||
|
||||
QHBoxLayout * opt3 = new QHBoxLayout;
|
||||
opt3->addWidget(radio3);
|
||||
QLabel * lOpt3 = new QLabel();
|
||||
lOpt3->setPixmap(QPixmap(":/images/flow3.png"));
|
||||
opt3->addStretch();
|
||||
opt3->addWidget(lOpt3);
|
||||
vbox->addLayout(opt3);
|
||||
|
||||
|
||||
//vbox->addStretch(1);
|
||||
groupBox->setLayout(vbox);
|
||||
|
||||
//fitToWidthRatioLabel = new QLabel(tr("Page width stretch"),this);
|
||||
QGroupBox *fitBox = new QGroupBox(tr("Page width stretch"));
|
||||
fitToWidthRatioS = new QSlider(this);
|
||||
@ -81,6 +39,7 @@ OptionsDialog::OptionsDialog(QWidget * parent)
|
||||
fitToWidthRatioS->setMaximum(100);
|
||||
fitToWidthRatioS->setPageStep(5);
|
||||
fitToWidthRatioS->setOrientation(Qt::Horizontal);
|
||||
connect(fitToWidthRatioS,SIGNAL(valueChanged(int)),this,SLOT(fitToWidthRatio(int)));
|
||||
QHBoxLayout * fitLayout = new QHBoxLayout;
|
||||
fitLayout->addWidget(fitToWidthRatioS);
|
||||
fitBox->setLayout(fitLayout);
|
||||
@ -110,20 +69,17 @@ OptionsDialog::OptionsDialog(QWidget * parent)
|
||||
buttons->addWidget(cancel);
|
||||
|
||||
layout->addWidget(pathBox);
|
||||
//layout->addLayout(path);
|
||||
layout->addWidget(slideSizeBox);
|
||||
//layout->addWidget(slideSize);
|
||||
layout->addWidget(groupBox);
|
||||
//layout->addWidget(fitToWidthRatioLabel);
|
||||
layout->addWidget(fitBox);
|
||||
layout->addWidget(colorBox);
|
||||
//layout->addLayout(colorSelection);
|
||||
layout->addWidget(sw);
|
||||
layout->addWidget(gl);
|
||||
layout->addWidget(useGL);
|
||||
layout->addLayout(buttons);
|
||||
|
||||
|
||||
setLayout(layout);
|
||||
|
||||
restoreOptions(); //load options
|
||||
//restoreOptions(); //load options
|
||||
resize(400,0);
|
||||
setModal (true);
|
||||
setWindowTitle("Options");
|
||||
@ -143,11 +99,11 @@ void OptionsDialog::saveOptions()
|
||||
Configuration & conf = Configuration::getConfiguration();
|
||||
conf.setDefaultPath(pathEdit->text());
|
||||
conf.setGotoSlideSize(QSize(static_cast<int>(slideSize->sliderPosition()*SLIDE_ASPECT_RATIO),slideSize->sliderPosition()));
|
||||
if(radio1->isChecked())
|
||||
if(sw->radio1->isChecked())
|
||||
conf.setFlowType(PictureFlow::CoverFlowLike);
|
||||
if(radio2->isChecked())
|
||||
if(sw->radio2->isChecked())
|
||||
conf.setFlowType(PictureFlow::Strip);
|
||||
if(radio3->isChecked())
|
||||
if(sw->radio3->isChecked())
|
||||
conf.setFlowType(PictureFlow::StripOverlapped);
|
||||
conf.setFitToWidthRatio(fitToWidthRatioS->sliderPosition()/100.0);
|
||||
conf.setBackgroundColor(colorDialog->currentColor());
|
||||
@ -156,8 +112,10 @@ void OptionsDialog::saveOptions()
|
||||
emit(accepted());
|
||||
}
|
||||
|
||||
void OptionsDialog::restoreOptions()
|
||||
void OptionsDialog::restoreOptions(QSettings * settings)
|
||||
{
|
||||
YACReaderOptionsDialog::restoreOptions(settings);
|
||||
|
||||
Configuration & conf = Configuration::getConfiguration();
|
||||
|
||||
slideSize->setSliderPosition(conf.getGotoSlideSize().height());
|
||||
@ -166,13 +124,13 @@ void OptionsDialog::restoreOptions()
|
||||
updateColor(Configuration::getConfiguration().getBackgroundColor());
|
||||
switch(conf.getFlowType()){
|
||||
case PictureFlow::CoverFlowLike:
|
||||
radio1->setChecked(true);
|
||||
sw->radio1->setChecked(true);
|
||||
break;
|
||||
case PictureFlow::Strip:
|
||||
radio2->setChecked(true);
|
||||
sw->radio2->setChecked(true);
|
||||
break;
|
||||
case PictureFlow::StripOverlapped:
|
||||
radio3->setChecked(true);
|
||||
sw->radio3->setChecked(true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -185,4 +143,10 @@ void OptionsDialog::updateColor(const QColor & color)
|
||||
backgroundColor->setPalette(pal);
|
||||
backgroundColor->setAutoFillBackground(true);
|
||||
colorDialog->setCurrentColor(color);
|
||||
}
|
||||
|
||||
void OptionsDialog::fitToWidthRatio(int value)
|
||||
{
|
||||
Configuration::getConfiguration().setFitToWidthRatio(value/100.0);
|
||||
emit(fitToWidthRatioChanged(value/100.0));
|
||||
}
|
Reference in New Issue
Block a user