Ignore:
Timestamp:
May 16, 2014, 9:51:55 AM (11 years ago)
Author:
Silvan Scherrer
Message:

SMPlayer: update trunk to latest 0.8.7

Location:
smplayer/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • smplayer/trunk

  • smplayer/trunk/src/mpcgui/mpcgui.cpp

    r156 r165  
    2020#include "mpcstyles.h"
    2121#include "widgetactions.h"
    22 #include "floatingwidget.h"
     22#include "autohidewidget.h"
    2323#include "myaction.h"
    2424#include "mplayerwindow.h"
     
    3232#include <QLabel>
    3333#include <QSlider>
     34#include <QLayout>
    3435#include <QApplication>
    3536
     
    4243        createActions();
    4344        createControlWidget();
    44     createStatusBar();
    45 
    46         connect( this, SIGNAL(cursorNearBottom(QPoint)),
    47              this, SLOT(showFloatingControl(QPoint)) );
    48 
    49         connect( this, SIGNAL(cursorFarEdges()),
    50              this, SLOT(hideFloatingControl()) );
     45        createStatusBar();
     46        createFloatingControl();
    5147
    5248        retranslateStrings();
     
    9389        controlwidget->setAllowedAreas(Qt::BottomToolBarArea);
    9490        controlwidget->addAction(playAct);
    95     controlwidget->addAction(pauseAct);
     91        controlwidget->addAction(pauseAct);
    9692        controlwidget->addAction(stopAct);
    9793        controlwidget->addSeparator();
    98     controlwidget->addAction(rewind3Act);
    99     controlwidget->addAction(rewind1Act);
    100     controlwidget->addAction(forward1Act);
    101     controlwidget->addAction(forward3Act);
    102     controlwidget->addSeparator();
    103     controlwidget->addAction(frameStepAct);
    104     controlwidget->addSeparator();
    105 
    106     QLabel* pLabel = new QLabel(this);
    107     pLabel->setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding));
    108     controlwidget->addWidget(pLabel);
     94        controlwidget->addAction(rewind3Act);
     95        controlwidget->addAction(rewind1Act);
     96        controlwidget->addAction(forward1Act);
     97        controlwidget->addAction(forward3Act);
     98        controlwidget->addSeparator();
     99        controlwidget->addAction(frameStepAct);
     100        controlwidget->addSeparator();
     101
     102        QLabel* pLabel = new QLabel(this);
     103        pLabel->setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding));
     104        controlwidget->addWidget(pLabel);
    109105
    110106        controlwidget->addAction(muteAct);
     
    115111        timeslidewidget->setLayoutDirection(Qt::LeftToRight);
    116112        timeslidewidget->addAction(timeslider_action);
    117     timeslidewidget->setMovable(false);
    118    
    119     QColor SliderColor = palette().color(QPalette::Window);
    120     QColor SliderBorderColor = palette().color(QPalette::Dark);
    121     setIconSize( QSize( 16 , 16 ) );
    122 
    123     addToolBar(Qt::BottomToolBarArea, controlwidget);
    124     addToolBarBreak(Qt::BottomToolBarArea);
     113        timeslidewidget->setMovable(false);
     114
     115        /*
     116        QColor SliderColor = palette().color(QPalette::Window);
     117        QColor SliderBorderColor = palette().color(QPalette::Dark);
     118        */
     119        setIconSize( QSize( 16 , 16 ) );
     120
     121        addToolBar(Qt::BottomToolBarArea, controlwidget);
     122        addToolBarBreak(Qt::BottomToolBarArea);
    125123        addToolBar(Qt::BottomToolBarArea, timeslidewidget);
    126124
    127     controlwidget->setStyle(new  MpcToolbarStyle() );
    128     timeslidewidget->setStyle(new  MpcToolbarStyle() );
    129 
    130     statusBar()->show();
     125        controlwidget->setStyle(new MpcToolbarStyle() );
     126        timeslidewidget->setStyle(new MpcToolbarStyle() );
     127
     128        statusBar()->show();
     129}
     130
     131void MpcGui::createFloatingControl() {
     132        // Floating control
     133        floating_control = new AutohideWidget(panel);
     134        floating_control->setAutoHide(true);
     135        floating_control->hide();
     136        spacer = new QSpacerItem(10,10);
    131137}
    132138
     
    163169        BaseGuiPlus::aboutToEnterFullscreen();
    164170
     171        // Show floating_control
     172        // Move controls to the floating_control layout
     173        removeToolBarBreak(controlwidget);
     174        removeToolBar(controlwidget);
     175        removeToolBar(timeslidewidget);
     176        floating_control->layout()->addWidget(timeslidewidget);
     177        floating_control->layout()->addItem(spacer);
     178        floating_control->layout()->addWidget(controlwidget);
     179        controlwidget->show();
     180        timeslidewidget->show();
     181        floating_control->adjustSize();
     182
     183        floating_control->setMargin(pref->floating_control_margin);
     184        floating_control->setPercWidth(pref->floating_control_width);
     185        floating_control->setAnimated(pref->floating_control_animated);
     186        floating_control->setActivationArea( (AutohideWidget::Activation) pref->floating_activation_area);
     187        floating_control->setHideDelay(pref->floating_hide_delay);
     188        QTimer::singleShot(500, floating_control, SLOT(activate()));
     189
     190
    165191        if (!pref->compact_mode) {
    166                 controlwidget->hide();
    167         timeslidewidget->hide();
    168         statusBar()->hide();
     192                //controlwidget->hide();
     193                //timeslidewidget->hide();
     194                statusBar()->hide();
    169195        }
    170196}
     
    173199        BaseGuiPlus::aboutToExitFullscreen();
    174200
     201        // Remove controls from the floating_control and put them back to the mainwindow
     202        floating_control->deactivate();
     203        floating_control->layout()->removeWidget(controlwidget);
     204        floating_control->layout()->removeWidget(timeslidewidget);
     205        floating_control->layout()->removeItem(spacer);
     206        addToolBar(Qt::BottomToolBarArea, controlwidget);
     207        addToolBarBreak(Qt::BottomToolBarArea);
     208        addToolBar(Qt::BottomToolBarArea, timeslidewidget);
     209
    175210        if (!pref->compact_mode) {
    176211                controlwidget->show();
    177         statusBar()->show();
    178         timeslidewidget->show();
     212                statusBar()->show();
     213                timeslidewidget->show();
     214        } else {
     215                controlwidget->hide();
     216                timeslidewidget->hide();
    179217        }
    180218}
     
    184222
    185223        controlwidget->hide();
    186     timeslidewidget->hide();
    187     statusBar()->hide();
     224        timeslidewidget->hide();
     225        statusBar()->hide();
    188226}
    189227
     
    193231        statusBar()->show();
    194232        controlwidget->show();
    195     timeslidewidget->show();
    196 }
    197 
    198 void MpcGui::showFloatingControl(QPoint /*p*/) {
    199 }
    200 
    201 void MpcGui::hideFloatingControl() {
     233        timeslidewidget->show();
    202234}
    203235
     
    381413        connect( this, SIGNAL(frameChanged(int)),
    382414             this, SLOT(displayFrame(int)) );
    383 
    384     connect( this, SIGNAL(cursorNearBottom(QPoint)),
    385              this, SLOT(showFullscreenControls()) );
    386 
    387     connect( this, SIGNAL(cursorFarEdges()),
    388              this, SLOT(hideFullscreenControls()) );
    389415}
    390416
Note: See TracChangeset for help on using the changeset viewer.