[SCM] bdsup2sub++/master: Sync with upstream

amichaelt-guest at users.alioth.debian.org amichaelt-guest at users.alioth.debian.org
Wed Jul 18 22:48:16 UTC 2012


The following commit has been merged in the master branch:
commit 03d218c9b723f89eb1b9ba715b36578f76a37a6f
Author: Adam Thomas-Murphy <adam at debian>
Date:   Wed Jul 18 18:47:59 2012 -0400

    Sync with upstream

diff --git a/src/Subtitles/subtitleprocessor.cpp b/src/Subtitles/subtitleprocessor.cpp
index c687856..16acfd7 100644
--- a/src/Subtitles/subtitleprocessor.cpp
+++ b/src/Subtitles/subtitleprocessor.cpp
@@ -1740,7 +1740,7 @@ void SubtitleProcessor::moveToBounds(SubPicture *picture, int index, double barF
         }
         else if ((picture->getImageWidth() + picture->getOfsX() + offsetX) > picture->width())
         {
-            picture->setOfsX(picture->width() - (picture->getImageWidth() + picture->getOfsX()));
+            picture->setOfsX(picture->getOfsX() + (picture->width() - (picture->getImageWidth() + picture->getOfsX())));
         }
         else
         {
diff --git a/src/bdsup2sub.cpp b/src/bdsup2sub.cpp
index 030d6ad..d0943f9 100644
--- a/src/bdsup2sub.cpp
+++ b/src/bdsup2sub.cpp
@@ -338,7 +338,7 @@ void BDSup2Sub::init()
 
     ui->consoleOutput->insertPlainText(progNameVer + " - a converter from Blu-Ray/HD-DVD SUP to DVD SUB/IDX and more\n");
     ui->consoleOutput->insertPlainText(authorDate + "\n");
-    ui->consoleOutput->insertPlainText("Official thread at Doom9: http://forum.doom9.org/showthread.php?t=145277\n\n");
+    ui->consoleOutput->insertPlainText("Official thread at Doom9: https://forum.doom9.org/showthread.php?t=165416\n\n");
 
     if (subtitleProcessor == 0)
     {
@@ -378,8 +378,8 @@ void BDSup2Sub::init()
 void BDSup2Sub::loadSettings()
 {
     //Rename INI file to name matching the new program name
-    QString oldIniFilePath = QString("%1/%2").arg(QDir::currentPath()).arg(oldIniName);
-    QString newIniFilePath = QString("%1/%2").arg(QDir::currentPath()).arg(iniName);
+    QString oldIniFilePath = QString("%1/%2").arg(QApplication::applicationDirPath()).arg(oldIniName);
+    QString newIniFilePath = QString("%1/%2").arg(QApplication::applicationDirPath()).arg(iniName);
     QFileInfo oldIniFileInfo = QFileInfo(oldIniFilePath);
     if (oldIniFileInfo.exists())
     {
@@ -565,7 +565,7 @@ void BDSup2Sub::openFile()
         connectSubtitleProcessor();
     }
     QString fileName = QFileDialog::getOpenFileName(this, tr("Open"),
-                                                    loadPath.isEmpty() ? QDir::currentPath() : QFileInfo(loadPath).absolutePath(),
+                                                    loadPath.isEmpty() ? QApplication::applicationDirPath() : QFileInfo(loadPath).absolutePath(),
                                                     filter,
                                                     &selectedFilter
                                                     );
@@ -693,7 +693,7 @@ void BDSup2Sub::loadSubtitleFile()
     if (extension == "sup" && streamID == StreamID::SUP)
     {
         QString fileName = QFileDialog::getOpenFileName(this, tr("Open IFO file"),
-                                                        loadPath.isEmpty() ? QDir::currentPath() : QFileInfo(loadPath).absolutePath(),
+                                                        loadPath.isEmpty() ? QApplication::applicationDirPath() : QFileInfo(loadPath).absolutePath(),
                                                         ifoFilter,
                                                         &ifoFilter
                                                         );
@@ -1677,28 +1677,48 @@ bool BDSup2Sub::execCLI(int argc, char** argv)
 
                 subtitleProcessor->setLoadPath(src);
 
-                if (xml || sid == StreamID::XML)
+                try
                 {
-                    subtitleProcessor->readXml();
-                }
-                else if (idx || sid == StreamID::DVDSUB || sid == StreamID::IDX)
-                {
-                    subtitleProcessor->readDVDSubStream(sid, true);
-                }
-                else if (ifo || sid == StreamID::IFO)
-                {
-                    subtitleProcessor->readDVDSubStream(sid, false);
-                }
-                else
-                {
-                    if (QFileInfo(QString("%1/%2.ifo").arg(srcFileInfo.absolutePath()).arg(srcFileInfo.completeBaseName())).exists())
+                    if (xml || sid == StreamID::XML)
+                    {
+                        subtitleProcessor->readXml();
+                    }
+                    else if (idx || sid == StreamID::DVDSUB || sid == StreamID::IDX)
+                    {
+                        subtitleProcessor->readDVDSubStream(sid, true);
+                    }
+                    else if (ifo || sid == StreamID::IFO)
                     {
                         subtitleProcessor->readDVDSubStream(sid, false);
                     }
-                    else
+                    else if (sid == StreamID::BDSUP)
                     {
                         subtitleProcessor->readSup();
                     }
+                    else
+                    {
+                        if (QFileInfo(QString("%1/%2.ifo").arg(srcFileInfo.absolutePath()).arg(srcFileInfo.completeBaseName())).exists())
+                        {
+                            subtitleProcessor->readDVDSubStream(sid, false);
+                        }
+                        else
+                        {
+                            try
+                            {
+                                subtitleProcessor->readDVDSubStream(sid, false);
+                            }
+                            catch(QString e)
+                            {
+                                outStream << "SUP file was not a valid DVD SUP file. Attempting to load as HD DVD SUP.\n";
+                                subtitleProcessor->readSup();
+                            }
+                        }
+                    }
+                }
+                catch (QString e)
+                {
+                    errorStream << e;
+                    exit(1);
                 }
 
                 printWarnings(outStream);
@@ -1726,8 +1746,14 @@ bool BDSup2Sub::execCLI(int argc, char** argv)
                     lumaThr.replace(1, lumThr2);
                 }
                 subtitleProcessor->setLuminanceThreshold(lumaThr);
-                subtitleProcessor->setAlphaThreshold(alphaThreshold);
-                subtitleProcessor->setLanguageIdx(langIdx);
+                if (alphaThreshold > 0)
+                {
+                    subtitleProcessor->setAlphaThreshold(alphaThreshold);
+                }
+                if (langIdx > 0)
+                {
+                    subtitleProcessor->setLanguageIdx(langIdx);
+                }
                 subtitleProcessor->writeSub(trg);
             }
             catch(QString e)
@@ -2023,25 +2049,27 @@ void BDSup2Sub::moveAllCaptions_triggered()
 {
     MoveDialog moveDialog(this, subtitleProcessor);
     moveDialog.setIndex(subIndex);
-    moveDialog.exec();
-    if (subtitleProcessor->getMoveCaptions())
-    {
-        subtitleProcessor->moveAll();
-    }
-    subIndex = moveDialog.getIndex();
-    ui->subtitleImage->setScreenRatio(moveDialog.getTrgRatio());
-    try
-    {
-        subtitleProcessor->convertSup(subIndex, subIndex + 1, subtitleProcessor->getNumberOfFrames());
-    }
-    catch (QString e)
+    if (moveDialog.exec() != QDialog::Rejected)
     {
-        errorDialog(e);
-        return;
+        if (subtitleProcessor->getMoveCaptions())
+        {
+            subtitleProcessor->moveAll();
+        }
+        subIndex = moveDialog.getIndex();
+        ui->subtitleImage->setScreenRatio(moveDialog.getTrgRatio());
+        try
+        {
+            subtitleProcessor->convertSup(subIndex, subIndex + 1, subtitleProcessor->getNumberOfFrames());
+        }
+        catch (QString e)
+        {
+            errorDialog(e);
+            return;
+        }
+        refreshSrcFrame(subIndex);
+        refreshTrgFrame(subIndex);
+        ui->subtitleNumberComboBox->setCurrentIndex(subIndex);
     }
-    refreshSrcFrame(subIndex);
-    refreshTrgFrame(subIndex);
-    ui->subtitleNumberComboBox->setCurrentIndex(subIndex);
 }
 
 void BDSup2Sub::resetCropOffset_triggered()
diff --git a/src/bdsup2sub.ui b/src/bdsup2sub.ui
index 007f510..a62a5f6 100644
--- a/src/bdsup2sub.ui
+++ b/src/bdsup2sub.ui
@@ -87,6 +87,9 @@
        </property>
        <item>
         <layout class="QVBoxLayout" name="subtitleLanguageLayout">
+         <property name="spacing">
+          <number>0</number>
+         </property>
          <property name="sizeConstraint">
           <enum>QLayout::SetFixedSize</enum>
          </property>
@@ -530,7 +533,7 @@
          <x>0</x>
          <y>0</y>
          <width>812</width>
-         <height>147</height>
+         <height>149</height>
         </rect>
        </property>
        <layout class="QGridLayout" name="gridLayout">
@@ -602,7 +605,7 @@
          <x>0</x>
          <y>0</y>
          <width>812</width>
-         <height>148</height>
+         <height>150</height>
         </rect>
        </property>
        <layout class="QGridLayout" name="gridLayout_2">
diff --git a/src/colordialog.cpp b/src/colordialog.cpp
index b31fb21..5fe12d4 100644
--- a/src/colordialog.cpp
+++ b/src/colordialog.cpp
@@ -98,7 +98,7 @@ void ColorDialog::on_restoreDefaultColorsButton_clicked()
 void ColorDialog::on_savePaletteButton_clicked()
 {
     QString filePath = QFileDialog::getSaveFileName(this, tr("Save"),
-                                                    colorPath == "" ? QDir::currentPath() :
+                                                    colorPath == "" ? QApplication::applicationDirPath() :
                                                                       QFileInfo(colorPath).absolutePath(),
                                                     filter,
                                                     &selectedFilter);
@@ -126,7 +126,7 @@ void ColorDialog::on_savePaletteButton_clicked()
 void ColorDialog::on_loadPaletteButton_clicked()
 {
     QString filePath = QFileDialog::getOpenFileName(this, tr("Save"),
-                                                    colorPath == "" ? QDir::currentPath() :
+                                                    colorPath == "" ? QApplication::applicationDirPath() :
                                                                       QFileInfo(colorPath).absolutePath(),
                                                     filter,
                                                     &selectedFilter);

-- 
bdsup2sub++ packaging



More information about the pkg-multimedia-commits mailing list