diff options
author | Mateusz Łukasik <mati75@linuxmint.pl> | 2015-10-06 15:06:23 +0200 |
---|---|---|
committer | Mateusz Łukasik <mati75@linuxmint.pl> | 2015-10-06 15:06:23 +0200 |
commit | cad53e4ce7061f8bc7d49c8123ca6fc6155c79fd (patch) | |
tree | 9da50be8116ad843a2f01441c1e65c4816e4927d /src/basegui.cpp | |
parent | ac1e595cfef357d7ef481dbbefb88996af72eb79 (diff) |
Imported Upstream version 15.9.0~ds0
Diffstat (limited to 'src/basegui.cpp')
-rw-r--r-- | src/basegui.cpp | 76 |
1 files changed, 46 insertions, 30 deletions
diff --git a/src/basegui.cpp b/src/basegui.cpp index 92ee827..9651d10 100644 --- a/src/basegui.cpp +++ b/src/basegui.cpp @@ -98,6 +98,7 @@ #include "playlist.h" #include "constants.h" +#include "links.h" #ifdef MPRIS2 #include "mpris2/mpris2.h" @@ -116,7 +117,7 @@ #endif #ifdef YOUTUBE_SUPPORT - #ifdef YT_USE_SCRIPT + #ifdef YT_USE_YTSIG #include "codedownloader.h" #endif #endif @@ -250,7 +251,7 @@ BaseGui::BaseGui( QWidget* parent, Qt::WindowFlags flags ) #endif #ifdef MPRIS2 - new Mpris2(this, this); + if (pref->use_mpris2) new Mpris2(this, this); #endif } @@ -864,7 +865,7 @@ void BaseGui::createActions() { connect( showCheckUpdatesAct, SIGNAL(triggered()), this, SLOT(helpCheckUpdates()) ); -#if defined(YOUTUBE_SUPPORT) && defined(YT_USE_SCRIPT) +#if defined(YOUTUBE_SUPPORT) && defined(YT_USE_YTSIG) updateYTAct = new MyAction( this, "update_youtube" ); connect( updateYTAct, SIGNAL(triggered()), this, SLOT(YTUpdateScript()) ); @@ -1211,10 +1212,12 @@ void BaseGui::createActions() { connect( subtitleTrackGroup, SIGNAL(activated(int)), core, SLOT(changeSubtitle(int)) ); +#ifdef MPV_SUPPORT // Secondary subtitle track secondarySubtitleTrackGroup = new MyActionGroup(this); connect( secondarySubtitleTrackGroup, SIGNAL(activated(int)), core, SLOT(changeSecondarySubtitle(int)) ); +#endif ccGroup = new MyActionGroup(this); ccNoneAct = new MyActionGroupItem(this, ccGroup, "cc_none", 0); @@ -1730,7 +1733,7 @@ void BaseGui::retranslateStrings() { // Submenu Logs #ifdef LOG_MPLAYER - showLogMplayerAct->change( "MPlayer/MPV" ); + showLogMplayerAct->change(PLAYER_NAME); #endif #ifdef LOG_SMPLAYER showLogSmplayerAct->change( "SMPlayer" ); @@ -1742,7 +1745,7 @@ void BaseGui::retranslateStrings() { showCLOptionsAct->change( Images::icon("cl_help"), tr("&Command line options") ); showCheckUpdatesAct->change( Images::icon("check_updates"), tr("Check for &updates") ); -#if defined(YOUTUBE_SUPPORT) && defined(YT_USE_SCRIPT) +#if defined(YOUTUBE_SUPPORT) && defined(YT_USE_YTSIG) updateYTAct->change( Images::icon("update_youtube"), tr("Update &Youtube code") ); #endif @@ -1975,8 +1978,10 @@ void BaseGui::retranslateStrings() { subtitles_track_menu->menuAction()->setText( tr("&Select") ); subtitles_track_menu->menuAction()->setIcon( Images::icon("sub") ); +#ifdef MPV_SUPPORT secondary_subtitles_track_menu->menuAction()->setText( tr("Secondary trac&k") ); secondary_subtitles_track_menu->menuAction()->setIcon( Images::icon("secondary_sub") ); +#endif closed_captions_menu->menuAction()->setText( tr("&Closed captions") ); closed_captions_menu->menuAction()->setIcon( Images::icon("closed_caption") ); @@ -2030,10 +2035,10 @@ void BaseGui::retranslateStrings() { // Other things #ifdef LOG_MPLAYER - mplayer_log_window->setWindowTitle( tr("SMPlayer - MPlayer log") ); + mplayer_log_window->setWindowTitle( tr("%1 log").arg(PLAYER_NAME) ); #endif #ifdef LOG_SMPLAYER - smplayer_log_window->setWindowTitle( tr("SMPlayer - SMPlayer log") ); + smplayer_log_window->setWindowTitle( tr("SMPlayer log") ); #endif updateRecents(); @@ -2362,8 +2367,10 @@ void BaseGui::createMenus() { openMenu->addAction(openFileAct); recentfiles_menu = new QMenu(this); + /* recentfiles_menu->addAction( clearRecentsAct ); recentfiles_menu->addSeparator(); + */ openMenu->addMenu( recentfiles_menu ); openMenu->addMenu(favorites); @@ -2613,11 +2620,15 @@ void BaseGui::createMenus() { subtitles_track_menu = new QMenu(this); subtitles_track_menu->menuAction()->setObjectName("subtitlestrack_menu"); +#ifdef MPV_SUPPORT secondary_subtitles_track_menu = new QMenu(this); secondary_subtitles_track_menu->menuAction()->setObjectName("secondary_subtitles_track_menu"); +#endif subtitlesMenu->addMenu(subtitles_track_menu); +#ifdef MPV_SUPPORT subtitlesMenu->addMenu(secondary_subtitles_track_menu); +#endif subtitlesMenu->addSeparator(); subtitlesMenu->addAction(loadSubsAct); @@ -2777,7 +2788,7 @@ void BaseGui::createMenus() { helpMenu->addAction(showCLOptionsAct); helpMenu->addSeparator(); helpMenu->addAction(showCheckUpdatesAct); -#if defined(YOUTUBE_SUPPORT) && defined(YT_USE_SCRIPT) +#if defined(YOUTUBE_SUPPORT) && defined(YT_USE_YTSIG) helpMenu->addAction(updateYTAct); #endif helpMenu->addSeparator(); @@ -3273,11 +3284,11 @@ void BaseGui::autosaveMplayerLog() { } void BaseGui::showMplayerLog() { - qDebug("BaseGui::showMplayerLog"); + qDebug("BaseGui::showMplayerLog"); exitFullscreenIfNeeded(); - mplayer_log_window->setText( mplayer_log ); + mplayer_log_window->setText( mplayer_log ); mplayer_log_window->show(); } #endif @@ -3322,6 +3333,7 @@ void BaseGui::initializeMenus() { } subtitles_track_menu->addActions( subtitleTrackGroup->actions() ); +#ifdef MPV_SUPPORT // Secondary Subtitles secondarySubtitleTrackGroup->clear(true); QAction * subSecNoneAct = secondarySubtitleTrackGroup->addAction( tr("&None") ); @@ -3334,6 +3346,7 @@ void BaseGui::initializeMenus() { a->setData(n); } secondary_subtitles_track_menu->addActions( secondarySubtitleTrackGroup->actions() ); +#endif // Audio audioTrackGroup->clear(true); @@ -3456,12 +3469,7 @@ void BaseGui::initializeMenus() { void BaseGui::updateRecents() { qDebug("BaseGui::updateRecents"); - // Not clear the first 2 items - while (recentfiles_menu->actions().count() > 2) { - QAction * a = recentfiles_menu->actions()[2]; - recentfiles_menu->removeAction( a ); - a->deleteLater(); - } + recentfiles_menu->clear(); int current_items = 0; @@ -3496,6 +3504,10 @@ void BaseGui::updateRecents() { } recentfiles_menu->menuAction()->setVisible( current_items > 0 ); + if (current_items > 0) { + recentfiles_menu->addSeparator(); + recentfiles_menu->addAction( clearRecentsAct ); + } } void BaseGui::clearRecentsList() { @@ -3516,8 +3528,10 @@ void BaseGui::updateWidgets() { // Subtitles menu subtitleTrackGroup->setChecked( core->mset.current_sub_id ); +#ifdef MPV_SUPPORT // Secondary subtitles menu secondarySubtitleTrackGroup->setChecked( core->mset.current_secondary_sub_id ); +#endif // Disable the unload subs action if there's no external subtitles unloadSubsAct->setEnabled( !core->mset.external_subtitles.isEmpty() ); @@ -4149,11 +4163,11 @@ void BaseGui::loadAudioFile() { } void BaseGui::helpFirstSteps() { - QDesktopServices::openUrl(QString("http://smplayer.sourceforge.net/first-steps.php?version=%1").arg(Version::printable())); + QDesktopServices::openUrl(QString(URL_FIRST_STEPS "?version=%1").arg(Version::printable())); } void BaseGui::helpFAQ() { - QString url = "http://smplayer.sourceforge.net/faq.php"; + QString url = URL_FAQ; /* if (!pref->language.isEmpty()) url += QString("?tr_lang=%1").arg(pref->language); */ QDesktopServices::openUrl( QUrl(url) ); } @@ -4171,7 +4185,7 @@ void BaseGui::helpCheckUpdates() { #ifdef UPDATE_CHECKER update_checker->check(); #else - QString url = QString("http://smplayer.sourceforge.net/changes.php?version=%1").arg(Version::with_revision()); + QString url = QString(URL_CHANGES "?version=%1").arg(Version::with_revision()); QDesktopServices::openUrl( QUrl(url) ); #endif } @@ -4214,7 +4228,7 @@ void BaseGui::helpAbout() { #ifdef SHARE_MENU void BaseGui::shareSMPlayer() { QString text = QString("SMPlayer - Free Media Player with built-in codecs that can play and download Youtube videos").replace(" ","+"); - QString url = "http://smplayer.sourceforge.net"; + QString url = URL_HOMEPAGE; if (sender() == twitterAct) { QDesktopServices::openUrl(QUrl("http://twitter.com/intent/tweet?text=" + text + "&url=" + url + "/&via=smplayer_dev")); @@ -4590,7 +4604,7 @@ void BaseGui::checkIfUpgraded() { #ifdef Q_OS_LINUX os = "linux"; #endif - QDesktopServices::openUrl(QString("http://smplayer.sourceforge.net/thank-you.php?version=%1&so=%2").arg(Version::printable()).arg(os)); + QDesktopServices::openUrl(QString(URL_THANK_YOU "?version=%1&so=%2").arg(Version::printable()).arg(os)); } pref->smplayer_stable_version = Version::stable(); } @@ -4647,7 +4661,7 @@ void BaseGui::YTNoSslSupport() { tr("The video you requested needs to open a HTTPS connection.") +"<br>"+ tr("Unfortunately the OpenSSL component, required for it, is not available in your system.") +"<br>"+ tr("Please, visit %1 to know how to fix this problem.") - .arg("<a href=\"http://smplayer.sourceforge.net/openssl.php\">" + tr("this link") + "</a>") ); + .arg("<a href=\"" URL_OPENSSL_INFO "\">" + tr("this link") + "</a>") ); } void BaseGui::YTNoSignature(const QString & title) { @@ -4663,7 +4677,7 @@ void BaseGui::YTNoSignature(const QString & title) { info_text = tr("Unfortunately due to changes in the Youtube page, the video '%1' can't be played.").arg(t); } - #ifdef YT_USE_SCRIPT + #ifdef YT_USE_YTSIG int ret = QMessageBox::question(this, tr("Problems with Youtube"), info_text + "<br><br>" + tr("Do you want to update the Youtube code? This may fix the problem."), @@ -4678,15 +4692,15 @@ void BaseGui::YTNoSignature(const QString & title) { #endif } -#ifdef YT_USE_SCRIPT +#ifdef YT_USE_YTSIG void BaseGui::YTUpdateScript() { static CodeDownloader * downloader = 0; if (!downloader) downloader = new CodeDownloader(this); downloader->saveAs(Paths::configPath() + "/yt.js"); downloader->show(); - downloader->download(QUrl("http://updates.smplayer.info/yt.js")); + downloader->download(QUrl(URL_YT_CODE)); } -#endif // YT_USE_SCRIPT +#endif // YT_USE_YTSIG #endif //YOUTUBE_SUPPORT void BaseGui::gotForbidden() { @@ -5365,7 +5379,8 @@ void BaseGui::showExitCodeFromMplayer(int exit_code) { if (exit_code != 255 ) { ErrorDialog d(this); - d.setText(tr("MPlayer has finished unexpectedly.") + " " + + d.setWindowTitle(tr("%1 Error").arg(PLAYER_NAME)); + d.setText(tr("%1 has finished unexpectedly.").arg(PLAYER_NAME) + " " + tr("Exit code: %1").arg(exit_code)); #ifdef LOG_MPLAYER d.setLog( mplayer_log ); @@ -5384,11 +5399,12 @@ void BaseGui::showErrorFromMplayer(QProcess::ProcessError e) { if ((e == QProcess::FailedToStart) || (e == QProcess::Crashed)) { ErrorDialog d(this); + d.setWindowTitle(tr("%1 Error").arg(PLAYER_NAME)); if (e == QProcess::FailedToStart) { - d.setText(tr("MPlayer failed to start.") + " " + - tr("Please check the MPlayer path in preferences.")); + d.setText(tr("%1 failed to start.").arg(PLAYER_NAME) + " " + + tr("Please check the %1 path in preferences.").arg(PLAYER_NAME)); } else { - d.setText(tr("MPlayer has crashed.") + " " + + d.setText(tr("%1 has crashed.").arg(PLAYER_NAME) + " " + tr("See the log for more info.")); } #ifdef LOG_MPLAYER |