mirror of
https://github.com/YACReader/yacreader
synced 2025-06-04 01:28:55 -04:00
Remove old fitmode code and do some config and menu cleanup work
This commit is contained in:
parent
dffe34ba25
commit
3ad70c39fb
@ -114,7 +114,7 @@ HEADERS += ../common/comic.h \
|
||||
page_label_widget.h \
|
||||
goto_flow_toolbar.h \
|
||||
goto_flow_decorationbar.h \
|
||||
width_slider.h \
|
||||
#width_slider.h \
|
||||
notifications_label_widget.h \
|
||||
../common/pictureflow.h \
|
||||
../common/custom_widgets.h \
|
||||
@ -158,7 +158,7 @@ SOURCES += ../common/comic.cpp \
|
||||
page_label_widget.cpp \
|
||||
goto_flow_toolbar.cpp \
|
||||
goto_flow_decorationbar.cpp \
|
||||
width_slider.cpp \
|
||||
#width_slider.cpp \
|
||||
notifications_label_widget.cpp \
|
||||
../common/pictureflow.cpp \
|
||||
../common/custom_widgets.cpp \
|
||||
|
@ -33,26 +33,28 @@ void Configuration::load(QSettings * settings)
|
||||
settings->setValue(MAG_GLASS_SIZE,QSize(350,175));
|
||||
if(!settings->contains(ZOOM_LEVEL))
|
||||
settings->setValue(MAG_GLASS_SIZE,QSize(350,175));
|
||||
if(!settings->contains(FIT))
|
||||
settings->setValue(FIT,false);
|
||||
if(!settings->contains(FLOW_TYPE))
|
||||
settings->setValue(FLOW_TYPE,0);
|
||||
if(!settings->contains(FULLSCREEN))
|
||||
settings->setValue(FULLSCREEN,false);
|
||||
if(!settings->contains(FIT_TO_WIDTH_RATIO))
|
||||
settings->setValue(FIT_TO_WIDTH_RATIO,1);
|
||||
if(!settings->contains(Y_WINDOW_SIZE))
|
||||
settings->setValue(Y_WINDOW_SIZE,QSize(0,0));
|
||||
if(!settings->contains(MAXIMIZED))
|
||||
settings->setValue(MAXIMIZED,false);
|
||||
if(!settings->contains(DOUBLE_PAGE))
|
||||
settings->setValue(DOUBLE_PAGE,false);
|
||||
if(!settings->contains(ADJUST_TO_FULL_SIZE))
|
||||
settings->setValue(ADJUST_TO_FULL_SIZE,false);
|
||||
if(!settings->contains(BACKGROUND_COLOR))
|
||||
settings->setValue(BACKGROUND_COLOR,QColor(40,40,40));
|
||||
if(!settings->contains(ALWAYS_ON_TOP))
|
||||
settings->setValue(ALWAYS_ON_TOP,false);
|
||||
if(!settings->contains(SHOW_TOOLBARS))
|
||||
settings->setValue(SHOW_TOOLBARS, true);
|
||||
}
|
||||
//old fit stuff
|
||||
/*if(!settings->contains(FIT))
|
||||
settings->setValue(FIT,false);
|
||||
if(!settings->contains(FIT_TO_WIDTH_RATIO))
|
||||
settings->setValue(FIT_TO_WIDTH_RATIO,1);
|
||||
if(!settings->contains(ADJUST_TO_FULL_SIZE))
|
||||
settings->setValue(ADJUST_TO_FULL_SIZE,false);
|
||||
*/
|
||||
}
|
@ -66,12 +66,14 @@ using namespace YACReader;
|
||||
void setFitMode ( YACReader::FitMode fitMode ){ settings->setValue(FITMODE, static_cast<int>(fitMode)); }
|
||||
|
||||
//Old fitmodes
|
||||
/*
|
||||
bool getAdjustToWidth() {return settings->value(FIT).toBool();}
|
||||
void setAdjustToWidth(bool atw=true) {settings->setValue(FIT,atw);}
|
||||
float getFitToWidthRatio(){return settings->value(FIT_TO_WIDTH_RATIO).toFloat();}
|
||||
void setFitToWidthRatio(float r){settings->setValue(FIT_TO_WIDTH_RATIO,r);}
|
||||
bool getAdjustToFullSize(){return settings->value(ADJUST_TO_FULL_SIZE).toBool();}
|
||||
void setAdjustToFullSize(bool b){settings->setValue(ADJUST_TO_FULL_SIZE,b);}
|
||||
*/
|
||||
|
||||
FlowType getFlowType(){return (FlowType)settings->value(FLOW_TYPE_SW).toInt();}
|
||||
void setFlowType(FlowType type){settings->setValue(FLOW_TYPE_SW,type);}
|
||||
|
@ -81,7 +81,7 @@ MainWindowViewer::~MainWindowViewer()
|
||||
delete viewer;
|
||||
delete had;
|
||||
|
||||
delete sliderAction;
|
||||
//delete sliderAction;
|
||||
delete openAction;
|
||||
delete openFolderAction;
|
||||
delete saveImageAction;
|
||||
@ -160,7 +160,6 @@ 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()));
|
||||
connect(optionsDialog,SIGNAL(changedFilters(int,int,int)),viewer,SLOT(updateFilters(int,int,int)));
|
||||
|
||||
@ -261,7 +260,6 @@ void MainWindowViewer::createActions()
|
||||
adjustHeightAction->setIcon(QIcon(":/images/viewer_toolbar/toHeight.png"));
|
||||
//adjustWidth->setCheckable(true);
|
||||
adjustHeightAction->setDisabled(true);
|
||||
adjustHeightAction->setChecked(Configuration::getConfiguration().getAdjustToWidth());
|
||||
adjustHeightAction->setToolTip(tr("Fit image to height"));
|
||||
//adjustWidth->setIcon(QIcon(":/images/fitWidth.png"));
|
||||
adjustHeightAction->setData(ADJUST_HEIGHT_ACTION_Y);
|
||||
@ -272,7 +270,6 @@ void MainWindowViewer::createActions()
|
||||
adjustWidthAction->setIcon(QIcon(":/images/viewer_toolbar/toWidth.png"));
|
||||
//adjustWidth->setCheckable(true);
|
||||
adjustWidthAction->setDisabled(true);
|
||||
adjustWidthAction->setChecked(Configuration::getConfiguration().getAdjustToWidth());
|
||||
adjustWidthAction->setToolTip(tr("Fit image to width"));
|
||||
//adjustWidth->setIcon(QIcon(":/images/fitWidth.png"));
|
||||
adjustWidthAction->setData(ADJUST_WIDTH_ACTION_Y);
|
||||
@ -407,7 +404,6 @@ void MainWindowViewer::createActions()
|
||||
adjustToFullSizeAction->setIcon(QIcon(":/images/viewer_toolbar/full.png"));
|
||||
adjustToFullSizeAction->setCheckable(false);
|
||||
adjustToFullSizeAction->setDisabled(true);
|
||||
adjustToFullSizeAction->setChecked(Configuration::getConfiguration().getAdjustToFullSize());
|
||||
adjustToFullSizeAction->setData(ADJUST_TO_FULL_SIZE_ACTION_Y);
|
||||
adjustToFullSizeAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(ADJUST_TO_FULL_SIZE_ACTION_Y));
|
||||
connect(adjustToFullSizeAction,SIGNAL(triggered()),this,SLOT(adjustToFullSizeSwitch()));
|
||||
@ -492,38 +488,38 @@ void MainWindowViewer::createToolBars()
|
||||
|
||||
#ifdef Q_OS_MAC
|
||||
|
||||
sliderAction = new YACReaderSlider(this);
|
||||
sliderAction->hide();
|
||||
//sliderAction = new YACReaderSlider(this);
|
||||
//sliderAction->hide();
|
||||
|
||||
comicToolBar->addAction(adjustWidthAction);
|
||||
|
||||
QAction * action = comicToolBar->addFitToWidthSlider(adjustWidthAction);
|
||||
//QAction * action = comicToolBar->addFitToWidthSlider(adjustWidthAction);
|
||||
|
||||
connect(action,SIGNAL(triggered()),this,SLOT(toggleFitToWidthSlider()));
|
||||
//connect(action,SIGNAL(triggered()),this,SLOT(toggleFitToWidthSlider()));
|
||||
|
||||
#else
|
||||
QMenu * menu = new QMenu();
|
||||
//QMenu * menu = new QMenu();
|
||||
|
||||
sliderAction = new YACReaderSliderAction(this);
|
||||
//sliderAction = new YACReaderSliderAction(this);
|
||||
|
||||
menu->setAutoFillBackground(false);
|
||||
menu->setStyleSheet(" QMenu {background:transparent; border: 0px;padding: 0px; }"
|
||||
);
|
||||
menu->addAction(sliderAction);
|
||||
QToolButton * tb2 = new QToolButton();
|
||||
tb2->addAction(adjustWidthAction);
|
||||
tb2->setMenu(menu);
|
||||
//menu->setAutoFillBackground(false);
|
||||
//menu->setStyleSheet(" QMenu {background:transparent; border: 0px;padding: 0px; }"
|
||||
// );
|
||||
//menu->addAction(sliderAction);
|
||||
//QToolButton * tb2 = new QToolButton();
|
||||
//tb2->addAction(adjustWidthAction);
|
||||
//tb2->setMenu(menu);
|
||||
|
||||
//tb2->addAction();
|
||||
tb2->setPopupMode(QToolButton::MenuButtonPopup);
|
||||
tb2->setDefaultAction(adjustWidthAction);
|
||||
comicToolBar->addWidget(tb2);
|
||||
//tb2->setPopupMode(QToolButton::MenuButtonPopup);
|
||||
//tb2->setDefaultAction(adjustWidthAction);
|
||||
//comicToolBar->addWidget(tb2);
|
||||
#endif
|
||||
|
||||
connect(sliderAction,SIGNAL(fitToWidthRatioChanged(float)),viewer,SLOT(updateFitToWidthRatio(float)));
|
||||
connect(optionsDialog,SIGNAL(fitToWidthRatioChanged(float)),sliderAction,SLOT(updateFitToWidthRatio(float)));
|
||||
|
||||
comicToolBar->addAction(adjustHeightAction);
|
||||
//connect(sliderAction,SIGNAL(fitToWidthRatioChanged(float)),viewer,SLOT(updateFitToWidthRatio(float)));
|
||||
//connect(optionsDialog,SIGNAL(fitToWidthRatioChanged(float)),sliderAction,SLOT(updateFitToWidthRatio(float)));
|
||||
comicToolBar->addAction(adjustWidthAction);
|
||||
comicToolBar->addAction(adjustHeightAction);
|
||||
comicToolBar->addAction(adjustToFullSizeAction);
|
||||
comicToolBar->addAction(leftRotationAction);
|
||||
comicToolBar->addAction(rightRotationAction);
|
||||
@ -881,11 +877,6 @@ void MainWindowViewer::keyPressEvent(QKeyEvent *event)
|
||||
toggleToolBars();
|
||||
event->accept();
|
||||
}
|
||||
else if (key == ShortcutsManager::getShortcutsManager().getShortcut(CHANGE_FIT_ACTION_Y))
|
||||
{
|
||||
changeFit();
|
||||
event->accept();
|
||||
}
|
||||
else
|
||||
QWidget::keyPressEvent(event);
|
||||
}
|
||||
@ -1149,6 +1140,7 @@ void MainWindowViewer::setUpShortcutsManagement()
|
||||
}
|
||||
|
||||
#ifdef Q_OS_MAC
|
||||
/*
|
||||
void MainWindowViewer::toggleFitToWidthSlider()
|
||||
{
|
||||
if(sliderAction->isVisible())
|
||||
@ -1160,16 +1152,9 @@ void MainWindowViewer::toggleFitToWidthSlider()
|
||||
sliderAction->move(250,0);
|
||||
sliderAction->show();
|
||||
}
|
||||
}
|
||||
}*/
|
||||
#endif
|
||||
|
||||
void MainWindowViewer::changeFit()
|
||||
{
|
||||
Configuration & conf = Configuration::getConfiguration();
|
||||
conf.setAdjustToWidth(!conf.getAdjustToWidth());
|
||||
viewer->updatePage();
|
||||
}
|
||||
|
||||
void MainWindowViewer::newVersion()
|
||||
{
|
||||
QMessageBox msgBox;
|
||||
|
@ -38,7 +38,6 @@ class EditShortcutsDialog;
|
||||
void toggleToolBars();
|
||||
void hideToolBars();
|
||||
void showToolBars();
|
||||
void changeFit();
|
||||
void enableActions();
|
||||
void disableActions();
|
||||
void toggleFullScreen();
|
||||
|
@ -55,7 +55,7 @@ OptionsDialog::OptionsDialog(QWidget * parent)
|
||||
connect(pathFindButton,SIGNAL(clicked()),this,SLOT(findFolder()));
|
||||
|
||||
//fitToWidthRatioLabel = new QLabel(tr("Page width stretch"),this);
|
||||
QGroupBox *fitBox = new QGroupBox(tr("Page width stretch"));
|
||||
/*QGroupBox *fitBox = new QGroupBox(tr("Page width stretch"));
|
||||
fitToWidthRatioS = new QSlider(this);
|
||||
fitToWidthRatioS->setMinimum(50);
|
||||
fitToWidthRatioS->setMaximum(100);
|
||||
@ -64,7 +64,7 @@ OptionsDialog::OptionsDialog(QWidget * parent)
|
||||
//connect(fitToWidthRatioS,SIGNAL(valueChanged(int)),this,SLOT(fitToWidthRatio(int)));
|
||||
QHBoxLayout * fitLayout = new QHBoxLayout;
|
||||
fitLayout->addWidget(fitToWidthRatioS);
|
||||
fitBox->setLayout(fitLayout);
|
||||
fitBox->setLayout(fitLayout);*/
|
||||
|
||||
QHBoxLayout * colorSelection = new QHBoxLayout;
|
||||
backgroundColor = new QLabel();
|
||||
@ -113,7 +113,7 @@ OptionsDialog::OptionsDialog(QWidget * parent)
|
||||
|
||||
layoutGeneral->addWidget(pathBox);
|
||||
layoutGeneral->addWidget(slideSizeBox);
|
||||
layoutGeneral->addWidget(fitBox);
|
||||
//layoutGeneral->addWidget(fitBox);
|
||||
layoutGeneral->addWidget(colorBox);
|
||||
layoutGeneral->addWidget(shortcutsBox);
|
||||
layoutGeneral->addStretch();
|
||||
@ -190,7 +190,7 @@ void OptionsDialog::saveOptions()
|
||||
settings->setValue(PATH,pathEdit->text());
|
||||
|
||||
settings->setValue(BACKGROUND_COLOR,colorDialog->currentColor());
|
||||
settings->setValue(FIT_TO_WIDTH_RATIO,fitToWidthRatioS->sliderPosition()/100.0);
|
||||
//settings->setValue(FIT_TO_WIDTH_RATIO,fitToWidthRatioS->sliderPosition()/100.0);
|
||||
|
||||
YACReaderOptionsDialog::saveOptions();
|
||||
}
|
||||
@ -219,7 +219,7 @@ void OptionsDialog::restoreOptions(QSettings * settings)
|
||||
pathEdit->setText(settings->value(PATH).toString());
|
||||
|
||||
updateColor(settings->value(BACKGROUND_COLOR).value<QColor>());
|
||||
fitToWidthRatioS->setSliderPosition(settings->value(FIT_TO_WIDTH_RATIO).toFloat()*100);
|
||||
//fitToWidthRatioS->setSliderPosition(settings->value(FIT_TO_WIDTH_RATIO).toFloat()*100);
|
||||
|
||||
brightnessS->setValue(settings->value(BRIGHTNESS,0).toInt());
|
||||
contrastS->setValue(settings->value(CONTRAST,100).toInt());
|
||||
@ -240,11 +240,11 @@ void OptionsDialog::updateColor(const QColor & color)
|
||||
emit(changedOptions());
|
||||
}
|
||||
|
||||
void OptionsDialog::fitToWidthRatio(int value)
|
||||
/*void OptionsDialog::fitToWidthRatio(int value)
|
||||
{
|
||||
Configuration::getConfiguration().setFitToWidthRatio(value/100.0);
|
||||
emit(fitToWidthRatioChanged(value/100.0));
|
||||
}
|
||||
}*/
|
||||
|
||||
void OptionsDialog::brightnessChanged(int value)
|
||||
{
|
||||
@ -287,9 +287,9 @@ void OptionsDialog::show()
|
||||
{
|
||||
//TODO solucionar el tema de las settings, esto sólo debería aparecer en una única línea de código
|
||||
QSettings *s = new QSettings(YACReader::getSettingsPath()+"/YACReader.ini",QSettings::IniFormat);
|
||||
fitToWidthRatioS->disconnect();
|
||||
fitToWidthRatioS->setSliderPosition(settings->value(FIT_TO_WIDTH_RATIO).toFloat()*100);
|
||||
connect(fitToWidthRatioS,SIGNAL(valueChanged(int)),this,SLOT(fitToWidthRatio(int)));
|
||||
//fitToWidthRatioS->disconnect();
|
||||
//fitToWidthRatioS->setSliderPosition(settings->value(FIT_TO_WIDTH_RATIO).toFloat()*100);
|
||||
//connect(fitToWidthRatioS,SIGNAL(valueChanged(int)),this,SLOT(fitToWidthRatio(int)));
|
||||
QDialog::show();
|
||||
delete s;
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ Q_OBJECT
|
||||
QSlider * slideSize;
|
||||
|
||||
//QLabel * fitToWidthRatioLabel;
|
||||
QSlider * fitToWidthRatioS;
|
||||
//QSlider * fitToWidthRatioS;
|
||||
|
||||
QLabel * backgroundColor;
|
||||
QPushButton * selectBackgroundColorButton;
|
||||
@ -50,7 +50,7 @@ Q_OBJECT
|
||||
void restoreOptions(QSettings * settings);
|
||||
void findFolder();
|
||||
void updateColor(const QColor & color);
|
||||
void fitToWidthRatio(int value);
|
||||
//void fitToWidthRatio(int value);
|
||||
void brightnessChanged(int value);
|
||||
void contrastChanged(int value);
|
||||
void gammaChanged(int value);
|
||||
@ -62,7 +62,7 @@ signals:
|
||||
void changedOptions();
|
||||
void changedImageOptions();
|
||||
void changedFilters(int brightness, int contrast, int gamma);
|
||||
void fitToWidthRatioChanged(float ratio);
|
||||
//void fitToWidthRatioChanged(float ratio);
|
||||
|
||||
};
|
||||
|
||||
|
@ -885,13 +885,6 @@ void Viewer::mouseReleaseEvent ( QMouseEvent * event )
|
||||
event->accept();
|
||||
}
|
||||
|
||||
void Viewer::updateFitToWidthRatio(float ratio)
|
||||
{
|
||||
Configuration::getConfiguration().setAdjustToWidth(true);
|
||||
adjustToWidthRatio = ratio;
|
||||
updateContentSize();
|
||||
}
|
||||
|
||||
void Viewer::updateConfig(QSettings * settings)
|
||||
{
|
||||
goToFlow->updateConfig(settings);
|
||||
|
@ -80,7 +80,6 @@ class NotificationsLabelWidget;
|
||||
virtual void mousePressEvent ( QMouseEvent * event );
|
||||
virtual void mouseReleaseEvent ( QMouseEvent * event );
|
||||
void updateBackgroundColor(const QColor & color);
|
||||
void updateFitToWidthRatio(float ratio);
|
||||
void updateConfig(QSettings * settings);
|
||||
void showMessageErrorOpening();
|
||||
void showMessageErrorOpening(QString);
|
||||
|
@ -12,23 +12,27 @@
|
||||
|
||||
#define VERSION "8.0.0"
|
||||
|
||||
//old fitmode defines
|
||||
/*
|
||||
#define ADJUST_TO_FULL_SIZE "ADJUST_TO_FULL_SIZE"
|
||||
#define FIT "FIT"
|
||||
#define FIT_TO_WIDTH_RATIO "FIT_TO_WIDTH_RATIO"
|
||||
*/
|
||||
|
||||
#define PATH "PATH"
|
||||
#define MAG_GLASS_SIZE "MAG_GLASS_SIZE"
|
||||
#define ZOOM_LEVEL "ZOOM_LEVEL"
|
||||
#define SLIDE_SIZE "SLIDE_SIZE"
|
||||
#define GO_TO_FLOW_SIZE "GO_TO_FLOW_SIZE"
|
||||
#define FLOW_TYPE_SW "FLOW_TYPE_SW"
|
||||
#define FIT "FIT"
|
||||
#define FITMODE "FITMODE"
|
||||
#define FLOW_TYPE "FLOW_TYPE"
|
||||
#define FULLSCREEN "FULLSCREEN"
|
||||
#define FIT_TO_WIDTH_RATIO "FIT_TO_WIDTH_RATIO"
|
||||
#define Y_WINDOW_POS "POS"
|
||||
#define Y_WINDOW_SIZE "SIZE"
|
||||
#define MAXIMIZED "MAXIMIZED"
|
||||
#define DOUBLE_PAGE "DOUBLE_PAGE"
|
||||
#define DOUBLE_MANGA_PAGE "DOUBLE_MANGA_PAGE"
|
||||
#define ADJUST_TO_FULL_SIZE "ADJUST_TO_FULL_SIZE"
|
||||
#define BACKGROUND_COLOR "BACKGROUND_COLOR"
|
||||
#define ALWAYS_ON_TOP "ALWAYS_ON_TOP"
|
||||
#define SHOW_TOOLBARS "SHOW_TOOLBARS"
|
||||
|
Loading…
x
Reference in New Issue
Block a user