| 1 | /* smplayer, GUI front-end for mplayer.
|
|---|
| 2 | Copyright (C) 2006-2012 Ricardo Villalba <rvm@users.sourceforge.net>
|
|---|
| 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 "basegui.h"
|
|---|
| 20 |
|
|---|
| 21 | #include "filedialog.h"
|
|---|
| 22 | #include <QMessageBox>
|
|---|
| 23 | #include <QLabel>
|
|---|
| 24 | #include <QMenu>
|
|---|
| 25 | #include <QFileInfo>
|
|---|
| 26 | #include <QApplication>
|
|---|
| 27 | #include <QMenuBar>
|
|---|
| 28 | #include <QHBoxLayout>
|
|---|
| 29 | #include <QCursor>
|
|---|
| 30 | #include <QTimer>
|
|---|
| 31 | #include <QStyle>
|
|---|
| 32 | #include <QRegExp>
|
|---|
| 33 | #include <QStatusBar>
|
|---|
| 34 | #include <QActionGroup>
|
|---|
| 35 | #include <QUrl>
|
|---|
| 36 | #include <QDragEnterEvent>
|
|---|
| 37 | #include <QDropEvent>
|
|---|
| 38 | #include <QDesktopServices>
|
|---|
| 39 | #include <QInputDialog>
|
|---|
| 40 |
|
|---|
| 41 | #include <cmath>
|
|---|
| 42 |
|
|---|
| 43 | #include "mplayerwindow.h"
|
|---|
| 44 | #include "desktopinfo.h"
|
|---|
| 45 | #include "helper.h"
|
|---|
| 46 | #include "paths.h"
|
|---|
| 47 | #include "colorutils.h"
|
|---|
| 48 | #include "global.h"
|
|---|
| 49 | #include "translator.h"
|
|---|
| 50 | #include "images.h"
|
|---|
| 51 | #include "preferences.h"
|
|---|
| 52 | #include "discname.h"
|
|---|
| 53 | #include "timeslider.h"
|
|---|
| 54 | #include "logwindow.h"
|
|---|
| 55 | #include "playlist.h"
|
|---|
| 56 | #include "filepropertiesdialog.h"
|
|---|
| 57 | #include "eqslider.h"
|
|---|
| 58 | #include "videoequalizer.h"
|
|---|
| 59 | #include "audioequalizer.h"
|
|---|
| 60 | #include "inputdvddirectory.h"
|
|---|
| 61 | #include "inputmplayerversion.h"
|
|---|
| 62 | #include "inputurl.h"
|
|---|
| 63 | #include "recents.h"
|
|---|
| 64 | #include "urlhistory.h"
|
|---|
| 65 | #include "about.h"
|
|---|
| 66 | #include "errordialog.h"
|
|---|
| 67 | #include "timedialog.h"
|
|---|
| 68 | #include "clhelp.h"
|
|---|
| 69 | #include "findsubtitleswindow.h"
|
|---|
| 70 | #include "videopreview.h"
|
|---|
| 71 | #include "mplayerversion.h"
|
|---|
| 72 |
|
|---|
| 73 | #include "config.h"
|
|---|
| 74 | #include "actionseditor.h"
|
|---|
| 75 |
|
|---|
| 76 | #include "myserver.h"
|
|---|
| 77 |
|
|---|
| 78 | #include "tvlist.h"
|
|---|
| 79 |
|
|---|
| 80 | #include "preferencesdialog.h"
|
|---|
| 81 | #ifndef NO_USE_INI_FILES
|
|---|
| 82 | #include "prefgeneral.h"
|
|---|
| 83 | #endif
|
|---|
| 84 | #include "prefinterface.h"
|
|---|
| 85 | #include "prefinput.h"
|
|---|
| 86 | #include "prefadvanced.h"
|
|---|
| 87 | #include "prefplaylist.h"
|
|---|
| 88 |
|
|---|
| 89 | #include "myaction.h"
|
|---|
| 90 | #include "myactiongroup.h"
|
|---|
| 91 | #include "playlist.h"
|
|---|
| 92 |
|
|---|
| 93 | #include "constants.h"
|
|---|
| 94 |
|
|---|
| 95 | #include "extensions.h"
|
|---|
| 96 |
|
|---|
| 97 | #ifdef Q_OS_WIN
|
|---|
| 98 | #include "deviceinfo.h"
|
|---|
| 99 | #include <QSysInfo>
|
|---|
| 100 | #endif
|
|---|
| 101 |
|
|---|
| 102 | using namespace Global;
|
|---|
| 103 |
|
|---|
| 104 | BaseGui::BaseGui( bool use_server, QWidget* parent, Qt::WindowFlags flags )
|
|---|
| 105 | : QMainWindow( parent, flags ),
|
|---|
| 106 | near_top(false),
|
|---|
| 107 | near_bottom(false)
|
|---|
| 108 | {
|
|---|
| 109 | #if defined(Q_OS_WIN) || defined(Q_OS_OS2)
|
|---|
| 110 | /* Disable screensaver by event */
|
|---|
| 111 | just_stopped = false;
|
|---|
| 112 | #endif
|
|---|
| 113 | ignore_show_hide_events = false;
|
|---|
| 114 |
|
|---|
| 115 | arg_close_on_finish = -1;
|
|---|
| 116 | arg_start_in_fullscreen = -1;
|
|---|
| 117 | use_control_server = use_server;
|
|---|
| 118 |
|
|---|
| 119 | setWindowTitle( "SMPlayer" );
|
|---|
| 120 |
|
|---|
| 121 | // Not created objects
|
|---|
| 122 | server = 0;
|
|---|
| 123 | popup = 0;
|
|---|
| 124 | pref_dialog = 0;
|
|---|
| 125 | file_dialog = 0;
|
|---|
| 126 | clhelp_window = 0;
|
|---|
| 127 | find_subs_dialog = 0;
|
|---|
| 128 | video_preview = 0;
|
|---|
| 129 |
|
|---|
| 130 | // Create objects:
|
|---|
| 131 | createPanel();
|
|---|
| 132 | setCentralWidget(panel);
|
|---|
| 133 |
|
|---|
| 134 | createMplayerWindow();
|
|---|
| 135 | createCore();
|
|---|
| 136 | createPlaylist();
|
|---|
| 137 | createVideoEqualizer();
|
|---|
| 138 | createAudioEqualizer();
|
|---|
| 139 |
|
|---|
| 140 | // Mouse Wheel
|
|---|
| 141 | connect( this, SIGNAL(wheelUp()),
|
|---|
| 142 | core, SLOT(wheelUp()) );
|
|---|
| 143 | connect( this, SIGNAL(wheelDown()),
|
|---|
| 144 | core, SLOT(wheelDown()) );
|
|---|
| 145 | connect( mplayerwindow, SIGNAL(wheelUp()),
|
|---|
| 146 | core, SLOT(wheelUp()) );
|
|---|
| 147 | connect( mplayerwindow, SIGNAL(wheelDown()),
|
|---|
| 148 | core, SLOT(wheelDown()) );
|
|---|
| 149 |
|
|---|
| 150 | // Set style before changing color of widgets:
|
|---|
| 151 | // Set style
|
|---|
| 152 | #if STYLE_SWITCHING
|
|---|
| 153 | qDebug( "Style name: '%s'", qApp->style()->objectName().toUtf8().data() );
|
|---|
| 154 | qDebug( "Style class name: '%s'", qApp->style()->metaObject()->className() );
|
|---|
| 155 |
|
|---|
| 156 | default_style = qApp->style()->objectName();
|
|---|
| 157 | if (!pref->style.isEmpty()) {
|
|---|
| 158 | qApp->setStyle( pref->style );
|
|---|
| 159 | }
|
|---|
| 160 | #endif
|
|---|
| 161 |
|
|---|
| 162 | mplayer_log_window = new LogWindow(0);
|
|---|
| 163 | smplayer_log_window = new LogWindow(0);
|
|---|
| 164 |
|
|---|
| 165 | createActions();
|
|---|
| 166 | createMenus();
|
|---|
| 167 | #if AUTODISABLE_ACTIONS
|
|---|
| 168 | setActionsEnabled(false);
|
|---|
| 169 | #endif
|
|---|
| 170 |
|
|---|
| 171 | #if !DOCK_PLAYLIST
|
|---|
| 172 | connect(playlist, SIGNAL(visibilityChanged(bool)),
|
|---|
| 173 | showPlaylistAct, SLOT(setChecked(bool)) );
|
|---|
| 174 | #endif
|
|---|
| 175 |
|
|---|
| 176 | retranslateStrings();
|
|---|
| 177 |
|
|---|
| 178 | setAcceptDrops(true);
|
|---|
| 179 |
|
|---|
| 180 | resize(pref->default_size);
|
|---|
| 181 |
|
|---|
| 182 | panel->setFocus();
|
|---|
| 183 |
|
|---|
| 184 | initializeGui();
|
|---|
| 185 | }
|
|---|
| 186 |
|
|---|
| 187 | void BaseGui::initializeGui() {
|
|---|
| 188 | if (pref->compact_mode) toggleCompactMode(TRUE);
|
|---|
| 189 | changeStayOnTop(pref->stay_on_top);
|
|---|
| 190 |
|
|---|
| 191 | #if ALLOW_CHANGE_STYLESHEET
|
|---|
| 192 | changeStyleSheet(pref->iconset);
|
|---|
| 193 | #endif
|
|---|
| 194 |
|
|---|
| 195 | updateRecents();
|
|---|
| 196 |
|
|---|
| 197 | // Call loadActions() outside initialization of the class.
|
|---|
| 198 | // Otherwise DefaultGui (and other subclasses) doesn't exist, and
|
|---|
| 199 | // its actions are not loaded
|
|---|
| 200 | QTimer::singleShot(20, this, SLOT(loadActions()));
|
|---|
| 201 |
|
|---|
| 202 | // Single instance
|
|---|
| 203 | if (use_control_server) {
|
|---|
| 204 | server = new MyServer(this);
|
|---|
| 205 | connect(server, SIGNAL(receivedOpen(QString)),
|
|---|
| 206 | this, SLOT(remoteOpen(QString)));
|
|---|
| 207 | connect(server, SIGNAL(receivedOpenFiles(QStringList)),
|
|---|
| 208 | this, SLOT(remoteOpenFiles(QStringList)));
|
|---|
| 209 | connect(server, SIGNAL(receivedAddFiles(QStringList)),
|
|---|
| 210 | this, SLOT(remoteAddFiles(QStringList)));
|
|---|
| 211 | connect(server, SIGNAL(receivedFunction(QString)),
|
|---|
| 212 | this, SLOT(processFunction(QString)));
|
|---|
| 213 | connect(server, SIGNAL(receivedLoadSubtitle(QString)),
|
|---|
| 214 | this, SLOT(remoteLoadSubtitle(QString)));
|
|---|
| 215 | connect(server, SIGNAL(receivedPlayItem(int)),
|
|---|
| 216 | this, SLOT(remotePlayItem(int)));
|
|---|
| 217 | connect(server, SIGNAL(receivedRemoveItem(int)),
|
|---|
| 218 | this, SLOT(remoteRemoveItem(int)));
|
|---|
| 219 | connect(server, SIGNAL(receivedViewPlaylist(QString*)),
|
|---|
| 220 | this, SLOT(remoteViewPlaylist(QString*)));
|
|---|
| 221 | connect(server, SIGNAL(receivedViewStatus(QString*)),
|
|---|
| 222 | this, SLOT(remoteViewStatus(QString*)));
|
|---|
| 223 | connect(server, SIGNAL(receivedViewClipInfo(QString*)),
|
|---|
| 224 | this, SLOT(remoteViewClipInfo(QString*)));
|
|---|
| 225 | connect(server, SIGNAL(receivedSeek(double)),
|
|---|
| 226 | this, SLOT(remoteSeek(double)));
|
|---|
| 227 | connect(server, SIGNAL(receivedGetChecked(QString,QString*)),
|
|---|
| 228 | this, SLOT(remoteGetChecked(QString,QString*)));
|
|---|
| 229 | connect(server, SIGNAL(receivedMoveItem(int,int)),
|
|---|
| 230 | this, SLOT(remoteMoveItem(int,int)));
|
|---|
| 231 | connect(server, SIGNAL(receivedGetVolume(int*)),
|
|---|
| 232 | this, SLOT(remoteGetVolume(int*)));
|
|---|
| 233 | connect(server, SIGNAL(receivedSetVolume(int)),
|
|---|
| 234 | core, SLOT(setVolume(int)));
|
|---|
| 235 |
|
|---|
| 236 | if (pref->use_single_instance) {
|
|---|
| 237 | int port = 0;
|
|---|
| 238 | if (!pref->use_autoport) port = pref->connection_port;
|
|---|
| 239 | if (server->listen(port)) {
|
|---|
| 240 | pref->autoport = server->serverPort();
|
|---|
| 241 | pref->save();
|
|---|
| 242 | qDebug("BaseGui::initializeGui: server running on port %d", pref->autoport);
|
|---|
| 243 | } else {
|
|---|
| 244 | qWarning("BaseGui::initializeGui: server couldn't be started");
|
|---|
| 245 | }
|
|---|
| 246 | }
|
|---|
| 247 | }
|
|---|
| 248 | }
|
|---|
| 249 |
|
|---|
| 250 | void BaseGui::remotePlayItem(int index){
|
|---|
| 251 | qDebug("BaseGui::remotePlay: '%s'", QString::number((index)).toUtf8().data());
|
|---|
| 252 | if (isMinimized()) showNormal();
|
|---|
| 253 | if (!isVisible()) show();
|
|---|
| 254 | raise();
|
|---|
| 255 | activateWindow();
|
|---|
| 256 | playlist->playItem(index);
|
|---|
| 257 | }
|
|---|
| 258 |
|
|---|
| 259 | void BaseGui::remoteRemoveItem(int index){
|
|---|
| 260 | qDebug("BaseGui::remoteRemove: '%s'", QString::number((index)).toUtf8().data());
|
|---|
| 261 | if (isMinimized()) showNormal();
|
|---|
| 262 | if (!isVisible()) show();
|
|---|
| 263 | raise();
|
|---|
| 264 | activateWindow();
|
|---|
| 265 |
|
|---|
| 266 | if(index == -1)
|
|---|
| 267 | playlist->removeAll();
|
|---|
| 268 | else
|
|---|
| 269 | playlist->remove(index);
|
|---|
| 270 | }
|
|---|
| 271 |
|
|---|
| 272 | void BaseGui::remoteMoveItem(int index, int shift){
|
|---|
| 273 | qDebug("BaseGui::remoteRemove: '%s'", QString::number((index)).toUtf8().data());
|
|---|
| 274 | if (isMinimized()) showNormal();
|
|---|
| 275 | if (!isVisible()) show();
|
|---|
| 276 | raise();
|
|---|
| 277 | activateWindow();
|
|---|
| 278 |
|
|---|
| 279 | int step = shift / abs(shift);
|
|---|
| 280 | for(int i = index; i != (index + shift); i += step){
|
|---|
| 281 | if(step == -1 && index == 0) break;
|
|---|
| 282 | if(step == +1 && index == (playlist->count() - 1)) break;
|
|---|
| 283 |
|
|---|
| 284 | if(step == -1) playlist->moveItemUp(index);
|
|---|
| 285 | if(step == +1) playlist->moveItemDown(index);
|
|---|
| 286 | } //end for
|
|---|
| 287 | }
|
|---|
| 288 |
|
|---|
| 289 | void BaseGui::remoteOpen(QString file) {
|
|---|
| 290 | qDebug("BaseGui::remoteOpen: '%s'", file.toUtf8().data());
|
|---|
| 291 | if (isMinimized()) showNormal();
|
|---|
| 292 | if (!isVisible()) show();
|
|---|
| 293 | raise();
|
|---|
| 294 | activateWindow();
|
|---|
| 295 | open(file);
|
|---|
| 296 | }
|
|---|
| 297 |
|
|---|
| 298 | void BaseGui::remoteOpenFiles(QStringList files) {
|
|---|
| 299 | qDebug("BaseGui::remoteOpenFiles");
|
|---|
| 300 | if (isMinimized()) showNormal();
|
|---|
| 301 | if (!isVisible()) show();
|
|---|
| 302 | raise();
|
|---|
| 303 | activateWindow();
|
|---|
| 304 | openFiles(files);
|
|---|
| 305 | }
|
|---|
| 306 |
|
|---|
| 307 | void BaseGui::remoteAddFiles(QStringList files) {
|
|---|
| 308 | qDebug("BaseGui::remoteAddFiles");
|
|---|
| 309 | if (isMinimized()) showNormal();
|
|---|
| 310 | if (!isVisible()) show();
|
|---|
| 311 | raise();
|
|---|
| 312 | activateWindow();
|
|---|
| 313 |
|
|---|
| 314 | playlist->addFiles(files);
|
|---|
| 315 | //open(files[0]);
|
|---|
| 316 | }
|
|---|
| 317 |
|
|---|
| 318 | void BaseGui::remoteLoadSubtitle(QString file) {
|
|---|
| 319 | qDebug("BaseGui::remoteLoadSubtitle: '%s'", file.toUtf8().data());
|
|---|
| 320 |
|
|---|
| 321 | setInitialSubtitle(file);
|
|---|
| 322 |
|
|---|
| 323 | if (core->state() != Core::Stopped) {
|
|---|
| 324 | core->loadSub(file);
|
|---|
| 325 | }
|
|---|
| 326 | }
|
|---|
| 327 |
|
|---|
| 328 | void BaseGui::remoteViewPlaylist(QString * output){
|
|---|
| 329 | qDebug("BaseGui::remoteViewPlaylist");
|
|---|
| 330 | *output += playlist->print("\t");
|
|---|
| 331 | }
|
|---|
| 332 |
|
|---|
| 333 | void BaseGui::remoteViewStatus(QString * output){
|
|---|
| 334 | qDebug("BaseGui::remoteViewStatus");
|
|---|
| 335 | *output = core->stateToString();
|
|---|
| 336 | }
|
|---|
| 337 |
|
|---|
| 338 | void BaseGui::remoteViewClipInfo(QString * output){
|
|---|
| 339 | qDebug("BaseGui::remoteViewClipInfo");
|
|---|
| 340 |
|
|---|
| 341 | *output += QString("%1\t%2\r\n").arg("Filename", core->mdat.filename);
|
|---|
| 342 | *output += QString("%1\t%2\r\n").arg("Position", QString::number(core->mset.current_sec));
|
|---|
| 343 | *output += QString("%1\t%2\r\n").arg("Duration", QString::number(core->mdat.duration));
|
|---|
| 344 |
|
|---|
| 345 | *output += QString("%1\t%2\r\n").arg("Title", core->mdat.clip_name);
|
|---|
| 346 | *output += QString("%1\t%2\r\n").arg("Artist", core->mdat.clip_artist);
|
|---|
| 347 | *output += QString("%1\t%2\r\n").arg("Author", core->mdat.clip_author);
|
|---|
| 348 | *output += QString("%1\t%2\r\n").arg("Album", core->mdat.clip_album);
|
|---|
| 349 | *output += QString("%1\t%2\r\n").arg("Genre", core->mdat.clip_genre);
|
|---|
| 350 | *output += QString("%1\t%2\r\n").arg("Date", core->mdat.clip_date);
|
|---|
| 351 | *output += QString("%1\t%2\r\n").arg("Track", core->mdat.clip_track);
|
|---|
| 352 | *output += QString("%1\t%2\r\n").arg("Copyright", core->mdat.clip_copyright);
|
|---|
| 353 | *output += QString("%1\t%2\r\n").arg("Comment", core->mdat.clip_comment);
|
|---|
| 354 | *output += QString("%1\t%2\r\n").arg("Software", core->mdat.clip_software);
|
|---|
| 355 | }
|
|---|
| 356 |
|
|---|
| 357 | void BaseGui::remoteSeek(double sec){
|
|---|
| 358 | qDebug("BaseGui::remoteSeek");
|
|---|
| 359 | core->goToSec(sec);
|
|---|
| 360 | }
|
|---|
| 361 |
|
|---|
| 362 | void BaseGui::remoteGetChecked(QString function, QString* output){
|
|---|
| 363 | qDebug("BaseGui::remoteGet");
|
|---|
| 364 |
|
|---|
| 365 | QAction* action = ActionsEditor::findAction(this, function);
|
|---|
| 366 | if(! action) action = ActionsEditor::findAction(playlist, function);
|
|---|
| 367 | if(! action) return;
|
|---|
| 368 |
|
|---|
| 369 | bool value = (action->isCheckable() ? action->isChecked() : action->isEnabled());
|
|---|
| 370 | *output = (value ? "true" : "false");
|
|---|
| 371 | }
|
|---|
| 372 |
|
|---|
| 373 | void BaseGui::remoteGetVolume(int *vol){
|
|---|
| 374 | *vol = (pref->global_volume ? pref->volume : core->mset.volume);
|
|---|
| 375 | }
|
|---|
| 376 |
|
|---|
| 377 | BaseGui::~BaseGui() {
|
|---|
| 378 | delete core; // delete before mplayerwindow, otherwise, segfault...
|
|---|
| 379 | delete mplayer_log_window;
|
|---|
| 380 | delete smplayer_log_window;
|
|---|
| 381 |
|
|---|
| 382 | delete favorites;
|
|---|
| 383 | delete tvlist;
|
|---|
| 384 | delete radiolist;
|
|---|
| 385 |
|
|---|
| 386 | //#if !DOCK_PLAYLIST
|
|---|
| 387 | if (playlist) {
|
|---|
| 388 | delete playlist;
|
|---|
| 389 | playlist = 0;
|
|---|
| 390 | }
|
|---|
| 391 | //#endif
|
|---|
| 392 |
|
|---|
| 393 | if (find_subs_dialog) {
|
|---|
| 394 | delete find_subs_dialog;
|
|---|
| 395 | find_subs_dialog = 0; // Necessary?
|
|---|
| 396 | }
|
|---|
| 397 |
|
|---|
| 398 | if (video_preview) {
|
|---|
| 399 | delete video_preview;
|
|---|
| 400 | }
|
|---|
| 401 | }
|
|---|
| 402 |
|
|---|
| 403 | void BaseGui::createActions() {
|
|---|
| 404 | // Menu File
|
|---|
| 405 | openFileAct = new MyAction( QKeySequence("Ctrl+F"), this, "open_file" );
|
|---|
| 406 | connect( openFileAct, SIGNAL(triggered()),
|
|---|
| 407 | this, SLOT(openFile()) );
|
|---|
| 408 |
|
|---|
| 409 | openDirectoryAct = new MyAction( this, "open_directory" );
|
|---|
| 410 | connect( openDirectoryAct, SIGNAL(triggered()),
|
|---|
| 411 | this, SLOT(openDirectory()) );
|
|---|
| 412 |
|
|---|
| 413 | openPlaylistAct = new MyAction( this, "open_playlist" );
|
|---|
| 414 | connect( openPlaylistAct, SIGNAL(triggered()),
|
|---|
| 415 | playlist, SLOT(load()) );
|
|---|
| 416 |
|
|---|
| 417 | openVCDAct = new MyAction( this, "open_vcd" );
|
|---|
| 418 | connect( openVCDAct, SIGNAL(triggered()),
|
|---|
| 419 | this, SLOT(openVCD()) );
|
|---|
| 420 |
|
|---|
| 421 | openAudioCDAct = new MyAction( this, "open_audio_cd" );
|
|---|
| 422 | connect( openAudioCDAct, SIGNAL(triggered()),
|
|---|
| 423 | this, SLOT(openAudioCD()) );
|
|---|
| 424 |
|
|---|
| 425 | #ifdef Q_OS_WIN
|
|---|
| 426 | // VCD's and Audio CD's seem they don't work on windows
|
|---|
| 427 | //openVCDAct->setEnabled(pref->enable_vcd_on_windows);
|
|---|
| 428 | openAudioCDAct->setEnabled(pref->enable_audiocd_on_windows);
|
|---|
| 429 | #endif
|
|---|
| 430 |
|
|---|
| 431 | openDVDAct = new MyAction( this, "open_dvd" );
|
|---|
| 432 | connect( openDVDAct, SIGNAL(triggered()),
|
|---|
| 433 | this, SLOT(openDVD()) );
|
|---|
| 434 |
|
|---|
| 435 | openDVDFolderAct = new MyAction( this, "open_dvd_folder" );
|
|---|
| 436 | connect( openDVDFolderAct, SIGNAL(triggered()),
|
|---|
| 437 | this, SLOT(openDVDFromFolder()) );
|
|---|
| 438 |
|
|---|
| 439 | openURLAct = new MyAction( QKeySequence("Ctrl+U"), this, "open_url" );
|
|---|
| 440 | connect( openURLAct, SIGNAL(triggered()),
|
|---|
| 441 | this, SLOT(openURL()) );
|
|---|
| 442 |
|
|---|
| 443 | exitAct = new MyAction( QKeySequence("Ctrl+X"), this, "close" );
|
|---|
| 444 | connect( exitAct, SIGNAL(triggered()), this, SLOT(closeWindow()) );
|
|---|
| 445 |
|
|---|
| 446 | clearRecentsAct = new MyAction( this, "clear_recents" );
|
|---|
| 447 | connect( clearRecentsAct, SIGNAL(triggered()), this, SLOT(clearRecentsList()) );
|
|---|
| 448 |
|
|---|
| 449 | // Favorites
|
|---|
| 450 | favorites = new Favorites(Paths::configPath() + "/favorites.m3u8", this);
|
|---|
| 451 | favorites->menuAction()->setObjectName( "favorites_menu" );
|
|---|
| 452 | addAction(favorites->editAct());
|
|---|
| 453 | addAction(favorites->jumpAct());
|
|---|
| 454 | addAction(favorites->nextAct());
|
|---|
| 455 | addAction(favorites->previousAct());
|
|---|
| 456 | connect(favorites, SIGNAL(activated(QString)), this, SLOT(openFavorite(QString)));
|
|---|
| 457 | connect(core, SIGNAL(mediaPlaying(const QString &, const QString &)),
|
|---|
| 458 | favorites, SLOT(getCurrentMedia(const QString &, const QString &)));
|
|---|
| 459 |
|
|---|
| 460 | // TV and Radio
|
|---|
| 461 | tvlist = new TVList(pref->check_channels_conf_on_startup,
|
|---|
| 462 | TVList::TV, Paths::configPath() + "/tv.m3u8", this);
|
|---|
| 463 | tvlist->menuAction()->setObjectName( "tv_menu" );
|
|---|
| 464 | addAction(tvlist->editAct());
|
|---|
| 465 | addAction(tvlist->jumpAct());
|
|---|
| 466 | addAction(tvlist->nextAct());
|
|---|
| 467 | addAction(tvlist->previousAct());
|
|---|
| 468 | tvlist->nextAct()->setShortcut( Qt::Key_H );
|
|---|
| 469 | tvlist->previousAct()->setShortcut( Qt::Key_L );
|
|---|
| 470 | tvlist->nextAct()->setObjectName("next_tv");
|
|---|
| 471 | tvlist->previousAct()->setObjectName("previous_tv");
|
|---|
| 472 | tvlist->editAct()->setObjectName("edit_tv_list");
|
|---|
| 473 | tvlist->jumpAct()->setObjectName("jump_tv_list");
|
|---|
| 474 | connect(tvlist, SIGNAL(activated(QString)), this, SLOT(open(QString)));
|
|---|
| 475 | connect(core, SIGNAL(mediaPlaying(const QString &, const QString &)),
|
|---|
| 476 | tvlist, SLOT(getCurrentMedia(const QString &, const QString &)));
|
|---|
| 477 |
|
|---|
| 478 | radiolist = new TVList(pref->check_channels_conf_on_startup,
|
|---|
| 479 | TVList::Radio, Paths::configPath() + "/radio.m3u8", this);
|
|---|
| 480 | radiolist->menuAction()->setObjectName( "radio_menu" );
|
|---|
| 481 | addAction(radiolist->editAct());
|
|---|
| 482 | addAction(radiolist->jumpAct());
|
|---|
| 483 | addAction(radiolist->nextAct());
|
|---|
| 484 | addAction(radiolist->previousAct());
|
|---|
| 485 | radiolist->nextAct()->setShortcut( Qt::SHIFT | Qt::Key_H );
|
|---|
| 486 | radiolist->previousAct()->setShortcut( Qt::SHIFT | Qt::Key_L );
|
|---|
| 487 | radiolist->nextAct()->setObjectName("next_radio");
|
|---|
| 488 | radiolist->previousAct()->setObjectName("previous_radio");
|
|---|
| 489 | radiolist->editAct()->setObjectName("edit_radio_list");
|
|---|
| 490 | radiolist->jumpAct()->setObjectName("jump_radio_list");
|
|---|
| 491 | connect(radiolist, SIGNAL(activated(QString)), this, SLOT(open(QString)));
|
|---|
| 492 | connect(core, SIGNAL(mediaPlaying(const QString &, const QString &)),
|
|---|
| 493 | radiolist, SLOT(getCurrentMedia(const QString &, const QString &)));
|
|---|
| 494 |
|
|---|
| 495 |
|
|---|
| 496 | // Menu Play
|
|---|
| 497 | playAct = new MyAction( this, "play" );
|
|---|
| 498 | connect( playAct, SIGNAL(triggered()),
|
|---|
| 499 | core, SLOT(play()) );
|
|---|
| 500 |
|
|---|
| 501 | playOrPauseAct = new MyAction( Qt::Key_MediaPlay, this, "play_or_pause" );
|
|---|
| 502 | connect( playOrPauseAct, SIGNAL(triggered()),
|
|---|
| 503 | core, SLOT(play_or_pause()) );
|
|---|
| 504 |
|
|---|
| 505 | pauseAct = new MyAction( Qt::Key_Space, this, "pause" );
|
|---|
| 506 | connect( pauseAct, SIGNAL(triggered()),
|
|---|
| 507 | core, SLOT(pause()) );
|
|---|
| 508 |
|
|---|
| 509 | pauseAndStepAct = new MyAction( this, "pause_and_frame_step" );
|
|---|
| 510 | connect( pauseAndStepAct, SIGNAL(triggered()),
|
|---|
| 511 | core, SLOT(pause_and_frame_step()) );
|
|---|
| 512 |
|
|---|
| 513 | stopAct = new MyAction( Qt::Key_MediaStop, this, "stop" );
|
|---|
| 514 | connect( stopAct, SIGNAL(triggered()),
|
|---|
| 515 | core, SLOT(stop()) );
|
|---|
| 516 |
|
|---|
| 517 | frameStepAct = new MyAction( Qt::Key_Period, this, "frame_step" );
|
|---|
| 518 | connect( frameStepAct, SIGNAL(triggered()),
|
|---|
| 519 | core, SLOT(frameStep()) );
|
|---|
| 520 |
|
|---|
| 521 | rewind1Act = new MyAction( Qt::Key_Left, this, "rewind1" );
|
|---|
| 522 | connect( rewind1Act, SIGNAL(triggered()),
|
|---|
| 523 | core, SLOT(srewind()) );
|
|---|
| 524 |
|
|---|
| 525 | rewind2Act = new MyAction( Qt::Key_Down, this, "rewind2" );
|
|---|
| 526 | connect( rewind2Act, SIGNAL(triggered()),
|
|---|
| 527 | core, SLOT(rewind()) );
|
|---|
| 528 |
|
|---|
| 529 | rewind3Act = new MyAction( Qt::Key_PageDown, this, "rewind3" );
|
|---|
| 530 | connect( rewind3Act, SIGNAL(triggered()),
|
|---|
| 531 | core, SLOT(fastrewind()) );
|
|---|
| 532 |
|
|---|
| 533 | forward1Act = new MyAction( Qt::Key_Right, this, "forward1" );
|
|---|
| 534 | connect( forward1Act, SIGNAL(triggered()),
|
|---|
| 535 | core, SLOT(sforward()) );
|
|---|
| 536 |
|
|---|
| 537 | forward2Act = new MyAction( Qt::Key_Up, this, "forward2" );
|
|---|
| 538 | connect( forward2Act, SIGNAL(triggered()),
|
|---|
| 539 | core, SLOT(forward()) );
|
|---|
| 540 |
|
|---|
| 541 | forward3Act = new MyAction( Qt::Key_PageUp, this, "forward3" );
|
|---|
| 542 | connect( forward3Act, SIGNAL(triggered()),
|
|---|
| 543 | core, SLOT(fastforward()) );
|
|---|
| 544 |
|
|---|
| 545 | setAMarkerAct = new MyAction( this, "set_a_marker" );
|
|---|
| 546 | connect( setAMarkerAct, SIGNAL(triggered()),
|
|---|
| 547 | core, SLOT(setAMarker()) );
|
|---|
| 548 |
|
|---|
| 549 | setBMarkerAct = new MyAction( this, "set_b_marker" );
|
|---|
| 550 | connect( setBMarkerAct, SIGNAL(triggered()),
|
|---|
| 551 | core, SLOT(setBMarker()) );
|
|---|
| 552 |
|
|---|
| 553 | clearABMarkersAct = new MyAction( this, "clear_ab_markers" );
|
|---|
| 554 | connect( clearABMarkersAct, SIGNAL(triggered()),
|
|---|
| 555 | core, SLOT(clearABMarkers()) );
|
|---|
| 556 |
|
|---|
| 557 | repeatAct = new MyAction( this, "repeat" );
|
|---|
| 558 | repeatAct->setCheckable( true );
|
|---|
| 559 | connect( repeatAct, SIGNAL(toggled(bool)),
|
|---|
| 560 | core, SLOT(toggleRepeat(bool)) );
|
|---|
| 561 |
|
|---|
| 562 | gotoAct = new MyAction( QKeySequence("Ctrl+J"), this, "jump_to" );
|
|---|
| 563 | connect( gotoAct, SIGNAL(triggered()),
|
|---|
| 564 | this, SLOT(showGotoDialog()) );
|
|---|
| 565 |
|
|---|
| 566 | // Submenu Speed
|
|---|
| 567 | normalSpeedAct = new MyAction( Qt::Key_Backspace, this, "normal_speed" );
|
|---|
| 568 | connect( normalSpeedAct, SIGNAL(triggered()),
|
|---|
| 569 | core, SLOT(normalSpeed()) );
|
|---|
| 570 |
|
|---|
| 571 | halveSpeedAct = new MyAction( Qt::Key_BraceLeft, this, "halve_speed" );
|
|---|
| 572 | connect( halveSpeedAct, SIGNAL(triggered()),
|
|---|
| 573 | core, SLOT(halveSpeed()) );
|
|---|
| 574 |
|
|---|
| 575 | doubleSpeedAct = new MyAction( Qt::Key_BraceRight, this, "double_speed" );
|
|---|
| 576 | connect( doubleSpeedAct, SIGNAL(triggered()),
|
|---|
| 577 | core, SLOT(doubleSpeed()) );
|
|---|
| 578 |
|
|---|
| 579 | decSpeed10Act = new MyAction( Qt::Key_BracketLeft, this, "dec_speed" );
|
|---|
| 580 | connect( decSpeed10Act, SIGNAL(triggered()),
|
|---|
| 581 | core, SLOT(decSpeed10()) );
|
|---|
| 582 |
|
|---|
| 583 | incSpeed10Act = new MyAction( Qt::Key_BracketRight, this, "inc_speed" );
|
|---|
| 584 | connect( incSpeed10Act, SIGNAL(triggered()),
|
|---|
| 585 | core, SLOT(incSpeed10()) );
|
|---|
| 586 |
|
|---|
| 587 | decSpeed4Act = new MyAction( this, "dec_speed_4" );
|
|---|
| 588 | connect( decSpeed4Act, SIGNAL(triggered()),
|
|---|
| 589 | core, SLOT(decSpeed4()) );
|
|---|
| 590 |
|
|---|
| 591 | incSpeed4Act = new MyAction( this, "inc_speed_4" );
|
|---|
| 592 | connect( incSpeed4Act, SIGNAL(triggered()),
|
|---|
| 593 | core, SLOT(incSpeed4()) );
|
|---|
| 594 |
|
|---|
| 595 | decSpeed1Act = new MyAction( this, "dec_speed_1" );
|
|---|
| 596 | connect( decSpeed1Act, SIGNAL(triggered()),
|
|---|
| 597 | core, SLOT(decSpeed1()) );
|
|---|
| 598 |
|
|---|
| 599 | incSpeed1Act = new MyAction( this, "inc_speed_1" );
|
|---|
| 600 | connect( incSpeed1Act, SIGNAL(triggered()),
|
|---|
| 601 | core, SLOT(incSpeed1()) );
|
|---|
| 602 |
|
|---|
| 603 |
|
|---|
| 604 | // Menu Video
|
|---|
| 605 | fullscreenAct = new MyAction( Qt::Key_F, this, "fullscreen" );
|
|---|
| 606 | fullscreenAct->setCheckable( true );
|
|---|
| 607 | connect( fullscreenAct, SIGNAL(toggled(bool)),
|
|---|
| 608 | this, SLOT(toggleFullscreen(bool)) );
|
|---|
| 609 |
|
|---|
| 610 | compactAct = new MyAction( QKeySequence("Ctrl+C"), this, "compact" );
|
|---|
| 611 | compactAct->setCheckable( true );
|
|---|
| 612 | connect( compactAct, SIGNAL(toggled(bool)),
|
|---|
| 613 | this, SLOT(toggleCompactMode(bool)) );
|
|---|
| 614 |
|
|---|
| 615 | videoEqualizerAct = new MyAction( QKeySequence("Ctrl+E"), this, "video_equalizer" );
|
|---|
| 616 | videoEqualizerAct->setCheckable( true );
|
|---|
| 617 | connect( videoEqualizerAct, SIGNAL(toggled(bool)),
|
|---|
| 618 | this, SLOT(showVideoEqualizer(bool)) );
|
|---|
| 619 |
|
|---|
| 620 | // Single screenshot
|
|---|
| 621 | screenshotAct = new MyAction( Qt::Key_S, this, "screenshot" );
|
|---|
| 622 | connect( screenshotAct, SIGNAL(triggered()),
|
|---|
| 623 | core, SLOT(screenshot()) );
|
|---|
| 624 |
|
|---|
| 625 | // Multiple screenshots
|
|---|
| 626 | screenshotsAct = new MyAction( QKeySequence("Shift+D"), this, "multiple_screenshots" );
|
|---|
| 627 | connect( screenshotsAct, SIGNAL(triggered()),
|
|---|
| 628 | core, SLOT(screenshots()) );
|
|---|
| 629 |
|
|---|
| 630 | videoPreviewAct = new MyAction( this, "video_preview" );
|
|---|
| 631 | connect( videoPreviewAct, SIGNAL(triggered()),
|
|---|
| 632 | this, SLOT(showVideoPreviewDialog()) );
|
|---|
| 633 |
|
|---|
| 634 | flipAct = new MyAction( this, "flip" );
|
|---|
| 635 | flipAct->setCheckable( true );
|
|---|
| 636 | connect( flipAct, SIGNAL(toggled(bool)),
|
|---|
| 637 | core, SLOT(toggleFlip(bool)) );
|
|---|
| 638 |
|
|---|
| 639 | mirrorAct = new MyAction( this, "mirror" );
|
|---|
| 640 | mirrorAct->setCheckable( true );
|
|---|
| 641 | connect( mirrorAct, SIGNAL(toggled(bool)),
|
|---|
| 642 | core, SLOT(toggleMirror(bool)) );
|
|---|
| 643 |
|
|---|
| 644 |
|
|---|
| 645 | // Submenu filter
|
|---|
| 646 | postProcessingAct = new MyAction( this, "postprocessing" );
|
|---|
| 647 | postProcessingAct->setCheckable( true );
|
|---|
| 648 | connect( postProcessingAct, SIGNAL(toggled(bool)),
|
|---|
| 649 | core, SLOT(togglePostprocessing(bool)) );
|
|---|
| 650 |
|
|---|
| 651 | phaseAct = new MyAction( this, "autodetect_phase" );
|
|---|
| 652 | phaseAct->setCheckable( true );
|
|---|
| 653 | connect( phaseAct, SIGNAL(toggled(bool)),
|
|---|
| 654 | core, SLOT(toggleAutophase(bool)) );
|
|---|
| 655 |
|
|---|
| 656 | deblockAct = new MyAction( this, "deblock" );
|
|---|
| 657 | deblockAct->setCheckable( true );
|
|---|
| 658 | connect( deblockAct, SIGNAL(toggled(bool)),
|
|---|
| 659 | core, SLOT(toggleDeblock(bool)) );
|
|---|
| 660 |
|
|---|
| 661 | deringAct = new MyAction( this, "dering" );
|
|---|
| 662 | deringAct->setCheckable( true );
|
|---|
| 663 | connect( deringAct, SIGNAL(toggled(bool)),
|
|---|
| 664 | core, SLOT(toggleDering(bool)) );
|
|---|
| 665 |
|
|---|
| 666 | addNoiseAct = new MyAction( this, "add_noise" );
|
|---|
| 667 | addNoiseAct->setCheckable( true );
|
|---|
| 668 | connect( addNoiseAct, SIGNAL(toggled(bool)),
|
|---|
| 669 | core, SLOT(toggleNoise(bool)) );
|
|---|
| 670 |
|
|---|
| 671 | addLetterboxAct = new MyAction( this, "add_letterbox" );
|
|---|
| 672 | addLetterboxAct->setCheckable( true );
|
|---|
| 673 | connect( addLetterboxAct, SIGNAL(toggled(bool)),
|
|---|
| 674 | core, SLOT(changeLetterbox(bool)) );
|
|---|
| 675 |
|
|---|
| 676 | upscaleAct = new MyAction( this, "upscaling" );
|
|---|
| 677 | upscaleAct->setCheckable( true );
|
|---|
| 678 | connect( upscaleAct, SIGNAL(toggled(bool)),
|
|---|
| 679 | core, SLOT(changeUpscale(bool)) );
|
|---|
| 680 |
|
|---|
| 681 |
|
|---|
| 682 | // Menu Audio
|
|---|
| 683 | audioEqualizerAct = new MyAction( this, "audio_equalizer" );
|
|---|
| 684 | audioEqualizerAct->setCheckable( true );
|
|---|
| 685 | connect( audioEqualizerAct, SIGNAL(toggled(bool)),
|
|---|
| 686 | this, SLOT(showAudioEqualizer(bool)) );
|
|---|
| 687 |
|
|---|
| 688 | muteAct = new MyAction( Qt::Key_M, this, "mute" );
|
|---|
| 689 | muteAct->setCheckable( true );
|
|---|
| 690 | connect( muteAct, SIGNAL(toggled(bool)),
|
|---|
| 691 | core, SLOT(mute(bool)) );
|
|---|
| 692 |
|
|---|
| 693 | #if USE_MULTIPLE_SHORTCUTS
|
|---|
| 694 | decVolumeAct = new MyAction( this, "decrease_volume" );
|
|---|
| 695 | decVolumeAct->setShortcuts( ActionsEditor::stringToShortcuts("9,/") );
|
|---|
| 696 | #else
|
|---|
| 697 | decVolumeAct = new MyAction( Qt::Key_9, this, "dec_volume" );
|
|---|
| 698 | #endif
|
|---|
| 699 | connect( decVolumeAct, SIGNAL(triggered()),
|
|---|
| 700 | core, SLOT(decVolume()) );
|
|---|
| 701 |
|
|---|
| 702 | #if USE_MULTIPLE_SHORTCUTS
|
|---|
| 703 | incVolumeAct = new MyAction( this, "increase_volume" );
|
|---|
| 704 | incVolumeAct->setShortcuts( ActionsEditor::stringToShortcuts("0,*") );
|
|---|
| 705 | #else
|
|---|
| 706 | incVolumeAct = new MyAction( Qt::Key_0, this, "inc_volume" );
|
|---|
| 707 | #endif
|
|---|
| 708 | connect( incVolumeAct, SIGNAL(triggered()),
|
|---|
| 709 | core, SLOT(incVolume()) );
|
|---|
| 710 |
|
|---|
| 711 | decAudioDelayAct = new MyAction( Qt::Key_Minus, this, "dec_audio_delay" );
|
|---|
| 712 | connect( decAudioDelayAct, SIGNAL(triggered()),
|
|---|
| 713 | core, SLOT(decAudioDelay()) );
|
|---|
| 714 |
|
|---|
| 715 | incAudioDelayAct = new MyAction( Qt::Key_Plus, this, "inc_audio_delay" );
|
|---|
| 716 | connect( incAudioDelayAct, SIGNAL(triggered()),
|
|---|
| 717 | core, SLOT(incAudioDelay()) );
|
|---|
| 718 |
|
|---|
| 719 | audioDelayAct = new MyAction( this, "audio_delay" );
|
|---|
| 720 | connect( audioDelayAct, SIGNAL(triggered()),
|
|---|
| 721 | this, SLOT(showAudioDelayDialog()) );
|
|---|
| 722 |
|
|---|
| 723 | loadAudioAct = new MyAction( this, "load_audio_file" );
|
|---|
| 724 | connect( loadAudioAct, SIGNAL(triggered()),
|
|---|
| 725 | this, SLOT(loadAudioFile()) );
|
|---|
| 726 |
|
|---|
| 727 | unloadAudioAct = new MyAction( this, "unload_audio_file" );
|
|---|
| 728 | connect( unloadAudioAct, SIGNAL(triggered()),
|
|---|
| 729 | core, SLOT(unloadAudioFile()) );
|
|---|
| 730 |
|
|---|
| 731 |
|
|---|
| 732 | // Submenu Filters
|
|---|
| 733 | extrastereoAct = new MyAction( this, "extrastereo_filter" );
|
|---|
| 734 | extrastereoAct->setCheckable( true );
|
|---|
| 735 | connect( extrastereoAct, SIGNAL(toggled(bool)),
|
|---|
| 736 | core, SLOT(toggleExtrastereo(bool)) );
|
|---|
| 737 |
|
|---|
| 738 | karaokeAct = new MyAction( this, "karaoke_filter" );
|
|---|
| 739 | karaokeAct->setCheckable( true );
|
|---|
| 740 | connect( karaokeAct, SIGNAL(toggled(bool)),
|
|---|
| 741 | core, SLOT(toggleKaraoke(bool)) );
|
|---|
| 742 |
|
|---|
| 743 | volnormAct = new MyAction( this, "volnorm_filter" );
|
|---|
| 744 | volnormAct->setCheckable( true );
|
|---|
| 745 | connect( volnormAct, SIGNAL(toggled(bool)),
|
|---|
| 746 | core, SLOT(toggleVolnorm(bool)) );
|
|---|
| 747 |
|
|---|
| 748 |
|
|---|
| 749 | // Menu Subtitles
|
|---|
| 750 | loadSubsAct = new MyAction( this, "load_subs" );
|
|---|
| 751 | connect( loadSubsAct, SIGNAL(triggered()),
|
|---|
| 752 | this, SLOT(loadSub()) );
|
|---|
| 753 |
|
|---|
| 754 | unloadSubsAct = new MyAction( this, "unload_subs" );
|
|---|
| 755 | connect( unloadSubsAct, SIGNAL(triggered()),
|
|---|
| 756 | core, SLOT(unloadSub()) );
|
|---|
| 757 |
|
|---|
| 758 | decSubDelayAct = new MyAction( Qt::Key_Z, this, "dec_sub_delay" );
|
|---|
| 759 | connect( decSubDelayAct, SIGNAL(triggered()),
|
|---|
| 760 | core, SLOT(decSubDelay()) );
|
|---|
| 761 |
|
|---|
| 762 | incSubDelayAct = new MyAction( Qt::Key_X, this, "inc_sub_delay" );
|
|---|
| 763 | connect( incSubDelayAct, SIGNAL(triggered()),
|
|---|
| 764 | core, SLOT(incSubDelay()) );
|
|---|
| 765 |
|
|---|
| 766 | subDelayAct = new MyAction( this, "sub_delay" );
|
|---|
| 767 | connect( subDelayAct, SIGNAL(triggered()),
|
|---|
| 768 | this, SLOT(showSubDelayDialog()) );
|
|---|
| 769 |
|
|---|
| 770 | decSubPosAct = new MyAction( Qt::Key_R, this, "dec_sub_pos" );
|
|---|
| 771 | connect( decSubPosAct, SIGNAL(triggered()),
|
|---|
| 772 | core, SLOT(decSubPos()) );
|
|---|
| 773 | incSubPosAct = new MyAction( Qt::Key_T, this, "inc_sub_pos" );
|
|---|
| 774 | connect( incSubPosAct, SIGNAL(triggered()),
|
|---|
| 775 | core, SLOT(incSubPos()) );
|
|---|
| 776 |
|
|---|
| 777 | decSubScaleAct = new MyAction( Qt::SHIFT | Qt::Key_R, this, "dec_sub_scale" );
|
|---|
| 778 | connect( decSubScaleAct, SIGNAL(triggered()),
|
|---|
| 779 | core, SLOT(decSubScale()) );
|
|---|
| 780 |
|
|---|
| 781 | incSubScaleAct = new MyAction( Qt::SHIFT | Qt::Key_T, this, "inc_sub_scale" );
|
|---|
| 782 | connect( incSubScaleAct, SIGNAL(triggered()),
|
|---|
| 783 | core, SLOT(incSubScale()) );
|
|---|
| 784 |
|
|---|
| 785 | decSubStepAct = new MyAction( Qt::Key_G, this, "dec_sub_step" );
|
|---|
| 786 | connect( decSubStepAct, SIGNAL(triggered()),
|
|---|
| 787 | core, SLOT(decSubStep()) );
|
|---|
| 788 |
|
|---|
| 789 | incSubStepAct = new MyAction( Qt::Key_Y, this, "inc_sub_step" );
|
|---|
| 790 | connect( incSubStepAct, SIGNAL(triggered()),
|
|---|
| 791 | core, SLOT(incSubStep()) );
|
|---|
| 792 |
|
|---|
| 793 | useAssAct = new MyAction(this, "use_ass_lib");
|
|---|
| 794 | useAssAct->setCheckable(true);
|
|---|
| 795 | connect( useAssAct, SIGNAL(toggled(bool)), core, SLOT(changeUseAss(bool)) );
|
|---|
| 796 |
|
|---|
| 797 | useForcedSubsOnlyAct = new MyAction(this, "use_forced_subs_only");
|
|---|
| 798 | useForcedSubsOnlyAct->setCheckable(true);
|
|---|
| 799 | connect( useForcedSubsOnlyAct, SIGNAL(toggled(bool)), core, SLOT(toggleForcedSubsOnly(bool)) );
|
|---|
| 800 |
|
|---|
| 801 | subVisibilityAct = new MyAction(Qt::Key_V, this, "subtitle_visibility");
|
|---|
| 802 | subVisibilityAct->setCheckable(true);
|
|---|
| 803 | connect( subVisibilityAct, SIGNAL(toggled(bool)), core, SLOT(changeSubVisibility(bool)) );
|
|---|
| 804 |
|
|---|
| 805 | showFindSubtitlesDialogAct = new MyAction( this, "show_find_sub_dialog" );
|
|---|
| 806 | connect( showFindSubtitlesDialogAct, SIGNAL(triggered()),
|
|---|
| 807 | this, SLOT(showFindSubtitlesDialog()) );
|
|---|
| 808 |
|
|---|
| 809 | openUploadSubtitlesPageAct = new MyAction( this, "upload_subtitles" ); //turbos
|
|---|
| 810 | connect( openUploadSubtitlesPageAct, SIGNAL(triggered()), //turbos
|
|---|
| 811 | this, SLOT(openUploadSubtitlesPage()) ); //turbos
|
|---|
| 812 |
|
|---|
| 813 |
|
|---|
| 814 | // Menu Options
|
|---|
| 815 | showPlaylistAct = new MyAction( QKeySequence("Ctrl+L"), this, "show_playlist" );
|
|---|
| 816 | showPlaylistAct->setCheckable( true );
|
|---|
| 817 | connect( showPlaylistAct, SIGNAL(toggled(bool)),
|
|---|
| 818 | this, SLOT(showPlaylist(bool)) );
|
|---|
| 819 |
|
|---|
| 820 | showPropertiesAct = new MyAction( QKeySequence("Ctrl+I"), this, "show_file_properties" );
|
|---|
| 821 | connect( showPropertiesAct, SIGNAL(triggered()),
|
|---|
| 822 | this, SLOT(showFilePropertiesDialog()) );
|
|---|
| 823 |
|
|---|
| 824 | showPreferencesAct = new MyAction( QKeySequence("Ctrl+P"), this, "show_preferences" );
|
|---|
| 825 | connect( showPreferencesAct, SIGNAL(triggered()),
|
|---|
| 826 | this, SLOT(showPreferencesDialog()) );
|
|---|
| 827 |
|
|---|
| 828 | showTubeBrowserAct = new MyAction( Qt::Key_F11, this, "show_tube_browser" );
|
|---|
| 829 | connect( showTubeBrowserAct, SIGNAL(triggered()),
|
|---|
| 830 | this, SLOT(showTubeBrowser()) );
|
|---|
| 831 |
|
|---|
| 832 | // Submenu Logs
|
|---|
| 833 | showLogMplayerAct = new MyAction( QKeySequence("Ctrl+M"), this, "show_mplayer_log" );
|
|---|
| 834 | connect( showLogMplayerAct, SIGNAL(triggered()),
|
|---|
| 835 | this, SLOT(showMplayerLog()) );
|
|---|
| 836 |
|
|---|
| 837 | showLogSmplayerAct = new MyAction( QKeySequence("Ctrl+S"), this, "show_smplayer_log" );
|
|---|
| 838 | connect( showLogSmplayerAct, SIGNAL(triggered()),
|
|---|
| 839 | this, SLOT(showLog()) );
|
|---|
| 840 |
|
|---|
| 841 | // Menu Help
|
|---|
| 842 | showFAQAct = new MyAction( this, "faq" );
|
|---|
| 843 | connect( showFAQAct, SIGNAL(triggered()),
|
|---|
| 844 | this, SLOT(helpFAQ()) );
|
|---|
| 845 |
|
|---|
| 846 | showCLOptionsAct = new MyAction( this, "cl_options" );
|
|---|
| 847 | connect( showCLOptionsAct, SIGNAL(triggered()),
|
|---|
| 848 | this, SLOT(helpCLOptions()) );
|
|---|
| 849 |
|
|---|
| 850 | showCheckUpdatesAct = new MyAction( this, "check_updates" );
|
|---|
| 851 | connect( showCheckUpdatesAct, SIGNAL(triggered()),
|
|---|
| 852 | this, SLOT(helpCheckUpdates()) );
|
|---|
| 853 |
|
|---|
| 854 | donateAct = new MyAction( this, "donate" );
|
|---|
| 855 | connect( donateAct, SIGNAL(triggered()),
|
|---|
| 856 | this, SLOT(helpDonate()) );
|
|---|
| 857 |
|
|---|
| 858 | aboutQtAct = new MyAction( this, "about_qt" );
|
|---|
| 859 | connect( aboutQtAct, SIGNAL(triggered()),
|
|---|
| 860 | this, SLOT(helpAboutQt()) );
|
|---|
| 861 |
|
|---|
| 862 | aboutThisAct = new MyAction( this, "about_smplayer" );
|
|---|
| 863 | connect( aboutThisAct, SIGNAL(triggered()),
|
|---|
| 864 | this, SLOT(helpAbout()) );
|
|---|
| 865 |
|
|---|
| 866 | // Playlist
|
|---|
| 867 | playNextAct = new MyAction(Qt::Key_Greater, this, "play_next");
|
|---|
| 868 | connect( playNextAct, SIGNAL(triggered()), playlist, SLOT(playNext()) );
|
|---|
| 869 |
|
|---|
| 870 | playPrevAct = new MyAction(Qt::Key_Less, this, "play_prev");
|
|---|
| 871 | connect( playPrevAct, SIGNAL(triggered()), playlist, SLOT(playPrev()) );
|
|---|
| 872 |
|
|---|
| 873 |
|
|---|
| 874 | // Move video window and zoom
|
|---|
| 875 | moveUpAct = new MyAction(Qt::ALT | Qt::Key_Up, this, "move_up");
|
|---|
| 876 | connect( moveUpAct, SIGNAL(triggered()), mplayerwindow, SLOT(moveUp()) );
|
|---|
| 877 |
|
|---|
| 878 | moveDownAct = new MyAction(Qt::ALT | Qt::Key_Down, this, "move_down");
|
|---|
| 879 | connect( moveDownAct, SIGNAL(triggered()), mplayerwindow, SLOT(moveDown()) );
|
|---|
| 880 |
|
|---|
| 881 | moveLeftAct = new MyAction(Qt::ALT | Qt::Key_Left, this, "move_left");
|
|---|
| 882 | connect( moveLeftAct, SIGNAL(triggered()), mplayerwindow, SLOT(moveLeft()) );
|
|---|
| 883 |
|
|---|
| 884 | moveRightAct = new MyAction(Qt::ALT | Qt::Key_Right, this, "move_right");
|
|---|
| 885 | connect( moveRightAct, SIGNAL(triggered()), mplayerwindow, SLOT(moveRight()) );
|
|---|
| 886 |
|
|---|
| 887 | incZoomAct = new MyAction(Qt::Key_E, this, "inc_zoom");
|
|---|
| 888 | connect( incZoomAct, SIGNAL(triggered()), core, SLOT(incZoom()) );
|
|---|
| 889 |
|
|---|
| 890 | decZoomAct = new MyAction(Qt::Key_W, this, "dec_zoom");
|
|---|
| 891 | connect( decZoomAct, SIGNAL(triggered()), core, SLOT(decZoom()) );
|
|---|
| 892 |
|
|---|
| 893 | resetZoomAct = new MyAction(Qt::SHIFT | Qt::Key_E, this, "reset_zoom");
|
|---|
| 894 | connect( resetZoomAct, SIGNAL(triggered()), core, SLOT(resetZoom()) );
|
|---|
| 895 |
|
|---|
| 896 | autoZoomAct = new MyAction(Qt::SHIFT | Qt::Key_W, this, "auto_zoom");
|
|---|
| 897 | connect( autoZoomAct, SIGNAL(triggered()), core, SLOT(autoZoom()) );
|
|---|
| 898 |
|
|---|
| 899 | autoZoom169Act = new MyAction(Qt::SHIFT | Qt::Key_A, this, "zoom_169");
|
|---|
| 900 | connect( autoZoom169Act, SIGNAL(triggered()), core, SLOT(autoZoomFor169()) );
|
|---|
| 901 |
|
|---|
| 902 | autoZoom235Act = new MyAction(Qt::SHIFT | Qt::Key_S, this, "zoom_235");
|
|---|
| 903 | connect( autoZoom235Act, SIGNAL(triggered()), core, SLOT(autoZoomFor235()) );
|
|---|
| 904 |
|
|---|
| 905 | #if USE_MPLAYER_PANSCAN
|
|---|
| 906 | incPanscanAct = new MyAction(Qt::SHIFT | Qt::Key_M, this, "inc_panscan");
|
|---|
| 907 | connect( incPanscanAct, SIGNAL(triggered()), core, SLOT(incPanscan()) );
|
|---|
| 908 |
|
|---|
| 909 | decPanscanAct = new MyAction(Qt::SHIFT | Qt::Key_N, this, "dec_panscan");
|
|---|
| 910 | connect( decPanscanAct, SIGNAL(triggered()), core, SLOT(decPanscan()) );
|
|---|
| 911 | #endif
|
|---|
| 912 |
|
|---|
| 913 |
|
|---|
| 914 | // Actions not in menus or buttons
|
|---|
| 915 | // Volume 2
|
|---|
| 916 | #if !USE_MULTIPLE_SHORTCUTS
|
|---|
| 917 | decVolume2Act = new MyAction( Qt::Key_Slash, this, "dec_volume2" );
|
|---|
| 918 | connect( decVolume2Act, SIGNAL(triggered()), core, SLOT(decVolume()) );
|
|---|
| 919 |
|
|---|
| 920 | incVolume2Act = new MyAction( Qt::Key_Asterisk, this, "inc_volume2" );
|
|---|
| 921 | connect( incVolume2Act, SIGNAL(triggered()), core, SLOT(incVolume()) );
|
|---|
| 922 | #endif
|
|---|
| 923 | // Exit fullscreen
|
|---|
| 924 | exitFullscreenAct = new MyAction( Qt::Key_Escape, this, "exit_fullscreen" );
|
|---|
| 925 | connect( exitFullscreenAct, SIGNAL(triggered()), this, SLOT(exitFullscreen()) );
|
|---|
| 926 |
|
|---|
| 927 | nextOSDAct = new MyAction( Qt::Key_O, this, "next_osd");
|
|---|
| 928 | connect( nextOSDAct, SIGNAL(triggered()), core, SLOT(nextOSD()) );
|
|---|
| 929 |
|
|---|
| 930 | decContrastAct = new MyAction( Qt::Key_1, this, "dec_contrast");
|
|---|
| 931 | connect( decContrastAct, SIGNAL(triggered()), core, SLOT(decContrast()) );
|
|---|
| 932 |
|
|---|
| 933 | incContrastAct = new MyAction( Qt::Key_2, this, "inc_contrast");
|
|---|
| 934 | connect( incContrastAct, SIGNAL(triggered()), core, SLOT(incContrast()) );
|
|---|
| 935 |
|
|---|
| 936 | decBrightnessAct = new MyAction( Qt::Key_3, this, "dec_brightness");
|
|---|
| 937 | connect( decBrightnessAct, SIGNAL(triggered()), core, SLOT(decBrightness()) );
|
|---|
| 938 |
|
|---|
| 939 | incBrightnessAct = new MyAction( Qt::Key_4, this, "inc_brightness");
|
|---|
| 940 | connect( incBrightnessAct, SIGNAL(triggered()), core, SLOT(incBrightness()) );
|
|---|
| 941 |
|
|---|
| 942 | decHueAct = new MyAction(Qt::Key_5, this, "dec_hue");
|
|---|
| 943 | connect( decHueAct, SIGNAL(triggered()), core, SLOT(decHue()) );
|
|---|
| 944 |
|
|---|
| 945 | incHueAct = new MyAction( Qt::Key_6, this, "inc_hue");
|
|---|
| 946 | connect( incHueAct, SIGNAL(triggered()), core, SLOT(incHue()) );
|
|---|
| 947 |
|
|---|
| 948 | decSaturationAct = new MyAction( Qt::Key_7, this, "dec_saturation");
|
|---|
| 949 | connect( decSaturationAct, SIGNAL(triggered()), core, SLOT(decSaturation()) );
|
|---|
| 950 |
|
|---|
| 951 | incSaturationAct = new MyAction( Qt::Key_8, this, "inc_saturation");
|
|---|
| 952 | connect( incSaturationAct, SIGNAL(triggered()), core, SLOT(incSaturation()) );
|
|---|
| 953 |
|
|---|
| 954 | decGammaAct = new MyAction( this, "dec_gamma");
|
|---|
| 955 | connect( decGammaAct, SIGNAL(triggered()), core, SLOT(decGamma()) );
|
|---|
| 956 |
|
|---|
| 957 | incGammaAct = new MyAction( this, "inc_gamma");
|
|---|
| 958 | connect( incGammaAct, SIGNAL(triggered()), core, SLOT(incGamma()) );
|
|---|
| 959 |
|
|---|
| 960 | nextVideoAct = new MyAction( this, "next_video");
|
|---|
| 961 | connect( nextVideoAct, SIGNAL(triggered()), core, SLOT(nextVideo()) );
|
|---|
| 962 |
|
|---|
| 963 | nextAudioAct = new MyAction( Qt::Key_K, this, "next_audio");
|
|---|
| 964 | connect( nextAudioAct, SIGNAL(triggered()), core, SLOT(nextAudio()) );
|
|---|
| 965 |
|
|---|
| 966 | nextSubtitleAct = new MyAction( Qt::Key_J, this, "next_subtitle");
|
|---|
| 967 | connect( nextSubtitleAct, SIGNAL(triggered()), core, SLOT(nextSubtitle()) );
|
|---|
| 968 |
|
|---|
| 969 | nextChapterAct = new MyAction( Qt::Key_At, this, "next_chapter");
|
|---|
| 970 | connect( nextChapterAct, SIGNAL(triggered()), core, SLOT(nextChapter()) );
|
|---|
| 971 |
|
|---|
| 972 | prevChapterAct = new MyAction( Qt::Key_Exclam, this, "prev_chapter");
|
|---|
| 973 | connect( prevChapterAct, SIGNAL(triggered()), core, SLOT(prevChapter()) );
|
|---|
| 974 |
|
|---|
| 975 | doubleSizeAct = new MyAction( Qt::CTRL | Qt::Key_D, this, "toggle_double_size");
|
|---|
| 976 | connect( doubleSizeAct, SIGNAL(triggered()), core, SLOT(toggleDoubleSize()) );
|
|---|
| 977 |
|
|---|
| 978 | resetVideoEqualizerAct = new MyAction( this, "reset_video_equalizer");
|
|---|
| 979 | connect( resetVideoEqualizerAct, SIGNAL(triggered()), video_equalizer, SLOT(reset()) );
|
|---|
| 980 |
|
|---|
| 981 | resetAudioEqualizerAct = new MyAction( this, "reset_audio_equalizer");
|
|---|
| 982 | connect( resetAudioEqualizerAct, SIGNAL(triggered()), audio_equalizer, SLOT(reset()) );
|
|---|
| 983 |
|
|---|
| 984 | showContextMenuAct = new MyAction( this, "show_context_menu");
|
|---|
| 985 | connect( showContextMenuAct, SIGNAL(triggered()),
|
|---|
| 986 | this, SLOT(showPopupMenu()) );
|
|---|
| 987 |
|
|---|
| 988 | nextAspectAct = new MyAction( Qt::Key_A, this, "next_aspect");
|
|---|
| 989 | connect( nextAspectAct, SIGNAL(triggered()),
|
|---|
| 990 | core, SLOT(nextAspectRatio()) );
|
|---|
| 991 |
|
|---|
| 992 | nextWheelFunctionAct = new MyAction(this, "next_wheel_function");
|
|---|
| 993 | connect( nextWheelFunctionAct, SIGNAL(triggered()),
|
|---|
| 994 | core, SLOT(nextWheelFunction()) );
|
|---|
| 995 |
|
|---|
| 996 | showFilenameAct = new MyAction(Qt::SHIFT | Qt::Key_I, this, "show_filename");
|
|---|
| 997 | connect( showFilenameAct, SIGNAL(triggered()), core, SLOT(showFilenameOnOSD()) );
|
|---|
| 998 |
|
|---|
| 999 | toggleDeinterlaceAct = new MyAction(Qt::Key_D, this, "toggle_deinterlacing");
|
|---|
| 1000 | connect( toggleDeinterlaceAct, SIGNAL(triggered()), core, SLOT(toggleDeinterlace()) );
|
|---|
| 1001 |
|
|---|
| 1002 |
|
|---|
| 1003 | // Group actions
|
|---|
| 1004 |
|
|---|
| 1005 | // OSD
|
|---|
| 1006 | osdGroup = new MyActionGroup(this);
|
|---|
| 1007 | osdNoneAct = new MyActionGroupItem(this, osdGroup, "osd_none", Preferences::None);
|
|---|
| 1008 | osdSeekAct = new MyActionGroupItem(this, osdGroup, "osd_seek", Preferences::Seek);
|
|---|
| 1009 | osdTimerAct = new MyActionGroupItem(this, osdGroup, "osd_timer", Preferences::SeekTimer);
|
|---|
| 1010 | osdTotalAct = new MyActionGroupItem(this, osdGroup, "osd_total", Preferences::SeekTimerTotal);
|
|---|
| 1011 | connect( osdGroup, SIGNAL(activated(int)), core, SLOT(changeOSD(int)) );
|
|---|
| 1012 |
|
|---|
| 1013 | // Denoise
|
|---|
| 1014 | denoiseGroup = new MyActionGroup(this);
|
|---|
| 1015 | denoiseNoneAct = new MyActionGroupItem(this, denoiseGroup, "denoise_none", MediaSettings::NoDenoise);
|
|---|
| 1016 | denoiseNormalAct = new MyActionGroupItem(this, denoiseGroup, "denoise_normal", MediaSettings::DenoiseNormal);
|
|---|
| 1017 | denoiseSoftAct = new MyActionGroupItem(this, denoiseGroup, "denoise_soft", MediaSettings::DenoiseSoft);
|
|---|
| 1018 | connect( denoiseGroup, SIGNAL(activated(int)), core, SLOT(changeDenoise(int)) );
|
|---|
| 1019 |
|
|---|
| 1020 | // Video size
|
|---|
| 1021 | sizeGroup = new MyActionGroup(this);
|
|---|
| 1022 | size50 = new MyActionGroupItem(this, sizeGroup, "5&0%", "size_50", 50);
|
|---|
| 1023 | size75 = new MyActionGroupItem(this, sizeGroup, "7&5%", "size_75", 75);
|
|---|
| 1024 | size100 = new MyActionGroupItem(this, sizeGroup, "&100%", "size_100", 100);
|
|---|
| 1025 | size125 = new MyActionGroupItem(this, sizeGroup, "1&25%", "size_125", 125);
|
|---|
| 1026 | size150 = new MyActionGroupItem(this, sizeGroup, "15&0%", "size_150", 150);
|
|---|
| 1027 | size175 = new MyActionGroupItem(this, sizeGroup, "1&75%", "size_175", 175);
|
|---|
| 1028 | size200 = new MyActionGroupItem(this, sizeGroup, "&200%", "size_200", 200);
|
|---|
| 1029 | size300 = new MyActionGroupItem(this, sizeGroup, "&300%", "size_300", 300);
|
|---|
| 1030 | size400 = new MyActionGroupItem(this, sizeGroup, "&400%", "size_400", 400);
|
|---|
| 1031 | size100->setShortcut( Qt::CTRL | Qt::Key_1 );
|
|---|
| 1032 | size200->setShortcut( Qt::CTRL | Qt::Key_2 );
|
|---|
| 1033 | connect( sizeGroup, SIGNAL(activated(int)), core, SLOT(changeSize(int)) );
|
|---|
| 1034 | // Make all not checkable
|
|---|
| 1035 | QList <QAction *> size_list = sizeGroup->actions();
|
|---|
| 1036 | for (int n=0; n < size_list.count(); n++) {
|
|---|
| 1037 | size_list[n]->setCheckable(false);
|
|---|
| 1038 | }
|
|---|
| 1039 |
|
|---|
| 1040 | // Deinterlace
|
|---|
| 1041 | deinterlaceGroup = new MyActionGroup(this);
|
|---|
| 1042 | deinterlaceNoneAct = new MyActionGroupItem(this, deinterlaceGroup, "deinterlace_none", MediaSettings::NoDeinterlace);
|
|---|
| 1043 | deinterlaceL5Act = new MyActionGroupItem(this, deinterlaceGroup, "deinterlace_l5", MediaSettings::L5);
|
|---|
| 1044 | deinterlaceYadif0Act = new MyActionGroupItem(this, deinterlaceGroup, "deinterlace_yadif0", MediaSettings::Yadif);
|
|---|
| 1045 | deinterlaceYadif1Act = new MyActionGroupItem(this, deinterlaceGroup, "deinterlace_yadif1", MediaSettings::Yadif_1);
|
|---|
| 1046 | deinterlaceLBAct = new MyActionGroupItem(this, deinterlaceGroup, "deinterlace_lb", MediaSettings::LB);
|
|---|
| 1047 | deinterlaceKernAct = new MyActionGroupItem(this, deinterlaceGroup, "deinterlace_kern", MediaSettings::Kerndeint);
|
|---|
| 1048 | connect( deinterlaceGroup, SIGNAL(activated(int)),
|
|---|
| 1049 | core, SLOT(changeDeinterlace(int)) );
|
|---|
| 1050 |
|
|---|
| 1051 | // Audio channels
|
|---|
| 1052 | channelsGroup = new MyActionGroup(this);
|
|---|
| 1053 | /* channelsDefaultAct = new MyActionGroupItem(this, channelsGroup, "channels_default", MediaSettings::ChDefault); */
|
|---|
| 1054 | channelsStereoAct = new MyActionGroupItem(this, channelsGroup, "channels_stereo", MediaSettings::ChStereo);
|
|---|
| 1055 | channelsSurroundAct = new MyActionGroupItem(this, channelsGroup, "channels_surround", MediaSettings::ChSurround);
|
|---|
| 1056 | channelsFull51Act = new MyActionGroupItem(this, channelsGroup, "channels_ful51", MediaSettings::ChFull51);
|
|---|
| 1057 | connect( channelsGroup, SIGNAL(activated(int)),
|
|---|
| 1058 | core, SLOT(setAudioChannels(int)) );
|
|---|
| 1059 |
|
|---|
| 1060 | // Stereo mode
|
|---|
| 1061 | stereoGroup = new MyActionGroup(this);
|
|---|
| 1062 | stereoAct = new MyActionGroupItem(this, stereoGroup, "stereo", MediaSettings::Stereo);
|
|---|
| 1063 | leftChannelAct = new MyActionGroupItem(this, stereoGroup, "left_channel", MediaSettings::Left);
|
|---|
| 1064 | rightChannelAct = new MyActionGroupItem(this, stereoGroup, "right_channel", MediaSettings::Right);
|
|---|
| 1065 | connect( stereoGroup, SIGNAL(activated(int)),
|
|---|
| 1066 | core, SLOT(setStereoMode(int)) );
|
|---|
| 1067 |
|
|---|
| 1068 | // Video aspect
|
|---|
| 1069 | aspectGroup = new MyActionGroup(this);
|
|---|
| 1070 | aspectDetectAct = new MyActionGroupItem(this, aspectGroup, "aspect_detect", MediaSettings::AspectAuto);
|
|---|
| 1071 | aspect11Act = new MyActionGroupItem(this, aspectGroup, "aspect_1:1", MediaSettings::Aspect11 );
|
|---|
| 1072 | aspect32Act = new MyActionGroupItem(this, aspectGroup, "aspect_3:2", MediaSettings::Aspect32);
|
|---|
| 1073 | aspect43Act = new MyActionGroupItem(this, aspectGroup, "aspect_4:3", MediaSettings::Aspect43);
|
|---|
| 1074 | aspect54Act = new MyActionGroupItem(this, aspectGroup, "aspect_5:4", MediaSettings::Aspect54 );
|
|---|
| 1075 | aspect149Act = new MyActionGroupItem(this, aspectGroup, "aspect_14:9", MediaSettings::Aspect149 );
|
|---|
| 1076 | aspect1410Act = new MyActionGroupItem(this, aspectGroup, "aspect_14:10", MediaSettings::Aspect1410 );
|
|---|
| 1077 | aspect169Act = new MyActionGroupItem(this, aspectGroup, "aspect_16:9", MediaSettings::Aspect169 );
|
|---|
| 1078 | aspect1610Act = new MyActionGroupItem(this, aspectGroup, "aspect_16:10", MediaSettings::Aspect1610 );
|
|---|
| 1079 | aspect235Act = new MyActionGroupItem(this, aspectGroup, "aspect_2.35:1", MediaSettings::Aspect235 );
|
|---|
| 1080 | {
|
|---|
| 1081 | QAction * sep = new QAction(aspectGroup);
|
|---|
| 1082 | sep->setSeparator(true);
|
|---|
| 1083 | }
|
|---|
| 1084 | aspectNoneAct = new MyActionGroupItem(this, aspectGroup, "aspect_none", MediaSettings::AspectNone);
|
|---|
| 1085 |
|
|---|
| 1086 | connect( aspectGroup, SIGNAL(activated(int)),
|
|---|
| 1087 | core, SLOT(changeAspectRatio(int)) );
|
|---|
| 1088 |
|
|---|
| 1089 | // Rotate
|
|---|
| 1090 | rotateGroup = new MyActionGroup(this);
|
|---|
| 1091 | rotateNoneAct = new MyActionGroupItem(this, rotateGroup, "rotate_none", MediaSettings::NoRotate);
|
|---|
| 1092 | rotateClockwiseFlipAct = new MyActionGroupItem(this, rotateGroup, "rotate_clockwise_flip", MediaSettings::Clockwise_flip);
|
|---|
| 1093 | rotateClockwiseAct = new MyActionGroupItem(this, rotateGroup, "rotate_clockwise", MediaSettings::Clockwise);
|
|---|
| 1094 | rotateCounterclockwiseAct = new MyActionGroupItem(this, rotateGroup, "rotate_counterclockwise", MediaSettings::Counterclockwise);
|
|---|
| 1095 | rotateCounterclockwiseFlipAct = new MyActionGroupItem(this, rotateGroup, "rotate_counterclockwise_flip", MediaSettings::Counterclockwise_flip);
|
|---|
| 1096 | connect( rotateGroup, SIGNAL(activated(int)),
|
|---|
| 1097 | core, SLOT(changeRotate(int)) );
|
|---|
| 1098 |
|
|---|
| 1099 | // On Top
|
|---|
| 1100 | onTopActionGroup = new MyActionGroup(this);
|
|---|
| 1101 | onTopAlwaysAct = new MyActionGroupItem( this,onTopActionGroup,"on_top_always",Preferences::AlwaysOnTop);
|
|---|
| 1102 | onTopNeverAct = new MyActionGroupItem( this,onTopActionGroup,"on_top_never",Preferences::NeverOnTop);
|
|---|
| 1103 | onTopWhilePlayingAct = new MyActionGroupItem( this,onTopActionGroup,"on_top_playing",Preferences::WhilePlayingOnTop);
|
|---|
| 1104 | connect( onTopActionGroup , SIGNAL(activated(int)),
|
|---|
| 1105 | this, SLOT(changeStayOnTop(int)) );
|
|---|
| 1106 |
|
|---|
| 1107 | toggleStayOnTopAct = new MyAction( this, "toggle_stay_on_top");
|
|---|
| 1108 | connect( toggleStayOnTopAct, SIGNAL(triggered()), this, SLOT(toggleStayOnTop()) );
|
|---|
| 1109 |
|
|---|
| 1110 |
|
|---|
| 1111 | #if USE_ADAPTER
|
|---|
| 1112 | screenGroup = new MyActionGroup(this);
|
|---|
| 1113 | screenDefaultAct = new MyActionGroupItem(this, screenGroup, "screen_default", -1);
|
|---|
| 1114 | #ifdef Q_OS_WIN
|
|---|
| 1115 | DeviceList display_devices = DeviceInfo::displayDevices();
|
|---|
| 1116 | if (!display_devices.isEmpty()) {
|
|---|
| 1117 | for (int n = 0; n < display_devices.count(); n++) {
|
|---|
| 1118 | int id = display_devices[n].ID().toInt();
|
|---|
| 1119 | QString desc = display_devices[n].desc();
|
|---|
| 1120 | MyAction * screen_item = new MyActionGroupItem(this, screenGroup, QString("screen_%1").arg(n).toAscii().constData(), id);
|
|---|
| 1121 | screen_item->change( "&"+QString::number(n) + " - " + desc);
|
|---|
| 1122 | }
|
|---|
| 1123 | }
|
|---|
| 1124 | else
|
|---|
| 1125 | #endif // Q_OS_WIN
|
|---|
| 1126 | for (int n = 1; n <= 4; n++) {
|
|---|
| 1127 | MyAction * screen_item = new MyActionGroupItem(this, screenGroup, QString("screen_%1").arg(n).toAscii().constData(), n);
|
|---|
| 1128 | screen_item->change( "&"+QString::number(n) );
|
|---|
| 1129 | }
|
|---|
| 1130 |
|
|---|
| 1131 | connect( screenGroup, SIGNAL(activated(int)),
|
|---|
| 1132 | core, SLOT(changeAdapter(int)) );
|
|---|
| 1133 | #endif
|
|---|
| 1134 |
|
|---|
| 1135 | #if PROGRAM_SWITCH
|
|---|
| 1136 | // Program track
|
|---|
| 1137 | programTrackGroup = new MyActionGroup(this);
|
|---|
| 1138 | connect( programTrackGroup, SIGNAL(activated(int)),
|
|---|
| 1139 | core, SLOT(changeProgram(int)) );
|
|---|
| 1140 | #endif
|
|---|
| 1141 |
|
|---|
| 1142 | // Video track
|
|---|
| 1143 | videoTrackGroup = new MyActionGroup(this);
|
|---|
| 1144 | connect( videoTrackGroup, SIGNAL(activated(int)),
|
|---|
| 1145 | core, SLOT(changeVideo(int)) );
|
|---|
| 1146 |
|
|---|
| 1147 | // Audio track
|
|---|
| 1148 | audioTrackGroup = new MyActionGroup(this);
|
|---|
| 1149 | connect( audioTrackGroup, SIGNAL(activated(int)),
|
|---|
| 1150 | core, SLOT(changeAudio(int)) );
|
|---|
| 1151 |
|
|---|
| 1152 | // Subtitle track
|
|---|
| 1153 | subtitleTrackGroup = new MyActionGroup(this);
|
|---|
| 1154 | connect( subtitleTrackGroup, SIGNAL(activated(int)),
|
|---|
| 1155 | core, SLOT(changeSubtitle(int)) );
|
|---|
| 1156 |
|
|---|
| 1157 | ccGroup = new MyActionGroup(this);
|
|---|
| 1158 | ccNoneAct = new MyActionGroupItem(this, ccGroup, "cc_none", 0);
|
|---|
| 1159 | ccChannel1Act = new MyActionGroupItem(this, ccGroup, "cc_ch_1", 1);
|
|---|
| 1160 | ccChannel2Act = new MyActionGroupItem(this, ccGroup, "cc_ch_2", 2);
|
|---|
| 1161 | ccChannel3Act = new MyActionGroupItem(this, ccGroup, "cc_ch_3", 3);
|
|---|
| 1162 | ccChannel4Act = new MyActionGroupItem(this, ccGroup, "cc_ch_4", 4);
|
|---|
| 1163 | connect( ccGroup, SIGNAL(activated(int)),
|
|---|
| 1164 | core, SLOT(changeClosedCaptionChannel(int)) );
|
|---|
| 1165 |
|
|---|
| 1166 | // Titles
|
|---|
| 1167 | titleGroup = new MyActionGroup(this);
|
|---|
| 1168 | connect( titleGroup, SIGNAL(activated(int)),
|
|---|
| 1169 | core, SLOT(changeTitle(int)) );
|
|---|
| 1170 |
|
|---|
| 1171 | // Angles
|
|---|
| 1172 | angleGroup = new MyActionGroup(this);
|
|---|
| 1173 | connect( angleGroup, SIGNAL(activated(int)),
|
|---|
| 1174 | core, SLOT(changeAngle(int)) );
|
|---|
| 1175 |
|
|---|
| 1176 | // Chapters
|
|---|
| 1177 | chapterGroup = new MyActionGroup(this);
|
|---|
| 1178 | connect( chapterGroup, SIGNAL(activated(int)),
|
|---|
| 1179 | core, SLOT(changeChapter(int)) );
|
|---|
| 1180 |
|
|---|
| 1181 | #if DVDNAV_SUPPORT
|
|---|
| 1182 | dvdnavUpAct = new MyAction(Qt::SHIFT | Qt::Key_Up, this, "dvdnav_up");
|
|---|
| 1183 | connect( dvdnavUpAct, SIGNAL(triggered()), core, SLOT(dvdnavUp()) );
|
|---|
| 1184 |
|
|---|
| 1185 | dvdnavDownAct = new MyAction(Qt::SHIFT | Qt::Key_Down, this, "dvdnav_down");
|
|---|
| 1186 | connect( dvdnavDownAct, SIGNAL(triggered()), core, SLOT(dvdnavDown()) );
|
|---|
| 1187 |
|
|---|
| 1188 | dvdnavLeftAct = new MyAction(Qt::SHIFT | Qt::Key_Left, this, "dvdnav_left");
|
|---|
| 1189 | connect( dvdnavLeftAct, SIGNAL(triggered()), core, SLOT(dvdnavLeft()) );
|
|---|
| 1190 |
|
|---|
| 1191 | dvdnavRightAct = new MyAction(Qt::SHIFT | Qt::Key_Right, this, "dvdnav_right");
|
|---|
| 1192 | connect( dvdnavRightAct, SIGNAL(triggered()), core, SLOT(dvdnavRight()) );
|
|---|
| 1193 |
|
|---|
| 1194 | dvdnavMenuAct = new MyAction(Qt::SHIFT | Qt::Key_Return, this, "dvdnav_menu");
|
|---|
| 1195 | connect( dvdnavMenuAct, SIGNAL(triggered()), core, SLOT(dvdnavMenu()) );
|
|---|
| 1196 |
|
|---|
| 1197 | dvdnavSelectAct = new MyAction(Qt::Key_Return, this, "dvdnav_select");
|
|---|
| 1198 | connect( dvdnavSelectAct, SIGNAL(triggered()), core, SLOT(dvdnavSelect()) );
|
|---|
| 1199 |
|
|---|
| 1200 | dvdnavPrevAct = new MyAction(Qt::SHIFT | Qt::Key_Escape, this, "dvdnav_prev");
|
|---|
| 1201 | connect( dvdnavPrevAct, SIGNAL(triggered()), core, SLOT(dvdnavPrev()) );
|
|---|
| 1202 |
|
|---|
| 1203 | dvdnavMouseAct = new MyAction( this, "dvdnav_mouse");
|
|---|
| 1204 | connect( dvdnavMouseAct, SIGNAL(triggered()), core, SLOT(dvdnavMouse()) );
|
|---|
| 1205 | #endif
|
|---|
| 1206 |
|
|---|
| 1207 | }
|
|---|
| 1208 |
|
|---|
| 1209 | #if AUTODISABLE_ACTIONS
|
|---|
| 1210 | void BaseGui::setActionsEnabled(bool b) {
|
|---|
| 1211 | // Menu Play
|
|---|
| 1212 | playAct->setEnabled(b);
|
|---|
| 1213 | playOrPauseAct->setEnabled(b);
|
|---|
| 1214 | pauseAct->setEnabled(b);
|
|---|
| 1215 | pauseAndStepAct->setEnabled(b);
|
|---|
| 1216 | stopAct->setEnabled(b);
|
|---|
| 1217 | frameStepAct->setEnabled(b);
|
|---|
| 1218 | rewind1Act->setEnabled(b);
|
|---|
| 1219 | rewind2Act->setEnabled(b);
|
|---|
| 1220 | rewind3Act->setEnabled(b);
|
|---|
| 1221 | forward1Act->setEnabled(b);
|
|---|
| 1222 | forward2Act->setEnabled(b);
|
|---|
| 1223 | forward3Act->setEnabled(b);
|
|---|
| 1224 | //repeatAct->setEnabled(b);
|
|---|
| 1225 | gotoAct->setEnabled(b);
|
|---|
| 1226 |
|
|---|
| 1227 | // Menu Speed
|
|---|
| 1228 | normalSpeedAct->setEnabled(b);
|
|---|
| 1229 | halveSpeedAct->setEnabled(b);
|
|---|
| 1230 | doubleSpeedAct->setEnabled(b);
|
|---|
| 1231 | decSpeed10Act->setEnabled(b);
|
|---|
| 1232 | incSpeed10Act->setEnabled(b);
|
|---|
| 1233 | decSpeed4Act->setEnabled(b);
|
|---|
| 1234 | incSpeed4Act->setEnabled(b);
|
|---|
| 1235 | decSpeed1Act->setEnabled(b);
|
|---|
| 1236 | incSpeed1Act->setEnabled(b);
|
|---|
| 1237 |
|
|---|
| 1238 | // Menu Video
|
|---|
| 1239 | videoEqualizerAct->setEnabled(b);
|
|---|
| 1240 | screenshotAct->setEnabled(b);
|
|---|
| 1241 | screenshotsAct->setEnabled(b);
|
|---|
| 1242 | flipAct->setEnabled(b);
|
|---|
| 1243 | mirrorAct->setEnabled(b);
|
|---|
| 1244 | postProcessingAct->setEnabled(b);
|
|---|
| 1245 | phaseAct->setEnabled(b);
|
|---|
| 1246 | deblockAct->setEnabled(b);
|
|---|
| 1247 | deringAct->setEnabled(b);
|
|---|
| 1248 | addNoiseAct->setEnabled(b);
|
|---|
| 1249 | addLetterboxAct->setEnabled(b);
|
|---|
| 1250 | upscaleAct->setEnabled(b);
|
|---|
| 1251 |
|
|---|
| 1252 | // Menu Audio
|
|---|
| 1253 | audioEqualizerAct->setEnabled(b);
|
|---|
| 1254 | muteAct->setEnabled(b);
|
|---|
| 1255 | decVolumeAct->setEnabled(b);
|
|---|
| 1256 | incVolumeAct->setEnabled(b);
|
|---|
| 1257 | decAudioDelayAct->setEnabled(b);
|
|---|
| 1258 | incAudioDelayAct->setEnabled(b);
|
|---|
| 1259 | audioDelayAct->setEnabled(b);
|
|---|
| 1260 | extrastereoAct->setEnabled(b);
|
|---|
| 1261 | karaokeAct->setEnabled(b);
|
|---|
| 1262 | volnormAct->setEnabled(b);
|
|---|
| 1263 | loadAudioAct->setEnabled(b);
|
|---|
| 1264 | //unloadAudioAct->setEnabled(b);
|
|---|
| 1265 |
|
|---|
| 1266 | // Menu Subtitles
|
|---|
| 1267 | loadSubsAct->setEnabled(b);
|
|---|
| 1268 | //unloadSubsAct->setEnabled(b);
|
|---|
| 1269 | decSubDelayAct->setEnabled(b);
|
|---|
| 1270 | incSubDelayAct->setEnabled(b);
|
|---|
| 1271 | subDelayAct->setEnabled(b);
|
|---|
| 1272 | decSubPosAct->setEnabled(b);
|
|---|
| 1273 | incSubPosAct->setEnabled(b);
|
|---|
| 1274 | incSubStepAct->setEnabled(b);
|
|---|
| 1275 | decSubStepAct->setEnabled(b);
|
|---|
| 1276 | incSubScaleAct->setEnabled(b);
|
|---|
| 1277 | decSubScaleAct->setEnabled(b);
|
|---|
| 1278 |
|
|---|
| 1279 | // Actions not in menus
|
|---|
| 1280 | #if !USE_MULTIPLE_SHORTCUTS
|
|---|
| 1281 | decVolume2Act->setEnabled(b);
|
|---|
| 1282 | incVolume2Act->setEnabled(b);
|
|---|
| 1283 | #endif
|
|---|
| 1284 | decContrastAct->setEnabled(b);
|
|---|
| 1285 | incContrastAct->setEnabled(b);
|
|---|
| 1286 | decBrightnessAct->setEnabled(b);
|
|---|
| 1287 | incBrightnessAct->setEnabled(b);
|
|---|
| 1288 | decHueAct->setEnabled(b);
|
|---|
| 1289 | incHueAct->setEnabled(b);
|
|---|
| 1290 | decSaturationAct->setEnabled(b);
|
|---|
| 1291 | incSaturationAct->setEnabled(b);
|
|---|
| 1292 | decGammaAct->setEnabled(b);
|
|---|
| 1293 | incGammaAct->setEnabled(b);
|
|---|
| 1294 | nextVideoAct->setEnabled(b);
|
|---|
| 1295 | nextAudioAct->setEnabled(b);
|
|---|
| 1296 | nextSubtitleAct->setEnabled(b);
|
|---|
| 1297 | nextChapterAct->setEnabled(b);
|
|---|
| 1298 | prevChapterAct->setEnabled(b);
|
|---|
| 1299 | doubleSizeAct->setEnabled(b);
|
|---|
| 1300 |
|
|---|
| 1301 | // Moving and zoom
|
|---|
| 1302 | moveUpAct->setEnabled(b);
|
|---|
| 1303 | moveDownAct->setEnabled(b);
|
|---|
| 1304 | moveLeftAct->setEnabled(b);
|
|---|
| 1305 | moveRightAct->setEnabled(b);
|
|---|
| 1306 | incZoomAct->setEnabled(b);
|
|---|
| 1307 | decZoomAct->setEnabled(b);
|
|---|
| 1308 | resetZoomAct->setEnabled(b);
|
|---|
| 1309 | autoZoomAct->setEnabled(b);
|
|---|
| 1310 | autoZoom169Act->setEnabled(b);
|
|---|
| 1311 | autoZoom235Act->setEnabled(b);
|
|---|
| 1312 |
|
|---|
| 1313 | #if DVDNAV_SUPPORT
|
|---|
| 1314 | dvdnavUpAct->setEnabled(b);
|
|---|
| 1315 | dvdnavDownAct->setEnabled(b);
|
|---|
| 1316 | dvdnavLeftAct->setEnabled(b);
|
|---|
| 1317 | dvdnavRightAct->setEnabled(b);
|
|---|
| 1318 | dvdnavMenuAct->setEnabled(b);
|
|---|
| 1319 | dvdnavSelectAct->setEnabled(b);
|
|---|
| 1320 | dvdnavPrevAct->setEnabled(b);
|
|---|
| 1321 | dvdnavMouseAct->setEnabled(b);
|
|---|
| 1322 | #endif
|
|---|
| 1323 |
|
|---|
| 1324 | // Groups
|
|---|
| 1325 | denoiseGroup->setActionsEnabled(b);
|
|---|
| 1326 | sizeGroup->setActionsEnabled(b);
|
|---|
| 1327 | deinterlaceGroup->setActionsEnabled(b);
|
|---|
| 1328 | aspectGroup->setActionsEnabled(b);
|
|---|
| 1329 | rotateGroup->setActionsEnabled(b);
|
|---|
| 1330 | #if USE_ADAPTER
|
|---|
| 1331 | screenGroup->setActionsEnabled(b);
|
|---|
| 1332 | #endif
|
|---|
| 1333 | channelsGroup->setActionsEnabled(b);
|
|---|
| 1334 | stereoGroup->setActionsEnabled(b);
|
|---|
| 1335 | }
|
|---|
| 1336 |
|
|---|
| 1337 | void BaseGui::enableActionsOnPlaying() {
|
|---|
| 1338 | qDebug("BaseGui::enableActionsOnPlaying");
|
|---|
| 1339 |
|
|---|
| 1340 | setActionsEnabled(true);
|
|---|
| 1341 |
|
|---|
| 1342 | playAct->setEnabled(false);
|
|---|
| 1343 |
|
|---|
| 1344 | // Screenshot option
|
|---|
| 1345 | bool screenshots_enabled = ( (pref->use_screenshot) &&
|
|---|
| 1346 | (!pref->screenshot_directory.isEmpty()) &&
|
|---|
| 1347 | (QFileInfo(pref->screenshot_directory).isDir()) );
|
|---|
| 1348 |
|
|---|
| 1349 | screenshotAct->setEnabled( screenshots_enabled );
|
|---|
| 1350 | screenshotsAct->setEnabled( screenshots_enabled );
|
|---|
| 1351 |
|
|---|
| 1352 | // Disable the compact action if not using video window
|
|---|
| 1353 | compactAct->setEnabled( panel->isVisible() );
|
|---|
| 1354 |
|
|---|
| 1355 | // Enable or disable the audio equalizer
|
|---|
| 1356 | audioEqualizerAct->setEnabled(pref->use_audio_equalizer);
|
|---|
| 1357 |
|
|---|
| 1358 | // Disable audio actions if there's not audio track
|
|---|
| 1359 | if ((core->mdat.audios.numItems()==0) && (core->mset.external_audio.isEmpty())) {
|
|---|
| 1360 | audioEqualizerAct->setEnabled(false);
|
|---|
| 1361 | muteAct->setEnabled(false);
|
|---|
| 1362 | decVolumeAct->setEnabled(false);
|
|---|
| 1363 | incVolumeAct->setEnabled(false);
|
|---|
| 1364 | decAudioDelayAct->setEnabled(false);
|
|---|
| 1365 | incAudioDelayAct->setEnabled(false);
|
|---|
| 1366 | audioDelayAct->setEnabled(false);
|
|---|
| 1367 | extrastereoAct->setEnabled(false);
|
|---|
| 1368 | karaokeAct->setEnabled(false);
|
|---|
| 1369 | volnormAct->setEnabled(false);
|
|---|
| 1370 | channelsGroup->setActionsEnabled(false);
|
|---|
| 1371 | stereoGroup->setActionsEnabled(false);
|
|---|
| 1372 | }
|
|---|
| 1373 |
|
|---|
| 1374 | // Disable video actions if it's an audio file
|
|---|
| 1375 | if (core->mdat.novideo) {
|
|---|
| 1376 | videoEqualizerAct->setEnabled(false);
|
|---|
| 1377 | screenshotAct->setEnabled(false);
|
|---|
| 1378 | screenshotsAct->setEnabled(false);
|
|---|
| 1379 | flipAct->setEnabled(false);
|
|---|
| 1380 | mirrorAct->setEnabled(false);
|
|---|
| 1381 | postProcessingAct->setEnabled(false);
|
|---|
| 1382 | phaseAct->setEnabled(false);
|
|---|
| 1383 | deblockAct->setEnabled(false);
|
|---|
| 1384 | deringAct->setEnabled(false);
|
|---|
| 1385 | addNoiseAct->setEnabled(false);
|
|---|
| 1386 | addLetterboxAct->setEnabled(false);
|
|---|
| 1387 | upscaleAct->setEnabled(false);
|
|---|
| 1388 | doubleSizeAct->setEnabled(false);
|
|---|
| 1389 |
|
|---|
| 1390 | // Moving and zoom
|
|---|
| 1391 | moveUpAct->setEnabled(false);
|
|---|
| 1392 | moveDownAct->setEnabled(false);
|
|---|
| 1393 | moveLeftAct->setEnabled(false);
|
|---|
| 1394 | moveRightAct->setEnabled(false);
|
|---|
| 1395 | incZoomAct->setEnabled(false);
|
|---|
| 1396 | decZoomAct->setEnabled(false);
|
|---|
| 1397 | resetZoomAct->setEnabled(false);
|
|---|
| 1398 | autoZoomAct->setEnabled(false);
|
|---|
| 1399 | autoZoom169Act->setEnabled(false);
|
|---|
| 1400 | autoZoom235Act->setEnabled(false);
|
|---|
| 1401 |
|
|---|
| 1402 | denoiseGroup->setActionsEnabled(false);
|
|---|
| 1403 | sizeGroup->setActionsEnabled(false);
|
|---|
| 1404 | deinterlaceGroup->setActionsEnabled(false);
|
|---|
| 1405 | aspectGroup->setActionsEnabled(false);
|
|---|
| 1406 | rotateGroup->setActionsEnabled(false);
|
|---|
| 1407 | #if USE_ADAPTER
|
|---|
| 1408 | screenGroup->setActionsEnabled(false);
|
|---|
| 1409 | #endif
|
|---|
| 1410 | }
|
|---|
| 1411 |
|
|---|
| 1412 | #if USE_ADAPTER
|
|---|
| 1413 | screenGroup->setActionsEnabled(pref->vo.startsWith(OVERLAY_VO));
|
|---|
| 1414 | #endif
|
|---|
| 1415 |
|
|---|
| 1416 | #ifndef Q_OS_WIN
|
|---|
| 1417 | // Disable video filters if using vdpau
|
|---|
| 1418 | if ((pref->vdpau.disable_video_filters) && (pref->vo.startsWith("vdpau"))) {
|
|---|
| 1419 | screenshotAct->setEnabled(false);
|
|---|
| 1420 | screenshotsAct->setEnabled(false);
|
|---|
| 1421 | flipAct->setEnabled(false);
|
|---|
| 1422 | mirrorAct->setEnabled(false);
|
|---|
| 1423 | postProcessingAct->setEnabled(false);
|
|---|
| 1424 | phaseAct->setEnabled(false);
|
|---|
| 1425 | deblockAct->setEnabled(false);
|
|---|
| 1426 | deringAct->setEnabled(false);
|
|---|
| 1427 | addNoiseAct->setEnabled(false);
|
|---|
| 1428 | addLetterboxAct->setEnabled(false);
|
|---|
| 1429 | upscaleAct->setEnabled(false);
|
|---|
| 1430 |
|
|---|
| 1431 | deinterlaceGroup->setActionsEnabled(false);
|
|---|
| 1432 | rotateGroup->setActionsEnabled(false);
|
|---|
| 1433 | denoiseGroup->setActionsEnabled(false);
|
|---|
| 1434 |
|
|---|
| 1435 | displayMessage( tr("Video filters are disabled when using vdpau") );
|
|---|
| 1436 | }
|
|---|
| 1437 | #endif
|
|---|
| 1438 |
|
|---|
| 1439 | #if DVDNAV_SUPPORT
|
|---|
| 1440 | if (!core->mdat.filename.startsWith("dvdnav:")) {
|
|---|
| 1441 | dvdnavUpAct->setEnabled(false);
|
|---|
| 1442 | dvdnavDownAct->setEnabled(false);
|
|---|
| 1443 | dvdnavLeftAct->setEnabled(false);
|
|---|
| 1444 | dvdnavRightAct->setEnabled(false);
|
|---|
| 1445 | dvdnavMenuAct->setEnabled(false);
|
|---|
| 1446 | dvdnavSelectAct->setEnabled(false);
|
|---|
| 1447 | dvdnavPrevAct->setEnabled(false);
|
|---|
| 1448 | dvdnavMouseAct->setEnabled(false);
|
|---|
| 1449 | }
|
|---|
| 1450 | #endif
|
|---|
| 1451 | }
|
|---|
| 1452 |
|
|---|
| 1453 | void BaseGui::disableActionsOnStop() {
|
|---|
| 1454 | qDebug("BaseGui::disableActionsOnStop");
|
|---|
| 1455 |
|
|---|
| 1456 | setActionsEnabled(false);
|
|---|
| 1457 |
|
|---|
| 1458 | playAct->setEnabled(true);
|
|---|
| 1459 | playOrPauseAct->setEnabled(true);
|
|---|
| 1460 | stopAct->setEnabled(true);
|
|---|
| 1461 | }
|
|---|
| 1462 |
|
|---|
| 1463 | void BaseGui::togglePlayAction(Core::State state) {
|
|---|
| 1464 | qDebug("BaseGui::togglePlayAction");
|
|---|
| 1465 | if (state == Core::Playing)
|
|---|
| 1466 | playAct->setEnabled(false);
|
|---|
| 1467 | else
|
|---|
| 1468 | playAct->setEnabled(true);
|
|---|
| 1469 | }
|
|---|
| 1470 | #endif // AUTODISABLE_ACTIONS
|
|---|
| 1471 |
|
|---|
| 1472 | void BaseGui::retranslateStrings() {
|
|---|
| 1473 | setWindowIcon( Images::icon("logo", 64) );
|
|---|
| 1474 |
|
|---|
| 1475 | // ACTIONS
|
|---|
| 1476 |
|
|---|
| 1477 | // Menu File
|
|---|
| 1478 | openFileAct->change( Images::icon("open"), tr("&File...") );
|
|---|
| 1479 | openDirectoryAct->change( Images::icon("openfolder"), tr("D&irectory...") );
|
|---|
| 1480 | openPlaylistAct->change( Images::icon("open_playlist"), tr("&Playlist...") );
|
|---|
| 1481 | openVCDAct->change( Images::icon("vcd"), tr("V&CD") );
|
|---|
| 1482 | openAudioCDAct->change( Images::icon("cdda"), tr("&Audio CD") );
|
|---|
| 1483 | openDVDAct->change( Images::icon("dvd"), tr("&DVD from drive") );
|
|---|
| 1484 | openDVDFolderAct->change( Images::icon("dvd_hd"), tr("D&VD from folder...") );
|
|---|
| 1485 | openURLAct->change( Images::icon("url"), tr("&URL...") );
|
|---|
| 1486 | exitAct->change( Images::icon("close"), tr("C&lose") );
|
|---|
| 1487 |
|
|---|
| 1488 | // Favorites
|
|---|
| 1489 | /*
|
|---|
| 1490 | favorites->editAct()->setText( tr("&Edit...") );
|
|---|
| 1491 | favorites->addCurrentAct()->setText( tr("&Add current media") );
|
|---|
| 1492 | */
|
|---|
| 1493 |
|
|---|
| 1494 | // TV & Radio submenus
|
|---|
| 1495 | /*
|
|---|
| 1496 | tvlist->editAct()->setText( tr("&Edit...") );
|
|---|
| 1497 | radiolist->editAct()->setText( tr("&Edit...") );
|
|---|
| 1498 | tvlist->addCurrentAct()->setText( tr("&Add current media") );
|
|---|
| 1499 | radiolist->addCurrentAct()->setText( tr("&Add current media") );
|
|---|
| 1500 | tvlist->jumpAct()->setText( tr("&Jump...") );
|
|---|
| 1501 | radiolist->jumpAct()->setText( tr("&Jump...") );
|
|---|
| 1502 | tvlist->nextAct()->setText( tr("Next TV channel") );
|
|---|
| 1503 | tvlist->previousAct()->setText( tr("Previous TV channel") );
|
|---|
| 1504 | radiolist->nextAct()->setText( tr("Next radio channel") );
|
|---|
| 1505 | radiolist->previousAct()->setText( tr("Previous radio channel") );
|
|---|
| 1506 | */
|
|---|
| 1507 |
|
|---|
| 1508 | // Menu Play
|
|---|
| 1509 | playAct->change( tr("P&lay") );
|
|---|
| 1510 | if (qApp->isLeftToRight())
|
|---|
| 1511 | playAct->setIcon( Images::icon("play") );
|
|---|
| 1512 | else
|
|---|
| 1513 | playAct->setIcon( Images::flippedIcon("play") );
|
|---|
| 1514 |
|
|---|
| 1515 | pauseAct->change( Images::icon("pause"), tr("&Pause"));
|
|---|
| 1516 | stopAct->change( Images::icon("stop"), tr("&Stop") );
|
|---|
| 1517 | frameStepAct->change( Images::icon("frame_step"), tr("&Frame step") );
|
|---|
| 1518 |
|
|---|
| 1519 | playOrPauseAct->change( tr("Play / Pause") );
|
|---|
| 1520 | if (qApp->isLeftToRight())
|
|---|
| 1521 | playOrPauseAct->setIcon( Images::icon("play_pause") );
|
|---|
| 1522 | else
|
|---|
| 1523 | playOrPauseAct->setIcon( Images::flippedIcon("play_pause") );
|
|---|
| 1524 |
|
|---|
| 1525 | pauseAndStepAct->change( Images::icon("pause"), tr("Pause / Frame step") );
|
|---|
| 1526 |
|
|---|
| 1527 | setJumpTexts(); // Texts for rewind*Act and forward*Act
|
|---|
| 1528 |
|
|---|
| 1529 | // Submenu A-B
|
|---|
| 1530 | setAMarkerAct->change( Images::icon("a_marker"), tr("Set &A marker") );
|
|---|
| 1531 | setBMarkerAct->change( Images::icon("b_marker"), tr("Set &B marker") );
|
|---|
| 1532 | clearABMarkersAct->change( Images::icon("clear_markers"), tr("&Clear A-B markers") );
|
|---|
| 1533 | repeatAct->change( Images::icon("repeat"), tr("&Repeat") );
|
|---|
| 1534 |
|
|---|
| 1535 | gotoAct->change( Images::icon("jumpto"), tr("&Jump to...") );
|
|---|
| 1536 |
|
|---|
| 1537 | // Submenu speed
|
|---|
| 1538 | normalSpeedAct->change( tr("&Normal speed") );
|
|---|
| 1539 | halveSpeedAct->change( tr("&Halve speed") );
|
|---|
| 1540 | doubleSpeedAct->change( tr("&Double speed") );
|
|---|
| 1541 | decSpeed10Act->change( tr("Speed &-10%") );
|
|---|
| 1542 | incSpeed10Act->change( tr("Speed &+10%") );
|
|---|
| 1543 | decSpeed4Act->change( tr("Speed -&4%") );
|
|---|
| 1544 | incSpeed4Act->change( tr("&Speed +4%") );
|
|---|
| 1545 | decSpeed1Act->change( tr("Speed -&1%") );
|
|---|
| 1546 | incSpeed1Act->change( tr("S&peed +1%") );
|
|---|
| 1547 |
|
|---|
| 1548 | // Menu Video
|
|---|
| 1549 | fullscreenAct->change( Images::icon("fullscreen"), tr("&Fullscreen") );
|
|---|
| 1550 | compactAct->change( Images::icon("compact"), tr("&Compact mode") );
|
|---|
| 1551 | videoEqualizerAct->change( Images::icon("equalizer"), tr("&Equalizer") );
|
|---|
| 1552 | screenshotAct->change( Images::icon("screenshot"), tr("&Screenshot") );
|
|---|
| 1553 | screenshotsAct->change( Images::icon("screenshots"), tr("Start/stop takin&g screenshots") );
|
|---|
| 1554 | videoPreviewAct->change( Images::icon("video_preview"), tr("Pre&view...") );
|
|---|
| 1555 | flipAct->change( Images::icon("flip"), tr("Fli&p image") );
|
|---|
| 1556 | mirrorAct->change( Images::icon("mirror"), tr("Mirr&or image") );
|
|---|
| 1557 |
|
|---|
| 1558 | decZoomAct->change( tr("Zoom &-") );
|
|---|
| 1559 | incZoomAct->change( tr("Zoom &+") );
|
|---|
| 1560 | resetZoomAct->change( tr("&Reset") );
|
|---|
| 1561 | autoZoomAct->change( tr("&Auto zoom") );
|
|---|
| 1562 | autoZoom169Act->change( tr("Zoom for &16:9") );
|
|---|
| 1563 | autoZoom235Act->change( tr("Zoom for &2.35:1") );
|
|---|
| 1564 | moveLeftAct->change( tr("Move &left") );
|
|---|
| 1565 | moveRightAct->change( tr("Move &right") );
|
|---|
| 1566 | moveUpAct->change( tr("Move &up") );
|
|---|
| 1567 | moveDownAct->change( tr("Move &down") );
|
|---|
| 1568 |
|
|---|
| 1569 | #if USE_MPLAYER_PANSCAN
|
|---|
| 1570 | decPanscanAct->change( "Panscan -" );
|
|---|
| 1571 | incPanscanAct->change( "Panscan +" );
|
|---|
| 1572 | #endif
|
|---|
| 1573 |
|
|---|
| 1574 | // Submenu Filters
|
|---|
| 1575 | postProcessingAct->change( tr("&Postprocessing") );
|
|---|
| 1576 | phaseAct->change( tr("&Autodetect phase") );
|
|---|
| 1577 | deblockAct->change( tr("&Deblock") );
|
|---|
| 1578 | deringAct->change( tr("De&ring") );
|
|---|
| 1579 | addNoiseAct->change( tr("Add n&oise") );
|
|---|
| 1580 | addLetterboxAct->change( Images::icon("letterbox"), tr("Add &black borders") );
|
|---|
| 1581 | upscaleAct->change( Images::icon("upscaling"), tr("Soft&ware scaling") );
|
|---|
| 1582 |
|
|---|
| 1583 | // Menu Audio
|
|---|
| 1584 | audioEqualizerAct->change( Images::icon("audio_equalizer"), tr("E&qualizer") );
|
|---|
| 1585 | QIcon icset( Images::icon("volume") );
|
|---|
| 1586 | icset.addPixmap( Images::icon("mute"), QIcon::Normal, QIcon::On );
|
|---|
| 1587 | muteAct->change( icset, tr("&Mute") );
|
|---|
| 1588 | decVolumeAct->change( Images::icon("audio_down"), tr("Volume &-") );
|
|---|
| 1589 | incVolumeAct->change( Images::icon("audio_up"), tr("Volume &+") );
|
|---|
| 1590 | decAudioDelayAct->change( Images::icon("delay_down"), tr("&Delay -") );
|
|---|
| 1591 | incAudioDelayAct->change( Images::icon("delay_up"), tr("D&elay +") );
|
|---|
| 1592 | audioDelayAct->change( Images::icon("audio_delay"), tr("Set dela&y...") );
|
|---|
| 1593 | loadAudioAct->change( Images::icon("open"), tr("&Load external file...") );
|
|---|
| 1594 | unloadAudioAct->change( Images::icon("unload"), tr("U&nload") );
|
|---|
| 1595 |
|
|---|
| 1596 | // Submenu Filters
|
|---|
| 1597 | extrastereoAct->change( tr("&Extrastereo") );
|
|---|
| 1598 | karaokeAct->change( tr("&Karaoke") );
|
|---|
| 1599 | volnormAct->change( tr("Volume &normalization") );
|
|---|
| 1600 |
|
|---|
| 1601 | // Menu Subtitles
|
|---|
| 1602 | loadSubsAct->change( Images::icon("open"), tr("&Load...") );
|
|---|
| 1603 | unloadSubsAct->change( Images::icon("unload"), tr("U&nload") );
|
|---|
| 1604 | decSubDelayAct->change( Images::icon("delay_down"), tr("Delay &-") );
|
|---|
| 1605 | incSubDelayAct->change( Images::icon("delay_up"), tr("Delay &+") );
|
|---|
| 1606 | subDelayAct->change( Images::icon("sub_delay"), tr("Se&t delay...") );
|
|---|
| 1607 | decSubPosAct->change( Images::icon("sub_up"), tr("&Up") );
|
|---|
| 1608 | incSubPosAct->change( Images::icon("sub_down"), tr("&Down") );
|
|---|
| 1609 | decSubScaleAct->change( Images::icon("dec_sub_scale"), tr("S&ize -") );
|
|---|
| 1610 | incSubScaleAct->change( Images::icon("inc_sub_scale"), tr("Si&ze +") );
|
|---|
| 1611 | decSubStepAct->change( Images::icon("dec_sub_step"),
|
|---|
| 1612 | tr("&Previous line in subtitles") );
|
|---|
| 1613 | incSubStepAct->change( Images::icon("inc_sub_step"),
|
|---|
| 1614 | tr("N&ext line in subtitles") );
|
|---|
| 1615 | useAssAct->change( Images::icon("use_ass_lib"), tr("Use SSA/&ASS library") );
|
|---|
| 1616 | useForcedSubsOnlyAct->change( Images::icon("forced_subs"), tr("&Forced subtitles only") );
|
|---|
| 1617 |
|
|---|
| 1618 | subVisibilityAct->change( Images::icon("sub_visibility"), tr("Subtitle &visibility") );
|
|---|
| 1619 |
|
|---|
| 1620 | showFindSubtitlesDialogAct->change( Images::icon("download_subs"), tr("Find subtitles on &OpenSubtitles.org...") );
|
|---|
| 1621 | openUploadSubtitlesPageAct->change( Images::icon("upload_subs"), tr("Upload su&btitles to OpenSubtitles.org...") );
|
|---|
| 1622 |
|
|---|
| 1623 | ccNoneAct->change( tr("&Off") );
|
|---|
| 1624 | ccChannel1Act->change( "&1" );
|
|---|
| 1625 | ccChannel2Act->change( "&2" );
|
|---|
| 1626 | ccChannel3Act->change( "&3" );
|
|---|
| 1627 | ccChannel4Act->change( "&4" );
|
|---|
| 1628 |
|
|---|
| 1629 | // Menu Options
|
|---|
| 1630 | showPlaylistAct->change( Images::icon("playlist"), tr("&Playlist") );
|
|---|
| 1631 | showPropertiesAct->change( Images::icon("info"), tr("View &info and properties...") );
|
|---|
| 1632 | showPreferencesAct->change( Images::icon("prefs"), tr("P&references") );
|
|---|
| 1633 | showTubeBrowserAct->change( Images::icon("tubebrowser"), tr("&YouTube browser") );
|
|---|
| 1634 |
|
|---|
| 1635 | // Submenu Logs
|
|---|
| 1636 | showLogMplayerAct->change( "MPlayer" );
|
|---|
| 1637 | showLogSmplayerAct->change( "SMPlayer" );
|
|---|
| 1638 |
|
|---|
| 1639 | // Menu Help
|
|---|
| 1640 | showFAQAct->change( Images::icon("faq"), tr("&FAQ") );
|
|---|
| 1641 | showCLOptionsAct->change( Images::icon("cl_help"), tr("&Command line options") );
|
|---|
| 1642 | showCheckUpdatesAct->change( Images::icon("check_updates"), tr("Check for &updates") );
|
|---|
| 1643 | donateAct->change( Images::icon("donate"), tr("&Donate") );
|
|---|
| 1644 | aboutQtAct->change( QPixmap(":/icons-png/qt.png"), tr("About &Qt") );
|
|---|
| 1645 | aboutThisAct->change( Images::icon("logo_small"), tr("About &SMPlayer") );
|
|---|
| 1646 |
|
|---|
| 1647 | // Playlist
|
|---|
| 1648 | playNextAct->change( tr("&Next") );
|
|---|
| 1649 | playPrevAct->change( tr("Pre&vious") );
|
|---|
| 1650 |
|
|---|
| 1651 | if (qApp->isLeftToRight()) {
|
|---|
| 1652 | playNextAct->setIcon( Images::icon("next") );
|
|---|
| 1653 | playPrevAct->setIcon( Images::icon("previous") );
|
|---|
| 1654 | } else {
|
|---|
| 1655 | playNextAct->setIcon( Images::flippedIcon("next") );
|
|---|
| 1656 | playPrevAct->setIcon( Images::flippedIcon("previous") );
|
|---|
| 1657 | }
|
|---|
| 1658 |
|
|---|
| 1659 |
|
|---|
| 1660 | // Actions not in menus or buttons
|
|---|
| 1661 | // Volume 2
|
|---|
| 1662 | #if !USE_MULTIPLE_SHORTCUTS
|
|---|
| 1663 | decVolume2Act->change( tr("Dec volume (2)") );
|
|---|
| 1664 | incVolume2Act->change( tr("Inc volume (2)") );
|
|---|
| 1665 | #endif
|
|---|
| 1666 | // Exit fullscreen
|
|---|
| 1667 | exitFullscreenAct->change( tr("Exit fullscreen") );
|
|---|
| 1668 |
|
|---|
| 1669 | nextOSDAct->change( tr("OSD - Next level") );
|
|---|
| 1670 | decContrastAct->change( tr("Dec contrast") );
|
|---|
| 1671 | incContrastAct->change( tr("Inc contrast") );
|
|---|
| 1672 | decBrightnessAct->change( tr("Dec brightness") );
|
|---|
| 1673 | incBrightnessAct->change( tr("Inc brightness") );
|
|---|
| 1674 | decHueAct->change( tr("Dec hue") );
|
|---|
| 1675 | incHueAct->change( tr("Inc hue") );
|
|---|
| 1676 | decSaturationAct->change( tr("Dec saturation") );
|
|---|
| 1677 | incSaturationAct->change( tr("Inc saturation") );
|
|---|
| 1678 | decGammaAct->change( tr("Dec gamma") );
|
|---|
| 1679 | incGammaAct->change( tr("Inc gamma") );
|
|---|
| 1680 | nextVideoAct->change( tr("Next video") );
|
|---|
| 1681 | nextAudioAct->change( tr("Next audio") );
|
|---|
| 1682 | nextSubtitleAct->change( tr("Next subtitle") );
|
|---|
| 1683 | nextChapterAct->change( tr("Next chapter") );
|
|---|
| 1684 | prevChapterAct->change( tr("Previous chapter") );
|
|---|
| 1685 | doubleSizeAct->change( tr("&Toggle double size") );
|
|---|
| 1686 | resetVideoEqualizerAct->change( tr("Reset video equalizer") );
|
|---|
| 1687 | resetAudioEqualizerAct->change( tr("Reset audio equalizer") );
|
|---|
| 1688 | showContextMenuAct->change( tr("Show context menu") );
|
|---|
| 1689 | nextAspectAct->change( Images::icon("next_aspect"), tr("Next aspect ratio") );
|
|---|
| 1690 | nextWheelFunctionAct->change( Images::icon("next_wheel_function"), tr("Next wheel function") );
|
|---|
| 1691 |
|
|---|
| 1692 | showFilenameAct->change( tr("Show filename on OSD") );
|
|---|
| 1693 | toggleDeinterlaceAct->change( tr("Toggle deinterlacing") );
|
|---|
| 1694 |
|
|---|
| 1695 |
|
|---|
| 1696 | // Action groups
|
|---|
| 1697 | osdNoneAct->change( tr("Subtitles onl&y") );
|
|---|
| 1698 | osdSeekAct->change( tr("Volume + &Seek") );
|
|---|
| 1699 | osdTimerAct->change( tr("Volume + Seek + &Timer") );
|
|---|
| 1700 | osdTotalAct->change( tr("Volume + Seek + Timer + T&otal time") );
|
|---|
| 1701 |
|
|---|
| 1702 |
|
|---|
| 1703 | // MENUS
|
|---|
| 1704 | openMenu->menuAction()->setText( tr("&Open") );
|
|---|
| 1705 | playMenu->menuAction()->setText( tr("&Play") );
|
|---|
| 1706 | videoMenu->menuAction()->setText( tr("&Video") );
|
|---|
| 1707 | audioMenu->menuAction()->setText( tr("&Audio") );
|
|---|
| 1708 | subtitlesMenu->menuAction()->setText( tr("&Subtitles") );
|
|---|
| 1709 | browseMenu->menuAction()->setText( tr("&Browse") );
|
|---|
| 1710 | optionsMenu->menuAction()->setText( tr("Op&tions") );
|
|---|
| 1711 | helpMenu->menuAction()->setText( tr("&Help") );
|
|---|
| 1712 |
|
|---|
| 1713 | /*
|
|---|
| 1714 | openMenuAct->setIcon( Images::icon("open_menu") );
|
|---|
| 1715 | playMenuAct->setIcon( Images::icon("play_menu") );
|
|---|
| 1716 | videoMenuAct->setIcon( Images::icon("video_menu") );
|
|---|
| 1717 | audioMenuAct->setIcon( Images::icon("audio_menu") );
|
|---|
| 1718 | subtitlesMenuAct->setIcon( Images::icon("subtitles_menu") );
|
|---|
| 1719 | browseMenuAct->setIcon( Images::icon("browse_menu") );
|
|---|
| 1720 | optionsMenuAct->setIcon( Images::icon("options_menu") );
|
|---|
| 1721 | helpMenuAct->setIcon( Images::icon("help_menu") );
|
|---|
| 1722 | */
|
|---|
| 1723 |
|
|---|
| 1724 | // Menu Open
|
|---|
| 1725 | recentfiles_menu->menuAction()->setText( tr("&Recent files") );
|
|---|
| 1726 | recentfiles_menu->menuAction()->setIcon( Images::icon("recents") );
|
|---|
| 1727 | clearRecentsAct->change( Images::icon("delete"), tr("&Clear") );
|
|---|
| 1728 |
|
|---|
| 1729 | disc_menu->menuAction()->setText( tr("&Disc") );
|
|---|
| 1730 | disc_menu->menuAction()->setIcon( Images::icon("open_disc") );
|
|---|
| 1731 |
|
|---|
| 1732 | /* favorites->menuAction()->setText( tr("&Favorites") ); */
|
|---|
| 1733 | favorites->menuAction()->setText( tr("F&avorites") );
|
|---|
| 1734 | favorites->menuAction()->setIcon( Images::icon("open_favorites") );
|
|---|
| 1735 |
|
|---|
| 1736 | tvlist->menuAction()->setText( tr("&TV") );
|
|---|
| 1737 | tvlist->menuAction()->setIcon( Images::icon("open_tv") );
|
|---|
| 1738 |
|
|---|
| 1739 | radiolist->menuAction()->setText( tr("Radi&o") );
|
|---|
| 1740 | radiolist->menuAction()->setIcon( Images::icon("open_radio") );
|
|---|
| 1741 |
|
|---|
| 1742 | // Menu Play
|
|---|
| 1743 | speed_menu->menuAction()->setText( tr("Sp&eed") );
|
|---|
| 1744 | speed_menu->menuAction()->setIcon( Images::icon("speed") );
|
|---|
| 1745 |
|
|---|
| 1746 | ab_menu->menuAction()->setText( tr("&A-B section") );
|
|---|
| 1747 | ab_menu->menuAction()->setIcon( Images::icon("ab_menu") );
|
|---|
| 1748 |
|
|---|
| 1749 | // Menu Video
|
|---|
| 1750 | videotrack_menu->menuAction()->setText( tr("&Track", "video") );
|
|---|
| 1751 | videotrack_menu->menuAction()->setIcon( Images::icon("video_track") );
|
|---|
| 1752 |
|
|---|
| 1753 | videosize_menu->menuAction()->setText( tr("Si&ze") );
|
|---|
| 1754 | videosize_menu->menuAction()->setIcon( Images::icon("video_size") );
|
|---|
| 1755 |
|
|---|
| 1756 | /*
|
|---|
| 1757 | panscan_menu->menuAction()->setText( tr("&Pan && scan") );
|
|---|
| 1758 | panscan_menu->menuAction()->setIcon( Images::icon("panscan") );
|
|---|
| 1759 | */
|
|---|
| 1760 | zoom_menu->menuAction()->setText( tr("Zoo&m") );
|
|---|
| 1761 | zoom_menu->menuAction()->setIcon( Images::icon("zoom") );
|
|---|
| 1762 |
|
|---|
| 1763 | aspect_menu->menuAction()->setText( tr("&Aspect ratio") );
|
|---|
| 1764 | aspect_menu->menuAction()->setIcon( Images::icon("aspect") );
|
|---|
| 1765 |
|
|---|
| 1766 | deinterlace_menu->menuAction()->setText( tr("&Deinterlace") );
|
|---|
| 1767 | deinterlace_menu->menuAction()->setIcon( Images::icon("deinterlace") );
|
|---|
| 1768 |
|
|---|
| 1769 | videofilter_menu->menuAction()->setText( tr("F&ilters") );
|
|---|
| 1770 | videofilter_menu->menuAction()->setIcon( Images::icon("video_filters") );
|
|---|
| 1771 |
|
|---|
| 1772 | rotate_menu->menuAction()->setText( tr("&Rotate") );
|
|---|
| 1773 | rotate_menu->menuAction()->setIcon( Images::icon("rotate") );
|
|---|
| 1774 |
|
|---|
| 1775 | ontop_menu->menuAction()->setText( tr("S&tay on top") );
|
|---|
| 1776 | ontop_menu->menuAction()->setIcon( Images::icon("ontop") );
|
|---|
| 1777 |
|
|---|
| 1778 | #if USE_ADAPTER
|
|---|
| 1779 | screen_menu->menuAction()->setText( tr("Scree&n") );
|
|---|
| 1780 | screen_menu->menuAction()->setIcon( Images::icon("screen") );
|
|---|
| 1781 | #endif
|
|---|
| 1782 |
|
|---|
| 1783 | /*
|
|---|
| 1784 | denoise_menu->menuAction()->setText( tr("De&noise") );
|
|---|
| 1785 | denoise_menu->menuAction()->setIcon( Images::icon("denoise") );
|
|---|
| 1786 | */
|
|---|
| 1787 |
|
|---|
| 1788 | aspectDetectAct->change( tr("&Auto") );
|
|---|
| 1789 | aspect11Act->change( "1&:1" );
|
|---|
| 1790 | aspect32Act->change( "&3:2" );
|
|---|
| 1791 | aspect43Act->change( "&4:3" );
|
|---|
| 1792 | aspect54Act->change( "&5:4" );
|
|---|
| 1793 | aspect149Act->change( "&14:9" );
|
|---|
| 1794 | aspect1410Act->change( "1&4:10" );
|
|---|
| 1795 | aspect169Act->change( "16:&9" );
|
|---|
| 1796 | aspect1610Act->change( "1&6:10" );
|
|---|
| 1797 | aspect235Act->change( "&2.35:1" );
|
|---|
| 1798 | aspectNoneAct->change( tr("&Disabled") );
|
|---|
| 1799 |
|
|---|
| 1800 | deinterlaceNoneAct->change( tr("&None") );
|
|---|
| 1801 | deinterlaceL5Act->change( tr("&Lowpass5") );
|
|---|
| 1802 | deinterlaceYadif0Act->change( tr("&Yadif (normal)") );
|
|---|
| 1803 | deinterlaceYadif1Act->change( tr("Y&adif (double framerate)") );
|
|---|
| 1804 | deinterlaceLBAct->change( tr("Linear &Blend") );
|
|---|
| 1805 | deinterlaceKernAct->change( tr("&Kerndeint") );
|
|---|
| 1806 |
|
|---|
| 1807 | denoiseNoneAct->change( tr("Denoise o&ff") );
|
|---|
| 1808 | denoiseNormalAct->change( tr("Denoise nor&mal") );
|
|---|
| 1809 | denoiseSoftAct->change( tr("Denoise &soft") );
|
|---|
| 1810 |
|
|---|
| 1811 | rotateNoneAct->change( tr("&Off") );
|
|---|
| 1812 | rotateClockwiseFlipAct->change( tr("&Rotate by 90 degrees clockwise and flip") );
|
|---|
| 1813 | rotateClockwiseAct->change( tr("Rotate by 90 degrees &clockwise") );
|
|---|
| 1814 | rotateCounterclockwiseAct->change( tr("Rotate by 90 degrees counterclock&wise") );
|
|---|
| 1815 | rotateCounterclockwiseFlipAct->change( tr("Rotate by 90 degrees counterclockwise and &flip") );
|
|---|
| 1816 |
|
|---|
| 1817 | onTopAlwaysAct->change( tr("&Always") );
|
|---|
| 1818 | onTopNeverAct->change( tr("&Never") );
|
|---|
| 1819 | onTopWhilePlayingAct->change( tr("While &playing") );
|
|---|
| 1820 | toggleStayOnTopAct->change( tr("Toggle stay on top") );
|
|---|
| 1821 |
|
|---|
| 1822 | #if USE_ADAPTER
|
|---|
| 1823 | screenDefaultAct->change( tr("&Default") );
|
|---|
| 1824 | #endif
|
|---|
| 1825 |
|
|---|
| 1826 | // Menu Audio
|
|---|
| 1827 | audiotrack_menu->menuAction()->setText( tr("&Track", "audio") );
|
|---|
| 1828 | audiotrack_menu->menuAction()->setIcon( Images::icon("audio_track") );
|
|---|
| 1829 |
|
|---|
| 1830 | audiofilter_menu->menuAction()->setText( tr("&Filters") );
|
|---|
| 1831 | audiofilter_menu->menuAction()->setIcon( Images::icon("audio_filters") );
|
|---|
| 1832 |
|
|---|
| 1833 | audiochannels_menu->menuAction()->setText( tr("&Channels") );
|
|---|
| 1834 | audiochannels_menu->menuAction()->setIcon( Images::icon("audio_channels") );
|
|---|
| 1835 |
|
|---|
| 1836 | stereomode_menu->menuAction()->setText( tr("&Stereo mode") );
|
|---|
| 1837 | stereomode_menu->menuAction()->setIcon( Images::icon("stereo_mode") );
|
|---|
| 1838 |
|
|---|
| 1839 | /* channelsDefaultAct->change( tr("&Default") ); */
|
|---|
| 1840 | channelsStereoAct->change( tr("&Stereo") );
|
|---|
| 1841 | channelsSurroundAct->change( tr("&4.0 Surround") );
|
|---|
| 1842 | channelsFull51Act->change( tr("&5.1 Surround") );
|
|---|
| 1843 |
|
|---|
| 1844 | stereoAct->change( tr("&Stereo") );
|
|---|
| 1845 | leftChannelAct->change( tr("&Left channel") );
|
|---|
| 1846 | rightChannelAct->change( tr("&Right channel") );
|
|---|
| 1847 |
|
|---|
| 1848 | // Menu Subtitle
|
|---|
| 1849 | subtitlestrack_menu->menuAction()->setText( tr("&Select") );
|
|---|
| 1850 | subtitlestrack_menu->menuAction()->setIcon( Images::icon("sub") );
|
|---|
| 1851 |
|
|---|
| 1852 | closed_captions_menu->menuAction()->setText( tr("&Closed captions") );
|
|---|
| 1853 | closed_captions_menu->menuAction()->setIcon( Images::icon("closed_caption") );
|
|---|
| 1854 |
|
|---|
| 1855 | // Menu Browse
|
|---|
| 1856 | titles_menu->menuAction()->setText( tr("&Title") );
|
|---|
| 1857 | titles_menu->menuAction()->setIcon( Images::icon("title") );
|
|---|
| 1858 |
|
|---|
| 1859 | chapters_menu->menuAction()->setText( tr("&Chapter") );
|
|---|
| 1860 | chapters_menu->menuAction()->setIcon( Images::icon("chapter") );
|
|---|
| 1861 |
|
|---|
| 1862 | angles_menu->menuAction()->setText( tr("&Angle") );
|
|---|
| 1863 | angles_menu->menuAction()->setIcon( Images::icon("angle") );
|
|---|
| 1864 |
|
|---|
| 1865 | #if PROGRAM_SWITCH
|
|---|
| 1866 | programtrack_menu->menuAction()->setText( tr("P&rogram", "program") );
|
|---|
| 1867 | programtrack_menu->menuAction()->setIcon( Images::icon("program_track") );
|
|---|
| 1868 | #endif
|
|---|
| 1869 |
|
|---|
| 1870 |
|
|---|
| 1871 | #if DVDNAV_SUPPORT
|
|---|
| 1872 | dvdnavUpAct->change(Images::icon("dvdnav_up"), tr("DVD menu, move up"));
|
|---|
| 1873 | dvdnavDownAct->change(Images::icon("dvdnav_down"), tr("DVD menu, move down"));
|
|---|
| 1874 | dvdnavLeftAct->change(Images::icon("dvdnav_left"), tr("DVD menu, move left"));
|
|---|
| 1875 | dvdnavRightAct->change(Images::icon("dvdnav_right"), tr("DVD menu, move right"));
|
|---|
| 1876 | dvdnavMenuAct->change(Images::icon("dvdnav_menu"), tr("DVD &menu"));
|
|---|
| 1877 | dvdnavSelectAct->change(Images::icon("dvdnav_select"), tr("DVD menu, select option"));
|
|---|
| 1878 | dvdnavPrevAct->change(Images::icon("dvdnav_prev"), tr("DVD &previous menu"));
|
|---|
| 1879 | dvdnavMouseAct->change(Images::icon("dvdnav_mouse"), tr("DVD menu, mouse click"));
|
|---|
| 1880 | #endif
|
|---|
| 1881 |
|
|---|
| 1882 | // Menu Options
|
|---|
| 1883 | osd_menu->menuAction()->setText( tr("&OSD") );
|
|---|
| 1884 | osd_menu->menuAction()->setIcon( Images::icon("osd") );
|
|---|
| 1885 |
|
|---|
| 1886 | logs_menu->menuAction()->setText( tr("&View logs") );
|
|---|
| 1887 | logs_menu->menuAction()->setIcon( Images::icon("logs") );
|
|---|
| 1888 |
|
|---|
| 1889 |
|
|---|
| 1890 | // To be sure that the "<empty>" string is translated
|
|---|
| 1891 | initializeMenus();
|
|---|
| 1892 |
|
|---|
| 1893 | // Other things
|
|---|
| 1894 | mplayer_log_window->setWindowTitle( tr("SMPlayer - mplayer log") );
|
|---|
| 1895 | smplayer_log_window->setWindowTitle( tr("SMPlayer - smplayer log") );
|
|---|
| 1896 |
|
|---|
| 1897 | updateRecents();
|
|---|
| 1898 | updateWidgets();
|
|---|
| 1899 |
|
|---|
| 1900 | // Update actions view in preferences
|
|---|
| 1901 | // It has to be done, here. The actions are translated after the
|
|---|
| 1902 | // preferences dialog.
|
|---|
| 1903 | if (pref_dialog) pref_dialog->mod_input()->actions_editor->updateView();
|
|---|
| 1904 | }
|
|---|
| 1905 |
|
|---|
| 1906 | void BaseGui::setJumpTexts() {
|
|---|
| 1907 | rewind1Act->change( tr("-%1").arg(Helper::timeForJumps(pref->seeking1)) );
|
|---|
| 1908 | rewind2Act->change( tr("-%1").arg(Helper::timeForJumps(pref->seeking2)) );
|
|---|
| 1909 | rewind3Act->change( tr("-%1").arg(Helper::timeForJumps(pref->seeking3)) );
|
|---|
| 1910 |
|
|---|
| 1911 | forward1Act->change( tr("+%1").arg(Helper::timeForJumps(pref->seeking1)) );
|
|---|
| 1912 | forward2Act->change( tr("+%1").arg(Helper::timeForJumps(pref->seeking2)) );
|
|---|
| 1913 | forward3Act->change( tr("+%1").arg(Helper::timeForJumps(pref->seeking3)) );
|
|---|
| 1914 |
|
|---|
| 1915 | if (qApp->isLeftToRight()) {
|
|---|
| 1916 | rewind1Act->setIcon( Images::icon("rewind10s") );
|
|---|
| 1917 | rewind2Act->setIcon( Images::icon("rewind1m") );
|
|---|
| 1918 | rewind3Act->setIcon( Images::icon("rewind10m") );
|
|---|
| 1919 |
|
|---|
| 1920 | forward1Act->setIcon( Images::icon("forward10s") );
|
|---|
| 1921 | forward2Act->setIcon( Images::icon("forward1m") );
|
|---|
| 1922 | forward3Act->setIcon( Images::icon("forward10m") );
|
|---|
| 1923 | } else {
|
|---|
| 1924 | rewind1Act->setIcon( Images::flippedIcon("rewind10s") );
|
|---|
| 1925 | rewind2Act->setIcon( Images::flippedIcon("rewind1m") );
|
|---|
| 1926 | rewind3Act->setIcon( Images::flippedIcon("rewind10m") );
|
|---|
| 1927 |
|
|---|
| 1928 | forward1Act->setIcon( Images::flippedIcon("forward10s") );
|
|---|
| 1929 | forward2Act->setIcon( Images::flippedIcon("forward1m") );
|
|---|
| 1930 | forward3Act->setIcon( Images::flippedIcon("forward10m") );
|
|---|
| 1931 | }
|
|---|
| 1932 | }
|
|---|
| 1933 |
|
|---|
| 1934 | void BaseGui::setWindowCaption(const QString & title) {
|
|---|
| 1935 | setWindowTitle(title);
|
|---|
| 1936 | }
|
|---|
| 1937 |
|
|---|
| 1938 | void BaseGui::createCore() {
|
|---|
| 1939 | core = new Core( mplayerwindow, this );
|
|---|
| 1940 |
|
|---|
| 1941 | connect( core, SIGNAL(menusNeedInitialize()),
|
|---|
| 1942 | this, SLOT(initializeMenus()) );
|
|---|
| 1943 | connect( core, SIGNAL(widgetsNeedUpdate()),
|
|---|
| 1944 | this, SLOT(updateWidgets()) );
|
|---|
| 1945 | connect( core, SIGNAL(videoEqualizerNeedsUpdate()),
|
|---|
| 1946 | this, SLOT(updateVideoEqualizer()) );
|
|---|
| 1947 |
|
|---|
| 1948 | connect( core, SIGNAL(audioEqualizerNeedsUpdate()),
|
|---|
| 1949 | this, SLOT(updateAudioEqualizer()) );
|
|---|
| 1950 |
|
|---|
| 1951 | connect( core, SIGNAL(showFrame(int)),
|
|---|
| 1952 | this, SIGNAL(frameChanged(int)) );
|
|---|
| 1953 |
|
|---|
| 1954 | connect( core, SIGNAL(ABMarkersChanged(int,int)),
|
|---|
| 1955 | this, SIGNAL(ABMarkersChanged(int,int)) );
|
|---|
| 1956 |
|
|---|
| 1957 | connect( core, SIGNAL(showTime(double)),
|
|---|
| 1958 | this, SLOT(gotCurrentTime(double)) );
|
|---|
| 1959 |
|
|---|
| 1960 | connect( core, SIGNAL(needResize(int, int)),
|
|---|
| 1961 | this, SLOT(resizeWindow(int,int)) );
|
|---|
| 1962 | connect( core, SIGNAL(showMessage(QString)),
|
|---|
| 1963 | this, SLOT(displayMessage(QString)) );
|
|---|
| 1964 | connect( core, SIGNAL(stateChanged(Core::State)),
|
|---|
| 1965 | this, SLOT(displayState(Core::State)) );
|
|---|
| 1966 | connect( core, SIGNAL(stateChanged(Core::State)),
|
|---|
| 1967 | this, SLOT(checkStayOnTop(Core::State)), Qt::QueuedConnection );
|
|---|
| 1968 |
|
|---|
| 1969 | connect( core, SIGNAL(mediaStartPlay()),
|
|---|
| 1970 | this, SLOT(enterFullscreenOnPlay()) );
|
|---|
| 1971 | connect( core, SIGNAL(mediaStoppedByUser()),
|
|---|
| 1972 | this, SLOT(exitFullscreenOnStop()) );
|
|---|
| 1973 |
|
|---|
| 1974 | connect( core, SIGNAL(mediaLoaded()),
|
|---|
| 1975 | this, SLOT(enableActionsOnPlaying()) );
|
|---|
| 1976 | #if NOTIFY_AUDIO_CHANGES
|
|---|
| 1977 | connect( core, SIGNAL(audioTracksChanged()),
|
|---|
| 1978 | this, SLOT(enableActionsOnPlaying()) );
|
|---|
| 1979 | #endif
|
|---|
| 1980 | connect( core, SIGNAL(mediaFinished()),
|
|---|
| 1981 | this, SLOT(disableActionsOnStop()) );
|
|---|
| 1982 | connect( core, SIGNAL(mediaStoppedByUser()),
|
|---|
| 1983 | this, SLOT(disableActionsOnStop()) );
|
|---|
| 1984 |
|
|---|
| 1985 | connect( core, SIGNAL(stateChanged(Core::State)),
|
|---|
| 1986 | this, SLOT(togglePlayAction(Core::State)) );
|
|---|
| 1987 |
|
|---|
| 1988 | connect( core, SIGNAL(mediaStartPlay()),
|
|---|
| 1989 | this, SLOT(newMediaLoaded()), Qt::QueuedConnection );
|
|---|
| 1990 | connect( core, SIGNAL(mediaInfoChanged()),
|
|---|
| 1991 | this, SLOT(updateMediaInfo()) );
|
|---|
| 1992 |
|
|---|
| 1993 | connect( core, SIGNAL(mediaStartPlay()),
|
|---|
| 1994 | this, SLOT(checkPendingActionsToRun()), Qt::QueuedConnection );
|
|---|
| 1995 | #if REPORT_OLD_MPLAYER
|
|---|
| 1996 | connect( core, SIGNAL(mediaStartPlay()),
|
|---|
| 1997 | this, SLOT(checkMplayerVersion()), Qt::QueuedConnection );
|
|---|
| 1998 | #endif
|
|---|
| 1999 | connect( core, SIGNAL(failedToParseMplayerVersion(QString)),
|
|---|
| 2000 | this, SLOT(askForMplayerVersion(QString)) );
|
|---|
| 2001 |
|
|---|
| 2002 | connect( core, SIGNAL(mplayerFailed(QProcess::ProcessError)),
|
|---|
| 2003 | this, SLOT(showErrorFromMplayer(QProcess::ProcessError)) );
|
|---|
| 2004 |
|
|---|
| 2005 | connect( core, SIGNAL(mplayerFinishedWithError(int)),
|
|---|
| 2006 | this, SLOT(showExitCodeFromMplayer(int)) );
|
|---|
| 2007 |
|
|---|
| 2008 | // Hide mplayer window
|
|---|
| 2009 | #if ALLOW_TO_HIDE_VIDEO_WINDOW_ON_AUDIO_FILES
|
|---|
| 2010 | if (pref->hide_video_window_on_audio_files) {
|
|---|
| 2011 | connect( core, SIGNAL(noVideo()), this, SLOT(hidePanel()) );
|
|---|
| 2012 | } else {
|
|---|
| 2013 | connect( core, SIGNAL(noVideo()), mplayerwindow, SLOT(showLogo()) );
|
|---|
| 2014 | }
|
|---|
| 2015 | #else
|
|---|
| 2016 | connect( core, SIGNAL(noVideo()), this, SLOT(hidePanel()) );
|
|---|
| 2017 | #endif
|
|---|
| 2018 |
|
|---|
| 2019 | // Log mplayer output
|
|---|
| 2020 | connect( core, SIGNAL(aboutToStartPlaying()),
|
|---|
| 2021 | this, SLOT(clearMplayerLog()) );
|
|---|
| 2022 | connect( core, SIGNAL(logLineAvailable(QString)),
|
|---|
| 2023 | this, SLOT(recordMplayerLog(QString)) );
|
|---|
| 2024 |
|
|---|
| 2025 | connect( core, SIGNAL(mediaLoaded()),
|
|---|
| 2026 | this, SLOT(autosaveMplayerLog()) );
|
|---|
| 2027 | }
|
|---|
| 2028 |
|
|---|
| 2029 | void BaseGui::createMplayerWindow() {
|
|---|
| 2030 | mplayerwindow = new MplayerWindow( panel );
|
|---|
| 2031 | mplayerwindow->setObjectName("mplayerwindow");
|
|---|
| 2032 | #if USE_COLORKEY
|
|---|
| 2033 | mplayerwindow->setColorKey( pref->color_key );
|
|---|
| 2034 | #endif
|
|---|
| 2035 | mplayerwindow->allowVideoMovement( pref->allow_video_movement );
|
|---|
| 2036 |
|
|---|
| 2037 | QHBoxLayout * layout = new QHBoxLayout;
|
|---|
| 2038 | layout->setSpacing(0);
|
|---|
| 2039 | layout->setMargin(0);
|
|---|
| 2040 | layout->addWidget(mplayerwindow);
|
|---|
| 2041 | panel->setLayout(layout);
|
|---|
| 2042 |
|
|---|
| 2043 | // mplayerwindow
|
|---|
| 2044 | /*
|
|---|
| 2045 | connect( mplayerwindow, SIGNAL(rightButtonReleased(QPoint)),
|
|---|
| 2046 | this, SLOT(showPopupMenu(QPoint)) );
|
|---|
| 2047 | */
|
|---|
| 2048 |
|
|---|
| 2049 | // mplayerwindow mouse events
|
|---|
| 2050 | connect( mplayerwindow, SIGNAL(doubleClicked()),
|
|---|
| 2051 | this, SLOT(doubleClickFunction()) );
|
|---|
| 2052 | connect( mplayerwindow, SIGNAL(leftClicked()),
|
|---|
| 2053 | this, SLOT(leftClickFunction()) );
|
|---|
| 2054 | connect( mplayerwindow, SIGNAL(rightClicked()),
|
|---|
| 2055 | this, SLOT(rightClickFunction()) );
|
|---|
| 2056 | connect( mplayerwindow, SIGNAL(middleClicked()),
|
|---|
| 2057 | this, SLOT(middleClickFunction()) );
|
|---|
| 2058 | connect( mplayerwindow, SIGNAL(xbutton1Clicked()),
|
|---|
| 2059 | this, SLOT(xbutton1ClickFunction()) );
|
|---|
| 2060 | connect( mplayerwindow, SIGNAL(xbutton2Clicked()),
|
|---|
| 2061 | this, SLOT(xbutton2ClickFunction()) );
|
|---|
| 2062 | connect( mplayerwindow, SIGNAL(mouseMoved(QPoint)),
|
|---|
| 2063 | this, SLOT(checkMousePos(QPoint)) );
|
|---|
| 2064 | }
|
|---|
| 2065 |
|
|---|
| 2066 | void BaseGui::createVideoEqualizer() {
|
|---|
| 2067 | // Equalizer
|
|---|
| 2068 | video_equalizer = new VideoEqualizer(this);
|
|---|
| 2069 |
|
|---|
| 2070 | connect( video_equalizer->contrast, SIGNAL(valueChanged(int)),
|
|---|
| 2071 | core, SLOT(setContrast(int)) );
|
|---|
| 2072 | connect( video_equalizer->brightness, SIGNAL(valueChanged(int)),
|
|---|
| 2073 | core, SLOT(setBrightness(int)) );
|
|---|
| 2074 | connect( video_equalizer->hue, SIGNAL(valueChanged(int)),
|
|---|
| 2075 | core, SLOT(setHue(int)) );
|
|---|
| 2076 | connect( video_equalizer->saturation, SIGNAL(valueChanged(int)),
|
|---|
| 2077 | core, SLOT(setSaturation(int)) );
|
|---|
| 2078 | connect( video_equalizer->gamma, SIGNAL(valueChanged(int)),
|
|---|
| 2079 | core, SLOT(setGamma(int)) );
|
|---|
| 2080 | connect( video_equalizer, SIGNAL(visibilityChanged()),
|
|---|
| 2081 | this, SLOT(updateWidgets()) );
|
|---|
| 2082 | }
|
|---|
| 2083 |
|
|---|
| 2084 | void BaseGui::createAudioEqualizer() {
|
|---|
| 2085 | // Audio Equalizer
|
|---|
| 2086 | audio_equalizer = new AudioEqualizer(this);
|
|---|
| 2087 |
|
|---|
| 2088 | connect( audio_equalizer->eq[0], SIGNAL(valueChanged(int)),
|
|---|
| 2089 | core, SLOT(setAudioEq0(int)) );
|
|---|
| 2090 | connect( audio_equalizer->eq[1], SIGNAL(valueChanged(int)),
|
|---|
| 2091 | core, SLOT(setAudioEq1(int)) );
|
|---|
| 2092 | connect( audio_equalizer->eq[2], SIGNAL(valueChanged(int)),
|
|---|
| 2093 | core, SLOT(setAudioEq2(int)) );
|
|---|
| 2094 | connect( audio_equalizer->eq[3], SIGNAL(valueChanged(int)),
|
|---|
| 2095 | core, SLOT(setAudioEq3(int)) );
|
|---|
| 2096 | connect( audio_equalizer->eq[4], SIGNAL(valueChanged(int)),
|
|---|
| 2097 | core, SLOT(setAudioEq4(int)) );
|
|---|
| 2098 | connect( audio_equalizer->eq[5], SIGNAL(valueChanged(int)),
|
|---|
| 2099 | core, SLOT(setAudioEq5(int)) );
|
|---|
| 2100 | connect( audio_equalizer->eq[6], SIGNAL(valueChanged(int)),
|
|---|
| 2101 | core, SLOT(setAudioEq6(int)) );
|
|---|
| 2102 | connect( audio_equalizer->eq[7], SIGNAL(valueChanged(int)),
|
|---|
| 2103 | core, SLOT(setAudioEq7(int)) );
|
|---|
| 2104 | connect( audio_equalizer->eq[8], SIGNAL(valueChanged(int)),
|
|---|
| 2105 | core, SLOT(setAudioEq8(int)) );
|
|---|
| 2106 | connect( audio_equalizer->eq[9], SIGNAL(valueChanged(int)),
|
|---|
| 2107 | core, SLOT(setAudioEq9(int)) );
|
|---|
| 2108 |
|
|---|
| 2109 | connect( audio_equalizer, SIGNAL(applyClicked(AudioEqualizerList)),
|
|---|
| 2110 | core, SLOT(setAudioAudioEqualizerRestart(AudioEqualizerList)) );
|
|---|
| 2111 |
|
|---|
| 2112 | connect( audio_equalizer, SIGNAL(visibilityChanged()),
|
|---|
| 2113 | this, SLOT(updateWidgets()) );
|
|---|
| 2114 | }
|
|---|
| 2115 |
|
|---|
| 2116 | void BaseGui::createPlaylist() {
|
|---|
| 2117 | #if DOCK_PLAYLIST
|
|---|
| 2118 | playlist = new Playlist(core, this, 0);
|
|---|
| 2119 | #else
|
|---|
| 2120 | //playlist = new Playlist(core, this, "playlist");
|
|---|
| 2121 | playlist = new Playlist(core, 0);
|
|---|
| 2122 | #endif
|
|---|
| 2123 |
|
|---|
| 2124 | /*
|
|---|
| 2125 | connect( playlist, SIGNAL(playlistEnded()),
|
|---|
| 2126 | this, SLOT(exitFullscreenOnStop()) );
|
|---|
| 2127 | */
|
|---|
| 2128 | connect( playlist, SIGNAL(playlistEnded()),
|
|---|
| 2129 | this, SLOT(playlistHasFinished()) );
|
|---|
| 2130 | /*
|
|---|
| 2131 | connect( playlist, SIGNAL(visibilityChanged()),
|
|---|
| 2132 | this, SLOT(playlistVisibilityChanged()) );
|
|---|
| 2133 | */
|
|---|
| 2134 |
|
|---|
| 2135 | }
|
|---|
| 2136 |
|
|---|
| 2137 | void BaseGui::createPanel() {
|
|---|
| 2138 | panel = new QWidget( this );
|
|---|
| 2139 | panel->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding );
|
|---|
| 2140 | panel->setMinimumSize( QSize(1,1) );
|
|---|
| 2141 | panel->setFocusPolicy( Qt::StrongFocus );
|
|---|
| 2142 |
|
|---|
| 2143 | // panel
|
|---|
| 2144 | panel->setAutoFillBackground(TRUE);
|
|---|
| 2145 | ColorUtils::setBackgroundColor( panel, QColor(0,0,0) );
|
|---|
| 2146 | }
|
|---|
| 2147 |
|
|---|
| 2148 | void BaseGui::createPreferencesDialog() {
|
|---|
| 2149 | pref_dialog = new PreferencesDialog(this);
|
|---|
| 2150 | pref_dialog->setModal(false);
|
|---|
| 2151 | /* pref_dialog->mod_input()->setActionsList( actions_list ); */
|
|---|
| 2152 | connect( pref_dialog, SIGNAL(applied()),
|
|---|
| 2153 | this, SLOT(applyNewPreferences()) );
|
|---|
| 2154 | }
|
|---|
| 2155 |
|
|---|
| 2156 | void BaseGui::createFilePropertiesDialog() {
|
|---|
| 2157 | file_dialog = new FilePropertiesDialog(this);
|
|---|
| 2158 | file_dialog->setModal(false);
|
|---|
| 2159 | connect( file_dialog, SIGNAL(applied()),
|
|---|
| 2160 | this, SLOT(applyFileProperties()) );
|
|---|
| 2161 | }
|
|---|
| 2162 |
|
|---|
| 2163 |
|
|---|
| 2164 | void BaseGui::createMenus() {
|
|---|
| 2165 | // MENUS
|
|---|
| 2166 | openMenu = menuBar()->addMenu("Open");
|
|---|
| 2167 | playMenu = menuBar()->addMenu("Play");
|
|---|
| 2168 | videoMenu = menuBar()->addMenu("Video");
|
|---|
| 2169 | audioMenu = menuBar()->addMenu("Audio");
|
|---|
| 2170 | subtitlesMenu = menuBar()->addMenu("Subtitles");
|
|---|
| 2171 | /* menuBar()->addMenu(favorites); */
|
|---|
| 2172 | browseMenu = menuBar()->addMenu("Browse");
|
|---|
| 2173 | optionsMenu = menuBar()->addMenu("Options");
|
|---|
| 2174 | helpMenu = menuBar()->addMenu("Help");
|
|---|
| 2175 |
|
|---|
| 2176 | // OPEN MENU
|
|---|
| 2177 | openMenu->addAction(openFileAct);
|
|---|
| 2178 |
|
|---|
| 2179 | recentfiles_menu = new QMenu(this);
|
|---|
| 2180 | recentfiles_menu->addAction( clearRecentsAct );
|
|---|
| 2181 | recentfiles_menu->addSeparator();
|
|---|
| 2182 |
|
|---|
| 2183 | openMenu->addMenu( recentfiles_menu );
|
|---|
| 2184 | openMenu->addMenu(favorites);
|
|---|
| 2185 | openMenu->addAction(openDirectoryAct);
|
|---|
| 2186 | openMenu->addAction(openPlaylistAct);
|
|---|
| 2187 |
|
|---|
| 2188 | // Disc submenu
|
|---|
| 2189 | disc_menu = new QMenu(this);
|
|---|
| 2190 | disc_menu->menuAction()->setObjectName("disc_menu");
|
|---|
| 2191 | disc_menu->addAction(openDVDAct);
|
|---|
| 2192 | disc_menu->addAction(openDVDFolderAct);
|
|---|
| 2193 | disc_menu->addAction(openVCDAct);
|
|---|
| 2194 | disc_menu->addAction(openAudioCDAct);
|
|---|
| 2195 |
|
|---|
| 2196 | openMenu->addMenu(disc_menu);
|
|---|
| 2197 |
|
|---|
| 2198 | openMenu->addAction(openURLAct);
|
|---|
| 2199 | /* #ifndef Q_OS_WIN */
|
|---|
| 2200 | openMenu->addMenu(tvlist);
|
|---|
| 2201 | openMenu->addMenu(radiolist);
|
|---|
| 2202 | /* #endif */
|
|---|
| 2203 | openMenu->addSeparator();
|
|---|
| 2204 | openMenu->addAction(exitAct);
|
|---|
| 2205 |
|
|---|
| 2206 | // PLAY MENU
|
|---|
| 2207 | playMenu->addAction(playAct);
|
|---|
| 2208 | playMenu->addAction(pauseAct);
|
|---|
| 2209 | /* playMenu->addAction(playOrPauseAct); */
|
|---|
| 2210 | playMenu->addAction(stopAct);
|
|---|
| 2211 | playMenu->addAction(frameStepAct);
|
|---|
| 2212 | playMenu->addSeparator();
|
|---|
| 2213 | playMenu->addAction(rewind1Act);
|
|---|
| 2214 | playMenu->addAction(forward1Act);
|
|---|
| 2215 | playMenu->addAction(rewind2Act);
|
|---|
| 2216 | playMenu->addAction(forward2Act);
|
|---|
| 2217 | playMenu->addAction(rewind3Act);
|
|---|
| 2218 | playMenu->addAction(forward3Act);
|
|---|
| 2219 | playMenu->addSeparator();
|
|---|
| 2220 |
|
|---|
| 2221 | // Speed submenu
|
|---|
| 2222 | speed_menu = new QMenu(this);
|
|---|
| 2223 | speed_menu->menuAction()->setObjectName("speed_menu");
|
|---|
| 2224 | speed_menu->addAction(normalSpeedAct);
|
|---|
| 2225 | speed_menu->addSeparator();
|
|---|
| 2226 | speed_menu->addAction(halveSpeedAct);
|
|---|
| 2227 | speed_menu->addAction(doubleSpeedAct);
|
|---|
| 2228 | speed_menu->addSeparator();
|
|---|
| 2229 | speed_menu->addAction(decSpeed10Act);
|
|---|
| 2230 | speed_menu->addAction(incSpeed10Act);
|
|---|
| 2231 | speed_menu->addSeparator();
|
|---|
| 2232 | speed_menu->addAction(decSpeed4Act);
|
|---|
| 2233 | speed_menu->addAction(incSpeed4Act);
|
|---|
| 2234 | speed_menu->addSeparator();
|
|---|
| 2235 | speed_menu->addAction(decSpeed1Act);
|
|---|
| 2236 | speed_menu->addAction(incSpeed1Act);
|
|---|
| 2237 |
|
|---|
| 2238 | playMenu->addMenu(speed_menu);
|
|---|
| 2239 |
|
|---|
| 2240 | // A-B submenu
|
|---|
| 2241 | ab_menu = new QMenu(this);
|
|---|
| 2242 | ab_menu->menuAction()->setObjectName("ab_menu");
|
|---|
| 2243 | ab_menu->addAction(setAMarkerAct);
|
|---|
| 2244 | ab_menu->addAction(setBMarkerAct);
|
|---|
| 2245 | ab_menu->addAction(clearABMarkersAct);
|
|---|
| 2246 | ab_menu->addSeparator();
|
|---|
| 2247 | ab_menu->addAction(repeatAct);
|
|---|
| 2248 |
|
|---|
| 2249 | playMenu->addSeparator();
|
|---|
| 2250 | playMenu->addMenu(ab_menu);
|
|---|
| 2251 |
|
|---|
| 2252 | playMenu->addSeparator();
|
|---|
| 2253 | playMenu->addAction(gotoAct);
|
|---|
| 2254 | playMenu->addSeparator();
|
|---|
| 2255 | playMenu->addAction(playPrevAct);
|
|---|
| 2256 | playMenu->addAction(playNextAct);
|
|---|
| 2257 |
|
|---|
| 2258 | // VIDEO MENU
|
|---|
| 2259 | videotrack_menu = new QMenu(this);
|
|---|
| 2260 | videotrack_menu->menuAction()->setObjectName("videotrack_menu");
|
|---|
| 2261 |
|
|---|
| 2262 | videoMenu->addMenu(videotrack_menu);
|
|---|
| 2263 |
|
|---|
| 2264 | videoMenu->addAction(fullscreenAct);
|
|---|
| 2265 | videoMenu->addAction(compactAct);
|
|---|
| 2266 |
|
|---|
| 2267 | #if USE_ADAPTER
|
|---|
| 2268 | // Screen submenu
|
|---|
| 2269 | screen_menu = new QMenu(this);
|
|---|
| 2270 | screen_menu->menuAction()->setObjectName("screen_menu");
|
|---|
| 2271 | screen_menu->addActions( screenGroup->actions() );
|
|---|
| 2272 | videoMenu->addMenu(screen_menu);
|
|---|
| 2273 | #endif
|
|---|
| 2274 |
|
|---|
| 2275 | // Size submenu
|
|---|
| 2276 | videosize_menu = new QMenu(this);
|
|---|
| 2277 | videosize_menu->menuAction()->setObjectName("videosize_menu");
|
|---|
| 2278 | videosize_menu->addActions( sizeGroup->actions() );
|
|---|
| 2279 | videosize_menu->addSeparator();
|
|---|
| 2280 | videosize_menu->addAction(doubleSizeAct);
|
|---|
| 2281 | videoMenu->addMenu(videosize_menu);
|
|---|
| 2282 |
|
|---|
| 2283 | // Zoom submenu
|
|---|
| 2284 | zoom_menu = new QMenu(this);
|
|---|
| 2285 | zoom_menu->menuAction()->setObjectName("zoom_menu");
|
|---|
| 2286 | zoom_menu->addAction(resetZoomAct);
|
|---|
| 2287 | zoom_menu->addSeparator();
|
|---|
| 2288 | zoom_menu->addAction(autoZoomAct);
|
|---|
| 2289 | zoom_menu->addAction(autoZoom169Act);
|
|---|
| 2290 | zoom_menu->addAction(autoZoom235Act);
|
|---|
| 2291 | zoom_menu->addSeparator();
|
|---|
| 2292 | zoom_menu->addAction(decZoomAct);
|
|---|
| 2293 | zoom_menu->addAction(incZoomAct);
|
|---|
| 2294 | zoom_menu->addSeparator();
|
|---|
| 2295 | zoom_menu->addAction(moveLeftAct);
|
|---|
| 2296 | zoom_menu->addAction(moveRightAct);
|
|---|
| 2297 | zoom_menu->addAction(moveUpAct);
|
|---|
| 2298 | zoom_menu->addAction(moveDownAct);
|
|---|
| 2299 |
|
|---|
| 2300 | videoMenu->addMenu(zoom_menu);
|
|---|
| 2301 |
|
|---|
| 2302 | // Aspect submenu
|
|---|
| 2303 | aspect_menu = new QMenu(this);
|
|---|
| 2304 | aspect_menu->menuAction()->setObjectName("aspect_menu");
|
|---|
| 2305 | aspect_menu->addActions( aspectGroup->actions() );
|
|---|
| 2306 |
|
|---|
| 2307 | videoMenu->addMenu(aspect_menu);
|
|---|
| 2308 |
|
|---|
| 2309 | // Deinterlace submenu
|
|---|
| 2310 | deinterlace_menu = new QMenu(this);
|
|---|
| 2311 | deinterlace_menu->menuAction()->setObjectName("deinterlace_menu");
|
|---|
| 2312 | deinterlace_menu->addActions( deinterlaceGroup->actions() );
|
|---|
| 2313 |
|
|---|
| 2314 | videoMenu->addMenu(deinterlace_menu);
|
|---|
| 2315 |
|
|---|
| 2316 | // Video filter submenu
|
|---|
| 2317 | videofilter_menu = new QMenu(this);
|
|---|
| 2318 | videofilter_menu->menuAction()->setObjectName("videofilter_menu");
|
|---|
| 2319 | videofilter_menu->addAction(postProcessingAct);
|
|---|
| 2320 | videofilter_menu->addAction(phaseAct);
|
|---|
| 2321 | videofilter_menu->addAction(deblockAct);
|
|---|
| 2322 | videofilter_menu->addAction(deringAct);
|
|---|
| 2323 | videofilter_menu->addAction(addNoiseAct);
|
|---|
| 2324 | videofilter_menu->addAction(addLetterboxAct);
|
|---|
| 2325 | videofilter_menu->addAction(upscaleAct);
|
|---|
| 2326 | videofilter_menu->addSeparator();
|
|---|
| 2327 | videofilter_menu->addActions(denoiseGroup->actions());
|
|---|
| 2328 |
|
|---|
| 2329 | videoMenu->addMenu(videofilter_menu);
|
|---|
| 2330 |
|
|---|
| 2331 | // Denoise submenu
|
|---|
| 2332 | /*
|
|---|
| 2333 | denoise_menu = new QMenu(this);
|
|---|
| 2334 | denoise_menu->addActions(denoiseGroup->actions());
|
|---|
| 2335 | videoMenu->addMenu(denoise_menu);
|
|---|
| 2336 | */
|
|---|
| 2337 |
|
|---|
| 2338 | // Rotate submenu
|
|---|
| 2339 | rotate_menu = new QMenu(this);
|
|---|
| 2340 | rotate_menu->menuAction()->setObjectName("rotate_menu");
|
|---|
| 2341 | rotate_menu->addActions(rotateGroup->actions());
|
|---|
| 2342 |
|
|---|
| 2343 | videoMenu->addMenu(rotate_menu);
|
|---|
| 2344 |
|
|---|
| 2345 | videoMenu->addAction(flipAct);
|
|---|
| 2346 | videoMenu->addAction(mirrorAct);
|
|---|
| 2347 | videoMenu->addSeparator();
|
|---|
| 2348 | videoMenu->addAction(videoEqualizerAct);
|
|---|
| 2349 | videoMenu->addAction(screenshotAct);
|
|---|
| 2350 | videoMenu->addAction(screenshotsAct);
|
|---|
| 2351 |
|
|---|
| 2352 | // Ontop submenu
|
|---|
| 2353 | ontop_menu = new QMenu(this);
|
|---|
| 2354 | ontop_menu->menuAction()->setObjectName("ontop_menu");
|
|---|
| 2355 | ontop_menu->addActions(onTopActionGroup->actions());
|
|---|
| 2356 |
|
|---|
| 2357 | videoMenu->addMenu(ontop_menu);
|
|---|
| 2358 |
|
|---|
| 2359 | videoMenu->addSeparator();
|
|---|
| 2360 | videoMenu->addAction(videoPreviewAct);
|
|---|
| 2361 |
|
|---|
| 2362 |
|
|---|
| 2363 | // AUDIO MENU
|
|---|
| 2364 |
|
|---|
| 2365 | // Audio track submenu
|
|---|
| 2366 | audiotrack_menu = new QMenu(this);
|
|---|
| 2367 | audiotrack_menu->menuAction()->setObjectName("audiotrack_menu");
|
|---|
| 2368 |
|
|---|
| 2369 | audioMenu->addMenu(audiotrack_menu);
|
|---|
| 2370 |
|
|---|
| 2371 | audioMenu->addAction(loadAudioAct);
|
|---|
| 2372 | audioMenu->addAction(unloadAudioAct);
|
|---|
| 2373 |
|
|---|
| 2374 | // Filter submenu
|
|---|
| 2375 | audiofilter_menu = new QMenu(this);
|
|---|
| 2376 | audiofilter_menu->menuAction()->setObjectName("audiofilter_menu");
|
|---|
| 2377 | audiofilter_menu->addAction(extrastereoAct);
|
|---|
| 2378 | audiofilter_menu->addAction(karaokeAct);
|
|---|
| 2379 | audiofilter_menu->addAction(volnormAct);
|
|---|
| 2380 |
|
|---|
| 2381 | audioMenu->addMenu(audiofilter_menu);
|
|---|
| 2382 |
|
|---|
| 2383 | // Audio channels submenu
|
|---|
| 2384 | audiochannels_menu = new QMenu(this);
|
|---|
| 2385 | audiochannels_menu->menuAction()->setObjectName("audiochannels_menu");
|
|---|
| 2386 | audiochannels_menu->addActions( channelsGroup->actions() );
|
|---|
| 2387 |
|
|---|
| 2388 | audioMenu->addMenu(audiochannels_menu);
|
|---|
| 2389 |
|
|---|
| 2390 | // Stereo mode submenu
|
|---|
| 2391 | stereomode_menu = new QMenu(this);
|
|---|
| 2392 | stereomode_menu->menuAction()->setObjectName("stereomode_menu");
|
|---|
| 2393 | stereomode_menu->addActions( stereoGroup->actions() );
|
|---|
| 2394 |
|
|---|
| 2395 | audioMenu->addMenu(stereomode_menu);
|
|---|
| 2396 | audioMenu->addAction(audioEqualizerAct);
|
|---|
| 2397 | audioMenu->addSeparator();
|
|---|
| 2398 | audioMenu->addAction(muteAct);
|
|---|
| 2399 | audioMenu->addSeparator();
|
|---|
| 2400 | audioMenu->addAction(decVolumeAct);
|
|---|
| 2401 | audioMenu->addAction(incVolumeAct);
|
|---|
| 2402 | audioMenu->addSeparator();
|
|---|
| 2403 | audioMenu->addAction(decAudioDelayAct);
|
|---|
| 2404 | audioMenu->addAction(incAudioDelayAct);
|
|---|
| 2405 | audioMenu->addSeparator();
|
|---|
| 2406 | audioMenu->addAction(audioDelayAct);
|
|---|
| 2407 |
|
|---|
| 2408 |
|
|---|
| 2409 | // SUBTITLES MENU
|
|---|
| 2410 | // Track submenu
|
|---|
| 2411 | subtitlestrack_menu = new QMenu(this);
|
|---|
| 2412 | subtitlestrack_menu->menuAction()->setObjectName("subtitlestrack_menu");
|
|---|
| 2413 |
|
|---|
| 2414 | subtitlesMenu->addMenu(subtitlestrack_menu);
|
|---|
| 2415 |
|
|---|
| 2416 | subtitlesMenu->addAction(loadSubsAct);
|
|---|
| 2417 | subtitlesMenu->addAction(unloadSubsAct);
|
|---|
| 2418 | subtitlesMenu->addSeparator();
|
|---|
| 2419 |
|
|---|
| 2420 | closed_captions_menu = new QMenu(this);
|
|---|
| 2421 | closed_captions_menu->menuAction()->setObjectName("closed_captions_menu");
|
|---|
| 2422 | closed_captions_menu->addAction( ccNoneAct);
|
|---|
| 2423 | closed_captions_menu->addAction( ccChannel1Act);
|
|---|
| 2424 | closed_captions_menu->addAction( ccChannel2Act);
|
|---|
| 2425 | closed_captions_menu->addAction( ccChannel3Act);
|
|---|
| 2426 | closed_captions_menu->addAction( ccChannel4Act);
|
|---|
| 2427 | subtitlesMenu->addMenu(closed_captions_menu);
|
|---|
| 2428 | subtitlesMenu->addSeparator();
|
|---|
| 2429 |
|
|---|
| 2430 | subtitlesMenu->addAction(decSubDelayAct);
|
|---|
| 2431 | subtitlesMenu->addAction(incSubDelayAct);
|
|---|
| 2432 | subtitlesMenu->addSeparator();
|
|---|
| 2433 | subtitlesMenu->addAction(subDelayAct);
|
|---|
| 2434 | subtitlesMenu->addSeparator();
|
|---|
| 2435 | subtitlesMenu->addAction(decSubPosAct);
|
|---|
| 2436 | subtitlesMenu->addAction(incSubPosAct);
|
|---|
| 2437 | subtitlesMenu->addSeparator();
|
|---|
| 2438 | subtitlesMenu->addAction(decSubScaleAct);
|
|---|
| 2439 | subtitlesMenu->addAction(incSubScaleAct);
|
|---|
| 2440 | subtitlesMenu->addSeparator();
|
|---|
| 2441 | subtitlesMenu->addAction(decSubStepAct);
|
|---|
| 2442 | subtitlesMenu->addAction(incSubStepAct);
|
|---|
| 2443 | subtitlesMenu->addSeparator();
|
|---|
| 2444 | subtitlesMenu->addAction(useForcedSubsOnlyAct);
|
|---|
| 2445 | subtitlesMenu->addSeparator();
|
|---|
| 2446 | subtitlesMenu->addAction(subVisibilityAct);
|
|---|
| 2447 | subtitlesMenu->addSeparator();
|
|---|
| 2448 | subtitlesMenu->addAction(useAssAct);
|
|---|
| 2449 | subtitlesMenu->addSeparator(); //turbos
|
|---|
| 2450 | subtitlesMenu->addAction(showFindSubtitlesDialogAct);
|
|---|
| 2451 | subtitlesMenu->addAction(openUploadSubtitlesPageAct); //turbos
|
|---|
| 2452 |
|
|---|
| 2453 | // BROWSE MENU
|
|---|
| 2454 | // Titles submenu
|
|---|
| 2455 | titles_menu = new QMenu(this);
|
|---|
| 2456 | titles_menu->menuAction()->setObjectName("titles_menu");
|
|---|
| 2457 |
|
|---|
| 2458 | browseMenu->addMenu(titles_menu);
|
|---|
| 2459 |
|
|---|
| 2460 | // Chapters submenu
|
|---|
| 2461 | chapters_menu = new QMenu(this);
|
|---|
| 2462 | chapters_menu->menuAction()->setObjectName("chapters_menu");
|
|---|
| 2463 |
|
|---|
| 2464 | browseMenu->addMenu(chapters_menu);
|
|---|
| 2465 |
|
|---|
| 2466 | // Angles submenu
|
|---|
| 2467 | angles_menu = new QMenu(this);
|
|---|
| 2468 | angles_menu->menuAction()->setObjectName("angles_menu");
|
|---|
| 2469 |
|
|---|
| 2470 | browseMenu->addMenu(angles_menu);
|
|---|
| 2471 |
|
|---|
| 2472 | #if DVDNAV_SUPPORT
|
|---|
| 2473 | browseMenu->addSeparator();
|
|---|
| 2474 | browseMenu->addAction(dvdnavMenuAct);
|
|---|
| 2475 | browseMenu->addAction(dvdnavPrevAct);
|
|---|
| 2476 | #endif
|
|---|
| 2477 |
|
|---|
| 2478 | #if PROGRAM_SWITCH
|
|---|
| 2479 | programtrack_menu = new QMenu(this);
|
|---|
| 2480 | programtrack_menu->menuAction()->setObjectName("programtrack_menu");
|
|---|
| 2481 |
|
|---|
| 2482 | browseMenu->addSeparator();
|
|---|
| 2483 | browseMenu->addMenu(programtrack_menu);
|
|---|
| 2484 | #endif
|
|---|
| 2485 |
|
|---|
| 2486 |
|
|---|
| 2487 | // OPTIONS MENU
|
|---|
| 2488 | optionsMenu->addAction(showPropertiesAct);
|
|---|
| 2489 | optionsMenu->addAction(showPlaylistAct);
|
|---|
| 2490 | // Check if the smplayer youtube browser is installed
|
|---|
| 2491 | {
|
|---|
| 2492 | QString tube_exec = Paths::appPath() + "/smtube";
|
|---|
| 2493 | #if defined(Q_OS_WIN) || defined(Q_OS_OS2)
|
|---|
| 2494 | tube_exec += ".exe";
|
|---|
| 2495 | #endif
|
|---|
| 2496 | if (QFile::exists(tube_exec)) {
|
|---|
| 2497 | optionsMenu->addAction(showTubeBrowserAct);
|
|---|
| 2498 | qDebug("BaseGui::createMenus: %s does exist", tube_exec.toUtf8().constData());
|
|---|
| 2499 | } else {
|
|---|
| 2500 | qDebug("BaseGui::createMenus: %s does not exist", tube_exec.toUtf8().constData());
|
|---|
| 2501 | }
|
|---|
| 2502 | }
|
|---|
| 2503 |
|
|---|
| 2504 | // OSD submenu
|
|---|
| 2505 | osd_menu = new QMenu(this);
|
|---|
| 2506 | osd_menu->menuAction()->setObjectName("osd_menu");
|
|---|
| 2507 | osd_menu->addActions(osdGroup->actions());
|
|---|
| 2508 |
|
|---|
| 2509 | optionsMenu->addMenu(osd_menu);
|
|---|
| 2510 |
|
|---|
| 2511 | // Logs submenu
|
|---|
| 2512 | logs_menu = new QMenu(this);
|
|---|
| 2513 | logs_menu->addAction(showLogMplayerAct);
|
|---|
| 2514 | logs_menu->addAction(showLogSmplayerAct);
|
|---|
| 2515 |
|
|---|
| 2516 | optionsMenu->addMenu(logs_menu);
|
|---|
| 2517 |
|
|---|
| 2518 | optionsMenu->addAction(showPreferencesAct);
|
|---|
| 2519 |
|
|---|
| 2520 | /*
|
|---|
| 2521 | Favorites * fav = new Favorites(Paths::configPath() + "/test.fav", this);
|
|---|
| 2522 | connect(fav, SIGNAL(activated(QString)), this, SLOT(open(QString)));
|
|---|
| 2523 | optionsMenu->addMenu( fav->menu() )->setText("Favorites");
|
|---|
| 2524 | */
|
|---|
| 2525 |
|
|---|
| 2526 | // HELP MENU
|
|---|
| 2527 | helpMenu->addAction(showFAQAct);
|
|---|
| 2528 | helpMenu->addAction(showCLOptionsAct);
|
|---|
| 2529 | helpMenu->addAction(showCheckUpdatesAct);
|
|---|
| 2530 | helpMenu->addAction(donateAct);
|
|---|
| 2531 | helpMenu->addSeparator();
|
|---|
| 2532 | helpMenu->addAction(aboutQtAct);
|
|---|
| 2533 | helpMenu->addAction(aboutThisAct);
|
|---|
| 2534 |
|
|---|
| 2535 | // POPUP MENU
|
|---|
| 2536 | if (!popup)
|
|---|
| 2537 | popup = new QMenu(this);
|
|---|
| 2538 | else
|
|---|
| 2539 | popup->clear();
|
|---|
| 2540 |
|
|---|
| 2541 | popup->addMenu( openMenu );
|
|---|
| 2542 | popup->addMenu( playMenu );
|
|---|
| 2543 | popup->addMenu( videoMenu );
|
|---|
| 2544 | popup->addMenu( audioMenu );
|
|---|
| 2545 | popup->addMenu( subtitlesMenu );
|
|---|
| 2546 | popup->addMenu( favorites );
|
|---|
| 2547 | popup->addMenu( browseMenu );
|
|---|
| 2548 | popup->addMenu( optionsMenu );
|
|---|
| 2549 |
|
|---|
| 2550 | // let's show something, even a <empty> entry
|
|---|
| 2551 | initializeMenus();
|
|---|
| 2552 | }
|
|---|
| 2553 |
|
|---|
| 2554 | /*
|
|---|
| 2555 | void BaseGui::closeEvent( QCloseEvent * e ) {
|
|---|
| 2556 | qDebug("BaseGui::closeEvent");
|
|---|
| 2557 |
|
|---|
| 2558 | qDebug("mplayer_log_window: %d x %d", mplayer_log_window->width(), mplayer_log_window->height() );
|
|---|
| 2559 | qDebug("smplayer_log_window: %d x %d", smplayer_log_window->width(), smplayer_log_window->height() );
|
|---|
| 2560 |
|
|---|
| 2561 | mplayer_log_window->close();
|
|---|
| 2562 | smplayer_log_window->close();
|
|---|
| 2563 | playlist->close();
|
|---|
| 2564 | equalizer->close();
|
|---|
| 2565 |
|
|---|
| 2566 | core->stop();
|
|---|
| 2567 | e->accept();
|
|---|
| 2568 | }
|
|---|
| 2569 | */
|
|---|
| 2570 |
|
|---|
| 2571 |
|
|---|
| 2572 | void BaseGui::closeWindow() {
|
|---|
| 2573 | qDebug("BaseGui::closeWindow");
|
|---|
| 2574 |
|
|---|
| 2575 | if (core->state() != Core::Stopped) {
|
|---|
| 2576 | core->stop();
|
|---|
| 2577 | }
|
|---|
| 2578 |
|
|---|
| 2579 | //qApp->quit();
|
|---|
| 2580 | emit quitSolicited();
|
|---|
| 2581 | }
|
|---|
| 2582 |
|
|---|
| 2583 | void BaseGui::showPlaylist() {
|
|---|
| 2584 | showPlaylist( !playlist->isVisible() );
|
|---|
| 2585 | }
|
|---|
| 2586 |
|
|---|
| 2587 | void BaseGui::showPlaylist(bool b) {
|
|---|
| 2588 | if ( !b ) {
|
|---|
| 2589 | playlist->hide();
|
|---|
| 2590 | } else {
|
|---|
| 2591 | exitFullscreenIfNeeded();
|
|---|
| 2592 | playlist->show();
|
|---|
| 2593 | }
|
|---|
| 2594 | //updateWidgets();
|
|---|
| 2595 | }
|
|---|
| 2596 |
|
|---|
| 2597 | void BaseGui::showVideoEqualizer() {
|
|---|
| 2598 | showVideoEqualizer( !video_equalizer->isVisible() );
|
|---|
| 2599 | }
|
|---|
| 2600 |
|
|---|
| 2601 | void BaseGui::showVideoEqualizer(bool b) {
|
|---|
| 2602 | if (!b) {
|
|---|
| 2603 | video_equalizer->hide();
|
|---|
| 2604 | } else {
|
|---|
| 2605 | // Exit fullscreen, otherwise dialog is not visible
|
|---|
| 2606 | exitFullscreenIfNeeded();
|
|---|
| 2607 | video_equalizer->show();
|
|---|
| 2608 | }
|
|---|
| 2609 | updateWidgets();
|
|---|
| 2610 | }
|
|---|
| 2611 |
|
|---|
| 2612 | void BaseGui::showAudioEqualizer() {
|
|---|
| 2613 | showAudioEqualizer( !audio_equalizer->isVisible() );
|
|---|
| 2614 | }
|
|---|
| 2615 |
|
|---|
| 2616 | void BaseGui::showAudioEqualizer(bool b) {
|
|---|
| 2617 | if (!b) {
|
|---|
| 2618 | audio_equalizer->hide();
|
|---|
| 2619 | } else {
|
|---|
| 2620 | // Exit fullscreen, otherwise dialog is not visible
|
|---|
| 2621 | exitFullscreenIfNeeded();
|
|---|
| 2622 | audio_equalizer->show();
|
|---|
| 2623 | }
|
|---|
| 2624 | updateWidgets();
|
|---|
| 2625 | }
|
|---|
| 2626 |
|
|---|
| 2627 | void BaseGui::showPreferencesDialog() {
|
|---|
| 2628 | qDebug("BaseGui::showPreferencesDialog");
|
|---|
| 2629 |
|
|---|
| 2630 | exitFullscreenIfNeeded();
|
|---|
| 2631 |
|
|---|
| 2632 | if (!pref_dialog) {
|
|---|
| 2633 | createPreferencesDialog();
|
|---|
| 2634 | }
|
|---|
| 2635 |
|
|---|
| 2636 | pref_dialog->setData(pref);
|
|---|
| 2637 |
|
|---|
| 2638 | pref_dialog->mod_input()->actions_editor->clear();
|
|---|
| 2639 | pref_dialog->mod_input()->actions_editor->addActions(this);
|
|---|
| 2640 | #if !DOCK_PLAYLIST
|
|---|
| 2641 | pref_dialog->mod_input()->actions_editor->addActions(playlist);
|
|---|
| 2642 | #endif
|
|---|
| 2643 |
|
|---|
| 2644 | // Set playlist preferences
|
|---|
| 2645 | PrefPlaylist * pl = pref_dialog->mod_playlist();
|
|---|
| 2646 | pl->setDirectoryRecursion(playlist->directoryRecursion());
|
|---|
| 2647 | pl->setAutoGetInfo(playlist->autoGetInfo());
|
|---|
| 2648 | pl->setSavePlaylistOnExit(playlist->savePlaylistOnExit());
|
|---|
| 2649 | pl->setPlayFilesFromStart(playlist->playFilesFromStart());
|
|---|
| 2650 |
|
|---|
| 2651 | PrefInterface * pi = pref_dialog->mod_interface();
|
|---|
| 2652 | pi->setSingleInstanceTabEnabled( use_control_server );
|
|---|
| 2653 |
|
|---|
| 2654 | pref_dialog->show();
|
|---|
| 2655 | }
|
|---|
| 2656 |
|
|---|
| 2657 | // The user has pressed OK in preferences dialog
|
|---|
| 2658 | void BaseGui::applyNewPreferences() {
|
|---|
| 2659 | qDebug("BaseGui::applyNewPreferences");
|
|---|
| 2660 |
|
|---|
| 2661 | bool need_update_language = false;
|
|---|
| 2662 |
|
|---|
| 2663 | pref_dialog->getData(pref);
|
|---|
| 2664 |
|
|---|
| 2665 | if (!pref->default_font.isEmpty()) {
|
|---|
| 2666 | QFont f;
|
|---|
| 2667 | f.fromString( pref->default_font );
|
|---|
| 2668 | qApp->setFont(f);
|
|---|
| 2669 | }
|
|---|
| 2670 |
|
|---|
| 2671 | #ifndef NO_USE_INI_FILES
|
|---|
| 2672 | PrefGeneral *_general = pref_dialog->mod_general();
|
|---|
| 2673 | if (_general->fileSettingsMethodChanged()) {
|
|---|
| 2674 | core->changeFileSettingsMethod(pref->file_settings_method);
|
|---|
| 2675 | }
|
|---|
| 2676 | #endif
|
|---|
| 2677 |
|
|---|
| 2678 | PrefInterface *_interface = pref_dialog->mod_interface();
|
|---|
| 2679 | if (_interface->recentsChanged()) {
|
|---|
| 2680 | updateRecents();
|
|---|
| 2681 | }
|
|---|
| 2682 | if (_interface->languageChanged()) need_update_language = true;
|
|---|
| 2683 |
|
|---|
| 2684 | if (_interface->iconsetChanged()) {
|
|---|
| 2685 | need_update_language = true;
|
|---|
| 2686 | // Stylesheet
|
|---|
| 2687 | #if ALLOW_CHANGE_STYLESHEET
|
|---|
| 2688 | changeStyleSheet(pref->iconset);
|
|---|
| 2689 | #endif
|
|---|
| 2690 | }
|
|---|
| 2691 |
|
|---|
| 2692 | if (use_control_server) {
|
|---|
| 2693 | if (!pref->use_single_instance && server->isListening()) {
|
|---|
| 2694 | server->close();
|
|---|
| 2695 | qDebug("BaseGui::applyNewPreferences: server closed");
|
|---|
| 2696 | }
|
|---|
| 2697 | else
|
|---|
| 2698 | {
|
|---|
| 2699 | bool server_requires_restart = _interface->serverPortChanged();
|
|---|
| 2700 | if (pref->use_single_instance && !server->isListening())
|
|---|
| 2701 | server_requires_restart=true;
|
|---|
| 2702 |
|
|---|
| 2703 | if (server_requires_restart) {
|
|---|
| 2704 | server->close();
|
|---|
| 2705 | int port = 0;
|
|---|
| 2706 | if (!pref->use_autoport) port = pref->connection_port;
|
|---|
| 2707 | if (server->listen(port)) {
|
|---|
| 2708 | pref->autoport = server->serverPort();
|
|---|
| 2709 | qDebug("BaseGui::applyNewPreferences: server running on port %d", pref->autoport);
|
|---|
| 2710 | } else {
|
|---|
| 2711 | qWarning("BaseGui::applyNewPreferences: server couldn't be started");
|
|---|
| 2712 | }
|
|---|
| 2713 | }
|
|---|
| 2714 | }
|
|---|
| 2715 | }
|
|---|
| 2716 |
|
|---|
| 2717 | #if ALLOW_TO_HIDE_VIDEO_WINDOW_ON_AUDIO_FILES
|
|---|
| 2718 | if (pref->hide_video_window_on_audio_files) {
|
|---|
| 2719 | connect( core, SIGNAL(noVideo()), this, SLOT(hidePanel()) );
|
|---|
| 2720 | disconnect( core, SIGNAL(noVideo()), mplayerwindow, SLOT(hideLogo()) );
|
|---|
| 2721 | } else {
|
|---|
| 2722 | disconnect( core, SIGNAL(noVideo()), this, SLOT(hidePanel()) );
|
|---|
| 2723 | connect( core, SIGNAL(noVideo()), mplayerwindow, SLOT(showLogo()) );
|
|---|
| 2724 | if (!panel->isVisible()) {
|
|---|
| 2725 | resize( width(), height() + 200);
|
|---|
| 2726 | panel->show();
|
|---|
| 2727 | }
|
|---|
| 2728 | }
|
|---|
| 2729 | #endif
|
|---|
| 2730 |
|
|---|
| 2731 | PrefAdvanced *advanced = pref_dialog->mod_advanced();
|
|---|
| 2732 | #if REPAINT_BACKGROUND_OPTION
|
|---|
| 2733 | if (advanced->repaintVideoBackgroundChanged()) {
|
|---|
| 2734 | mplayerwindow->videoLayer()->setRepaintBackground(pref->repaint_video_background);
|
|---|
| 2735 | }
|
|---|
| 2736 | #endif
|
|---|
| 2737 | #if USE_COLORKEY
|
|---|
| 2738 | if (advanced->colorkeyChanged()) {
|
|---|
| 2739 | mplayerwindow->setColorKey( pref->color_key );
|
|---|
| 2740 | }
|
|---|
| 2741 | #endif
|
|---|
| 2742 | if (advanced->monitorAspectChanged()) {
|
|---|
| 2743 | mplayerwindow->setMonitorAspect( pref->monitor_aspect_double() );
|
|---|
| 2744 | }
|
|---|
| 2745 |
|
|---|
| 2746 | // Update playlist preferences
|
|---|
| 2747 | PrefPlaylist * pl = pref_dialog->mod_playlist();
|
|---|
| 2748 | playlist->setDirectoryRecursion(pl->directoryRecursion());
|
|---|
| 2749 | playlist->setAutoGetInfo(pl->autoGetInfo());
|
|---|
| 2750 | playlist->setSavePlaylistOnExit(pl->savePlaylistOnExit());
|
|---|
| 2751 | playlist->setPlayFilesFromStart(pl->playFilesFromStart());
|
|---|
| 2752 |
|
|---|
| 2753 |
|
|---|
| 2754 | if (need_update_language) {
|
|---|
| 2755 | translator->load(pref->language);
|
|---|
| 2756 | }
|
|---|
| 2757 |
|
|---|
| 2758 | setJumpTexts(); // Update texts in menus
|
|---|
| 2759 | updateWidgets(); // Update the screenshot action
|
|---|
| 2760 |
|
|---|
| 2761 | #if STYLE_SWITCHING
|
|---|
| 2762 | if (_interface->styleChanged()) {
|
|---|
| 2763 | qDebug( "selected style: '%s'", pref->style.toUtf8().data() );
|
|---|
| 2764 | if ( !pref->style.isEmpty()) {
|
|---|
| 2765 | qApp->setStyle( pref->style );
|
|---|
| 2766 | } else {
|
|---|
| 2767 | qDebug("setting default style: '%s'", default_style.toUtf8().data() );
|
|---|
| 2768 | qApp->setStyle( default_style );
|
|---|
| 2769 | }
|
|---|
| 2770 | }
|
|---|
| 2771 | #endif
|
|---|
| 2772 |
|
|---|
| 2773 | // Restart the video if needed
|
|---|
| 2774 | if (pref_dialog->requiresRestart())
|
|---|
| 2775 | core->restart();
|
|---|
| 2776 |
|
|---|
| 2777 | // Update actions
|
|---|
| 2778 | pref_dialog->mod_input()->actions_editor->applyChanges();
|
|---|
| 2779 | saveActions();
|
|---|
| 2780 |
|
|---|
| 2781 | #ifndef NO_USE_INI_FILES
|
|---|
| 2782 | pref->save();
|
|---|
| 2783 | #endif
|
|---|
| 2784 | }
|
|---|
| 2785 |
|
|---|
| 2786 |
|
|---|
| 2787 | void BaseGui::showFilePropertiesDialog() {
|
|---|
| 2788 | qDebug("BaseGui::showFilePropertiesDialog");
|
|---|
| 2789 |
|
|---|
| 2790 | exitFullscreenIfNeeded();
|
|---|
| 2791 |
|
|---|
| 2792 | if (!file_dialog) {
|
|---|
| 2793 | createFilePropertiesDialog();
|
|---|
| 2794 | }
|
|---|
| 2795 |
|
|---|
| 2796 | setDataToFileProperties();
|
|---|
| 2797 |
|
|---|
| 2798 | file_dialog->show();
|
|---|
| 2799 | }
|
|---|
| 2800 |
|
|---|
| 2801 | void BaseGui::setDataToFileProperties() {
|
|---|
| 2802 | // Save a copy of the original values
|
|---|
| 2803 | if (core->mset.original_demuxer.isEmpty())
|
|---|
| 2804 | core->mset.original_demuxer = core->mdat.demuxer;
|
|---|
| 2805 |
|
|---|
| 2806 | if (core->mset.original_video_codec.isEmpty())
|
|---|
| 2807 | core->mset.original_video_codec = core->mdat.video_codec;
|
|---|
| 2808 |
|
|---|
| 2809 | if (core->mset.original_audio_codec.isEmpty())
|
|---|
| 2810 | core->mset.original_audio_codec = core->mdat.audio_codec;
|
|---|
| 2811 |
|
|---|
| 2812 | QString demuxer = core->mset.forced_demuxer;
|
|---|
| 2813 | if (demuxer.isEmpty()) demuxer = core->mdat.demuxer;
|
|---|
| 2814 |
|
|---|
| 2815 | QString ac = core->mset.forced_audio_codec;
|
|---|
| 2816 | if (ac.isEmpty()) ac = core->mdat.audio_codec;
|
|---|
| 2817 |
|
|---|
| 2818 | QString vc = core->mset.forced_video_codec;
|
|---|
| 2819 | if (vc.isEmpty()) vc = core->mdat.video_codec;
|
|---|
| 2820 |
|
|---|
| 2821 | file_dialog->setDemuxer(demuxer, core->mset.original_demuxer);
|
|---|
| 2822 | file_dialog->setAudioCodec(ac, core->mset.original_audio_codec);
|
|---|
| 2823 | file_dialog->setVideoCodec(vc, core->mset.original_video_codec);
|
|---|
| 2824 |
|
|---|
| 2825 | file_dialog->setMplayerAdditionalArguments( core->mset.mplayer_additional_options );
|
|---|
| 2826 | file_dialog->setMplayerAdditionalVideoFilters( core->mset.mplayer_additional_video_filters );
|
|---|
| 2827 | file_dialog->setMplayerAdditionalAudioFilters( core->mset.mplayer_additional_audio_filters );
|
|---|
| 2828 |
|
|---|
| 2829 | file_dialog->setMediaData( core->mdat );
|
|---|
| 2830 | }
|
|---|
| 2831 |
|
|---|
| 2832 | void BaseGui::applyFileProperties() {
|
|---|
| 2833 | qDebug("BaseGui::applyFileProperties");
|
|---|
| 2834 |
|
|---|
| 2835 | bool need_restart = false;
|
|---|
| 2836 | bool demuxer_changed = false;
|
|---|
| 2837 |
|
|---|
| 2838 | #undef TEST_AND_SET
|
|---|
| 2839 | #define TEST_AND_SET( Pref, Dialog ) \
|
|---|
| 2840 | if ( Pref != Dialog ) { Pref = Dialog; need_restart = TRUE; }
|
|---|
| 2841 |
|
|---|
| 2842 | QString prev_demuxer = core->mset.forced_demuxer;
|
|---|
| 2843 |
|
|---|
| 2844 | QString demuxer = file_dialog->demuxer();
|
|---|
| 2845 | if (demuxer == core->mset.original_demuxer) demuxer="";
|
|---|
| 2846 | TEST_AND_SET(core->mset.forced_demuxer, demuxer);
|
|---|
| 2847 |
|
|---|
| 2848 | if (prev_demuxer != core->mset.forced_demuxer) {
|
|---|
| 2849 | // Demuxer changed
|
|---|
| 2850 | demuxer_changed = true;
|
|---|
| 2851 | core->mset.current_audio_id = MediaSettings::NoneSelected;
|
|---|
| 2852 | core->mset.current_sub_id = MediaSettings::NoneSelected;
|
|---|
| 2853 | }
|
|---|
| 2854 |
|
|---|
| 2855 | QString ac = file_dialog->audioCodec();
|
|---|
| 2856 | if (ac == core->mset.original_audio_codec) ac="";
|
|---|
| 2857 | TEST_AND_SET(core->mset.forced_audio_codec, ac);
|
|---|
| 2858 |
|
|---|
| 2859 | QString vc = file_dialog->videoCodec();
|
|---|
| 2860 | if (vc == core->mset.original_video_codec) vc="";
|
|---|
| 2861 | TEST_AND_SET(core->mset.forced_video_codec, vc);
|
|---|
| 2862 |
|
|---|
| 2863 | TEST_AND_SET(core->mset.mplayer_additional_options, file_dialog->mplayerAdditionalArguments());
|
|---|
| 2864 | TEST_AND_SET(core->mset.mplayer_additional_video_filters, file_dialog->mplayerAdditionalVideoFilters());
|
|---|
| 2865 | TEST_AND_SET(core->mset.mplayer_additional_audio_filters, file_dialog->mplayerAdditionalAudioFilters());
|
|---|
| 2866 |
|
|---|
| 2867 | // Restart the video to apply
|
|---|
| 2868 | if (need_restart) {
|
|---|
| 2869 | if (demuxer_changed) {
|
|---|
| 2870 | core->reload();
|
|---|
| 2871 | } else {
|
|---|
| 2872 | core->restart();
|
|---|
| 2873 | }
|
|---|
| 2874 | }
|
|---|
| 2875 | }
|
|---|
| 2876 |
|
|---|
| 2877 |
|
|---|
| 2878 | void BaseGui::updateMediaInfo() {
|
|---|
| 2879 | qDebug("BaseGui::updateMediaInfo");
|
|---|
| 2880 |
|
|---|
| 2881 | if (file_dialog) {
|
|---|
| 2882 | if (file_dialog->isVisible()) setDataToFileProperties();
|
|---|
| 2883 | }
|
|---|
| 2884 |
|
|---|
| 2885 | setWindowCaption( core->mdat.displayName(pref->show_tag_in_window_title) + " - SMPlayer" );
|
|---|
| 2886 |
|
|---|
| 2887 | emit videoInfoChanged(core->mdat.video_width, core->mdat.video_height, core->mdat.video_fps.toDouble());
|
|---|
| 2888 | }
|
|---|
| 2889 |
|
|---|
| 2890 | void BaseGui::newMediaLoaded() {
|
|---|
| 2891 | qDebug("BaseGui::newMediaLoaded");
|
|---|
| 2892 |
|
|---|
| 2893 | pref->history_recents->addItem( core->mdat.filename );
|
|---|
| 2894 | updateRecents();
|
|---|
| 2895 |
|
|---|
| 2896 | // If a VCD, Audio CD or DVD, add items to playlist
|
|---|
| 2897 | bool is_disc = ( (core->mdat.type == TYPE_VCD) || (core->mdat.type == TYPE_DVD) || (core->mdat.type == TYPE_AUDIO_CD) );
|
|---|
| 2898 | #if DVDNAV_SUPPORT
|
|---|
| 2899 | // Don't add the list of titles if using dvdnav
|
|---|
| 2900 | if ((core->mdat.type == TYPE_DVD) && (core->mdat.filename.startsWith("dvdnav:"))) is_disc = false;
|
|---|
| 2901 | #endif
|
|---|
| 2902 | if (pref->auto_add_to_playlist && is_disc)
|
|---|
| 2903 | {
|
|---|
| 2904 | int first_title = 1;
|
|---|
| 2905 | if (core->mdat.type == TYPE_VCD) first_title = pref->vcd_initial_title;
|
|---|
| 2906 |
|
|---|
| 2907 | QString type = "dvd"; // FIXME: support dvdnav
|
|---|
| 2908 | if (core->mdat.type == TYPE_VCD) type="vcd";
|
|---|
| 2909 | else
|
|---|
| 2910 | if (core->mdat.type == TYPE_AUDIO_CD) type="cdda";
|
|---|
| 2911 |
|
|---|
| 2912 | if (core->mset.current_title_id == first_title) {
|
|---|
| 2913 | playlist->clear();
|
|---|
| 2914 | QStringList l;
|
|---|
| 2915 | QString s;
|
|---|
| 2916 | QString folder;
|
|---|
| 2917 | if (core->mdat.type == TYPE_DVD) {
|
|---|
| 2918 | DiscData disc_data = DiscName::split(core->mdat.filename);
|
|---|
| 2919 | folder = disc_data.device;
|
|---|
| 2920 | }
|
|---|
| 2921 | for (int n=0; n < core->mdat.titles.numItems(); n++) {
|
|---|
| 2922 | s = type + "://" + QString::number(core->mdat.titles.itemAt(n).ID());
|
|---|
| 2923 | if ( !folder.isEmpty() ) {
|
|---|
| 2924 | s += "/" + folder; // FIXME: dvd names are not created as they should
|
|---|
| 2925 | }
|
|---|
| 2926 | l.append(s);
|
|---|
| 2927 | }
|
|---|
| 2928 | playlist->addFiles(l);
|
|---|
| 2929 | //playlist->setModified(false); // Not a real playlist
|
|---|
| 2930 | }
|
|---|
| 2931 | } /*else {
|
|---|
| 2932 | playlist->clear();
|
|---|
| 2933 | playlist->addCurrentFile();
|
|---|
| 2934 | }*/
|
|---|
| 2935 |
|
|---|
| 2936 | if ((core->mdat.type == TYPE_FILE) && (pref->auto_add_to_playlist) && (pref->add_to_playlist_consecutive_files)) {
|
|---|
| 2937 | // Look for consecutive files
|
|---|
| 2938 | QStringList files_to_add = Helper::searchForConsecutiveFiles(core->mdat.filename);
|
|---|
| 2939 | if (!files_to_add.empty()) playlist->addFiles(files_to_add);
|
|---|
| 2940 | }
|
|---|
| 2941 | }
|
|---|
| 2942 |
|
|---|
| 2943 | void BaseGui::clearMplayerLog() {
|
|---|
| 2944 | mplayer_log.clear();
|
|---|
| 2945 | if (mplayer_log_window->isVisible()) mplayer_log_window->clear();
|
|---|
| 2946 | }
|
|---|
| 2947 |
|
|---|
| 2948 | void BaseGui::recordMplayerLog(QString line) {
|
|---|
| 2949 | if (pref->log_mplayer) {
|
|---|
| 2950 | if ( (line.indexOf("A:")==-1) && (line.indexOf("V:")==-1) ) {
|
|---|
| 2951 | line.append("\n");
|
|---|
| 2952 | mplayer_log.append(line);
|
|---|
| 2953 | if (mplayer_log_window->isVisible()) mplayer_log_window->appendText(line);
|
|---|
| 2954 | }
|
|---|
| 2955 | }
|
|---|
| 2956 | }
|
|---|
| 2957 |
|
|---|
| 2958 | void BaseGui::recordSmplayerLog(QString line) {
|
|---|
| 2959 | if (pref->log_smplayer) {
|
|---|
| 2960 | line.append("\n");
|
|---|
| 2961 | smplayer_log.append(line);
|
|---|
| 2962 | if (smplayer_log_window->isVisible()) smplayer_log_window->appendText(line);
|
|---|
| 2963 | }
|
|---|
| 2964 | }
|
|---|
| 2965 |
|
|---|
| 2966 | /*!
|
|---|
| 2967 | Save the mplayer log to a file, so it can be used by external
|
|---|
| 2968 | applications.
|
|---|
| 2969 | */
|
|---|
| 2970 | void BaseGui::autosaveMplayerLog() {
|
|---|
| 2971 | qDebug("BaseGui::autosaveMplayerLog");
|
|---|
| 2972 |
|
|---|
| 2973 | if (pref->autosave_mplayer_log) {
|
|---|
| 2974 | if (!pref->mplayer_log_saveto.isEmpty()) {
|
|---|
| 2975 | QFile file( pref->mplayer_log_saveto );
|
|---|
| 2976 | if ( file.open( QIODevice::WriteOnly ) ) {
|
|---|
| 2977 | QTextStream strm( &file );
|
|---|
| 2978 | strm << mplayer_log;
|
|---|
| 2979 | file.close();
|
|---|
| 2980 | }
|
|---|
| 2981 | }
|
|---|
| 2982 | }
|
|---|
| 2983 | }
|
|---|
| 2984 |
|
|---|
| 2985 | void BaseGui::showMplayerLog() {
|
|---|
| 2986 | qDebug("BaseGui::showMplayerLog");
|
|---|
| 2987 |
|
|---|
| 2988 | exitFullscreenIfNeeded();
|
|---|
| 2989 |
|
|---|
| 2990 | mplayer_log_window->setText( mplayer_log );
|
|---|
| 2991 | mplayer_log_window->show();
|
|---|
| 2992 | }
|
|---|
| 2993 |
|
|---|
| 2994 | void BaseGui::showLog() {
|
|---|
| 2995 | qDebug("BaseGui::showLog");
|
|---|
| 2996 |
|
|---|
| 2997 | exitFullscreenIfNeeded();
|
|---|
| 2998 |
|
|---|
| 2999 | smplayer_log_window->setText( smplayer_log );
|
|---|
| 3000 | smplayer_log_window->show();
|
|---|
| 3001 | }
|
|---|
| 3002 |
|
|---|
| 3003 |
|
|---|
| 3004 | void BaseGui::initializeMenus() {
|
|---|
| 3005 | qDebug("BaseGui::initializeMenus");
|
|---|
| 3006 |
|
|---|
| 3007 | #define EMPTY 1
|
|---|
| 3008 |
|
|---|
| 3009 | int n;
|
|---|
| 3010 |
|
|---|
| 3011 | // Subtitles
|
|---|
| 3012 | subtitleTrackGroup->clear(true);
|
|---|
| 3013 | QAction * subNoneAct = subtitleTrackGroup->addAction( tr("&None") );
|
|---|
| 3014 | subNoneAct->setData(MediaSettings::SubNone);
|
|---|
| 3015 | subNoneAct->setCheckable(true);
|
|---|
| 3016 | for (n=0; n < core->mdat.subs.numItems(); n++) {
|
|---|
| 3017 | QAction *a = new QAction(subtitleTrackGroup);
|
|---|
| 3018 | a->setCheckable(true);
|
|---|
| 3019 | a->setText(core->mdat.subs.itemAt(n).displayName());
|
|---|
| 3020 | a->setData(n);
|
|---|
| 3021 | }
|
|---|
| 3022 | subtitlestrack_menu->addActions( subtitleTrackGroup->actions() );
|
|---|
| 3023 |
|
|---|
| 3024 | // Audio
|
|---|
| 3025 | audioTrackGroup->clear(true);
|
|---|
| 3026 | if (core->mdat.audios.numItems()==0) {
|
|---|
| 3027 | QAction * a = audioTrackGroup->addAction( tr("<empty>") );
|
|---|
| 3028 | a->setEnabled(false);
|
|---|
| 3029 | } else {
|
|---|
| 3030 | for (n=0; n < core->mdat.audios.numItems(); n++) {
|
|---|
| 3031 | QAction *a = new QAction(audioTrackGroup);
|
|---|
| 3032 | a->setCheckable(true);
|
|---|
| 3033 | a->setText(core->mdat.audios.itemAt(n).displayName());
|
|---|
| 3034 | a->setData(core->mdat.audios.itemAt(n).ID());
|
|---|
| 3035 | }
|
|---|
| 3036 | }
|
|---|
| 3037 | audiotrack_menu->addActions( audioTrackGroup->actions() );
|
|---|
| 3038 |
|
|---|
| 3039 | #if PROGRAM_SWITCH
|
|---|
| 3040 | // Program
|
|---|
| 3041 | programTrackGroup->clear(true);
|
|---|
| 3042 | if (core->mdat.programs.numItems()==0) {
|
|---|
| 3043 | QAction * a = programTrackGroup->addAction( tr("<empty>") );
|
|---|
| 3044 | a->setEnabled(false);
|
|---|
| 3045 | } else {
|
|---|
| 3046 | for (n=0; n < core->mdat.programs.numItems(); n++) {
|
|---|
| 3047 | QAction *a = new QAction(programTrackGroup);
|
|---|
| 3048 | a->setCheckable(true);
|
|---|
| 3049 | a->setText(core->mdat.programs.itemAt(n).displayName());
|
|---|
| 3050 | a->setData(core->mdat.programs.itemAt(n).ID());
|
|---|
| 3051 | }
|
|---|
| 3052 | }
|
|---|
| 3053 | programtrack_menu->addActions( programTrackGroup->actions() );
|
|---|
| 3054 | #endif
|
|---|
| 3055 |
|
|---|
| 3056 | // Video
|
|---|
| 3057 | videoTrackGroup->clear(true);
|
|---|
| 3058 | if (core->mdat.videos.numItems()==0) {
|
|---|
| 3059 | QAction * a = videoTrackGroup->addAction( tr("<empty>") );
|
|---|
| 3060 | a->setEnabled(false);
|
|---|
| 3061 | } else {
|
|---|
| 3062 | for (n=0; n < core->mdat.videos.numItems(); n++) {
|
|---|
| 3063 | QAction *a = new QAction(videoTrackGroup);
|
|---|
| 3064 | a->setCheckable(true);
|
|---|
| 3065 | a->setText(core->mdat.videos.itemAt(n).displayName());
|
|---|
| 3066 | a->setData(core->mdat.videos.itemAt(n).ID());
|
|---|
| 3067 | }
|
|---|
| 3068 | }
|
|---|
| 3069 | videotrack_menu->addActions( videoTrackGroup->actions() );
|
|---|
| 3070 |
|
|---|
| 3071 | // Titles
|
|---|
| 3072 | titleGroup->clear(true);
|
|---|
| 3073 | if (core->mdat.titles.numItems()==0) {
|
|---|
| 3074 | QAction * a = titleGroup->addAction( tr("<empty>") );
|
|---|
| 3075 | a->setEnabled(false);
|
|---|
| 3076 | } else {
|
|---|
| 3077 | for (n=0; n < core->mdat.titles.numItems(); n++) {
|
|---|
| 3078 | QAction *a = new QAction(titleGroup);
|
|---|
| 3079 | a->setCheckable(true);
|
|---|
| 3080 | a->setText(core->mdat.titles.itemAt(n).displayName());
|
|---|
| 3081 | a->setData(core->mdat.titles.itemAt(n).ID());
|
|---|
| 3082 | }
|
|---|
| 3083 | }
|
|---|
| 3084 | titles_menu->addActions( titleGroup->actions() );
|
|---|
| 3085 |
|
|---|
| 3086 | #if GENERIC_CHAPTER_SUPPORT
|
|---|
| 3087 | chapterGroup->clear(true);
|
|---|
| 3088 | if (core->mdat.chapters > 0) {
|
|---|
| 3089 | for (n=0; n < core->mdat.chapters; n++) {
|
|---|
| 3090 | QAction *a = new QAction(chapterGroup);
|
|---|
| 3091 | a->setCheckable(true);
|
|---|
| 3092 | a->setText( QString::number(n+1) );
|
|---|
| 3093 | a->setData( n + Core::firstChapter() );
|
|---|
| 3094 | }
|
|---|
| 3095 | } else {
|
|---|
| 3096 | QAction * a = chapterGroup->addAction( tr("<empty>") );
|
|---|
| 3097 | a->setEnabled(false);
|
|---|
| 3098 | }
|
|---|
| 3099 | chapters_menu->addActions( chapterGroup->actions() );
|
|---|
| 3100 | #else
|
|---|
| 3101 | // DVD Chapters
|
|---|
| 3102 | chapterGroup->clear(true);
|
|---|
| 3103 | if ( (core->mdat.type == TYPE_DVD) && (core->mset.current_title_id > 0) ) {
|
|---|
| 3104 | for (n=0; n < core->mdat.titles.item(core->mset.current_title_id).chapters(); n++) {
|
|---|
| 3105 | QAction *a = new QAction(chapterGroup);
|
|---|
| 3106 | a->setCheckable(true);
|
|---|
| 3107 | a->setText( QString::number(n+1) );
|
|---|
| 3108 | a->setData( n + Core::dvdFirstChapter() );
|
|---|
| 3109 | }
|
|---|
| 3110 | } else {
|
|---|
| 3111 | // *** Matroshka chapters ***
|
|---|
| 3112 | if (core->mdat.mkv_chapters > 0) {
|
|---|
| 3113 | for (n=0; n < core->mdat.mkv_chapters; n++) {
|
|---|
| 3114 | QAction *a = new QAction(chapterGroup);
|
|---|
| 3115 | a->setCheckable(true);
|
|---|
| 3116 | a->setText( QString::number(n+1) );
|
|---|
| 3117 | a->setData( n + Core::firstChapter() );
|
|---|
| 3118 | }
|
|---|
| 3119 | } else {
|
|---|
| 3120 | QAction * a = chapterGroup->addAction( tr("<empty>") );
|
|---|
| 3121 | a->setEnabled(false);
|
|---|
| 3122 | }
|
|---|
| 3123 | }
|
|---|
| 3124 | chapters_menu->addActions( chapterGroup->actions() );
|
|---|
| 3125 | #endif
|
|---|
| 3126 |
|
|---|
| 3127 | // Angles
|
|---|
| 3128 | angleGroup->clear(true);
|
|---|
| 3129 | int n_angles = 0;
|
|---|
| 3130 | if (core->mset.current_angle_id > 0) {
|
|---|
| 3131 | int i = core->mdat.titles.find(core->mset.current_angle_id);
|
|---|
| 3132 | if (i > -1) n_angles = core->mdat.titles.itemAt(i).angles();
|
|---|
| 3133 | }
|
|---|
| 3134 | if (n_angles > 0) {
|
|---|
| 3135 | for (n=1; n <= n_angles; n++) {
|
|---|
| 3136 | QAction *a = new QAction(angleGroup);
|
|---|
| 3137 | a->setCheckable(true);
|
|---|
| 3138 | a->setText( QString::number(n) );
|
|---|
| 3139 | a->setData( n );
|
|---|
| 3140 | }
|
|---|
| 3141 | } else {
|
|---|
| 3142 | QAction * a = angleGroup->addAction( tr("<empty>") );
|
|---|
| 3143 | a->setEnabled(false);
|
|---|
| 3144 | }
|
|---|
| 3145 | angles_menu->addActions( angleGroup->actions() );
|
|---|
| 3146 | }
|
|---|
| 3147 |
|
|---|
| 3148 | void BaseGui::updateRecents() {
|
|---|
| 3149 | qDebug("BaseGui::updateRecents");
|
|---|
| 3150 |
|
|---|
| 3151 | // Not clear the first 2 items
|
|---|
| 3152 | while (recentfiles_menu->actions().count() > 2) {
|
|---|
| 3153 | QAction * a = recentfiles_menu->actions()[2];
|
|---|
| 3154 | recentfiles_menu->removeAction( a );
|
|---|
| 3155 | a->deleteLater();
|
|---|
| 3156 | }
|
|---|
| 3157 |
|
|---|
| 3158 | int current_items = 0;
|
|---|
| 3159 |
|
|---|
| 3160 | if (pref->history_recents->count() > 0) {
|
|---|
| 3161 | for (int n=0; n < pref->history_recents->count(); n++) {
|
|---|
| 3162 | QString i = QString::number( n+1 );
|
|---|
| 3163 | QString fullname = pref->history_recents->item(n);
|
|---|
| 3164 | QString filename = fullname;
|
|---|
| 3165 | QFileInfo fi(fullname);
|
|---|
| 3166 | //if (fi.exists()) filename = fi.fileName(); // Can be slow
|
|---|
| 3167 |
|
|---|
| 3168 | // Let's see if it looks like a file (no dvd://1 or something)
|
|---|
| 3169 | if (fullname.indexOf(QRegExp("^.*://.*")) == -1) filename = fi.fileName();
|
|---|
| 3170 |
|
|---|
| 3171 | QAction * a = recentfiles_menu->addAction( QString("%1. " + filename ).arg( i.insert( i.size()-1, '&' ), 3, ' ' ));
|
|---|
| 3172 | a->setStatusTip(fullname);
|
|---|
| 3173 | a->setData(n);
|
|---|
| 3174 | connect(a, SIGNAL(triggered()), this, SLOT(openRecent()));
|
|---|
| 3175 | current_items++;
|
|---|
| 3176 | }
|
|---|
| 3177 | } else {
|
|---|
| 3178 | QAction * a = recentfiles_menu->addAction( tr("<empty>") );
|
|---|
| 3179 | a->setEnabled(false);
|
|---|
| 3180 | }
|
|---|
| 3181 |
|
|---|
| 3182 | recentfiles_menu->menuAction()->setVisible( current_items > 0 );
|
|---|
| 3183 | }
|
|---|
| 3184 |
|
|---|
| 3185 | void BaseGui::clearRecentsList() {
|
|---|
| 3186 | // Delete items in menu
|
|---|
| 3187 | pref->history_recents->clear();
|
|---|
| 3188 | updateRecents();
|
|---|
| 3189 | }
|
|---|
| 3190 |
|
|---|
| 3191 | void BaseGui::updateWidgets() {
|
|---|
| 3192 | qDebug("BaseGui::updateWidgets");
|
|---|
| 3193 |
|
|---|
| 3194 | // Subtitles menu
|
|---|
| 3195 | subtitleTrackGroup->setChecked( core->mset.current_sub_id );
|
|---|
| 3196 |
|
|---|
| 3197 | // Disable the unload subs action if there's no external subtitles
|
|---|
| 3198 | unloadSubsAct->setEnabled( !core->mset.external_subtitles.isEmpty() );
|
|---|
| 3199 |
|
|---|
| 3200 | // Closed caption menu
|
|---|
| 3201 | ccGroup->setChecked( core->mset.closed_caption_channel );
|
|---|
| 3202 |
|
|---|
| 3203 | // Audio menu
|
|---|
| 3204 | audioTrackGroup->setChecked( core->mset.current_audio_id );
|
|---|
| 3205 | channelsGroup->setChecked( core->mset.audio_use_channels );
|
|---|
| 3206 | stereoGroup->setChecked( core->mset.stereo_mode );
|
|---|
| 3207 | // Disable the unload audio file action if there's no external audio file
|
|---|
| 3208 | unloadAudioAct->setEnabled( !core->mset.external_audio.isEmpty() );
|
|---|
| 3209 |
|
|---|
| 3210 | #if PROGRAM_SWITCH
|
|---|
| 3211 | // Program menu
|
|---|
| 3212 | programTrackGroup->setChecked( core->mset.current_program_id );
|
|---|
| 3213 | #endif
|
|---|
| 3214 |
|
|---|
| 3215 | // Video menu
|
|---|
| 3216 | videoTrackGroup->setChecked( core->mset.current_video_id );
|
|---|
| 3217 |
|
|---|
| 3218 | // Aspect ratio
|
|---|
| 3219 | aspectGroup->setChecked( core->mset.aspect_ratio_id );
|
|---|
| 3220 |
|
|---|
| 3221 | // Rotate
|
|---|
| 3222 | rotateGroup->setChecked( core->mset.rotate );
|
|---|
| 3223 |
|
|---|
| 3224 | #if USE_ADAPTER
|
|---|
| 3225 | screenGroup->setChecked( pref->adapter );
|
|---|
| 3226 | #endif
|
|---|
| 3227 |
|
|---|
| 3228 | // OSD
|
|---|
| 3229 | osdGroup->setChecked( pref->osd );
|
|---|
| 3230 |
|
|---|
| 3231 | // Titles
|
|---|
| 3232 | titleGroup->setChecked( core->mset.current_title_id );
|
|---|
| 3233 |
|
|---|
| 3234 | // Chapters
|
|---|
| 3235 | chapterGroup->setChecked( core->mset.current_chapter_id );
|
|---|
| 3236 |
|
|---|
| 3237 | // Angles
|
|---|
| 3238 | angleGroup->setChecked( core->mset.current_angle_id );
|
|---|
| 3239 |
|
|---|
| 3240 | // Deinterlace menu
|
|---|
| 3241 | deinterlaceGroup->setChecked( core->mset.current_deinterlacer );
|
|---|
| 3242 |
|
|---|
| 3243 | // Video size menu
|
|---|
| 3244 | sizeGroup->setChecked( pref->size_factor );
|
|---|
| 3245 |
|
|---|
| 3246 | // Auto phase
|
|---|
| 3247 | phaseAct->setChecked( core->mset.phase_filter );
|
|---|
| 3248 |
|
|---|
| 3249 | // Deblock
|
|---|
| 3250 | deblockAct->setChecked( core->mset.deblock_filter );
|
|---|
| 3251 |
|
|---|
| 3252 | // Dering
|
|---|
| 3253 | deringAct->setChecked( core->mset.dering_filter );
|
|---|
| 3254 |
|
|---|
| 3255 | // Add noise
|
|---|
| 3256 | addNoiseAct->setChecked( core->mset.noise_filter );
|
|---|
| 3257 |
|
|---|
| 3258 | // Letterbox
|
|---|
| 3259 | addLetterboxAct->setChecked( core->mset.add_letterbox );
|
|---|
| 3260 |
|
|---|
| 3261 | // Upscaling
|
|---|
| 3262 | upscaleAct->setChecked( core->mset.upscaling_filter );
|
|---|
| 3263 |
|
|---|
| 3264 |
|
|---|
| 3265 | // Postprocessing
|
|---|
| 3266 | postProcessingAct->setChecked( core->mset.postprocessing_filter );
|
|---|
| 3267 |
|
|---|
| 3268 | // Denoise submenu
|
|---|
| 3269 | denoiseGroup->setChecked( core->mset.current_denoiser );
|
|---|
| 3270 |
|
|---|
| 3271 | /*
|
|---|
| 3272 | // Fullscreen button
|
|---|
| 3273 | fullscreenbutton->setOn(pref->fullscreen);
|
|---|
| 3274 |
|
|---|
| 3275 | // Mute button
|
|---|
| 3276 | mutebutton->setOn(core->mset.mute);
|
|---|
| 3277 | if (core->mset.mute)
|
|---|
| 3278 | mutebutton->setPixmap( Images::icon("mute_small") );
|
|---|
| 3279 | else
|
|---|
| 3280 | mutebutton->setPixmap( Images::icon("volume_small") );
|
|---|
| 3281 |
|
|---|
| 3282 | // Volume slider
|
|---|
| 3283 | volumeslider->setValue( core->mset.volume );
|
|---|
| 3284 | */
|
|---|
| 3285 |
|
|---|
| 3286 | // Mute menu option
|
|---|
| 3287 | muteAct->setChecked( (pref->global_volume ? pref->mute : core->mset.mute) );
|
|---|
| 3288 |
|
|---|
| 3289 | // Karaoke menu option
|
|---|
| 3290 | karaokeAct->setChecked( core->mset.karaoke_filter );
|
|---|
| 3291 |
|
|---|
| 3292 | // Extrastereo menu option
|
|---|
| 3293 | extrastereoAct->setChecked( core->mset.extrastereo_filter );
|
|---|
| 3294 |
|
|---|
| 3295 | // Volnorm menu option
|
|---|
| 3296 | volnormAct->setChecked( core->mset.volnorm_filter );
|
|---|
| 3297 |
|
|---|
| 3298 | // Repeat menu option
|
|---|
| 3299 | repeatAct->setChecked( core->mset.loop );
|
|---|
| 3300 |
|
|---|
| 3301 | // Fullscreen action
|
|---|
| 3302 | fullscreenAct->setChecked( pref->fullscreen );
|
|---|
| 3303 |
|
|---|
| 3304 | // Time slider
|
|---|
| 3305 | if (core->state()==Core::Stopped) {
|
|---|
| 3306 | //FIXME
|
|---|
| 3307 | //timeslider->setValue( (int) core->mset.current_sec );
|
|---|
| 3308 | }
|
|---|
| 3309 |
|
|---|
| 3310 | // Video equalizer
|
|---|
| 3311 | videoEqualizerAct->setChecked( video_equalizer->isVisible() );
|
|---|
| 3312 |
|
|---|
| 3313 | // Audio equalizer
|
|---|
| 3314 | audioEqualizerAct->setChecked( audio_equalizer->isVisible() );
|
|---|
| 3315 |
|
|---|
| 3316 | // Playlist
|
|---|
| 3317 | #if !DOCK_PLAYLIST
|
|---|
| 3318 | //showPlaylistAct->setChecked( playlist->isVisible() );
|
|---|
| 3319 | #endif
|
|---|
| 3320 |
|
|---|
| 3321 | #if DOCK_PLAYLIST
|
|---|
| 3322 | showPlaylistAct->setChecked( playlist->isVisible() );
|
|---|
| 3323 | #endif
|
|---|
| 3324 |
|
|---|
| 3325 | // Compact mode
|
|---|
| 3326 | compactAct->setChecked( pref->compact_mode );
|
|---|
| 3327 |
|
|---|
| 3328 | // Stay on top
|
|---|
| 3329 | onTopActionGroup->setChecked( (int) pref->stay_on_top );
|
|---|
| 3330 |
|
|---|
| 3331 | // Flip
|
|---|
| 3332 | flipAct->setChecked( core->mset.flip );
|
|---|
| 3333 |
|
|---|
| 3334 | // Mirror
|
|---|
| 3335 | mirrorAct->setChecked( core->mset.mirror );
|
|---|
| 3336 |
|
|---|
| 3337 | // Use ass lib
|
|---|
| 3338 | useAssAct->setChecked( pref->use_ass_subtitles );
|
|---|
| 3339 |
|
|---|
| 3340 | // Forced subs
|
|---|
| 3341 | useForcedSubsOnlyAct->setChecked( pref->use_forced_subs_only );
|
|---|
| 3342 |
|
|---|
| 3343 | // Subtitle visibility
|
|---|
| 3344 | subVisibilityAct->setChecked(pref->sub_visibility);
|
|---|
| 3345 |
|
|---|
| 3346 | // Enable or disable subtitle options
|
|---|
| 3347 | bool e = ((core->mset.current_sub_id != MediaSettings::SubNone) &&
|
|---|
| 3348 | (core->mset.current_sub_id != MediaSettings::NoneSelected));
|
|---|
| 3349 |
|
|---|
| 3350 | if (core->mset.closed_caption_channel !=0 ) e = true; // Enable if using closed captions
|
|---|
| 3351 |
|
|---|
| 3352 | decSubDelayAct->setEnabled(e);
|
|---|
| 3353 | incSubDelayAct->setEnabled(e);
|
|---|
| 3354 | subDelayAct->setEnabled(e);
|
|---|
| 3355 | decSubPosAct->setEnabled(e);
|
|---|
| 3356 | incSubPosAct->setEnabled(e);
|
|---|
| 3357 | decSubScaleAct->setEnabled(e);
|
|---|
| 3358 | incSubScaleAct->setEnabled(e);
|
|---|
| 3359 | decSubStepAct->setEnabled(e);
|
|---|
| 3360 | incSubStepAct->setEnabled(e);
|
|---|
| 3361 | }
|
|---|
| 3362 |
|
|---|
| 3363 | void BaseGui::updateVideoEqualizer() {
|
|---|
| 3364 | // Equalizer
|
|---|
| 3365 | video_equalizer->contrast->setValue( core->mset.contrast );
|
|---|
| 3366 | video_equalizer->brightness->setValue( core->mset.brightness );
|
|---|
| 3367 | video_equalizer->hue->setValue( core->mset.hue );
|
|---|
| 3368 | video_equalizer->saturation->setValue( core->mset.saturation );
|
|---|
| 3369 | video_equalizer->gamma->setValue( core->mset.gamma );
|
|---|
| 3370 | }
|
|---|
| 3371 |
|
|---|
| 3372 | void BaseGui::updateAudioEqualizer() {
|
|---|
| 3373 | // Audio Equalizer
|
|---|
| 3374 | for (int n = 0; n < 10; n++) {
|
|---|
| 3375 | audio_equalizer->eq[n]->setValue( core->mset.audio_equalizer[n].toInt() );
|
|---|
| 3376 | }
|
|---|
| 3377 | }
|
|---|
| 3378 |
|
|---|
| 3379 | /*
|
|---|
| 3380 | void BaseGui::playlistVisibilityChanged() {
|
|---|
| 3381 | #if !DOCK_PLAYLIST
|
|---|
| 3382 | bool visible = playlist->isVisible();
|
|---|
| 3383 |
|
|---|
| 3384 | showPlaylistAct->setChecked( visible );
|
|---|
| 3385 | #endif
|
|---|
| 3386 | }
|
|---|
| 3387 | */
|
|---|
| 3388 |
|
|---|
| 3389 | /*
|
|---|
| 3390 | void BaseGui::openRecent(int item) {
|
|---|
| 3391 | qDebug("BaseGui::openRecent: %d", item);
|
|---|
| 3392 | if ((item > -1) && (item < RECENTS_CLEAR)) { // 1000 = Clear item
|
|---|
| 3393 | open( recents->item(item) );
|
|---|
| 3394 | }
|
|---|
| 3395 | }
|
|---|
| 3396 | */
|
|---|
| 3397 |
|
|---|
| 3398 | void BaseGui::openRecent() {
|
|---|
| 3399 | QAction *a = qobject_cast<QAction *> (sender());
|
|---|
| 3400 | if (a) {
|
|---|
| 3401 | int item = a->data().toInt();
|
|---|
| 3402 | qDebug("BaseGui::openRecent: %d", item);
|
|---|
| 3403 | QString file = pref->history_recents->item(item);
|
|---|
| 3404 |
|
|---|
| 3405 | if (pref->auto_add_to_playlist) {
|
|---|
| 3406 | if (playlist->maybeSave()) {
|
|---|
| 3407 | playlist->clear();
|
|---|
| 3408 | playlist->addFile(file, Playlist::NoGetInfo);
|
|---|
| 3409 |
|
|---|
| 3410 | open( file );
|
|---|
| 3411 | }
|
|---|
| 3412 | } else {
|
|---|
| 3413 | open( file );
|
|---|
| 3414 | }
|
|---|
| 3415 |
|
|---|
| 3416 | }
|
|---|
| 3417 | }
|
|---|
| 3418 |
|
|---|
| 3419 | void BaseGui::open(QString file) {
|
|---|
| 3420 | qDebug("BaseGui::open: '%s'", file.toUtf8().data());
|
|---|
| 3421 |
|
|---|
| 3422 | // If file is a playlist, open that playlist
|
|---|
| 3423 | QString extension = QFileInfo(file).suffix().toLower();
|
|---|
| 3424 | if ( (extension=="m3u") || (extension=="m3u8") ) {
|
|---|
| 3425 | playlist->load_m3u(file);
|
|---|
| 3426 | }
|
|---|
| 3427 | else
|
|---|
| 3428 | if (extension=="pls") {
|
|---|
| 3429 | playlist->load_pls(file);
|
|---|
| 3430 | }
|
|---|
| 3431 | else
|
|---|
| 3432 | if (QFileInfo(file).isDir()) {
|
|---|
| 3433 | openDirectory(file);
|
|---|
| 3434 | }
|
|---|
| 3435 | else {
|
|---|
| 3436 | // Let the core to open it, autodetecting the file type
|
|---|
| 3437 | //if (playlist->maybeSave()) {
|
|---|
| 3438 | // playlist->clear();
|
|---|
| 3439 | // playlist->addFile(file);
|
|---|
| 3440 |
|
|---|
| 3441 | core->open(file);
|
|---|
| 3442 | //}
|
|---|
| 3443 | }
|
|---|
| 3444 |
|
|---|
| 3445 | if (QFile::exists(file)) pref->latest_dir = QFileInfo(file).absolutePath();
|
|---|
| 3446 | }
|
|---|
| 3447 |
|
|---|
| 3448 | void BaseGui::openFiles(QStringList files) {
|
|---|
| 3449 | qDebug("BaseGui::openFiles");
|
|---|
| 3450 | if (files.empty()) return;
|
|---|
| 3451 |
|
|---|
| 3452 | if (files.count()==1) {
|
|---|
| 3453 | if (pref->auto_add_to_playlist) {
|
|---|
| 3454 | if (playlist->maybeSave()) {
|
|---|
| 3455 | playlist->clear();
|
|---|
| 3456 | playlist->addFile(files[0], Playlist::NoGetInfo);
|
|---|
| 3457 |
|
|---|
| 3458 | open(files[0]);
|
|---|
| 3459 | }
|
|---|
| 3460 | } else {
|
|---|
| 3461 | open(files[0]);
|
|---|
| 3462 | }
|
|---|
| 3463 | } else {
|
|---|
| 3464 | if (playlist->maybeSave()) {
|
|---|
| 3465 | playlist->clear();
|
|---|
| 3466 | playlist->addFiles(files);
|
|---|
| 3467 | open(files[0]);
|
|---|
| 3468 | }
|
|---|
| 3469 | }
|
|---|
| 3470 | }
|
|---|
| 3471 |
|
|---|
| 3472 | void BaseGui::openFavorite(QString file) {
|
|---|
| 3473 | qDebug("BaseGui::openFavorite");
|
|---|
| 3474 |
|
|---|
| 3475 | openFiles(QStringList() << file);
|
|---|
| 3476 | }
|
|---|
| 3477 |
|
|---|
| 3478 | void BaseGui::openURL() {
|
|---|
| 3479 | qDebug("BaseGui::openURL");
|
|---|
| 3480 |
|
|---|
| 3481 | exitFullscreenIfNeeded();
|
|---|
| 3482 |
|
|---|
| 3483 | /*
|
|---|
| 3484 | bool ok;
|
|---|
| 3485 | QString s = QInputDialog::getText(this,
|
|---|
| 3486 | tr("SMPlayer - Enter URL"), tr("URL:"), QLineEdit::Normal,
|
|---|
| 3487 | pref->last_url, &ok );
|
|---|
| 3488 |
|
|---|
| 3489 | if ( ok && !s.isEmpty() ) {
|
|---|
| 3490 |
|
|---|
| 3491 | //playlist->clear();
|
|---|
| 3492 | //playlistdock->hide();
|
|---|
| 3493 |
|
|---|
| 3494 | openURL(s);
|
|---|
| 3495 | } else {
|
|---|
| 3496 | // user entered nothing or pressed Cancel
|
|---|
| 3497 | }
|
|---|
| 3498 | */
|
|---|
| 3499 |
|
|---|
| 3500 | InputURL d(this);
|
|---|
| 3501 |
|
|---|
| 3502 | for (int n=0; n < pref->history_urls->count(); n++) {
|
|---|
| 3503 | d.setURL( pref->history_urls->url(n) );
|
|---|
| 3504 | }
|
|---|
| 3505 |
|
|---|
| 3506 | if (d.exec() == QDialog::Accepted ) {
|
|---|
| 3507 | QString url = d.url();
|
|---|
| 3508 | if (!url.isEmpty()) {
|
|---|
| 3509 | pref->history_urls->addUrl(url);
|
|---|
| 3510 | openURL(url);
|
|---|
| 3511 | }
|
|---|
| 3512 | }
|
|---|
| 3513 | }
|
|---|
| 3514 |
|
|---|
| 3515 | void BaseGui::openURL(QString url) {
|
|---|
| 3516 | if (!url.isEmpty()) {
|
|---|
| 3517 | //pref->history_urls->addUrl(url);
|
|---|
| 3518 |
|
|---|
| 3519 | if (pref->auto_add_to_playlist) {
|
|---|
| 3520 | if (playlist->maybeSave()) {
|
|---|
| 3521 | core->openStream(url);
|
|---|
| 3522 |
|
|---|
| 3523 | playlist->clear();
|
|---|
| 3524 | playlist->addFile(url, Playlist::NoGetInfo);
|
|---|
| 3525 | }
|
|---|
| 3526 | } else {
|
|---|
| 3527 | core->openStream(url);
|
|---|
| 3528 | }
|
|---|
| 3529 | }
|
|---|
| 3530 | }
|
|---|
| 3531 |
|
|---|
| 3532 |
|
|---|
| 3533 | void BaseGui::openFile() {
|
|---|
| 3534 | qDebug("BaseGui::fileOpen");
|
|---|
| 3535 |
|
|---|
| 3536 | exitFullscreenIfNeeded();
|
|---|
| 3537 |
|
|---|
| 3538 | Extensions e;
|
|---|
| 3539 | QString s = MyFileDialog::getOpenFileName(
|
|---|
| 3540 | this, tr("Choose a file"), pref->latest_dir,
|
|---|
| 3541 | tr("Multimedia") + e.allPlayable().forFilter()+";;" +
|
|---|
| 3542 | tr("Video") + e.video().forFilter()+";;" +
|
|---|
| 3543 | tr("Audio") + e.audio().forFilter()+";;" +
|
|---|
| 3544 | tr("Playlists") + e.playlist().forFilter()+";;" +
|
|---|
| 3545 | tr("All files") +" (*.*)" );
|
|---|
| 3546 |
|
|---|
| 3547 | if ( !s.isEmpty() ) {
|
|---|
| 3548 | openFile(s);
|
|---|
| 3549 | }
|
|---|
| 3550 | }
|
|---|
| 3551 |
|
|---|
| 3552 | void BaseGui::openFile(QString file) {
|
|---|
| 3553 | qDebug("BaseGui::openFile: '%s'", file.toUtf8().data());
|
|---|
| 3554 |
|
|---|
| 3555 | if ( !file.isEmpty() ) {
|
|---|
| 3556 |
|
|---|
| 3557 | //playlist->clear();
|
|---|
| 3558 | //playlistdock->hide();
|
|---|
| 3559 |
|
|---|
| 3560 | // If file is a playlist, open that playlist
|
|---|
| 3561 | QString extension = QFileInfo(file).suffix().toLower();
|
|---|
| 3562 | if ( (extension=="m3u") || (extension=="m3u8") ) {
|
|---|
| 3563 | playlist->load_m3u(file);
|
|---|
| 3564 | }
|
|---|
| 3565 | else
|
|---|
| 3566 | if (extension=="pls") {
|
|---|
| 3567 | playlist->load_pls(file);
|
|---|
| 3568 | }
|
|---|
| 3569 | else
|
|---|
| 3570 | if (extension=="iso") {
|
|---|
| 3571 | if (playlist->maybeSave()) {
|
|---|
| 3572 | core->open(file);
|
|---|
| 3573 | }
|
|---|
| 3574 | }
|
|---|
| 3575 | else {
|
|---|
| 3576 | if (pref->auto_add_to_playlist) {
|
|---|
| 3577 | if (playlist->maybeSave()) {
|
|---|
| 3578 | core->openFile(file);
|
|---|
| 3579 |
|
|---|
| 3580 | playlist->clear();
|
|---|
| 3581 | playlist->addFile(file, Playlist::NoGetInfo);
|
|---|
| 3582 | }
|
|---|
| 3583 | } else {
|
|---|
| 3584 | core->openFile(file);
|
|---|
| 3585 | }
|
|---|
| 3586 | }
|
|---|
| 3587 | if (QFile::exists(file)) pref->latest_dir = QFileInfo(file).absolutePath();
|
|---|
| 3588 | }
|
|---|
| 3589 | }
|
|---|
| 3590 |
|
|---|
| 3591 | void BaseGui::configureDiscDevices() {
|
|---|
| 3592 | QMessageBox::information( this, tr("SMPlayer - Information"),
|
|---|
| 3593 | tr("The CDROM / DVD drives are not configured yet.\n"
|
|---|
| 3594 | "The configuration dialog will be shown now, "
|
|---|
| 3595 | "so you can do it."), QMessageBox::Ok);
|
|---|
| 3596 |
|
|---|
| 3597 | showPreferencesDialog();
|
|---|
| 3598 | pref_dialog->showSection( PreferencesDialog::Drives );
|
|---|
| 3599 | }
|
|---|
| 3600 |
|
|---|
| 3601 | void BaseGui::openVCD() {
|
|---|
| 3602 | qDebug("BaseGui::openVCD");
|
|---|
| 3603 |
|
|---|
| 3604 | if ( (pref->dvd_device.isEmpty()) ||
|
|---|
| 3605 | (pref->cdrom_device.isEmpty()) )
|
|---|
| 3606 | {
|
|---|
| 3607 | configureDiscDevices();
|
|---|
| 3608 | } else {
|
|---|
| 3609 | if (playlist->maybeSave()) {
|
|---|
| 3610 | core->openVCD( pref->vcd_initial_title );
|
|---|
| 3611 | }
|
|---|
| 3612 | }
|
|---|
| 3613 | }
|
|---|
| 3614 |
|
|---|
| 3615 | void BaseGui::openAudioCD() {
|
|---|
| 3616 | qDebug("BaseGui::openAudioCD");
|
|---|
| 3617 |
|
|---|
| 3618 | if ( (pref->dvd_device.isEmpty()) ||
|
|---|
| 3619 | (pref->cdrom_device.isEmpty()) )
|
|---|
| 3620 | {
|
|---|
| 3621 | configureDiscDevices();
|
|---|
| 3622 | } else {
|
|---|
| 3623 | if (playlist->maybeSave()) {
|
|---|
| 3624 | core->openAudioCD();
|
|---|
| 3625 | }
|
|---|
| 3626 | }
|
|---|
| 3627 | }
|
|---|
| 3628 |
|
|---|
| 3629 | void BaseGui::openDVD() {
|
|---|
| 3630 | qDebug("BaseGui::openDVD");
|
|---|
| 3631 |
|
|---|
| 3632 | if ( (pref->dvd_device.isEmpty()) ||
|
|---|
| 3633 | (pref->cdrom_device.isEmpty()) )
|
|---|
| 3634 | {
|
|---|
| 3635 | configureDiscDevices();
|
|---|
| 3636 | } else {
|
|---|
| 3637 | if (playlist->maybeSave()) {
|
|---|
| 3638 | #if DVDNAV_SUPPORT
|
|---|
| 3639 | core->openDVD( DiscName::joinDVD(pref->use_dvdnav ? 0: 1, pref->dvd_device, pref->use_dvdnav) );
|
|---|
| 3640 | #else
|
|---|
| 3641 | core->openDVD( DiscName::joinDVD(1, pref->dvd_device, false) );
|
|---|
| 3642 | #endif
|
|---|
| 3643 | }
|
|---|
| 3644 | }
|
|---|
| 3645 | }
|
|---|
| 3646 |
|
|---|
| 3647 | void BaseGui::openDVDFromFolder() {
|
|---|
| 3648 | qDebug("BaseGui::openDVDFromFolder");
|
|---|
| 3649 |
|
|---|
| 3650 | if (playlist->maybeSave()) {
|
|---|
| 3651 | InputDVDDirectory *d = new InputDVDDirectory(this);
|
|---|
| 3652 | d->setFolder( pref->last_dvd_directory );
|
|---|
| 3653 |
|
|---|
| 3654 | if (d->exec() == QDialog::Accepted) {
|
|---|
| 3655 | qDebug("BaseGui::openDVDFromFolder: accepted");
|
|---|
| 3656 | openDVDFromFolder( d->folder() );
|
|---|
| 3657 | }
|
|---|
| 3658 |
|
|---|
| 3659 | delete d;
|
|---|
| 3660 | }
|
|---|
| 3661 | }
|
|---|
| 3662 |
|
|---|
| 3663 | void BaseGui::openDVDFromFolder(QString directory) {
|
|---|
| 3664 | pref->last_dvd_directory = directory;
|
|---|
| 3665 | #if DVDNAV_SUPPORT
|
|---|
| 3666 | core->openDVD( DiscName::joinDVD(pref->use_dvdnav ? 0: 1, directory, pref->use_dvdnav) );
|
|---|
| 3667 | #else
|
|---|
| 3668 | core->openDVD( DiscName::joinDVD(1, directory, false) );
|
|---|
| 3669 | #endif
|
|---|
| 3670 | }
|
|---|
| 3671 |
|
|---|
| 3672 | void BaseGui::openDirectory() {
|
|---|
| 3673 | qDebug("BaseGui::openDirectory");
|
|---|
| 3674 |
|
|---|
| 3675 | QString s = MyFileDialog::getExistingDirectory(
|
|---|
| 3676 | this, tr("Choose a directory"),
|
|---|
| 3677 | pref->latest_dir );
|
|---|
| 3678 |
|
|---|
| 3679 | if (!s.isEmpty()) {
|
|---|
| 3680 | openDirectory(s);
|
|---|
| 3681 | }
|
|---|
| 3682 | }
|
|---|
| 3683 |
|
|---|
| 3684 | void BaseGui::openDirectory(QString directory) {
|
|---|
| 3685 | qDebug("BaseGui::openDirectory: '%s'", directory.toUtf8().data());
|
|---|
| 3686 |
|
|---|
| 3687 | if (Helper::directoryContainsDVD(directory)) {
|
|---|
| 3688 | core->open(directory);
|
|---|
| 3689 | }
|
|---|
| 3690 | else {
|
|---|
| 3691 | QFileInfo fi(directory);
|
|---|
| 3692 | if ( (fi.exists()) && (fi.isDir()) ) {
|
|---|
| 3693 | playlist->clear();
|
|---|
| 3694 | //playlist->addDirectory(directory);
|
|---|
| 3695 | playlist->addDirectory( fi.absoluteFilePath() );
|
|---|
| 3696 | playlist->startPlay();
|
|---|
| 3697 | } else {
|
|---|
| 3698 | qDebug("BaseGui::openDirectory: directory is not valid");
|
|---|
| 3699 | }
|
|---|
| 3700 | }
|
|---|
| 3701 | }
|
|---|
| 3702 |
|
|---|
| 3703 | void BaseGui::loadSub() {
|
|---|
| 3704 | qDebug("BaseGui::loadSub");
|
|---|
| 3705 |
|
|---|
| 3706 | exitFullscreenIfNeeded();
|
|---|
| 3707 |
|
|---|
| 3708 | Extensions e;
|
|---|
| 3709 | QString s = MyFileDialog::getOpenFileName(
|
|---|
| 3710 | this, tr("Choose a file"),
|
|---|
| 3711 | pref->latest_dir,
|
|---|
| 3712 | tr("Subtitles") + e.subtitles().forFilter()+ ";;" +
|
|---|
| 3713 | tr("All files") +" (*.*)" );
|
|---|
| 3714 |
|
|---|
| 3715 | if (!s.isEmpty()) core->loadSub(s);
|
|---|
| 3716 | }
|
|---|
| 3717 |
|
|---|
| 3718 | void BaseGui::setInitialSubtitle(const QString & subtitle_file) {
|
|---|
| 3719 | qDebug("BaseGui::setInitialSubtitle: '%s'", subtitle_file.toUtf8().constData());
|
|---|
| 3720 |
|
|---|
| 3721 | core->setInitialSubtitle(subtitle_file);
|
|---|
| 3722 | }
|
|---|
| 3723 |
|
|---|
| 3724 | void BaseGui::loadAudioFile() {
|
|---|
| 3725 | qDebug("BaseGui::loadAudioFile");
|
|---|
| 3726 |
|
|---|
| 3727 | exitFullscreenIfNeeded();
|
|---|
| 3728 |
|
|---|
| 3729 | Extensions e;
|
|---|
| 3730 | QString s = MyFileDialog::getOpenFileName(
|
|---|
| 3731 | this, tr("Choose a file"),
|
|---|
| 3732 | pref->latest_dir,
|
|---|
| 3733 | tr("Audio") + e.audio().forFilter()+";;" +
|
|---|
| 3734 | tr("All files") +" (*.*)" );
|
|---|
| 3735 |
|
|---|
| 3736 | if (!s.isEmpty()) core->loadAudioFile(s);
|
|---|
| 3737 | }
|
|---|
| 3738 |
|
|---|
| 3739 | void BaseGui::helpFAQ() {
|
|---|
| 3740 | QUrl url = QUrl::fromLocalFile(Paths::doc("faq.html", pref->language));
|
|---|
| 3741 | qDebug("BaseGui::helpFAQ: file to open %s", url.toString().toUtf8().data());
|
|---|
| 3742 | QDesktopServices::openUrl( url );
|
|---|
| 3743 | }
|
|---|
| 3744 |
|
|---|
| 3745 | void BaseGui::helpCLOptions() {
|
|---|
| 3746 | if (clhelp_window == 0) {
|
|---|
| 3747 | clhelp_window = new LogWindow(this);
|
|---|
| 3748 | }
|
|---|
| 3749 | clhelp_window->setWindowTitle( tr("SMPlayer command line options") );
|
|---|
| 3750 | clhelp_window->setHtml(CLHelp::help(true));
|
|---|
| 3751 | clhelp_window->show();
|
|---|
| 3752 | }
|
|---|
| 3753 |
|
|---|
| 3754 | void BaseGui::helpCheckUpdates() {
|
|---|
| 3755 | QString url = "http://smplayer.sourceforge.net/latest.php";
|
|---|
| 3756 | if (!pref->language.isEmpty()) url += QString("?tr_lang=%1").arg(pref->language);
|
|---|
| 3757 | QDesktopServices::openUrl( QUrl(url) );
|
|---|
| 3758 | }
|
|---|
| 3759 |
|
|---|
| 3760 | void BaseGui::helpDonate() {
|
|---|
| 3761 | QMessageBox d(QMessageBox::NoIcon, tr("Donate"),
|
|---|
| 3762 | tr("If you like SMPlayer, a really good way to support it is by sending a donation, even the smallest one is highly appreciated.") + "<br>" +
|
|---|
| 3763 | tr("You can send your donation using %1.").arg("<a href=\"https://sourceforge.net/donate/index.php?group_id=185512\">"+tr("this form")),
|
|---|
| 3764 | QMessageBox::Ok, this);
|
|---|
| 3765 | d.setIconPixmap( Images::icon("logo", 64) );
|
|---|
| 3766 | d.exec();
|
|---|
| 3767 | }
|
|---|
| 3768 |
|
|---|
| 3769 | void BaseGui::helpAbout() {
|
|---|
| 3770 | About d(this);
|
|---|
| 3771 | d.exec();
|
|---|
| 3772 | }
|
|---|
| 3773 |
|
|---|
| 3774 | void BaseGui::helpAboutQt() {
|
|---|
| 3775 | QMessageBox::aboutQt(this, tr("About Qt") );
|
|---|
| 3776 | }
|
|---|
| 3777 |
|
|---|
| 3778 | void BaseGui::showGotoDialog() {
|
|---|
| 3779 | TimeDialog d(this);
|
|---|
| 3780 | d.setLabel(tr("&Jump to:"));
|
|---|
| 3781 | d.setWindowTitle(tr("SMPlayer - Seek"));
|
|---|
| 3782 | d.setMaximumTime( (int) core->mdat.duration);
|
|---|
| 3783 | d.setTime( (int) core->mset.current_sec);
|
|---|
| 3784 | if (d.exec() == QDialog::Accepted) {
|
|---|
| 3785 | core->goToSec( d.time() );
|
|---|
| 3786 | }
|
|---|
| 3787 | }
|
|---|
| 3788 |
|
|---|
| 3789 | void BaseGui::showAudioDelayDialog() {
|
|---|
| 3790 | bool ok;
|
|---|
| 3791 | int delay = QInputDialog::getInteger(this, tr("SMPlayer - Audio delay"),
|
|---|
| 3792 | tr("Audio delay (in milliseconds):"), core->mset.audio_delay,
|
|---|
| 3793 | -3600000, 3600000, 1, &ok);
|
|---|
| 3794 | if (ok) {
|
|---|
| 3795 | core->setAudioDelay(delay);
|
|---|
| 3796 | }
|
|---|
| 3797 | }
|
|---|
| 3798 |
|
|---|
| 3799 | void BaseGui::showSubDelayDialog() {
|
|---|
| 3800 | bool ok;
|
|---|
| 3801 | int delay = QInputDialog::getInteger(this, tr("SMPlayer - Subtitle delay"),
|
|---|
| 3802 | tr("Subtitle delay (in milliseconds):"), core->mset.sub_delay,
|
|---|
| 3803 | -3600000, 3600000, 1, &ok);
|
|---|
| 3804 | if (ok) {
|
|---|
| 3805 | core->setSubDelay(delay);
|
|---|
| 3806 | }
|
|---|
| 3807 | }
|
|---|
| 3808 |
|
|---|
| 3809 | void BaseGui::exitFullscreen() {
|
|---|
| 3810 | if (pref->fullscreen) {
|
|---|
| 3811 | toggleFullscreen(false);
|
|---|
| 3812 | }
|
|---|
| 3813 | }
|
|---|
| 3814 |
|
|---|
| 3815 | void BaseGui::toggleFullscreen() {
|
|---|
| 3816 | qDebug("BaseGui::toggleFullscreen");
|
|---|
| 3817 |
|
|---|
| 3818 | toggleFullscreen(!pref->fullscreen);
|
|---|
| 3819 | }
|
|---|
| 3820 |
|
|---|
| 3821 | void BaseGui::toggleFullscreen(bool b) {
|
|---|
| 3822 | qDebug("BaseGui::toggleFullscreen: %d", b);
|
|---|
| 3823 |
|
|---|
| 3824 | if (b==pref->fullscreen) {
|
|---|
| 3825 | // Nothing to do
|
|---|
| 3826 | qDebug("BaseGui::toggleFullscreen: nothing to do, returning");
|
|---|
| 3827 | return;
|
|---|
| 3828 | }
|
|---|
| 3829 |
|
|---|
| 3830 | pref->fullscreen = b;
|
|---|
| 3831 |
|
|---|
| 3832 | // If using mplayer window
|
|---|
| 3833 | if (pref->use_mplayer_window) {
|
|---|
| 3834 | core->tellmp("vo_fullscreen " + QString::number(b) );
|
|---|
| 3835 | updateWidgets();
|
|---|
| 3836 | return;
|
|---|
| 3837 | }
|
|---|
| 3838 |
|
|---|
| 3839 | if (!panel->isVisible()) return; // mplayer window is not used.
|
|---|
| 3840 |
|
|---|
| 3841 | if (pref->fullscreen) {
|
|---|
| 3842 | compactAct->setEnabled(false);
|
|---|
| 3843 |
|
|---|
| 3844 | if (pref->restore_pos_after_fullscreen) {
|
|---|
| 3845 | win_pos = pos();
|
|---|
| 3846 | win_size = size();
|
|---|
| 3847 | }
|
|---|
| 3848 |
|
|---|
| 3849 | was_maximized = isMaximized();
|
|---|
| 3850 | qDebug("BaseGui::toggleFullscreen: was_maximized: %d", was_maximized);
|
|---|
| 3851 |
|
|---|
| 3852 | aboutToEnterFullscreen();
|
|---|
| 3853 |
|
|---|
| 3854 | #ifdef Q_OS_WIN
|
|---|
| 3855 | // Hack to avoid the windows taskbar to be visible on Windows XP
|
|---|
| 3856 | if (QSysInfo::WindowsVersion < QSysInfo::WV_VISTA) {
|
|---|
| 3857 | if (!pref->pause_when_hidden) hide();
|
|---|
| 3858 | }
|
|---|
| 3859 | #endif
|
|---|
| 3860 |
|
|---|
| 3861 | showFullScreen();
|
|---|
| 3862 |
|
|---|
| 3863 | } else {
|
|---|
| 3864 | showNormal();
|
|---|
| 3865 |
|
|---|
| 3866 | if (was_maximized) showMaximized(); // It has to be called after showNormal()
|
|---|
| 3867 |
|
|---|
| 3868 | aboutToExitFullscreen();
|
|---|
| 3869 |
|
|---|
| 3870 | if (pref->restore_pos_after_fullscreen) {
|
|---|
| 3871 | move( win_pos );
|
|---|
| 3872 | resize( win_size );
|
|---|
| 3873 | }
|
|---|
| 3874 |
|
|---|
| 3875 | compactAct->setEnabled(true);
|
|---|
| 3876 | }
|
|---|
| 3877 |
|
|---|
| 3878 | updateWidgets();
|
|---|
| 3879 |
|
|---|
| 3880 | if ((pref->add_blackborders_on_fullscreen) &&
|
|---|
| 3881 | (!core->mset.add_letterbox))
|
|---|
| 3882 | {
|
|---|
| 3883 | core->restart();
|
|---|
| 3884 | }
|
|---|
| 3885 |
|
|---|
| 3886 | setFocus(); // Fixes bug #2493415
|
|---|
| 3887 | }
|
|---|
| 3888 |
|
|---|
| 3889 |
|
|---|
| 3890 | void BaseGui::aboutToEnterFullscreen() {
|
|---|
| 3891 | if (!pref->compact_mode) {
|
|---|
| 3892 | menuBar()->hide();
|
|---|
| 3893 | statusBar()->hide();
|
|---|
| 3894 | }
|
|---|
| 3895 | }
|
|---|
| 3896 |
|
|---|
| 3897 | void BaseGui::aboutToExitFullscreen() {
|
|---|
| 3898 | if (!pref->compact_mode) {
|
|---|
| 3899 | menuBar()->show();
|
|---|
| 3900 | statusBar()->show();
|
|---|
| 3901 | }
|
|---|
| 3902 | }
|
|---|
| 3903 |
|
|---|
| 3904 |
|
|---|
| 3905 | void BaseGui::leftClickFunction() {
|
|---|
| 3906 | qDebug("BaseGui::leftClickFunction");
|
|---|
| 3907 |
|
|---|
| 3908 | if (!pref->mouse_left_click_function.isEmpty()) {
|
|---|
| 3909 | processFunction(pref->mouse_left_click_function);
|
|---|
| 3910 | }
|
|---|
| 3911 | }
|
|---|
| 3912 |
|
|---|
| 3913 | void BaseGui::rightClickFunction() {
|
|---|
| 3914 | qDebug("BaseGui::rightClickFunction");
|
|---|
| 3915 |
|
|---|
| 3916 | if (!pref->mouse_right_click_function.isEmpty()) {
|
|---|
| 3917 | processFunction(pref->mouse_right_click_function);
|
|---|
| 3918 | }
|
|---|
| 3919 | }
|
|---|
| 3920 |
|
|---|
| 3921 | void BaseGui::doubleClickFunction() {
|
|---|
| 3922 | qDebug("BaseGui::doubleClickFunction");
|
|---|
| 3923 |
|
|---|
| 3924 | if (!pref->mouse_double_click_function.isEmpty()) {
|
|---|
| 3925 | processFunction(pref->mouse_double_click_function);
|
|---|
| 3926 | }
|
|---|
| 3927 | }
|
|---|
| 3928 |
|
|---|
| 3929 | void BaseGui::middleClickFunction() {
|
|---|
| 3930 | qDebug("BaseGui::middleClickFunction");
|
|---|
| 3931 |
|
|---|
| 3932 | if (!pref->mouse_middle_click_function.isEmpty()) {
|
|---|
| 3933 | processFunction(pref->mouse_middle_click_function);
|
|---|
| 3934 | }
|
|---|
| 3935 | }
|
|---|
| 3936 |
|
|---|
| 3937 | void BaseGui::xbutton1ClickFunction() {
|
|---|
| 3938 | qDebug("BaseGui::xbutton1ClickFunction");
|
|---|
| 3939 |
|
|---|
| 3940 | if (!pref->mouse_xbutton1_click_function.isEmpty()) {
|
|---|
| 3941 | processFunction(pref->mouse_xbutton1_click_function);
|
|---|
| 3942 | }
|
|---|
| 3943 | }
|
|---|
| 3944 |
|
|---|
| 3945 | void BaseGui::xbutton2ClickFunction() {
|
|---|
| 3946 | qDebug("BaseGui::xbutton2ClickFunction");
|
|---|
| 3947 |
|
|---|
| 3948 | if (!pref->mouse_xbutton2_click_function.isEmpty()) {
|
|---|
| 3949 | processFunction(pref->mouse_xbutton2_click_function);
|
|---|
| 3950 | }
|
|---|
| 3951 | }
|
|---|
| 3952 |
|
|---|
| 3953 | void BaseGui::processFunction(QString function) {
|
|---|
| 3954 | qDebug("BaseGui::processFunction: '%s'", function.toUtf8().data());
|
|---|
| 3955 |
|
|---|
| 3956 | //parse args for checkable actions
|
|---|
| 3957 | QRegExp func_rx("(.*) (true|false)");
|
|---|
| 3958 | bool value = false;
|
|---|
| 3959 | bool checkableFunction = false;
|
|---|
| 3960 |
|
|---|
| 3961 | if(func_rx.indexIn(function) > -1){
|
|---|
| 3962 | function = func_rx.cap(1);
|
|---|
| 3963 | value = (func_rx.cap(2) == "true");
|
|---|
| 3964 | checkableFunction = true;
|
|---|
| 3965 | } //end if
|
|---|
| 3966 |
|
|---|
| 3967 | QAction * action = ActionsEditor::findAction(this, function);
|
|---|
| 3968 | if (!action) action = ActionsEditor::findAction(playlist, function);
|
|---|
| 3969 |
|
|---|
| 3970 | if (action) {
|
|---|
| 3971 | qDebug("BaseGui::processFunction: action found");
|
|---|
| 3972 |
|
|---|
| 3973 | if (!action->isEnabled()) {
|
|---|
| 3974 | qDebug("BaseGui::processFunction: action is disabled, doing nothing");
|
|---|
| 3975 | return;
|
|---|
| 3976 | }
|
|---|
| 3977 |
|
|---|
| 3978 | if (action->isCheckable()){
|
|---|
| 3979 | if(checkableFunction)
|
|---|
| 3980 | action->setChecked(value);
|
|---|
| 3981 | else
|
|---|
| 3982 | //action->toggle();
|
|---|
| 3983 | action->trigger();
|
|---|
| 3984 | }else{
|
|---|
| 3985 | action->trigger();
|
|---|
| 3986 | }
|
|---|
| 3987 | }
|
|---|
| 3988 | }
|
|---|
| 3989 |
|
|---|
| 3990 | void BaseGui::runActions(QString actions) {
|
|---|
| 3991 | qDebug("BaseGui::runActions");
|
|---|
| 3992 |
|
|---|
| 3993 | actions = actions.simplified(); // Remove white space
|
|---|
| 3994 |
|
|---|
| 3995 | QAction * action;
|
|---|
| 3996 | QStringList actionsList = actions.split(" ");
|
|---|
| 3997 |
|
|---|
| 3998 | for (int n = 0; n < actionsList.count(); n++) {
|
|---|
| 3999 | QString actionStr = actionsList[n];
|
|---|
| 4000 | QString par = ""; //the parameter which the action takes
|
|---|
| 4001 |
|
|---|
| 4002 | //set par if the next word is a boolean value
|
|---|
| 4003 | if ( (n+1) < actionsList.count() ) {
|
|---|
| 4004 | if ( (actionsList[n+1].toLower() == "true") || (actionsList[n+1].toLower() == "false") ) {
|
|---|
| 4005 | par = actionsList[n+1].toLower();
|
|---|
| 4006 | n++;
|
|---|
| 4007 | } //end if
|
|---|
| 4008 | } //end if
|
|---|
| 4009 |
|
|---|
| 4010 | action = ActionsEditor::findAction(this, actionStr);
|
|---|
| 4011 | if (!action) action = ActionsEditor::findAction(playlist, actionStr);
|
|---|
| 4012 |
|
|---|
| 4013 | if (action) {
|
|---|
| 4014 | qDebug("BaseGui::runActions: running action: '%s' (par: '%s')",
|
|---|
| 4015 | actionStr.toUtf8().data(), par.toUtf8().data() );
|
|---|
| 4016 |
|
|---|
| 4017 | if (action->isCheckable()) {
|
|---|
| 4018 | if (par.isEmpty()) {
|
|---|
| 4019 | //action->toggle();
|
|---|
| 4020 | action->trigger();
|
|---|
| 4021 | } else {
|
|---|
| 4022 | action->setChecked( (par == "true") );
|
|---|
| 4023 | } //end if
|
|---|
| 4024 | } else {
|
|---|
| 4025 | action->trigger();
|
|---|
| 4026 | } //end if
|
|---|
| 4027 | } else {
|
|---|
| 4028 | qWarning("BaseGui::runActions: action: '%s' not found",actionStr.toUtf8().data());
|
|---|
| 4029 | } //end if
|
|---|
| 4030 | } //end for
|
|---|
| 4031 | }
|
|---|
| 4032 |
|
|---|
| 4033 | void BaseGui::checkPendingActionsToRun() {
|
|---|
| 4034 | qDebug("BaseGui::checkPendingActionsToRun");
|
|---|
| 4035 |
|
|---|
| 4036 | QString actions;
|
|---|
| 4037 | if (!pending_actions_to_run.isEmpty()) {
|
|---|
| 4038 | actions = pending_actions_to_run;
|
|---|
| 4039 | pending_actions_to_run.clear();
|
|---|
| 4040 | if (!pref->actions_to_run.isEmpty()) {
|
|---|
| 4041 | actions = pref->actions_to_run +" "+ actions;
|
|---|
| 4042 | }
|
|---|
| 4043 | } else {
|
|---|
| 4044 | actions = pref->actions_to_run;
|
|---|
| 4045 | }
|
|---|
| 4046 |
|
|---|
| 4047 | if (!actions.isEmpty()) {
|
|---|
| 4048 | qDebug("BaseGui::checkPendingActionsToRun: actions: '%s'", actions.toUtf8().constData());
|
|---|
| 4049 | runActions(actions);
|
|---|
| 4050 | }
|
|---|
| 4051 | }
|
|---|
| 4052 |
|
|---|
| 4053 | #if REPORT_OLD_MPLAYER
|
|---|
| 4054 | void BaseGui::checkMplayerVersion() {
|
|---|
| 4055 | qDebug("BaseGui::checkMplayerVersion");
|
|---|
| 4056 |
|
|---|
| 4057 | // Qt 4.3.5 is crazy, I can't popup a messagebox here, it calls
|
|---|
| 4058 | // this function once and again when the messagebox is shown
|
|---|
| 4059 |
|
|---|
| 4060 | if ( (pref->mplayer_detected_version > 0) && (!MplayerVersion::isMplayerAtLeast(25158)) ) {
|
|---|
| 4061 | QTimer::singleShot(1000, this, SLOT(displayWarningAboutOldMplayer()));
|
|---|
| 4062 | }
|
|---|
| 4063 | }
|
|---|
| 4064 |
|
|---|
| 4065 | void BaseGui::displayWarningAboutOldMplayer() {
|
|---|
| 4066 | qDebug("BaseGui::displayWarningAboutOldMplayer");
|
|---|
| 4067 |
|
|---|
| 4068 | if (!pref->reported_mplayer_is_old) {
|
|---|
| 4069 | QMessageBox::warning(this, tr("Warning - Using old MPlayer"),
|
|---|
| 4070 | tr("The version of MPlayer (%1) installed on your system "
|
|---|
| 4071 | "is obsolete. SMPlayer can't work well with it: some "
|
|---|
| 4072 | "options won't work, subtitle selection may fail...")
|
|---|
| 4073 | .arg(MplayerVersion::toString(pref->mplayer_detected_version)) +
|
|---|
| 4074 | "<br><br>" +
|
|---|
| 4075 | tr("Please, update your MPlayer.") +
|
|---|
| 4076 | "<br><br>" +
|
|---|
| 4077 | tr("(This warning won't be displayed anymore)") );
|
|---|
| 4078 |
|
|---|
| 4079 | pref->reported_mplayer_is_old = true;
|
|---|
| 4080 | }
|
|---|
| 4081 | //else
|
|---|
| 4082 | //statusBar()->showMessage( tr("Using an old MPlayer, please update it"), 10000 );
|
|---|
| 4083 | }
|
|---|
| 4084 | #endif
|
|---|
| 4085 |
|
|---|
| 4086 | void BaseGui::dragEnterEvent( QDragEnterEvent *e ) {
|
|---|
| 4087 | qDebug("BaseGui::dragEnterEvent");
|
|---|
| 4088 |
|
|---|
| 4089 | if (e->mimeData()->hasUrls()) {
|
|---|
| 4090 | e->acceptProposedAction();
|
|---|
| 4091 | }
|
|---|
| 4092 | }
|
|---|
| 4093 |
|
|---|
| 4094 |
|
|---|
| 4095 |
|
|---|
| 4096 | void BaseGui::dropEvent( QDropEvent *e ) {
|
|---|
| 4097 | qDebug("BaseGui::dropEvent");
|
|---|
| 4098 |
|
|---|
| 4099 | QStringList files;
|
|---|
| 4100 |
|
|---|
| 4101 | if (e->mimeData()->hasUrls()) {
|
|---|
| 4102 | QList <QUrl> l = e->mimeData()->urls();
|
|---|
| 4103 | QString s;
|
|---|
| 4104 | for (int n=0; n < l.count(); n++) {
|
|---|
| 4105 | if (l[n].isValid()) {
|
|---|
| 4106 | qDebug("BaseGui::dropEvent: scheme: '%s'", l[n].scheme().toUtf8().data());
|
|---|
| 4107 | if (l[n].scheme() == "file")
|
|---|
| 4108 | s = l[n].toLocalFile();
|
|---|
| 4109 | else
|
|---|
| 4110 | s = l[n].toString();
|
|---|
| 4111 | /*
|
|---|
| 4112 | qDebug(" * '%s'", l[n].toString().toUtf8().data());
|
|---|
| 4113 | qDebug(" * '%s'", l[n].toLocalFile().toUtf8().data());
|
|---|
| 4114 | */
|
|---|
| 4115 | qDebug("BaseGui::dropEvent: file: '%s'", s.toUtf8().data());
|
|---|
| 4116 | files.append(s);
|
|---|
| 4117 | }
|
|---|
| 4118 | }
|
|---|
| 4119 | }
|
|---|
| 4120 |
|
|---|
| 4121 |
|
|---|
| 4122 | qDebug( "BaseGui::dropEvent: count: %d", files.count());
|
|---|
| 4123 | if (files.count() > 0) {
|
|---|
| 4124 | if (files.count() == 1) {
|
|---|
| 4125 | QFileInfo fi( files[0] );
|
|---|
| 4126 |
|
|---|
| 4127 | Extensions e;
|
|---|
| 4128 | QRegExp ext_sub(e.subtitles().forRegExp());
|
|---|
| 4129 | ext_sub.setCaseSensitivity(Qt::CaseInsensitive);
|
|---|
| 4130 | if (ext_sub.indexIn(fi.suffix()) > -1) {
|
|---|
| 4131 | qDebug( "BaseGui::dropEvent: loading sub: '%s'", files[0].toUtf8().data());
|
|---|
| 4132 | core->loadSub( files[0] );
|
|---|
| 4133 | }
|
|---|
| 4134 | else
|
|---|
| 4135 | if (fi.isDir()) {
|
|---|
| 4136 | openDirectory( files[0] );
|
|---|
| 4137 | } else {
|
|---|
| 4138 | //openFile( files[0] );
|
|---|
| 4139 | if (pref->auto_add_to_playlist) {
|
|---|
| 4140 | if (playlist->maybeSave()) {
|
|---|
| 4141 | playlist->clear();
|
|---|
| 4142 | playlist->addFile(files[0], Playlist::NoGetInfo);
|
|---|
| 4143 |
|
|---|
| 4144 | open( files[0] );
|
|---|
| 4145 | }
|
|---|
| 4146 | } else {
|
|---|
| 4147 | open( files[0] );
|
|---|
| 4148 | }
|
|---|
| 4149 | }
|
|---|
| 4150 | } else {
|
|---|
| 4151 | // More than one file
|
|---|
| 4152 | qDebug("BaseGui::dropEvent: adding files to playlist");
|
|---|
| 4153 | playlist->clear();
|
|---|
| 4154 | playlist->addFiles(files);
|
|---|
| 4155 | //openFile( files[0] );
|
|---|
| 4156 | playlist->startPlay();
|
|---|
| 4157 | }
|
|---|
| 4158 | }
|
|---|
| 4159 | }
|
|---|
| 4160 |
|
|---|
| 4161 | void BaseGui::showPopupMenu() {
|
|---|
| 4162 | showPopupMenu(QCursor::pos());
|
|---|
| 4163 | }
|
|---|
| 4164 |
|
|---|
| 4165 | void BaseGui::showPopupMenu( QPoint p ) {
|
|---|
| 4166 | //qDebug("BaseGui::showPopupMenu: %d, %d", p.x(), p.y());
|
|---|
| 4167 | popup->move( p );
|
|---|
| 4168 | popup->show();
|
|---|
| 4169 | }
|
|---|
| 4170 |
|
|---|
| 4171 | /*
|
|---|
| 4172 | void BaseGui::mouseReleaseEvent( QMouseEvent * e ) {
|
|---|
| 4173 | qDebug("BaseGui::mouseReleaseEvent");
|
|---|
| 4174 |
|
|---|
| 4175 | if (e->button() == Qt::LeftButton) {
|
|---|
| 4176 | e->accept();
|
|---|
| 4177 | emit leftClicked();
|
|---|
| 4178 | }
|
|---|
| 4179 | else
|
|---|
| 4180 | if (e->button() == Qt::MidButton) {
|
|---|
| 4181 | e->accept();
|
|---|
| 4182 | emit middleClicked();
|
|---|
| 4183 | }
|
|---|
| 4184 | //
|
|---|
| 4185 | //else
|
|---|
| 4186 | //if (e->button() == Qt::RightButton) {
|
|---|
| 4187 | // showPopupMenu( e->globalPos() );
|
|---|
| 4188 | //}
|
|---|
| 4189 | //
|
|---|
| 4190 | else
|
|---|
| 4191 | e->ignore();
|
|---|
| 4192 | }
|
|---|
| 4193 |
|
|---|
| 4194 | void BaseGui::mouseDoubleClickEvent( QMouseEvent * e ) {
|
|---|
| 4195 | e->accept();
|
|---|
| 4196 | emit doubleClicked();
|
|---|
| 4197 | }
|
|---|
| 4198 | */
|
|---|
| 4199 |
|
|---|
| 4200 | void BaseGui::wheelEvent( QWheelEvent * e ) {
|
|---|
| 4201 | qDebug("BaseGui::wheelEvent: delta: %d", e->delta());
|
|---|
| 4202 | e->accept();
|
|---|
| 4203 |
|
|---|
| 4204 | if (e->orientation() == Qt::Vertical) {
|
|---|
| 4205 | if (e->delta() >= 0)
|
|---|
| 4206 | emit wheelUp();
|
|---|
| 4207 | else
|
|---|
| 4208 | emit wheelDown();
|
|---|
| 4209 | } else {
|
|---|
| 4210 | qDebug("BaseGui::wheelEvent: horizontal event received, doing nothing");
|
|---|
| 4211 | }
|
|---|
| 4212 | }
|
|---|
| 4213 |
|
|---|
| 4214 |
|
|---|
| 4215 | // Called when a video has started to play
|
|---|
| 4216 | void BaseGui::enterFullscreenOnPlay() {
|
|---|
| 4217 | qDebug("BaseGui::enterFullscreenOnPlay: arg_start_in_fullscreen: %d, pref->start_in_fullscreen: %d", arg_start_in_fullscreen, pref->start_in_fullscreen);
|
|---|
| 4218 |
|
|---|
| 4219 | if (arg_start_in_fullscreen != 0) {
|
|---|
| 4220 | if ( (arg_start_in_fullscreen == 1) || (pref->start_in_fullscreen) ) {
|
|---|
| 4221 | if (!pref->fullscreen) toggleFullscreen(TRUE);
|
|---|
| 4222 | }
|
|---|
| 4223 | }
|
|---|
| 4224 | }
|
|---|
| 4225 |
|
|---|
| 4226 | // Called when the playlist has stopped
|
|---|
| 4227 | void BaseGui::exitFullscreenOnStop() {
|
|---|
| 4228 | if (pref->fullscreen) {
|
|---|
| 4229 | toggleFullscreen(FALSE);
|
|---|
| 4230 | }
|
|---|
| 4231 | }
|
|---|
| 4232 |
|
|---|
| 4233 | void BaseGui::playlistHasFinished() {
|
|---|
| 4234 | qDebug("BaseGui::playlistHasFinished");
|
|---|
| 4235 | exitFullscreenOnStop();
|
|---|
| 4236 |
|
|---|
| 4237 | qDebug("BaseGui::playlistHasFinished: arg_close_on_finish: %d, pref->close_on_finish: %d", arg_close_on_finish, pref->close_on_finish);
|
|---|
| 4238 |
|
|---|
| 4239 | if (arg_close_on_finish != 0) {
|
|---|
| 4240 | if ((arg_close_on_finish == 1) || (pref->close_on_finish)) exitAct->trigger();
|
|---|
| 4241 | }
|
|---|
| 4242 | }
|
|---|
| 4243 |
|
|---|
| 4244 | void BaseGui::displayState(Core::State state) {
|
|---|
| 4245 | qDebug("BaseGui::displayState: %s", core->stateToString().toUtf8().data());
|
|---|
| 4246 | switch (state) {
|
|---|
| 4247 | case Core::Playing: statusBar()->showMessage( tr("Playing %1").arg(core->mdat.filename), 2000); break;
|
|---|
| 4248 | case Core::Paused: statusBar()->showMessage( tr("Pause") ); break;
|
|---|
| 4249 | case Core::Stopped: statusBar()->showMessage( tr("Stop") , 2000); break;
|
|---|
| 4250 | }
|
|---|
| 4251 | if (state == Core::Stopped) setWindowCaption( "SMPlayer" );
|
|---|
| 4252 |
|
|---|
| 4253 | #if defined(Q_OS_WIN) || defined(Q_OS_OS2)
|
|---|
| 4254 | /* Disable screensaver by event */
|
|---|
| 4255 | just_stopped = false;
|
|---|
| 4256 |
|
|---|
| 4257 | if (state == Core::Stopped) {
|
|---|
| 4258 | just_stopped = true;
|
|---|
| 4259 | int time = 1000 * 60; // 1 minute
|
|---|
| 4260 | QTimer::singleShot( time, this, SLOT(clear_just_stopped()) );
|
|---|
| 4261 | }
|
|---|
| 4262 | #endif
|
|---|
| 4263 | }
|
|---|
| 4264 |
|
|---|
| 4265 | void BaseGui::displayMessage(QString message) {
|
|---|
| 4266 | statusBar()->showMessage(message, 2000);
|
|---|
| 4267 | }
|
|---|
| 4268 |
|
|---|
| 4269 | void BaseGui::gotCurrentTime(double sec) {
|
|---|
| 4270 | //qDebug( "DefaultGui::displayTime: %f", sec);
|
|---|
| 4271 |
|
|---|
| 4272 | static int last_second = 0;
|
|---|
| 4273 |
|
|---|
| 4274 | if (floor(sec)==last_second) return; // Update only once per second
|
|---|
| 4275 | last_second = (int) floor(sec);
|
|---|
| 4276 |
|
|---|
| 4277 | QString time = Helper::formatTime( (int) sec ) + " / " +
|
|---|
| 4278 | Helper::formatTime( (int) core->mdat.duration );
|
|---|
| 4279 |
|
|---|
| 4280 | //qDebug( " duration: %f, current_sec: %f", core->mdat.duration, core->mset.current_sec);
|
|---|
| 4281 |
|
|---|
| 4282 | emit timeChanged( time );
|
|---|
| 4283 | }
|
|---|
| 4284 |
|
|---|
| 4285 | void BaseGui::resizeWindow(int w, int h) {
|
|---|
| 4286 | qDebug("BaseGui::resizeWindow: %d, %d", w, h);
|
|---|
| 4287 |
|
|---|
| 4288 | // If fullscreen, don't resize!
|
|---|
| 4289 | if (pref->fullscreen) return;
|
|---|
| 4290 |
|
|---|
| 4291 | if ( (pref->resize_method==Preferences::Never) && (panel->isVisible()) ) {
|
|---|
| 4292 | return;
|
|---|
| 4293 | }
|
|---|
| 4294 |
|
|---|
| 4295 | if (!panel->isVisible()) {
|
|---|
| 4296 | panel->show();
|
|---|
| 4297 |
|
|---|
| 4298 | // Enable compact mode
|
|---|
| 4299 | //compactAct->setEnabled(true);
|
|---|
| 4300 | }
|
|---|
| 4301 |
|
|---|
| 4302 | if (pref->size_factor != 100) {
|
|---|
| 4303 | w = w * pref->size_factor / 100;
|
|---|
| 4304 | h = h * pref->size_factor / 100;
|
|---|
| 4305 | }
|
|---|
| 4306 |
|
|---|
| 4307 | qDebug("BaseGui::resizeWindow: size to scale: %d, %d", w, h);
|
|---|
| 4308 |
|
|---|
| 4309 | QSize video_size(w,h);
|
|---|
| 4310 |
|
|---|
| 4311 | if (video_size == panel->size()) {
|
|---|
| 4312 | qDebug("BaseGui::resizeWindow: the panel size is already the required size. Doing nothing.");
|
|---|
| 4313 | return;
|
|---|
| 4314 | }
|
|---|
| 4315 |
|
|---|
| 4316 | int diff_width = this->width() - panel->width();
|
|---|
| 4317 | int diff_height = this->height() - panel->height();
|
|---|
| 4318 |
|
|---|
| 4319 | int new_width = w + diff_width;
|
|---|
| 4320 | int new_height = h + diff_height;
|
|---|
| 4321 |
|
|---|
| 4322 | #if USE_MINIMUMSIZE
|
|---|
| 4323 | int minimum_width = minimumSizeHint().width();
|
|---|
| 4324 | if (pref->gui_minimum_width != 0) minimum_width = pref->gui_minimum_width;
|
|---|
| 4325 | if (new_width < minimum_width) {
|
|---|
| 4326 | qDebug("BaseGui::resizeWindow: width is too small, setting width to %d", minimum_width);
|
|---|
| 4327 | new_width = minimum_width;
|
|---|
| 4328 | }
|
|---|
| 4329 | #endif
|
|---|
| 4330 |
|
|---|
| 4331 | resize(new_width, new_height);
|
|---|
| 4332 |
|
|---|
| 4333 | qDebug("BaseGui::resizeWindow: done: window size: %d, %d", this->width(), this->height());
|
|---|
| 4334 | qDebug("BaseGui::resizeWindow: done: panel->size: %d, %d",
|
|---|
| 4335 | panel->size().width(),
|
|---|
| 4336 | panel->size().height() );
|
|---|
| 4337 | qDebug("BaseGui::resizeWindow: done: mplayerwindow->size: %d, %d",
|
|---|
| 4338 | mplayerwindow->size().width(),
|
|---|
| 4339 | mplayerwindow->size().height() );
|
|---|
| 4340 | }
|
|---|
| 4341 |
|
|---|
| 4342 | void BaseGui::hidePanel() {
|
|---|
| 4343 | qDebug("BaseGui::hidePanel");
|
|---|
| 4344 |
|
|---|
| 4345 | if (panel->isVisible()) {
|
|---|
| 4346 | // Exit from fullscreen mode
|
|---|
| 4347 | if (pref->fullscreen) { toggleFullscreen(false); update(); }
|
|---|
| 4348 |
|
|---|
| 4349 | // Exit from compact mode first
|
|---|
| 4350 | if (pref->compact_mode) toggleCompactMode(false);
|
|---|
| 4351 |
|
|---|
| 4352 | //resizeWindow( size().width(), 0 );
|
|---|
| 4353 | int width = size().width();
|
|---|
| 4354 | if (width > pref->default_size.width()) width = pref->default_size.width();
|
|---|
| 4355 | resize( width, size().height() - panel->size().height() );
|
|---|
| 4356 | panel->hide();
|
|---|
| 4357 |
|
|---|
| 4358 | // Disable compact mode
|
|---|
| 4359 | //compactAct->setEnabled(false);
|
|---|
| 4360 | }
|
|---|
| 4361 | }
|
|---|
| 4362 |
|
|---|
| 4363 | void BaseGui::displayGotoTime(int t) {
|
|---|
| 4364 | #ifdef SEEKBAR_RESOLUTION
|
|---|
| 4365 | int jump_time = (int)core->mdat.duration * t / SEEKBAR_RESOLUTION;
|
|---|
| 4366 | #else
|
|---|
| 4367 | int jump_time = (int)core->mdat.duration * t / 100;
|
|---|
| 4368 | #endif
|
|---|
| 4369 | QString s = tr("Jump to %1").arg( Helper::formatTime(jump_time) );
|
|---|
| 4370 | statusBar()->showMessage( s, 1000 );
|
|---|
| 4371 |
|
|---|
| 4372 | if (pref->fullscreen) {
|
|---|
| 4373 | core->displayTextOnOSD( s );
|
|---|
| 4374 | }
|
|---|
| 4375 | }
|
|---|
| 4376 |
|
|---|
| 4377 | void BaseGui::goToPosOnDragging(int t) {
|
|---|
| 4378 | if (pref->update_while_seeking) {
|
|---|
| 4379 | #if ENABLE_DELAYED_DRAGGING
|
|---|
| 4380 | #ifdef SEEKBAR_RESOLUTION
|
|---|
| 4381 | core->goToPosition(t);
|
|---|
| 4382 | #else
|
|---|
| 4383 | core->goToPos(t);
|
|---|
| 4384 | #endif
|
|---|
| 4385 | #else
|
|---|
| 4386 | if ( ( t % 4 ) == 0 ) {
|
|---|
| 4387 | qDebug("BaseGui::goToPosOnDragging: %d", t);
|
|---|
| 4388 | #ifdef SEEKBAR_RESOLUTION
|
|---|
| 4389 | core->goToPosition(t);
|
|---|
| 4390 | #else
|
|---|
| 4391 | core->goToPos(t);
|
|---|
| 4392 | #endif
|
|---|
| 4393 | }
|
|---|
| 4394 | #endif
|
|---|
| 4395 | }
|
|---|
| 4396 | }
|
|---|
| 4397 |
|
|---|
| 4398 | void BaseGui::toggleCompactMode() {
|
|---|
| 4399 | toggleCompactMode( !pref->compact_mode );
|
|---|
| 4400 | }
|
|---|
| 4401 |
|
|---|
| 4402 | void BaseGui::toggleCompactMode(bool b) {
|
|---|
| 4403 | qDebug("BaseGui::toggleCompactMode: %d", b);
|
|---|
| 4404 |
|
|---|
| 4405 | if (b)
|
|---|
| 4406 | aboutToEnterCompactMode();
|
|---|
| 4407 | else
|
|---|
| 4408 | aboutToExitCompactMode();
|
|---|
| 4409 |
|
|---|
| 4410 | pref->compact_mode = b;
|
|---|
| 4411 | updateWidgets();
|
|---|
| 4412 | }
|
|---|
| 4413 |
|
|---|
| 4414 | void BaseGui::aboutToEnterCompactMode() {
|
|---|
| 4415 | menuBar()->hide();
|
|---|
| 4416 | statusBar()->hide();
|
|---|
| 4417 | }
|
|---|
| 4418 |
|
|---|
| 4419 | void BaseGui::aboutToExitCompactMode() {
|
|---|
| 4420 | menuBar()->show();
|
|---|
| 4421 | statusBar()->show();
|
|---|
| 4422 | }
|
|---|
| 4423 |
|
|---|
| 4424 | void BaseGui::setStayOnTop(bool b) {
|
|---|
| 4425 | qDebug("BaseGui::setStayOnTop: %d", b);
|
|---|
| 4426 |
|
|---|
| 4427 | if ( (b && (windowFlags() & Qt::WindowStaysOnTopHint)) ||
|
|---|
| 4428 | (!b && (!(windowFlags() & Qt::WindowStaysOnTopHint))) )
|
|---|
| 4429 | {
|
|---|
| 4430 | // identical do nothing
|
|---|
| 4431 | qDebug("BaseGui::setStayOnTop: nothing to do");
|
|---|
| 4432 | return;
|
|---|
| 4433 | }
|
|---|
| 4434 |
|
|---|
| 4435 | ignore_show_hide_events = true;
|
|---|
| 4436 |
|
|---|
| 4437 | bool visible = isVisible();
|
|---|
| 4438 |
|
|---|
| 4439 | QPoint old_pos = pos();
|
|---|
| 4440 |
|
|---|
| 4441 | if (b) {
|
|---|
| 4442 | setWindowFlags(windowFlags() | Qt::WindowStaysOnTopHint);
|
|---|
| 4443 | }
|
|---|
| 4444 | else {
|
|---|
| 4445 | setWindowFlags(windowFlags() & ~Qt::WindowStaysOnTopHint);
|
|---|
| 4446 | }
|
|---|
| 4447 |
|
|---|
| 4448 | move(old_pos);
|
|---|
| 4449 |
|
|---|
| 4450 | if (visible) {
|
|---|
| 4451 | show();
|
|---|
| 4452 | }
|
|---|
| 4453 |
|
|---|
| 4454 | ignore_show_hide_events = false;
|
|---|
| 4455 | }
|
|---|
| 4456 |
|
|---|
| 4457 | void BaseGui::changeStayOnTop(int stay_on_top) {
|
|---|
| 4458 | switch (stay_on_top) {
|
|---|
| 4459 | case Preferences::AlwaysOnTop : setStayOnTop(true); break;
|
|---|
| 4460 | case Preferences::NeverOnTop : setStayOnTop(false); break;
|
|---|
| 4461 | case Preferences::WhilePlayingOnTop : setStayOnTop((core->state() == Core::Playing)); break;
|
|---|
| 4462 | }
|
|---|
| 4463 |
|
|---|
| 4464 | pref->stay_on_top = (Preferences::OnTop) stay_on_top;
|
|---|
| 4465 | updateWidgets();
|
|---|
| 4466 | }
|
|---|
| 4467 |
|
|---|
| 4468 | void BaseGui::checkStayOnTop(Core::State state) {
|
|---|
| 4469 | qDebug("BaseGui::checkStayOnTop");
|
|---|
| 4470 | if ((!pref->fullscreen) && (pref->stay_on_top == Preferences::WhilePlayingOnTop)) {
|
|---|
| 4471 | setStayOnTop((state == Core::Playing));
|
|---|
| 4472 | }
|
|---|
| 4473 | }
|
|---|
| 4474 |
|
|---|
| 4475 | void BaseGui::toggleStayOnTop() {
|
|---|
| 4476 | if (pref->stay_on_top == Preferences::AlwaysOnTop)
|
|---|
| 4477 | changeStayOnTop(Preferences::NeverOnTop);
|
|---|
| 4478 | else
|
|---|
| 4479 | if (pref->stay_on_top == Preferences::NeverOnTop)
|
|---|
| 4480 | changeStayOnTop(Preferences::AlwaysOnTop);
|
|---|
| 4481 | }
|
|---|
| 4482 |
|
|---|
| 4483 | // Called when a new window (equalizer, preferences..) is opened.
|
|---|
| 4484 | void BaseGui::exitFullscreenIfNeeded() {
|
|---|
| 4485 | /*
|
|---|
| 4486 | if (pref->fullscreen) {
|
|---|
| 4487 | toggleFullscreen(FALSE);
|
|---|
| 4488 | }
|
|---|
| 4489 | */
|
|---|
| 4490 | }
|
|---|
| 4491 |
|
|---|
| 4492 | void BaseGui::checkMousePos(QPoint p) {
|
|---|
| 4493 | //qDebug("BaseGui::checkMousePos: %d, %d", p.x(), p.y());
|
|---|
| 4494 |
|
|---|
| 4495 | bool compact = (pref->floating_display_in_compact_mode && pref->compact_mode);
|
|---|
| 4496 |
|
|---|
| 4497 | if (!pref->fullscreen && !compact) return;
|
|---|
| 4498 |
|
|---|
| 4499 | #define MARGIN 70
|
|---|
| 4500 |
|
|---|
| 4501 | int margin = MARGIN + pref->floating_control_margin;
|
|---|
| 4502 |
|
|---|
| 4503 | if (p.y() > mplayerwindow->height() - margin) {
|
|---|
| 4504 | //qDebug("BaseGui::checkMousePos: %d, %d", p.x(), p.y());
|
|---|
| 4505 | if (!near_bottom) {
|
|---|
| 4506 | emit cursorNearBottom(p);
|
|---|
| 4507 | near_bottom = true;
|
|---|
| 4508 | }
|
|---|
| 4509 | } else {
|
|---|
| 4510 | if (near_bottom) {
|
|---|
| 4511 | emit cursorFarEdges();
|
|---|
| 4512 | near_bottom = false;
|
|---|
| 4513 | }
|
|---|
| 4514 | }
|
|---|
| 4515 |
|
|---|
| 4516 | if (p.y() < margin) {
|
|---|
| 4517 | //qDebug("BaseGui::checkMousePos: %d, %d", p.x(), p.y());
|
|---|
| 4518 | if (!near_top) {
|
|---|
| 4519 | emit cursorNearTop(p);
|
|---|
| 4520 | near_top = true;
|
|---|
| 4521 | }
|
|---|
| 4522 | } else {
|
|---|
| 4523 | if (near_top) {
|
|---|
| 4524 | emit cursorFarEdges();
|
|---|
| 4525 | near_top = false;
|
|---|
| 4526 | }
|
|---|
| 4527 | }
|
|---|
| 4528 | }
|
|---|
| 4529 |
|
|---|
| 4530 | #if ALLOW_CHANGE_STYLESHEET
|
|---|
| 4531 | void BaseGui::loadQss(QString filename) {
|
|---|
| 4532 | QFile file( filename );
|
|---|
| 4533 | file.open(QFile::ReadOnly);
|
|---|
| 4534 | QString styleSheet = QLatin1String(file.readAll());
|
|---|
| 4535 |
|
|---|
| 4536 | qApp->setStyleSheet(styleSheet);
|
|---|
| 4537 | }
|
|---|
| 4538 |
|
|---|
| 4539 | void BaseGui::changeStyleSheet(QString style) {
|
|---|
| 4540 | if (style.isEmpty()) {
|
|---|
| 4541 | qApp->setStyleSheet("");
|
|---|
| 4542 | }
|
|---|
| 4543 | else {
|
|---|
| 4544 | QString qss_file = Paths::configPath() + "/themes/" + pref->iconset +"/style.qss";
|
|---|
| 4545 | //qDebug("BaseGui::changeStyleSheet: '%s'", qss_file.toUtf8().data());
|
|---|
| 4546 | if (!QFile::exists(qss_file)) {
|
|---|
| 4547 | qss_file = Paths::themesPath() +"/"+ pref->iconset +"/style.qss";
|
|---|
| 4548 | }
|
|---|
| 4549 | if (QFile::exists(qss_file)) {
|
|---|
| 4550 | qDebug("BaseGui::changeStyleSheet: '%s'", qss_file.toUtf8().data());
|
|---|
| 4551 | loadQss(qss_file);
|
|---|
| 4552 | } else {
|
|---|
| 4553 | qApp->setStyleSheet("");
|
|---|
| 4554 | }
|
|---|
| 4555 | }
|
|---|
| 4556 | }
|
|---|
| 4557 | #endif
|
|---|
| 4558 |
|
|---|
| 4559 | void BaseGui::loadActions() {
|
|---|
| 4560 | qDebug("BaseGui::loadActions");
|
|---|
| 4561 | ActionsEditor::loadFromConfig(this, settings);
|
|---|
| 4562 | #if !DOCK_PLAYLIST
|
|---|
| 4563 | ActionsEditor::loadFromConfig(playlist, settings);
|
|---|
| 4564 | #endif
|
|---|
| 4565 |
|
|---|
| 4566 | actions_list = ActionsEditor::actionsNames(this);
|
|---|
| 4567 | #if !DOCK_PLAYLIST
|
|---|
| 4568 | actions_list += ActionsEditor::actionsNames(playlist);
|
|---|
| 4569 | #endif
|
|---|
| 4570 |
|
|---|
| 4571 | if (server) server->setActionsList( actions_list );
|
|---|
| 4572 | }
|
|---|
| 4573 |
|
|---|
| 4574 | void BaseGui::saveActions() {
|
|---|
| 4575 | qDebug("BaseGui::saveActions");
|
|---|
| 4576 |
|
|---|
| 4577 | ActionsEditor::saveToConfig(this, settings);
|
|---|
| 4578 | #if !DOCK_PLAYLIST
|
|---|
| 4579 | ActionsEditor::saveToConfig(playlist, settings);
|
|---|
| 4580 | #endif
|
|---|
| 4581 | }
|
|---|
| 4582 |
|
|---|
| 4583 |
|
|---|
| 4584 | void BaseGui::showEvent( QShowEvent * ) {
|
|---|
| 4585 | qDebug("BaseGui::showEvent");
|
|---|
| 4586 |
|
|---|
| 4587 | if (ignore_show_hide_events) return;
|
|---|
| 4588 |
|
|---|
| 4589 | //qDebug("BaseGui::showEvent: pref->pause_when_hidden: %d", pref->pause_when_hidden);
|
|---|
| 4590 | if ((pref->pause_when_hidden) && (core->state() == Core::Paused)) {
|
|---|
| 4591 | qDebug("BaseGui::showEvent: unpausing");
|
|---|
| 4592 | core->pause(); // Unpauses
|
|---|
| 4593 | }
|
|---|
| 4594 | }
|
|---|
| 4595 |
|
|---|
| 4596 | void BaseGui::hideEvent( QHideEvent * ) {
|
|---|
| 4597 | qDebug("BaseGui::hideEvent");
|
|---|
| 4598 |
|
|---|
| 4599 | if (ignore_show_hide_events) return;
|
|---|
| 4600 |
|
|---|
| 4601 | //qDebug("BaseGui::hideEvent: pref->pause_when_hidden: %d", pref->pause_when_hidden);
|
|---|
| 4602 | if ((pref->pause_when_hidden) && (core->state() == Core::Playing)) {
|
|---|
| 4603 | qDebug("BaseGui::hideEvent: pausing");
|
|---|
| 4604 | core->pause();
|
|---|
| 4605 | }
|
|---|
| 4606 | }
|
|---|
| 4607 |
|
|---|
| 4608 | void BaseGui::askForMplayerVersion(QString line) {
|
|---|
| 4609 | qDebug("BaseGui::askForMplayerVersion: %s", line.toUtf8().data());
|
|---|
| 4610 |
|
|---|
| 4611 | if (pref->mplayer_user_supplied_version <= 0) {
|
|---|
| 4612 | InputMplayerVersion d(this);
|
|---|
| 4613 | d.setVersion( pref->mplayer_user_supplied_version );
|
|---|
| 4614 | d.setVersionFromOutput(line);
|
|---|
| 4615 | if (d.exec() == QDialog::Accepted) {
|
|---|
| 4616 | pref->mplayer_user_supplied_version = d.version();
|
|---|
| 4617 | qDebug("BaseGui::askForMplayerVersion: user supplied version: %d", pref->mplayer_user_supplied_version);
|
|---|
| 4618 | }
|
|---|
| 4619 | } else {
|
|---|
| 4620 | qDebug("BaseGui::askForMplayerVersion: already have a version supplied by user, so no asking");
|
|---|
| 4621 | }
|
|---|
| 4622 | }
|
|---|
| 4623 |
|
|---|
| 4624 | void BaseGui::showExitCodeFromMplayer(int exit_code) {
|
|---|
| 4625 | qDebug("BaseGui::showExitCodeFromMplayer: %d", exit_code);
|
|---|
| 4626 |
|
|---|
| 4627 | if (!pref->report_mplayer_crashes) {
|
|---|
| 4628 | qDebug("BaseGui::showExitCodeFromMplayer: not displaying error dialog");
|
|---|
| 4629 | return;
|
|---|
| 4630 | }
|
|---|
| 4631 |
|
|---|
| 4632 | if (exit_code != 255 ) {
|
|---|
| 4633 | ErrorDialog d(this);
|
|---|
| 4634 | d.setText(tr("MPlayer has finished unexpectedly.") + " " +
|
|---|
| 4635 | tr("Exit code: %1").arg(exit_code));
|
|---|
| 4636 | d.setLog( mplayer_log );
|
|---|
| 4637 | d.exec();
|
|---|
| 4638 | }
|
|---|
| 4639 | }
|
|---|
| 4640 |
|
|---|
| 4641 | void BaseGui::showErrorFromMplayer(QProcess::ProcessError e) {
|
|---|
| 4642 | qDebug("BaseGui::showErrorFromMplayer");
|
|---|
| 4643 |
|
|---|
| 4644 | if (!pref->report_mplayer_crashes) {
|
|---|
| 4645 | qDebug("showErrorFromMplayer: not displaying error dialog");
|
|---|
| 4646 | return;
|
|---|
| 4647 | }
|
|---|
| 4648 |
|
|---|
| 4649 | if ((e == QProcess::FailedToStart) || (e == QProcess::Crashed)) {
|
|---|
| 4650 | ErrorDialog d(this);
|
|---|
| 4651 | if (e == QProcess::FailedToStart) {
|
|---|
| 4652 | d.setText(tr("MPlayer failed to start.") + " " +
|
|---|
| 4653 | tr("Please check the MPlayer path in preferences."));
|
|---|
| 4654 | } else {
|
|---|
| 4655 | d.setText(tr("MPlayer has crashed.") + " " +
|
|---|
| 4656 | tr("See the log for more info."));
|
|---|
| 4657 | }
|
|---|
| 4658 | d.setLog( mplayer_log );
|
|---|
| 4659 | d.exec();
|
|---|
| 4660 | }
|
|---|
| 4661 | }
|
|---|
| 4662 |
|
|---|
| 4663 |
|
|---|
| 4664 | void BaseGui::showFindSubtitlesDialog() {
|
|---|
| 4665 | qDebug("BaseGui::showFindSubtitlesDialog");
|
|---|
| 4666 |
|
|---|
| 4667 | if (!find_subs_dialog) {
|
|---|
| 4668 | find_subs_dialog = new FindSubtitlesWindow(this, Qt::Window | Qt::WindowMinMaxButtonsHint);
|
|---|
| 4669 | find_subs_dialog->setSettings(Global::settings);
|
|---|
| 4670 | find_subs_dialog->setWindowIcon(windowIcon());
|
|---|
| 4671 | #if DOWNLOAD_SUBS
|
|---|
| 4672 | connect(find_subs_dialog, SIGNAL(subtitleDownloaded(const QString &)),
|
|---|
| 4673 | core, SLOT(loadSub(const QString &)));
|
|---|
| 4674 | #endif
|
|---|
| 4675 | }
|
|---|
| 4676 |
|
|---|
| 4677 | find_subs_dialog->show();
|
|---|
| 4678 | find_subs_dialog->setMovie(core->mdat.filename);
|
|---|
| 4679 | }
|
|---|
| 4680 |
|
|---|
| 4681 | void BaseGui::openUploadSubtitlesPage() {
|
|---|
| 4682 | //QDesktopServices::openUrl( QUrl("http://ds6.ovh.org/hashsubtitles/upload.php") );
|
|---|
| 4683 | //QDesktopServices::openUrl( QUrl("http://www.opensubtitles.com/upload") );
|
|---|
| 4684 | QDesktopServices::openUrl( QUrl("http://www.opensubtitles.org/uploadjava") );
|
|---|
| 4685 | }
|
|---|
| 4686 |
|
|---|
| 4687 | void BaseGui::showVideoPreviewDialog() {
|
|---|
| 4688 | qDebug("BaseGui::showVideoPreviewDialog");
|
|---|
| 4689 |
|
|---|
| 4690 | if (video_preview == 0) {
|
|---|
| 4691 | video_preview = new VideoPreview( pref->mplayer_bin, this );
|
|---|
| 4692 | video_preview->setSettings(Global::settings);
|
|---|
| 4693 | }
|
|---|
| 4694 |
|
|---|
| 4695 | if (!core->mdat.filename.isEmpty()) {
|
|---|
| 4696 | video_preview->setVideoFile(core->mdat.filename);
|
|---|
| 4697 |
|
|---|
| 4698 | // DVD
|
|---|
| 4699 | if (core->mdat.type==TYPE_DVD) {
|
|---|
| 4700 | QString file = core->mdat.filename;
|
|---|
| 4701 | DiscData disc_data = DiscName::split(file);
|
|---|
| 4702 | QString dvd_folder = disc_data.device;
|
|---|
| 4703 | if (dvd_folder.isEmpty()) dvd_folder = pref->dvd_device;
|
|---|
| 4704 | int dvd_title = disc_data.title;
|
|---|
| 4705 | file = disc_data.protocol + "://" + QString::number(dvd_title);
|
|---|
| 4706 |
|
|---|
| 4707 | video_preview->setVideoFile(file);
|
|---|
| 4708 | video_preview->setDVDDevice(dvd_folder);
|
|---|
| 4709 | } else {
|
|---|
| 4710 | video_preview->setDVDDevice("");
|
|---|
| 4711 | }
|
|---|
| 4712 | }
|
|---|
| 4713 |
|
|---|
| 4714 | video_preview->setMplayerPath(pref->mplayer_bin);
|
|---|
| 4715 |
|
|---|
| 4716 | if ( (video_preview->showConfigDialog(this)) && (video_preview->createThumbnails()) ) {
|
|---|
| 4717 | video_preview->show();
|
|---|
| 4718 | video_preview->adjustWindowSize();
|
|---|
| 4719 | }
|
|---|
| 4720 | }
|
|---|
| 4721 |
|
|---|
| 4722 | void BaseGui::showTubeBrowser() {
|
|---|
| 4723 | qDebug("BaseGui::showTubeBrowser");
|
|---|
| 4724 | if (!QProcess::startDetached("smtube", QStringList())) {
|
|---|
| 4725 | QMessageBox::warning(this, tr("An error happened - SMPlayer"), tr("The YouTube Browser couldn't be launched"));
|
|---|
| 4726 | }
|
|---|
| 4727 | }
|
|---|
| 4728 |
|
|---|
| 4729 | // Language change stuff
|
|---|
| 4730 | void BaseGui::changeEvent(QEvent *e) {
|
|---|
| 4731 | if (e->type() == QEvent::LanguageChange) {
|
|---|
| 4732 | retranslateStrings();
|
|---|
| 4733 | } else {
|
|---|
| 4734 | QMainWindow::changeEvent(e);
|
|---|
| 4735 | }
|
|---|
| 4736 | }
|
|---|
| 4737 |
|
|---|
| 4738 | #ifdef Q_OS_WIN
|
|---|
| 4739 | /* Disable screensaver by event */
|
|---|
| 4740 | bool BaseGui::winEvent ( MSG * m, long * result ) {
|
|---|
| 4741 | //qDebug("BaseGui::winEvent");
|
|---|
| 4742 | if (m->message==WM_SYSCOMMAND) {
|
|---|
| 4743 | if ((m->wParam & 0xFFF0)==SC_SCREENSAVE || (m->wParam & 0xFFF0)==SC_MONITORPOWER) {
|
|---|
| 4744 | qDebug("BaseGui::winEvent: received SC_SCREENSAVE or SC_MONITORPOWER");
|
|---|
| 4745 | qDebug("BaseGui::winEvent: avoid_screensaver: %d", pref->avoid_screensaver);
|
|---|
| 4746 | qDebug("BaseGui::winEvent: playing: %d", core->state()==Core::Playing);
|
|---|
| 4747 | qDebug("BaseGui::winEvent: video: %d", !core->mdat.novideo);
|
|---|
| 4748 |
|
|---|
| 4749 | if ((pref->avoid_screensaver) && (core->state()==Core::Playing) && (!core->mdat.novideo)) {
|
|---|
| 4750 | qDebug("BaseGui::winEvent: not allowing screensaver");
|
|---|
| 4751 | (*result) = 0;
|
|---|
| 4752 | return true;
|
|---|
| 4753 | } else {
|
|---|
| 4754 | if ((pref->avoid_screensaver) && (just_stopped)) {
|
|---|
| 4755 | qDebug("BaseGui::winEvent: file just stopped, so not allowing screensaver for a while");
|
|---|
| 4756 | (*result) = 0;
|
|---|
| 4757 | return true;
|
|---|
| 4758 | } else {
|
|---|
| 4759 | qDebug("BaseGui::winEvent: allowing screensaver");
|
|---|
| 4760 | return false;
|
|---|
| 4761 | }
|
|---|
| 4762 | }
|
|---|
| 4763 | }
|
|---|
| 4764 | }
|
|---|
| 4765 | return false;
|
|---|
| 4766 | }
|
|---|
| 4767 | #endif
|
|---|
| 4768 |
|
|---|
| 4769 | #if defined(Q_OS_WIN) || defined(Q_OS_OS2)
|
|---|
| 4770 | void BaseGui::clear_just_stopped() {
|
|---|
| 4771 | qDebug("BaseGui::clear_just_stopped");
|
|---|
| 4772 | just_stopped = false;
|
|---|
| 4773 | }
|
|---|
| 4774 | #endif
|
|---|
| 4775 |
|
|---|
| 4776 | #include "moc_basegui.cpp"
|
|---|