Ignore:
Timestamp:
Mar 29, 2012, 3:09:42 PM (13 years ago)
Author:
Silvan Scherrer
Message:

SMPlayer: update to latest svn

File:
1 edited

Legend:

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

    r121 r127  
    6767#include "timedialog.h"
    6868#include "clhelp.h"
     69#include "mplayerversion.h"
     70
     71#ifdef FIND_SUBTITLES
    6972#include "findsubtitleswindow.h"
     73#endif
     74
     75#ifdef VIDEOPREVIEW
    7076#include "videopreview.h"
    71 #include "mplayerversion.h"
     77#endif
    7278
    7379#include "config.h"
    7480#include "actionseditor.h"
    75 
    76 #include "myserver.h"
    7781
    7882#include "tvlist.h"
     
    102106using namespace Global;
    103107
    104 BaseGui::BaseGui( bool use_server, QWidget* parent, Qt::WindowFlags flags )
     108BaseGui::BaseGui( QWidget* parent, Qt::WindowFlags flags )
    105109        : QMainWindow( parent, flags ),
    106110                near_top(false),
     
    115119        arg_close_on_finish = -1;
    116120        arg_start_in_fullscreen = -1;
    117         use_control_server = use_server;
    118121
    119122        setWindowTitle( "SMPlayer" );
    120123
    121124        // Not created objects
    122         server = 0;
    123125        popup = 0;
    124126        pref_dialog = 0;
    125127        file_dialog = 0;
    126128        clhelp_window = 0;
     129#ifdef FIND_SUBTITLES
    127130        find_subs_dialog = 0;
     131#endif
     132#ifdef VIDEOPREVIEW
    128133        video_preview = 0;
     134#endif
    129135
    130136        // Create objects:
     
    160166#endif
    161167
    162     mplayer_log_window = new LogWindow(0);
     168#ifdef LOG_MPLAYER
     169        mplayer_log_window = new LogWindow(0);
     170#endif
     171#ifdef LOG_SMPLAYER
    163172        smplayer_log_window = new LogWindow(0);
     173#endif
    164174
    165175        createActions();
     
    201211
    202212        // 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");
     213        /* Deleted */
     214}
     215
     216#ifdef SINGLE_INSTANCE
     217void BaseGui::handleMessageFromOtherInstances(const QString& message) {
     218        qDebug("BaseGui::handleMessageFromOtherInstances: '%s'", message.toUtf8().constData());
     219
     220        int pos = message.indexOf(' ');
     221        if (pos > -1) {
     222                QString command = message.left(pos);
     223                QString arg = message.mid(pos+1);
     224                qDebug("command: '%s'", command.toUtf8().constData());
     225                qDebug("arg: '%s'", arg.toUtf8().constData());
     226
     227                if (command == "open_file") {
     228                        open(arg);
     229                }
     230                else
     231                if (command == "open_files") {
     232                        QStringList file_list = arg.split(" <<sep>> ");
     233                        openFiles(file_list);
     234                }
     235                else
     236                if (command == "add_to_playlist") {
     237                        QStringList file_list = arg.split(" <<sep>> ");
     238                        playlist->addFiles(file_list);
     239                }
     240                else
     241                if (command == "action") {
     242                        processFunction(arg);
     243                }
     244                else
     245                if (command == "load_sub") {
     246                        setInitialSubtitle(arg);
     247                        if (core->state() != Core::Stopped) {
     248                                core->loadSub(arg);
    245249                        }
    246250                }
    247251        }
    248252}
    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 }
     253#endif
    376254
    377255BaseGui::~BaseGui() {
    378256        delete core; // delete before mplayerwindow, otherwise, segfault...
     257#ifdef LOG_MPLAYER
    379258        delete mplayer_log_window;
     259#endif
     260#ifdef LOG_SMPLAYER
    380261        delete smplayer_log_window;
     262#endif
    381263
    382264        delete favorites;
     
    391273//#endif
    392274
     275#ifdef FIND_SUBTITLES
    393276        if (find_subs_dialog) {
    394277                delete find_subs_dialog;
    395278                find_subs_dialog = 0; // Necessary?
    396279        }
    397 
     280#endif
     281
     282#ifdef VIDEOPREVIEW
    398283        if (video_preview) {
    399284                delete video_preview;
    400285        }
     286#endif
    401287}
    402288
     
    628514             core, SLOT(screenshots()) );
    629515
     516#ifdef VIDEOPREVIEW
    630517        videoPreviewAct = new MyAction( this, "video_preview" );
    631518        connect( videoPreviewAct, SIGNAL(triggered()),
    632519             this, SLOT(showVideoPreviewDialog()) );
     520#endif
    633521
    634522        flipAct = new MyAction( this, "flip" );
     
    663551        connect( deringAct, SIGNAL(toggled(bool)),
    664552             core, SLOT(toggleDering(bool)) );
     553
     554        gradfunAct = new MyAction( this, "gradfun" );
     555        gradfunAct->setCheckable( true );
     556        connect( gradfunAct, SIGNAL(toggled(bool)),
     557             core, SLOT(toggleGradfun(bool)) );
     558
    665559
    666560        addNoiseAct = new MyAction( this, "add_noise" );
     
    803697        connect( subVisibilityAct, SIGNAL(toggled(bool)), core, SLOT(changeSubVisibility(bool)) );
    804698
     699#ifdef FIND_SUBTITLES
    805700        showFindSubtitlesDialogAct = new MyAction( this, "show_find_sub_dialog" );
    806701        connect( showFindSubtitlesDialogAct, SIGNAL(triggered()),
     
    810705        connect( openUploadSubtitlesPageAct, SIGNAL(triggered()),                                       //turbos
    811706             this, SLOT(openUploadSubtitlesPage()) );                                                   //turbos
    812 
     707#endif
    813708
    814709        // Menu Options
     
    831726
    832727        // Submenu Logs
     728#ifdef LOG_MPLAYER
    833729        showLogMplayerAct = new MyAction( QKeySequence("Ctrl+M"), this, "show_mplayer_log" );
    834730        connect( showLogMplayerAct, SIGNAL(triggered()),
    835731             this, SLOT(showMplayerLog()) );
    836 
     732#endif
     733
     734#ifdef LOG_SMPLAYER
    837735        showLogSmplayerAct = new MyAction( QKeySequence("Ctrl+S"), this, "show_smplayer_log" );
    838736        connect( showLogSmplayerAct, SIGNAL(triggered()),
    839737             this, SLOT(showLog()) );
     738#endif
    840739
    841740        // Menu Help
     
    1017916        denoiseSoftAct = new MyActionGroupItem(this, denoiseGroup, "denoise_soft", MediaSettings::DenoiseSoft);
    1018917        connect( denoiseGroup, SIGNAL(activated(int)), core, SLOT(changeDenoise(int)) );
     918
     919        // Unsharp group
     920        unsharpGroup = new MyActionGroup(this);
     921        unsharpNoneAct = new MyActionGroupItem(this, unsharpGroup, "unsharp_off", 0);
     922        blurAct = new MyActionGroupItem(this, unsharpGroup, "blur", 1);
     923        sharpenAct = new MyActionGroupItem(this, unsharpGroup, "sharpen", 2);
     924        connect( unsharpGroup, SIGNAL(activated(int)), core, SLOT(changeUnsharp(int)) );
    1019925
    1020926        // Video size
     
    12461152        deblockAct->setEnabled(b);
    12471153        deringAct->setEnabled(b);
     1154        gradfunAct->setEnabled(b);
    12481155        addNoiseAct->setEnabled(b);
    12491156        addLetterboxAct->setEnabled(b);
     
    13241231        // Groups
    13251232        denoiseGroup->setActionsEnabled(b);
     1233        unsharpGroup->setActionsEnabled(b);
    13261234        sizeGroup->setActionsEnabled(b);
    13271235        deinterlaceGroup->setActionsEnabled(b);
     
    13831291                deblockAct->setEnabled(false);
    13841292                deringAct->setEnabled(false);
     1293                gradfunAct->setEnabled(false);
    13851294                addNoiseAct->setEnabled(false);
    13861295                addLetterboxAct->setEnabled(false);
     
    14011310
    14021311                denoiseGroup->setActionsEnabled(false);
     1312                unsharpGroup->setActionsEnabled(false);
    14031313                sizeGroup->setActionsEnabled(false);
    14041314                deinterlaceGroup->setActionsEnabled(false);
     
    14251335                deblockAct->setEnabled(false);
    14261336                deringAct->setEnabled(false);
     1337                gradfunAct->setEnabled(false);
    14271338                addNoiseAct->setEnabled(false);
    14281339                addLetterboxAct->setEnabled(false);
     
    14321343                rotateGroup->setActionsEnabled(false);
    14331344                denoiseGroup->setActionsEnabled(false);
     1345                unsharpGroup->setActionsEnabled(false);
    14341346
    14351347                displayMessage( tr("Video filters are disabled when using vdpau") );
     
    15521464        screenshotAct->change( Images::icon("screenshot"), tr("&Screenshot") );
    15531465        screenshotsAct->change( Images::icon("screenshots"), tr("Start/stop takin&g screenshots") );
     1466#ifdef VIDEOPREVIEW
    15541467        videoPreviewAct->change( Images::icon("video_preview"), tr("Pre&view...") );
     1468#endif
    15551469        flipAct->change( Images::icon("flip"), tr("Fli&p image") );
    15561470        mirrorAct->change( Images::icon("mirror"), tr("Mirr&or image") );
     
    15771491        deblockAct->change( tr("&Deblock") );
    15781492        deringAct->change( tr("De&ring") );
     1493        gradfunAct->change( tr("Debanding (&gradfun)") );
    15791494        addNoiseAct->change( tr("Add n&oise") );
    15801495        addLetterboxAct->change( Images::icon("letterbox"), tr("Add &black borders") );
     
    16181533        subVisibilityAct->change( Images::icon("sub_visibility"), tr("Subtitle &visibility") );
    16191534
     1535#ifdef FIND_SUBTITLES
    16201536        showFindSubtitlesDialogAct->change( Images::icon("download_subs"), tr("Find subtitles on &OpenSubtitles.org...") );
    16211537        openUploadSubtitlesPageAct->change( Images::icon("upload_subs"), tr("Upload su&btitles to OpenSubtitles.org...") );
    1622 
    1623         ccNoneAct->change( tr("&Off") );
     1538#endif
     1539
     1540        ccNoneAct->change( tr("&Off", "closed captions menu") );
    16241541        ccChannel1Act->change( "&1" );
    16251542        ccChannel2Act->change( "&2" );
     
    16341551
    16351552        // Submenu Logs
     1553#ifdef LOG_MPLAYER
    16361554        showLogMplayerAct->change( "MPlayer" );
     1555#endif
     1556#ifdef LOG_SMPLAYER
    16371557        showLogSmplayerAct->change( "SMPlayer" );
     1558#endif
    16381559
    16391560        // Menu Help
     
    17811702#endif
    17821703
    1783         /*
    17841704        denoise_menu->menuAction()->setText( tr("De&noise") );
    17851705        denoise_menu->menuAction()->setIcon( Images::icon("denoise") );
    1786         */
     1706
     1707        unsharp_menu->menuAction()->setText( tr("Blur/S&harp") );
     1708        unsharp_menu->menuAction()->setIcon( Images::icon("unsharp") );
    17871709
    17881710        aspectDetectAct->change( tr("&Auto") );
     
    18051727        deinterlaceKernAct->change( tr("&Kerndeint") );
    18061728
    1807         denoiseNoneAct->change( tr("Denoise o&ff") );
    1808         denoiseNormalAct->change( tr("Denoise nor&mal") );
    1809         denoiseSoftAct->change( tr("Denoise &soft") );
     1729        denoiseNoneAct->change( tr("&Off", "denoise menu") );
     1730        denoiseNormalAct->change( tr("&Normal","denoise menu") );
     1731        denoiseSoftAct->change( tr("&Soft", "denoise menu") );
     1732
     1733        unsharpNoneAct->change( tr("&None", "unsharp menu") );
     1734        blurAct->change( tr("&Blur", "unsharp menu") );
     1735        sharpenAct->change( tr("&Sharpen", "unsharp menu") );
    18101736
    18111737        rotateNoneAct->change( tr("&Off") );
     
    18841810        osd_menu->menuAction()->setIcon( Images::icon("osd") );
    18851811
     1812#if defined(LOG_MPLAYER) || defined(LOG_SMPLAYER)
    18861813        logs_menu->menuAction()->setText( tr("&View logs") );
    18871814        logs_menu->menuAction()->setIcon( Images::icon("logs") );
    1888 
     1815#endif
    18891816
    18901817        // To be sure that the "<empty>" string is translated
     
    18921819
    18931820        // Other things
    1894         mplayer_log_window->setWindowTitle( tr("SMPlayer - mplayer log") );
    1895         smplayer_log_window->setWindowTitle( tr("SMPlayer - smplayer log") );
     1821#ifdef LOG_MPLAYER
     1822        mplayer_log_window->setWindowTitle( tr("SMPlayer - MPlayer log") );
     1823#endif
     1824#ifdef LOG_SMPLAYER
     1825        smplayer_log_window->setWindowTitle( tr("SMPlayer - SMPlayer log") );
     1826#endif
    18961827
    18971828        updateRecents();
     
    20181949
    20191950        // Log mplayer output
     1951#ifdef LOG_MPLAYER
    20201952        connect( core, SIGNAL(aboutToStartPlaying()),
    20211953             this, SLOT(clearMplayerLog()) );
     
    20251957        connect( core, SIGNAL(mediaLoaded()),
    20261958             this, SLOT(autosaveMplayerLog()) );
     1959#endif
    20271960}
    20281961
     
    23182251        videofilter_menu->menuAction()->setObjectName("videofilter_menu");
    23192252        videofilter_menu->addAction(postProcessingAct);
    2320         videofilter_menu->addAction(phaseAct);
    23212253        videofilter_menu->addAction(deblockAct);
    23222254        videofilter_menu->addAction(deringAct);
     2255        videofilter_menu->addAction(gradfunAct);
    23232256        videofilter_menu->addAction(addNoiseAct);
    23242257        videofilter_menu->addAction(addLetterboxAct);
    23252258        videofilter_menu->addAction(upscaleAct);
     2259        videofilter_menu->addAction(phaseAct);
     2260
     2261        // Denoise submenu
     2262        denoise_menu = new QMenu(this);
     2263        denoise_menu->menuAction()->setObjectName("denoise_menu");
     2264        denoise_menu->addActions(denoiseGroup->actions());
     2265        videofilter_menu->addMenu(denoise_menu);
     2266
     2267        // Unsharp submenu
     2268        unsharp_menu = new QMenu(this);
     2269        unsharp_menu->menuAction()->setObjectName("unsharp_menu");
     2270        unsharp_menu->addActions(unsharpGroup->actions());
     2271        videofilter_menu->addMenu(unsharp_menu);
     2272        /*
    23262273        videofilter_menu->addSeparator();
    23272274        videofilter_menu->addActions(denoiseGroup->actions());
    2328 
     2275        videofilter_menu->addSeparator();
     2276        videofilter_menu->addActions(unsharpGroup->actions());
     2277        */
    23292278        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         */
    23372279
    23382280        // Rotate submenu
     
    23572299        videoMenu->addMenu(ontop_menu);
    23582300
     2301#ifdef VIDEOPREVIEW
    23592302        videoMenu->addSeparator();
    23602303        videoMenu->addAction(videoPreviewAct);
     2304#endif
    23612305
    23622306
     
    24472391        subtitlesMenu->addSeparator();
    24482392        subtitlesMenu->addAction(useAssAct);
     2393#ifdef FIND_SUBTITLES
    24492394        subtitlesMenu->addSeparator(); //turbos
    24502395        subtitlesMenu->addAction(showFindSubtitlesDialogAct);
    24512396        subtitlesMenu->addAction(openUploadSubtitlesPageAct); //turbos
     2397#endif
    24522398
    24532399        // BROWSE MENU
     
    24912437        {
    24922438                QString tube_exec = Paths::appPath() + "/smtube";
    2493                 #ifdef Q_OS_WIN
     2439                #if defined(Q_OS_WIN) || defined(Q_OS_OS2)
    24942440                tube_exec += ".exe";
    24952441                #endif
     
    25102456
    25112457        // Logs submenu
     2458#if defined(LOG_MPLAYER) || defined(LOG_SMPLAYER)
    25122459        logs_menu = new QMenu(this);
     2460        #ifdef LOG_MPLAYER
    25132461        logs_menu->addAction(showLogMplayerAct);
     2462        #endif
     2463        #ifdef LOG_SMPLAYER
    25142464        logs_menu->addAction(showLogSmplayerAct);
    2515 
     2465        #endif
    25162466        optionsMenu->addMenu(logs_menu);
     2467#endif
    25172468
    25182469        optionsMenu->addAction(showPreferencesAct);
     
    26492600        pl->setPlayFilesFromStart(playlist->playFilesFromStart());
    26502601
    2651         PrefInterface * pi = pref_dialog->mod_interface();
    2652         pi->setSingleInstanceTabEnabled( use_control_server );
    2653 
    26542602        pref_dialog->show();
    26552603}
     
    26882636                changeStyleSheet(pref->iconset);
    26892637#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                 }
    27152638        }
    27162639
     
    27722695
    27732696    // Restart the video if needed
    2774     if (pref_dialog->requiresRestart())
     2697        if (pref_dialog->requiresRestart())
    27752698                core->restart();
    27762699
     
    27802703
    27812704#ifndef NO_USE_INI_FILES
    2782     pref->save();
    2783 #endif
     2705        pref->save();
     2706#endif
     2707
     2708
     2709        if (_interface->guiChanged()) {
     2710#ifdef GUI_CHANGE_ON_RUNTIME
     2711                core->stop();
     2712                emit guiChanged(pref->gui);
     2713#else
     2714                QMessageBox::information(this, tr("Information"),
     2715                        tr("You need to restart SMPlayer to use the new GUI.") );
     2716#endif
     2717        }
    27842718}
    27852719
     
    29412875}
    29422876
     2877#ifdef LOG_MPLAYER
    29432878void BaseGui::clearMplayerLog() {
    29442879        mplayer_log.clear();
     
    29532888                        if (mplayer_log_window->isVisible()) mplayer_log_window->appendText(line);
    29542889                }
    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);
    29632890        }
    29642891}
     
    29912918        mplayer_log_window->show();
    29922919}
     2920#endif
     2921
     2922#ifdef LOG_SMPLAYER
     2923void BaseGui::recordSmplayerLog(QString line) {
     2924        if (pref->log_smplayer) {
     2925                line.append("\n");
     2926                smplayer_log.append(line);
     2927                if (smplayer_log_window->isVisible()) smplayer_log_window->appendText(line);
     2928        }
     2929}
    29932930
    29942931void BaseGui::showLog() {
    2995     qDebug("BaseGui::showLog");
     2932        qDebug("BaseGui::showLog");
    29962933
    29972934        exitFullscreenIfNeeded();
    29982935
    29992936        smplayer_log_window->setText( smplayer_log );
    3000     smplayer_log_window->show();
    3001 }
     2937        smplayer_log_window->show();
     2938}
     2939#endif
    30022940
    30032941
     
    30843022        titles_menu->addActions( titleGroup->actions() );
    30853023
    3086 #if GENERIC_CHAPTER_SUPPORT
     3024        // Chapters
    30873025        chapterGroup->clear(true);
    3088         if (core->mdat.chapters > 0) {
    3089                 for (n=0; n < core->mdat.chapters; n++) {
     3026        if (core->mdat.chapters.numItems() > 0) {
     3027                for (n=0; n < core->mdat.chapters.numItems(); n++) {
    30903028                        QAction *a = new QAction(chapterGroup);
    3091                         a->setCheckable(true);
     3029                        //a->setCheckable(true);
     3030                        a->setText(core->mdat.chapters.itemAt(n).name());
     3031                        a->setData(n + Core::firstChapter());
     3032                }
     3033        }
     3034        else
     3035        if (core->mdat.n_chapters > 0) {
     3036                for (n=0; n < core->mdat.n_chapters; n++) {
     3037                        QAction *a = new QAction(chapterGroup);
     3038                        //a->setCheckable(true);
    30923039                        a->setText( QString::number(n+1) );
    30933040                        a->setData( n + Core::firstChapter() );
    30943041                }
    3095         } else {
     3042        }
     3043        else {
    30963044                QAction * a = chapterGroup->addAction( tr("<empty>") );
    30973045                a->setEnabled(false);
    30983046        }
    30993047        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
    31263048
    31273049        // Angles
     
    32533175        deringAct->setChecked( core->mset.dering_filter );
    32543176
     3177        // Gradfun
     3178        gradfunAct->setChecked( core->mset.gradfun_filter );
     3179
    32553180        // Add noise
    32563181        addNoiseAct->setChecked( core->mset.noise_filter );
     
    32683193        // Denoise submenu
    32693194        denoiseGroup->setChecked( core->mset.current_denoiser );
     3195
     3196        // Unsharp submenu
     3197        unsharpGroup->setChecked( core->mset.current_unsharp );
    32703198
    32713199        /*
     
    34223350        // If file is a playlist, open that playlist
    34233351        QString extension = QFileInfo(file).suffix().toLower();
    3424         if ( (extension=="m3u") || (extension=="m3u8") ) {
     3352        if ( ((extension=="m3u") || (extension=="m3u8")) && (QFile::exists(file)) ) {
    34253353                playlist->load_m3u(file);
    34263354        }
     
    45684496        actions_list += ActionsEditor::actionsNames(playlist);
    45694497#endif
    4570 
    4571         if (server) server->setActionsList( actions_list );
    45724498}
    45734499
     
    46344560                d.setText(tr("MPlayer has finished unexpectedly.") + " " +
    46354561                      tr("Exit code: %1").arg(exit_code));
     4562#ifdef LOG_MPLAYER
    46364563                d.setLog( mplayer_log );
     4564#endif
    46374565                d.exec();
    46384566        }
     
    46564584                      tr("See the log for more info."));
    46574585                }
     4586#ifdef LOG_MPLAYER
    46584587                d.setLog( mplayer_log );
     4588#endif
    46594589                d.exec();
    46604590        }
     
    46624592
    46634593
     4594#ifdef FIND_SUBTITLES
    46644595void BaseGui::showFindSubtitlesDialog() {
    46654596        qDebug("BaseGui::showFindSubtitlesDialog");
     
    46844615        QDesktopServices::openUrl( QUrl("http://www.opensubtitles.org/uploadjava") );
    46854616}
    4686 
     4617#endif
     4618
     4619#ifdef VIDEOPREVIEW
    46874620void BaseGui::showVideoPreviewDialog() {
    46884621        qDebug("BaseGui::showVideoPreviewDialog");
     
    47194652        }
    47204653}
     4654#endif
    47214655
    47224656void BaseGui::showTubeBrowser() {
    47234657        qDebug("BaseGui::showTubeBrowser");
    4724         if (!QProcess::startDetached("smtube", QStringList())) {
     4658        QString exec = Paths::appPath() + "/smtube";
     4659        qDebug("BaseGui::showTubeBrowser: '%s'", exec.toUtf8().constData());
     4660        if (!QProcess::startDetached(exec, QStringList())) {
    47254661                QMessageBox::warning(this, tr("An error happened - SMPlayer"), tr("The YouTube Browser couldn't be launched"));
    47264662        }
Note: See TracChangeset for help on using the changeset viewer.