207 lines
8.3 KiB
C++
207 lines
8.3 KiB
C++
#include "rm_dialog_overwrite.h"
|
|
#include "../data/rm_overwrite.h"
|
|
#include "../rm_include.h"
|
|
#include <QLabel>
|
|
#include <QVBoxLayout>
|
|
#include <QHBoxLayout>
|
|
#include <QCheckBox>
|
|
#include "rm_popup_content_background.h"
|
|
#include "rm_button.h"
|
|
#include "title_widget.h"
|
|
#include "../core/fm_strings.h"
|
|
|
|
// ファイルの保存
|
|
#if (FORCE_FM_STRING)
|
|
RMDialogOverwrite::RMDialogOverwrite(QWidget *parent) : RMPopup(parent,FMS::txt("backup_title"),"")
|
|
#else
|
|
RMDialogOverwrite::RMDialogOverwrite(QWidget *parent) : RMPopup(parent,MKU8("\xe3\x83\x95\xe3\x82\xa1\xe3\x82\xa4\xe3\x83\xab\xe3\x81\xae\xe4\xbf\x9d\xe5\xad\x98"),"")
|
|
#endif
|
|
{
|
|
#if (RM_MODEL_EMT_KR)
|
|
this->setFixedSize(392,206);
|
|
QVBoxLayout* layout = new QVBoxLayout(_contentWidget);
|
|
layout->setContentsMargins(20,13,20,13);
|
|
QWidget* bg = _contentWidget;
|
|
QVBoxLayout* contentLayout = layout;
|
|
|
|
contentLayout->setSpacing(14);
|
|
RMLayout::addThemeLabel(bg,contentLayout,FMS::txt("file_exist"),"version_label");
|
|
RMLayout::addThemeLabel(bg,contentLayout,RMOverwrite::currentFileName,"version_label");
|
|
|
|
if(RMOverwrite::currentCount > 1) {
|
|
// 동일한 작업을 다음의
|
|
// 파일에도 적용
|
|
QString allString = FMS::txt("apply_rule") + \
|
|
QString::number(RMOverwrite::currentCount) + \
|
|
FMS::txt("after_files");
|
|
// 同じ処理を次の%d個の競合に適用
|
|
_chkBox = new QCheckBox(this);
|
|
_chkBox->setObjectName("popup");
|
|
_chkBox->setText(allString);
|
|
contentLayout->addWidget(_chkBox);
|
|
}
|
|
else {
|
|
_chkBox = NULL;
|
|
}
|
|
|
|
RMButton* skipButton = RMButton::create2(_buttonWidget,_buttonLayout,"button","skip",QSize(120,30));
|
|
skipButton->setText(FMS::txt("skip"));
|
|
connect(skipButton,SIGNAL(clicked()),this,SLOT(onSkip()));
|
|
|
|
RMButton* overwriteButton = RMButton::create2(_buttonWidget,_buttonLayout,"button","overwrite",QSize(120,30));
|
|
overwriteButton->setText(FMS::txt("overwrite"));
|
|
connect(overwriteButton,SIGNAL(clicked()),this,SLOT(onOverwrite()));
|
|
|
|
RMButton* cancelButton = RMButton::create2(_buttonWidget,_buttonLayout,"button","cancel",QSize(120,30));
|
|
cancelButton->setText(FMS::txt("cancel"));
|
|
connect(cancelButton,SIGNAL(clicked()),this,SLOT(reject()));
|
|
|
|
#else // RM_MODEL_EMT_KR
|
|
#if !(FORCE_FM_STRING)
|
|
#if (LIVE_LANGUAGE_CHANGE)
|
|
bool bJP = RMLanguage::isJP();
|
|
if(bJP == false)
|
|
{
|
|
_title->titleLabel->setText("Backup files");
|
|
}
|
|
#endif
|
|
#endif //FORCE_FM_STRING
|
|
|
|
this->setFixedSize(392,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);
|
|
#if (FORCE_FM_STRING)
|
|
RMLayout::addLabel(bg,contentLayout,FMS::txt("file_exist"),"text_header_label");
|
|
#else
|
|
QString fileExistString = MKU8("\xe3\x81\x93\xe3\x81\xae\xe5\xa0\xb4\xe6\x89\x80\xe3\x81\xab\xe5\x90\x8c\xe3\x81\x98\xe5\x90\x8d\xe5\x89\x8d\xe3\x81\xae\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\x99\xe3\x80\x82");
|
|
#if (LIVE_LANGUAGE_CHANGE)
|
|
if(bJP == false)
|
|
{
|
|
fileExistString = "File already exists.";
|
|
}
|
|
#endif
|
|
RMLayout::addLabel(bg,contentLayout,fileExistString,"text_header_label");
|
|
#endif
|
|
|
|
RMLayout::addLabel(bg,contentLayout,RMOverwrite::currentFileName,"text_header_label");
|
|
if(RMOverwrite::currentCount > 1) {
|
|
#if (FORCE_FM_STRING)
|
|
// 同じ処理を次の
|
|
// 個の競合に適用
|
|
// 동일한 작업을 다음의
|
|
// 파일에도 적용
|
|
QString allString = FMS::txt("apply_rule") + \
|
|
QString::number(RMOverwrite::currentCount) + \
|
|
FMS::txt("after_files");
|
|
#else // FORCE_FM_STRING
|
|
QString allString = MKU8("\xe5\x90\x8c\xe3\x81\x98\xe5\x87\xa6\xe7\x90\x86\xe3\x82\x92\xe6\xac\xa1\xe3\x81\xae") + \
|
|
QString::number(RMOverwrite::currentCount) + \
|
|
MKU8("\xe5\x80\x8b\xe3\x81\xae\xe7\xab\xb6\xe5\x90\x88\xe3\x81\xab\xe9\x81\xa9\xe7\x94\xa8");
|
|
#if (LIVE_LANGUAGE_CHANGE)
|
|
if(bJP == false)
|
|
{
|
|
allString = "Apply to next " + QString::number(RMOverwrite::currentCount) + " files.";
|
|
}
|
|
#endif
|
|
#endif
|
|
// 同じ処理を次の%d個の競合に適用
|
|
_chkBox = new QCheckBox(this);
|
|
_chkBox->setObjectName("popup");
|
|
_chkBox->setText(allString);
|
|
contentLayout->addWidget(_chkBox);
|
|
}
|
|
else {
|
|
_chkBox = NULL;
|
|
}
|
|
|
|
#if (FORCE_FM_STRING)
|
|
#if (LIVE_LANGUAGE2)
|
|
RMButton* skipButton = RMButton::create2(_buttonWidget,_buttonLayout,"popup_button","skip",QSize(120,30));
|
|
#else
|
|
RMButton* skipButton = RMButton::create(_buttonWidget,_buttonLayout,"popup_button",FMS::txt("skip"),QSize(120,30));
|
|
#endif
|
|
skipButton->setText(FMS::txt("skip"));
|
|
#else
|
|
// スキップ
|
|
#if (LIVE_LANGUAGE_CHANGE)
|
|
QString skipString = bJP ? MKU8("\xe3\x82\xb9\xe3\x82\xad\xe3\x83\x83\xe3\x83\x97") : "Skip";
|
|
RMButton* skipButton = RMButton::create(_buttonWidget,_buttonLayout,"popup_button",skipString,QSize(120,30));
|
|
skipButton->setText(skipString);
|
|
#else
|
|
RMButton* skipButton = RMButton::create(_buttonWidget,_buttonLayout,"popup_button",MKU8("\xe3\x82\xb9\xe3\x82\xad\xe3\x83\x83\xe3\x83\x97"),QSize(120,30));
|
|
skipButton->setText(MKU8("\xe3\x82\xb9\xe3\x82\xad\xe3\x83\x83\xe3\x83\x97"));
|
|
#endif
|
|
#endif
|
|
connect(skipButton,SIGNAL(clicked()),this,SLOT(onSkip()));
|
|
|
|
#if (FORCE_FM_STRING)
|
|
#if (LIVE_LANGUAGE2)
|
|
RMButton* overwriteButton = RMButton::create2(_buttonWidget,_buttonLayout,"popup_button","overwrite",QSize(120,30));
|
|
#else
|
|
RMButton* overwriteButton = RMButton::create(_buttonWidget,_buttonLayout,"popup_button",FMS::txt("overwrite"),QSize(120,30));
|
|
#endif
|
|
overwriteButton->setText(FMS::txt("overwrite"));
|
|
#else
|
|
// 置き換える
|
|
#if (LIVE_LANGUAGE_CHANGE)
|
|
QString overwriteString = bJP ? MKU8("\xe7\xbd\xae\xe3\x81\x8d\xe6\x8f\x9b\xe3\x81\x88\xe3\x82\x8b") : "Overwrite";
|
|
RMButton* overwriteButton = RMButton::create(_buttonWidget,_buttonLayout,"popup_button",overwriteString,QSize(120,30));
|
|
overwriteButton->setText(overwriteString);
|
|
#else
|
|
RMButton* overwriteButton = RMButton::create(_buttonWidget,_buttonLayout,"popup_button",MKU8("\xe7\xbd\xae\xe3\x81\x8d\xe6\x8f\x9b\xe3\x81\x88\xe3\x82\x8b"),QSize(120,30));
|
|
overwriteButton->setText(MKU8("\xe7\xbd\xae\xe3\x81\x8d\xe6\x8f\x9b\xe3\x81\x88\xe3\x82\x8b"));
|
|
#endif
|
|
#endif // FORCE_FM_STRING
|
|
connect(overwriteButton,SIGNAL(clicked()),this,SLOT(onOverwrite()));
|
|
|
|
// キャンセル
|
|
#if (FORCE_FM_STRING)
|
|
#if (LIVE_LANGUAGE2)
|
|
RMButton* cancelButton = RMButton::create2(_buttonWidget,_buttonLayout,"popup_button","cancel",QSize(120,30));
|
|
#else
|
|
RMButton* cancelButton = RMButton::create(_buttonWidget,_buttonLayout,"popup_button",FMS::txt("cancel"),QSize(120,30));
|
|
#endif
|
|
cancelButton->setText(FMS::txt("cancel"));
|
|
#else
|
|
#if (LIVE_LANGUAGE_CHANGE)
|
|
QString cancelString = bJP ? MKU8("\xe3\x82\xad\xe3\x83\xa3\xe3\x83\xb3\xe3\x82\xbb\xe3\x83\xab") : "Cancel";
|
|
RMButton* cancelButton = RMButton::create(_buttonWidget,_buttonLayout,"popup_button",cancelString,QSize(120,30));
|
|
cancelButton->setText(cancelString);
|
|
#else
|
|
RMButton* cancelButton = RMButton::create(_buttonWidget,_buttonLayout,"popup_button",MKU8("\xe3\x82\xad\xe3\x83\xa3\xe3\x83\xb3\xe3\x82\xbb\xe3\x83\xab"),QSize(120,30));
|
|
cancelButton->setText(MKU8("\xe3\x82\xad\xe3\x83\xa3\xe3\x83\xb3\xe3\x82\xbb\xe3\x83\xab"));
|
|
#endif
|
|
#endif
|
|
connect(cancelButton,SIGNAL(clicked()),this,SLOT(reject()));
|
|
#endif // #else // RM_MODEL_EMT_KR
|
|
}
|
|
|
|
void RMDialogOverwrite::onSkip()
|
|
{
|
|
if(_chkBox != NULL) {
|
|
RMOverwrite::gCurrent = OVERWRITE_OPTION_SKIP | (_chkBox->isChecked() ? OVERWRITE_OPTION_ALL : 0);
|
|
}
|
|
else {
|
|
RMOverwrite::gCurrent = OVERWRITE_OPTION_SKIP;
|
|
}
|
|
accept();
|
|
}
|
|
void RMDialogOverwrite::onOverwrite()
|
|
{
|
|
if(_chkBox != NULL) {
|
|
RMOverwrite::gCurrent = OVERWRITE_OPTION_WRITE | (_chkBox->isChecked() ? OVERWRITE_OPTION_ALL : 0);
|
|
}
|
|
else
|
|
{
|
|
RMOverwrite::gCurrent = OVERWRITE_OPTION_WRITE;
|
|
}
|
|
accept();
|
|
}
|