322 lines
11 KiB
C++
322 lines
11 KiB
C++
#include "rm_dialog_bbviewer.h"
|
|
#include <QComboBox>
|
|
#include "title_widget.h"
|
|
#include "../core/rm_language.h"
|
|
#include "rm_popup_content_background.h"
|
|
#include "fm_button.h"
|
|
|
|
#if !(LIVE_LANGUAGE2)
|
|
|
|
#if (FORCE_FM_STRING)
|
|
#include "../core/fm_strings.h"
|
|
#endif // FORCE_FM_STRING
|
|
|
|
int RMDialogBBViewer::languageIndex = -1;
|
|
QString RMDialogBBViewer::selectedDisk = "";
|
|
|
|
#if (MODEL_WATEX)
|
|
#define POPUP_BUTTON_HEIGHT 27
|
|
#else
|
|
#define POPUP_BUTTON_HEIGHT 24
|
|
#endif
|
|
|
|
RMDialogBBViewer::RMDialogBBViewer(QWidget *parent,QString title) : RMPopup(parent,title)
|
|
{
|
|
setFixedSize(550,162);
|
|
// 言語選択
|
|
//RMPopup::RMPopup(parent,title);
|
|
_title->closeButton->setHidden(true);
|
|
|
|
_buttonLayout->setAlignment(Qt::AlignCenter);
|
|
|
|
#if !(FORCE_FM_STRING)
|
|
bool bJP = RMLanguage::isJP();
|
|
#endif // #if (FORCE_FM_STRING)
|
|
|
|
// 確認
|
|
|
|
#if (FORCE_FM_STRING)
|
|
QString okString = FMS::txt("ok");
|
|
#else // FORCE_FM_STRING
|
|
#if (MODEL_BBVIEWER)
|
|
QString okString = "OK";
|
|
#else // MODEL_BBVIEWER
|
|
QString okString = bJP ? MKU8("\xe7\xa2\xba\xe8\xaa\x8d") : "OK";
|
|
#endif // MODEL_BBVIEWER
|
|
#endif // FORCE_FM_STRING
|
|
_okButton = RMButton::create(_buttonWidget,_buttonLayout,"button",okString,QSize(100,POPUP_BUTTON_HEIGHT));
|
|
_okButton->setText(okString);
|
|
connect(_okButton,SIGNAL(clicked()),this,SLOT(accept()));
|
|
|
|
RMLayout::addSpacer(_buttonLayout,10,0);
|
|
|
|
// キャンセル
|
|
#if (FORCE_FM_STRING)
|
|
QString cancelString = FMS::txt("cancel");
|
|
|
|
#else // FORCE_FM_STRING
|
|
QString cancelString = bJP ? MKU8("\xe3\x82\xad\xe3\x83\xa3\xe3\x83\xb3\xe3\x82\xbb\xe3\x83\xab") : "Cancel";
|
|
#endif // FORCE_FM_STRING
|
|
_cancelButton = RMButton::create(_buttonWidget,
|
|
_buttonLayout,
|
|
"button",
|
|
cancelString,
|
|
QSize(100,POPUP_BUTTON_HEIGHT));
|
|
_cancelButton->setText(cancelString);
|
|
|
|
connect(_cancelButton,SIGNAL(clicked()),this,SLOT(reject()));
|
|
|
|
RMLayout::addSpacer(_buttonLayout,20,0);
|
|
}
|
|
void RMDialogBBViewer::createInfoLayout()
|
|
{
|
|
_cancelButton->setHidden(true);
|
|
//bool isJP = RMLanguage::isJP();
|
|
|
|
QVBoxLayout* layout = new QVBoxLayout(_contentWidget);
|
|
layout->setContentsMargins(10,2,10,2);
|
|
|
|
RMPopupContentBackground* bg = new RMPopupContentBackground(_contentWidget);
|
|
layout->addWidget(bg);
|
|
|
|
QVBoxLayout* contentLayout = new QVBoxLayout(bg);
|
|
contentLayout->setAlignment(Qt::AlignTop | Qt::AlignHCenter);
|
|
|
|
RMLayout::addLabel(bg,
|
|
contentLayout,
|
|
QString("DRIVE RECORDER FD500 Viewer"),
|
|
"text");
|
|
|
|
RMLayout::addSpacer(contentLayout,0,5);
|
|
|
|
|
|
QString pcViewer = "PC Viewer ";
|
|
QString swVersion;
|
|
swVersion.sprintf("%d.%d.%d",RM_MODEL_VERSION_0,RM_MODEL_VERSION_1,RM_MODEL_VERSION_2);
|
|
|
|
#if (FORCE_FM_STRING)
|
|
// のバージョン
|
|
//MKU8("\xe3\x81\xae\xe3\x83\x90\xe3\x83\xbc\xe3\x82\xb8\xe3\x83\xa7\xe3\x83\xb3");
|
|
pcViewer += FMS::txt("version_of");
|
|
pcViewer += " : ";
|
|
#else // FORCE_FM_STRING
|
|
if(RMLanguage::isJP())
|
|
{
|
|
// のバージョン
|
|
pcViewer += MKU8("\xe3\x81\xae\xe3\x83\x90\xe3\x83\xbc\xe3\x82\xb8\xe3\x83\xa7\xe3\x83\xb3");
|
|
pcViewer += " : ";
|
|
}
|
|
else
|
|
{
|
|
pcViewer += "Version : ";
|
|
}
|
|
#endif // FORCE_FM_STRING
|
|
|
|
pcViewer += swVersion;
|
|
//QString message = isJP ? MKU8("\xe8\xa8\x80\xe8\xaa\x9e\xe3\x82\x92\xe9\x81\xb8\xe6\x8a\x9e\xe3\x81\x97\xe3\x81\xa6\xe3\x81\x8f\xe3\x81\xa0\xe3\x81\x95\xe3\x81\x84") : "Select a language";
|
|
RMLayout::addLabel(bg,
|
|
contentLayout,
|
|
pcViewer,
|
|
"text");
|
|
}
|
|
void RMDialogBBViewer::createOpenLayout()
|
|
{
|
|
#if !(FORCE_FM_STRING)
|
|
bool isJP = RMLanguage::isJP();
|
|
#endif
|
|
#if (FORCE_FM_STRING)
|
|
QString otherString = FMS::txt("others");
|
|
#else
|
|
// その他フォルダ
|
|
#if (MODEL_WATEX)
|
|
QString otherString = isJP ? MKU8("\xe3\x81\x9d\xe3\x81\xae\xe4\xbb\x96\xe3\x83\x95\xe3\x82\xa9\xe3\x83\xab\xe3\x83\x80") : "Others..";
|
|
#else
|
|
// 他の保存先
|
|
QString otherString = isJP ? MKU8("\xe4\xbb\x96\xe3\x81\xae\xe4\xbf\x9d\xe5\xad\x98\xe5\x85\x88") : "Others..";
|
|
#endif
|
|
#endif // FORCE_FM_STRING
|
|
RMButton* otherButton = RMButton::create(_buttonWidget,_buttonLayout,"button",otherString,QSize(100,POPUP_BUTTON_HEIGHT));
|
|
|
|
_buttonLayout->removeWidget(otherButton);
|
|
_buttonLayout->insertWidget(0,otherButton);
|
|
|
|
QSpacerItem* seperator = new QSpacerItem(1000,0,QSizePolicy::Expanding,QSizePolicy::Preferred);
|
|
_buttonLayout->insertSpacerItem(1,seperator);
|
|
|
|
QSpacerItem* seperator2 = new QSpacerItem(20,0,QSizePolicy::Fixed,QSizePolicy::Fixed);
|
|
_buttonLayout->insertSpacerItem(0,seperator2);
|
|
|
|
otherButton->setText(otherString);
|
|
connect(otherButton,SIGNAL(clicked()),this,SLOT(onSelectOther()));
|
|
|
|
|
|
RMLayout::addSpacer(_buttonLayout,10,0);
|
|
|
|
|
|
RMDialogBBViewer::selectedDisk = "";
|
|
|
|
|
|
QVBoxLayout* layout = new QVBoxLayout(_contentWidget);
|
|
layout->setContentsMargins(10,2,10,2);
|
|
|
|
RMPopupContentBackground* bg = new RMPopupContentBackground(_contentWidget);
|
|
layout->addWidget(bg);
|
|
|
|
QVBoxLayout* contentLayout = new QVBoxLayout(bg);
|
|
contentLayout->setAlignment(Qt::AlignTop | Qt::AlignHCenter);
|
|
|
|
QWidget* comboWidget = new QWidget(bg);
|
|
contentLayout->addWidget(comboWidget);
|
|
|
|
QHBoxLayout* comboLayout = new QHBoxLayout(comboWidget);
|
|
comboLayout->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
|
|
comboLayout->setContentsMargins(0,2,8,2);
|
|
comboLayout->setSpacing(3);
|
|
|
|
#if (FORCE_FM_STRING)
|
|
QString driveString = FMS::txt("drive");//isJP ? MKU8("\xe3\x83\x95\xe3\x82\xa9\xe3\x83\xab\xe3\x83\x80") : "Drive";
|
|
#else // FORCE_FM_STRING
|
|
#if (MODEL_WATEX)
|
|
// フォルダ:
|
|
QString driveString = isJP ? MKU8("\xe3\x83\x95\xe3\x82\xa9\xe3\x83\xab\xe3\x83\x80") : "Drive";
|
|
#else
|
|
// ドライブを選択してください。
|
|
QString driveString = isJP ? MKU8("\xe3\x83\x89\xe3\x83\xa9\xe3\x82\xa4\xe3\x83\x96") : "Drive";
|
|
#endif
|
|
#endif // FORCE_FM_STRING
|
|
driveString += " : ";
|
|
|
|
RMLayout::addLabel(comboWidget,
|
|
comboLayout,
|
|
driveString,
|
|
"text");
|
|
|
|
RMLayout::addSpacer(contentLayout,0,15);
|
|
QStringList disks = RMApp::getRemovableDisks();
|
|
QComboBox* combo = new QComboBox(bg);
|
|
combo->setFixedWidth(300);
|
|
if(disks.size() > 0)
|
|
{
|
|
RMDialogBBViewer::selectedDisk = disks[0];
|
|
foreach (QString disk, disks) {
|
|
combo->addItem(disk);
|
|
}
|
|
connect(combo,SIGNAL(currentIndexChanged(QString)),SLOT(onDiskSelected(QString)));
|
|
}
|
|
else
|
|
{
|
|
_okButton->setEnabled(false);
|
|
combo->setEnabled(false);
|
|
}
|
|
comboLayout->addWidget(combo);
|
|
|
|
#if (FORCE_FM_STRING)
|
|
// "Select the drive which memory card is inserted on."
|
|
QString message = FMS::txt("select_memory_drive");//isJP ? MKU8("\xe3\x83\x95\xe3\x82\xa9\xe3\x83\xab\xe3\x83\x80") : "Drive";
|
|
#else // FORCE_FM_STRING
|
|
// メモリカードが挿入されているドライブを選択します。
|
|
QString message = isJP ? MKU8("\xe3\x83\xa1\xe3\x83\xa2\xe3\x83\xaa\xe3\x82\xab\xe3\x83\xbc\xe3\x83\x89\xe3\x81\x8c\xe6\x8c\xbf\xe5\x85\xa5\xe3\x81\x95\xe3\x82\x8c\xe3\x81\xa6\xe3\x81\x84\xe3\x82\x8b\xe3\x83\x89\xe3\x83\xa9\xe3\x82\xa4\xe3\x83\x96\xe3\x82\x92\xe9\x81\xb8\xe6\x8a\x9e\xe3\x81\x97\xe3\x81\xbe\xe3\x81\x99\xe3\x80\x82") : "Select the drive which memory card is inserted on.";
|
|
#endif // FORCE_FM_STRING
|
|
RMLayout::addLabel(bg,
|
|
contentLayout,
|
|
message,
|
|
"text");
|
|
|
|
}
|
|
|
|
void RMDialogBBViewer::createLanguageLayout()
|
|
{
|
|
RMDialogBBViewer::languageIndex = -1;
|
|
|
|
#if !(FORCE_FM_STRING)
|
|
bool isJP = RMLanguage::isJP();
|
|
#endif //
|
|
|
|
QVBoxLayout* layout = new QVBoxLayout(_contentWidget);
|
|
layout->setContentsMargins(10,2,10,2);
|
|
|
|
RMPopupContentBackground* bg = new RMPopupContentBackground(_contentWidget);
|
|
layout->addWidget(bg);
|
|
|
|
QVBoxLayout* contentLayout = new QVBoxLayout(bg);
|
|
contentLayout->setAlignment(Qt::AlignTop | Qt::AlignHCenter);
|
|
|
|
// 言語
|
|
QWidget* comboWidget = new QWidget(bg);
|
|
contentLayout->addWidget(comboWidget);
|
|
|
|
QHBoxLayout* comboLayout = new QHBoxLayout(comboWidget);
|
|
comboLayout->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
|
|
comboLayout->setContentsMargins(0,2,8,2);
|
|
comboLayout->setSpacing(3);
|
|
#if !(FORCE_FM_STRING)
|
|
QString title = isJP ? MKU8("\xe8\xa8\x80\xe8\xaa\x9e") : "Language";
|
|
#else
|
|
QString title = MKU8("\xe8\xa8\x80\xe8\xaa\x9e");
|
|
#endif
|
|
title += ":";
|
|
RMLayout::addLabel(comboWidget,
|
|
comboLayout,
|
|
title,
|
|
"text");
|
|
|
|
RMLayout::addSpacer(contentLayout,0,5);
|
|
|
|
QComboBox* comboBox = new QComboBox(this);
|
|
comboBox->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Preferred);
|
|
comboBox->setFixedWidth(200);
|
|
comboBox->setObjectName("settings");
|
|
comboBox->setMaxVisibleItems(100);
|
|
|
|
// 日本語, 自動
|
|
#if !(FORCE_FM_STRING)
|
|
QString autoString = isJP ? MKU8("\xe8\x87\xaa\xe5\x8b\x95") : "Auto";
|
|
#else
|
|
QString autoString = MKU8("\xe8\x87\xaa\xe5\x8b\x95");
|
|
#endif
|
|
QStringList items = QStringList() << autoString << MKU8("\xe6\x97\xa5\xe6\x9c\xac\xe8\xaa\x9e") << "English";
|
|
|
|
comboBox->addItems(items);
|
|
|
|
//comboBox->setCurrentIndex(realIndex(*value));
|
|
connect(comboBox,SIGNAL(currentIndexChanged(int)),SLOT(onLanguageSelected(int)));
|
|
comboLayout->addWidget(comboBox);
|
|
|
|
int current = 0; // AUTO
|
|
if(RMLanguage::isAuto == false)
|
|
{
|
|
current = RMLanguage::isJP() ? 1 : 2;
|
|
}
|
|
comboBox->setCurrentIndex(current);
|
|
|
|
|
|
// 言語を選択してください
|
|
#if !(FORCE_FM_STRING)
|
|
QString message = isJP ? MKU8("\xe8\xa8\x80\xe8\xaa\x9e\xe3\x82\x92\xe9\x81\xb8\xe6\x8a\x9e\xe3\x81\x97\xe3\x81\xa6\xe3\x81\x8f\xe3\x81\xa0\xe3\x81\x95\xe3\x81\x84") : "Select a language";
|
|
#else
|
|
QString message = MKU8("\xe8\xa8\x80\xe8\xaa\x9e\xe3\x82\x92\xe9\x81\xb8\xe6\x8a\x9e\xe3\x81\x97\xe3\x81\xa6\xe3\x81\x8f\xe3\x81\xa0\xe3\x81\x95\xe3\x81\x84");
|
|
#endif
|
|
RMLayout::addLabel(bg,
|
|
contentLayout,
|
|
message,
|
|
"text");
|
|
|
|
}
|
|
void RMDialogBBViewer::onLanguageSelected(int index)
|
|
{
|
|
RMDialogBBViewer::languageIndex = index;
|
|
}
|
|
void RMDialogBBViewer::onDiskSelected(QString disk)
|
|
{
|
|
RMDialogBBViewer::selectedDisk = disk;
|
|
// qInfo() << "disk:" << disk;
|
|
//RMDialogBBViewer::languageIndex = index;
|
|
}
|
|
void RMDialogBBViewer::onSelectOther()
|
|
{
|
|
RMDialogBBViewer::selectedDisk = "OPENFOLDER";
|
|
accept();
|
|
}
|
|
|
|
#endif // #if !(LIVE_LANGUAGE2)
|