[113] | 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"
|
---|
[165] | 22 | #include "autohidewidget.h"
|
---|
[113] | 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>
|
---|
[165] | 34 | #include <QLayout>
|
---|
[113] | 35 | #include <QApplication>
|
---|
| 36 |
|
---|
| 37 | using namespace Global;
|
---|
| 38 |
|
---|
| 39 |
|
---|
[128] | 40 | MpcGui::MpcGui( QWidget * parent, Qt::WindowFlags flags )
|
---|
| 41 | : BaseGuiPlus( parent, flags )
|
---|
[113] | 42 | {
|
---|
| 43 | createActions();
|
---|
| 44 | createControlWidget();
|
---|
[165] | 45 | createStatusBar();
|
---|
| 46 | createFloatingControl();
|
---|
[181] | 47 | populateMainMenu();
|
---|
[113] | 48 |
|
---|
| 49 | retranslateStrings();
|
---|
| 50 |
|
---|
| 51 | loadConfig();
|
---|
| 52 |
|
---|
| 53 | if (pref->compact_mode) {
|
---|
| 54 | controlwidget->hide();
|
---|
[176] | 55 | timeslidewidget->hide();
|
---|
[113] | 56 | }
|
---|
[176] | 57 |
|
---|
| 58 | applyStyles();
|
---|
[113] | 59 | }
|
---|
| 60 |
|
---|
| 61 | MpcGui::~MpcGui() {
|
---|
| 62 | saveConfig();
|
---|
| 63 | }
|
---|
| 64 |
|
---|
| 65 | void MpcGui::createActions() {
|
---|
| 66 | timeslider_action = createTimeSliderAction(this);
|
---|
| 67 | timeslider_action->disable();
|
---|
| 68 | timeslider_action->setCustomStyle( new MpcTimeSlideStyle() );
|
---|
| 69 |
|
---|
| 70 | #if USE_VOLUME_BAR
|
---|
| 71 | volumeslider_action = createVolumeSliderAction(this);
|
---|
| 72 | volumeslider_action->disable();
|
---|
[181] | 73 | volumeslider_action->setCustomStyle( new MpcVolumeSlideStyle() );
|
---|
| 74 | volumeslider_action->setFixedSize( QSize(50,18) );
|
---|
[113] | 75 | volumeslider_action->setTickPosition( QSlider::NoTicks );
|
---|
| 76 | #endif
|
---|
| 77 | }
|
---|
| 78 |
|
---|
| 79 |
|
---|
| 80 | void MpcGui::createControlWidget() {
|
---|
| 81 | controlwidget = new QToolBar( this );
|
---|
| 82 | controlwidget->setObjectName("controlwidget");
|
---|
[156] | 83 | controlwidget->setLayoutDirection(Qt::LeftToRight);
|
---|
| 84 |
|
---|
[113] | 85 | controlwidget->setMovable(false);
|
---|
| 86 | controlwidget->setAllowedAreas(Qt::BottomToolBarArea);
|
---|
| 87 | controlwidget->addAction(playAct);
|
---|
[165] | 88 | controlwidget->addAction(pauseAct);
|
---|
[113] | 89 | controlwidget->addAction(stopAct);
|
---|
| 90 | controlwidget->addSeparator();
|
---|
[165] | 91 | controlwidget->addAction(rewind3Act);
|
---|
| 92 | controlwidget->addAction(rewind1Act);
|
---|
| 93 | controlwidget->addAction(forward1Act);
|
---|
| 94 | controlwidget->addAction(forward3Act);
|
---|
| 95 | controlwidget->addSeparator();
|
---|
| 96 | controlwidget->addAction(frameStepAct);
|
---|
| 97 | controlwidget->addSeparator();
|
---|
[113] | 98 |
|
---|
[165] | 99 | QLabel* pLabel = new QLabel(this);
|
---|
| 100 | pLabel->setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding));
|
---|
| 101 | controlwidget->addWidget(pLabel);
|
---|
[113] | 102 |
|
---|
| 103 | controlwidget->addAction(muteAct);
|
---|
| 104 | controlwidget->addAction(volumeslider_action);
|
---|
| 105 |
|
---|
[156] | 106 | timeslidewidget = new QToolBar( this );
|
---|
[113] | 107 | timeslidewidget->setObjectName("timeslidewidget");
|
---|
[156] | 108 | timeslidewidget->setLayoutDirection(Qt::LeftToRight);
|
---|
[113] | 109 | timeslidewidget->addAction(timeslider_action);
|
---|
[165] | 110 | timeslidewidget->setMovable(false);
|
---|
[113] | 111 |
|
---|
[165] | 112 | /*
|
---|
| 113 | QColor SliderColor = palette().color(QPalette::Window);
|
---|
| 114 | QColor SliderBorderColor = palette().color(QPalette::Dark);
|
---|
| 115 | */
|
---|
| 116 | setIconSize( QSize( 16 , 16 ) );
|
---|
| 117 |
|
---|
| 118 | addToolBar(Qt::BottomToolBarArea, controlwidget);
|
---|
| 119 | addToolBarBreak(Qt::BottomToolBarArea);
|
---|
[113] | 120 | addToolBar(Qt::BottomToolBarArea, timeslidewidget);
|
---|
| 121 |
|
---|
[165] | 122 | controlwidget->setStyle(new MpcToolbarStyle() );
|
---|
| 123 | timeslidewidget->setStyle(new MpcToolbarStyle() );
|
---|
[113] | 124 |
|
---|
[165] | 125 | statusBar()->show();
|
---|
[113] | 126 | }
|
---|
| 127 |
|
---|
[165] | 128 | void MpcGui::createFloatingControl() {
|
---|
| 129 | // Floating control
|
---|
[181] | 130 | floating_control = new AutohideWidget(mplayerwindow);
|
---|
[165] | 131 | floating_control->setAutoHide(true);
|
---|
| 132 | floating_control->hide();
|
---|
| 133 | spacer = new QSpacerItem(10,10);
|
---|
[170] | 134 |
|
---|
| 135 | floating_control_time = new QLabel(floating_control);
|
---|
| 136 | floating_control_time->setAlignment(Qt::AlignRight);
|
---|
| 137 | floating_control_time->setAutoFillBackground(true);
|
---|
[181] | 138 | floating_control_time->setObjectName("floating_control_time");
|
---|
| 139 | #ifdef CHANGE_WIDGET_COLOR
|
---|
[170] | 140 | ColorUtils::setBackgroundColor( floating_control_time, QColor(0,0,0) );
|
---|
| 141 | ColorUtils::setForegroundColor( floating_control_time, QColor(255,255,255) );
|
---|
[181] | 142 | #endif
|
---|
[170] | 143 |
|
---|
[181] | 144 | connect(this, SIGNAL(timeChanged(QString)), floating_control_time, SLOT(setText(QString)));
|
---|
[165] | 145 | }
|
---|
| 146 |
|
---|
[113] | 147 | void MpcGui::retranslateStrings() {
|
---|
| 148 | BaseGuiPlus::retranslateStrings();
|
---|
| 149 |
|
---|
| 150 | controlwidget->setWindowTitle( tr("Control bar") );
|
---|
[128] | 151 | timeslidewidget->setWindowTitle( tr("Seek bar") );
|
---|
[113] | 152 |
|
---|
[181] | 153 | setupIcons();
|
---|
[113] | 154 | }
|
---|
| 155 |
|
---|
| 156 | #if AUTODISABLE_ACTIONS
|
---|
| 157 | void MpcGui::enableActionsOnPlaying() {
|
---|
| 158 | BaseGuiPlus::enableActionsOnPlaying();
|
---|
| 159 |
|
---|
| 160 | timeslider_action->enable();
|
---|
| 161 | #if USE_VOLUME_BAR
|
---|
| 162 | volumeslider_action->enable();
|
---|
| 163 | #endif
|
---|
| 164 | }
|
---|
| 165 |
|
---|
| 166 | void MpcGui::disableActionsOnStop() {
|
---|
| 167 | BaseGuiPlus::disableActionsOnStop();
|
---|
| 168 |
|
---|
| 169 | timeslider_action->disable();
|
---|
| 170 | #if USE_VOLUME_BAR
|
---|
| 171 | volumeslider_action->disable();
|
---|
| 172 | #endif
|
---|
| 173 | }
|
---|
| 174 | #endif // AUTODISABLE_ACTIONS
|
---|
| 175 |
|
---|
| 176 | void MpcGui::aboutToEnterFullscreen() {
|
---|
| 177 | BaseGuiPlus::aboutToEnterFullscreen();
|
---|
| 178 |
|
---|
[165] | 179 | // Show floating_control
|
---|
| 180 | // Move controls to the floating_control layout
|
---|
| 181 | removeToolBarBreak(controlwidget);
|
---|
| 182 | removeToolBar(controlwidget);
|
---|
| 183 | removeToolBar(timeslidewidget);
|
---|
| 184 | floating_control->layout()->addWidget(timeslidewidget);
|
---|
| 185 | floating_control->layout()->addItem(spacer);
|
---|
| 186 | floating_control->layout()->addWidget(controlwidget);
|
---|
[170] | 187 | floating_control->layout()->addWidget(floating_control_time);
|
---|
[165] | 188 | controlwidget->show();
|
---|
| 189 | timeslidewidget->show();
|
---|
| 190 | floating_control->adjustSize();
|
---|
| 191 |
|
---|
| 192 | floating_control->setMargin(pref->floating_control_margin);
|
---|
| 193 | floating_control->setPercWidth(pref->floating_control_width);
|
---|
| 194 | floating_control->setAnimated(pref->floating_control_animated);
|
---|
| 195 | floating_control->setActivationArea( (AutohideWidget::Activation) pref->floating_activation_area);
|
---|
| 196 | floating_control->setHideDelay(pref->floating_hide_delay);
|
---|
[176] | 197 | QTimer::singleShot(100, floating_control, SLOT(activate()));
|
---|
[165] | 198 |
|
---|
| 199 |
|
---|
[113] | 200 | if (!pref->compact_mode) {
|
---|
[165] | 201 | //controlwidget->hide();
|
---|
| 202 | //timeslidewidget->hide();
|
---|
| 203 | statusBar()->hide();
|
---|
[113] | 204 | }
|
---|
| 205 | }
|
---|
| 206 |
|
---|
| 207 | void MpcGui::aboutToExitFullscreen() {
|
---|
| 208 | BaseGuiPlus::aboutToExitFullscreen();
|
---|
| 209 |
|
---|
[165] | 210 | // Remove controls from the floating_control and put them back to the mainwindow
|
---|
| 211 | floating_control->deactivate();
|
---|
| 212 | floating_control->layout()->removeWidget(controlwidget);
|
---|
| 213 | floating_control->layout()->removeWidget(timeslidewidget);
|
---|
| 214 | floating_control->layout()->removeItem(spacer);
|
---|
[170] | 215 | floating_control->layout()->removeWidget(floating_control_time);
|
---|
[165] | 216 | addToolBar(Qt::BottomToolBarArea, controlwidget);
|
---|
| 217 | addToolBarBreak(Qt::BottomToolBarArea);
|
---|
| 218 | addToolBar(Qt::BottomToolBarArea, timeslidewidget);
|
---|
| 219 |
|
---|
[113] | 220 | if (!pref->compact_mode) {
|
---|
| 221 | controlwidget->show();
|
---|
[165] | 222 | statusBar()->show();
|
---|
| 223 | timeslidewidget->show();
|
---|
| 224 | } else {
|
---|
| 225 | controlwidget->hide();
|
---|
| 226 | timeslidewidget->hide();
|
---|
[113] | 227 | }
|
---|
| 228 | }
|
---|
| 229 |
|
---|
| 230 | void MpcGui::aboutToEnterCompactMode() {
|
---|
| 231 | BaseGuiPlus::aboutToEnterCompactMode();
|
---|
| 232 |
|
---|
| 233 | controlwidget->hide();
|
---|
[165] | 234 | timeslidewidget->hide();
|
---|
| 235 | statusBar()->hide();
|
---|
[113] | 236 | }
|
---|
| 237 |
|
---|
| 238 | void MpcGui::aboutToExitCompactMode() {
|
---|
| 239 | BaseGuiPlus::aboutToExitCompactMode();
|
---|
| 240 |
|
---|
| 241 | statusBar()->show();
|
---|
| 242 | controlwidget->show();
|
---|
[165] | 243 | timeslidewidget->show();
|
---|
[113] | 244 | }
|
---|
| 245 |
|
---|
| 246 | #if USE_mpcMUMSIZE
|
---|
| 247 | QSize MpcGui::mpcmumSizeHint() const {
|
---|
| 248 | return QSize(controlwidget->sizeHint().width(), 0);
|
---|
| 249 | }
|
---|
| 250 | #endif
|
---|
| 251 |
|
---|
| 252 |
|
---|
| 253 | void MpcGui::saveConfig() {
|
---|
| 254 | QSettings * set = settings;
|
---|
| 255 |
|
---|
| 256 | set->beginGroup( "mpc_gui");
|
---|
| 257 |
|
---|
| 258 | if (pref->save_window_size_on_exit) {
|
---|
| 259 | qDebug("MpcGui::saveConfig: w: %d h: %d", width(), height());
|
---|
| 260 | set->setValue( "pos", pos() );
|
---|
| 261 | set->setValue( "size", size() );
|
---|
[156] | 262 | set->setValue( "state", (int) windowState() );
|
---|
[113] | 263 | }
|
---|
| 264 |
|
---|
| 265 | set->setValue( "toolbars_state", saveState(Helper::qtVersion()) );
|
---|
| 266 |
|
---|
| 267 | set->endGroup();
|
---|
| 268 | }
|
---|
| 269 |
|
---|
| 270 | void MpcGui::loadConfig() {
|
---|
| 271 | QSettings * set = settings;
|
---|
| 272 |
|
---|
| 273 | set->beginGroup( "mpc_gui");
|
---|
| 274 |
|
---|
| 275 | if (pref->save_window_size_on_exit) {
|
---|
| 276 | QPoint p = set->value("pos", pos()).toPoint();
|
---|
| 277 | QSize s = set->value("size", size()).toSize();
|
---|
| 278 |
|
---|
| 279 | if ( (s.height() < 200) && (!pref->use_mplayer_window) ) {
|
---|
| 280 | s = pref->default_size;
|
---|
| 281 | }
|
---|
| 282 |
|
---|
| 283 | move(p);
|
---|
| 284 | resize(s);
|
---|
| 285 |
|
---|
[156] | 286 | setWindowState( (Qt::WindowStates) set->value("state", 0).toInt() );
|
---|
| 287 |
|
---|
[113] | 288 | if (!DesktopInfo::isInsideScreen(this)) {
|
---|
[181] | 289 | QPoint tl = DesktopInfo::topLeftPrimaryScreen();
|
---|
| 290 | move(tl);
|
---|
| 291 | qWarning("DefaultGui::loadConfig: window is outside of the screen, moved to %d x %d", tl.x(), tl.y());
|
---|
[113] | 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);
|
---|
[181] | 318 |
|
---|
[113] | 319 | connect( muteAct, SIGNAL(toggled(bool)),
|
---|
| 320 | this, SLOT(muteIconChange(bool)) );
|
---|
| 321 |
|
---|
| 322 | connect( core , SIGNAL(mediaInfoChanged()),
|
---|
| 323 | this, SLOT(updateAudioChannels()) );
|
---|
| 324 |
|
---|
[181] | 325 | connect( core , SIGNAL(stateChanged(Core::State)),
|
---|
[113] | 326 | this, SLOT(iconChange(Core::State)) );
|
---|
| 327 | }
|
---|
| 328 |
|
---|
| 329 | void MpcGui::iconChange(Core::State state) {
|
---|
| 330 | playAct->blockSignals(true);
|
---|
| 331 | pauseAct->blockSignals(true);
|
---|
| 332 | stopAct->blockSignals(true);
|
---|
| 333 |
|
---|
| 334 | if( state == Core::Paused )
|
---|
| 335 | {
|
---|
| 336 | playAct->setChecked(false);
|
---|
| 337 | pauseAct->setChecked(true);
|
---|
| 338 | stopAct->setChecked(false);
|
---|
| 339 | }
|
---|
| 340 | if( state == Core::Playing )
|
---|
| 341 | {
|
---|
| 342 | playAct->setChecked(true);
|
---|
| 343 | pauseAct->setChecked(false);
|
---|
| 344 | stopAct->setChecked(false);
|
---|
| 345 | }
|
---|
| 346 | if( state == Core::Stopped )
|
---|
| 347 | {
|
---|
| 348 | playAct->setChecked(false);
|
---|
| 349 | pauseAct->setChecked(false);
|
---|
| 350 | stopAct->setChecked(false);
|
---|
| 351 | }
|
---|
| 352 |
|
---|
| 353 | playAct->blockSignals(false);
|
---|
| 354 | pauseAct->blockSignals(false);
|
---|
| 355 | stopAct->blockSignals(false);
|
---|
| 356 | }
|
---|
| 357 |
|
---|
| 358 | void MpcGui::muteIconChange(bool b) {
|
---|
| 359 | if( sender() == muteAct )
|
---|
| 360 | {
|
---|
| 361 | if(!b) {
|
---|
| 362 | muteAct->setIcon( QPixmap(":/mpcgui/mpc_toolbar.png").copy(192,0,16,16) );
|
---|
| 363 | } else {
|
---|
| 364 | muteAct->setIcon( QPixmap(":/mpcgui/mpc_toolbar.png").copy(208,0,16,16) );
|
---|
| 365 | }
|
---|
| 366 | }
|
---|
| 367 |
|
---|
| 368 | }
|
---|
| 369 |
|
---|
| 370 |
|
---|
| 371 | void MpcGui::createStatusBar() {
|
---|
| 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("") );
|
---|
[181] | 383 |
|
---|
[113] | 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());
|
---|
[181] | 388 | time_display->setContentsMargins(15,2,1,1);
|
---|
[113] | 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());
|
---|
[181] | 394 | frame_display->setContentsMargins(15,2,1,1);
|
---|
[113] | 395 |
|
---|
[181] | 396 | statusBar()->setAutoFillBackground(true);
|
---|
[113] | 397 |
|
---|
[181] | 398 | #ifdef CHANGE_WIDGET_COLOR
|
---|
[113] | 399 | ColorUtils::setBackgroundColor( statusBar(), QColor(0,0,0) );
|
---|
| 400 | ColorUtils::setForegroundColor( statusBar(), QColor(255,255,255) );
|
---|
| 401 | ColorUtils::setBackgroundColor( time_display, QColor(0,0,0) );
|
---|
| 402 | ColorUtils::setForegroundColor( time_display, QColor(255,255,255) );
|
---|
| 403 | ColorUtils::setBackgroundColor( frame_display, QColor(0,0,0) );
|
---|
| 404 | ColorUtils::setForegroundColor( frame_display, QColor(255,255,255) );
|
---|
| 405 | ColorUtils::setBackgroundColor( audiochannel_display, QColor(0,0,0) );
|
---|
| 406 | ColorUtils::setForegroundColor( audiochannel_display, QColor(255,255,255) );
|
---|
[181] | 407 | #endif
|
---|
[113] | 408 |
|
---|
[181] | 409 | statusBar()->setSizeGripEnabled(false);
|
---|
[113] | 410 |
|
---|
| 411 | statusBar()->addPermanentWidget( frame_display, 0 );
|
---|
| 412 | frame_display->setText( "0" );
|
---|
| 413 |
|
---|
[181] | 414 | statusBar()->addPermanentWidget( time_display, 0 );
|
---|
[113] | 415 | time_display->setText(" 00:00:00 / 00:00:00 ");
|
---|
| 416 |
|
---|
[181] | 417 | statusBar()->addPermanentWidget( audiochannel_display, 0 );
|
---|
[113] | 418 |
|
---|
| 419 | time_display->show();
|
---|
| 420 | frame_display->hide();
|
---|
| 421 |
|
---|
[181] | 422 | connect(this, SIGNAL(timeChanged(QString)), time_display, SLOT(setText(QString)));
|
---|
| 423 | connect(this, SIGNAL(frameChanged(int)), this, SLOT(displayFrame(int)));
|
---|
[113] | 424 | }
|
---|
| 425 |
|
---|
| 426 | void MpcGui::displayFrame(int frame) {
|
---|
| 427 | if (frame_display->isVisible()) {
|
---|
| 428 | frame_display->setNum( frame );
|
---|
| 429 | }
|
---|
| 430 | }
|
---|
| 431 |
|
---|
| 432 | void MpcGui::updateAudioChannels() {
|
---|
| 433 | if( core->mdat.audio_nch == 1 ) {
|
---|
| 434 | audiochannel_display->setPixmap( QPixmap(":/mpcgui/mpc_mono.png") );
|
---|
| 435 | }
|
---|
| 436 | else {
|
---|
| 437 | audiochannel_display->setPixmap( QPixmap(":/mpcgui/mpc_stereo.png") );
|
---|
| 438 | }
|
---|
| 439 | }
|
---|
| 440 |
|
---|
| 441 | void MpcGui::showFullscreenControls() {
|
---|
| 442 |
|
---|
| 443 | if(pref->fullscreen && controlwidget->isHidden() && timeslidewidget->isHidden() &&
|
---|
| 444 | !pref->compact_mode )
|
---|
| 445 | {
|
---|
[181] | 446 | controlwidget->show();
|
---|
[113] | 447 | timeslidewidget->show();
|
---|
| 448 | statusBar()->show();
|
---|
| 449 | }
|
---|
| 450 | }
|
---|
| 451 |
|
---|
| 452 | void MpcGui::hideFullscreenControls() {
|
---|
| 453 |
|
---|
| 454 | if(pref->fullscreen && controlwidget->isVisible() && timeslidewidget->isVisible() )
|
---|
| 455 | {
|
---|
| 456 | controlwidget->hide();
|
---|
| 457 | timeslidewidget->hide();
|
---|
| 458 | statusBar()->hide();
|
---|
| 459 | }
|
---|
| 460 | }
|
---|
| 461 |
|
---|
| 462 | void MpcGui::setJumpTexts() {
|
---|
| 463 | rewind1Act->change( tr("-%1").arg(Helper::timeForJumps(pref->seeking1)) );
|
---|
| 464 | rewind2Act->change( tr("-%1").arg(Helper::timeForJumps(pref->seeking2)) );
|
---|
| 465 | rewind3Act->change( tr("-%1").arg(Helper::timeForJumps(pref->seeking3)) );
|
---|
| 466 |
|
---|
| 467 | forward1Act->change( tr("+%1").arg(Helper::timeForJumps(pref->seeking1)) );
|
---|
| 468 | forward2Act->change( tr("+%1").arg(Helper::timeForJumps(pref->seeking2)) );
|
---|
| 469 | forward3Act->change( tr("+%1").arg(Helper::timeForJumps(pref->seeking3)) );
|
---|
| 470 |
|
---|
[156] | 471 | /*
|
---|
[113] | 472 | if (qApp->isLeftToRight()) {
|
---|
[156] | 473 | */
|
---|
[113] | 474 | rewind1Act->setIcon( QPixmap(":/mpcgui/mpc_toolbar.png").copy(80,0,16,16) );
|
---|
| 475 | rewind2Act->setIcon( QPixmap(":/mpcgui/mpc_toolbar.png").copy(80,0,16,16) );
|
---|
| 476 | rewind3Act->setIcon( QPixmap(":/mpcgui/mpc_toolbar.png").copy(64,0,16,16) );
|
---|
| 477 |
|
---|
| 478 | forward1Act->setIcon( QPixmap(":/mpcgui/mpc_toolbar.png").copy(96,0,16,16) );
|
---|
| 479 | forward2Act->setIcon( QPixmap(":/mpcgui/mpc_toolbar.png").copy(96,0,16,16) );
|
---|
| 480 | forward3Act->setIcon( QPixmap(":/mpcgui/mpc_toolbar.png").copy(112,0,16,16) );
|
---|
[156] | 481 | /*
|
---|
[113] | 482 | } else {
|
---|
| 483 | rewind1Act->setIcon( QPixmap(":/mpcgui/mpc_toolbar.png").copy(96,0,16,16) );
|
---|
| 484 | rewind2Act->setIcon( QPixmap(":/mpcgui/mpc_toolbar.png").copy(96,0,16,16) );
|
---|
| 485 | rewind3Act->setIcon( QPixmap(":/mpcgui/mpc_toolbar.png").copy(112,0,16,16) );
|
---|
| 486 |
|
---|
| 487 | forward1Act->setIcon( QPixmap(":/mpcgui/mpc_toolbar.png").copy(80,0,16,16) );
|
---|
| 488 | forward2Act->setIcon( QPixmap(":/mpcgui/mpc_toolbar.png").copy(80,0,16,16) );
|
---|
| 489 | forward3Act->setIcon( QPixmap(":/mpcgui/mpc_toolbar.png").copy(64,0,16,16) );
|
---|
| 490 | }
|
---|
[156] | 491 | */
|
---|
[113] | 492 | }
|
---|
| 493 |
|
---|
| 494 | void MpcGui::updateWidgets() {
|
---|
[188] | 495 | BaseGuiPlus::updateWidgets();
|
---|
[113] | 496 |
|
---|
| 497 | // Frame counter
|
---|
| 498 | /* frame_display->setVisible( pref->show_frame_counter ); */
|
---|
| 499 | }
|
---|
| 500 |
|
---|
| 501 | #include "moc_mpcgui.cpp"
|
---|
| 502 |
|
---|