Ignore:
Timestamp:
May 15, 2014, 7:53:54 PM (12 years ago)
Author:
Silvan Scherrer
Message:

SMPlayer: update vendor to 0.8.7

File:
1 edited

Legend:

Unmodified
Added
Removed
  • smplayer/vendor/current/src/basegui.cpp

    r154 r163  
    11/*  smplayer, GUI front-end for mplayer.
    2     Copyright (C) 2006-2013 Ricardo Villalba <[email protected]>
     2    Copyright (C) 2006-201 Ricardo Villalba <[email protected]>
    33
    44    This program is free software; you can redistribute it and/or modify
     
    3939#include <QInputDialog>
    4040#include <QClipboard>
     41
    4142
    4243#include <cmath>
     
    5758#include "filepropertiesdialog.h"
    5859#include "eqslider.h"
    59 #include "videoequalizer2.h"
     60#include "videoequalizer.h"
    6061#include "audioequalizer.h"
    6162#include "inputdvddirectory.h"
     
    112113#endif
    113114
     115
     116
     117
     118
    114119using namespace Global;
    115120
    116121BaseGui::BaseGui( QWidget* parent, Qt::WindowFlags flags )
    117         : QMainWindow( parent, flags ),
    118                 near_top(false),
    119                 near_bottom(false)
     122        : QMainWindow( parent, flags )
    120123{
    121124#if defined(Q_OS_WIN) || defined(Q_OS_OS2)
     
    153156
    154157        // Mouse Wheel
     158
    155159        connect( this, SIGNAL(wheelUp()),
    156160             core, SLOT(wheelUp()) );
    157161        connect( this, SIGNAL(wheelDown()),
    158162             core, SLOT(wheelDown()) );
     163
    159164        connect( mplayerwindow, SIGNAL(wheelUp()),
    160165             core, SLOT(wheelUp()) );
     
    185190#if AUTODISABLE_ACTIONS
    186191        setActionsEnabled(false);
     192
     193
     194
     195
    187196#endif
    188197
     
    218227
    219228void BaseGui::initializeGui() {
    220         if (pref->compact_mode) toggleCompactMode(TRUE);
     229        if (pref->compact_mode) toggleCompactMode();
    221230        changeStayOnTop(pref->stay_on_top);
    222231
     
    342351             this, SLOT(openDVDFromFolder()) );
    343352
     353
     354
     355
     356
     357
     358
     359
     360
     361
     362
     363
    344364        openURLAct = new MyAction( QKeySequence("Ctrl+U"), this, "open_url" );
    345365        connect( openURLAct, SIGNAL(triggered()),
     
    405425
    406426        playOrPauseAct = new MyAction( Qt::Key_MediaPlay, this, "play_or_pause" );
     427
    407428        connect( playOrPauseAct, SIGNAL(triggered()),
    408429             core, SLOT(play_or_pause()) );
    409430
    410431        pauseAct = new MyAction( Qt::Key_Space, this, "pause" );
     432
    411433        connect( pauseAct, SIGNAL(triggered()),
    412434             core, SLOT(pause()) );
     
    425447
    426448        rewind1Act = new MyAction( Qt::Key_Left, this, "rewind1" );
     449
    427450        connect( rewind1Act, SIGNAL(triggered()),
    428451             core, SLOT(srewind()) );
     
    437460
    438461        forward1Act = new MyAction( Qt::Key_Right, this, "forward1" );
     462
    439463        connect( forward1Act, SIGNAL(triggered()),
    440464             core, SLOT(sforward()) );
     
    509533        // Menu Video
    510534        fullscreenAct = new MyAction( Qt::Key_F, this, "fullscreen" );
     535
    511536        fullscreenAct->setCheckable( true );
    512537        connect( fullscreenAct, SIGNAL(toggled(bool)),
     
    600625
    601626        muteAct = new MyAction( Qt::Key_M, this, "mute" );
     627
    602628        muteAct->setCheckable( true );
    603629        connect( muteAct, SIGNAL(toggled(bool)),
     
    607633        decVolumeAct = new MyAction( this, "decrease_volume" );
    608634        decVolumeAct->setShortcuts( ActionsEditor::stringToShortcuts("9,/") );
     635
    609636#else
    610637        decVolumeAct = new MyAction( Qt::Key_9, this, "dec_volume" );
     
    616643        incVolumeAct = new MyAction( this, "increase_volume" );
    617644        incVolumeAct->setShortcuts( ActionsEditor::stringToShortcuts("0,*") );
     645
    618646#else
    619647        incVolumeAct = new MyAction( Qt::Key_0, this, "inc_volume" );
     
    792820#endif
    793821
    794         aboutQtAct = new MyAction( this, "about_qt" );
    795         connect( aboutQtAct, SIGNAL(triggered()),
    796              this, SLOT(helpAboutQt()) );
    797 
    798822        aboutThisAct = new MyAction( this, "about_smplayer" );
    799823        connect( aboutThisAct, SIGNAL(triggered()),
    800824             this, SLOT(helpAbout()) );
    801825
     826
    802827        facebookAct = new MyAction (this, "facebook");
    803828        twitterAct = new MyAction (this, "twitter");
     
    816841        connect( yahooAct, SIGNAL(triggered()),
    817842             this, SLOT(shareSMPlayer()) );
    818 
     843#endif
    819844
    820845        // Playlist
    821846        playNextAct = new MyAction(Qt::Key_Greater, this, "play_next");
     847
    822848        connect( playNextAct, SIGNAL(triggered()), playlist, SLOT(playNext()) );
    823849
    824850        playPrevAct = new MyAction(Qt::Key_Less, this, "play_prev");
     851
    825852        connect( playPrevAct, SIGNAL(triggered()), playlist, SLOT(playPrev()) );
    826853
     
    931958
    932959        resetVideoEqualizerAct = new MyAction( this, "reset_video_equalizer");
    933         connect( resetVideoEqualizerAct, SIGNAL(triggered()), video_equalizer2, SLOT(reset()) );
     960        connect( resetVideoEqualizerAct, SIGNAL(triggered()), video_equalizer, SLOT(reset()) );
    934961
    935962        resetAudioEqualizerAct = new MyAction( this, "reset_audio_equalizer");
     
    10351062        aspectDetectAct = new MyActionGroupItem(this, aspectGroup, "aspect_detect", MediaSettings::AspectAuto);
    10361063        aspect11Act = new MyActionGroupItem(this, aspectGroup, "aspect_1:1", MediaSettings::Aspect11 );
     1064
     1065
     1066
     1067
    10371068        aspect32Act = new MyActionGroupItem(this, aspectGroup, "aspect_3:2", MediaSettings::Aspect32);
    1038         aspect43Act = new MyActionGroupItem(this, aspectGroup, "aspect_4:3", MediaSettings::Aspect43);
    1039         aspect54Act = new MyActionGroupItem(this, aspectGroup, "aspect_5:4", MediaSettings::Aspect54 );
    10401069        aspect149Act = new MyActionGroupItem(this, aspectGroup, "aspect_14:9", MediaSettings::Aspect149 );
    1041         aspect1410Act = new MyActionGroupItem(this, aspectGroup, "aspect_14:10", MediaSettings::Aspect1410 );
     1070        aspect110 );
    10421071        aspect169Act = new MyActionGroupItem(this, aspectGroup, "aspect_16:9", MediaSettings::Aspect169 );
    1043         aspect1610Act = new MyActionGroupItem(this, aspectGroup, "aspect_16:10", MediaSettings::Aspect1610 );
    10441072        aspect235Act = new MyActionGroupItem(this, aspectGroup, "aspect_2.35:1", MediaSettings::Aspect235 );
    10451073        {
     
    10771105        screenGroup = new MyActionGroup(this);
    10781106        screenDefaultAct = new MyActionGroupItem(this, screenGroup, "screen_default", -1);
    1079 #ifdef Q_OS_WIN
     1107#ifdef Q_OS_WIN
    10801108        DeviceList display_devices = DeviceInfo::displayDevices();
    10811109        if (!display_devices.isEmpty()) {
     
    10831111                        int id = display_devices[n].ID().toInt();
    10841112                        QString desc = display_devices[n].desc();
    1085                         MyAction * screen_item = new MyActionGroupItem(this, screenGroup, QString("screen_%1").arg(n).toAscii().constData(), id);
     1113                        MyAction * screen_item = new MyActionGroupItem(this, screenGroup, QString("screen_%1").arg(n).to().constData(), id);
    10861114                        screen_item->change( "&"+QString::number(n) + " - " + desc);
    10871115                }
    10881116        }
    10891117        else
    1090 #endif // Q_OS_WIN
     1118#endif // Q_OS_WIN
    10911119        for (int n = 1; n <= 4; n++) {
    1092                 MyAction * screen_item = new MyActionGroupItem(this, screenGroup, QString("screen_%1").arg(n).toAscii().constData(), n);
     1120                MyAction * screen_item = new MyActionGroupItem(this, screenGroup, QString("screen_%1").arg(n).to().constData(), n);
    10931121                screen_item->change( "&"+QString::number(n) );
    10941122        }
     
    14651493        openDVDAct->change( Images::icon("dvd"), tr("&DVD from drive") );
    14661494        openDVDFolderAct->change( Images::icon("dvd_hd"), tr("D&VD from folder...") );
     1495
     1496
     1497
     1498
    14671499        openURLAct->change( Images::icon("url"), tr("&URL...") );
    14681500        exitAct->change( Images::icon("close"), tr("C&lose") );
     
    15131545        // Submenu speed
    15141546        normalSpeedAct->change( tr("&Normal speed") );
    1515         halveSpeedAct->change( tr("&Halve speed") );
     1547        halveSpeedAct->change( tr("&Hal speed") );
    15161548        doubleSpeedAct->change( tr("&Double speed") );
    15171549        decSpeed10Act->change( tr("Speed &-10%") );
     
    15291561        screenshotsAct->change( Images::icon("screenshots"), tr("Start/stop takin&g screenshots") );
    15301562#ifdef VIDEOPREVIEW
    1531         videoPreviewAct->change( Images::icon("video_preview"), tr("Pre&view...") );
     1563        videoPreviewAct->change( Images::icon("video_preview"), tr("...") );
    15321564#endif
    15331565        flipAct->change( Images::icon("flip"), tr("Fli&p image") );
     
    15981630
    15991631#ifdef FIND_SUBTITLES
    1600         showFindSubtitlesDialogAct->change( Images::icon("download_subs"), tr("Find subtitles on &OpenSubtitles.org...") );
     1632        showFindSubtitlesDialogAct->change( Images::icon("download_subs"), tr("Find subtitles &OpenSubtitles.org...") );
    16011633        openUploadSubtitlesPageAct->change( Images::icon("upload_subs"), tr("Upload su&btitles to OpenSubtitles.org...") );
    16021634#endif
     
    16461678        donateAct->change( Images::icon("donate"), tr("&Donate") );
    16471679#endif
    1648         aboutQtAct->change( QPixmap(":/icons-png/qt.png"), tr("About &Qt") );
    16491680        aboutThisAct->change( Images::icon("logo_small"), tr("About &SMPlayer") );
    16501681
     1682
    16511683        facebookAct->change("&Facebook");
    16521684        twitterAct->change("&Twitter");
     
    16541686        hotmailAct->change("&Hotmail");
    16551687        yahooAct->change("&Yahoo!");
    1656 
     1688#endif
    16571689
    16581690        // Playlist
     
    17971829        aspect32Act->change( "&3:2" );
    17981830        aspect43Act->change( "&4:3" );
     1831
    17991832        aspect54Act->change( "&5:4" );
    18001833        aspect149Act->change( "&14:9" );
     
    19021935        osd_menu->menuAction()->setIcon( Images::icon("osd") );
    19031936
     1937
    19041938        share_menu->menuAction()->setText( tr("S&hare SMPlayer with your friends") );
    19051939        share_menu->menuAction()->setIcon( Images::icon("share") );
     1940
    19061941
    19071942#if defined(LOG_MPLAYER) || defined(LOG_SMPLAYER)
     
    19972032        connect( core, SIGNAL(mediaLoaded()),
    19982033             this, SLOT(enableActionsOnPlaying()) );
     2034
     2035
     2036
    19992037#if NOTIFY_AUDIO_CHANGES
    20002038        connect( core, SIGNAL(audioTracksChanged()),
     
    20552093            this, SLOT(YTNoSignature(const QString &)));
    20562094#endif
     2095
    20572096}
    20582097
     
    20642103#endif
    20652104        mplayerwindow->allowVideoMovement( pref->allow_video_movement );
     2105
    20662106
    20672107#if LOGO_ANIMATION
     
    20942134        connect( mplayerwindow, SIGNAL(xbutton2Clicked()),
    20952135             this, SLOT(xbutton2ClickFunction()) );
    2096         connect( mplayerwindow, SIGNAL(mouseMoved(QPoint)),
    2097              this, SLOT(checkMousePos(QPoint)) );
    2098 
    2099         if (pref->move_when_dragging) {
    2100                 connect( mplayerwindow, SIGNAL(mouseMovedDiff(QPoint)),
    2101                      this, SLOT(moveWindow(QPoint)));
    2102         }
     2136
     2137        connect( mplayerwindow, SIGNAL(mouseMovedDiff(QPoint)),
     2138             this, SLOT(moveWindowDiff(QPoint)), Qt::QueuedConnection );
     2139        mplayerwindow->activateMouseDragTracking(pref->move_when_dragging);
    21032140}
    21042141
    21052142void BaseGui::createVideoEqualizer() {
    21062143        // Equalizer
    2107         video_equalizer2 = new VideoEqualizer2(this);
    2108         connect( video_equalizer2, SIGNAL(contrastChanged(int)),
     2144        video_equalizer(this);
     2145        connect( video_equalizer, SIGNAL(contrastChanged(int)),
    21092146             core, SLOT(setContrast(int)) );
    2110         connect( video_equalizer2, SIGNAL(brightnessChanged(int)),
     2147        connect( video_equalizer, SIGNAL(brightnessChanged(int)),
    21112148             core, SLOT(setBrightness(int)) );
    2112         connect( video_equalizer2, SIGNAL(hueChanged(int)),
     2149        connect( video_equalizer, SIGNAL(hueChanged(int)),
    21132150             core, SLOT(setHue(int)) );
    2114         connect( video_equalizer2, SIGNAL(saturationChanged(int)),
     2151        connect( video_equalizer, SIGNAL(saturationChanged(int)),
    21152152             core, SLOT(setSaturation(int)) );
    2116         connect( video_equalizer2, SIGNAL(gammaChanged(int)),
     2153        connect( video_equalizer, SIGNAL(gammaChanged(int)),
    21172154             core, SLOT(setGamma(int)) );
    21182155
    2119         connect( video_equalizer2, SIGNAL(visibilityChanged()),
     2156        connect( video_equalizer, SIGNAL(visibilityChanged()),
    21202157             this, SLOT(updateWidgets()) );
    2121         connect( video_equalizer2, SIGNAL(requestToChangeDefaultValues()),
     2158        connect( video_equalizer, SIGNAL(requestToChangeDefaultValues()),
    21222159             this, SLOT(setDefaultValuesFromVideoEqualizer()) );
    2123         connect( video_equalizer2, SIGNAL(bySoftwareChanged(bool)),
     2160        connect( video_equalizer, SIGNAL(bySoftwareChanged(bool)),
    21242161             this, SLOT(changeVideoEqualizerBySoftware(bool)) );
    21252162}
     
    21892226
    21902227        // panel
    2191         panel->setAutoFillBackground(TRUE);
     2228        /*
     2229        panel->setAutoFillBackground(true);
    21922230        ColorUtils::setBackgroundColor( panel, QColor(0,0,0) );
     2231
    21932232}
    21942233
     
    22422281        disc_menu->addAction(openDVDAct);
    22432282        disc_menu->addAction(openDVDFolderAct);
     2283
     2284
     2285
     2286
    22442287        disc_menu->addAction(openVCDAct);
    22452288        disc_menu->addAction(openAudioCDAct);
     
    26132656        // HELP MENU
    26142657        // Share submenu
     2658
    26152659        share_menu = new QMenu(this);
    26162660        share_menu->addAction(facebookAct);
     
    26222666        helpMenu->addMenu(share_menu);
    26232667        helpMenu->addSeparator();
     2668
     2669
    26242670        helpMenu->addAction(showFirstStepsAct);
    26252671        helpMenu->addAction(showFAQAct);
     
    26372683        helpMenu->addSeparator();
    26382684#endif
    2639         helpMenu->addAction(aboutQtAct);
    26402685        helpMenu->addAction(aboutThisAct);
    26412686
     
    27032748
    27042749void BaseGui::showVideoEqualizer() {
    2705         showVideoEqualizer( !video_equalizer2->isVisible() );
     2750        showVideoEqualizer( !video_equalizer->isVisible() );
    27062751}
    27072752
    27082753void BaseGui::showVideoEqualizer(bool b) {
    27092754        if (!b) {
    2710                 video_equalizer2->hide();
     2755                video_equalizer->hide();
    27112756        } else {
    27122757                // Exit fullscreen, otherwise dialog is not visible
    27132758                exitFullscreenIfNeeded();
    2714                 video_equalizer2->show();
     2759                video_equalizer->show();
    27152760        }
    27162761        updateWidgets();
     
    27672812        pref_dialog->getData(pref);
    27682813
     2814
    27692815        if (!pref->default_font.isEmpty()) {
    27702816                QFont f;
    27712817                f.fromString( pref->default_font );
    2772                 qApp->setFont(f);
     2818                if (QApplication::font() != f) {
     2819                        qDebug("BaseGui::applyNewPreferences: setting new font: %s", pref->default_font.toLatin1().constData());
     2820                        QApplication::setFont(f);
     2821                }
    27732822        }
    27742823
     
    27942843        }
    27952844
    2796         if (pref->move_when_dragging) {
    2797                 connect( mplayerwindow, SIGNAL(mouseMovedDiff(QPoint)), this, SLOT(moveWindow(QPoint)));
    2798         } else {
    2799                 disconnect( mplayerwindow, SIGNAL(mouseMovedDiff(QPoint)), this, SLOT(moveWindow(QPoint)));
    2800         }
     2845        mplayerwindow->activateMouseDragTracking(pref->move_when_dragging);
     2846        mplayerwindow->delayLeftClick(pref->delay_left_click);
    28012847
    28022848#if ALLOW_TO_HIDE_VIDEO_WINDOW_ON_AUDIO_FILES
     
    28282874                mplayerwindow->setMonitorAspect( pref->monitor_aspect_double() );
    28292875        }
     2876
     2877
     2878
    28302879
    28312880        // Update playlist preferences
     
    29342983#undef TEST_AND_SET
    29352984#define TEST_AND_SET( Pref, Dialog ) \
    2936         if ( Pref != Dialog ) { Pref = Dialog; need_restart = TRUE; }
     2985        if ( Pref != Dialog ) { Pref = Dialog; need_restart = ; }
    29372986
    29382987        QString prev_demuxer = core->mset.forced_demuxer;
     
    30303079        }*/
    30313080
    3032         if ((core->mdat.type == TYPE_FILE) && (pref->auto_add_to_playlist) && (pref->add_to_playlist_consecutive_files)) {
    3033                 // Look for consecutive files
    3034                 QStringList files_to_add = Helper::searchForConsecutiveFiles(core->mdat.filename);
     3081        // Automatically add files to playlist
     3082        if ((core->mdat.type == TYPE_FILE) && (pref->auto_add_to_playlist)) {
     3083                //qDebug("BaseGui::newMediaLoaded: playlist count: %d", playlist->count());
     3084                QStringList files_to_add;
     3085                if (playlist->count() == 1) {
     3086                        files_to_add = Helper::filesForPlaylist(core->mdat.filename, pref->media_to_add_to_playlist);
     3087                }
    30353088                if (!files_to_add.empty()) playlist->addFiles(files_to_add);
    30363089        }
     3090
     3091
     3092
     3093
     3094
    30373095}
    30383096
     
    34223480
    34233481        // Video equalizer
    3424         videoEqualizerAct->setChecked( video_equalizer2->isVisible() );
    3425         video_equalizer2->setBySoftware( pref->use_soft_video_eq );
     3482        videoEqualizerAct->setChecked( video_equalizer->isVisible() );
     3483        video_equalizer->setBySoftware( pref->use_soft_video_eq );
    34263484
    34273485        // Audio equalizer
     
    34773535void BaseGui::updateVideoEqualizer() {
    34783536        // Equalizer
    3479         video_equalizer2->setContrast( core->mset.contrast );
    3480         video_equalizer2->setBrightness( core->mset.brightness );
    3481         video_equalizer2->setHue( core->mset.hue );
    3482         video_equalizer2->setSaturation( core->mset.saturation );
    3483         video_equalizer2->setGamma( core->mset.gamma );
     3537        video_equalizer->setContrast( core->mset.contrast );
     3538        video_equalizer->setBrightness( core->mset.brightness );
     3539        video_equalizer->setHue( core->mset.hue );
     3540        video_equalizer->setSaturation( core->mset.saturation );
     3541        video_equalizer->setGamma( core->mset.gamma );
    34843542}
    34853543
    34863544void BaseGui::updateAudioEqualizer() {
    34873545        // Audio Equalizer
    3488         for (int n = 0; n < 10; n++) {
    3489                 audio_equalizer->eq[n]->setValue( core->mset.audio_equalizer[n].toInt() );
    3490         }
     3546        AudioEqualizerList l = pref->global_audio_equalizer ? pref->audio_equalizer : core->mset.audio_equalizer;
     3547        audio_equalizer->setEqualizer(l);
    34913548}
    34923549
     
    34943551        qDebug("BaseGui::setDefaultValuesFromVideoEqualizer");
    34953552
    3496         pref->initial_contrast = video_equalizer2->contrast();
    3497         pref->initial_brightness = video_equalizer2->brightness();
    3498         pref->initial_hue = video_equalizer2->hue();
    3499         pref->initial_saturation = video_equalizer2->saturation();
    3500         pref->initial_gamma = video_equalizer2->gamma();
     3553        pref->initial_contrast = video_equalizer->contrast();
     3554        pref->initial_brightness = video_equalizer->brightness();
     3555        pref->initial_hue = video_equalizer->hue();
     3556        pref->initial_saturation = video_equalizer->saturation();
     3557        pref->initial_gamma = video_equalizer->gamma();
    35013558
    35023559        QMessageBox::information(this, tr("Information"),
     
    35863643        qDebug("BaseGui::openFiles");
    35873644        if (files.empty()) return;
     3645
     3646
     3647
     3648
    35883649
    35893650        if (files.count()==1) {
     
    38133874}
    38143875
     3876
     3877
     3878
     3879
     3880
     3881
     3882
     3883
     3884
     3885
     3886
     3887
     3888
     3889
     3890
     3891
     3892
     3893
     3894
     3895
     3896
     3897
     3898
     3899
     3900
     3901
     3902
     3903
     3904
     3905
     3906
     3907
     3908
     3909
     3910
     3911
     3912
     3913
     3914
    38153915void BaseGui::openDirectory() {
    38163916        qDebug("BaseGui::openDirectory");
     
    39114011#ifdef REMINDER_ACTIONS
    39124012void BaseGui::helpDonate() {
    3913         QMessageBox d(QMessageBox::NoIcon, tr("Donate"),
    3914                 tr("If you like SMPlayer and want to support its development, you can send a donation. Even the smallest one is highly appreciated."),
    3915                 QMessageBox::Ok | QMessageBox::Cancel, this);
    3916         d.setIconPixmap( Images::icon("logo", 64) );
    3917         d.button(QMessageBox::Ok)->setText(tr("Yes, I want to donate"));
    3918         d.setDefaultButton(QMessageBox::Ok);
    3919         if ( d.exec() == QMessageBox::Ok ) {
    3920                 QDesktopServices::openUrl(QUrl("http://sourceforge.net/donate/index.php?group_id=185512"));
    3921 
     4013        ShareDialog d(this);
     4014        d.showRemindCheck(false);
     4015        d.exec();
     4016        int action = d.actions();
     4017        qDebug("BaseGui::helpDonate: action: %d", action);
     4018
     4019        if (action > 0) {
    39224020                QSettings * set = Global::settings;
    39234021                set->beginGroup("reminder");
    3924                 set->setValue("action", 1);
     4022                set->setValue("action", );
    39254023                set->endGroup();
    39264024        }
     
    39334031}
    39344032
    3935 void BaseGui::helpAboutQt() {
    3936         QMessageBox::aboutQt(this, tr("About Qt") );
    3937 }
    3938 
     4033#ifdef SHARE_MENU
    39394034void BaseGui::shareSMPlayer() {
    39404035        QString text = QString("SMPlayer - Free Media Player with built-in codecs that can play and download Youtube videos").replace(" ","+");
     
    39684063        }
    39694064}
     4065
    39704066
    39714067void BaseGui::showGotoDialog() {
     
    39824078void BaseGui::showAudioDelayDialog() {
    39834079        bool ok;
     4080
     4081
     4082
     4083
     4084
    39844085        int delay = QInputDialog::getInteger(this, tr("SMPlayer - Audio delay"),
    39854086                                         tr("Audio delay (in milliseconds):"), core->mset.audio_delay,
    39864087                                         -3600000, 3600000, 1, &ok);
     4088
    39874089        if (ok) {
    39884090                core->setAudioDelay(delay);
     
    39924094void BaseGui::showSubDelayDialog() {
    39934095        bool ok;
     4096
     4097
     4098
     4099
     4100
    39944101        int delay = QInputDialog::getInteger(this, tr("SMPlayer - Subtitle delay"),
    39954102                                         tr("Subtitle delay (in milliseconds):"), core->mset.sub_delay,
    39964103                                         -3600000, 3600000, 1, &ok);
     4104
    39974105        if (ok) {
    39984106                core->setSubDelay(delay);
     
    43264434        set->setValue("count", count);
    43274435        int action = set->value("action", 0).toInt();
     4436
    43284437        set->endGroup();
     4438
     4439
     4440
    43294441
    43304442        if (action != 0) return;
    43314443        if ((count != 25) && (count != 45)) return;
    4332 
    4333         QMessageBox box(this);
    4334         box.setIcon(QMessageBox::Question);
    4335         box.setIconPixmap( Images::icon("donate_big") );
    4336         box.setWindowTitle(tr("Help SMPlayer"));
    4337         box.setText(
    4338                 tr("If you like SMPlayer and want to support its development, you can send a donation. Even the smallest one is highly appreciated.") + "<br>"+
    4339                 tr("Or you maybe you want to share SMPlayer with your friends in Facebook.") + "<br>" +
    4340                 tr("What would you like to do?") );
    4341         QPushButton * donate_button = box.addButton(tr("&Donate"), QMessageBox::ActionRole);
    4342         QPushButton * facebook_button = box.addButton(tr("&Share with my friends"), QMessageBox::ActionRole);
    4343         QPushButton * cancel_button = box.addButton(QMessageBox::Cancel);
    4344 
    4345         box.exec();
    4346         if (box.clickedButton() == donate_button) {
    4347                 QDesktopServices::openUrl(QUrl("http://sourceforge.net/donate/index.php?group_id=185512"));
    4348                 action = 1;
    4349         }
    4350         else
    4351         if (box.clickedButton() == facebook_button) {
    4352                 QString text = QString("SMPlayer - Free Media Player with built-in codecs that can play and download Youtube videos").replace(" ","+");
    4353                 QString url = "http://smplayer.sourceforge.net";
    4354                 QDesktopServices::openUrl(QUrl("http://www.facebook.com/sharer.php?u=" + url + "&t=" + text));
    4355                 action = 2;
    4356         }
    4357         else
    4358         if (box.clickedButton() == cancel_button) {
     4444#endif
     4445
     4446        ShareDialog d(this);
     4447        //d.showRemindCheck(false);
     4448        d.exec();
     4449        action = d.actions();
     4450        qDebug("BaseGui::checkReminder: action: %d", action);
     4451
     4452        if (!d.isRemindChecked()) {
     4453                set->beginGroup("reminder");
     4454                set->setValue("dont_show_anymore", true);
     4455                set->endGroup();
    43594456        }
    43604457
     
    43644461                set->endGroup();
    43654462        }
     4463
     4464
    43664465}
    43674466#endif
     
    43724471
    43734472        QString t = title;
    4374         t.replace(" - YouTube", "");
     4473
     4474        QString info_text;
     4475        if (title.isEmpty()) {
     4476                info_text = tr("Unfortunately due to changes in the Youtube page, this video can't be played.");
     4477        } else {
     4478                t.replace(" - YouTube", "");
     4479                info_text = tr("Unfortunately due to changes in the Youtube page, the video '%1' can't be played.").arg(t);
     4480        }
    43754481
    43764482        #ifdef YT_USE_SCRIPT
    43774483        int ret = QMessageBox::question(this, tr("Problems with Youtube"),
    4378                                 tr("Unfortunately due to changes in the Youtube page, the video '%1' can't be played.").arg(t) + "<br><br>" +
     4484                                + "<br><br>" +
    43794485                                tr("Do you want to update the Youtube code? This may fix the problem."),
    43804486                                QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes);
     
    43844490        #else
    43854491        QMessageBox::warning(this, tr("Problems with Youtube"),
    4386                 tr("Unfortunately due to changes in the Youtube page, the video '%1' can't be played.").arg(t) + "<br><br>" +
     4492                + "<br><br>" +
    43874493                tr("Maybe updating SMPlayer could fix the problem."));
    43884494        #endif
     
    43934499        static CodeDownloader * downloader = 0;
    43944500        if (!downloader) downloader = new CodeDownloader(this);
    4395         downloader->saveAs(Paths::configPath() + "/ytcode.script");
     4501        downloader->saveAs(Paths::configPath() + "/yt");
    43964502        downloader->show();
    4397         downloader->download(QUrl("http://updates.smplayer.info/ytcode.script"));
     4503        downloader->download(QUrl("http://updates.smplayer.info/yt"));
    43984504}
    43994505#endif // YT_USE_SCRIPT
    44004506#endif //YOUTUBE_SUPPORT
     4507
     4508
     4509
     4510
     4511
     4512
     4513
     4514
     4515
     4516
     4517
     4518
     4519
     4520
     4521
     4522
     4523
     4524
     4525
     4526
    44014527
    44024528void BaseGui::dragEnterEvent( QDragEnterEvent *e ) {
     
    44384564        qDebug( "BaseGui::dropEvent: count: %d", files.count());
    44394565        if (files.count() > 0) {
     4566
     4567
     4568
     4569
    44404570                if (files.count() == 1) {
    44414571                        QFileInfo fi( files[0] );
     
    45144644*/
    45154645
     4646
    45164647void BaseGui::wheelEvent( QWheelEvent * e ) {
    45174648        qDebug("BaseGui::wheelEvent: delta: %d", e->delta());
     
    45274658        }
    45284659}
    4529 
     4660*/
    45304661
    45314662// Called when a video has started to play
     
    45354666        if (arg_start_in_fullscreen != 0) {
    45364667                if ( (arg_start_in_fullscreen == 1) || (pref->start_in_fullscreen) ) {
    4537                         if (!pref->fullscreen) toggleFullscreen(TRUE);
     4668                        if (!pref->fullscreen) toggleFullscreen();
    45384669                }
    45394670        }
     
    45434674void BaseGui::exitFullscreenOnStop() {
    45444675    if (pref->fullscreen) {
    4545                 toggleFullscreen(FALSE);
     4676                toggleFullscreen();
    45464677        }
    45474678}
     
    48254956        /*
    48264957        if (pref->fullscreen) {
    4827                 toggleFullscreen(FALSE);
     4958                toggleFullscreen();
    48284959        }
    48294960        */
    4830 }
    4831 
    4832 void BaseGui::checkMousePos(QPoint p) {
    4833         //qDebug("BaseGui::checkMousePos: %d, %d", p.x(), p.y());
    4834 
    4835         bool compact = (pref->floating_display_in_compact_mode && pref->compact_mode);
    4836 
    4837         if (!pref->fullscreen && !compact) return;
    4838 
    4839         #define MARGIN 70
    4840 
    4841         int margin = MARGIN + pref->floating_control_margin;
    4842 
    4843         if (p.y() > mplayerwindow->height() - margin) {
    4844                 //qDebug("BaseGui::checkMousePos: %d, %d", p.x(), p.y());
    4845                 if (!near_bottom) {
    4846                         emit cursorNearBottom(p);
    4847                         near_bottom = true;
    4848                 }
    4849         } else {
    4850                 if (near_bottom) {
    4851                         emit cursorFarEdges();
    4852                         near_bottom = false;
    4853                 }
    4854         }
    4855 
    4856         if (p.y() < margin) {
    4857                 //qDebug("BaseGui::checkMousePos: %d, %d", p.x(), p.y());
    4858                 if (!near_top) {
    4859                         emit cursorNearTop(p);
    4860                         near_top = true;
    4861                 }
    4862         } else {
    4863                 if (near_top) {
    4864                         emit cursorFarEdges();
    4865                         near_top = false;
    4866                 }
    4867         }
    48684961}
    48694962
     
    49265019}
    49275020
    4928 void BaseGui::moveWindow(QPoint diff) {
     5021void BaseGui::moveWindow(QPoint diff) {
    49295022        if (pref->fullscreen || isMaximized()) {
    49305023                return;
    49315024        }
     5025
     5026
     5027
     5028
     5029
     5030
     5031
     5032
     5033
     5034
     5035
     5036
     5037
     5038
     5039
     5040
     5041
     5042
     5043
     5044
     5045
     5046
     5047
    49325048        move(pos() + diff);
     5049
    49335050}
    49345051
     
    50365153
    50375154void BaseGui::openUploadSubtitlesPage() {       
    5038         //QDesktopServices::openUrl( QUrl("http://ds6.ovh.org/hashsubtitles/upload.php") );
    5039         //QDesktopServices::openUrl( QUrl("http://www.opensubtitles.com/upload") );
    5040         QDesktopServices::openUrl( QUrl("http://www.opensubtitles.org/uploadjava") );
     5155        QDesktopServices::openUrl( QUrl("http://www.opensubtitles.org/upload") );
    50415156}
    50425157#endif
     
    51025217
    51035218#ifdef Q_OS_WIN
     5219
    51045220/* Disable screensaver by event */
    51055221bool BaseGui::winEvent ( MSG * m, long * result ) {
     
    51315247}
    51325248#endif
     5249
    51335250
    51345251#if defined(Q_OS_WIN) || defined(Q_OS_OS2)
Note: See TracChangeset for help on using the changeset viewer.