first commit
This commit is contained in:
430
project/fm_viewer/ui/rm_popup_info.cpp
Normal file
430
project/fm_viewer/ui/rm_popup_info.cpp
Normal file
@@ -0,0 +1,430 @@
|
||||
#include "rm_popup_info.h"
|
||||
#if !(PLAYER_ONLY_LIBRARY_MODE)
|
||||
#include "../fm_dimensions.h"
|
||||
|
||||
#include <QVBoxLayout>
|
||||
#include "rm_button.h"
|
||||
#include "fm_button.h"
|
||||
#include "rm_popup_content_background.h"
|
||||
#include "title_widget.h"
|
||||
#include "../core/fm_strings.h"
|
||||
|
||||
#if (HWACCEL_SETTING)
|
||||
#include "rm_widget_checkbox.h"
|
||||
#include <QMessageBox>
|
||||
#include <QProcess>
|
||||
#endif
|
||||
#include <QThread>
|
||||
|
||||
#if (SELECT_AUDIO_BACKEND)
|
||||
#include "../core/rm_player.h"
|
||||
#include "../fav/AudioOutputBackend.h"
|
||||
#include <QComboBox>
|
||||
#include <QGroupBox>
|
||||
#endif
|
||||
|
||||
#if (SYSTEM_INFO_DIALOG)
|
||||
#include "../ui/fm_systeminfo_dialog.h"
|
||||
#endif
|
||||
|
||||
|
||||
RMPopupInfo::RMPopupInfo(QWidget *parent,QString fw, QString gps) : RMPopup(parent,FMS::txt("viewer_sw_version"),"")
|
||||
{
|
||||
#if (RM_MODEL_EMT_KR)
|
||||
int height = POPUP_INFO_HEIGHT;
|
||||
//#if (HWACCEL_SETTING)
|
||||
// height += 30;
|
||||
//#endif // HWACCEL_SETTING
|
||||
this->setFixedSize(POPUP_INFO_WIDTH,height);
|
||||
_title->closeButton->setHidden(true);
|
||||
|
||||
QVBoxLayout* layout = new QVBoxLayout(_contentWidget);
|
||||
layout->setContentsMargins(10,13,10,12);
|
||||
|
||||
QWidget* bg = new QWidget(_contentWidget);
|
||||
layout->addWidget(bg);
|
||||
|
||||
QVBoxLayout* contentLayout = new QVBoxLayout(bg);
|
||||
contentLayout->setAlignment(Qt::AlignTop);
|
||||
|
||||
int vSpace = 8;
|
||||
QString prefix = QString(" ");
|
||||
|
||||
RMLayout::addThemeLabel(bg,
|
||||
contentLayout,
|
||||
FMS::txt("viewer_sw_version"),
|
||||
"version_header");
|
||||
QString swVersion;
|
||||
swVersion.sprintf("v%d.%d.%d",RM_MODEL_VERSION_0,RM_MODEL_VERSION_1,RM_MODEL_VERSION_2);
|
||||
RMLayout::addThemeLabel(bg,contentLayout,QString(prefix+swVersion),"version_label");
|
||||
|
||||
#if (HWACCEL_SETTING)
|
||||
RMLayout::addSpacer(contentLayout,0,vSpace);
|
||||
QWidget* hw = new QWidget(bg);
|
||||
contentLayout->addWidget(hw);
|
||||
QHBoxLayout* hwl = new QHBoxLayout(hw);
|
||||
hwl->setMargin(0);
|
||||
//RMLayout::addSpacer(hwl,20,0);
|
||||
RMWidgetCheckBox* chkBox = new RMWidgetCheckBox(hw);
|
||||
chkBox->setObjectName("popup");
|
||||
chkBox->setText(FMS::txt("hw_accel"));
|
||||
hwl->addWidget(chkBox);
|
||||
|
||||
// Black List 된 ...
|
||||
if(RMApp::checkGPU())
|
||||
{
|
||||
chkBox->setEnabled(false);
|
||||
chkBox->setChecked(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
chkBox->setChecked(RMSettings::instance()->HWAccelOff() == false);
|
||||
}
|
||||
connect(chkBox,SIGNAL(clicked()),SLOT(onHWAccelClicked()));
|
||||
RMLayout::addSpacer(contentLayout,0,vSpace);
|
||||
#endif // HWACCEL_SETTING
|
||||
|
||||
RMButton* okButton = RMButton::create2(_buttonWidget,_buttonLayout,"button","ok",QSize(120,30));
|
||||
okButton->setText(FMS::txt("ok"));
|
||||
connect(okButton,SIGNAL(clicked()),this,SLOT(accept()));
|
||||
|
||||
#else // RM_MODEL_EMT_KR
|
||||
int height = POPUP_INFO_HEIGHT;
|
||||
#if !(USE_GPS_VERSION)
|
||||
height -= 30;
|
||||
#endif
|
||||
|
||||
#if (HWACCEL_SETTING)
|
||||
height += 30;
|
||||
#endif
|
||||
|
||||
#if (SELECT_AUDIO_BACKEND)
|
||||
height += 60;
|
||||
#endif
|
||||
|
||||
#if (SYSTEM_INFO_DIALOG)
|
||||
height += 30;
|
||||
#endif
|
||||
|
||||
this->setFixedSize(POPUP_INFO_WIDTH,height);
|
||||
|
||||
_title->closeButton->setHidden(true);
|
||||
|
||||
QVBoxLayout* layout = new QVBoxLayout(_contentWidget);
|
||||
|
||||
layout->setContentsMargins(10,13,10,12);
|
||||
|
||||
RMPopupContentBackground* bg = new RMPopupContentBackground(_contentWidget);
|
||||
layout->addWidget(bg);
|
||||
|
||||
QVBoxLayout* contentLayout = new QVBoxLayout(bg);
|
||||
contentLayout->setAlignment(Qt::AlignTop);
|
||||
|
||||
int vSpace = 8;
|
||||
QString prefix = QString(" ");
|
||||
|
||||
// 1.Viewer Version
|
||||
// Viewer S/W バージョン情報
|
||||
#if (LIVE_LANGUAGE_CHANGE && !REMOVE_OLD_C)
|
||||
if(RMLanguage::isJP() == false)
|
||||
{
|
||||
_title->titleLabel->setText("Viewer S/W Version Info.");
|
||||
RMLayout::addLabel(bg,
|
||||
contentLayout,
|
||||
QString("Viewer S/W Version Info."),
|
||||
"text_header_label");
|
||||
}
|
||||
else {
|
||||
#endif // LIVE_LANGUAGE_CHANGE???
|
||||
RMLayout::addLabel(bg,
|
||||
contentLayout,
|
||||
FMS::txt("viewer_sw_version"),
|
||||
"text_header_label");
|
||||
|
||||
#if (LIVE_LANGUAGE_CHANGE && !REMOVE_OLD_C)
|
||||
}
|
||||
#endif
|
||||
|
||||
QString swVersion;
|
||||
swVersion.sprintf("Version : %d.%d.%d",RM_MODEL_VERSION_0,RM_MODEL_VERSION_1,RM_MODEL_VERSION_2);
|
||||
|
||||
#if (RM_MODEL == RM_MODEL_TYPE_ADT_CAPS)
|
||||
//swVersion += "\n";
|
||||
swVersion += MKU8("\xeb\x8d\xb0\xeb\xaa\xa8\xeb\xb2\x84\xec\xa0\x84");
|
||||
#endif
|
||||
#if !defined(SUPPRESS_ALL_TESTER)
|
||||
swVersion += " TEST";
|
||||
#endif
|
||||
#if (MODEL_TEST_MODE && !(HIDE_BUILD_NO))
|
||||
swVersion += " (" + QString::number(RM_MODEL_SVN_VERSION) + ")";
|
||||
#endif
|
||||
|
||||
#if (SYSTEM_INFO_DIALOG)
|
||||
swVersion += " [TEST ONLY]";
|
||||
#endif
|
||||
|
||||
#if (DEMO_BUILD)
|
||||
swVersion += " [TEST ONLY]";
|
||||
#endif
|
||||
#if (RM_MODEL_EMT_KR)
|
||||
RMLayout::addThemeLabel(bg,contentLayout,QString(prefix+swVersion),"version_label");
|
||||
#else
|
||||
RMLayout::addLabel(bg,contentLayout,QString(prefix+swVersion),"text_normal_label");
|
||||
#endif
|
||||
|
||||
#if(REMOVE_OLD_C)
|
||||
#if(SUPPORT_LANGUAGE_INSERT)
|
||||
FMS::insert_if_not_exist(1,"settings_file_not_exist",FM_WSTR(L"設定ファイルがありません。"));
|
||||
FMS::insert_if_not_exist(2,"settings_file_not_exist",FM_WSTR(L"설정 파일이 존재하지 않습니다"));
|
||||
FMS::insert_if_not_exist(3,"settings_file_not_exist",FM_WSTR(L"Settings file not exist"));
|
||||
#endif // #if(SUPPORT_LANGUAGE_INSERT)
|
||||
|
||||
QString noCFG = FMS::txt("settings_file_not_exist");
|
||||
#else // #if(REMOVE_OLD_C)
|
||||
// 設定ファイルがありません。
|
||||
QString noCFG = MKU8("\xe8\xa8\xad\xe5\xae\x9a\xe3\x83\x95\xe3\x82\xa1\xe3\x82\xa4\xe3\x83\xab\xe3\x81\x8c\xe3\x81\x82\xe3\x82\x8a\xe3\x81\xbe\xe3\x81\x9b\xe3\x82\x93\xe3\x80\x82");
|
||||
#if (LIVE_LANGUAGE_CHANGE)
|
||||
if(RMLanguage::isJP() == false)
|
||||
{
|
||||
noCFG = "Settings file not exist";
|
||||
}
|
||||
#endif
|
||||
#endif // #if(REMOVE_OLD_C)
|
||||
#if !(TOP_DOWN_360)
|
||||
#if (HWACCEL_SETTING)
|
||||
RMLayout::addSpacer(contentLayout,0,vSpace);
|
||||
QWidget* hw = new QWidget(bg);
|
||||
contentLayout->addWidget(hw);
|
||||
QHBoxLayout* hwl = new QHBoxLayout(hw);
|
||||
hwl->setMargin(0);
|
||||
RMLayout::addSpacer(hwl,20,0);
|
||||
RMWidgetCheckBox* chkBox = new RMWidgetCheckBox(hw);
|
||||
chkBox->setObjectName("popup");
|
||||
//MKU8("\xe3\x83\x8f\xe3\x83\xbc\xe3\x83\x89\xe3\x82\xa6\xe3\x82\xa7\xe3\x82\xa2\xe3\x82\xa2\xe3\x82\xaf\xe3\x82\xbb\xe3\x83\xa9\xe3\x83\xac\xe3\x83\xbc\xe3\x82\xb7\xe3\x83\xa7\xe3\x83\xb3"));
|
||||
chkBox->setText(FMS::txt("hw_accel"));
|
||||
#if(!REMOVE_OLD_C)
|
||||
#if (LIVE_LANGUAGE_CHANGE)
|
||||
if(RMLanguage::isJP() == false)
|
||||
{
|
||||
chkBox->setText("Enable H/W Acceleration");
|
||||
}
|
||||
#endif
|
||||
#endif // #if(REMOVE_OLD_C)
|
||||
hwl->addWidget(chkBox);
|
||||
|
||||
// Black List 된 ...
|
||||
if(RMApp::checkGPU())
|
||||
{
|
||||
chkBox->setEnabled(false);
|
||||
chkBox->setChecked(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
chkBox->setChecked(RMSettings::instance()->HWAccelOff() == false);
|
||||
}
|
||||
connect(chkBox,SIGNAL(clicked()),SLOT(onHWAccelClicked()));
|
||||
#endif // HWACCEL_SETTING
|
||||
#endif // #if !(TOP_DOWN_360)
|
||||
|
||||
RMLayout::addSpacer(contentLayout,0,vSpace);
|
||||
|
||||
#if (SELECT_AUDIO_BACKEND)
|
||||
|
||||
|
||||
QGroupBox* widgetAudio = new QGroupBox(bg);
|
||||
widgetAudio->setObjectName("sub");
|
||||
widgetAudio->setFixedHeight(60);
|
||||
contentLayout->addWidget(widgetAudio);
|
||||
QVBoxLayout* layoutAudio = new QVBoxLayout(widgetAudio);
|
||||
layoutAudio->setMargin(5);
|
||||
layoutAudio->setSpacing(5);
|
||||
RMLayout::addLabel(widgetAudio,layoutAudio,FM_WSTR(L"サウンドデバイス:"),"text_normal_label");
|
||||
//RMLayout::addSpacer(layoutAudio,20,0);
|
||||
soundCombo = new QComboBox(widgetAudio);
|
||||
soundCombo->setMinimumWidth(200);
|
||||
soundCombo->setSizeAdjustPolicy(QComboBox::AdjustToContentsOnFirstShow);
|
||||
soundCombo->setObjectName("settings");
|
||||
deviceList = FAV::globalSounddeviceList();
|
||||
deviceList.insert(0,QPair<QString,int>("Auto",-1));
|
||||
QStringList deviceStringList = QStringList();
|
||||
for(int i=0;i<deviceList.size();i++) {
|
||||
deviceStringList.append(deviceList.at(i).first);
|
||||
}
|
||||
soundCombo->addItems(deviceStringList);
|
||||
layoutAudio->addWidget(soundCombo);
|
||||
updateSoundCombo();
|
||||
connect(soundCombo,SIGNAL(currentIndexChanged(int)),SLOT(onSelectSoundDevice(int)));
|
||||
|
||||
|
||||
// RMWidgetCheckBox* chkBoxAudio = new RMWidgetCheckBox(widgetAudio);
|
||||
// chkBoxAudio->setObjectName("popup");
|
||||
// chkBoxAudio->setChecked(RMSettings::instance()->XAudioOff() == false);
|
||||
// chkBoxAudio->setText(FMS::txt("directx_audio"));
|
||||
// layoutAudio->addWidget(chkBoxAudio);
|
||||
// connect(chkBoxAudio,SIGNAL(clicked()),SLOT(onDirectXSoundClicked()));
|
||||
#endif
|
||||
|
||||
#if (SYSTEM_INFO_DIALOG)
|
||||
QWidget* widgetInfo = new QWidget(bg);
|
||||
contentLayout->addWidget(widgetInfo);
|
||||
QHBoxLayout* layoutInfo = new QHBoxLayout(widgetInfo);
|
||||
layoutInfo->setMargin(0);
|
||||
RMLayout::addSpacer(layoutInfo,20,0);
|
||||
layoutInfo->setAlignment(Qt::AlignLeft);
|
||||
RMButton* infoButton = RMButton::create(widgetInfo,layoutInfo,"button_small",FMS::txt("ok"),QSize(160,20));
|
||||
infoButton->setText("SYSTEM INFO");
|
||||
//layoutAudio->addWidget(chkBoxAudio);
|
||||
connect(infoButton,SIGNAL(clicked()),this,SLOT(onSystemInfo()));
|
||||
#endif
|
||||
|
||||
#if (LIVE_LANGUAGE2)
|
||||
RMButton* okButton = RMButton::create2(_buttonWidget,_buttonLayout,"button","ok",QSize(120,30));
|
||||
okButton->setText(FMS::txt("ok"));
|
||||
#else // LIVE_LANGUAGE2
|
||||
RMButton* okButton = RMButton::create(_buttonWidget,_buttonLayout,"button",FMS::txt("ok"),QSize(120,30));
|
||||
okButton->setText("OK");
|
||||
#endif // LIVE_LANGUAGE2
|
||||
connect(okButton,SIGNAL(clicked()),this,SLOT(accept()));
|
||||
#endif // RM_MODEL_EMT_KR
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
#if (SELECT_AUDIO_BACKEND)
|
||||
void RMPopupInfo::updateSoundCombo()
|
||||
{
|
||||
//deviceList = FAV::globalSounddeviceList();
|
||||
//deviceList.insert(0,QPair<QString,int>("Auto",-1));
|
||||
//QStringList deviceStringList = QStringList();
|
||||
|
||||
QString selected = RMSettings::instance()->AudioDevice();
|
||||
int currentIndex = 0;
|
||||
for(int i=0;i<deviceList.size();i++) {
|
||||
if(deviceList.at(i).first == selected) {
|
||||
currentIndex = i;
|
||||
}
|
||||
//deviceStringList.append(deviceList.at(i).first);
|
||||
}
|
||||
soundCombo->blockSignals(true);
|
||||
soundCombo->setCurrentIndex(currentIndex);
|
||||
soundCombo->blockSignals(false);
|
||||
}
|
||||
void RMPopupInfo::onSelectSoundDevice(int index)
|
||||
{
|
||||
if(RMSettings::instance()->AudioDevice() != deviceList.at(index).first)
|
||||
{
|
||||
QMessageBox msgBox(QMessageBox::Warning,
|
||||
"",
|
||||
FMS::txt("restart_msg"),
|
||||
QMessageBox::Yes | QMessageBox::No,
|
||||
this);
|
||||
|
||||
|
||||
msgBox.setButtonText(QMessageBox::Yes, FMS::txt("ok"));
|
||||
msgBox.setButtonText(QMessageBox::No, FMS::txt("cancel"));
|
||||
if(msgBox.exec() == QMessageBox::Yes) {
|
||||
QString name = index == 0 ? "" : deviceList.at(index).first;
|
||||
RMSettings::instance()->setAudioDevice(name);
|
||||
RMPopupInfo::restart();
|
||||
}
|
||||
else {
|
||||
updateSoundCombo();
|
||||
}
|
||||
}
|
||||
|
||||
// qInfo() << index << __FUNCTION__;
|
||||
}
|
||||
/*
|
||||
void RMPopupInfo::onDirectXSoundClicked()
|
||||
{
|
||||
RMWidgetCheckBox* checkbox = qobject_cast<RMWidgetCheckBox *>(QObject::sender());
|
||||
if(checkbox != NULL)
|
||||
{
|
||||
|
||||
bool on = checkbox->checkState() == Qt::Checked;
|
||||
|
||||
|
||||
QMessageBox msgBox(QMessageBox::Warning,
|
||||
"",
|
||||
FMS::txt("restart_msg"),
|
||||
QMessageBox::Yes | QMessageBox::No,
|
||||
this);
|
||||
|
||||
|
||||
msgBox.setButtonText(QMessageBox::Yes, FMS::txt("ok"));
|
||||
msgBox.setButtonText(QMessageBox::No, FMS::txt("cancel"));
|
||||
if(msgBox.exec() == QMessageBox::Yes)
|
||||
{
|
||||
RMSettings::instance()->setXAudioOff(!on);
|
||||
RMPopupInfo::restart();
|
||||
}
|
||||
else
|
||||
{
|
||||
checkbox->setCheckState(on ? Qt::Unchecked : Qt::Checked);
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
#endif // SELECT_AUDIO_BACKEND
|
||||
#if (HWACCEL_SETTING)
|
||||
void RMPopupInfo::onHWAccelClicked()
|
||||
{
|
||||
RMWidgetCheckBox* checkbox = qobject_cast<RMWidgetCheckBox *>(QObject::sender());
|
||||
if(checkbox != NULL)
|
||||
{
|
||||
// 再起動をします
|
||||
bool on = checkbox->checkState() == Qt::Checked;
|
||||
// QString message = MKU8("\xe5\x86\x8d\xe8\xb5\xb7\xe5\x8b\x95\xe3\x82\x92\xe3\x81\x97\xe3\x81\xbe\xe3\x81\x99");
|
||||
//#if (LIVE_LANGUAGE_CHANGE)
|
||||
// if(RMLanguage::isJP() == false)
|
||||
// {
|
||||
// message = "The application must restart in order to enable/disable H/W acceleration";
|
||||
// }
|
||||
//#endif // LIVE_LANGUAGE_CHANGE
|
||||
QMessageBox msgBox(QMessageBox::Warning,
|
||||
"",
|
||||
FMS::txt("restart_msg"),
|
||||
QMessageBox::Yes | QMessageBox::No,
|
||||
this);
|
||||
|
||||
|
||||
msgBox.setButtonText(QMessageBox::Yes, FMS::txt("ok"));
|
||||
msgBox.setButtonText(QMessageBox::No, FMS::txt("cancel"));
|
||||
//#if (LIVE_LANGUAGE_CHANGE)
|
||||
// if(RMLanguage::isJP() == false)
|
||||
// {
|
||||
// msgBox.setButtonText(QMessageBox::Yes, "Yes");
|
||||
// msgBox.setButtonText(QMessageBox::No, "Cancel");
|
||||
// }
|
||||
//#endif // LIVE_LANGUAGE_CHANGE
|
||||
if(msgBox.exec() == QMessageBox::Yes)
|
||||
{
|
||||
RMSettings::instance()->setHWAccelOff(!on);
|
||||
RMPopupInfo::restart();
|
||||
}
|
||||
else
|
||||
{
|
||||
checkbox->setCheckState(on ? Qt::Unchecked : Qt::Checked);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
#if (SYSTEM_INFO_DIALOG)
|
||||
void RMPopupInfo::onSystemInfo()
|
||||
{
|
||||
FMSystemInfoDialog* dialog = new FMSystemInfoDialog(this);
|
||||
dialog->exec();
|
||||
}
|
||||
#endif
|
||||
#include <Windows.h>
|
||||
void RMPopupInfo::restart()
|
||||
{
|
||||
QCoreApplication::flush();
|
||||
QThread::msleep(100);
|
||||
QCoreApplication::quit();
|
||||
::ShellExecute(0, L"open", (LPCWSTR)QCoreApplication::applicationFilePath().utf16(), 0, 0, SW_SHOWNORMAL);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // #if !(PLAYER_ONLY_LIBRARY_MODE)
|
||||
Reference in New Issue
Block a user