bug/loadimage-dump
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
#include "ui_frmalbum.h"
|
||||
#include <QUrl>
|
||||
|
||||
int FrmAlbum::m_copyType = 0;
|
||||
|
||||
FrmAlbum::FrmAlbum(QWidget *parent) : QWidget(parent)
|
||||
{
|
||||
@@ -13,52 +14,168 @@ FrmAlbum::~FrmAlbum()
|
||||
delete ui;
|
||||
}
|
||||
|
||||
// QSet<QString> FrmAlbum::getUrlSet()
|
||||
// {
|
||||
// return m_selectedImageSet;
|
||||
// }
|
||||
|
||||
int FrmAlbum::getCopyType()
|
||||
{
|
||||
return m_copyType;
|
||||
}
|
||||
|
||||
void FrmAlbum::slot_updateImage()
|
||||
{
|
||||
QList<QUrl> urls = {
|
||||
QUrl("https://imagehyj.oss-cn-hangzhou.aliyuncs.com/blog/20250320201317.png"),
|
||||
QUrl("https://imagehyj.oss-cn-hangzhou.aliyuncs.com/blog/EDH386.jpeg"),
|
||||
QUrl("https://imagehyj.oss-cn-hangzhou.aliyuncs.com/blog/20250321103557.png"),
|
||||
QUrl("https://imagehyj.oss-cn-hangzhou.aliyuncs.com/blog/logo512.png")
|
||||
};
|
||||
|
||||
foreach (const QUrl& u, urls) {
|
||||
FrmImgShow* widget = new FrmImgShow(this);
|
||||
widget->loadImage(u);
|
||||
picWidgetList.push_front(widget);
|
||||
}
|
||||
qDebug() <<"slot_updateImage";
|
||||
// QList<QUrl> urls = ImageManager::instance()->getImageUrls(FileConfigDecode::getInstance()->getAddress(),
|
||||
// FileConfigDecode::getInstance()->getUserName());
|
||||
|
||||
// foreach (const QUrl& u, urls) {
|
||||
// qDebug() << "image url:" <<u;
|
||||
// FrmImgShow* widget = new FrmImgShow;
|
||||
// connect(widget, &FrmImgShow::signal_imageSelected, [this](const QString& url){
|
||||
// m_selectedImageSet.insert(url);
|
||||
// });
|
||||
// connect(widget, &FrmImgShow::signal_imageUnselected, [this](const QString& url){
|
||||
// m_selectedImageSet.remove(url);
|
||||
// });
|
||||
// widget->loadImage(u);
|
||||
// picWidgetList.push_front(widget);
|
||||
// panelWidget->setWidget(picWidgetList, 3);
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
void FrmAlbum::initForm()
|
||||
{
|
||||
layout = new QHBoxLayout(this);
|
||||
panelWidget = new PanelWidget(this);
|
||||
|
||||
layout = new QVBoxLayout();
|
||||
setLayout(layout);
|
||||
panelWidget = new PanelWidget();
|
||||
panelWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
||||
panelWidget->setStyleSheet("border:1px solid white;");
|
||||
panelWidget->setSpace(5);
|
||||
layout->addWidget(panelWidget);
|
||||
|
||||
|
||||
layout->setContentsMargins(0, 0, 0, 0);
|
||||
layout->setSpacing(0);
|
||||
this->setLayout(layout);
|
||||
|
||||
panelWidget->setObjectName("widget");
|
||||
panelWidget->setStyleSheet("background-color: rgb(63, 60, 55)");
|
||||
// panelWidget->setStyleSheet("background-color: #FFFFFF");
|
||||
panelWidget->setAutoHeight(false);
|
||||
panelWidget->setAutoWidth(false);
|
||||
panelWidget->setAutoHeight(false);
|
||||
panelWidget->setAutoWidth(false);
|
||||
|
||||
btnCopy = new QPushButton;
|
||||
btnCopy->setText("复制");
|
||||
btnCopy->setCursor(Qt::PointingHandCursor);
|
||||
btnCopy->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
||||
btnCopy->setStyleSheet("height:25px;width:70px;background-color:#1B9EF3;color:white;border-style:none;border-radius:8px");
|
||||
connect(btnCopy, &QPushButton::clicked, [this](){
|
||||
qDebug() <<"btnCopy";
|
||||
QString clipStr = "";
|
||||
foreach (QString s, m_selectedImageSet) {
|
||||
switch (cbbCopyType->currentIndex()) {
|
||||
case 0:
|
||||
{
|
||||
QString curStr = QString("").arg(s);
|
||||
curStr += "\n";
|
||||
clipStr += curStr;
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
QString curStr = QString("%1").arg(s);
|
||||
curStr += "\n";
|
||||
clipStr += curStr;
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
QString curStr = QString("<img src=\"%1\"/>").arg(s);
|
||||
curStr += "\n";
|
||||
clipStr += curStr;
|
||||
break;
|
||||
}
|
||||
case 3:
|
||||
{
|
||||
QString curStr = QString("[IMG]%1[/IMG]").arg(s);
|
||||
curStr += "\n";
|
||||
clipStr += curStr;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QClipboard* clipboard = QApplication::clipboard();
|
||||
clipboard->setText(clipStr);
|
||||
});
|
||||
|
||||
btnDelete = new QPushButton;
|
||||
btnDelete->setText("删除");
|
||||
btnDelete->setCursor(Qt::PointingHandCursor);
|
||||
btnDelete->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
||||
btnDelete->setStyleSheet("height:25px;width:70px;background-color:#F15140;color:white;border-style:none;border-radius:8px");
|
||||
|
||||
btnSelectAll = new QPushButton;
|
||||
btnSelectAll->setText("全选");
|
||||
btnSelectAll->setCursor(Qt::PointingHandCursor);
|
||||
btnSelectAll->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
||||
btnSelectAll->setStyleSheet("height:25px;width:70px;background-color:#44B363;color:white;border-style:none;border-radius:8px");
|
||||
|
||||
cbbCopyType = new QComboBox;
|
||||
cbbCopyType->setCursor(Qt::PointingHandCursor);
|
||||
cbbCopyType->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
||||
cbbCopyType->setStyleSheet("height:25px;width:300;background-color:white;padding-left:16px;");
|
||||
|
||||
QList<QString> copyTypeList{"Markdown", "URL", "HTML", "UBB"};
|
||||
cbbCopyType->addItems(copyTypeList);
|
||||
|
||||
connect(cbbCopyType, &QComboBox::currentIndexChanged, [this](int index){
|
||||
m_copyType = index;
|
||||
qDebug() << m_copyType;
|
||||
});
|
||||
|
||||
spacerItem = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Fixed);
|
||||
menuLayout = new QHBoxLayout();
|
||||
menuLayout->setContentsMargins(0, 0, 0, 0);
|
||||
menuLayout->setSpacing(8);
|
||||
menuLayout->addWidget(cbbCopyType);
|
||||
menuLayout->addWidget(btnCopy);
|
||||
menuLayout->addWidget(btnDelete);
|
||||
menuLayout->addWidget(btnSelectAll);
|
||||
menuLayout->addSpacerItem(spacerItem);
|
||||
|
||||
layout->addLayout(menuLayout);
|
||||
layout->addWidget(panelWidget);
|
||||
layout->setSpacing(6);
|
||||
// qDebug() << ui->widget;
|
||||
|
||||
QList<QUrl> urls = {
|
||||
QUrl("https://imagehyj.oss-cn-hangzhou.aliyuncs.com/blog/20250320201317.png"),
|
||||
QUrl("https://imagehyj.oss-cn-hangzhou.aliyuncs.com/blog/EDH386.jpeg"),
|
||||
QUrl("https://imagehyj.oss-cn-hangzhou.aliyuncs.com/blog/20250321103557.png"),
|
||||
QUrl("https://imagehyj.oss-cn-hangzhou.aliyuncs.com/blog/logo512.png")
|
||||
};
|
||||
connect(TCHttpService::getInstance(), &TCHttpService::signal_loginSuc, [this](){
|
||||
qDebug() <<"login success";
|
||||
QList<QUrl> urls = ImageManager::instance()->getImageUrls(FileConfigDecode::getInstance()->getAddress(),
|
||||
FileConfigDecode::getInstance()->getUserName());
|
||||
|
||||
foreach (const QUrl& u, urls) {
|
||||
qDebug() << "image url:" <<u;
|
||||
FrmImgShow* widget = new FrmImgShow(panelWidget);
|
||||
connect(widget, &FrmImgShow::signal_imageSelected, [this](const QString& url){
|
||||
m_selectedImageSet.insert(url);
|
||||
});
|
||||
connect(widget, &FrmImgShow::signal_imageUnselected, [this](const QString& url){
|
||||
m_selectedImageSet.remove(url);
|
||||
});
|
||||
widget->loadImage(u);
|
||||
picWidgetList.push_front(widget);
|
||||
panelWidget->setWidget(picWidgetList, 3);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
foreach (const QUrl& u, urls) {
|
||||
FrmImgShow* widget = new FrmImgShow(this);
|
||||
widget->loadImage(u);
|
||||
picWidgetList.push_front(widget);
|
||||
}
|
||||
|
||||
panelWidget->setWidget(picWidgetList, 4);
|
||||
panelWidget->setSpace(15);
|
||||
|
||||
Reference in New Issue
Block a user