185 lines
5.6 KiB
C++
185 lines
5.6 KiB
C++
#include "window_settings_standard.h"
|
|
#if (USE_DEVICE_SETTINGS && !USE_DEVICE_SETTINGS_JSON && !RM_MODEL_EMT_KR)
|
|
|
|
#include "../fm_dimensions.h"
|
|
//#if (RM_MODEL == RM_MODEL_TYPE_STANDARD || RM_MODEL == RM_MODEL_TYPE_XLDR_88)
|
|
|
|
#include "../ui/title_widget.h"
|
|
#include "rm_combo_box.h"
|
|
#include "rm_radio_buttons.h"
|
|
#include "rm_group_combo_box.h"
|
|
#include "rm_group_radio_buttons.h"
|
|
#include "rm_text_edit.h"
|
|
|
|
#include "rm_settings_cfg_standard.h"
|
|
#include "rm_setting_time.h"
|
|
#include <QComboBox>
|
|
#include <QGridLayout>
|
|
#include <QDir>
|
|
#include <QMessageBox>
|
|
|
|
#if (DETECT_SETTING_USB_EJECT)
|
|
#include "../core/rm_usb.h"
|
|
#include "../rm_application.h"
|
|
#endif
|
|
|
|
#if (RM_MODEL == RM_MODEL_TYPE_AN6000)
|
|
#include <QJsonObject>
|
|
#endif // RM_MODEL_TYPE_AN6000
|
|
|
|
// 문자열 처리 UTF
|
|
// https://www.branah.com/unicode-converter
|
|
|
|
const int gComboBoxWidth = 200;
|
|
const int gTitleWidth = 50;
|
|
|
|
static const QString glevel = MKU8("\xe3\x83\xac\xe3\x83\x99\xe3\x83\xab");
|
|
|
|
|
|
WindowSettings::WindowSettings(QWidget *parent) : RMSettingsWindowBase(parent)
|
|
{
|
|
_createRowA();
|
|
}
|
|
void WindowSettings::afterSave()
|
|
{
|
|
|
|
}
|
|
#if (RM_MODEL == RM_MODEL_TYPE_AN6000)
|
|
bool WindowSettings::validateData()
|
|
{
|
|
const QList<QString> keys = validateList.keys();
|
|
for(int i=0;i<keys.size();i++){
|
|
QPair<QString,RMTextEdit*> item = validateList[keys.at(i)];
|
|
QString str = item.second->edit->text();
|
|
QString reg = item.first;
|
|
QRegExp regexp(reg);
|
|
if(!regexp.exactMatch(str)) {
|
|
QMessageBox msgBox(QMessageBox::Warning,
|
|
"AN6000",
|
|
FM_WSTR(L"「入力内容にエラーがあります。\n修正して再度ご登録をお願いいたします。」"),
|
|
QMessageBox::Ok,
|
|
this);
|
|
msgBox.exec();
|
|
QTimer::singleShot(0, item.second->edit, SLOT(setFocus()));
|
|
return false;
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
#endif // #if (RM_MODEL == RM_MODEL_TYPE_AN6000)
|
|
void WindowSettings::_createRowA()
|
|
{
|
|
#if (RM_MODEL == RM_MODEL_TYPE_AN6000)
|
|
QWidget* row = NULL;
|
|
QVBoxLayout* rowLayout = NULL;
|
|
rowLayout = _createRow(&row);
|
|
|
|
int fh = 55;
|
|
|
|
for(int i=0;i<CFG::items.size();i++) {
|
|
QJsonObject obj = CFG::items.at(i).toObject();
|
|
|
|
if(obj.contains("hidden")) {
|
|
continue;
|
|
}
|
|
if(obj.contains("control")) {
|
|
QString ctype = obj.value("control").toString();
|
|
if(ctype == "radio") {
|
|
RMGroupRadioButtons* rb = new RMGroupRadioButtons(row,i);
|
|
rowLayout->addWidget(rb);
|
|
rb->setFixedHeight(fh);
|
|
} else if(ctype == "combo") {
|
|
RMGroupComboBox* cb = new RMGroupComboBox(row,i);
|
|
rowLayout->addWidget(cb);
|
|
cb->comboBox->setFixedWidth(gComboBoxWidth);
|
|
cb->setFixedHeight(fh);
|
|
} else if(ctype == "text") {
|
|
RMGroupTextEdit* tb = new RMGroupTextEdit(row,i);
|
|
// REGEX 포함 데이터일 경우 추가
|
|
if(obj.contains("regex")) {
|
|
validateList.insert(obj.value("key").toString(),QPair<QString,RMTextEdit*>(obj.value("regex").toString(),tb->text));
|
|
}
|
|
rowLayout->addWidget(tb);
|
|
tb->text->setFixedWidth(gComboBoxWidth);
|
|
tb->setFixedHeight(fh);
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
#else // AN6000
|
|
QWidget* row = NULL;
|
|
QVBoxLayout* rowLayout = NULL;
|
|
rowLayout = _createRow(&row);
|
|
|
|
int fh = 65;
|
|
|
|
RMGroupComboBox* gs = new RMGroupComboBox(row,
|
|
MKU8("\x33\x47\xe3\x82\xbb\xe3\x83\xb3\xe3\x82\xb5\xe3\x83\xbc\xe6\x84\x9f\xe5\xba\xa6"),
|
|
QStringList() << glevel + "1" << glevel + "2" << glevel + "3" \
|
|
<< glevel + "4" << glevel + "5",
|
|
&CFG::data[SD_SENSOR]);
|
|
|
|
rowLayout->addWidget(gs);
|
|
gs->comboBox->setFixedWidth(gComboBoxWidth);
|
|
gs->setFixedHeight(fh);
|
|
|
|
// 画像 SIZE_800x600, SIZE_640x320
|
|
RMGroupRadioButtons* gr = _MGR(row,MKU8("\xe7\x94\xbb\xe5\x83\x8f"),rowLayout,QStringList() << "800x600" << "640x320",SD_SIZE);
|
|
gr->setFixedHeight(fh);
|
|
|
|
// 録画フレームレート
|
|
gr = _MGR(row,
|
|
MKU8("\xe9\x8c\xb2\xe7\x94\xbb\xe3\x83\x95\xe3\x83\xac\xe3\x83\xbc\xe3\x83\xa0\xe3\x83\xac\xe3\x83\xbc\xe3\x83\x88"),
|
|
rowLayout,
|
|
QStringList()
|
|
<< "20 fps"
|
|
<< "25 fps"
|
|
<< "30 fps",SD_FRAME);
|
|
gr->setFixedHeight(fh);
|
|
|
|
|
|
// 音量調整
|
|
gr = _MGR(row,
|
|
MKU8("\xe9\x9f\xb3\xe9\x87\x8f\xe8\xaa\xbf\xe6\x95\xb4") + " ",
|
|
rowLayout,
|
|
QStringList() << "0" << "1" << "2" << "3" << "4" << "5",
|
|
SD_VOLUME);
|
|
gr->setFixedHeight(fh);
|
|
|
|
// ボイス
|
|
gr = _MGR(row,
|
|
MKU8("\xe3\x83\x9c\xe3\x82\xa4\xe3\x82\xb9") + " ",
|
|
rowLayout,
|
|
QStringList() << MKU8("\xe3\x82\xaa\xe3\x83\x95") << MKU8("\xe3\x82\xaa\xe3\x83\xb3"),
|
|
SD_VOICE);
|
|
gr->setFixedHeight(fh);
|
|
|
|
|
|
RMSettingTime* time = new RMSettingTime(row);
|
|
rowLayout->addWidget(time);
|
|
#endif // #else // AN6000
|
|
}
|
|
|
|
QVBoxLayout* WindowSettings::_createRow(QWidget** rw)
|
|
{
|
|
*rw = new QWidget(_contentWidget);
|
|
(*rw)->setFixedWidth(SETTINGS_WINDOW_WIDTH-(8*2));
|
|
layout->addWidget(*rw);
|
|
|
|
QVBoxLayout* l = new QVBoxLayout(*rw);
|
|
l->setMargin(0);
|
|
l->setSpacing(4);
|
|
l->setAlignment(Qt::AlignTop);
|
|
return l;
|
|
}
|
|
WindowSettings::~WindowSettings()
|
|
{
|
|
|
|
}
|
|
#endif // #if (USE_DEVICE_SETTINGS)
|
|
//#endif // #if (RM_MODEL == RM_MODEL_TYPE_CS_32FH)
|
|
|