Ignore:
Timestamp:
Apr 30, 2012, 7:09:25 PM (13 years ago)
Author:
Silvan Scherrer
Message:

SMPlayer vendor: 0.8.0

Location:
smplayer/vendor/current/src/findsubtitles
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • smplayer/vendor/current/src/findsubtitles/findsubtitles.pro

    r127 r130  
    1515           ../filechooser.h \
    1616           ../languages.h \
     17           fixsubs.h \
    1718           findsubtitlesconfigdialog.h \
    1819           findsubtitleswindow.h
     
    2425           ../filechooser.cpp \
    2526           ../languages.cpp \
     27           fixsubs.cpp \
    2628           findsubtitlesconfigdialog.cpp \
    2729           findsubtitleswindow.cpp \
  • smplayer/vendor/current/src/findsubtitles/findsubtitleswindow.cpp

    r127 r130  
    4040#include "quazip.h"
    4141#include "quazipfile.h"
     42#include "fixsubs.h"
    4243#include <QTemporaryFile>
    4344#include <QBuffer>
     
    130131
    131132        file_downloader = new FileDownloader(this);
    132         file_downloader->setModal(false);
     133        file_downloader->setModal(false);
    133134        connect( file_downloader, SIGNAL(downloadFailed(QString)),
    134135             this, SLOT(showError(QString)), Qt::QueuedConnection );
    135136        connect( file_downloader, SIGNAL(downloadFinished(const QByteArray &)),
    136137             this, SLOT(archiveDownloaded(const QByteArray &)), Qt::QueuedConnection );
     138        connect( this, SIGNAL(subtitleDownloaded(const QString &)),
     139             this, SLOT(fixSubtitles(const QString &)) );
    137140#endif
    138141
     
    204207        language_filter->clear();
    205208
    206         QMap<QString,QString> l = Languages::list();
    207         QMapIterator<QString, QString> i(l);
    208         while (i.hasNext()) {
    209                 i.next();
    210                 language_filter->addItem( i.value() + " (" + i.key() + ")", i.key() );
    211         }
     209        QMap<QString,QString> l1 = Languages::most_used_list();
     210        QMapIterator<QString, QString> i1(l1);
     211        while (i1.hasNext()) {
     212                i1.next();
     213                language_filter->addItem( i1.value() + " (" + i1.key() + ")", i1.key() );
     214        }
     215        language_filter->addItem( tr("Portuguese - Brasil") + " (pb)", "pb");
    212216        language_filter->model()->sort(0);
     217        #if QT_VERSION >= 0x040400
     218        language_filter->insertSeparator(language_filter->count());
     219        #endif
     220
     221        QMap<QString,QString> l2 = Languages::list();
     222        QMapIterator<QString, QString> i2(l2);
     223        while (i2.hasNext()) {
     224                i2.next();
     225                if (language_filter->findData(i2.key()) == -1) {
     226                        language_filter->addItem( i2.value() + " (" + i2.key() + ")", i2.key() );
     227                }
     228        }
     229        //language_filter->model()->sort(0);
    213230        language_filter->insertItem( 0, tr("All"), "*" );
     231        #if QT_VERSION >= 0x040400
     232        language_filter->insertSeparator(1);
     233        #endif
    214234        //language_filter->setCurrentIndex(language_index);
    215235        language_filter->setCurrentIndex(language_filter->findData(current_language));
     
    546566                        if (ok) extracted_count++;
    547567                }
    548                 status->setText(tr("%1 subtitle(s) extracted","", extracted_count).arg(extracted_count));
     568                status->setText(tr("%n subtitle(s) extracted","", extracted_count));
    549569                if (extracted_count > 0) {
    550570                        emit subtitleDownloaded( output_path +"/"+ files_to_extract[0] );
     
    596616
    597617        return true;
     618}
     619
     620void FindSubtitlesWindow::fixSubtitles(const QString & filename) {
     621        qDebug("FindSubtitlesWindow::fixSubtitles: %s", filename.toUtf8().constData());
     622
     623        QFileInfo fi(filename);
     624        if (fi.suffix().toLower() == "sub") {
     625                qDebug("FindSubtitlesWindow::fixSubtitles: fixing end of lines");
     626                if (FixSubtitles::fix(filename) != FixSubtitles::NoError) {
     627                        status->setText( tr("Error fixing the subtitle lines") );
     628                        qDebug("FindSubtitlesWindow::fixSubtitles: error fixing the subtitles");
     629                }
     630        }
    598631}
    599632
  • smplayer/vendor/current/src/findsubtitles/findsubtitleswindow.h

    r121 r130  
    104104        bool uncompressZip(const QString & filename, const QString & output_path, const QString & preferred_output_name);
    105105        bool extractFile(QuaZip & zip, const QString & filename, const QString & output_name);
     106
     107protected slots:
     108        void fixSubtitles(const QString & filename);
    106109#endif
    107110
Note: See TracChangeset for help on using the changeset viewer.