unificaci?n de las partes comunes en los di?logos de configuraci?n

This commit is contained in:
Luis Ángel San Martín
2012-10-09 07:25:28 +02:00
parent 5d13a4812a
commit c760120e39
15 changed files with 724 additions and 662 deletions

View File

@ -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

View File

@ -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);

View File

@ -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;

View File

@ -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:

View File

@ -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;
}
}
@ -186,3 +144,9 @@ void OptionsDialog::updateColor(const QColor & color)
backgroundColor->setAutoFillBackground(true);
colorDialog->setCurrentColor(color);
}
void OptionsDialog::fitToWidthRatio(int value)
{
Configuration::getConfiguration().setFitToWidthRatio(value/100.0);
emit(fitToWidthRatioChanged(value/100.0));
}

View File

@ -10,7 +10,9 @@
#include <QRadioButton>
#include <QColorDialog>
class OptionsDialog : public QDialog
#include "custom_widgets.h"
class OptionsDialog : public YACReaderOptionsDialog
{
Q_OBJECT
public:
@ -27,13 +29,6 @@ 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);
};

View File

@ -66,7 +66,15 @@ drag(false)
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->hide();
showGoToFlowAnimation = new QPropertyAnimation(goToFlow,"pos");
showGoToFlowAnimation->setDuration(150);
@ -674,3 +682,14 @@ 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);
}

View File

@ -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;

View File

@ -44,7 +44,7 @@ HEADERS += comic_flow.h \
../YACReader/comic.h \
../YACReader/bookmarks.h \
server_config_dialog.h \
../common/comic_flow_widget.h \
comic_flow_widget.h \
../common/yacreader_flow_gl.h
SOURCES += comic_flow.cpp \
@ -77,7 +77,7 @@ SOURCES += comic_flow.cpp \
../YACReader/comic.cpp \
../YACReader/bookmarks.cpp \
server_config_dialog.cpp \
../common/comic_flow_widget.cpp \
comic_flow_widget.cpp \
../common/yacreader_flow_gl.cpp
include(./server/server.pri)

View File

@ -58,6 +58,7 @@ void LibraryWindow::doLayout()
comicFlow = new ComicFlowWidgetGL(0);
else
comicFlow = new ComicFlowWidgetSW(0);
//comicFlow->setFlowType(flowType);
comicFlow->updateConfig(settings);
comicFlow->setFocusPolicy(Qt::StrongFocus);

View File

@ -16,31 +16,15 @@
PictureFlow::FlowType flowType = PictureFlow::Strip;
OptionsDialog::OptionsDialog(QWidget * parent)
:QDialog()
:YACReaderOptionsDialog(parent)
{
QVBoxLayout * layout = new QVBoxLayout;
QLayout * layout1 = setupLayoutSW();
QLayout * layout2 = setupLayoutGL();
sw = new QWidget(this);
layout1->setContentsMargins(0,0,0,0);
sw->setLayout(layout1);
gl = new QWidget(this);
layout2->setContentsMargins(0,0,0,0);
gl->setLayout(layout2);
QHBoxLayout * switchFlowType = new QHBoxLayout;
switchFlowType->addStretch();
switchFlowType->addWidget(useGL = new QCheckBox(tr("Use hardware acceleration (restart needed)")));
switchFlowType->addWidget(useGL);
connect(useGL,SIGNAL(stateChanged(int)),this,SLOT(saveUseGL(int)));
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()));
QHBoxLayout * buttons = new QHBoxLayout();
buttons->addStretch();
@ -61,506 +45,4 @@ OptionsDialog::OptionsDialog(QWidget * parent)
setWindowTitle("Options");
}
QLayout * OptionsDialog::setupLayoutSW()
{
QVBoxLayout * layout = new QVBoxLayout(this);
QGroupBox *groupBox = new QGroupBox(tr("How to show covers:"));
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);
layout->addWidget(groupBox);
return layout;
}
QLayout * OptionsDialog::setupLayoutGL()
{
QVBoxLayout * layout = new QVBoxLayout(this);
//PRESETS------------------------------------------------------------------
QGroupBox *groupBox = new QGroupBox(tr("Presets:"));
radioClassic = new QRadioButton(tr("Classic look"));
connect(radioClassic,SIGNAL(toggled(bool)),this,SLOT(setClassicConfig()));
radioStripe = new QRadioButton(tr("Stripe look"));
connect(radioStripe,SIGNAL(toggled(bool)),this,SLOT(setStripeConfig()));
radioOver = new QRadioButton(tr("Overlapped Stripe look"));
connect(radioOver,SIGNAL(toggled(bool)),this,SLOT(setOverlappedStripeConfig()));
radionModern = new QRadioButton(tr("Modern look"));
connect(radionModern,SIGNAL(toggled(bool)),this,SLOT(setModernConfig()));
radioDown = new QRadioButton(tr("Roulette look"));
connect(radioDown,SIGNAL(toggled(bool)),this,SLOT(setRouletteConfig()));
QVBoxLayout *vbox = new QVBoxLayout;
QHBoxLayout * opt1 = new QHBoxLayout;
opt1->addWidget(radioClassic);
QLabel * lOpt1 = new QLabel();
lOpt1->setPixmap(QPixmap(":/images/flow1.png"));
opt1->addStretch();
opt1->addWidget(lOpt1);
vbox->addLayout(opt1);
QHBoxLayout * opt2 = new QHBoxLayout;
opt2->addWidget(radioStripe);
QLabel * lOpt2 = new QLabel();
lOpt2->setPixmap(QPixmap(":/images/flow2.png"));
opt2->addStretch();
opt2->addWidget(lOpt2);
vbox->addLayout(opt2);
QHBoxLayout * opt3 = new QHBoxLayout;
opt3->addWidget(radioOver);
QLabel * lOpt3 = new QLabel();
lOpt3->setPixmap(QPixmap(":/images/flow3.png"));
opt3->addStretch();
opt3->addWidget(lOpt3);
vbox->addLayout(opt3);
QHBoxLayout * opt4 = new QHBoxLayout;
opt4->addWidget(radionModern);
QLabel * lOpt4 = new QLabel();
lOpt4->setPixmap(QPixmap(":/images/flow3.png"));
opt4->addStretch();
opt4->addWidget(lOpt4);
vbox->addLayout(opt4);
QHBoxLayout * opt5 = new QHBoxLayout;
opt5->addWidget(radioDown);
QLabel * lOpt5 = new QLabel();
lOpt5->setPixmap(QPixmap(":/images/flow3.png"));
opt5->addStretch();
opt5->addWidget(lOpt5);
vbox->addLayout(opt5);
groupBox->setLayout(vbox);
//OPTIONS------------------------------------------------------------------
QGroupBox *optionsGroupBox = new QGroupBox(tr("Custom:"));
xRotation = new YACReaderSpinSliderWidget(this);
xRotation->setText(tr("View angle"));
xRotation->setRange(0,90);
connect(xRotation,SIGNAL(valueChanged(int)),this,SIGNAL(optionsChanged()));
connect(xRotation,SIGNAL(valueChanged(int)),this,SLOT(saveXRotation(int)));
yPosition = new YACReaderSpinSliderWidget(this);
yPosition->setText(tr("Position"));
yPosition->setRange(-100,100);
connect(yPosition,SIGNAL(valueChanged(int)),this,SIGNAL(optionsChanged()));
connect(yPosition,SIGNAL(valueChanged(int)),this,SLOT(saveYPosition(int)));
coverDistance = new YACReaderSpinSliderWidget(this);
coverDistance->setText(tr("Cover gap"));
coverDistance->setRange(0,150);
connect(coverDistance,SIGNAL(valueChanged(int)),this,SIGNAL(optionsChanged()));
connect(coverDistance,SIGNAL(valueChanged(int)),this,SLOT(saveCoverDistance(int)));
centralDistance = new YACReaderSpinSliderWidget(this);
centralDistance->setText(tr("Central gap"));
centralDistance->setRange(0,150);
connect(centralDistance,SIGNAL(valueChanged(int)),this,SIGNAL(optionsChanged()));
connect(centralDistance,SIGNAL(valueChanged(int)),this,SLOT(saveCentralDistance(int)));
zoomLevel = new YACReaderSpinSliderWidget(this);
zoomLevel->setText(tr("Zoom"));
zoomLevel->setRange(-20,0);
connect(zoomLevel,SIGNAL(valueChanged(int)),this,SIGNAL(optionsChanged()));
connect(zoomLevel,SIGNAL(valueChanged(int)),this,SLOT(saveZoomLevel(int)));
yCoverOffset = new YACReaderSpinSliderWidget(this);
yCoverOffset->setText(tr("Y offset"));
yCoverOffset->setRange(-50,50);
connect(yCoverOffset,SIGNAL(valueChanged(int)),this,SIGNAL(optionsChanged()));
connect(yCoverOffset,SIGNAL(valueChanged(int)),this,SLOT(saveYCoverOffset(int)));
zCoverOffset = new YACReaderSpinSliderWidget(this);
zCoverOffset->setText(tr("Z offset"));
zCoverOffset->setRange(-50,50);
connect(zCoverOffset,SIGNAL(valueChanged(int)),this,SIGNAL(optionsChanged()));
connect(zCoverOffset,SIGNAL(valueChanged(int)),this,SLOT(saveZCoverOffset(int)));
coverRotation = new YACReaderSpinSliderWidget(this);
coverRotation->setText(tr("Cover Angle"));
coverRotation->setRange(0,360);
connect(coverRotation,SIGNAL(valueChanged(int)),this,SIGNAL(optionsChanged()));
connect(coverRotation,SIGNAL(valueChanged(int)),this,SLOT(saveCoverRotation(int)));
fadeOutDist = new YACReaderSpinSliderWidget(this);
fadeOutDist->setText(tr("Visibility"));
fadeOutDist->setRange(0,10);
connect(fadeOutDist,SIGNAL(valueChanged(int)),this,SIGNAL(optionsChanged()));
connect(fadeOutDist,SIGNAL(valueChanged(int)),this,SLOT(saveFadeOutDist(int)));
lightStrength = new YACReaderSpinSliderWidget(this);
lightStrength->setText(tr("Light"));
lightStrength->setRange(-10,10);
connect(lightStrength,SIGNAL(valueChanged(int)),this,SIGNAL(optionsChanged()));
connect(lightStrength,SIGNAL(valueChanged(int)),this,SLOT(saveLightStrength(int)));
maxAngle = new YACReaderSpinSliderWidget(this);
maxAngle->setText(tr("Max angle"));
maxAngle->setRange(0,90);
connect(maxAngle,SIGNAL(valueChanged(int)),this,SIGNAL(optionsChanged()));
connect(maxAngle,SIGNAL(valueChanged(int)),this,SLOT(saveMaxAngle(int)));
QVBoxLayout *optionsLayoutStretch = new QVBoxLayout;
optionsLayoutStretch->setContentsMargins(0,0,0,0);
QGridLayout *optionsLayout = new QGridLayout;
optionsLayout->addWidget(xRotation,0,0);
optionsLayout->addWidget(yPosition,0,1);
optionsLayout->addWidget(coverDistance,1,0);
optionsLayout->addWidget(centralDistance,1,1);
optionsLayout->addWidget(zoomLevel,2,0);
optionsLayout->addWidget(yCoverOffset,2,1);
optionsLayout->addWidget(zCoverOffset,3,0);
optionsLayout->addWidget(coverRotation,3,1);
optionsLayout->addWidget(fadeOutDist,4,0);
optionsLayout->addWidget(lightStrength,4,1);
optionsLayout->addWidget(maxAngle,5,0);
optionsLayoutStretch->addLayout(optionsLayout);
optionsLayoutStretch->addStretch();
optionsGroupBox->setLayout(optionsLayoutStretch);
QHBoxLayout * groupBoxesLayout = new QHBoxLayout;
groupBoxesLayout->addWidget(groupBox);
groupBoxesLayout->addWidget(optionsGroupBox);
QHBoxLayout * performance = new QHBoxLayout;
performance->addWidget(new QLabel(tr("Low Performance")));
performance->addWidget(performanceSlider = new QSlider(Qt::Horizontal));
performance->addWidget(new QLabel(tr("High Performance")));
performanceSlider->setMinimum(0);
performanceSlider->setMaximum(3);
performanceSlider->setSingleStep(1);
performanceSlider->setPageStep(1);
performanceSlider->setTickInterval(1);
performanceSlider->setTickPosition(QSlider::TicksRight);
connect(performanceSlider, SIGNAL(valueChanged(int)),this,SLOT(savePerformance(int)));
connect(performanceSlider, SIGNAL(valueChanged(int)),this,SLOT(optionsChanged()));
layout->addLayout(groupBoxesLayout);
layout->addLayout(performance);
return layout;
}
void OptionsDialog::savePerformance(int value)
{
settings->setValue("performance",value);
}
void OptionsDialog::saveUseGL(int b)
{
if(Qt::Checked == b)
{
sw->setVisible(false);
gl->setVisible(true);
}
else
{
gl->setVisible(false);
sw->setVisible(true);
}
resize(0,0);
settings->setValue("useOpenGL",b);
}
void OptionsDialog::saveXRotation(int value)
{
settings->setValue("flowType",PictureFlow::Custom);
settings->setValue("xRotation",xRotation->getValue());
}
void OptionsDialog::saveYPosition(int value)
{
settings->setValue("flowType",PictureFlow::Custom);
settings->setValue("yPosition",yPosition->getValue());
}
void OptionsDialog::saveCoverDistance(int value)
{
settings->setValue("flowType",PictureFlow::Custom);
settings->setValue("coverDistance",coverDistance->getValue());
}
void OptionsDialog::saveCentralDistance(int value)
{
settings->setValue("flowType",PictureFlow::Custom);
settings->setValue("centralDistance",centralDistance->getValue());
}
void OptionsDialog::saveZoomLevel(int value)
{
settings->setValue("flowType",PictureFlow::Custom);
settings->setValue("zoomLevel",zoomLevel->getValue());
}
void OptionsDialog::saveYCoverOffset(int value)
{
settings->setValue("flowType",PictureFlow::Custom);
settings->setValue("yCoverOffset",yCoverOffset->getValue());
}
void OptionsDialog::saveZCoverOffset(int value)
{
settings->setValue("flowType",PictureFlow::Custom);
settings->setValue("zCoverOffset",zCoverOffset->getValue());
}
void OptionsDialog::saveCoverRotation(int value)
{
settings->setValue("flowType",PictureFlow::Custom);
settings->setValue("coverRotation",coverRotation->getValue());
}
void OptionsDialog::saveFadeOutDist(int value)
{
settings->setValue("flowType",PictureFlow::Custom);
settings->setValue("fadeOutDist",fadeOutDist->getValue());
}
void OptionsDialog::saveLightStrength(int value)
{
settings->setValue("flowType",PictureFlow::Custom);
settings->setValue("lightStrength",lightStrength->getValue());
}
void OptionsDialog::saveMaxAngle(int value)
{
settings->setValue("flowType",PictureFlow::Custom);
settings->setValue("maxAngle",maxAngle->getValue());
}
void OptionsDialog::saveOptions()
{
emit(optionsChanged());
close();
}
void OptionsDialog::restoreOptions(QSettings * settings)
{
this->settings = settings;
if(settings->contains("useOpenGL") && settings->value("useOpenGL").toInt() == Qt::Checked)
{
sw->setVisible(false);
gl->setVisible(true);
useGL->setChecked(true);
}
else
{
gl->setVisible(false);
sw->setVisible(true);
useGL->setChecked(false);
}
if(!settings->contains("flowType"))
{
setClassicConfig();
radioClassic->setChecked(true);
performanceSlider->setValue(1);
return;
}
performanceSlider->setValue(settings->value("performance").toInt());
PictureFlow::FlowType flowType;
switch(settings->value("flowType").toInt())
{
case 0:
flowType = PictureFlow::CoverFlowLike;
break;
case 1:
flowType = PictureFlow::Strip;
break;
case 2:
flowType = PictureFlow::StripOverlapped;
break;
case 3:
flowType = PictureFlow::Modern;
break;
case 4:
flowType = PictureFlow::Roulette;
break;
case 5:
flowType = PictureFlow::Custom;
break;
}
if(flowType == PictureFlow::Custom)
{
loadConfig();
return;
}
if(flowType == PictureFlow::CoverFlowLike)
{
setClassicConfig();
radioClassic->setChecked(true);
return;
}
if(flowType == PictureFlow::Strip)
{
setStripeConfig();
radioStripe->setChecked(true);
return;
}
if(flowType == PictureFlow::StripOverlapped)
{
setOverlappedStripeConfig();
radioOver->setChecked(true);
return;
}
if(flowType == PictureFlow::Modern)
{
setModernConfig();
radionModern->setChecked(true);
return;
}
if(flowType == PictureFlow::Roulette)
{
setRouletteConfig();
radioDown->setChecked(true);
return;
}
}
void OptionsDialog::loadConfig()
{
xRotation->setValue(settings->value("xRotation").toInt());
yPosition->setValue(settings->value("yPosition").toInt());
coverDistance->setValue(settings->value("coverDistance").toInt());
centralDistance->setValue(settings->value("centralDistance").toInt());
zoomLevel->setValue(settings->value("zoomLevel").toInt());
yCoverOffset->setValue(settings->value("yCoverOffset").toInt());
zCoverOffset->setValue(settings->value("zCoverOffset").toInt());
coverRotation->setValue(settings->value("coverRotation").toInt());
fadeOutDist->setValue(settings->value("fadeOutDist").toInt());
lightStrength->setValue(settings->value("lightStrength").toInt());
maxAngle->setValue(settings->value("maxAngle").toInt());
}
void OptionsDialog::setClassicConfig()
{
settings->setValue("flowType",PictureFlow::CoverFlowLike);
xRotation->setValue(presetYACReaderFlowClassicConfig.cfRX);
yPosition->setValue(presetYACReaderFlowClassicConfig.cfY*100);
coverDistance->setValue(presetYACReaderFlowClassicConfig.xDistance*100);
centralDistance->setValue(presetYACReaderFlowClassicConfig.centerDistance*100);
zoomLevel->setValue(presetYACReaderFlowClassicConfig.cfZ);
yCoverOffset->setValue(presetYACReaderFlowClassicConfig.yDistance*100);
zCoverOffset->setValue(presetYACReaderFlowClassicConfig.zDistance*100);
coverRotation->setValue(presetYACReaderFlowClassicConfig.rotation*-1);
fadeOutDist->setValue(presetYACReaderFlowClassicConfig.animationFadeOutDist);
lightStrength->setValue(presetYACReaderFlowClassicConfig.viewRotateLightStrenght);
maxAngle->setValue(presetYACReaderFlowClassicConfig.viewAngle);
}
void OptionsDialog::setStripeConfig()
{
settings->setValue("flowType",PictureFlow::Strip);
xRotation->setValue(presetYACReaderFlowStripeConfig.cfRX);
yPosition->setValue(presetYACReaderFlowStripeConfig.cfY*100);
coverDistance->setValue(presetYACReaderFlowStripeConfig.xDistance*100);
centralDistance->setValue(presetYACReaderFlowStripeConfig.centerDistance*100);
zoomLevel->setValue(presetYACReaderFlowStripeConfig.cfZ);
yCoverOffset->setValue(presetYACReaderFlowStripeConfig.yDistance*100);
zCoverOffset->setValue(presetYACReaderFlowStripeConfig.zDistance*100);
coverRotation->setValue(presetYACReaderFlowStripeConfig.rotation*-1);
fadeOutDist->setValue(presetYACReaderFlowStripeConfig.animationFadeOutDist);
lightStrength->setValue(presetYACReaderFlowStripeConfig.viewRotateLightStrenght);
maxAngle->setValue(presetYACReaderFlowStripeConfig.viewAngle);
}
void OptionsDialog::setOverlappedStripeConfig()
{
settings->setValue("flowType",PictureFlow::StripOverlapped);
xRotation->setValue(presetYACReaderFlowOverlappedStripeConfig.cfRX);
yPosition->setValue(presetYACReaderFlowOverlappedStripeConfig.cfY*100);
coverDistance->setValue(presetYACReaderFlowOverlappedStripeConfig.xDistance*100);
centralDistance->setValue(presetYACReaderFlowOverlappedStripeConfig.centerDistance*100);
zoomLevel->setValue(presetYACReaderFlowOverlappedStripeConfig.cfZ);
yCoverOffset->setValue(presetYACReaderFlowOverlappedStripeConfig.yDistance*100);
zCoverOffset->setValue(presetYACReaderFlowOverlappedStripeConfig.zDistance*100);
coverRotation->setValue(presetYACReaderFlowOverlappedStripeConfig.rotation*-1);
fadeOutDist->setValue(presetYACReaderFlowOverlappedStripeConfig.animationFadeOutDist);
lightStrength->setValue(presetYACReaderFlowOverlappedStripeConfig.viewRotateLightStrenght);
maxAngle->setValue(presetYACReaderFlowOverlappedStripeConfig.viewAngle);
}
void OptionsDialog::setModernConfig()
{
settings->setValue("flowType",PictureFlow::Modern);
xRotation->setValue(defaultYACReaderFlowConfig.cfRX);
yPosition->setValue(defaultYACReaderFlowConfig.cfY*100);
coverDistance->setValue(defaultYACReaderFlowConfig.xDistance*100);
centralDistance->setValue(defaultYACReaderFlowConfig.centerDistance*100);
zoomLevel->setValue(defaultYACReaderFlowConfig.cfZ);
yCoverOffset->setValue(defaultYACReaderFlowConfig.yDistance*100);
zCoverOffset->setValue(defaultYACReaderFlowConfig.zDistance*100);
coverRotation->setValue(defaultYACReaderFlowConfig.rotation*-1);
fadeOutDist->setValue(defaultYACReaderFlowConfig.animationFadeOutDist);
lightStrength->setValue(defaultYACReaderFlowConfig.viewRotateLightStrenght);
maxAngle->setValue(defaultYACReaderFlowConfig.viewAngle);
}
void OptionsDialog::setRouletteConfig()
{
settings->setValue("flowType",PictureFlow::Roulette);
xRotation->setValue(pressetYACReaderFlowDownConfig.cfRX);
yPosition->setValue(pressetYACReaderFlowDownConfig.cfY*100);
coverDistance->setValue(pressetYACReaderFlowDownConfig.xDistance*100);
centralDistance->setValue(pressetYACReaderFlowDownConfig.centerDistance*100);
zoomLevel->setValue(pressetYACReaderFlowDownConfig.cfZ);
yCoverOffset->setValue(pressetYACReaderFlowDownConfig.yDistance*100);
zCoverOffset->setValue(pressetYACReaderFlowDownConfig.zDistance*100);
coverRotation->setValue(pressetYACReaderFlowDownConfig.rotation*-1);
fadeOutDist->setValue(pressetYACReaderFlowDownConfig.animationFadeOutDist);
lightStrength->setValue(pressetYACReaderFlowDownConfig.viewRotateLightStrenght);
maxAngle->setValue(pressetYACReaderFlowDownConfig.viewAngle);
}

View File

@ -16,80 +16,11 @@
extern PictureFlow::FlowType flowType;
class OptionsDialog : public QDialog
class OptionsDialog : public YACReaderOptionsDialog
{
Q_OBJECT
public:
OptionsDialog(QWidget * parent = 0);
private:
QPushButton * accept;
QPushButton * cancel;
QCheckBox * useGL;
//SW.........................
QRadioButton *radio1;
QRadioButton *radio2;
QRadioButton *radio3;
//GL.........................
QRadioButton *radioClassic;
QRadioButton *radioStripe;
QRadioButton *radioOver;
QRadioButton *radionModern;
QRadioButton *radioDown;
YACReaderSpinSliderWidget * xRotation;
YACReaderSpinSliderWidget * yPosition;
YACReaderSpinSliderWidget * coverDistance;
YACReaderSpinSliderWidget * centralDistance;
YACReaderSpinSliderWidget * zoomLevel;
YACReaderSpinSliderWidget * yCoverOffset;
YACReaderSpinSliderWidget * zCoverOffset;
YACReaderSpinSliderWidget * coverRotation;
YACReaderSpinSliderWidget * fadeOutDist;
YACReaderSpinSliderWidget * lightStrength;
YACReaderSpinSliderWidget * maxAngle;
QSlider * performanceSlider;
QWidget * sw;
QWidget * gl;
QLayout * setupLayoutSW();
QLayout * setupLayoutGL();
QSettings * settings;
QSettings * previousSettings;
private slots:
void savePerformance(int value);
void saveUseGL(int b);
void saveXRotation(int value);
void saveYPosition(int value);
void saveCoverDistance(int value);
void saveCentralDistance(int value);
void saveZoomLevel(int value);
void saveYCoverOffset(int value);
void saveZCoverOffset(int value);
void saveCoverRotation(int value);
void saveFadeOutDist(int value);
void saveLightStrength(int value);
void saveMaxAngle(int value);
void loadConfig();
void setClassicConfig();
void setStripeConfig();
void setOverlappedStripeConfig();
void setModernConfig();
void setRouletteConfig();
public slots:
void saveOptions();
void restoreOptions(QSettings * settings);
signals:
void optionsChanged();
};

View File

@ -516,3 +516,543 @@ QSize YACReaderSpinSliderWidget::minimumSizeHint() const
{
return QSize(220, 25);
}
//----------------------------------------------------------------------------
YACReaderOptionsDialog::YACReaderOptionsDialog(QWidget * parent)
:QDialog(parent)
{
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()));
sw = new YACReaderFlowConfigWidget(this);
gl = new YACReaderGLFlowConfigWidget(this);
useGL = useGL = new QCheckBox(tr("Use hardware acceleration (restart needed)"));
connect(useGL,SIGNAL(stateChanged(int)),this,SLOT(saveUseGL(int)));
//gl CONNECTIONS
connect(gl->radioClassic,SIGNAL(toggled(bool)),this,SLOT(setClassicConfig()));
connect(gl->radioStripe,SIGNAL(toggled(bool)),this,SLOT(setStripeConfig()));
connect(gl->radioOver,SIGNAL(toggled(bool)),this,SLOT(setOverlappedStripeConfig()));
connect(gl->radionModern,SIGNAL(toggled(bool)),this,SLOT(setModernConfig()));
connect(gl->radioDown,SIGNAL(toggled(bool)),this,SLOT(setRouletteConfig()));
connect(gl->xRotation,SIGNAL(valueChanged(int)),this,SIGNAL(optionsChanged()));
connect(gl->xRotation,SIGNAL(valueChanged(int)),this,SLOT(saveXRotation(int)));
connect(gl->yPosition,SIGNAL(valueChanged(int)),this,SIGNAL(optionsChanged()));
connect(gl->yPosition,SIGNAL(valueChanged(int)),this,SLOT(saveYPosition(int)));
connect(gl->coverDistance,SIGNAL(valueChanged(int)),this,SIGNAL(optionsChanged()));
connect(gl->coverDistance,SIGNAL(valueChanged(int)),this,SLOT(saveCoverDistance(int)));
connect(gl->centralDistance,SIGNAL(valueChanged(int)),this,SIGNAL(optionsChanged()));
connect(gl->centralDistance,SIGNAL(valueChanged(int)),this,SLOT(saveCentralDistance(int)));
connect(gl->zoomLevel,SIGNAL(valueChanged(int)),this,SIGNAL(optionsChanged()));
connect(gl->zoomLevel,SIGNAL(valueChanged(int)),this,SLOT(saveZoomLevel(int)));
connect(gl->yCoverOffset,SIGNAL(valueChanged(int)),this,SIGNAL(optionsChanged()));
connect(gl->yCoverOffset,SIGNAL(valueChanged(int)),this,SLOT(saveYCoverOffset(int)));
connect(gl->zCoverOffset,SIGNAL(valueChanged(int)),this,SIGNAL(optionsChanged()));
connect(gl->zCoverOffset,SIGNAL(valueChanged(int)),this,SLOT(saveZCoverOffset(int)));
connect(gl->coverRotation,SIGNAL(valueChanged(int)),this,SIGNAL(optionsChanged()));
connect(gl->coverRotation,SIGNAL(valueChanged(int)),this,SLOT(saveCoverRotation(int)));
connect(gl->fadeOutDist,SIGNAL(valueChanged(int)),this,SIGNAL(optionsChanged()));
connect(gl->fadeOutDist,SIGNAL(valueChanged(int)),this,SLOT(saveFadeOutDist(int)));
connect(gl->lightStrength,SIGNAL(valueChanged(int)),this,SIGNAL(optionsChanged()));
connect(gl->lightStrength,SIGNAL(valueChanged(int)),this,SLOT(saveLightStrength(int)));
connect(gl->maxAngle,SIGNAL(valueChanged(int)),this,SIGNAL(optionsChanged()));
connect(gl->maxAngle,SIGNAL(valueChanged(int)),this,SLOT(saveMaxAngle(int)));
connect(gl->performanceSlider, SIGNAL(valueChanged(int)),this,SLOT(savePerformance(int)));
connect(gl->performanceSlider, SIGNAL(valueChanged(int)),this,SLOT(optionsChanged()));
}
void YACReaderOptionsDialog::savePerformance(int value)
{
settings->setValue("performance",value);
}
void YACReaderOptionsDialog::saveOptions()
{
emit(optionsChanged());
close();
}
void YACReaderOptionsDialog::saveUseGL(int b)
{
if(Qt::Checked == b)
{
sw->setVisible(false);
gl->setVisible(true);
}
else
{
gl->setVisible(false);
sw->setVisible(true);
}
resize(0,0);
settings->setValue("useOpenGL",b);
}
void YACReaderOptionsDialog::saveXRotation(int value)
{
settings->setValue("flowType",PictureFlow::Custom);
settings->setValue("xRotation",gl->xRotation->getValue());
}
void YACReaderOptionsDialog::saveYPosition(int value)
{
settings->setValue("flowType",PictureFlow::Custom);
settings->setValue("yPosition",gl->yPosition->getValue());
}
void YACReaderOptionsDialog::saveCoverDistance(int value)
{
settings->setValue("flowType",PictureFlow::Custom);
settings->setValue("coverDistance",gl->coverDistance->getValue());
}
void YACReaderOptionsDialog::saveCentralDistance(int value)
{
settings->setValue("flowType",PictureFlow::Custom);
settings->setValue("centralDistance",gl->centralDistance->getValue());
}
void YACReaderOptionsDialog::saveZoomLevel(int value)
{
settings->setValue("flowType",PictureFlow::Custom);
settings->setValue("zoomLevel",gl->zoomLevel->getValue());
}
void YACReaderOptionsDialog::saveYCoverOffset(int value)
{
settings->setValue("flowType",PictureFlow::Custom);
settings->setValue("yCoverOffset",gl->yCoverOffset->getValue());
}
void YACReaderOptionsDialog::saveZCoverOffset(int value)
{
settings->setValue("flowType",PictureFlow::Custom);
settings->setValue("zCoverOffset",gl->zCoverOffset->getValue());
}
void YACReaderOptionsDialog::saveCoverRotation(int value)
{
settings->setValue("flowType",PictureFlow::Custom);
settings->setValue("coverRotation",gl->coverRotation->getValue());
}
void YACReaderOptionsDialog::saveFadeOutDist(int value)
{
settings->setValue("flowType",PictureFlow::Custom);
settings->setValue("fadeOutDist",gl->fadeOutDist->getValue());
}
void YACReaderOptionsDialog::saveLightStrength(int value)
{
settings->setValue("flowType",PictureFlow::Custom);
settings->setValue("lightStrength",gl->lightStrength->getValue());
}
void YACReaderOptionsDialog::saveMaxAngle(int value)
{
settings->setValue("flowType",PictureFlow::Custom);
settings->setValue("maxAngle",gl->maxAngle->getValue());
}
void YACReaderOptionsDialog::restoreOptions(QSettings * settings)
{
this->settings = settings;
if(settings->contains("useOpenGL") && settings->value("useOpenGL").toInt() == Qt::Checked)
{
sw->setVisible(false);
gl->setVisible(true);
useGL->setChecked(true);
}
else
{
gl->setVisible(false);
sw->setVisible(true);
useGL->setChecked(false);
}
if(!settings->contains("flowType"))
{
setClassicConfig();
gl->radioClassic->setChecked(true);
gl->performanceSlider->setValue(1);
return;
}
gl->performanceSlider->setValue(settings->value("performance").toInt());
PictureFlow::FlowType flowType;
switch(settings->value("flowType").toInt())
{
case 0:
flowType = PictureFlow::CoverFlowLike;
break;
case 1:
flowType = PictureFlow::Strip;
break;
case 2:
flowType = PictureFlow::StripOverlapped;
break;
case 3:
flowType = PictureFlow::Modern;
break;
case 4:
flowType = PictureFlow::Roulette;
break;
case 5:
flowType = PictureFlow::Custom;
break;
}
if(flowType == PictureFlow::Custom)
{
loadConfig();
return;
}
if(flowType == PictureFlow::CoverFlowLike)
{
setClassicConfig();
gl->radioClassic->setChecked(true);
return;
}
if(flowType == PictureFlow::Strip)
{
setStripeConfig();
gl->radioStripe->setChecked(true);
return;
}
if(flowType == PictureFlow::StripOverlapped)
{
setOverlappedStripeConfig();
gl->radioOver->setChecked(true);
return;
}
if(flowType == PictureFlow::Modern)
{
setModernConfig();
gl->radionModern->setChecked(true);
return;
}
if(flowType == PictureFlow::Roulette)
{
setRouletteConfig();
gl->radioDown->setChecked(true);
return;
}
}
void YACReaderOptionsDialog::loadConfig()
{
gl->xRotation->setValue(settings->value("xRotation").toInt());
gl->yPosition->setValue(settings->value("yPosition").toInt());
gl->coverDistance->setValue(settings->value("coverDistance").toInt());
gl->centralDistance->setValue(settings->value("centralDistance").toInt());
gl->zoomLevel->setValue(settings->value("zoomLevel").toInt());
gl->yCoverOffset->setValue(settings->value("yCoverOffset").toInt());
gl->zCoverOffset->setValue(settings->value("zCoverOffset").toInt());
gl->coverRotation->setValue(settings->value("coverRotation").toInt());
gl->fadeOutDist->setValue(settings->value("fadeOutDist").toInt());
gl->lightStrength->setValue(settings->value("lightStrength").toInt());
gl->maxAngle->setValue(settings->value("maxAngle").toInt());
}
void YACReaderOptionsDialog::setClassicConfig()
{
settings->setValue("flowType",PictureFlow::CoverFlowLike);
gl->setValues(presetYACReaderFlowClassicConfig);
}
void YACReaderOptionsDialog::setStripeConfig()
{
settings->setValue("flowType",PictureFlow::Strip);
gl->setValues(presetYACReaderFlowStripeConfig);
}
void YACReaderOptionsDialog::setOverlappedStripeConfig()
{
settings->setValue("flowType",PictureFlow::StripOverlapped);
gl->setValues(presetYACReaderFlowOverlappedStripeConfig);
}
void YACReaderOptionsDialog::setModernConfig()
{
settings->setValue("flowType",PictureFlow::Modern);
gl->setValues(defaultYACReaderFlowConfig);
}
void YACReaderOptionsDialog::setRouletteConfig()
{
settings->setValue("flowType",PictureFlow::Roulette);
gl->setValues(pressetYACReaderFlowDownConfig);
}
///----------------------------------------------------------
YACReaderGLFlowConfigWidget::YACReaderGLFlowConfigWidget(QWidget * parent /* = 0 */)
:QWidget(parent)
{
QVBoxLayout * layout = new QVBoxLayout(this);
//PRESETS------------------------------------------------------------------
QGroupBox *groupBox = new QGroupBox(tr("Presets:"));
radioClassic = new QRadioButton(tr("Classic look"));
connect(radioClassic,SIGNAL(toggled(bool)),this,SLOT(setClassicConfig()));
radioStripe = new QRadioButton(tr("Stripe look"));
connect(radioStripe,SIGNAL(toggled(bool)),this,SLOT(setStripeConfig()));
radioOver = new QRadioButton(tr("Overlapped Stripe look"));
connect(radioOver,SIGNAL(toggled(bool)),this,SLOT(setOverlappedStripeConfig()));
radionModern = new QRadioButton(tr("Modern look"));
connect(radionModern,SIGNAL(toggled(bool)),this,SLOT(setModernConfig()));
radioDown = new QRadioButton(tr("Roulette look"));
connect(radioDown,SIGNAL(toggled(bool)),this,SLOT(setRouletteConfig()));
QVBoxLayout *vbox = new QVBoxLayout;
QHBoxLayout * opt1 = new QHBoxLayout;
opt1->addWidget(radioClassic);
QLabel * lOpt1 = new QLabel();
lOpt1->setPixmap(QPixmap(":/images/flow1.png"));
opt1->addStretch();
opt1->addWidget(lOpt1);
vbox->addLayout(opt1);
QHBoxLayout * opt2 = new QHBoxLayout;
opt2->addWidget(radioStripe);
QLabel * lOpt2 = new QLabel();
lOpt2->setPixmap(QPixmap(":/images/flow2.png"));
opt2->addStretch();
opt2->addWidget(lOpt2);
vbox->addLayout(opt2);
QHBoxLayout * opt3 = new QHBoxLayout;
opt3->addWidget(radioOver);
QLabel * lOpt3 = new QLabel();
lOpt3->setPixmap(QPixmap(":/images/flow3.png"));
opt3->addStretch();
opt3->addWidget(lOpt3);
vbox->addLayout(opt3);
QHBoxLayout * opt4 = new QHBoxLayout;
opt4->addWidget(radionModern);
QLabel * lOpt4 = new QLabel();
lOpt4->setPixmap(QPixmap(":/images/flow3.png"));
opt4->addStretch();
opt4->addWidget(lOpt4);
vbox->addLayout(opt4);
QHBoxLayout * opt5 = new QHBoxLayout;
opt5->addWidget(radioDown);
QLabel * lOpt5 = new QLabel();
lOpt5->setPixmap(QPixmap(":/images/flow3.png"));
opt5->addStretch();
opt5->addWidget(lOpt5);
vbox->addLayout(opt5);
groupBox->setLayout(vbox);
//OPTIONS------------------------------------------------------------------
QGroupBox *optionsGroupBox = new QGroupBox(tr("Custom:"));
xRotation = new YACReaderSpinSliderWidget(this);
xRotation->setText(tr("View angle"));
xRotation->setRange(0,90);
//connect(xRotation,SIGNAL(valueChanged(int)),this,SIGNAL(optionsChanged()));
//connect(xRotation,SIGNAL(valueChanged(int)),this,SLOT(saveXRotation(int)));
yPosition = new YACReaderSpinSliderWidget(this);
yPosition->setText(tr("Position"));
yPosition->setRange(-100,100);
//connect(yPosition,SIGNAL(valueChanged(int)),this,SIGNAL(optionsChanged()));
//connect(yPosition,SIGNAL(valueChanged(int)),this,SLOT(saveYPosition(int)));
coverDistance = new YACReaderSpinSliderWidget(this);
coverDistance->setText(tr("Cover gap"));
coverDistance->setRange(0,150);
//connect(coverDistance,SIGNAL(valueChanged(int)),this,SIGNAL(optionsChanged()));
//connect(coverDistance,SIGNAL(valueChanged(int)),this,SLOT(saveCoverDistance(int)));
centralDistance = new YACReaderSpinSliderWidget(this);
centralDistance->setText(tr("Central gap"));
centralDistance->setRange(0,150);
//connect(centralDistance,SIGNAL(valueChanged(int)),this,SIGNAL(optionsChanged()));
//connect(centralDistance,SIGNAL(valueChanged(int)),this,SLOT(saveCentralDistance(int)));
zoomLevel = new YACReaderSpinSliderWidget(this);
zoomLevel->setText(tr("Zoom"));
zoomLevel->setRange(-20,0);
//connect(zoomLevel,SIGNAL(valueChanged(int)),this,SIGNAL(optionsChanged()));
//connect(zoomLevel,SIGNAL(valueChanged(int)),this,SLOT(saveZoomLevel(int)));
yCoverOffset = new YACReaderSpinSliderWidget(this);
yCoverOffset->setText(tr("Y offset"));
yCoverOffset->setRange(-50,50);
//connect(yCoverOffset,SIGNAL(valueChanged(int)),this,SIGNAL(optionsChanged()));
//connect(yCoverOffset,SIGNAL(valueChanged(int)),this,SLOT(saveYCoverOffset(int)));
zCoverOffset = new YACReaderSpinSliderWidget(this);
zCoverOffset->setText(tr("Z offset"));
zCoverOffset->setRange(-50,50);
//connect(zCoverOffset,SIGNAL(valueChanged(int)),this,SIGNAL(optionsChanged()));
//connect(zCoverOffset,SIGNAL(valueChanged(int)),this,SLOT(saveZCoverOffset(int)));
coverRotation = new YACReaderSpinSliderWidget(this);
coverRotation->setText(tr("Cover Angle"));
coverRotation->setRange(0,360);
//connect(coverRotation,SIGNAL(valueChanged(int)),this,SIGNAL(optionsChanged()));
//connect(coverRotation,SIGNAL(valueChanged(int)),this,SLOT(saveCoverRotation(int)));
fadeOutDist = new YACReaderSpinSliderWidget(this);
fadeOutDist->setText(tr("Visibility"));
fadeOutDist->setRange(0,10);
//connect(fadeOutDist,SIGNAL(valueChanged(int)),this,SIGNAL(optionsChanged()));
//connect(fadeOutDist,SIGNAL(valueChanged(int)),this,SLOT(saveFadeOutDist(int)));
lightStrength = new YACReaderSpinSliderWidget(this);
lightStrength->setText(tr("Light"));
lightStrength->setRange(-10,10);
//connect(lightStrength,SIGNAL(valueChanged(int)),this,SIGNAL(optionsChanged()));
//connect(lightStrength,SIGNAL(valueChanged(int)),this,SLOT(saveLightStrength(int)));
maxAngle = new YACReaderSpinSliderWidget(this);
maxAngle->setText(tr("Max angle"));
maxAngle->setRange(0,90);
//connect(maxAngle,SIGNAL(valueChanged(int)),this,SIGNAL(optionsChanged()));
//connect(maxAngle,SIGNAL(valueChanged(int)),this,SLOT(saveMaxAngle(int)));
QVBoxLayout *optionsLayoutStretch = new QVBoxLayout;
optionsLayoutStretch->setContentsMargins(0,0,0,0);
QGridLayout *optionsLayout = new QGridLayout;
optionsLayout->addWidget(xRotation,0,0);
optionsLayout->addWidget(yPosition,0,1);
optionsLayout->addWidget(coverDistance,1,0);
optionsLayout->addWidget(centralDistance,1,1);
optionsLayout->addWidget(zoomLevel,2,0);
optionsLayout->addWidget(yCoverOffset,2,1);
optionsLayout->addWidget(zCoverOffset,3,0);
optionsLayout->addWidget(coverRotation,3,1);
optionsLayout->addWidget(fadeOutDist,4,0);
optionsLayout->addWidget(lightStrength,4,1);
optionsLayout->addWidget(maxAngle,5,0);
optionsLayoutStretch->addLayout(optionsLayout);
optionsLayoutStretch->addStretch();
optionsGroupBox->setLayout(optionsLayoutStretch);
QHBoxLayout * groupBoxesLayout = new QHBoxLayout;
groupBoxesLayout->addWidget(groupBox);
groupBoxesLayout->addWidget(optionsGroupBox);
QHBoxLayout * performance = new QHBoxLayout;
performance->addWidget(new QLabel(tr("Low Performance")));
performance->addWidget(performanceSlider = new QSlider(Qt::Horizontal));
performance->addWidget(new QLabel(tr("High Performance")));
performanceSlider->setMinimum(0);
performanceSlider->setMaximum(3);
performanceSlider->setSingleStep(1);
performanceSlider->setPageStep(1);
performanceSlider->setTickInterval(1);
performanceSlider->setTickPosition(QSlider::TicksRight);
//connect(performanceSlider, SIGNAL(valueChanged(int)),this,SLOT(savePerformance(int)));
//connect(performanceSlider, SIGNAL(valueChanged(int)),this,SLOT(optionsChanged()));
layout->addLayout(groupBoxesLayout);
layout->addLayout(performance);
layout->setContentsMargins(0,0,0,0);
setLayout(layout);
}
void YACReaderGLFlowConfigWidget::setValues(Preset preset)
{
xRotation->setValue(preset.cfRX);
yPosition->setValue(preset.cfY*100);
coverDistance->setValue(preset.xDistance*100);
centralDistance->setValue(preset.centerDistance*100);
zoomLevel->setValue(preset.cfZ);
yCoverOffset->setValue(preset.yDistance*100);
zCoverOffset->setValue(preset.zDistance*100);
coverRotation->setValue(preset.rotation*-1);
fadeOutDist->setValue(preset.animationFadeOutDist);
lightStrength->setValue(preset.viewRotateLightStrenght);
maxAngle->setValue(preset.viewAngle);
}
//-----------------------------------------------------------------------------
YACReaderFlowConfigWidget::YACReaderFlowConfigWidget(QWidget * parent )
:QWidget(parent)
{
QVBoxLayout * layout = new QVBoxLayout(this);
QGroupBox *groupBox = new QGroupBox(tr("How to show covers:"));
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);
layout->addWidget(groupBox);
layout->setContentsMargins(0,0,0,0);
setLayout(layout);
}

View File

@ -24,9 +24,12 @@
#include <QLabel>
#include <QSpinBox>
#include <QSlider>
#include <QRadioButton>
#include "pictureflow.h"
#include "yacreader_flow_gl.h"
class QToolBarStretch : public QWidget
{
public:
@ -207,6 +210,92 @@ signals:
};
class YACReaderFlowConfigWidget : public QWidget
{
Q_OBJECT
public:
QRadioButton *radio1;
QRadioButton *radio2;
QRadioButton *radio3;
YACReaderFlowConfigWidget(QWidget * parent = 0);
};
class YACReaderGLFlowConfigWidget : public QWidget
{
Q_OBJECT
public:
YACReaderGLFlowConfigWidget(QWidget * parent = 0);
//GL.........................
QRadioButton *radioClassic;
QRadioButton *radioStripe;
QRadioButton *radioOver;
QRadioButton *radionModern;
QRadioButton *radioDown;
YACReaderSpinSliderWidget * xRotation;
YACReaderSpinSliderWidget * yPosition;
YACReaderSpinSliderWidget * coverDistance;
YACReaderSpinSliderWidget * centralDistance;
YACReaderSpinSliderWidget * zoomLevel;
YACReaderSpinSliderWidget * yCoverOffset;
YACReaderSpinSliderWidget * zCoverOffset;
YACReaderSpinSliderWidget * coverRotation;
YACReaderSpinSliderWidget * fadeOutDist;
YACReaderSpinSliderWidget * lightStrength;
YACReaderSpinSliderWidget * maxAngle;
QSlider * performanceSlider;
public slots:
void setValues(Preset preset);
};
class YACReaderOptionsDialog : public QDialog
{
Q_OBJECT
protected:
YACReaderFlowConfigWidget * sw;
YACReaderGLFlowConfigWidget * gl;
QCheckBox * useGL;
QPushButton * accept;
QPushButton * cancel;
QSettings * settings;
QSettings * previousSettings;
public:
YACReaderOptionsDialog(QWidget * parent);
public slots:
void restoreOptions(QSettings * settings);
void saveOptions();
protected slots:
void savePerformance(int value);
void saveUseGL(int b);
void saveXRotation(int value);
void saveYPosition(int value);
void saveCoverDistance(int value);
void saveCentralDistance(int value);
void saveZoomLevel(int value);
void saveYCoverOffset(int value);
void saveZCoverOffset(int value);
void saveCoverRotation(int value);
void saveFadeOutDist(int value);
void saveLightStrength(int value);
void saveMaxAngle(int value);
void loadConfig();
void setClassicConfig();
void setStripeConfig();
void setOverlappedStripeConfig();
void setModernConfig();
void setRouletteConfig();
signals:
void optionsChanged();
};
#endif

View File

@ -309,6 +309,7 @@ void YACReaderFlowGL::resizeGL(int width, int height)
#endif
glMatrixMode(GL_MODELVIEW);
if(numObjects>0)
updatePositions();
}