Skip to content

Commit

Permalink
Merge branch 'main' of https://gitee.com/opguess/QSyncUi
Browse files Browse the repository at this point in the history
  • Loading branch information
RaidenShogunShadow committed Jul 10, 2024
2 parents 5f7bd6a + f65b0fa commit bfda273
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 18 deletions.
10 changes: 10 additions & 0 deletions dircardproxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,16 @@ void DirCardProxy::addDirCard(DirCard *card, const QString &id) {
}
}

void DirCardProxy::addDirCard(QString filename,QString datasize,QString bindtime,const QString &id)
{
DirCard*card=new DirCard(filename,datasize,bindtime,id);
if (card && parentWidget && !cardMap.contains(id)) {
cardMap[id] = card;
filesLayout->addWidget(card);
filesLayout->setAlignment(Qt::AlignTop);
}
}

void DirCardProxy::removeDirCard(const QString &id) {
if (cardMap.contains(id)) {
DirCard *card = cardMap.take(id);
Expand Down
1 change: 1 addition & 0 deletions dircardproxy.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ class DirCardProxy : public QWidget {
~DirCardProxy() override;

void addDirCard(DirCard *card, const QString &id);
void addDirCard(QString filename,QString datasize,QString bindtime,const QString &id);
void removeDirCard(const QString &id);
void removeChecked();
QVBoxLayout*filesLayout;
Expand Down
28 changes: 14 additions & 14 deletions filemange_view.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,16 +107,16 @@ FileManagePage::FileManagePage(QWidget* parent):ElaScrollPage(parent)
scrollArea->viewport()->setStyleSheet("background:transparent;");//设置背景透明

_dircardProxy=new DirCardProxy(this);
addDirCard("文件1","1.0GB","2024.7.1");
addDirCard("文件2","2.0GB","2024.7.2");
addDirCard("文件3","3.0GB","2024.7.3");
addDirCard("文件4","4.0GB","2024.7.4");
addDirCard("文件5","5.0GB","2024.7.5");
addDirCard("文件6","6.0GB","2024.7.6");
addDirCard("文件7","7.0GB","2024.7.7");
addDirCard("文件8","8.0GB","2024.7.8");
addDirCard("文件9","9.0GB","2024.7.9");
addDirCard("文件10","10.0GB","2024.7.10");
addDirCard("文件1","1.0GB","2024.7.1","1");
addDirCard("文件2","2.0GB","2024.7.2","2");
addDirCard("文件3","3.0GB","2024.7.3","3");
addDirCard("文件4","4.0GB","2024.7.4","4");
addDirCard("文件5","5.0GB","2024.7.5","5");
addDirCard("文件6","6.0GB","2024.7.6","6");
addDirCard("文件7","7.0GB","2024.7.7","7");
addDirCard("文件8","8.0GB","2024.7.8","8");
addDirCard("文件9","9.0GB","2024.7.9","9");
addDirCard("文件10","10.0GB","2024.7.10","10");

scrollArea->setWidget(_dircardProxy);
scrollArea->setWidgetResizable(true); // 允许scrollArea根据内容自动调整大小
Expand All @@ -134,11 +134,11 @@ FileManagePage::~FileManagePage()

}

void FileManagePage::addDirCard(QString filename,QString datasize,QString bingtime)
void FileManagePage::addDirCard(QString filename,QString datasize,QString bindtime,QString id)
{
DirCard*newDir=new DirCard(filename,datasize,bingtime);
qDebug()<<connect(newDir,&DirCard::relieve,this,&FileManagePage::removeDirCard);
_dircardProxy->addDirCard(newDir,filename+datasize+bingtime);
DirCard*newDir=new DirCard(filename,datasize,bindtime,id);
connect(newDir,&DirCard::relieve,this,&FileManagePage::removeDirCard);
_dircardProxy->addDirCard(newDir,id);
}

void FileManagePage::removeDirCard(QString id)
Expand Down
2 changes: 1 addition & 1 deletion filemange_view.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class FileManagePage:public ElaScrollPage
public:
FileManagePage(QWidget* parent = nullptr);
~FileManagePage();
void addDirCard(QString filename,QString datasize,QString bingtime);
void addDirCard(QString filename,QString datasize,QString bindtime,QString id);
void removeDirCard(QString id);
DirCardProxy*_dircardProxy;
linkNewFolder_window* linknewfolderwindow=new linkNewFolder_window();
Expand Down
4 changes: 2 additions & 2 deletions thirdParty/ElaWidgetTools/DirCard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@
#include"ElaPushButton.h"
#include"ElaToggleButton.h"

DirCard::DirCard(QString f, QString d,QString b)
DirCard::DirCard(QString f, QString d,QString b,QString Id)
{
filename=new ElaText(f);
datasize=new ElaText(d);
bindtime=new ElaText(b);
id=filename->text()+datasize->text()+bindtime->text();
id=Id;

_checkBox = new ElaCheckBox(filename->text(), this);
QVBoxLayout*checkBoxArea=new QVBoxLayout();
Expand Down
2 changes: 1 addition & 1 deletion thirdParty/ElaWidgetTools/include/DirCard.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class ELA_EXPORT DirCard : public ElaScrollPageArea
{
Q_OBJECT
public:
explicit DirCard(QString f, QString d,QString b);
explicit DirCard(QString f, QString d,QString b,QString Id);

ElaCheckBox* _checkBox{nullptr};
ElaToggleButton*pauseBtn;
Expand Down

0 comments on commit bfda273

Please sign in to comment.