Skip to content

Commit

Permalink
Adapt to canadainc lib changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
ragaeeb committed Feb 9, 2016
1 parent 72d1476 commit 4759080
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 7 deletions.
2 changes: 1 addition & 1 deletion assets/BookmarksTab.qml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ NavigationPane
ListView
{
id: listView
property alias formatter: textUtils
property alias formatter: app
property alias activeImage: activePaint

verticalAlignment: VerticalAlignment.Fill
Expand Down
2 changes: 1 addition & 1 deletion assets/NotesDialog.qml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Dialog
property variant position

onPositionChanged: {
textArea.hintText = formatter.formatTime(position);
textArea.hintText = app.formatTime(position);
}

Container
Expand Down
6 changes: 3 additions & 3 deletions assets/PlaybackControl.qml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ Container
timer.refresh();
touchedDown = false;
} else if ( event.isMove() ) {
seekerLabel.positionText = textUtils.formatTime(immediateValue);
seekerLabel.positionText = app.formatTime(immediateValue);
} else if ( event.isDown() ) {
timer.stop();
touchedDown = true;
Expand Down Expand Up @@ -79,11 +79,11 @@ Container

onCreationCompleted: {
player.durationChanged.connect( function(duration) {
durationText = textUtils.formatTime(duration);
durationText = app.formatTime(duration);
});

player.positionChanged.connect( function(position) {
positionText = textUtils.formatTime(position);
positionText = app.formatTime(position);
});
}
}
Expand Down
2 changes: 1 addition & 1 deletion assets/RecentTab.qml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ NavigationPane
ListView
{
id: listView
property alias formatter: textUtils
property alias formatter: app

verticalAlignment: VerticalAlignment.Fill
horizontalAlignment: HorizontalAlignment.Fill
Expand Down
18 changes: 17 additions & 1 deletion src/BackgroundVideo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ QString BackgroundVideo::exportAllBookmarks(QObject* q)
result += last.mid( last.lastIndexOf("/")+1 )+"\n";
}

QString t = TextUtils::formatTime( current.value("position").toInt() );
QString t = formatTime( current.value("position").toInt() );
result += QString("%1: %2").arg(t).arg( current.value("body").toString() )+"\n";
}
}
Expand All @@ -265,4 +265,20 @@ void BackgroundVideo::clearAllBookmarks()
fetchAllBookmarks();
}


QString BackgroundVideo::formatTime(unsigned int duration)
{
unsigned int secs = floor(duration / 1000);
secs %= 60;
unsigned int mins = floor( (duration / (1000 * 60) ) % 60);
unsigned int hrs = floor( (duration / (1000 * 60 * 60) ) % 24);

QString seconds = QString::number(secs).rightJustified(2,'0');
QString minutes = QString::number(mins).rightJustified(2,'0');
QString hours = hrs > 0 ? QString("%1:").arg(hrs) : "";

return QString("%1%2:%3").arg(hours).arg(minutes).arg(seconds);
}


}
6 changes: 6 additions & 0 deletions src/BackgroundVideo.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,12 @@ private slots:
Q_INVOKABLE void clearAllRecent();
Q_INVOKABLE void clearAllBookmarks();
Q_INVOKABLE QString exportAllBookmarks(QObject* gdm);

/**
* @param A duration in milliseconds.
* @return 15:12:04
*/
Q_INVOKABLE static QString formatTime(unsigned int duration);
};

}
Expand Down

0 comments on commit 4759080

Please sign in to comment.