/*
Copyright (C) 2022 Lari Varjonen <[email protected]>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
version 2 as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef MAIN_WINDOW_H
#define MAIN_WINDOW_H
#include <QMainWindow>
#include <QRandomGenerator>
#include <QFileDialog>
#include <QProcess>
#include <QCollator>
#include <QDir>
#include <QUrl>
#include <QLabel>
#include <QDragEnterEvent>
#include <QMimeData>
#include "draw_pixmap.h"
#include "info_view.h"
#include "processing.h"
#include "draw_pixmap.h"
#include "frames_extractor.h"
#include "about_window.h"
QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACE
class MainWindow : public QMainWindow
{
Q_OBJECT
const QString app_version = "1.6";
const QString app_name = "Video Photographer";
const QString FFMPEG_EXE = ffmpeg_path();
const QString STAT_EXE = stat_path();
QString current_video_path;
int count_spin;
int start_time;
int end_time;
double current_video_fps;
int video_frame_count;
public:
MainWindow(QWidget *parent = nullptr);
~MainWindow();
static QString ffmpeg_path(QString path = "")
{
static QString ffmpeg_path = "/usr/bin/ffmpeg";
if (!path.isEmpty())
{
ffmpeg_path = path;
}
return ffmpeg_path;
}
static QString stat_path(QString path = "")
{
static QString stat_path = "/usr/bin/stat";
if (!path.isEmpty())
{
stat_path = path;
}
return stat_path;
}
private slots:
void on_select_video_button_clicked();
void on_generate_image_button_clicked();
void on_updatetext_button_clicked();
void on_save_image_button_clicked();
void on_action_About_triggered();
void on_action_Exit_triggered();
void on_action_hide_signature_changed();
void on_action_hide_timestamp_changed();
private:
Ui::MainWindow *ui;
FramesExtractor *fe;
DrawPixmap *draw_pixmap;
QLabel *image_label;
void update_video_info();
QMap<QString, QString> get_video_info(QString video_path);
QString get_random_string(int size);
void get_pictures_from_video(double start_frame, double end_frame);
protected:
virtual void dragEnterEvent(QDragEnterEvent *event);
virtual void dropEvent(QDropEvent *event);
};
#endif // MAIN_WINDOW_H
/* Copyright (C) 2022 Lari Varjonen <[email protected]> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef MAIN_WINDOW_H #define MAIN_WINDOW_H #include <QMainWindow> #include <QRandomGenerator> #include <QFileDialog> #include <QProcess> #include <QCollator> #include <QDir> #include <QUrl> #include <QLabel> #include <QDragEnterEvent> #include <QMimeData> #include "draw_pixmap.h" #include "info_view.h" #include "processing.h" #include "draw_pixmap.h" #include "frames_extractor.h" #include "about_window.h" QT_BEGIN_NAMESPACE namespace Ui { class MainWindow; } QT_END_NAMESPACE class MainWindow : public QMainWindow { Q_OBJECT const QString app_version = "1.6"; const QString app_name = "Video Photographer"; const QString FFMPEG_EXE = ffmpeg_path(); const QString STAT_EXE = stat_path(); QString current_video_path; int count_spin; int start_time; int end_time; double current_video_fps; int video_frame_count; public: MainWindow(QWidget *parent = nullptr); ~MainWindow(); static QString ffmpeg_path(QString path = "") { static QString ffmpeg_path = "/usr/bin/ffmpeg"; if (!path.isEmpty()) { ffmpeg_path = path; } return ffmpeg_path; } static QString stat_path(QString path = "") { static QString stat_path = "/usr/bin/stat"; if (!path.isEmpty()) { stat_path = path; } return stat_path; } private slots: void on_select_video_button_clicked(); void on_generate_image_button_clicked(); void on_updatetext_button_clicked(); void on_save_image_button_clicked(); void on_action_About_triggered(); void on_action_Exit_triggered(); void on_action_hide_signature_changed(); void on_action_hide_timestamp_changed(); private: Ui::MainWindow *ui; FramesExtractor *fe; DrawPixmap *draw_pixmap; QLabel *image_label; void update_video_info(); QMap<QString, QString> get_video_info(QString video_path); QString get_random_string(int size); void get_pictures_from_video(double start_frame, double end_frame); protected: virtual void dragEnterEvent(QDragEnterEvent *event); virtual void dropEvent(QDropEvent *event); }; #endif // MAIN_WINDOW_H
/*
    Copyright (C) 2022 Lari Varjonen <[email protected]>

    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public License
    version 2 as published by the Free Software Foundation.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
*/

#ifndef MAIN_WINDOW_H
#define MAIN_WINDOW_H

#include <QMainWindow>

#include <QRandomGenerator>
#include <QFileDialog>
#include <QProcess>
#include <QCollator>
#include <QDir>
#include <QUrl>
#include <QLabel>

#include <QDragEnterEvent>
#include <QMimeData>

#include "draw_pixmap.h"
#include "info_view.h"
#include "processing.h"
#include "draw_pixmap.h"
#include "frames_extractor.h"
#include "about_window.h"


QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACE


class MainWindow : public QMainWindow
{
    Q_OBJECT

    const QString app_version = "1.6";
    const QString app_name = "Video Photographer";

    const QString FFMPEG_EXE = ffmpeg_path();
    const QString STAT_EXE = stat_path();

    QString current_video_path;

    int count_spin;
    int start_time;
    int end_time;
    double current_video_fps;
    int video_frame_count;

public:
    MainWindow(QWidget *parent = nullptr);
    ~MainWindow();

    static QString ffmpeg_path(QString path = "")
    {
        static QString ffmpeg_path = "/usr/bin/ffmpeg";
        if (!path.isEmpty())
        {
            ffmpeg_path = path;
        }
        return ffmpeg_path;
    }

    static QString stat_path(QString path = "")
    {
        static QString stat_path = "/usr/bin/stat";
        if (!path.isEmpty())
        {
            stat_path = path;
        }
        return stat_path;
    }

private slots:
    void on_select_video_button_clicked();
    void on_generate_image_button_clicked();
    void on_updatetext_button_clicked();
    void on_save_image_button_clicked();

    void on_action_About_triggered();
    void on_action_Exit_triggered();
    void on_action_hide_signature_changed();
    void on_action_hide_timestamp_changed();

private:

    Ui::MainWindow *ui;
    FramesExtractor *fe;
    DrawPixmap *draw_pixmap;
    QLabel *image_label;

    void update_video_info();
    QMap<QString, QString> get_video_info(QString video_path);
    QString get_random_string(int size);
    void get_pictures_from_video(double start_frame, double end_frame);

protected:
    virtual void dragEnterEvent(QDragEnterEvent *event);
    virtual void dropEvent(QDropEvent *event);
};
#endif // MAIN_WINDOW_H