148 lines
6.0 KiB
C++
148 lines
6.0 KiB
C++
#include "rm_popup_select_model.h"
|
|
#if (MULTI_MODEL_VIEWER)
|
|
|
|
#include <QVBoxLayout>
|
|
#include <QComboBox>
|
|
#include "rm_button.h"
|
|
#include "rm_popup_content_background.h"
|
|
#include "title_widget.h"
|
|
#include "../core/fm_strings.h"
|
|
|
|
// モデル選択
|
|
RMPopupCreateModel::RMPopupCreateModel(QWidget *parent) : RMPopup(parent,MKU8("\xe3\x83\xa2\xe3\x83\x87\xe3\x83\xab\xe9\x81\xb8\xe6\x8a\x9e"),"")
|
|
{
|
|
this->setFixedSize(368,266);
|
|
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);
|
|
contentLayout->setSpacing(18);
|
|
contentLayout->setMargin(10);
|
|
|
|
// SDカードに環境設定情報が入っておりません。
|
|
QString msg1 = MKU8("\x53\x44\xe3\x82\xab\xe3\x83\xbc\xe3\x83\x89\xe3\x81\xab\xe7\x92\xb0\xe5\xa2\x83\xe8\xa8\xad\xe5\xae\x9a\xe6\x83\x85\xe5\xa0\xb1\xe3\x81\x8c\xe5\x85\xa5\xe3\x81\xa3\xe3\x81\xa6\xe3\x81\x8a\xe3\x82\x8a\xe3\x81\xbe\xe3\x81\x9b\xe3\x82\x93\xe3\x80\x82");
|
|
RMLayout::addLabel(bg,
|
|
contentLayout,
|
|
msg1,
|
|
"text_header_label");
|
|
|
|
// モデル名を選択してください。
|
|
QString msg2 = MKU8("\xe3\x83\xa2\xe3\x83\x87\xe3\x83\xab\xe5\x90\x8d\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\xe3\x80\x82");
|
|
RMLayout::addLabel(bg,
|
|
contentLayout,
|
|
msg2,
|
|
"text_header_label");
|
|
|
|
RMLayout::addSpacer(contentLayout,0,15);
|
|
QStringList disks = RMApp::getRemovableDisks();
|
|
selectedModel = "";
|
|
QComboBox* combo = new QComboBox(bg);
|
|
combo->setFixedWidth(300);
|
|
// [モデル選択]
|
|
combo->addItem(MKU8("\x5b\xe3\x83\xa2\xe3\x83\x87\xe3\x83\xab\xe9\x81\xb8\xe6\x8a\x9e\x5d"));
|
|
foreach (QString model, MULTI_MODEL_NAMES) {
|
|
combo->addItem(model);
|
|
}
|
|
connect(combo,SIGNAL(currentIndexChanged(QString)),SLOT(onModelChanged(QString)));
|
|
contentLayout->addWidget(combo);
|
|
|
|
okButton = RMButton::create(_buttonWidget,_buttonLayout,"button",FMS::txt("ok"),QSize(120,30));
|
|
okButton->setText(FMS::txt("ok"));
|
|
connect(okButton,SIGNAL(clicked()),this,SLOT(accept()));
|
|
okButton->setEnabled(false);
|
|
|
|
// キャンセル
|
|
RMButton* cancelButton = RMButton::create(_buttonWidget,_buttonLayout,"button",FMS::txt("cancel"),QSize(120,30));
|
|
cancelButton->setText(FMS::txt("cancel"));
|
|
connect(cancelButton,SIGNAL(clicked()),this,SLOT(reject()));
|
|
}
|
|
void RMPopupCreateModel::onModelChanged(QString model)
|
|
{
|
|
if(MULTI_MODEL_NAMES.contains(model))
|
|
{
|
|
selectedModel = model;
|
|
okButton->setEnabled(true);
|
|
}
|
|
else {
|
|
selectedModel = "";
|
|
okButton->setEnabled(false);
|
|
}
|
|
}
|
|
|
|
//-------------------------------------------------------------------
|
|
RMPopupSelectModel::RMPopupSelectModel(QList<QPair<QString,QString>> models, QWidget *parent) : RMPopup(parent,MKU8("\xe6\xb3\xa8\xe6\x84\x8f"),"")
|
|
{
|
|
this->setFixedSize(368,266);
|
|
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);
|
|
contentLayout->setSpacing(18);
|
|
contentLayout->setMargin(10);
|
|
|
|
// いくつかの設定ファイルが見付かりました。
|
|
QString msg1 = MKU8("\xe3\x81\x84\xe3\x81\x8f\xe3\x81\xa4\xe3\x81\x8b\xe3\x81\xae\xe8\xa8\xad\xe5\xae\x9a\xe3\x83\x95\xe3\x82\xa1\xe3\x82\xa4\xe3\x83\xab\xe3\x81\x8c\xe8\xa6\x8b\xe4\xbb\x98\xe3\x81\x8b\xe3\x82\x8a\xe3\x81\xbe\xe3\x81\x97\xe3\x81\x9f\xe3\x80\x82");
|
|
RMLayout::addLabel(bg,
|
|
contentLayout,
|
|
msg1,
|
|
"text_header_label");
|
|
|
|
// // モデル名を選択してください。
|
|
// QString msg2 = MKU8("\xe3\x83\xa2\xe3\x83\x87\xe3\x83\xab\xe5\x90\x8d\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\xe3\x80\x82");
|
|
// RMLayout::addLabel(bg,
|
|
// contentLayout,
|
|
// msg2,
|
|
// "text_header_label");
|
|
|
|
RMLayout::addSpacer(contentLayout,0,15);
|
|
// QStringList disks = RMApp::getRemovableDisks();
|
|
//selectedModel = "";
|
|
modelIndex = 0;
|
|
QComboBox* combo = new QComboBox(bg);
|
|
combo->setFixedWidth(300);
|
|
// [モデル選択]
|
|
// combo->addItem(MKU8("\x5b\xe3\x83\xa2\xe3\x83\x87\xe3\x83\xab\xe9\x81\xb8\xe6\x8a\x9e\x5d"));
|
|
for(int i=0;i<models.size();i++) {
|
|
QPair<QString,QString> model = models.at(i);
|
|
combo->addItem(model.first + " " + model.second);
|
|
}
|
|
// foreach (QPair<QString,QString>& model, models) {
|
|
// combo->addItem(model.first + ":" + model.second);
|
|
// }
|
|
connect(combo,SIGNAL(currentIndexChanged(int)),SLOT(onModelChanged(int)));
|
|
contentLayout->addWidget(combo);
|
|
|
|
okButton = RMButton::create(_buttonWidget,_buttonLayout,"popup_button",QString("OK"),QSize(120,30));
|
|
okButton->setText("OK");
|
|
connect(okButton,SIGNAL(clicked()),this,SLOT(accept()));
|
|
//okButton->setEnabled(false);
|
|
|
|
QString cancelString = MKU8("\xe3\x82\xad\xe3\x83\xa3\xe3\x83\xb3\xe3\x82\xbb\xe3\x83\xab");
|
|
// キャンセル
|
|
RMButton* cancelButton = RMButton::create(_buttonWidget,_buttonLayout,"popup_button",cancelString,QSize(120,30));
|
|
cancelButton->setText(cancelString);
|
|
connect(cancelButton,SIGNAL(clicked()),this,SLOT(reject()));
|
|
}
|
|
void RMPopupSelectModel::onModelChanged(int model)
|
|
{
|
|
modelIndex = model;
|
|
// if(MULTI_MODEL_NAMES.contains(model))
|
|
// {
|
|
// selectedModel = model;
|
|
// okButton->setEnabled(true);
|
|
// }
|
|
// else {
|
|
// selectedModel = "";
|
|
// okButton->setEnabled(false);
|
|
// }
|
|
}
|
|
|
|
|
|
#endif // #if (MULTI_MODEL_VIEWER)
|