Changeset 165 for smplayer/trunk/src/mpcgui/mpcgui.cpp
- Timestamp:
- May 16, 2014, 9:51:55 AM (11 years ago)
- Location:
- smplayer/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
smplayer/trunk
- Property svn:mergeinfo changed
/smplayer/vendor/current merged: 163
- Property svn:mergeinfo changed
-
smplayer/trunk/src/mpcgui/mpcgui.cpp
r156 r165 20 20 #include "mpcstyles.h" 21 21 #include "widgetactions.h" 22 #include " floatingwidget.h"22 #include "autohidewidget.h" 23 23 #include "myaction.h" 24 24 #include "mplayerwindow.h" … … 32 32 #include <QLabel> 33 33 #include <QSlider> 34 #include <QLayout> 34 35 #include <QApplication> 35 36 … … 42 43 createActions(); 43 44 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(); 51 47 52 48 retranslateStrings(); … … 93 89 controlwidget->setAllowedAreas(Qt::BottomToolBarArea); 94 90 controlwidget->addAction(playAct); 95 91 controlwidget->addAction(pauseAct); 96 92 controlwidget->addAction(stopAct); 97 93 controlwidget->addSeparator(); 98 99 100 101 102 103 104 105 106 107 108 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); 109 105 110 106 controlwidget->addAction(muteAct); … … 115 111 timeslidewidget->setLayoutDirection(Qt::LeftToRight); 116 112 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); 125 123 addToolBar(Qt::BottomToolBarArea, timeslidewidget); 126 124 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 131 void 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); 131 137 } 132 138 … … 163 169 BaseGuiPlus::aboutToEnterFullscreen(); 164 170 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 165 191 if (!pref->compact_mode) { 166 controlwidget->hide();167 168 192 //controlwidget->hide(); 193 //timeslidewidget->hide(); 194 statusBar()->hide(); 169 195 } 170 196 } … … 173 199 BaseGuiPlus::aboutToExitFullscreen(); 174 200 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 175 210 if (!pref->compact_mode) { 176 211 controlwidget->show(); 177 statusBar()->show(); 178 timeslidewidget->show(); 212 statusBar()->show(); 213 timeslidewidget->show(); 214 } else { 215 controlwidget->hide(); 216 timeslidewidget->hide(); 179 217 } 180 218 } … … 184 222 185 223 controlwidget->hide(); 186 187 224 timeslidewidget->hide(); 225 statusBar()->hide(); 188 226 } 189 227 … … 193 231 statusBar()->show(); 194 232 controlwidget->show(); 195 timeslidewidget->show(); 196 } 197 198 void MpcGui::showFloatingControl(QPoint /*p*/) { 199 } 200 201 void MpcGui::hideFloatingControl() { 233 timeslidewidget->show(); 202 234 } 203 235 … … 381 413 connect( this, SIGNAL(frameChanged(int)), 382 414 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()) );389 415 } 390 416
Note:
See TracChangeset
for help on using the changeset viewer.