diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2009-08-12 17:06:28 -0400 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2009-08-12 17:06:28 -0400 |
commit | fd83b6f75ed631bdcde4030984019146380d259c (patch) | |
tree | 112869e702b7cbc04ef972f6a4163e970bbebf96 | |
parent | Moved movieFile() into three seperate functions instead of returning QStringList (thanks Fred Emmott). (diff) | |
download | Subtitler-fd83b6f75ed631bdcde4030984019146380d259c.tar.xz Subtitler-fd83b6f75ed631bdcde4030984019146380d259c.zip |
Bounds checking and style.
-rw-r--r-- | moviefileselectorpage.cpp | 6 | ||||
-rw-r--r-- | subtitleparser.cpp | 5 |
2 files changed, 7 insertions, 4 deletions
diff --git a/moviefileselectorpage.cpp b/moviefileselectorpage.cpp index 6243cae..0ff58a4 100644 --- a/moviefileselectorpage.cpp +++ b/moviefileselectorpage.cpp @@ -30,17 +30,17 @@ void MovieFileHolder::populate(const QString &directory) } QString MovieFileHolder::movieFile() const { - if (!currentItem()) return QString::null; + if (!currentItem()) return QString(); return currentItem()->data(Qt::UserRole + 0).toString(); } QString MovieFileHolder::movieTitle() const { - if (!currentItem()) return QString::null; + if (!currentItem()) return QString(); return currentItem()->text(); } QString MovieFileHolder::subtitleFile() const { - if (!currentItem()) return QString::null; + if (!currentItem()) return QString(); return currentItem()->data(Qt::UserRole + 1).toString(); } MovieFileSelectorPage::MovieFileSelectorPage(QWidget *parent) diff --git a/subtitleparser.cpp b/subtitleparser.cpp index 6527ae2..2c91f06 100644 --- a/subtitleparser.cpp +++ b/subtitleparser.cpp @@ -13,7 +13,10 @@ Subtitle::Subtitle(const QString &text, quint64 start, quint64 stop) } void Subtitle::offsetTime(qint64 time) { - m_offset = time; + if (time < 0 && static_cast<qint64>(m_start) < -time) + m_offset = -m_start; + else + m_offset = time; } bool Subtitle::isContainedIn(quint64 time) const { |