Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Attorney_Online.pro
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
QT += core gui widgets network websockets uitools
QT += core gui widgets network websockets uitools multimediawidgets

TARGET = Attorney_Online
TEMPLATE = app
Expand Down
4 changes: 4 additions & 0 deletions include/aoapplication.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ class AOApplication : public QApplication {
bool desk_mod_supported = false;
bool evidence_supported = false;
bool cccc_ic_supported = false;
bool video_supported = false;
bool arup_supported = false;
bool casing_alerts_supported = false;
bool modcall_reason_supported = false;
Expand Down Expand Up @@ -331,6 +332,9 @@ class AOApplication : public QApplication {
// Returns if the sfx is defined as looping in char.ini
QString get_sfx_looping(QString p_char, int p_emote);

// Returns the video filename for that emote
QString get_video_name(QString p_char, int p_emote);

// Returns if an emote has a frame specific SFX for it
QString get_sfx_frame(QString p_char, QString p_emote, int n_frame);

Expand Down
23 changes: 23 additions & 0 deletions include/aographicsview.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#include <QGraphicsScene>
#include <QGraphicsView>

#include <QGraphicsItem>
#include <QObject>
#include <QResizeEvent>

#include <QDebug>

class AOGraphicsView : public QGraphicsView
{
Q_OBJECT

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

protected:
void resizeEvent(QResizeEvent *event) final;

private:
QGraphicsScene *m_scene;
};
14 changes: 13 additions & 1 deletion include/courtroom.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
#include "scrolltext.h"
#include "eventfilters.h"
#include "aoemotepreview.h"
#include "video/videoscreen.h"
#include "aographicsview.h"

#include <QCheckBox>
#include <QCloseEvent>
Expand All @@ -47,6 +49,9 @@
#include <QMenuBar>
#include <QShortcut>

#include <QGraphicsItem>
#include <QGraphicsView>

#include <QBrush>
#include <QDebug>
#include <QDesktopServices>
Expand Down Expand Up @@ -276,6 +281,9 @@ class Courtroom : public QMainWindow {
// Display the evidence image box when presenting evidence in IC
void display_evidence_image();

// Handle video playback before passing over to the next step
void handle_video();

// Handle the stuff that comes when the character appears on screen and starts animating (preanims etc.)
void handle_ic_message();

Expand Down Expand Up @@ -564,7 +572,7 @@ class Courtroom : public QMainWindow {

// Minumum and maximum number of parameters in the MS packet
static const int MS_MINIMUM = 15;
static const int MS_MAXIMUM = 35;
static const int MS_MAXIMUM = 36;
QString m_chatmessage[MS_MAXIMUM];

QString previous_ic_message = "";
Expand Down Expand Up @@ -759,6 +767,8 @@ class Courtroom : public QMainWindow {
QLabel *ui_vp_showname;
InterfaceLayer *ui_vp_chat_arrow;
QTextEdit *ui_vp_message;
AOGraphicsView *ui_vp_graphics;
VideoScreen *ui_vp_video;
SplashLayer *ui_vp_testimony;
SplashLayer *ui_vp_wtce;
EffectLayer *ui_vp_effect;
Expand Down Expand Up @@ -942,6 +952,8 @@ class Courtroom : public QMainWindow {
void show_evidence(int f_real_id);
void set_evidence_page();

void video_finished();

void reset_ui();

void regenerate_ic_chatlog();
Expand Down
1 change: 1 addition & 0 deletions include/datatypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ enum CHAT_MESSAGE {
THIRD_EMOTE,
THIRD_OFFSET,
THIRD_FLIP,
VIDEO,
};

enum EMOTE_MOD_TYPE {
Expand Down
20 changes: 20 additions & 0 deletions include/mediatester.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#include <QMediaPlayer>
#include <QObject>

class MediaTester : public QObject
{
Q_OBJECT

public:
MediaTester(QObject *parent = nullptr);
~MediaTester();

signals:
void done();

private:
QMediaPlayer m_player;

private slots:
void p_check_status(QMediaPlayer::MediaStatus p_status);
};
64 changes: 64 additions & 0 deletions include/video/videoscreen.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
#include "aoapplication.h"
#include "options.h"


#include <QGraphicsVideoItem>
#include <QVideoWidget>
#include <QMediaPlayer>

class VideoScreen : public QGraphicsVideoItem
{
Q_OBJECT

public:
VideoScreen(AOApplication *p_ao_app, QGraphicsItem *parent = nullptr);
~VideoScreen();

QString get_file_name() const;

void update_audio_output();

void set_volume(int p_value);

void set_muted(bool p_toggle);

public slots:
void set_file_name(QString file_name);

void play_character_video(QString character, QString video);

void play();

void stop();

signals:
void started();

void finished();

private:
QWidget *m_parent;

AOApplication *ao_app;

QString m_file_name;

bool m_scanned;

bool m_video_available;

bool m_running;

QMediaPlayer *m_player;

void start_playback();

void finish_playback();

private slots:
void update_video_availability(bool);

void check_status(QMediaPlayer::MediaStatus);

void check_state(QMediaPlayer::State);
};
Binary file added resource/data_sample.avi
Binary file not shown.
1 change: 1 addition & 0 deletions resources.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,6 @@
<file>resource/ui/lobby_assets/tab_motd_off_hover.png</file>
<file>resource/ui/lobby_assets/tab_motd_on.png</file>
<file>resource/ui/lobby_assets/tab_motd_on_hover.png</file>
<file>resource/data_sample.avi</file>
</qresource>
</RCC>
39 changes: 39 additions & 0 deletions src/aographicsview.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#include "aographicsview.h"

AOGraphicsView::AOGraphicsView(QWidget *parent)
: QGraphicsView(parent)
, m_scene(new QGraphicsScene(this))
{
setInteractive(false);

setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);

setFrameShape(QFrame::NoFrame);
setFrameStyle(0);

// Currently only used for video playback so always assume smooth transform for now
setRenderHints(QPainter::SmoothPixmapTransform);

setScene(m_scene);

setBackgroundBrush(Qt::transparent);
}

AOGraphicsView::~AOGraphicsView()
{}

void AOGraphicsView::resizeEvent(QResizeEvent *event)
{
QGraphicsView::resizeEvent(event);
for (QGraphicsItem *i_item : scene()->items())
{
auto l_object = dynamic_cast<QObject *>(i_item);
if (l_object)
{
l_object->setProperty("size", event->size());
}
}
m_scene->setSceneRect(rect());
setSceneRect(rect());
}
3 changes: 2 additions & 1 deletion src/aomusicplayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,8 @@ QString AOMusicPlayer::play(QString p_song, int channel, bool loop,
p_song_clear = p_song_clear.left(p_song_clear.lastIndexOf('.'));

if (is_stop) {
return QObject::tr("None");
// No music just clears out the displayer
return "";
}

if (error_code == BASS_ERROR_HANDLE) { // Cheap hack to see if file missing
Expand Down
Loading
Loading