完成发布
This commit is contained in:
@@ -26,33 +26,38 @@ int FrmAlbum::getCopyType()
|
||||
|
||||
void FrmAlbum::slot_updateImage()
|
||||
{
|
||||
picWidgetList.clear();
|
||||
panelWidget->clearWidgets();
|
||||
QList<QUrl> urls = ImageManager::instance()->getImageUrls(FileConfigDecode::getInstance()->getAddress(),
|
||||
FileConfigDecode::getInstance()->getUserName());
|
||||
qDebug() <<urls.size();
|
||||
foreach (const QUrl& u, urls) {
|
||||
FrmImgShow* widget = new FrmImgShow(this);
|
||||
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);
|
||||
});
|
||||
|
||||
qDebug() <<"slot_updateImage";
|
||||
// QList<QUrl> urls = ImageManager::instance()->getImageUrls(FileConfigDecode::getInstance()->getAddress(),
|
||||
// FileConfigDecode::getInstance()->getUserName());
|
||||
connect(widget, &FrmImgShow::signal_imageDelete, this, &FrmAlbum::slot_updateImage);
|
||||
|
||||
// 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);
|
||||
// }
|
||||
widget->loadImage(u);
|
||||
picWidgetList.push_back(widget);
|
||||
|
||||
// panelWidget->setWidget(picWidgetList, 3);
|
||||
}
|
||||
panelWidget->setWidget(picWidgetList, 4);
|
||||
panelWidget->setSpace(15);
|
||||
|
||||
}
|
||||
|
||||
void FrmAlbum::initForm()
|
||||
{
|
||||
|
||||
layout = new QVBoxLayout();
|
||||
layout = new QVBoxLayout(this);
|
||||
setLayout(layout);
|
||||
panelWidget = new PanelWidget();
|
||||
panelWidget = new PanelWidget(this);
|
||||
panelWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
||||
panelWidget->setStyleSheet("border:1px solid white;");
|
||||
panelWidget->setSpace(5);
|
||||
@@ -75,7 +80,6 @@ void FrmAlbum::initForm()
|
||||
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()) {
|
||||
@@ -136,7 +140,6 @@ void FrmAlbum::initForm()
|
||||
|
||||
connect(cbbCopyType, &QComboBox::currentIndexChanged, [this](int index){
|
||||
m_copyType = index;
|
||||
qDebug() << m_copyType;
|
||||
});
|
||||
|
||||
spacerItem = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Fixed);
|
||||
@@ -155,13 +158,12 @@ void FrmAlbum::initForm()
|
||||
// qDebug() << ui->widget;
|
||||
|
||||
connect(TCHttpService::getInstance(), &TCHttpService::signal_loginSuc, [this](){
|
||||
qDebug() <<"login success";
|
||||
// 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);
|
||||
FrmImgShow* widget = new FrmImgShow(this);
|
||||
connect(widget, &FrmImgShow::signal_imageSelected, [this](const QString& url){
|
||||
m_selectedImageSet.insert(url);
|
||||
});
|
||||
@@ -170,13 +172,10 @@ void FrmAlbum::initForm()
|
||||
});
|
||||
widget->loadImage(u);
|
||||
picWidgetList.push_front(widget);
|
||||
panelWidget->setWidget(picWidgetList, 3);
|
||||
|
||||
// panelWidget->setWidget(picWidgetList, 3);
|
||||
}
|
||||
panelWidget->setWidget(picWidgetList, 4);
|
||||
panelWidget->setSpace(15);
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
panelWidget->setWidget(picWidgetList, 4);
|
||||
panelWidget->setSpace(15);
|
||||
}
|
||||
|
||||
@@ -6,9 +6,10 @@
|
||||
#include <QComboBox>
|
||||
#include <QSet>
|
||||
#include "panelwidget.h"
|
||||
#include "frmimgshow.h"
|
||||
#include "fileconfigdecode.h"`
|
||||
#include <QHBoxLayout>
|
||||
#include "frmimgshow.h"
|
||||
#include "fileconfigdecode.h"
|
||||
|
||||
|
||||
namespace Ui {
|
||||
class FrmAlbum;
|
||||
|
||||
@@ -8,14 +8,12 @@ FrmImgShow::FrmImgShow(QWidget *parent) : QWidget(parent)
|
||||
connect(TCHttpService::getInstance(), &TCHttpService::signal_imageDownloaded,
|
||||
this, [this](const QString& requestId, const QPixmap& pixmap){
|
||||
if (requestId == m_requestId) {
|
||||
// setLoadingState(false);
|
||||
qDebug() << "load success";
|
||||
setImage(pixmap);
|
||||
}
|
||||
});
|
||||
|
||||
connect(TCHttpService::getInstance(), &TCHttpService::signal_downloadFailed,
|
||||
this, [this](const QString& requestId, const QString& error){
|
||||
this, [this](const QString& requestId){
|
||||
if (requestId == m_requestId) {
|
||||
qDebug() << "load failed";
|
||||
}
|
||||
@@ -24,7 +22,6 @@ FrmImgShow::FrmImgShow(QWidget *parent) : QWidget(parent)
|
||||
|
||||
void FrmImgShow::loadImage(const QUrl &imageUrl)
|
||||
{
|
||||
qDebug() << "loadImage";
|
||||
m_currentUrl = imageUrl;
|
||||
m_requestId = QUuid::createUuid().toString();
|
||||
TCHttpService::getInstance()->downloadImage(m_requestId, imageUrl);
|
||||
@@ -46,14 +43,9 @@ void FrmImgShow::setImage(const QPixmap &pixmap)
|
||||
labImg->setPixmap(pixmap.scaled(this->labImg->width(), this->labImg->height()));
|
||||
}
|
||||
|
||||
void FrmImgShow::setLoadingState(bool loading)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void FrmImgShow::initSignalSlot()
|
||||
{
|
||||
connect(btnCopy, &QPushButton::clicked, [this](){
|
||||
connect(btnCopy, &QPushButton::clicked, this, [this](){
|
||||
switch(FrmAlbum::getCopyType()) {
|
||||
case 0:
|
||||
{
|
||||
@@ -86,7 +78,7 @@ void FrmImgShow::initSignalSlot()
|
||||
}
|
||||
});
|
||||
|
||||
connect(ckbSelect, &QCheckBox::checkStateChanged, [this](Qt::CheckState state){
|
||||
connect(ckbSelect, &QCheckBox::checkStateChanged, this, [this](Qt::CheckState state){
|
||||
if (state == Qt::Unchecked) {
|
||||
emit signal_imageUnselected(m_currentUrl.toString());
|
||||
}
|
||||
@@ -95,6 +87,15 @@ void FrmImgShow::initSignalSlot()
|
||||
emit signal_imageSelected(m_currentUrl.toString());
|
||||
}
|
||||
});
|
||||
|
||||
connect(btnDelete, &QPushButton::clicked, this, [this](){
|
||||
// qDebug() <<"delete";
|
||||
QString domain = FileConfigDecode::getInstance()->getAddress();
|
||||
QString userName = FileConfigDecode::getInstance()->getUserName();
|
||||
int del_res = ImageManager::instance()->removeImageUrl(domain, userName, m_currentUrl.toString());
|
||||
// qDebug() << "del_res:" << del_res;
|
||||
emit signal_imageDelete();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -199,7 +200,7 @@ void FrmImgShow::initForm()
|
||||
// btnCopy->setFixedSize(32, 32);
|
||||
// btnCopy->setCursor(Qt::PointingHandCursor);
|
||||
|
||||
setStyleSheet("background-color: #FF0000");
|
||||
// setStyleSheet("background-color: #FF0000");
|
||||
|
||||
setFixedSize(134, 160);
|
||||
|
||||
|
||||
@@ -23,7 +23,6 @@ public:
|
||||
|
||||
void loadImage(const QUrl& imageUrl);
|
||||
void setImage(const QPixmap& pixmap);
|
||||
void setLoadingState(bool loading);
|
||||
|
||||
void initSignalSlot();
|
||||
|
||||
@@ -56,6 +55,7 @@ private:
|
||||
signals:
|
||||
void signal_imageSelected(QString);
|
||||
void signal_imageUnselected(QString);
|
||||
void signal_imageDelete();
|
||||
};
|
||||
|
||||
#endif // FRMIMGSHOW_H
|
||||
|
||||
@@ -94,14 +94,14 @@ void FrmSetting::initWidget()
|
||||
}
|
||||
if (FileConfigDecode::getInstance()->getAutoLogin()) {
|
||||
ui->labAUtoLoginOpen->setStyleSheet(OPENQSS);
|
||||
ui->labAUtoLoginOpen->setStyleSheet(CLOSEQSS);
|
||||
ui->labAutoLoginClose->setStyleSheet(CLOSEQSS);
|
||||
TCHttpService::getInstance()->setConfiguration(FileConfigDecode::getInstance()->getUserName(),
|
||||
FileConfigDecode::getInstance()->getPassword(),
|
||||
FileConfigDecode::getInstance()->getAddress());
|
||||
}
|
||||
else {
|
||||
ui->labAUtoLoginOpen->setStyleSheet(CLOSEQSS);
|
||||
ui->labAUtoLoginOpen->setStyleSheet(OPENQSS);
|
||||
ui->labAutoLoginClose->setStyleSheet(OPENQSS);
|
||||
}
|
||||
|
||||
ui->schRename->setChecked(FileConfigDecode::getInstance()->getRename());
|
||||
|
||||
@@ -81,6 +81,14 @@ int PanelWidget::getColumnCount()
|
||||
return this->columnCount;
|
||||
}
|
||||
|
||||
void PanelWidget::clearWidgets()
|
||||
{
|
||||
foreach (QWidget* w, widgets) {
|
||||
delete w;
|
||||
}
|
||||
widgets.clear();
|
||||
}
|
||||
|
||||
void PanelWidget::setWidget(QList<QWidget *> widgets, int columnCount)
|
||||
{
|
||||
this->widgets = widgets;
|
||||
@@ -94,7 +102,6 @@ void PanelWidget::setWidget(QList<QWidget *> widgets, int columnCount)
|
||||
foreach (QWidget *widget, widgets) {
|
||||
gridLayout->removeWidget(widget);
|
||||
widget->setVisible(false);
|
||||
delete widget;
|
||||
}
|
||||
|
||||
//重新添加到布局中并可见
|
||||
|
||||
@@ -60,6 +60,7 @@ public:
|
||||
|
||||
QList<QWidget *> getWidgets();
|
||||
int getColumnCount();
|
||||
void clearWidgets();
|
||||
|
||||
|
||||
public Q_SLOTS:
|
||||
@@ -70,6 +71,7 @@ public Q_SLOTS:
|
||||
void setAutoWidth(bool autoWidth);
|
||||
void setAutoHeight(bool autoHeight);
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif // PANELWIDGET_H
|
||||
|
||||
Reference in New Issue
Block a user