更新UI界面
This commit is contained in:
parent
d80db4c389
commit
73f64e6344
|
@ -2784,3 +2784,6 @@ msgstr "文本或风格错误"
|
|||
|
||||
msgid "Parameter error"
|
||||
msgstr "参数错误"
|
||||
|
||||
msgid "Image resolution"
|
||||
msgstr "图像分辨率"
|
||||
|
|
|
@ -53,24 +53,13 @@ kpAIDrawingBar::kpAIDrawingBar(QWidget *parent)
|
|||
*/
|
||||
|
||||
m_AiMode = new AIModeDataThread();
|
||||
if(m_AiMode->setSessionStatus())
|
||||
{
|
||||
mSession = m_AiMode->getVisionSession();
|
||||
}
|
||||
|
||||
initUI();
|
||||
|
||||
const char* json = R"(
|
||||
{
|
||||
"appId": "49080653",
|
||||
"apiKey": "sd6XK461G446AHz43GAKMEme",
|
||||
"secretKey": "dCauacFHm6CyWW5hVT3BGg7lavYxxXxB"
|
||||
}
|
||||
)";
|
||||
capability_settings_set_deploy_policy(CAPABILITY_VISION, PUBLIC_CLOUD);
|
||||
|
||||
capability_settings_set_model(CAPABILITY_VISION,PUBLIC_CLOUD, "baidu");
|
||||
|
||||
capability_settings_set_model_config(Capability::CAPABILITY_VISION,
|
||||
DeployPolicy::PUBLIC_CLOUD,
|
||||
"baidu", json);
|
||||
|
||||
setFixedWidth(250);
|
||||
}
|
||||
|
||||
|
@ -264,12 +253,12 @@ void kpAIDrawingBar::initUI()
|
|||
"border: none;"
|
||||
"border-radius: 5px; }";
|
||||
// 获取基础版本/高级版本
|
||||
getconfigVersionData();
|
||||
// getconfigVersionData();
|
||||
|
||||
if (configVersion == 2)
|
||||
AIImageSize = QSize(640,360);
|
||||
else if (configVersion == 1)
|
||||
AIImageSize = QSize(1536, 1024);
|
||||
// if (configVersion == 2)
|
||||
AIImageSize = QSize(512, 512);
|
||||
// else if (configVersion == 1)
|
||||
// AIImageSize = QSize(1536, 1024);
|
||||
|
||||
/* 图像描述布局 */
|
||||
auto *label = new QLabel(i18n("Image description"));
|
||||
|
@ -289,46 +278,21 @@ void kpAIDrawingBar::initUI()
|
|||
styleGrid = new QGridLayout();
|
||||
addStyleWidget();
|
||||
|
||||
/* 图像比例布局 */
|
||||
ratioButtonGroup = new QButtonGroup(this);
|
||||
auto *ratioLabel = new QLabel(i18n("Image ratio"));
|
||||
ratioLabel->setAlignment(Qt::AlignLeft | Qt::AlignTop);
|
||||
ratioLabel->setFixedSize(180, 30);
|
||||
/* 图像分辨率 */
|
||||
auto *resolutionLabel = new QLabel(i18n("Image resolution"));
|
||||
resolutionLabel->setAlignment(Qt::AlignLeft | Qt::AlignTop);
|
||||
resolutionLabel->setFixedSize(180, 30);
|
||||
|
||||
QGridLayout *ratioGrid = new QGridLayout();
|
||||
if (configVersion == 2) {
|
||||
addRatioButtons(ratioGrid, "16:9", 0);
|
||||
addRatioButtons(ratioGrid, "1:1", 1);
|
||||
addRatioButtons(ratioGrid, "9:16", 2);
|
||||
}
|
||||
else if (configVersion == 1) {
|
||||
addRatioButtons(ratioGrid, "3:2", 0);
|
||||
addRatioButtons(ratioGrid, "1:1", 1);
|
||||
addRatioButtons(ratioGrid, "2:3", 2);
|
||||
}
|
||||
resolutionComboBox = new QComboBox(this);
|
||||
addResolutionComboBox();
|
||||
|
||||
/* 缩放倍数布局 */
|
||||
QLabel *multipleLabel;
|
||||
QGridLayout *multipleLayout;
|
||||
if (configVersion == 2) {
|
||||
multipleButtonGroup = new QButtonGroup(this);
|
||||
multipleLabel = new QLabel(i18n("Scaling factor"));
|
||||
multipleLabel->setAlignment(Qt::AlignLeft | Qt::AlignTop);
|
||||
multipleLabel->setFixedSize(180, 30);
|
||||
|
||||
multipleLayout = new QGridLayout();
|
||||
addMultipleButton(multipleLayout, "1x", 0);
|
||||
addMultipleButton(multipleLayout, "2x", 1);
|
||||
addMultipleButton(multipleLayout, "4x", 2);
|
||||
}
|
||||
/* 生成数量布局 */
|
||||
quantityButtonGroup = new QButtonGroup(this);
|
||||
QLabel *quantityLabel = new QLabel(i18n("Generated quantity"));
|
||||
quantityLabel->setAlignment(Qt::AlignLeft | Qt::AlignTop);
|
||||
quantityLabel->setFixedSize(180, 30);
|
||||
|
||||
QGridLayout *quantityLayout = new QGridLayout();
|
||||
addQuantityButtons(quantityLayout);
|
||||
quantityComboBox = new QComboBox(this);
|
||||
addQuantityComboBox();
|
||||
|
||||
/* 立即生成按钮 */
|
||||
buildButton = new QPushButton(i18n("Generate now"), this);
|
||||
|
@ -384,16 +348,11 @@ void kpAIDrawingBar::initUI()
|
|||
vbox->addWidget(styleLabel);
|
||||
vbox->addLayout(styleGrid);
|
||||
vbox->addSpacing(15);
|
||||
vbox->addWidget(ratioLabel);
|
||||
vbox->addLayout(ratioGrid);
|
||||
if (configVersion == 2) {
|
||||
vbox->addSpacing(15);
|
||||
vbox->addWidget(multipleLabel);
|
||||
vbox->addLayout(multipleLayout);
|
||||
}
|
||||
vbox->addWidget(resolutionLabel);
|
||||
vbox->addWidget(resolutionComboBox);
|
||||
vbox->addSpacing(15);
|
||||
vbox->addWidget(quantityLabel);
|
||||
vbox->addLayout(quantityLayout);
|
||||
vbox->addWidget(quantityComboBox);
|
||||
vbox->addSpacing(15);
|
||||
vbox->addWidget(buildButton);
|
||||
vbox->addSpacing(15);
|
||||
|
@ -668,127 +627,109 @@ void kpAIDrawingBar::handleLabelClicked(QObject *clickedObject)
|
|||
ImageStyle = (VisionImageStyle)identifier;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief kpAIDrawingBar::addRatioButtons
|
||||
* 添加比例按钮
|
||||
* @param layout
|
||||
* @param name
|
||||
* @param line
|
||||
*/
|
||||
void kpAIDrawingBar::addRatioButtons(QGridLayout *layout, QString name, int line)
|
||||
QJsonArray kpAIDrawingBar::readResolutionsFromJson(QString key)
|
||||
{
|
||||
// 添加比例按钮
|
||||
QPushButton *ratioButton = new QPushButton(this);
|
||||
ratioButton->setText(name);
|
||||
ratioButton->setFixedSize(69,24);
|
||||
ratioButton->setCheckable(true);
|
||||
ratioButton->setAutoDefault(false);
|
||||
if (line == 0)
|
||||
ratioButton->click();
|
||||
ratioButtonGroup->addButton(ratioButton, line);
|
||||
connect(ratioButton, &QPushButton::clicked, [this, line]() {
|
||||
if (line == 0) {
|
||||
AIImageSize = QSize(640, 360);
|
||||
if (configVersion == 1)
|
||||
AIImageSize = QSize(1536, 1024);
|
||||
}
|
||||
else if (line == 1){
|
||||
AIImageSize = QSize(512, 512);
|
||||
if (configVersion == 1)
|
||||
AIImageSize = QSize(1024, 1024);
|
||||
}
|
||||
else if (line == 2){
|
||||
AIImageSize = QSize(360, 640);
|
||||
if (configVersion == 1)
|
||||
AIImageSize = QSize(1024, 1536);
|
||||
}
|
||||
else{
|
||||
AIImageSize = QSize(640, 360);
|
||||
if (configVersion == 1)
|
||||
AIImageSize = QSize(1536, 1024);
|
||||
}
|
||||
if (!mSession)
|
||||
return QJsonArray();
|
||||
|
||||
ratioNum = line;
|
||||
qDebug()<<"处理比例按钮点击事件: AIImageSize = "<< AIImageSize;
|
||||
});
|
||||
layout->addWidget(ratioButton, line / 3, line % 3);
|
||||
QString jsonString = QString(vision_get_prompt2image_supported_params(mSession));
|
||||
|
||||
qDebug()<<"jsonString === "<<jsonString;
|
||||
|
||||
QJsonDocument doc = QJsonDocument::fromJson(jsonString.toUtf8());
|
||||
|
||||
if (!doc.isObject())
|
||||
return QJsonArray();
|
||||
|
||||
QJsonObject obj = doc.object();
|
||||
if (!obj.contains(key.toLatin1().data()))
|
||||
return QJsonArray();
|
||||
|
||||
return obj[key.toLatin1().data()].toArray();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief kpAIDrawingBar::addMultipleButton
|
||||
* 添加倍数按钮
|
||||
* @param layout
|
||||
* @param name
|
||||
* @param line
|
||||
*/
|
||||
void kpAIDrawingBar::addMultipleButton(QGridLayout *layout, QString name, int line)
|
||||
int kpAIDrawingBar::readNumFromJson(QString key)
|
||||
{
|
||||
QPushButton *multipleButton = new QPushButton(this);
|
||||
multipleButton->setText(name);
|
||||
multipleButton->setFixedSize(69, 24);
|
||||
multipleButton->setCheckable(true);
|
||||
multipleButton->setAutoDefault(false);
|
||||
if (line == 0)
|
||||
multipleButton->click();
|
||||
multipleButtonGroup->addButton(multipleButton, line);
|
||||
connect(multipleButton, &QPushButton::clicked, [this, line]() {
|
||||
if (line == 0)
|
||||
multipleNum = 1;
|
||||
else if (line == 1)
|
||||
multipleNum = 2;
|
||||
else if (line == 2)
|
||||
multipleNum = 4;
|
||||
else
|
||||
multipleNum = 1;
|
||||
if(!mSession)
|
||||
return 1;
|
||||
|
||||
qDebug()<<"处理倍数按钮点击事件: line = "<< multipleNum;
|
||||
});
|
||||
layout->addWidget(multipleButton, line / 3, line % 3);
|
||||
QString jsonString = QString(vision_get_prompt2image_supported_params(mSession));
|
||||
|
||||
QJsonDocument doc = QJsonDocument::fromJson(jsonString.toUtf8());
|
||||
|
||||
if (!doc.isObject())
|
||||
return 1;
|
||||
|
||||
QJsonObject obj = doc.object();
|
||||
if (!obj.contains(key.toLatin1().data()))
|
||||
return 1;
|
||||
|
||||
return obj[key.toLatin1().data()].toInt();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief kpAIDrawingBar::addQuantityButtons
|
||||
* 添加数量按钮
|
||||
* @param layout
|
||||
*/
|
||||
void kpAIDrawingBar::addQuantityButtons(QGridLayout *layout)
|
||||
void kpAIDrawingBar::addResolutionComboBox()
|
||||
{
|
||||
for (int i = 0; i < 4; ++i)
|
||||
QString resoKey = "resolution-ratio";
|
||||
QJsonArray resolutions = readResolutionsFromJson(resoKey);
|
||||
if (resolutions.isEmpty())
|
||||
{
|
||||
QString buttonName = QString::number(1 << i);
|
||||
if (i == 3 && configVersion == 1){
|
||||
buttonName = QString::number(6);
|
||||
}
|
||||
QPushButton *quantityButton = new QPushButton(buttonName);
|
||||
quantityButton->setFixedSize(50,24);
|
||||
quantityButton->setCheckable(true);
|
||||
|
||||
if (i == 2)
|
||||
quantityButton->click();
|
||||
quantityButtonGroup->addButton(quantityButton, i);
|
||||
connect(quantityButton, &QPushButton::clicked, [this, i](){
|
||||
if(i == 0) {
|
||||
quantityNum = 1;
|
||||
}
|
||||
else if (i == 1) {
|
||||
quantityNum = 2;
|
||||
}
|
||||
else if (i == 2){
|
||||
quantityNum = 4;
|
||||
}
|
||||
else if (i == 3 && configVersion == 2){
|
||||
quantityNum = 8;
|
||||
}
|
||||
else if (i == 3 && configVersion == 1){
|
||||
quantityNum = 6;
|
||||
}
|
||||
else {
|
||||
quantityNum = 4;
|
||||
}
|
||||
qDebug()<<"处理数量按钮点击事件 line = "<<quantityNum;
|
||||
});
|
||||
layout->addWidget(quantityButton, i / 4, i % 4);
|
||||
resolutionComboBox->addItem("512x512");
|
||||
return;
|
||||
}
|
||||
|
||||
for (const QJsonValue &value : resolutions) {
|
||||
QString resolution = value.toString();
|
||||
resolutionComboBox->addItem(resolution);
|
||||
}
|
||||
|
||||
connect(resolutionComboBox, QOverload<int>::of(&QComboBox::currentIndexChanged),
|
||||
[=](int index) {
|
||||
QString selectedResolution = resolutionComboBox->currentText();
|
||||
// 解析为QSize(这里假设分辨率总是"WxH"格式)
|
||||
int widthPos = selectedResolution.indexOf('x');
|
||||
qDebug()<<"index = "<<index<<selectedResolution<<widthPos;
|
||||
if (widthPos != -1) {
|
||||
int width = selectedResolution.left(widthPos).toInt();
|
||||
int height = selectedResolution.mid(widthPos + 1).toInt();
|
||||
QSize size(width, height);
|
||||
AIImageSize = size;
|
||||
}
|
||||
qDebug()<<"AIImageSize === "<<AIImageSize;
|
||||
});
|
||||
}
|
||||
|
||||
void kpAIDrawingBar::addQuantityComboBox()
|
||||
{
|
||||
QString numKey = "image-number";
|
||||
int num = readNumFromJson(numKey);
|
||||
if (num == 1){
|
||||
quantityComboBox->addItem("1张");
|
||||
}
|
||||
else if (num == 6){
|
||||
quantityComboBox->addItem("1张");
|
||||
quantityComboBox->addItem("2张");
|
||||
quantityComboBox->addItem("6张");
|
||||
}
|
||||
else if (num == 8){
|
||||
for (int i = 1; i <= num; i *= 2) {
|
||||
quantityComboBox->addItem(QString("%1张").arg(i));
|
||||
}
|
||||
}
|
||||
else {
|
||||
quantityComboBox->addItem("1张");
|
||||
qDebug()<<"读取生成数量不是常用数量, num = "<<num;
|
||||
}
|
||||
|
||||
// 连接信号以处理分辨率变化
|
||||
connect(quantityComboBox, QOverload<int>::of(&QComboBox::currentIndexChanged),
|
||||
[=](int index) {
|
||||
QString selectedResolution = quantityComboBox->currentText();
|
||||
QString numberString = selectedResolution.remove(QRegExp("[^\\d]"));
|
||||
quantityNum = numberString.toInt();
|
||||
qDebug()<<"生成数量quantityNum = "<<quantityNum;
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -852,7 +793,12 @@ void kpAIDrawingBar::addPageAndStoreImages()
|
|||
QGridLayout *pageLayout = new QGridLayout(newPage);
|
||||
pageLayout->setMargin (2);
|
||||
pageLayout->setSpacing (5);
|
||||
pageLayout->setAlignment(Qt::AlignTop | Qt::AlignCenter);
|
||||
if(show_quantityNum == 1){
|
||||
pageLayout->setAlignment(Qt::AlignTop | Qt::AlignLeft);
|
||||
}
|
||||
else {
|
||||
pageLayout->setAlignment(Qt::AlignTop | Qt::AlignCenter);
|
||||
}
|
||||
|
||||
for (int i = 0; i < currentImages.size(); ++i) {
|
||||
QPixmap pixmap = currentImages[i];
|
||||
|
@ -872,12 +818,7 @@ void kpAIDrawingBar::addPageAndStoreImages()
|
|||
QPixmap kpAIDrawingBar::createPixmapWithText(const QString &text)
|
||||
{
|
||||
QSize size;
|
||||
if (configVersion == 2)
|
||||
size = AIImageSize/4;
|
||||
else if (configVersion == 1)
|
||||
size = AIImageSize/8;
|
||||
else
|
||||
size = AIImageSize/4;
|
||||
size = getImageLabelSize();
|
||||
|
||||
QPixmap pixmap(size);
|
||||
pixmap.fill(QColor("#E6E6E6"));
|
||||
|
@ -890,13 +831,13 @@ QPixmap kpAIDrawingBar::createPixmapWithText(const QString &text)
|
|||
// 若需要调整字体大小以适应换行,请在此处设置,例如:font.setPointSize(10);
|
||||
|
||||
// 计算文本在给定宽度下的自动换行字符串
|
||||
QString wrappedText = fontMetrics().elidedText(text, Qt::ElideNone, pixmap.rect().width(), Qt::TextWordWrap);
|
||||
QString wrappedText = fontMetrics().elidedText(i18n(text.toLocal8Bit().data()), Qt::ElideNone, pixmap.rect().width(), Qt::TextWordWrap);
|
||||
|
||||
painter.setPen(color);
|
||||
painter.drawText(pixmap.rect(), Qt::AlignCenter | Qt::TextWordWrap, wrappedText);
|
||||
painter.end();
|
||||
|
||||
qDebug()<<"Error message:"<<i18n(text.toLocal8Bit().data());
|
||||
qDebug()<<"Error message:"<<i18n(text.toLocal8Bit().data())<<"size = "<<size;
|
||||
return pixmap;
|
||||
}
|
||||
|
||||
|
@ -979,7 +920,8 @@ void kpAIDrawingBar::onThreadFinished(bool flag, QPixmap pixmap, int imageIndex,
|
|||
if (imagesVector.size() > 0 ){
|
||||
imagesVector.last().append(map);
|
||||
}
|
||||
if (imageIndex + 1 == imageSum){
|
||||
qDebug()<<"onThreadFinished: imageIndex = "<<imageIndex<<"imageSum = "<<imageSum<<"errorCode = "<<errorCode;
|
||||
if (imageIndex + 1 == imageSum || imageSum == 0){
|
||||
buildButton->setEnabled(true);
|
||||
buildButton->setText(i18n("Generate now"));
|
||||
buildButton->setStyleSheet(colorfulButtonStyle);//设置立即生成按钮为立即生成
|
||||
|
@ -1047,7 +989,6 @@ void AIModeDataThread::generateImageCallback(VisionImageData imageData, void* us
|
|||
if(imageData.index == 0)
|
||||
emit AIMode->finishedSignal(false, map, imageData.index, imageData.total, imageData.error_code);
|
||||
emit AIMode->finishedSignal(true, map, imageData.index, imageData.total, imageData.error_code);
|
||||
qDebug()<<"------------------------------ generateImageCallback";
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1057,8 +998,8 @@ void AIModeDataThread::generateImageCallback(VisionImageData imageData, void* us
|
|||
*/
|
||||
bool AIModeDataThread::someFunctionInThread()
|
||||
{
|
||||
int width = AIImageSize.width() * multipleNum;
|
||||
int height = AIImageSize.height() * multipleNum;
|
||||
int width = AIImageSize.width();
|
||||
int height = AIImageSize.height();
|
||||
|
||||
vision_set_prompt2image_number(session, quantityNum);
|
||||
vision_set_prompt2image_size(session, width, height);
|
||||
|
@ -1084,57 +1025,15 @@ bool AIModeDataThread::someFunctionInThread()
|
|||
*/
|
||||
QSize kpAIDrawingBar::getImageLabelSize()
|
||||
{
|
||||
QSize labelSize = QSize(90,90);
|
||||
imageColumn = 2;
|
||||
if (show_quantityNum == 1){
|
||||
if(configVersion == 2){
|
||||
if(show_ratioNum == 0)
|
||||
labelSize = QSize(224, 126);
|
||||
else if (show_ratioNum == 1)
|
||||
labelSize = QSize(224, 224);
|
||||
else if (show_ratioNum == 2)
|
||||
labelSize = QSize(108, 192);
|
||||
else
|
||||
labelSize = QSize(224, 126);
|
||||
}
|
||||
else if (configVersion == 1){
|
||||
if(show_ratioNum == 0)
|
||||
labelSize = QSize(224, 150);
|
||||
else if (show_ratioNum == 1)
|
||||
labelSize = QSize(224, 224);
|
||||
else if (show_ratioNum == 2)
|
||||
labelSize = QSize(108, 162);
|
||||
else
|
||||
labelSize = QSize(224, 150);
|
||||
}
|
||||
imageColumn = 1;
|
||||
}
|
||||
else if (show_quantityNum >= 2) {
|
||||
if(configVersion == 2){
|
||||
if(show_ratioNum == 0)
|
||||
labelSize = QSize(108, 60);
|
||||
else if (show_ratioNum == 1)
|
||||
labelSize = QSize(108, 108);
|
||||
else if (show_ratioNum == 2)
|
||||
labelSize = QSize(108, 192);
|
||||
else
|
||||
labelSize = QSize(108, 60);
|
||||
}
|
||||
else if(configVersion == 1){
|
||||
if(show_ratioNum == 0)
|
||||
labelSize = QSize(108, 72);
|
||||
else if (show_ratioNum == 1)
|
||||
labelSize = QSize(108, 108);
|
||||
else if (show_ratioNum == 2)
|
||||
labelSize = QSize(108, 162);
|
||||
else
|
||||
labelSize = QSize(108, 72);
|
||||
}
|
||||
imageColumn = 2;
|
||||
}
|
||||
else
|
||||
labelSize = QSize(108,108);
|
||||
QSize labelSize = QSize(108,108);
|
||||
qreal ratio = showAIImageSize.width() / 108;
|
||||
int height = showAIImageSize.height() / ratio;
|
||||
|
||||
if (height != 0)
|
||||
labelSize = QSize(108, height);
|
||||
|
||||
qDebug()<<"getImageLabelSize labelSize = "<<labelSize;
|
||||
return labelSize;
|
||||
}
|
||||
|
||||
|
@ -1276,7 +1175,7 @@ void kpAIDrawingBar::updateResultGrid()
|
|||
void kpAIDrawingBar::updateImageGrid()
|
||||
{
|
||||
show_quantityNum = quantityNum;
|
||||
show_ratioNum = ratioNum;
|
||||
showAIImageSize = AIImageSize;
|
||||
|
||||
QSize labelSize = getImageLabelSize();
|
||||
|
||||
|
@ -1285,7 +1184,12 @@ void kpAIDrawingBar::updateImageGrid()
|
|||
|
||||
pageLayout->setMargin (2);
|
||||
pageLayout->setSpacing (5);
|
||||
pageLayout->setAlignment(Qt::AlignTop | Qt::AlignCenter);
|
||||
if(show_quantityNum == 1){
|
||||
pageLayout->setAlignment(Qt::AlignTop | Qt::AlignLeft);
|
||||
}
|
||||
else {
|
||||
pageLayout->setAlignment(Qt::AlignTop | Qt::AlignCenter);
|
||||
}
|
||||
|
||||
for(int i = 0; i < quantityNum; i++){
|
||||
QLabel *label = new QLabel();
|
||||
|
@ -1314,7 +1218,7 @@ void kpAIDrawingBar::updateImageGrid()
|
|||
deleteButtonFlag = false;
|
||||
deleteButton->setEnabled(false);
|
||||
|
||||
qDebug()<<textBox<<AIImageSize * multipleNum<<quantityNum<<ImageStyle;
|
||||
qDebug()<<textBox<<AIImageSize <<quantityNum<<ImageStyle;
|
||||
|
||||
startThread();
|
||||
}
|
||||
|
|
|
@ -78,12 +78,14 @@ public:
|
|||
~AIModeDataThread();
|
||||
|
||||
bool setSessionStatus();
|
||||
VisionSession getVisionSession(){
|
||||
return session;
|
||||
}
|
||||
bool someFunctionInThread();
|
||||
|
||||
void setAIData (QString str, QSize size, int multiple, int quantity, VisionImageStyle Style){
|
||||
void setAIData (QString str, QSize size, int quantity, VisionImageStyle Style){
|
||||
textBox = str;
|
||||
AIImageSize = size;
|
||||
multipleNum = multiple;
|
||||
quantityNum = quantity;
|
||||
ImageStyle = Style;
|
||||
}
|
||||
|
@ -101,8 +103,7 @@ private:
|
|||
|
||||
private:
|
||||
QPixmap pixmap;
|
||||
int quantityNum = 4; //数量按钮
|
||||
int multipleNum = 1; //倍数按钮
|
||||
int quantityNum = 1; //数量按钮
|
||||
QSize AIImageSize;
|
||||
QString textBox;
|
||||
VisionImageStyle ImageStyle;
|
||||
|
@ -180,7 +181,7 @@ private slots:
|
|||
|
||||
void startThread() {
|
||||
if (m_AiMode->setSessionStatus()){
|
||||
m_AiMode->setAIData(textBox, AIImageSize, multipleNum, quantityNum, ImageStyle);
|
||||
m_AiMode->setAIData(textBox, AIImageSize, quantityNum, ImageStyle);
|
||||
m_AiMode->someFunctionInThread();
|
||||
}
|
||||
}
|
||||
|
@ -191,10 +192,11 @@ private:
|
|||
void updateResultGrid();
|
||||
void deleteImageGridWidget();
|
||||
|
||||
void addRatioButtons(QGridLayout *layout, QString name, int line);
|
||||
void addQuantityButtons(QGridLayout *layout);
|
||||
void addMultipleButton(QGridLayout *layout, QString name, int line);
|
||||
void addResolutionComboBox();
|
||||
void addQuantityComboBox();
|
||||
|
||||
QJsonArray readResolutionsFromJson(QString key);
|
||||
int readNumFromJson(QString key);
|
||||
QWidget *addAllStyleLabel(QString iconPath, QString labelText, int line);
|
||||
QWidget *addStyleLabel(QString iconPath, QString labelText, int line);
|
||||
|
||||
|
@ -202,12 +204,9 @@ private:
|
|||
void addStyleGrid(QWidget *widget, int line);
|
||||
|
||||
private:
|
||||
int multipleNum = 1; //倍数按钮
|
||||
int imageColumn = 2;//显示列表列数
|
||||
int quantityNum = 4; //数量按钮
|
||||
int ratioNum = 0; //比例按钮
|
||||
int show_quantityNum = 4; //数量按钮
|
||||
int show_ratioNum = 0; //比例按钮
|
||||
int quantityNum = 1; //数量按钮
|
||||
int show_quantityNum = 1; //数量按钮
|
||||
int currentPageIndx = -1;//切换页第几页
|
||||
|
||||
bool styleFlag; //风格标志位,用于判断按下哪一个风格
|
||||
|
@ -216,6 +215,7 @@ private:
|
|||
|
||||
QGSettings *AiSettings; //监听配置信息
|
||||
QSize AIImageSize; //图片大小
|
||||
QSize showAIImageSize;
|
||||
QMovie *movie = nullptr;//生成等待图标
|
||||
QLabel *resultLabel; //生成结果 label
|
||||
QLabel *pageLabel; //第几页面label
|
||||
|
@ -239,14 +239,13 @@ private:
|
|||
QPushButton *buildButton; //立即生成按钮
|
||||
QPushButton *deleteButton; //删除按钮
|
||||
|
||||
QButtonGroup *ratioButtonGroup; //比例按钮
|
||||
QButtonGroup *quantityButtonGroup; //数量按钮
|
||||
QButtonGroup *multipleButtonGroup; //倍数按钮
|
||||
|
||||
QComboBox *resolutionComboBox; //图像分辨率
|
||||
QComboBox *quantityComboBox; //生成数量
|
||||
|
||||
QStackedWidget *stackedWidget; //生成结果的换页窗口
|
||||
QVector<QVector<QPixmap>> imagesVector; //生成图像数据集成
|
||||
|
||||
VisionSession mSession = nullptr;
|
||||
VisionImageStyle ImageStyle; //风格样式
|
||||
AIModeDataThread *m_AiMode; //AI生成程序
|
||||
|
||||
|
|
Loading…
Reference in New Issue