x-tools/Source/Tools/ToolsUI/xToolsBaseToolUi.cpp
2024-03-30 13:20:25 +08:00

50 lines
1.5 KiB
C++

/***************************************************************************************************
* Copyright 2023-2024 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 "xToolsBaseToolUi.h"
#include "xToolsBaseTool.h"
xToolsBaseToolUi::xToolsBaseToolUi(QWidget *parent)
: QWidget{parent}
{}
void xToolsBaseToolUi::initialize(xToolsBaseTool *tool,
const QString &settingsGroup,
const char *loggingCategory)
{
m_tool = tool;
if (mLoggingCategory) {
delete mLoggingCategory;
mLoggingCategory = nullptr;
}
mLoggingCategory = new QLoggingCategory(loggingCategory);
if (!tool) {
qCWarning((*mLoggingCategory)) << "The value of tool is nullptr!";
return;
}
connect(tool, &xToolsBaseTool::isWorkingChanged, this, [=]() {
onIsWorkingChanged(tool->isWorking());
});
onBaseToolUiInitialized(tool, settingsGroup);
}
void xToolsBaseToolUi::onIsWorkingChanged(bool isWorking)
{
Q_UNUSED(isWorking)
}
void xToolsBaseToolUi::onBaseToolUiInitialized(xToolsBaseTool *tool, const QString &settingsGroup)
{
Q_UNUSED(tool)
Q_UNUSED(settingsGroup)
}