| 1 | /* Mpcgui for SMPlayer.
|
|---|
| 2 | Copyright (C) 2008 matt_ <matt@endboss.org>
|
|---|
| 3 |
|
|---|
| 4 | This program is free software; you can redistribute it and/or modify
|
|---|
| 5 | it under the terms of the GNU General Public License as published by
|
|---|
| 6 | the Free Software Foundation; either version 2 of the License, or
|
|---|
| 7 | (at your option) any later version.
|
|---|
| 8 |
|
|---|
| 9 | This program is distributed in the hope that it will be useful,
|
|---|
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|---|
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|---|
| 12 | GNU General Public License for more details.
|
|---|
| 13 |
|
|---|
| 14 | You should have received a copy of the GNU General Public License
|
|---|
| 15 | along with this program; if not, write to the Free Software
|
|---|
| 16 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|---|
| 17 | */
|
|---|
| 18 |
|
|---|
| 19 | #include "mpcgui.h"
|
|---|
| 20 | #include "mpcstyles.h"
|
|---|
| 21 | #include "widgetactions.h"
|
|---|
| 22 | #include "autohidewidget.h"
|
|---|
| 23 | #include "myaction.h"
|
|---|
| 24 | #include "mplayerwindow.h"
|
|---|
| 25 | #include "global.h"
|
|---|
| 26 | #include "helper.h"
|
|---|
| 27 | #include "desktopinfo.h"
|
|---|
| 28 | #include "colorutils.h"
|
|---|
| 29 |
|
|---|
| 30 | #include <QToolBar>
|
|---|
| 31 | #include <QStatusBar>
|
|---|
| 32 | #include <QLabel>
|
|---|
| 33 | #include <QSlider>
|
|---|
| 34 | #include <QLayout>
|
|---|
| 35 | #include <QApplication>
|
|---|
| 36 |
|
|---|
| 37 | using namespace Global;
|
|---|
| 38 |
|
|---|
| 39 |
|
|---|
| 40 | MpcGui::MpcGui( QWidget * parent, Qt::WindowFlags flags )
|
|---|
| 41 | : BaseGuiPlus( parent, flags )
|
|---|
| 42 | {
|
|---|
| 43 | createActions();
|
|---|
| 44 | createControlWidget();
|
|---|
| 45 | createStatusBar();
|
|---|
| 46 | createFloatingControl();
|
|---|
| 47 |
|
|---|
| 48 | retranslateStrings();
|
|---|
| 49 |
|
|---|
| 50 | loadConfig();
|
|---|
| 51 |
|
|---|
| 52 | if (pref->compact_mode) {
|
|---|
| 53 | controlwidget->hide();
|
|---|
| 54 | timeslidewidget->hide();
|
|---|
| 55 | }
|
|---|
| 56 |
|
|---|
| 57 | applyStyles();
|
|---|
| 58 | }
|
|---|
| 59 |
|
|---|
| 60 | MpcGui::~MpcGui() {
|
|---|
| 61 | saveConfig();
|
|---|
| 62 | }
|
|---|
| 63 |
|
|---|
| 64 | void MpcGui::createActions() {
|
|---|
| 65 | timeslider_action = createTimeSliderAction(this);
|
|---|
| 66 | timeslider_action->disable();
|
|---|
| 67 | timeslider_action->setCustomStyle( new MpcTimeSlideStyle() );
|
|---|
| 68 |
|
|---|
| 69 | #if USE_VOLUME_BAR
|
|---|
| 70 | volumeslider_action = createVolumeSliderAction(this);
|
|---|
| 71 | volumeslider_action->disable();
|
|---|
| 72 | volumeslider_action->setCustomStyle( new MpcVolumeSlideStyle() );
|
|---|
| 73 | volumeslider_action->setFixedSize( QSize(50,18) );
|
|---|
| 74 | volumeslider_action->setTickPosition( QSlider::NoTicks );
|
|---|
| 75 | #endif
|
|---|
| 76 |
|
|---|
| 77 | time_label_action = new TimeLabelAction(this);
|
|---|
| 78 | time_label_action->setObjectName("timelabel_action");
|
|---|
| 79 |
|
|---|
| 80 | connect( this, SIGNAL(timeChanged(QString)),
|
|---|
| 81 | time_label_action, SLOT(setText(QString)) );
|
|---|
| 82 | }
|
|---|
| 83 |
|
|---|
| 84 |
|
|---|
| 85 | void MpcGui::createControlWidget() {
|
|---|
| 86 | controlwidget = new QToolBar( this );
|
|---|
| 87 | controlwidget->setObjectName("controlwidget");
|
|---|
| 88 | controlwidget->setLayoutDirection(Qt::LeftToRight);
|
|---|
| 89 |
|
|---|
| 90 | controlwidget->setMovable(false);
|
|---|
| 91 | controlwidget->setAllowedAreas(Qt::BottomToolBarArea);
|
|---|
| 92 | controlwidget->addAction(playAct);
|
|---|
| 93 | controlwidget->addAction(pauseAct);
|
|---|
| 94 | controlwidget->addAction(stopAct);
|
|---|
| 95 | controlwidget->addSeparator();
|
|---|
| 96 | controlwidget->addAction(rewind3Act);
|
|---|
| 97 | controlwidget->addAction(rewind1Act);
|
|---|
| 98 | controlwidget->addAction(forward1Act);
|
|---|
| 99 | controlwidget->addAction(forward3Act);
|
|---|
| 100 | controlwidget->addSeparator();
|
|---|
| 101 | controlwidget->addAction(frameStepAct);
|
|---|
| 102 | controlwidget->addSeparator();
|
|---|
| 103 |
|
|---|
| 104 | QLabel* pLabel = new QLabel(this);
|
|---|
| 105 | pLabel->setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding));
|
|---|
| 106 | controlwidget->addWidget(pLabel);
|
|---|
| 107 |
|
|---|
| 108 | controlwidget->addAction(muteAct);
|
|---|
| 109 | controlwidget->addAction(volumeslider_action);
|
|---|
| 110 |
|
|---|
| 111 | timeslidewidget = new QToolBar( this );
|
|---|
| 112 | timeslidewidget->setObjectName("timeslidewidget");
|
|---|
| 113 | timeslidewidget->setLayoutDirection(Qt::LeftToRight);
|
|---|
| 114 | timeslidewidget->addAction(timeslider_action);
|
|---|
| 115 | timeslidewidget->setMovable(false);
|
|---|
| 116 |
|
|---|
| 117 | /*
|
|---|
| 118 | QColor SliderColor = palette().color(QPalette::Window);
|
|---|
| 119 | QColor SliderBorderColor = palette().color(QPalette::Dark);
|
|---|
| 120 | */
|
|---|
| 121 | setIconSize( QSize( 16 , 16 ) );
|
|---|
| 122 |
|
|---|
| 123 | addToolBar(Qt::BottomToolBarArea, controlwidget);
|
|---|
| 124 | addToolBarBreak(Qt::BottomToolBarArea);
|
|---|
| 125 | addToolBar(Qt::BottomToolBarArea, timeslidewidget);
|
|---|
| 126 |
|
|---|
| 127 | controlwidget->setStyle(new MpcToolbarStyle() );
|
|---|
| 128 | timeslidewidget->setStyle(new MpcToolbarStyle() );
|
|---|
| 129 |
|
|---|
| 130 | statusBar()->show();
|
|---|
| 131 | }
|
|---|
| 132 |
|
|---|
| 133 | void MpcGui::createFloatingControl() {
|
|---|
| 134 | // Floating control
|
|---|
| 135 | floating_control = new AutohideWidget(panel);
|
|---|
| 136 | floating_control->setAutoHide(true);
|
|---|
| 137 | floating_control->hide();
|
|---|
| 138 | spacer = new QSpacerItem(10,10);
|
|---|
| 139 |
|
|---|
| 140 | floating_control_time = new QLabel(floating_control);
|
|---|
| 141 | floating_control_time->setAlignment(Qt::AlignRight);
|
|---|
| 142 | floating_control_time->setAutoFillBackground(true);
|
|---|
| 143 | ColorUtils::setBackgroundColor( floating_control_time, QColor(0,0,0) );
|
|---|
| 144 | ColorUtils::setForegroundColor( floating_control_time, QColor(255,255,255) );
|
|---|
| 145 |
|
|---|
| 146 | }
|
|---|
| 147 |
|
|---|
| 148 | void MpcGui::retranslateStrings() {
|
|---|
| 149 | BaseGuiPlus::retranslateStrings();
|
|---|
| 150 |
|
|---|
| 151 | controlwidget->setWindowTitle( tr("Control bar") );
|
|---|
| 152 | timeslidewidget->setWindowTitle( tr("Seek bar") );
|
|---|
| 153 |
|
|---|
| 154 | setupIcons();
|
|---|
| 155 | }
|
|---|
| 156 |
|
|---|
| 157 | #if AUTODISABLE_ACTIONS
|
|---|
| 158 | void MpcGui::enableActionsOnPlaying() {
|
|---|
| 159 | BaseGuiPlus::enableActionsOnPlaying();
|
|---|
| 160 |
|
|---|
| 161 | timeslider_action->enable();
|
|---|
| 162 | #if USE_VOLUME_BAR
|
|---|
| 163 | volumeslider_action->enable();
|
|---|
| 164 | #endif
|
|---|
| 165 | }
|
|---|
| 166 |
|
|---|
| 167 | void MpcGui::disableActionsOnStop() {
|
|---|
| 168 | BaseGuiPlus::disableActionsOnStop();
|
|---|
| 169 |
|
|---|
| 170 | timeslider_action->disable();
|
|---|
| 171 | #if USE_VOLUME_BAR
|
|---|
| 172 | volumeslider_action->disable();
|
|---|
| 173 | #endif
|
|---|
| 174 | }
|
|---|
| 175 | #endif // AUTODISABLE_ACTIONS
|
|---|
| 176 |
|
|---|
| 177 | void MpcGui::aboutToEnterFullscreen() {
|
|---|
| 178 | BaseGuiPlus::aboutToEnterFullscreen();
|
|---|
| 179 |
|
|---|
| 180 | // Show floating_control
|
|---|
| 181 | // Move controls to the floating_control layout
|
|---|
| 182 | removeToolBarBreak(controlwidget);
|
|---|
| 183 | removeToolBar(controlwidget);
|
|---|
| 184 | removeToolBar(timeslidewidget);
|
|---|
| 185 | floating_control->layout()->addWidget(timeslidewidget);
|
|---|
| 186 | floating_control->layout()->addItem(spacer);
|
|---|
| 187 | floating_control->layout()->addWidget(controlwidget);
|
|---|
| 188 | floating_control->layout()->addWidget(floating_control_time);
|
|---|
| 189 | controlwidget->show();
|
|---|
| 190 | timeslidewidget->show();
|
|---|
| 191 | floating_control->adjustSize();
|
|---|
| 192 |
|
|---|
| 193 | floating_control->setMargin(pref->floating_control_margin);
|
|---|
| 194 | floating_control->setPercWidth(pref->floating_control_width);
|
|---|
| 195 | floating_control->setAnimated(pref->floating_control_animated);
|
|---|
| 196 | floating_control->setActivationArea( (AutohideWidget::Activation) pref->floating_activation_area);
|
|---|
| 197 | floating_control->setHideDelay(pref->floating_hide_delay);
|
|---|
| 198 | QTimer::singleShot(100, floating_control, SLOT(activate()));
|
|---|
| 199 |
|
|---|
| 200 |
|
|---|
| 201 | if (!pref->compact_mode) {
|
|---|
| 202 | //controlwidget->hide();
|
|---|
| 203 | //timeslidewidget->hide();
|
|---|
| 204 | statusBar()->hide();
|
|---|
| 205 | }
|
|---|
| 206 | }
|
|---|
| 207 |
|
|---|
| 208 | void MpcGui::aboutToExitFullscreen() {
|
|---|
| 209 | BaseGuiPlus::aboutToExitFullscreen();
|
|---|
| 210 |
|
|---|
| 211 | // Remove controls from the floating_control and put them back to the mainwindow
|
|---|
| 212 | floating_control->deactivate();
|
|---|
| 213 | floating_control->layout()->removeWidget(controlwidget);
|
|---|
| 214 | floating_control->layout()->removeWidget(timeslidewidget);
|
|---|
| 215 | floating_control->layout()->removeItem(spacer);
|
|---|
| 216 | floating_control->layout()->removeWidget(floating_control_time);
|
|---|
| 217 | addToolBar(Qt::BottomToolBarArea, controlwidget);
|
|---|
| 218 | addToolBarBreak(Qt::BottomToolBarArea);
|
|---|
| 219 | addToolBar(Qt::BottomToolBarArea, timeslidewidget);
|
|---|
| 220 |
|
|---|
| 221 | if (!pref->compact_mode) {
|
|---|
| 222 | controlwidget->show();
|
|---|
| 223 | statusBar()->show();
|
|---|
| 224 | timeslidewidget->show();
|
|---|
| 225 | } else {
|
|---|
| 226 | controlwidget->hide();
|
|---|
| 227 | timeslidewidget->hide();
|
|---|
| 228 | }
|
|---|
| 229 | }
|
|---|
| 230 |
|
|---|
| 231 | void MpcGui::aboutToEnterCompactMode() {
|
|---|
| 232 | BaseGuiPlus::aboutToEnterCompactMode();
|
|---|
| 233 |
|
|---|
| 234 | controlwidget->hide();
|
|---|
| 235 | timeslidewidget->hide();
|
|---|
| 236 | statusBar()->hide();
|
|---|
| 237 | }
|
|---|
| 238 |
|
|---|
| 239 | void MpcGui::aboutToExitCompactMode() {
|
|---|
| 240 | BaseGuiPlus::aboutToExitCompactMode();
|
|---|
| 241 |
|
|---|
| 242 | statusBar()->show();
|
|---|
| 243 | controlwidget->show();
|
|---|
| 244 | timeslidewidget->show();
|
|---|
| 245 | }
|
|---|
| 246 |
|
|---|
| 247 | #if USE_mpcMUMSIZE
|
|---|
| 248 | QSize MpcGui::mpcmumSizeHint() const {
|
|---|
| 249 | return QSize(controlwidget->sizeHint().width(), 0);
|
|---|
| 250 | }
|
|---|
| 251 | #endif
|
|---|
| 252 |
|
|---|
| 253 |
|
|---|
| 254 | void MpcGui::saveConfig() {
|
|---|
| 255 | QSettings * set = settings;
|
|---|
| 256 |
|
|---|
| 257 | set->beginGroup( "mpc_gui");
|
|---|
| 258 |
|
|---|
| 259 | if (pref->save_window_size_on_exit) {
|
|---|
| 260 | qDebug("MpcGui::saveConfig: w: %d h: %d", width(), height());
|
|---|
| 261 | set->setValue( "pos", pos() );
|
|---|
| 262 | set->setValue( "size", size() );
|
|---|
| 263 | set->setValue( "state", (int) windowState() );
|
|---|
| 264 | }
|
|---|
| 265 |
|
|---|
| 266 | set->setValue( "toolbars_state", saveState(Helper::qtVersion()) );
|
|---|
| 267 |
|
|---|
| 268 | set->endGroup();
|
|---|
| 269 | }
|
|---|
| 270 |
|
|---|
| 271 | void MpcGui::loadConfig() {
|
|---|
| 272 | QSettings * set = settings;
|
|---|
| 273 |
|
|---|
| 274 | set->beginGroup( "mpc_gui");
|
|---|
| 275 |
|
|---|
| 276 | if (pref->save_window_size_on_exit) {
|
|---|
| 277 | QPoint p = set->value("pos", pos()).toPoint();
|
|---|
| 278 | QSize s = set->value("size", size()).toSize();
|
|---|
| 279 |
|
|---|
| 280 | if ( (s.height() < 200) && (!pref->use_mplayer_window) ) {
|
|---|
| 281 | s = pref->default_size;
|
|---|
| 282 | }
|
|---|
| 283 |
|
|---|
| 284 | move(p);
|
|---|
| 285 | resize(s);
|
|---|
| 286 |
|
|---|
| 287 | setWindowState( (Qt::WindowStates) set->value("state", 0).toInt() );
|
|---|
| 288 |
|
|---|
| 289 | if (!DesktopInfo::isInsideScreen(this)) {
|
|---|
| 290 | move(0,0);
|
|---|
| 291 | qWarning("MpcGui::loadConfig: window is outside of the screen, moved to 0x0");
|
|---|
| 292 | }
|
|---|
| 293 | }
|
|---|
| 294 |
|
|---|
| 295 | restoreState( set->value( "toolbars_state" ).toByteArray(), Helper::qtVersion() );
|
|---|
| 296 |
|
|---|
| 297 | set->endGroup();
|
|---|
| 298 | }
|
|---|
| 299 |
|
|---|
| 300 | void MpcGui::setupIcons() {
|
|---|
| 301 | playAct->setIcon( QPixmap(":/mpcgui/mpc_toolbar.png").copy(0,0,16,16) );
|
|---|
| 302 | playOrPauseAct->setIcon( QPixmap(":/mpcgui/mpc_toolbar.png").copy(0,0,16,16) );
|
|---|
| 303 | pauseAct->setIcon( QPixmap(":/mpcgui/mpc_toolbar.png").copy(16,0,16,16) );
|
|---|
| 304 | pauseAndStepAct->setIcon( QPixmap(":/mpcgui/mpc_toolbar.png").copy(16,0,16,16) );
|
|---|
| 305 | stopAct->setIcon( QPixmap(":/mpcgui/mpc_toolbar.png").copy(32,0,16,16) );
|
|---|
| 306 | rewind3Act->setIcon( QPixmap(":/mpcgui/mpc_toolbar.png").copy(64,0,16,16) );
|
|---|
| 307 | rewind2Act->setIcon( QPixmap(":/mpcgui/mpc_toolbar.png").copy(80,0,16,16) );
|
|---|
| 308 | rewind1Act->setIcon( QPixmap(":/mpcgui/mpc_toolbar.png").copy(80,0,16,16) );
|
|---|
| 309 | forward1Act->setIcon( QPixmap(":/mpcgui/mpc_toolbar.png").copy(96,0,16,16) );
|
|---|
| 310 | forward2Act->setIcon( QPixmap(":/mpcgui/mpc_toolbar.png").copy(96,0,16,16) );
|
|---|
| 311 | forward3Act->setIcon( QPixmap(":/mpcgui/mpc_toolbar.png").copy(112,0,16,16) );
|
|---|
| 312 | frameStepAct->setIcon( QPixmap(":/mpcgui/mpc_toolbar.png").copy(144,0,16,16) );
|
|---|
| 313 | muteAct->setIcon( QPixmap(":/mpcgui/mpc_toolbar.png").copy(192,0,16,16) );
|
|---|
| 314 |
|
|---|
| 315 | pauseAct->setCheckable(true);
|
|---|
| 316 | playAct->setCheckable(true);
|
|---|
| 317 | stopAct->setCheckable(true);
|
|---|
| 318 | connect( muteAct, SIGNAL(toggled(bool)),
|
|---|
| 319 | this, SLOT(muteIconChange(bool)) );
|
|---|
| 320 |
|
|---|
| 321 | connect( core , SIGNAL(mediaInfoChanged()),
|
|---|
| 322 | this, SLOT(updateAudioChannels()) );
|
|---|
| 323 |
|
|---|
| 324 | connect( core , SIGNAL(stateChanged(Core::State)),
|
|---|
| 325 | this, SLOT(iconChange(Core::State)) );
|
|---|
| 326 | }
|
|---|
| 327 |
|
|---|
| 328 | void MpcGui::iconChange(Core::State state) {
|
|---|
| 329 | playAct->blockSignals(true);
|
|---|
| 330 | pauseAct->blockSignals(true);
|
|---|
| 331 | stopAct->blockSignals(true);
|
|---|
| 332 |
|
|---|
| 333 | if( state == Core::Paused )
|
|---|
| 334 | {
|
|---|
| 335 | playAct->setChecked(false);
|
|---|
| 336 | pauseAct->setChecked(true);
|
|---|
| 337 | stopAct->setChecked(false);
|
|---|
| 338 | }
|
|---|
| 339 | if( state == Core::Playing )
|
|---|
| 340 | {
|
|---|
| 341 | playAct->setChecked(true);
|
|---|
| 342 | pauseAct->setChecked(false);
|
|---|
| 343 | stopAct->setChecked(false);
|
|---|
| 344 | }
|
|---|
| 345 | if( state == Core::Stopped )
|
|---|
| 346 | {
|
|---|
| 347 | playAct->setChecked(false);
|
|---|
| 348 | pauseAct->setChecked(false);
|
|---|
| 349 | stopAct->setChecked(false);
|
|---|
| 350 | }
|
|---|
| 351 |
|
|---|
| 352 | playAct->blockSignals(false);
|
|---|
| 353 | pauseAct->blockSignals(false);
|
|---|
| 354 | stopAct->blockSignals(false);
|
|---|
| 355 | }
|
|---|
| 356 |
|
|---|
| 357 | void MpcGui::muteIconChange(bool b) {
|
|---|
| 358 | if( sender() == muteAct )
|
|---|
| 359 | {
|
|---|
| 360 | if(!b) {
|
|---|
| 361 | muteAct->setIcon( QPixmap(":/mpcgui/mpc_toolbar.png").copy(192,0,16,16) );
|
|---|
| 362 | } else {
|
|---|
| 363 | muteAct->setIcon( QPixmap(":/mpcgui/mpc_toolbar.png").copy(208,0,16,16) );
|
|---|
| 364 | }
|
|---|
| 365 | }
|
|---|
| 366 |
|
|---|
| 367 | }
|
|---|
| 368 |
|
|---|
| 369 |
|
|---|
| 370 | void MpcGui::createStatusBar() {
|
|---|
| 371 |
|
|---|
| 372 | // remove frames around statusbar items
|
|---|
| 373 | statusBar()->setStyleSheet("QStatusBar::item { border: 0px solid black }; ");
|
|---|
| 374 |
|
|---|
| 375 | // emulate mono/stereo display from mpc
|
|---|
| 376 | audiochannel_display = new QLabel( statusBar() );
|
|---|
| 377 | audiochannel_display->setContentsMargins(0,0,0,0);
|
|---|
| 378 | audiochannel_display->setAlignment(Qt::AlignRight);
|
|---|
| 379 | audiochannel_display->setPixmap( QPixmap(":/mpcgui/mpc_stereo.png") );
|
|---|
| 380 | audiochannel_display->setMinimumSize(audiochannel_display->sizeHint());
|
|---|
| 381 | audiochannel_display->setMaximumSize(audiochannel_display->sizeHint());
|
|---|
| 382 | audiochannel_display->setPixmap( QPixmap("") );
|
|---|
| 383 |
|
|---|
| 384 | time_display = new QLabel( statusBar() );
|
|---|
| 385 | time_display->setAlignment(Qt::AlignRight);
|
|---|
| 386 | time_display->setText(" 88:88:88 / 88:88:88 ");
|
|---|
| 387 | time_display->setMinimumSize(time_display->sizeHint());
|
|---|
| 388 | time_display->setContentsMargins(15,2,1,1);
|
|---|
| 389 |
|
|---|
| 390 | frame_display = new QLabel( statusBar() );
|
|---|
| 391 | frame_display->setAlignment(Qt::AlignRight);
|
|---|
| 392 | frame_display->setText("88888888");
|
|---|
| 393 | frame_display->setMinimumSize(frame_display->sizeHint());
|
|---|
| 394 | frame_display->setContentsMargins(15,2,1,1);
|
|---|
| 395 |
|
|---|
| 396 | statusBar()->setAutoFillBackground(TRUE);
|
|---|
| 397 |
|
|---|
| 398 | ColorUtils::setBackgroundColor( statusBar(), QColor(0,0,0) );
|
|---|
| 399 | ColorUtils::setForegroundColor( statusBar(), QColor(255,255,255) );
|
|---|
| 400 | ColorUtils::setBackgroundColor( time_display, QColor(0,0,0) );
|
|---|
| 401 | ColorUtils::setForegroundColor( time_display, QColor(255,255,255) );
|
|---|
| 402 | ColorUtils::setBackgroundColor( frame_display, QColor(0,0,0) );
|
|---|
| 403 | ColorUtils::setForegroundColor( frame_display, QColor(255,255,255) );
|
|---|
| 404 | ColorUtils::setBackgroundColor( audiochannel_display, QColor(0,0,0) );
|
|---|
| 405 | ColorUtils::setForegroundColor( audiochannel_display, QColor(255,255,255) );
|
|---|
| 406 | statusBar()->setSizeGripEnabled(FALSE);
|
|---|
| 407 |
|
|---|
| 408 |
|
|---|
| 409 |
|
|---|
| 410 | statusBar()->addPermanentWidget( frame_display, 0 );
|
|---|
| 411 | frame_display->setText( "0" );
|
|---|
| 412 |
|
|---|
| 413 | statusBar()->addPermanentWidget( time_display, 0 );
|
|---|
| 414 | time_display->setText(" 00:00:00 / 00:00:00 ");
|
|---|
| 415 |
|
|---|
| 416 | statusBar()->addPermanentWidget( audiochannel_display, 0 );
|
|---|
| 417 |
|
|---|
| 418 | time_display->show();
|
|---|
| 419 | frame_display->hide();
|
|---|
| 420 |
|
|---|
| 421 | connect( this, SIGNAL(timeChanged(QString)),
|
|---|
| 422 | this, SLOT(displayTime(QString)) );
|
|---|
| 423 |
|
|---|
| 424 | connect( this, SIGNAL(frameChanged(int)),
|
|---|
| 425 | this, SLOT(displayFrame(int)) );
|
|---|
| 426 | }
|
|---|
| 427 |
|
|---|
| 428 | void MpcGui::displayTime(QString text) {
|
|---|
| 429 | time_display->setText( text );
|
|---|
| 430 | time_label_action->setText(text );
|
|---|
| 431 | floating_control_time->setText(text);
|
|---|
| 432 | }
|
|---|
| 433 |
|
|---|
| 434 | void MpcGui::displayFrame(int frame) {
|
|---|
| 435 | if (frame_display->isVisible()) {
|
|---|
| 436 | frame_display->setNum( frame );
|
|---|
| 437 | }
|
|---|
| 438 | }
|
|---|
| 439 |
|
|---|
| 440 | void MpcGui::updateAudioChannels() {
|
|---|
| 441 | if( core->mdat.audio_nch == 1 ) {
|
|---|
| 442 | audiochannel_display->setPixmap( QPixmap(":/mpcgui/mpc_mono.png") );
|
|---|
| 443 | }
|
|---|
| 444 | else {
|
|---|
| 445 | audiochannel_display->setPixmap( QPixmap(":/mpcgui/mpc_stereo.png") );
|
|---|
| 446 | }
|
|---|
| 447 | }
|
|---|
| 448 |
|
|---|
| 449 | void MpcGui::showFullscreenControls() {
|
|---|
| 450 |
|
|---|
| 451 | if(pref->fullscreen && controlwidget->isHidden() && timeslidewidget->isHidden() &&
|
|---|
| 452 | !pref->compact_mode )
|
|---|
| 453 | {
|
|---|
| 454 | controlwidget->show();
|
|---|
| 455 | timeslidewidget->show();
|
|---|
| 456 | statusBar()->show();
|
|---|
| 457 | }
|
|---|
| 458 | }
|
|---|
| 459 |
|
|---|
| 460 | void MpcGui::hideFullscreenControls() {
|
|---|
| 461 |
|
|---|
| 462 | if(pref->fullscreen && controlwidget->isVisible() && timeslidewidget->isVisible() )
|
|---|
| 463 | {
|
|---|
| 464 | controlwidget->hide();
|
|---|
| 465 | timeslidewidget->hide();
|
|---|
| 466 | statusBar()->hide();
|
|---|
| 467 | }
|
|---|
| 468 | }
|
|---|
| 469 |
|
|---|
| 470 | void MpcGui::setJumpTexts() {
|
|---|
| 471 | rewind1Act->change( tr("-%1").arg(Helper::timeForJumps(pref->seeking1)) );
|
|---|
| 472 | rewind2Act->change( tr("-%1").arg(Helper::timeForJumps(pref->seeking2)) );
|
|---|
| 473 | rewind3Act->change( tr("-%1").arg(Helper::timeForJumps(pref->seeking3)) );
|
|---|
| 474 |
|
|---|
| 475 | forward1Act->change( tr("+%1").arg(Helper::timeForJumps(pref->seeking1)) );
|
|---|
| 476 | forward2Act->change( tr("+%1").arg(Helper::timeForJumps(pref->seeking2)) );
|
|---|
| 477 | forward3Act->change( tr("+%1").arg(Helper::timeForJumps(pref->seeking3)) );
|
|---|
| 478 |
|
|---|
| 479 | /*
|
|---|
| 480 | if (qApp->isLeftToRight()) {
|
|---|
| 481 | */
|
|---|
| 482 | rewind1Act->setIcon( QPixmap(":/mpcgui/mpc_toolbar.png").copy(80,0,16,16) );
|
|---|
| 483 | rewind2Act->setIcon( QPixmap(":/mpcgui/mpc_toolbar.png").copy(80,0,16,16) );
|
|---|
| 484 | rewind3Act->setIcon( QPixmap(":/mpcgui/mpc_toolbar.png").copy(64,0,16,16) );
|
|---|
| 485 |
|
|---|
| 486 | forward1Act->setIcon( QPixmap(":/mpcgui/mpc_toolbar.png").copy(96,0,16,16) );
|
|---|
| 487 | forward2Act->setIcon( QPixmap(":/mpcgui/mpc_toolbar.png").copy(96,0,16,16) );
|
|---|
| 488 | forward3Act->setIcon( QPixmap(":/mpcgui/mpc_toolbar.png").copy(112,0,16,16) );
|
|---|
| 489 | /*
|
|---|
| 490 | } else {
|
|---|
| 491 | rewind1Act->setIcon( QPixmap(":/mpcgui/mpc_toolbar.png").copy(96,0,16,16) );
|
|---|
| 492 | rewind2Act->setIcon( QPixmap(":/mpcgui/mpc_toolbar.png").copy(96,0,16,16) );
|
|---|
| 493 | rewind3Act->setIcon( QPixmap(":/mpcgui/mpc_toolbar.png").copy(112,0,16,16) );
|
|---|
| 494 |
|
|---|
| 495 | forward1Act->setIcon( QPixmap(":/mpcgui/mpc_toolbar.png").copy(80,0,16,16) );
|
|---|
| 496 | forward2Act->setIcon( QPixmap(":/mpcgui/mpc_toolbar.png").copy(80,0,16,16) );
|
|---|
| 497 | forward3Act->setIcon( QPixmap(":/mpcgui/mpc_toolbar.png").copy(64,0,16,16) );
|
|---|
| 498 | }
|
|---|
| 499 | */
|
|---|
| 500 | }
|
|---|
| 501 |
|
|---|
| 502 | void MpcGui::updateWidgets() {
|
|---|
| 503 |
|
|---|
| 504 | BaseGui::updateWidgets();
|
|---|
| 505 |
|
|---|
| 506 | // Frame counter
|
|---|
| 507 | /* frame_display->setVisible( pref->show_frame_counter ); */
|
|---|
| 508 | }
|
|---|
| 509 |
|
|---|
| 510 | #include "moc_mpcgui.cpp"
|
|---|
| 511 |
|
|---|