Begin setting up video recording UI

This commit is contained in:
Jeffrey Pfau 2014-10-26 18:27:53 -07:00
parent 27c7041008
commit 3dfc2bfcb3
6 changed files with 345 additions and 3 deletions

View File

@ -38,11 +38,13 @@ set(SOURCE_FILES
LogView.cpp
SavestateButton.cpp
Window.cpp
VFileDevice.cpp)
VFileDevice.cpp
VideoView.cpp)
qt5_wrap_ui(UI_FILES
LoadSaveState.ui
LogView.ui)
LogView.ui
VideoView.ui)
if(USE_GDB_STUB)
set(SOURCE_FILES ${PLATFORM_SRC} ${SOURCE_FILES} GDBController.cpp GDBWindow.cpp)

View File

@ -0,0 +1,15 @@
#include "VideoView.h"
#ifdef USE_FFMPEG
using namespace QGBA;
VideoView::VideoView(QWidget* parent)
: QWidget(parent)
{
m_ui.setupUi(this);
connect(m_ui.buttonBox, SIGNAL(rejected()), this, SLOT(close()));
}
#endif

View File

@ -0,0 +1,30 @@
#ifndef QGBA_VIDEO_VIEW
#define QGBA_VIDEO_VIEW
#ifdef USE_FFMPEG
#include <QWidget>
#include "ui_VideoView.h"
struct FFmpegEncoder;
namespace QGBA {
class VideoView : public QWidget {
Q_OBJECT
public:
VideoView(QWidget* parent = nullptr);
private:
Ui::VideoView m_ui;
FFmpegEncoder* m_encoder;
};
}
#endif
#endif

View File

@ -0,0 +1,261 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>VideoView</class>
<widget class="QWidget" name="VideoView">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>462</width>
<height>194</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle">
<string>Record Video</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<property name="sizeConstraint">
<enum>QLayout::SetFixedSize</enum>
</property>
<item row="0" column="0" rowspan="2">
<widget class="QGroupBox" name="groupBox_4">
<property name="title">
<string>Format</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_6">
<item>
<widget class="QComboBox" name="container">
<property name="editable">
<bool>true</bool>
</property>
<item>
<property name="text">
<string>MKV</string>
</property>
</item>
<item>
<property name="text">
<string>AVI</string>
</property>
</item>
<item>
<property name="text">
<string>MP4</string>
</property>
</item>
</widget>
</item>
<item>
<widget class="QComboBox" name="video">
<property name="editable">
<bool>true</bool>
</property>
<item>
<property name="text">
<string>PNG</string>
</property>
</item>
<item>
<property name="text">
<string>h.264</string>
</property>
</item>
<item>
<property name="text">
<string>Xvid</string>
</property>
</item>
<item>
<property name="text">
<string>Uncompressed</string>
</property>
</item>
</widget>
</item>
<item>
<widget class="QComboBox" name="audio">
<property name="editable">
<bool>true</bool>
</property>
<item>
<property name="text">
<string>FLAC</string>
</property>
</item>
<item>
<property name="text">
<string>Vorbis</string>
</property>
</item>
<item>
<property name="text">
<string>MP3</string>
</property>
</item>
<item>
<property name="text">
<string>AAC</string>
</property>
</item>
<item>
<property name="text">
<string>Uncompressed</string>
</property>
</item>
</widget>
</item>
</layout>
</widget>
</item>
<item row="1" column="1">
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string> Bitrate</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Video</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="buddy">
<cstring>vbr</cstring>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="vbr">
<property name="suffix">
<string/>
</property>
<property name="minimum">
<number>200</number>
</property>
<property name="maximum">
<number>9999</number>
</property>
<property name="value">
<number>800</number>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_2">
<property name="text">
<string>Audio</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="buddy">
<cstring>abr</cstring>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="abr">
<property name="minimum">
<number>16</number>
</property>
<property name="maximum">
<number>320</number>
</property>
<property name="value">
<number>192</number>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="0" column="1">
<layout class="QGridLayout" name="gridLayout">
<item row="1" column="0">
<widget class="QPushButton" name="start">
<property name="enabled">
<bool>false</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Start</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QPushButton" name="stop">
<property name="enabled">
<bool>false</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Stop</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QPushButton" name="selectFile">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Select File</string>
</property>
</widget>
</item>
<item row="0" column="0" colspan="3">
<widget class="QLineEdit" name="filename">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
</layout>
</item>
<item row="2" column="0" colspan="2">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="standardButtons">
<set>QDialogButtonBox::Close</set>
</property>
</widget>
</item>
</layout>
</widget>
<tabstops>
<tabstop>filename</tabstop>
<tabstop>start</tabstop>
<tabstop>stop</tabstop>
<tabstop>selectFile</tabstop>
<tabstop>container</tabstop>
<tabstop>video</tabstop>
<tabstop>audio</tabstop>
<tabstop>vbr</tabstop>
<tabstop>abr</tabstop>
</tabstops>
<resources/>
<connections/>
</ui>

View File

@ -11,6 +11,7 @@
#include "GDBWindow.h"
#include "LoadSaveState.h"
#include "LogView.h"
#include "VideoView.h"
extern "C" {
#include "platform/commandline.h"
@ -24,6 +25,9 @@ Window::Window(QWidget* parent)
, m_stateWindow(nullptr)
, m_screenWidget(new WindowBackground())
, m_logo(":/res/mgba-1024.png")
#ifdef USE_FFMPEG
, m_videoView(nullptr)
#endif
#ifdef USE_GDB_STUB
, m_gdbController(nullptr)
#endif
@ -57,6 +61,7 @@ Window::Window(QWidget* parent)
Window::~Window() {
delete m_logView;
delete m_videoView;
}
GBAKey Window::mapKey(int qtKey) {
@ -139,6 +144,15 @@ void Window::selectPatch() {
}
}
#ifdef USE_FFMPEG
void Window::openVideoWindow() {
if (!m_videoView) {
m_videoView = new VideoView();
}
m_videoView->show();
}
#endif
#ifdef USE_GDB_STUB
void Window::gdbOpen() {
if (!m_gdbController) {
@ -291,8 +305,11 @@ void Window::setupMenu(QMenuBar* menubar) {
quickSaveMenu->addAction(quickSave);
}
#ifdef USE_PNG
#if defined(USE_PNG) || defined(USE_FFMPEG)
fileMenu->addSeparator();
#endif
#ifdef USE_PNG
QAction* screenshot = new QAction(tr("Take &screenshot"), fileMenu);
screenshot->setShortcut(tr("F12"));
connect(screenshot, SIGNAL(triggered()), m_display, SLOT(screenshot()));
@ -300,6 +317,14 @@ void Window::setupMenu(QMenuBar* menubar) {
fileMenu->addAction(screenshot);
#endif
#ifdef USE_FFMPEG
QAction* recordOutput = new QAction(tr("Record output..."), fileMenu);
recordOutput->setShortcut(tr("F11"));
connect(recordOutput, SIGNAL(triggered()), this, SLOT(openVideoWindow()));
m_gameActions.append(recordOutput);
fileMenu->addAction(recordOutput);
#endif
#ifndef Q_OS_MAC
fileMenu->addSeparator();
fileMenu->addAction(tr("E&xit"), this, SLOT(close()), QKeySequence::Quit);

View File

@ -18,6 +18,7 @@ namespace QGBA {
class GameController;
class LogView;
class VideoView;
class WindowBackground;
class Window : public QMainWindow {
@ -45,6 +46,10 @@ public slots:
void selectPatch();
void toggleFullScreen();
#ifdef USE_FFMPEG
void openVideoWindow();
#endif
#ifdef USE_GDB_STUB
void gdbOpen();
#endif
@ -75,6 +80,10 @@ private:
WindowBackground* m_screenWidget;
QPixmap m_logo;
#ifdef USE_FFMPEG
VideoView* m_videoView;
#endif
#ifdef USE_GDB_STUB
GDBController* m_gdbController;
#endif