509 lines
17 KiB
C++
509 lines
17 KiB
C++
#include "title_widget.h"
|
|
|
|
|
|
#include "../fm_dimensions.h"
|
|
#include <QStyleOption>
|
|
#include <QPainter>
|
|
#include <QHBoxLayout>
|
|
#include <QLabel>
|
|
#include <QPushButton>
|
|
#include <QToolButton>
|
|
#include <QDesktopServices>
|
|
#include "fm_button.h"
|
|
|
|
#include "rm_app.h"
|
|
#if !(SETUP_ONLY_BUILD)
|
|
#include "../data/rm_video_item_2ch.h"
|
|
#include "../core/rm_player.h"
|
|
#include "../core/rm_play_process.h"
|
|
#endif
|
|
#include "rm_popup.h"
|
|
#include "fm_colors.h"
|
|
|
|
#if (DUAL_VIEWER)
|
|
#include "rm_dialog_map.h"
|
|
#endif
|
|
|
|
TitleWidget::TitleWidget(QWidget *parent, QString title, QString icon, bool isPopup) : QWidget(parent)
|
|
{
|
|
#if (RM_MODEL_EMT_KR)
|
|
FMWidgetBottomBorderBackground(this,"title_widget", FM_THEME_COLOR_M1,0x00);
|
|
setFixedHeight(isPopup ? POPUP_TITLE_BAR_HEIGHT : MAIN_TITLE_BAR_HEIGHT);
|
|
setSizePolicy(QSizePolicy::Preferred,QSizePolicy::Fixed);
|
|
|
|
layout = new QHBoxLayout(this);
|
|
ZERO_LAYOUT(layout);
|
|
layout->setAlignment(Qt::AlignLeft | Qt::AlignVCenter);
|
|
layout->setContentsMargins(10,0,0,0);
|
|
if(!title.isEmpty()) {
|
|
|
|
//LAYOUT_SPACE(layout,100,0);
|
|
//_addSpacer(layout,10);
|
|
titleLabel = new QLabel(this);
|
|
layout->addWidget(titleLabel);
|
|
titleLabel->setText(title);
|
|
titleLabel->setStyleSheet("color: #BABABA;font-family: Arial;font-size: 13px;");
|
|
}
|
|
|
|
#else // RM_MODEL_EMT_KR
|
|
setStyleSheet("TitleWidget{border-image: url(:/image/title_bg.png) 0 0 0 0 repeat stretch;}");
|
|
this->setObjectName(isPopup ? "popup_title" : "main_title");
|
|
|
|
this->setFixedHeight(isPopup ? POPUP_TITLE_BAR_HEIGHT : MAIN_TITLE_BAR_HEIGHT);
|
|
this->setSizePolicy(QSizePolicy::Preferred,QSizePolicy::Fixed);
|
|
|
|
layout = new QHBoxLayout(this);
|
|
layout->setMargin(0);
|
|
layout->setSpacing(0);
|
|
layout->setContentsMargins(QMargins(0,0,0,0));
|
|
layout->setAlignment(Qt::AlignLeft);
|
|
if(icon.isEmpty() == false || title.isEmpty() == false)
|
|
{
|
|
titleLabel = new QLabel(this);
|
|
if(icon.isEmpty() == false)
|
|
{
|
|
titleLabel->setPixmap( QPixmap(":/image/" + icon) );
|
|
titleLabel->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Preferred);
|
|
}
|
|
else if (title.isEmpty() == false)
|
|
{
|
|
_addSpacer(layout,10);
|
|
titleLabel->setText(title);
|
|
titleLabel->setObjectName("title_label");
|
|
titleLabel->setSizePolicy(QSizePolicy::Preferred,QSizePolicy::Preferred);
|
|
}
|
|
layout->addWidget(titleLabel);
|
|
}
|
|
#endif // RM_MODEL_EMT_KR
|
|
|
|
_toolBar = new QWidget(this);
|
|
//_toolBar->setObjectName("test_widget");
|
|
_toolBar->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Preferred);
|
|
layout->addWidget(_toolBar);
|
|
|
|
_toolBarLayout = new QHBoxLayout(_toolBar);
|
|
_toolBarLayout->setMargin(0);
|
|
_toolBarLayout->setSpacing(0);
|
|
_toolBarLayout->setContentsMargins(QMargins(0,0,0,0));
|
|
|
|
#if (MODEL_STANDARD)
|
|
QSize mainButtonSize = QSize(42,30);
|
|
_toolBarLayout->setAlignment(Qt::AlignRight);
|
|
#else // MODEL_STANDARD
|
|
#if (MODEL_WATEX)
|
|
_toolBarLayout->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
|
|
QSize mainButtonSize = QSize(31,29);
|
|
#else
|
|
_toolBarLayout->setAlignment(Qt::AlignRight | Qt::AlignTop);
|
|
QSize mainButtonSize = QSize(26,26);
|
|
#endif // MODEL_WATEX
|
|
#endif // MODEL_STANDARD
|
|
#if !(REMOVE_UNUSED_TITLE)
|
|
// main widget
|
|
if(isPopup == false)
|
|
{
|
|
#if(LIVE_LANGUAGE_CHANGE)
|
|
RMLanguage* lng = RMLanguage::instance();
|
|
#endif
|
|
|
|
#if (MODEL_STANDARD)
|
|
|
|
#if (LIVE_LANGUAGE_CHANGE && (!FIXED_ENGLISH))
|
|
#if (LIVE_LANGUAGE2)
|
|
languageButton = RMButton::create2(_toolBar,_toolBarLayout,"language_button","language",QSize(34,42));
|
|
#else // LIVE_LANGUAGE2
|
|
languageButton = RMButton::create(_toolBar,_toolBarLayout,"language_button",MKU8("\xe8\xa8\x80\xe8\xaa\x9e\xe9\x81\xb8\xe6\x8a\x9e"),QSize(34,42));
|
|
// 言語選択
|
|
RMLanguage::instance()->appendENGToolTip(languageButton,"Language");
|
|
#endif // LIVE_LANGUAGE2
|
|
connect(languageButton,SIGNAL(clicked()),SLOT(onLanguage()));
|
|
_addSpacer(_toolBarLayout,12);
|
|
#endif
|
|
|
|
#if (DUAL_VIEWER)
|
|
// パノラマビュー
|
|
panoramaButton = RMButton::create(_toolBar,_toolBarLayout,"panorama_button",MKU8("\xe3\x83\x91\xe3\x83\x8e\xe3\x83\xa9\xe3\x83\x9e\xe3\x83\x93\xe3\x83\xa5\xe3\x83\xbc"),QSize(52,42));
|
|
//panoramaButton->setEnabled(false);
|
|
|
|
// ミラービュー
|
|
mirrorButton = RMButton::create(_toolBar,_toolBarLayout,"mirror_button",MKU8("\xe3\x83\x9f\xe3\x83\xa9\xe3\x83\xbc\xe3\x83\x93\xe3\x83\xa5\xe3\x83\xbc"),QSize(52,42));
|
|
//mirrorButton->setEnabled(false);
|
|
|
|
_addSpacer(_toolBarLayout,17);
|
|
|
|
// マップ
|
|
mapButton = RMButton::create(_toolBar,_toolBarLayout,"map_toolbar_button",MKU8("\xe3\x83\x9e\xe3\x83\x83\xe3\x83\x97"),QSize(52,42));
|
|
connect(mapButton,SIGNAL(clicked()),SLOT(onMap()));
|
|
//mapButton->setEnabled(false);
|
|
|
|
_addSpacer(_toolBarLayout,17);
|
|
#endif
|
|
|
|
#if !(REMOVE_REPORT)
|
|
|
|
#if (LIVE_LANGUAGE2)
|
|
reportButton = RMButton::create2(_toolBar,_toolBarLayout,"report_button","report",QSize(34,42));
|
|
#else // LIVE_LANGUAGE2
|
|
reportButton = RMButton::create(_toolBar,_toolBarLayout,"report_button",MKU8("\xe3\x83\xac\xe3\x83\x9d\xe3\x83\xbc\xe3\x83\x88"),QSize(34,42));
|
|
#endif // LIVE_LANGUAGE2
|
|
// レポート
|
|
reportButton->setEnabled(false);
|
|
_addSpacer(_toolBarLayout,17);
|
|
#endif
|
|
// Panorama, Wide, Map
|
|
|
|
|
|
// 設定
|
|
#if (LIVE_LANGUAGE2)
|
|
settingsButton = RMButton::create2(_toolBar,_toolBarLayout,"settings_button","settings",QSize(34,42));
|
|
#else // LIVE_LANGUAGE2
|
|
settingsButton = RMButton::create(_toolBar,_toolBarLayout,"settings_button",MKU8("\xe8\xa8\xad\xe5\xae\x9a"),QSize(34,42));
|
|
#endif // LIVE_LANGUAGE2
|
|
|
|
|
|
_addSpacer(_toolBarLayout,12);
|
|
#if !(RM_MODEL == RM_MODEL_TYPE_TB4000)
|
|
#if (LIVE_LANGUAGE2)
|
|
// ビューアー情報
|
|
infoButton = RMButton::create2(_toolBar,
|
|
_toolBarLayout,
|
|
"info_button",
|
|
"viewer_info",
|
|
QSize(34,42));
|
|
#else // LIVE_LANGUAGE2
|
|
// ビューアー情報
|
|
infoButton = RMButton::create(_toolBar,
|
|
_toolBarLayout,
|
|
"info_button",
|
|
MKU8("\xe3\x83\x93\xe3\x83\xa5\xe3\x83\xbc\xe3\x82\xa2\xe3\x83\xbc\xe6\x83\x85\xe5\xa0\xb1"),
|
|
QSize(34,42));
|
|
#endif // LIVE_LANGUAGE2
|
|
_addSpacer(_toolBarLayout,6);
|
|
|
|
#if (LIVE_LANGUAGE2)
|
|
// JPG 保存
|
|
captureButton = RMButton::create2(_toolBar,
|
|
_toolBarLayout,
|
|
"capture_button",
|
|
"capture",
|
|
QSize(48,42));
|
|
#else // LIVE_LANGUAGE2
|
|
// JPG 保存
|
|
captureButton = RMButton::create(_toolBar,
|
|
_toolBarLayout,
|
|
"capture_button",
|
|
MKU8("\x4a\x50\x47 \xe4\xbf\x9d\xe5\xad\x98"),
|
|
QSize(48,42));
|
|
#endif // LIVE_LANGUAGE2
|
|
captureButton->setEnabled(false);
|
|
|
|
|
|
#if !(LIVE_LANGUAGE2)
|
|
#if(LIVE_LANGUAGE_CHANGE)
|
|
// WFF_800C
|
|
#if !(REMOVE_REPORT)
|
|
lng->appendENGToolTip(reportButton,"Report");
|
|
#endif
|
|
lng->appendENGToolTip(settingsButton,"Settings");
|
|
lng->appendENGToolTip(infoButton,"Info");
|
|
lng->appendENGToolTip(captureButton,"Capture");
|
|
#endif
|
|
#endif // #if (LIVE_LANGUAGE2)
|
|
|
|
|
|
|
|
#if !(REMOVE_ALL_SHORT_CUTS)
|
|
#if !(REMOVE_REPORT)
|
|
reportShortcut = new QShortcut(QKeySequence(Qt::Key_F3), this);
|
|
reportShortcut->setContext(Qt::ApplicationShortcut);
|
|
#endif
|
|
settingsShortcut = new QShortcut(QKeySequence(Qt::Key_F6), this);
|
|
settingsShortcut->setContext(Qt::ApplicationShortcut);
|
|
|
|
infoShortcut = new QShortcut(QKeySequence(Qt::Key_F7), this);
|
|
infoShortcut->setContext(Qt::ApplicationShortcut);
|
|
|
|
captureShortcut = new QShortcut(QKeySequence(Qt::Key_F5), this);
|
|
captureShortcut->setContext(Qt::ApplicationShortcut);
|
|
captureShortcut->setEnabled(false);
|
|
#endif
|
|
_addSpacer(_toolBarLayout,40);
|
|
#endif
|
|
|
|
#if(MODEL_WATEX)
|
|
// 言語選択 (언어 설정은 있으나 자동 및 일본어만 존재?)
|
|
languageButton = RMButton::create(_toolBar,_toolBarLayout,"language_button",MKU8("\xe8\xa8\x80\xe8\xaa\x9e\xe9\x81\xb8\xe6\x8a\x9e"),QSize(32,33));
|
|
connect(languageButton,SIGNAL(clicked()),SLOT(onLanguage()));
|
|
_addSpacer(_toolBarLayout,12);
|
|
|
|
|
|
// ホームページ
|
|
manualButton = RMButton::create(_toolBar,
|
|
_toolBarLayout,
|
|
"manual_button",
|
|
MKU8("\xe3\x83\x9b\xe3\x83\xbc\xe3\x83\xa0\xe3\x83\x9a\xe3\x83\xbc\xe3\x82\xb8"),
|
|
QSize(28,33));
|
|
connect(manualButton,SIGNAL(clicked()),SLOT(onManual()));
|
|
|
|
_addSpacer(_toolBarLayout,12);
|
|
|
|
// 情報
|
|
infoButton = RMButton::create(_toolBar,
|
|
_toolBarLayout,
|
|
"info_button",
|
|
MKU8("\xe6\x83\x85\xe5\xa0\xb1"), // 情報
|
|
QSize(28,33));
|
|
_addSpacer(_toolBarLayout,24);
|
|
|
|
#endif // MODEL_WATEX
|
|
|
|
#if (MODEL_WATEX)
|
|
// WATEX 모델은 최소화/최대화 버튼이 TOP ALIGN 되어 있음
|
|
QWidget* pw = new QWidget(_toolBar);
|
|
pw->setSizePolicy(QSizePolicy::Preferred,QSizePolicy::Expanding);
|
|
_toolBarLayout->addWidget(pw);
|
|
//pw->setObjectName("test_widget");
|
|
|
|
QHBoxLayout* pl = new QHBoxLayout(pw);
|
|
pl->setMargin(0);
|
|
pl->setSpacing(0);
|
|
pl->setAlignment(Qt::AlignTop | Qt::AlignLeft);
|
|
#else
|
|
QWidget* pw = _toolBar;
|
|
QLayout* pl = _toolBarLayout;
|
|
#endif
|
|
|
|
#endif // #if !(RM_MODEL == RM_MODEL_TYPE_TB4000)
|
|
|
|
|
|
#if (LIVE_LANGUAGE2)
|
|
// 最小化
|
|
minimizeButton = RMButton::create2(pw,
|
|
pl,
|
|
"minimize_button",
|
|
"minimize",
|
|
mainButtonSize);
|
|
|
|
#else // LIVE_LANGUAGE2
|
|
// 最小化
|
|
minimizeButton = RMButton::create(pw,
|
|
pl,
|
|
"minimize_button",
|
|
MKU8("\xe6\x9c\x80\xe5\xb0\x8f\xe5\x8c\x96"),
|
|
mainButtonSize);
|
|
|
|
#endif // LIVE_LANGUAGE2
|
|
|
|
|
|
|
|
#if !defined(MODEL_WATEX) // WATEX 는 전체화면 툴바에 있음
|
|
#if (LIVE_LANGUAGE2)
|
|
// 最大化
|
|
fullScreenButton = RMButton::create2(pw,
|
|
pl,
|
|
"fullscreen_button",
|
|
"maximize",
|
|
mainButtonSize);
|
|
#else // LIVE_LANGUAGE2
|
|
// 最大化
|
|
fullScreenButton = RMButton::create(pw,
|
|
pl,
|
|
"fullscreen_button",
|
|
MKU8("\xe6\x9c\x80\xe5\xa4\xa7\xe5\x8c\x96"),
|
|
mainButtonSize);
|
|
#endif // LIVE_LANGUAGE2
|
|
#endif
|
|
|
|
#if (LIVE_LANGUAGE2)
|
|
closeButton = FMButton::btn2(pw,pl,"title_close","close",mainButtonSize);
|
|
#else // LIVE_LANGUAGE2
|
|
// 閉じる
|
|
closeButton = FMButton::btn(pw,pl,"title_close",MKU8("\xe9\x96\x89\xe3\x81\x98\xe3\x82\x8b"),mainButtonSize);
|
|
|
|
|
|
#if(LIVE_LANGUAGE_CHANGE)
|
|
lng->appendENGToolTip(minimizeButton,"Minimize");
|
|
#if !defined(MODEL_WATEX) // WATEX 는 전체화면 툴바에 있음
|
|
lng->appendENGToolTip(fullScreenButton,"Full Screen");
|
|
#endif
|
|
lng->appendENGToolTip(closeButton,"Exit");
|
|
#endif
|
|
#endif // LIVE_LANGUAGE2
|
|
|
|
|
|
#if (MODEL_STANDARD)
|
|
_addSpacer(_toolBarLayout,16);
|
|
#else
|
|
_addSpacer(_toolBarLayout,8);
|
|
#endif
|
|
#if !(SETUP_ONLY_BUILD)
|
|
connect(RMPlayer::instance(),SIGNAL(playEvent(PLAY_EVENT,RMVideoItem*)),SLOT(onPlayEvent(PLAY_EVENT,RMVideoItem*)));
|
|
#endif //
|
|
}
|
|
else
|
|
#endif // #if !(REMOVE_UNUSED_TITLE)
|
|
{
|
|
|
|
#if!(REMOVE_UNUSED_TITLE)
|
|
#if (MODEL_STANDARD)
|
|
#if !(REMOVE_REPORT)
|
|
reportButton = NULL;
|
|
#endif
|
|
settingsButton = NULL;
|
|
#if !(RM_MODEL == RM_MODEL_TYPE_TB4000)
|
|
infoButton = NULL;
|
|
captureButton = NULL;
|
|
#endif // #if !(RM_MODEL == RM_MODEL_TYPE_TB4000)
|
|
#endif
|
|
|
|
#if (MODEL_WATEX)
|
|
infoButton = NULL;
|
|
manualButton = NULL;
|
|
#endif
|
|
|
|
minimizeButton = NULL;
|
|
#if !defined(MODEL_WATEX) // WATEX 는 전체화면 툴바에 있음
|
|
fullScreenButton = NULL;
|
|
#endif
|
|
#endif // #if!(REMOVE_UNUSED_TITLE)
|
|
|
|
#if defined(MODEL_WATEX)
|
|
closeButton = RMButton::create(_toolBar,_toolBarLayout,"popup_close_button",MKU8("\xe9\x96\x89\xe3\x81\x98\xe3\x82\x8b"),QSize(22,21));
|
|
#else
|
|
#if (LIVE_LANGUAGE2)
|
|
// 閉じる
|
|
closeButton = FMButton::btn2(_toolBar,_toolBarLayout,"title_close","close",QSize(38,38));
|
|
#else // LIVE_LANGUAGE2
|
|
// 閉じる
|
|
closeButton = FMButton::btn(_toolBar,_toolBarLayout,"title_close",MKU8("\xe9\x96\x89\xe3\x81\x98\xe3\x82\x8b"),QSize(38,38));
|
|
#endif // LIVE_LANGUAGE2
|
|
|
|
//closeButton = RMButton::create(_toolBar,_toolBarLayout,"popup_close_button",MKU8("\xe9\x96\x89\xe3\x81\x98\xe3\x82\x8b"),QSize(38,38));
|
|
#endif
|
|
LAYOUT_SPACE(_toolBarLayout,7,0);
|
|
|
|
}
|
|
|
|
}
|
|
void TitleWidget::_addSpacer(QHBoxLayout* layout, int width)
|
|
{
|
|
QSpacerItem* seperator = new QSpacerItem(width,0,QSizePolicy::Fixed,QSizePolicy::Fixed);
|
|
layout->addSpacerItem(seperator);
|
|
}
|
|
|
|
void TitleWidget::paintEvent(QPaintEvent *pe)
|
|
{
|
|
Q_UNUSED(pe);
|
|
QStyleOption o;
|
|
o.initFrom(this);
|
|
QPainter p(this);
|
|
style()->drawPrimitive(QStyle::PE_Widget, &o, &p, this);
|
|
}
|
|
#if!(REMOVE_UNUSED_TITLE)
|
|
#if !(SETUP_ONLY_BUILD)
|
|
void TitleWidget::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 || event == PLAY_DID_USER_STOP)
|
|
{
|
|
#if (MODEL_STANDARD)
|
|
#if !(REMOVE_REPORT)
|
|
reportButton->setEnabled(event == PLAY_DID_LOADED);
|
|
#endif
|
|
|
|
#if !(RM_MODEL == RM_MODEL_TYPE_TB4000)
|
|
captureButton->setEnabled(event == PLAY_DID_LOADED);
|
|
#endif // #if !(RM_MODEL == RM_MODEL_TYPE_TB4000)
|
|
|
|
//#if (DUAL_VIEWER)
|
|
// panoramaButton->setEnabled(event == PLAY_DID_LOADED);
|
|
// mirrorButton->setEnabled(event == PLAY_DID_LOADED);
|
|
//#endif
|
|
|
|
#if !(REMOVE_ALL_SHORT_CUTS)
|
|
#if !(REMOVE_REPORT)
|
|
reportShortcut->setEnabled(event == PLAY_DID_LOADED);
|
|
#endif
|
|
captureShortcut->setEnabled(event == PLAY_DID_LOADED);
|
|
#endif
|
|
|
|
#endif
|
|
}
|
|
}
|
|
#endif // #if !(SETUP_ONLY_BUILD)
|
|
#endif // #if!(REMOVE_UNUSED_TITLE)
|
|
|
|
#if (DUAL_VIEWER)
|
|
void TitleWidget::onMap()
|
|
{
|
|
//qInfo() << "size:" << _videoWidget->size();
|
|
if(RMDialogMap::instance()->isHiddenReal()) {
|
|
RMDialogMap::instance()->show();
|
|
RMDialogMap::instance()->setFocus();
|
|
}
|
|
else
|
|
{
|
|
RMDialogMap::instance()->onClose();
|
|
}
|
|
}
|
|
#endif
|
|
|
|
#if !(REMOVE_OLD_C)
|
|
#if (LIVE_LANGUAGE_CHANGE && (!FIXED_ENGLISH))
|
|
void TitleWidget::onLanguage()
|
|
{
|
|
QString title = RMLanguage::isJP() ? MKU8("\xe8\xa8\x80\xe8\xaa\x9e\xe9\x81\xb8\xe6\x8a\x9e") : "Select a language";
|
|
RMPopup* dialog = new RMPopup(this,title);
|
|
dialog->createLanguageLayout();
|
|
if(dialog->exec())
|
|
{
|
|
int index = RMPopup::languageIndex;
|
|
RMLanguage::LANGUAGE_TYPE type = RMLanguage::LANGUAGE_JP;
|
|
if(index == 0)
|
|
{
|
|
RMLanguage::isAuto = true;
|
|
type = RMLanguage::systemLanguage();
|
|
RMSettings::instance()->setAutoLanguage(true);
|
|
}
|
|
else if(index == 1)
|
|
{
|
|
RMLanguage::isAuto = false;
|
|
type = RMLanguage::LANGUAGE_JP;
|
|
RMSettings::instance()->setAutoLanguage(false);
|
|
}
|
|
#if !(LANGUAGE_REMOVE_ENG)
|
|
else if(index == 2)
|
|
{
|
|
RMLanguage::isAuto = false;
|
|
type = RMLanguage::LANGUAGE_EN;
|
|
RMSettings::instance()->setAutoLanguage(false);
|
|
}
|
|
#endif // MODEL_WATEX
|
|
//qInfo() << "onLanguageSelected:" << type << index;
|
|
if(RMLanguage::instance()->language() != type)
|
|
{
|
|
RMLanguage::instance()->setLanguage(type);
|
|
}
|
|
}
|
|
}
|
|
#endif
|
|
#endif // #if !(REMOVE_OLD_C)
|
|
|
|
#if(MODEL_WATEX)
|
|
void TitleWidget::onManual()
|
|
{
|
|
QDesktopServices::openUrl(QUrl("https://www.watex-net.com/"));
|
|
}
|
|
#endif //
|
|
|
|
|