mirror of
https://github.com/YACReader/yacreader
synced 2025-07-19 05:24:57 -04:00
unificaci?n de las partes comunes en los di?logos de configuraci?n
This commit is contained in:
@ -279,6 +279,12 @@ void GoToFlow::updateSize() //TODO : fix. it doesn't work.
|
||||
imageSize = Configuration::getConfiguration().getGotoSlideSize();
|
||||
flow->setSlideSize(imageSize);
|
||||
resize(static_cast<int>(5*imageSize.width()),static_cast<int>(imageSize.height()*1.7));
|
||||
}
|
||||
|
||||
void GoToFlow::updateConfig(QSettings * settings)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
//SlideInitializer
|
||||
|
@ -58,6 +58,7 @@ private:
|
||||
void setImageReady(int index,const QByteArray & image);
|
||||
void setFlowType(PictureFlow::FlowType flowType);
|
||||
void updateSize();
|
||||
void updateConfig(QSettings * settings);
|
||||
signals:
|
||||
void goToPage(unsigned int page);
|
||||
|
||||
|
@ -26,6 +26,8 @@ void MainWindowViewer::loadConfiguration()
|
||||
|
||||
void MainWindowViewer::setupUI()
|
||||
{
|
||||
settings = new QSettings("YACReader.ini",QSettings::IniFormat);
|
||||
settings->beginGroup("config");
|
||||
|
||||
setWindowIcon(QIcon(":/images/icon.png"));
|
||||
|
||||
@ -59,7 +61,10 @@ void MainWindowViewer::setupUI()
|
||||
|
||||
optionsDialog = new OptionsDialog(this);
|
||||
connect(optionsDialog,SIGNAL(accepted()),viewer,SLOT(updateOptions()));
|
||||
connect(optionsDialog,SIGNAL(fitToWidthRatioChanged(float)),viewer,SLOT(updateFitToWidthRatio(float)));
|
||||
connect(optionsDialog, SIGNAL(optionsChanged()),this,SLOT(reloadOptions()));
|
||||
|
||||
optionsDialog->restoreOptions(settings);
|
||||
shortcutsDialog = new ShortcutsDialog(this);
|
||||
|
||||
createActions();
|
||||
@ -286,6 +291,22 @@ void MainWindowViewer::createToolBars()
|
||||
comicToolBar->addAction(alwaysOnTopAction);
|
||||
|
||||
comicToolBar->addSeparator();
|
||||
|
||||
//QWidget * widget = new QWidget();
|
||||
|
||||
//QToolButton * tbW = new QToolButton(widget);
|
||||
//tbW->addAction(adjustWidth);
|
||||
//tbW->setPopupMode(QToolButton::MenuButtonPopup);
|
||||
//tbW->setDefaultAction(adjustWidth);
|
||||
|
||||
//QHBoxLayout *layout = new QHBoxLayout;
|
||||
//layout->addWidget(tbW);
|
||||
//layout->setContentsMargins(0,0,0,0);
|
||||
//widget->setLayout(layout);
|
||||
//widget->setContentsMargins(0,0,0,0);
|
||||
|
||||
//comicToolBar->addWidget(widget);
|
||||
|
||||
comicToolBar->addAction(adjustWidth);
|
||||
comicToolBar->addAction(adjustToFullSizeAction);
|
||||
comicToolBar->addAction(leftRotationAction);
|
||||
@ -356,6 +377,11 @@ void MainWindowViewer::createToolBars()
|
||||
viewer->setContextMenuPolicy(Qt::ActionsContextMenu);
|
||||
}
|
||||
|
||||
void MainWindowViewer::reloadOptions()
|
||||
{
|
||||
viewer->updateConfig(settings);
|
||||
}
|
||||
|
||||
void MainWindowViewer::open()
|
||||
{
|
||||
QFileDialog openDialog;
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include <QKeyEvent>
|
||||
#include <QMouseEvent>
|
||||
#include <QCloseEvent>
|
||||
#include <QSettings>
|
||||
|
||||
class Comic;
|
||||
class Viewer;
|
||||
@ -41,6 +42,7 @@ class ShortcutsDialog;
|
||||
void openFolderFromPath(QString pathDir);
|
||||
void alwaysOnTopSwitch();
|
||||
void adjustToFullSizeSwitch();
|
||||
void reloadOptions();
|
||||
/*void viewComic();
|
||||
void prev();
|
||||
void next();
|
||||
@ -106,6 +108,7 @@ class ShortcutsDialog;
|
||||
void dropEvent(QDropEvent *event);
|
||||
void dragEnterEvent(QDragEnterEvent *event);
|
||||
|
||||
QSettings * settings;
|
||||
protected:
|
||||
virtual void closeEvent ( QCloseEvent * event );
|
||||
public:
|
||||
|
@ -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));
|
||||
}
|
@ -10,7 +10,9 @@
|
||||
#include <QRadioButton>
|
||||
#include <QColorDialog>
|
||||
|
||||
class OptionsDialog : public QDialog
|
||||
#include "custom_widgets.h"
|
||||
|
||||
class OptionsDialog : public YACReaderOptionsDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
@ -26,14 +28,7 @@ Q_OBJECT
|
||||
|
||||
//QLabel * slideSizeLabel;
|
||||
QSlider * slideSize;
|
||||
|
||||
QPushButton * accept;
|
||||
QPushButton * cancel;
|
||||
|
||||
QRadioButton *radio1;
|
||||
QRadioButton *radio2;
|
||||
QRadioButton *radio3;
|
||||
|
||||
|
||||
//QLabel * fitToWidthRatioLabel;
|
||||
QSlider * fitToWidthRatioS;
|
||||
|
||||
@ -44,12 +39,14 @@ Q_OBJECT
|
||||
|
||||
public slots:
|
||||
void saveOptions();
|
||||
void restoreOptions();
|
||||
void restoreOptions(QSettings * settings);
|
||||
void findFolder();
|
||||
void updateColor(const QColor & color);
|
||||
void fitToWidthRatio(int value);
|
||||
|
||||
signals:
|
||||
void changedOptions();
|
||||
void fitToWidthRatioChanged(float ratio);
|
||||
|
||||
};
|
||||
|
||||
|
@ -65,8 +65,16 @@ drag(false)
|
||||
showCursor();
|
||||
|
||||
goToDialog = new GoToDialog(this);
|
||||
|
||||
QSettings * settings = new QSettings("YACReader.ini",QSettings::IniFormat);
|
||||
settings->beginGroup("config");
|
||||
|
||||
//CONFIG GOTO_FLOW--------------------------------------------------------
|
||||
if(settings->contains("useOpenGL") && settings->value("useOpenGL").toBool() == true)
|
||||
goToFlow = new GoToFlowGL(this,Configuration::getConfiguration().getFlowType());
|
||||
else
|
||||
goToFlow = new GoToFlow(this,Configuration::getConfiguration().getFlowType());
|
||||
|
||||
goToFlow = new GoToFlowGL(this,Configuration::getConfiguration().getFlowType());
|
||||
goToFlow->hide();
|
||||
showGoToFlowAnimation = new QPropertyAnimation(goToFlow,"pos");
|
||||
showGoToFlowAnimation->setDuration(150);
|
||||
@ -673,4 +681,15 @@ void Viewer::mouseReleaseEvent ( QMouseEvent * event )
|
||||
{
|
||||
drag = false;
|
||||
setCursor(Qt::OpenHandCursor);
|
||||
}
|
||||
|
||||
void Viewer::updateFitToWidthRatio(float ratio)
|
||||
{
|
||||
adjustToWidthRatio = ratio;
|
||||
updateContentSize();
|
||||
}
|
||||
|
||||
void Viewer::updateConfig(QSettings * settings)
|
||||
{
|
||||
goToFlow->updateConfig(settings);
|
||||
}
|
@ -14,7 +14,7 @@
|
||||
#include <QMouseEvent>
|
||||
#include <QCloseEvent>
|
||||
#include <QPropertyAnimation>
|
||||
|
||||
#include <QSettings>
|
||||
|
||||
|
||||
class Comic;
|
||||
@ -71,6 +71,8 @@ class GoToFlowWidget;
|
||||
virtual void mousePressEvent ( QMouseEvent * event );
|
||||
virtual void mouseReleaseEvent ( QMouseEvent * event );
|
||||
void updateBackgroundColor(const QColor & color);
|
||||
void updateFitToWidthRatio(float ratio);
|
||||
void updateConfig(QSettings * settings);
|
||||
|
||||
private:
|
||||
bool information;
|
||||
|
Reference in New Issue
Block a user