181 lines
6.8 KiB
C++
181 lines
6.8 KiB
C++
#include "rm_toolbar.h"
|
|
#if (MODEL_BBVIEWER)
|
|
#include <QHBoxLayout>
|
|
#include "rm_button.h"
|
|
#include "rm_layout.h"
|
|
#include "../core/rm_play_process.h"
|
|
#include "../core/rm_player.h"
|
|
|
|
#include "rm_dialog_bbviewer.h"
|
|
#include "../core/rm_language.h"
|
|
|
|
RMToolbar::RMToolbar(QWidget *parent) : RMWidgetStyleBase(parent,"",true)
|
|
{
|
|
setObjectName("toolbar");
|
|
QHBoxLayout* layout = new QHBoxLayout(this);
|
|
layout->setMargin(0);
|
|
layout->setSpacing(6);
|
|
layout->setAlignment(Qt::AlignVCenter | Qt::AlignLeft );
|
|
RMLayout::addSpacer(layout,10,0);
|
|
// 設定
|
|
settingsButton = RMButton::create(this,layout,"settings_button",MKU8("\xe8\xa8\xad\xe5\xae\x9a"),QSize(35,35));
|
|
RMLanguage::instance()->appendENGToolTip(settingsButton,"Setup");
|
|
|
|
// バックアップ
|
|
backupButton = RMButton::create(this,layout,"backup",MKU8("\xe3\x83\x90\xe3\x83\x83\xe3\x82\xaf\xe3\x82\xa2\xe3\x83\x83\xe3\x83\x97"),QSize(35,35));
|
|
RMLanguage::instance()->appendENGToolTip(backupButton,"Backup");
|
|
backupButton->setEnabled(false);
|
|
|
|
// スナップショット
|
|
captureButton = RMButton::create(this,layout,"capture_button",MKU8("\xe3\x82\xb9\xe3\x83\x8a\xe3\x83\x83\xe3\x83\x97\xe3\x82\xb7\xe3\x83\xa7\xe3\x83\x83\xe3\x83\x88"),QSize(35,35));
|
|
RMLanguage::instance()->appendENGToolTip(captureButton,"Snapshot");
|
|
captureButton->setEnabled(false);
|
|
|
|
#if defined(MODEL_WATEX)
|
|
RMLayout::addSpacer(layout,20,0);
|
|
QWidget *horizontalLineWidget = new QWidget(this);
|
|
horizontalLineWidget->setFixedSize(1,30);
|
|
horizontalLineWidget->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed);
|
|
horizontalLineWidget->setStyleSheet(QString("background-color: #c0c0c0;"));
|
|
layout->addWidget(horizontalLineWidget);
|
|
int space = 260;
|
|
#else
|
|
int space = 380;
|
|
#endif
|
|
|
|
sp01 = RMLayout::addSpacer(layout,space,0);
|
|
|
|
// 左右反転, 上下反転
|
|
flipHMainButton = RMButton::create(this,layout,"flipH",MKU8("\xe5\xb7\xa6\xe5\x8f\xb3\xe5\x8f\x8d\xe8\xbb\xa2"),QSize(35,35));
|
|
flipVMainButton = RMButton::create(this,layout,"flipV",MKU8("\xe4\xb8\x8a\xe4\xb8\x8b\xe5\x8f\x8d\xe8\xbb\xa2"),QSize(35,35));
|
|
|
|
#if defined(MODEL_WATEX) // WATEX 는 전체화면 툴바에 있음
|
|
RMLayout::addSpacer(layout,20,0);
|
|
// 最大化
|
|
fullScreenButton = RMButton::create(this,
|
|
layout,
|
|
"fullscreen_button",
|
|
MKU8("\xe6\x9c\x80\xe5\xa4\xa7\xe5\x8c\x96"),
|
|
QSize(35,35));
|
|
#endif
|
|
// チャンネル切替
|
|
swapButton = RMButton::create(this,layout,"swap",MKU8("\xe3\x83\x81\xe3\x83\xa3\xe3\x83\xb3\xe3\x83\x8d\xe3\x83\xab\xe5\x88\x87\xe6\x9b\xbf"),QSize(35,35));
|
|
|
|
#if defined(MODEL_WATEX) // sub 상하/좌우 플립
|
|
sp02 = RMLayout::addSpacer(layout,310,0);
|
|
#endif
|
|
|
|
flipHSubButton = RMButton::create(this,layout,"flipH",MKU8("\xe5\xb7\xa6\xe5\x8f\xb3\xe5\x8f\x8d\xe8\xbb\xa2"),QSize(35,35));
|
|
flipVSubButton = RMButton::create(this,layout,"flipV",MKU8("\xe4\xb8\x8a\xe4\xb8\x8b\xe5\x8f\x8d\xe8\xbb\xa2"),QSize(35,35));
|
|
|
|
#if !(MODEL_WATEX) // WATEX
|
|
sp02 = RMLayout::addSpacer(layout,210,0);
|
|
// 言語選択
|
|
languageButton = RMButton::create(this,layout,"language_button",MKU8("\xe8\xa8\x80\xe8\xaa\x9e\xe9\x81\xb8\xe6\x8a\x9e"),QSize(35,35));
|
|
RMLanguage::instance()->appendENGToolTip(languageButton,"Language");
|
|
connect(languageButton,SIGNAL(clicked()),SLOT(onLanguage()));
|
|
|
|
|
|
// 情報
|
|
infoButton = RMButton::create(this,layout,"info_button",MKU8("\xe6\x83\x85\xe5\xa0\xb1"),QSize(35,35));
|
|
RMLanguage::instance()->appendENGToolTip(infoButton,"Info");
|
|
connect(infoButton,SIGNAL(clicked()),SLOT(onInfo()));
|
|
|
|
#endif // #if !(MODEL_WATEX) // WATEX
|
|
connect(RMPlayer::instance(),SIGNAL(playEvent(PLAY_EVENT, RMVideoItem*)),SLOT(onPlayEvent(PLAY_EVENT, RMVideoItem*)));
|
|
}
|
|
#if !(MODEL_WATEX) // WATEX
|
|
void RMToolbar::onLanguage()
|
|
{
|
|
QString title = RMLanguage::isJP() ? MKU8("\xe8\xa8\x80\xe8\xaa\x9e\xe9\x81\xb8\xe6\x8a\x9e") : "Select a language";
|
|
RMDialogBBViewer* dialog = new RMDialogBBViewer(this,title);
|
|
dialog->createLanguageLayout();
|
|
if(dialog->exec())
|
|
{
|
|
int index = RMDialogBBViewer::languageIndex;
|
|
RMLanguage::LANGUAGE_TYPE type = RMLanguage::LANGUAGE_JP;
|
|
if(index == 0)
|
|
{
|
|
if(RMLanguage::isAuto) {
|
|
return;
|
|
}
|
|
RMLanguage::isAuto = true;
|
|
}
|
|
else if(index == 1)
|
|
{
|
|
RMLanguage::isAuto = false;
|
|
type = RMLanguage::LANGUAGE_JP;
|
|
}
|
|
else if(index == 2)
|
|
{
|
|
RMLanguage::isAuto = false;
|
|
type = RMLanguage::LANGUAGE_EN;
|
|
}
|
|
//qInfo() << "onLanguageSelected:" << type << index;
|
|
if(RMLanguage::instance()->language() != type)
|
|
{
|
|
RMLanguage::instance()->setLanguage(type);
|
|
}
|
|
}
|
|
}
|
|
void RMToolbar::onInfo()
|
|
{
|
|
// 情報
|
|
QString title = RMLanguage::isJP() ? MKU8("\xe6\x83\x85\xe5\xa0\xb1") : "Information";
|
|
RMDialogBBViewer* dialog = new RMDialogBBViewer(this,title);
|
|
dialog->createInfoLayout();
|
|
dialog->exec();
|
|
|
|
}
|
|
#endif // #if !(MODEL_WATEX) // WATEX
|
|
void RMToolbar::onAppEvent(RMApp::Event event)
|
|
{
|
|
RMWidgetStyleBase::onAppEvent(event); // style change
|
|
if(event == RMApp::WillFullScreen || event == RMApp::WillNormalScreen)
|
|
{
|
|
bool bFullScreen = (event == RMApp::WillFullScreen);
|
|
|
|
flipHSubButton->setHidden(bFullScreen);
|
|
flipVSubButton->setHidden(bFullScreen);
|
|
#if (MODEL_WATEX) // WATEX
|
|
|
|
fullScreenButton->setStyleStatus("restore",bFullScreen);
|
|
fullScreenButton->setToolTip(bFullScreen ? MKU8("\xe4\xbb\xa5\xe5\x89\x8d\xe7\x94\xbb\xe9\x9d\xa2\xe3\x81\xab\xe6\x88\xbb\xe3\x82\x8b") : MKU8("\xe6\x9c\x80\xe5\xa4\xa7\xe5\x8c\x96"));
|
|
|
|
settingsButton->setHidden(bFullScreen);
|
|
//backupButton->setHidden(bFullScreen);
|
|
//captureButton->setHidden(bFullScreen);
|
|
#else
|
|
languageButton->setHidden(bFullScreen);
|
|
infoButton->setHidden(bFullScreen);
|
|
#endif
|
|
int sp1Width = bFullScreen ? 9999 : 380;
|
|
sp01->changeSize(sp1Width,0);
|
|
|
|
int sp2Width = bFullScreen ? 20 : 210;
|
|
sp02->changeSize(sp2Width,0);
|
|
}
|
|
}
|
|
|
|
void RMToolbar::onPlayEvent(PLAY_EVENT event, RMVideoItem* item)
|
|
{
|
|
//Q_UNUSED(item)
|
|
|
|
#if (PLAY_CONTINUE_EVENT)
|
|
// 로딩...등 다음파일 플레이시 변화 없도록 처리
|
|
if(event == PLAY_DID_CLEARED && (item != NULL || RMPlayProcess::instance()->isLoadingNextFile()))
|
|
{
|
|
return;
|
|
}
|
|
#endif
|
|
// 사용자 STOP 일 경우 PLAY ITEM CLEAR
|
|
if(event == PLAY_DID_LOADED || event == PLAY_DID_CLEARED) {
|
|
// backupButton->setEnabled(event == PLAY_DID_LOADED);
|
|
|
|
//qInfo() << "captureButton:" << captureButton->isEnabled();
|
|
captureButton->setEnabled(event == PLAY_DID_LOADED);
|
|
}
|
|
}
|
|
|
|
#endif // MODEL_BBVIEWER
|