From 6e34df117b8b1e2a6dcc1524bf561043269c7743 Mon Sep 17 00:00:00 2001 From: Nikolay Tischenko Date: Fri, 22 Oct 2010 01:34:58 +0700 Subject: [PATCH] Replacing more button with fullscreen button in scroll mode --- src/playerform.cpp | 21 +++++++++++++++++++-- src/playerform.h | 2 ++ src/toolswidget.cpp | 8 ++++++-- src/toolswidget.h | 1 + src/ui/toolswidget.ui | 3 +++ 5 files changed, 31 insertions(+), 4 deletions(-) diff --git a/src/playerform.cpp b/src/playerform.cpp index f6c657b..fe08eae 100644 --- a/src/playerform.cpp +++ b/src/playerform.cpp @@ -70,6 +70,16 @@ PlayerForm::PlayerForm(Library* lib, QWidget *parent) : } else { ui->repeatButton->setIcon(QIcon(":/icons/"+_icons_theme+"/repeat_one.png")); } + + _fscreen_button = new QPushButton(this); + _fscreen_button->setFlat(true); + _fscreen_button->setIcon(QIcon(":/icons/"+_icons_theme+"/fullscreen.png")); + _fscreen_button->setCheckable(true); + _fscreen_button->setMinimumSize(70, 70); + _fscreen_button->setMaximumSize(70, 70); + _fscreen_button->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); + _fscreen_button->hide(); + ui->volumeSlider->setMinimum(0); ui->volumeSlider->setMaximum(100); ui->volumeSlider->setValue(config.getValue("playback/volume").toInt()); @@ -126,6 +136,9 @@ PlayerForm::PlayerForm(Library* lib, QWidget *parent) : connect(_tools_widget, SIGNAL(nextSearch()), this, SLOT(nextItem())); connect(_tools_widget, SIGNAL(prevSearch()), this, SLOT(prevItem())); connect(_tools_widget, SIGNAL(toggleFullscreen(bool)), this, SIGNAL(fullscreen(bool))); + connect(_tools_widget, SIGNAL(toggleFullscreen(bool)), _fscreen_button, SLOT(setChecked(bool))); + connect(_fscreen_button, SIGNAL(clicked(bool)), this, SIGNAL(fullscreen(bool))); + connect(_fscreen_button, SIGNAL(clicked(bool)), _tools_widget, SLOT(setFullscreenState(bool))); ui->viewButton->setIcon(QIcon(":/icons/"+_icons_theme+"/playback.png")); _top_gradient = ui->topWidget->styleSheet(); _bottom_gradient = ui->bottomWidget->styleSheet(); @@ -159,10 +172,12 @@ void PlayerForm::_toggle_view() { index = (!index % 2); if (index) { ui->viewButton->setIcon(QIcon(":/icons/"+_icons_theme+"/playlist.png")); - ui->moreButton->setEnabled(false); + ui->moreButton->hide(); + _fscreen_button->show(); } else { ui->viewButton->setIcon(QIcon(":/icons/"+_icons_theme+"/playback.png")); - ui->moreButton->setEnabled(true); + ui->moreButton->show(); + _fscreen_button->hide(); } ui->stackedWidget->setCurrentIndex(index); } @@ -421,6 +436,7 @@ void PlayerForm::landscapeMode() { ui->bhorizontalLayout->addWidget(ui->stopButton); ui->bhorizontalLayout->addItem(ui->chorizontalSpacer_3); ui->bhorizontalLayout->addWidget(ui->moreButton); + ui->bhorizontalLayout->addWidget(_fscreen_button); ui->bhorizontalLayout->addItem(ui->chorizontalSpacer_4); ui->bhorizontalLayout->addWidget(ui->volumeButton); @@ -454,6 +470,7 @@ void PlayerForm::portraitMode() { ui->topWidget->layout()->addWidget(ui->nextButton); ui->topWidget->layout()->addItem(ui->thorizontalSpacer_3); ui->topWidget->layout()->addWidget(ui->moreButton); + ui->topWidget->layout()->addWidget(_fscreen_button); ui->bhorizontalLayout->removeItem(ui->chorizontalSpacer_0); ui->bhorizontalLayout->removeItem(ui->chorizontalSpacer_1); ui->bhorizontalLayout->removeItem(ui->chorizontalSpacer_2); diff --git a/src/playerform.h b/src/playerform.h index 6cf22be..8ed8da2 100644 --- a/src/playerform.h +++ b/src/playerform.h @@ -28,6 +28,7 @@ #include #include #include +#include #include "trackrenderer.h" #include "tagresolver.h" #include "dbusadaptor.h" @@ -110,6 +111,7 @@ private: QMenu *_context_menu; QString _search_pattern; ToolsWidget *_tools_widget; + QPushButton *_fscreen_button; bool landscape; QString _icons_theme; QString _top_gradient; diff --git a/src/toolswidget.cpp b/src/toolswidget.cpp index 08a8cb0..9379e20 100644 --- a/src/toolswidget.cpp +++ b/src/toolswidget.cpp @@ -46,7 +46,6 @@ ToolsWidget::~ToolsWidget() void ToolsWidget::_fullscreen_button() { _fullscreen = !_fullscreen; emit toggleFullscreen(_fullscreen); - ui->fscreenButton->setIcon(QIcon(_fullscreen ? ":/icons/"+_icons_theme+"/window.png" : ":/icons/"+_icons_theme+"/fullscreen.png")); } void ToolsWidget::reset() { @@ -60,7 +59,7 @@ void ToolsWidget::setFocus() { void ToolsWidget::updateIcons() { Config config; _icons_theme = config.getValue("ui/iconstheme").toString(); - ui->fscreenButton->setIcon(QIcon(_fullscreen ? ":/icons/"+_icons_theme+"/window.png" : ":/icons/"+_icons_theme+"/fullscreen.png")); + ui->fscreenButton->setIcon(QIcon(":/icons/"+_icons_theme+"/fullscreen.png")); ui->nextButton->setIcon(QIcon(":/icons/"+_icons_theme+"/forward.png")); ui->prevButton->setIcon(QIcon(":/icons/"+_icons_theme+"/back.png")); } @@ -78,3 +77,8 @@ void ToolsWidget::toggleArrows(bool state) { void ToolsWidget::hideFSButton() { ui->fscreenButton->hide(); } + +void ToolsWidget::setFullscreenState(bool on) { + ui->fscreenButton->setChecked(on); + _fullscreen = on; +} diff --git a/src/toolswidget.h b/src/toolswidget.h index dd6d180..78d4593 100644 --- a/src/toolswidget.h +++ b/src/toolswidget.h @@ -41,6 +41,7 @@ public slots: void show(); void toggleArrows(bool); void hideFSButton(); + void setFullscreenState(bool); signals: void toggleFullscreen(bool); diff --git a/src/ui/toolswidget.ui b/src/ui/toolswidget.ui index f21d90e..05e9996 100644 --- a/src/ui/toolswidget.ui +++ b/src/ui/toolswidget.ui @@ -47,6 +47,9 @@ :/icons/white/fullscreen.png:/icons/white/fullscreen.png + + true + true -- 1.7.9.5