diff --git a/YACReader/YACReader.pro b/YACReader/YACReader.pro index 25fe7d8d..93c7091b 100644 --- a/YACReader/YACReader.pro +++ b/YACReader/YACReader.pro @@ -48,6 +48,7 @@ HEADERS += comic.h \ page_label_widget.h \ goto_flow_toolbar.h \ goto_flow_decorationbar.h \ + width_slider.h \ ../common/pictureflow.h \ ../common/custom_widgets.h \ ../common/check_new_version.h \ @@ -75,6 +76,7 @@ SOURCES += comic.cpp \ page_label_widget.cpp \ goto_flow_toolbar.cpp \ goto_flow_decorationbar.cpp \ + width_slider.cpp \ ../common/pictureflow.cpp \ ../common/custom_widgets.cpp \ ../common/check_new_version.cpp \ diff --git a/YACReader/images.qrc b/YACReader/images.qrc index 31273fcb..c88922a6 100644 --- a/YACReader/images.qrc +++ b/YACReader/images.qrc @@ -51,7 +51,7 @@ ../images/sliderGround.png ../images/sliderSubPage.png ../images/sliderAddPage.png - ../images/sliderHandle.png + ../images/sliderHandle.png ../images/helpImages/open.png ../images/helpImages/openFolder.png diff --git a/YACReader/main_window_viewer.cpp b/YACReader/main_window_viewer.cpp index 1aead5b6..b27f1198 100644 --- a/YACReader/main_window_viewer.cpp +++ b/YACReader/main_window_viewer.cpp @@ -8,7 +8,7 @@ #include "comic.h" #include "bookmarks_dialog.h" #include "shortcuts_dialog.h" - +#include "width_slider.h" MainWindowViewer::MainWindowViewer() :QMainWindow(),fullscreen(false),toolbars(true),alwaysOnTop(false),currentDirectory("."),currentDirectoryImgDest(".") @@ -322,13 +322,17 @@ void MainWindowViewer::createToolBars() //comicToolBar->addAction(adjustWidth); QMenu * menu = new QMenu(); + sliderAction = new YACReaderSliderAction(this); menu->setAutoFillBackground(false); menu->setStyleSheet(" QMenu {background:transparent; border: 0px;padding: 0px; }" ); - menu->addAction(new YACReaderSliderAction(this)); + menu->addAction(sliderAction); QToolButton * tb2 = new QToolButton(); tb2->addAction(adjustWidth); tb2->setMenu(menu); + + connect(sliderAction,SIGNAL(fitToWidthRatioChanged(float)),viewer,SLOT(updateFitToWidthRatio(float))); + //tb2->addAction(); tb2->setPopupMode(QToolButton::MenuButtonPopup); tb2->setDefaultAction(adjustWidth); diff --git a/YACReader/main_window_viewer.h b/YACReader/main_window_viewer.h index c8da2d86..1d16a227 100644 --- a/YACReader/main_window_viewer.h +++ b/YACReader/main_window_viewer.h @@ -15,7 +15,7 @@ class OptionsDialog; class HelpAboutDialog; class HttpVersionChecker; class ShortcutsDialog; - +class YACReaderSliderAction; class MainWindowViewer : public QMainWindow { @@ -91,6 +91,7 @@ class ShortcutsDialog; QAction *showDictionaryAction; QAction *alwaysOnTopAction; QAction *adjustToFullSizeAction; + YACReaderSliderAction * sliderAction; HttpVersionChecker * versionChecker; QString previousComicPath; diff --git a/common/custom_widgets.cpp b/common/custom_widgets.cpp index 7f551649..bbcc909c 100644 --- a/common/custom_widgets.cpp +++ b/common/custom_widgets.cpp @@ -1205,67 +1205,4 @@ YACReaderFlowConfigWidget::YACReaderFlowConfigWidget(QWidget * parent ) layout->setContentsMargins(0,0,0,0); setLayout(layout); -} - - -YACReaderSliderAction::YACReaderSliderAction (QWidget * parent) - :QWidgetAction (0) { - - //QWidget* pWidget = new QWidget (0); - - //QLabel* imgLabel = new QLabel(pWidget); - //QPixmap p(":/images/numPagesLabel.png"); - //imgLabel->resize(p.size()); - //imgLabel->setPixmap(p); - - //QLabel * textLabel = new QLabel(pWidget); - //textLabel->setAlignment(Qt::AlignVCenter|Qt::AlignHCenter); - //textLabel->setStyleSheet("QLabel { color : white; }"); - //textLabel->setText("hola"); - ////informationLabel->setAutoFillBackground(true); - ////textLabel->setFont(QFont("courier new bold", 12)); - ////textLabel->resize(100,25); - - //textLabel->setGeometry(imgLabel->geometry()); - - //setDefaultWidget(pWidget); - - QWidget* pWidget = new QWidget (NULL); - QHBoxLayout* pLayout = new QHBoxLayout(); - QLabel * pLabel = new QLabel ("100%"); - pLabel->setStyleSheet("QLabel { color : white; }"); - pLayout->addWidget (pLabel); - QSlider * slider = new QSlider(NULL); - slider->setOrientation(Qt::Horizontal); - pLayout->addWidget (slider); - //"background-image: url(:/images/sliderGround.png); width: 100%; height:100%; background-repeat: none; border: none; padding: 0px; color: white;" - //"QSlider::sub-page:horizontal {background-image: url(:/images/sliderSubPage.png); background-repeat:repeat-x;}" - QString sliderCSS = //"QSlider {background-image: url(:/images/sliderGround.png); width: 100%; height:100%; background-repeat: none; border: none; padding: 0px;} " - - "QSlider::sub-page:horizontal {background-image: url(:/images/sliderSubPage.png); border: 0px; margin-left: 18px;}" - "QSlider::add-page:horizontal {background-image: url(:/images/sliderAddPage.png); border: 0px; margin-right: 18px;}" - "QSlider::handle:horizontal {image: url(:/images/sliderHandle.png); width: 100px;height:45px;padding:-20px; margin-left:-10px; margin-right:-10px; }" - "QSlider::groove:horizontal {border-image:url(:/images/sliderGround.png); border-left:-10px; border-right:-10px;}" - ; - - //"QSlider::handle {background-image: url(:/images/sliderHandle.png); border: 0px; width: 31px; height:45px; margin:0px; padding:0px;}" - slider->setStyleSheet(sliderCSS); - slider->setFixedSize(214,45); - - QLabel* imgLabel = new QLabel(pWidget); - QPixmap p(":/images/sliderBackground.png"); - imgLabel->resize(p.size()); - imgLabel->setPixmap(p); - - pLayout->setMargin(0); - pLayout->setSpacing(0); - - pWidget->setLayout (pLayout); - pWidget->setAutoFillBackground(false); - - //pWidget->setMinimumSize(250,45); - - setDefaultWidget(pWidget); - - } \ No newline at end of file diff --git a/common/custom_widgets.h b/common/custom_widgets.h index d78c7b8d..a95cf225 100644 --- a/common/custom_widgets.h +++ b/common/custom_widgets.h @@ -371,10 +371,6 @@ signals: ////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////// -class YACReaderSliderAction : public QWidgetAction { -public: - YACReaderSliderAction (QWidget * parent = 0); -}; #endif diff --git a/images/sliderAddPage.png b/images/sliderAddPage.png index 1c285196..dac9b0a0 100644 Binary files a/images/sliderAddPage.png and b/images/sliderAddPage.png differ diff --git a/images/sliderBackground.png b/images/sliderBackground.png index d2d31325..385d9ed5 100644 Binary files a/images/sliderBackground.png and b/images/sliderBackground.png differ diff --git a/images/sliderGround.png b/images/sliderGround.png index 1f427f3c..294d6108 100644 Binary files a/images/sliderGround.png and b/images/sliderGround.png differ diff --git a/images/sliderHandle.png b/images/sliderHandle.png index 4c8730bf..033c8658 100644 Binary files a/images/sliderHandle.png and b/images/sliderHandle.png differ diff --git a/images/sliderSubPage.png b/images/sliderSubPage.png index 404b296f..84017df7 100644 Binary files a/images/sliderSubPage.png and b/images/sliderSubPage.png differ