mirror of
https://github.com/lostjared/Acid.Cam.v2.Qt.git
synced 2025-12-18 21:00:13 +01:00
set precision for QTextStream for seconds and added percentage for video file
This commit is contained in:
@@ -211,6 +211,7 @@ AC_MainWindow::~AC_MainWindow() {
|
|||||||
delete playback;
|
delete playback;
|
||||||
}
|
}
|
||||||
AC_MainWindow::AC_MainWindow(QWidget *parent) : QMainWindow(parent) {
|
AC_MainWindow::AC_MainWindow(QWidget *parent) : QMainWindow(parent) {
|
||||||
|
programMode = MODE_CAMERA;
|
||||||
init_plugins();
|
init_plugins();
|
||||||
generate_map();
|
generate_map();
|
||||||
setGeometry(100, 100, 800, 600);
|
setGeometry(100, 100, 800, 600);
|
||||||
@@ -448,6 +449,7 @@ void AC_MainWindow::Log(const QString &s) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool AC_MainWindow::startCamera(int res, int dev, const QString &outdir, bool record) {
|
bool AC_MainWindow::startCamera(int res, int dev, const QString &outdir, bool record) {
|
||||||
|
programMode = MODE_CAMERA;
|
||||||
// setup device
|
// setup device
|
||||||
step_frame = false;
|
step_frame = false;
|
||||||
video_file_name = "";
|
video_file_name = "";
|
||||||
@@ -525,6 +527,7 @@ bool AC_MainWindow::startCamera(int res, int dev, const QString &outdir, bool re
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool AC_MainWindow::startVideo(const QString &filename, const QString &outdir, bool record) {
|
bool AC_MainWindow::startVideo(const QString &filename, const QString &outdir, bool record) {
|
||||||
|
programMode = MODE_VIDEO;
|
||||||
video_file_name = "";
|
video_file_name = "";
|
||||||
step_frame = false;
|
step_frame = false;
|
||||||
capture_video.open(filename.toStdString());
|
capture_video.open(filename.toStdString());
|
||||||
@@ -815,7 +818,17 @@ void AC_MainWindow::updateFrame(QImage img) {
|
|||||||
frame_index++;
|
frame_index++;
|
||||||
QString frame_string;
|
QString frame_string;
|
||||||
QTextStream frame_stream(&frame_string);
|
QTextStream frame_stream(&frame_string);
|
||||||
|
|
||||||
|
frame_stream.setRealNumberPrecision(4);
|
||||||
|
|
||||||
frame_stream << "(Current/Total Frames/Seconds) - (" << frame_index << "/" << video_frames << "/" << (frame_index/video_fps) << ") ";
|
frame_stream << "(Current/Total Frames/Seconds) - (" << frame_index << "/" << video_frames << "/" << (frame_index/video_fps) << ") ";
|
||||||
|
if(programMode == MODE_VIDEO) {
|
||||||
|
|
||||||
|
float index = frame_index;
|
||||||
|
float max_frames = video_frames;
|
||||||
|
|
||||||
|
frame_stream << " - " << (index/max_frames)*100 << "%";
|
||||||
|
}
|
||||||
statusBar()->showMessage(frame_string);
|
statusBar()->showMessage(frame_string);
|
||||||
|
|
||||||
if(take_snapshot == true) {
|
if(take_snapshot == true) {
|
||||||
|
|||||||
@@ -50,6 +50,8 @@ private:
|
|||||||
QLabel *img_label;
|
QLabel *img_label;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum VideoMode { MODE_CAMERA = 0, MODE_VIDEO };
|
||||||
|
|
||||||
class AC_MainWindow : public QMainWindow {
|
class AC_MainWindow : public QMainWindow {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
@@ -104,7 +106,7 @@ private:
|
|||||||
bool take_snapshot;
|
bool take_snapshot;
|
||||||
unsigned long file_pos, frame_index;
|
unsigned long file_pos, frame_index;
|
||||||
Playback *playback;
|
Playback *playback;
|
||||||
|
VideoMode programMode;
|
||||||
void buildVector(std::vector<std::pair<int,int>> &v);
|
void buildVector(std::vector<std::pair<int,int>> &v);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user