170 lines
4.8 KiB
C++
170 lines
4.8 KiB
C++
#include "rm_frame_bottom.h"
|
|
#include "rm_button.h"
|
|
#include "../core/rm_player.h"
|
|
#include "../data/rm_video_item_2ch.h"
|
|
#include "../fm_dimensions.h"
|
|
#include <QDesktopWidget>
|
|
|
|
RMFrameBottom::RMFrameBottom(QWidget *parent) : RMWidgetStyleBase(parent,"",true)
|
|
{
|
|
setObjectName("player_bg");
|
|
|
|
layout = new QHBoxLayout(this);
|
|
layout->setMargin(0);
|
|
layout->setSpacing(0);
|
|
layout->setAlignment(Qt::AlignLeft);
|
|
|
|
//bFrontCamera = true;
|
|
|
|
sliderControl = NULL;
|
|
playControl = NULL;
|
|
|
|
bToggleEnabled = true;
|
|
|
|
#if (!DUAL_VIEWER)
|
|
#if (MODEL_STANDARD)
|
|
QWidget* cameraControl = new QWidget(this);
|
|
cameraControl->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Preferred);
|
|
cameraControl->setFixedWidth(120*2);
|
|
layout->addWidget(cameraControl);
|
|
QHBoxLayout* cameraLayout = new QHBoxLayout(cameraControl);
|
|
cameraLayout->setAlignment(Qt::AlignCenter);
|
|
cameraLayout->setSpacing(0);
|
|
cameraLayout->setMargin(0);
|
|
|
|
#if (REAR_CAMERA_INSIDE)
|
|
frontCamera = RMButton::create(cameraControl,cameraLayout,"front_camera_inside",QString(""),QSize(110,34));
|
|
#elif (FRONT_CAMERA_MAIN)
|
|
frontCamera = RMButton::create(cameraControl,cameraLayout,"front_camera_main",QString(""),QSize(110,34));
|
|
#elif (FRONT_CAMERA_NAME_FRONT)
|
|
frontCamera = RMButton::create(cameraControl,cameraLayout,"front_camera_front",QString(""),QSize(110,34));
|
|
#else
|
|
|
|
#if (LIVE_LANGUAGE2)
|
|
frontCamera = RMButton::create2(cameraControl,cameraLayout,"front_camera",NULL,QSize(110,34));
|
|
#else // LIVE_LANGUAGE2
|
|
frontCamera = RMButton::create(cameraControl,cameraLayout,"front_camera",QString(""),QSize(110,34));
|
|
#endif // LIVE_LANGUAGE2
|
|
|
|
#endif
|
|
frontCamera->setEnabled(false);
|
|
frontCamera->setStyleStatus("on",true);
|
|
#if !(SINGLE_CH_VIEWER)
|
|
connect(frontCamera,SIGNAL(clicked()),RMPlayer::instance(),SLOT(toggleSwap()));
|
|
#endif
|
|
#if (REAR_CAMERA_INSIDE)
|
|
rearCamera = RMButton::create(cameraControl,cameraLayout,"rear_camera_inside",QString(""),QSize(110,34));
|
|
#else
|
|
|
|
#if (LIVE_LANGUAGE2)
|
|
rearCamera = RMButton::create2(cameraControl,cameraLayout,"rear_camera",NULL,QSize(110,34));
|
|
#else // LIVE_LANGUAGE2
|
|
rearCamera = RMButton::create(cameraControl,cameraLayout,"rear_camera",QString(""),QSize(110,34));
|
|
#endif // LIVE_LANGUAGE2
|
|
#endif
|
|
rearCamera->setStyleStatus("on",false);
|
|
#if !(SINGLE_CH_VIEWER)
|
|
connect(rearCamera,SIGNAL(clicked()),RMPlayer::instance(),SLOT(toggleSwap()));
|
|
#endif
|
|
#endif
|
|
|
|
#if (SINGLE_CH_VIEWER)
|
|
frontCamera->setEnabled(false);
|
|
rearCamera->setEnabled(false);
|
|
#else
|
|
connect(RMPlayer::instance(),SIGNAL(playEvent(PLAY_EVENT, RMVideoItem*)),SLOT(onPlayEvent(PLAY_EVENT, RMVideoItem*)));
|
|
#endif
|
|
|
|
|
|
#endif // !DUAL_VIEWER
|
|
|
|
|
|
|
|
|
|
this->setFixedHeight(BOTTOM_FRAME_HEIGHT);
|
|
setHidden(true);
|
|
|
|
#if (LIVE_LANGUAGE_CHANGE && MODEL_STANDARD)
|
|
connect(RMLanguage::instance(),SIGNAL(languageChange(RMLanguage::LANGUAGE_TYPE)),SLOT(onLanguageChange(RMLanguage::LANGUAGE_TYPE)));
|
|
#endif
|
|
|
|
#if (LIVE_LANGUAGE_CHANGE && MODEL_STANDARD)
|
|
refreshLanguage();
|
|
#endif
|
|
//_rightMargin = NULL;
|
|
}
|
|
|
|
void RMFrameBottom::onAppEvent(RMApp::Event event,int param)
|
|
{
|
|
Q_UNUSED(param)
|
|
if(event == RMApp::WillFullScreen || event == RMApp::WillNormalScreen)
|
|
{
|
|
setHidden(event != RMApp::WillFullScreen);
|
|
}
|
|
}
|
|
#if !(SINGLE_CH_VIEWER)
|
|
void RMFrameBottom::onPlayEvent(PLAY_EVENT event, RMVideoItem* item)
|
|
{
|
|
#if (DUAL_CH_FILE)
|
|
Q_UNUSED(item)
|
|
#endif
|
|
|
|
if(event == PLAY_DID_SWAPPED || event == PLAY_DID_UNSWAPPED){
|
|
#if (MODEL_STANDARD)
|
|
updateSwapStatus();
|
|
#endif
|
|
}
|
|
else if(event == PLAY_DID_LOADED){
|
|
|
|
#if (DUAL_CH_FILE && DUAL_CH_1CH_EXIST)
|
|
bToggleEnabled = (item->isSingleChannel() == false);
|
|
#elif !(DUAL_CH_FILE)
|
|
bToggleEnabled = !(item->filePath.isEmpty() || item->filePathCH2.isEmpty());
|
|
#endif
|
|
|
|
#if (MODEL_STANDARD)
|
|
updateSwapStatus();
|
|
#endif
|
|
}
|
|
else if(event == PLAY_DID_USER_STOP){
|
|
#if !(DUAL_CH_FILE)
|
|
bToggleEnabled = true;
|
|
#endif
|
|
|
|
#if (MODEL_STANDARD)
|
|
updateSwapStatus();
|
|
#endif
|
|
}
|
|
}
|
|
#endif // !SINGLE_CH_VIEWER
|
|
|
|
|
|
#if (MODEL_STANDARD && !SINGLE_CH_VIEWER)
|
|
void RMFrameBottom::updateSwapStatus()
|
|
{
|
|
bool bFrontCamera = (RMPlayer::instance()->isSwapped() == false);
|
|
#if (DUAL_CH_FILE && !(DUAL_CH_1CH_EXIST))
|
|
bToggleEnabled = true; // 항상 TRUE
|
|
#endif
|
|
frontCamera->setEnabled((!bFrontCamera && bToggleEnabled));
|
|
frontCamera->setStyleStatus("on",bFrontCamera);
|
|
|
|
rearCamera->setEnabled((bFrontCamera && bToggleEnabled));
|
|
rearCamera->setStyleStatus("on",!bFrontCamera);
|
|
}
|
|
#endif
|
|
|
|
#if (LIVE_LANGUAGE_CHANGE && MODEL_STANDARD)
|
|
void RMFrameBottom::refreshLanguage()
|
|
{
|
|
QString tag = RMLanguage::languageTag();
|
|
frontCamera->updateObject("front_camera" + tag);
|
|
rearCamera->updateObject("rear_camera" + tag);
|
|
}
|
|
void RMFrameBottom::onLanguageChange(RMLanguage::LANGUAGE_TYPE language)
|
|
{
|
|
Q_UNUSED(language)
|
|
refreshLanguage();
|
|
}
|
|
#endif
|