x-tools/Source/Tools/ToolsUI/sakmaskertoolui.cpp
2024-03-19 19:26:05 +08:00

54 lines
1.7 KiB
C++

/***************************************************************************************************
* Copyright 2023 x-tools-author(x-tools@outlook.com). All rights reserved.
*
* The file is encoded using "utf8 with bom", it is a part of xTools project.
*
* xTools is licensed according to the terms in the file LICENCE(GPL V3) in the root of the source
* code directory.
**************************************************************************************************/
#include "sakmaskertoolui.h"
#include "sakmaskertool.h"
#include "ui_sakmaskertoolui.h"
SAKMaskerToolUi::SAKMaskerToolUi(QWidget *parent)
: SAKBaseToolUi(parent)
, ui(new Ui::SAKMaskerToolUi)
{
ui->setupUi(this);
}
SAKMaskerToolUi::~SAKMaskerToolUi()
{
delete ui;
}
void SAKMaskerToolUi::setToolName(const QString &name)
{
ui->groupBox->setTitle(name);
}
void SAKMaskerToolUi::onBaseToolUiInitialized(SAKBaseTool *tool, const QString &settingsGroup)
{
#if 0
ui->checkBoxEnable->setGroupKey(settingsGroup, "maskerEnable");
#endif
ui->spinBoxMaskCode->setGroupKey(settingsGroup, "maskCode");
SAKMaskerTool *cookedTool = qobject_cast<SAKMaskerTool *>(tool);
if (!cookedTool) {
qCWarning((*mLoggingCategory)) << "Invalid tool type!";
return;
}
connect(ui->checkBoxEnable, &QCheckBox::clicked, this, [=]() {
cookedTool->setIsEnable(ui->checkBoxEnable->isChecked());
});
connect(ui->spinBoxMaskCode,
static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged),
this,
[=](int code) { cookedTool->setMaskCode(code); });
cookedTool->setIsEnable(ui->checkBoxEnable->isChecked());
cookedTool->setMaskCode(ui->spinBoxMaskCode->value());
}