开源 企业版 高校版 私有云 模力方舟 AI 队友
代码拉取完成,页面将自动刷新
捐赠
捐赠前请先登录
扫描微信二维码支付
取消
支付完成
支付提示
将跳转至支付宝完成支付
确定
取消
1 Star 0 Fork 142

撸码小分队/DS

forked from Vanishi/DS
加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
已有帐号? 立即登录
文件
master
分支 (2)
标签 (4)
master
V1.0
DS.v1.7.x64.2023年04月16日
DS.v1.6.x64.2023年04月13日
DS.v1.5.x64.2023年04月08日
DS.v1.0.x64.2023年03月18日
master
分支 (2)
标签 (4)
master
V1.0
DS.v1.7.x64.2023年04月16日
DS.v1.6.x64.2023年04月13日
DS.v1.5.x64.2023年04月08日
DS.v1.0.x64.2023年03月18日
克隆/下载
克隆/下载
提示
下载代码请复制以下命令到终端执行
为确保你提交的代码身份被 Gitee 正确识别,请执行以下命令完成配置
初次使用 SSH 协议进行代码克隆、推送等操作时,需按下述提示完成 SSH 配置
1 生成 RSA 密钥
2 获取 RSA 公钥内容,并配置到 SSH公钥
在 Gitee 上使用 SVN,请访问 使用指南
使用 HTTPS 协议时,命令行会出现如下账号密码验证步骤。基于安全考虑,Gitee 建议 配置并使用私人令牌 替代登录密码进行克隆、推送等操作
Username for 'https://gitee.com': userName
Password for 'https://userName@gitee.com': # 私人令牌
master
分支 (2)
标签 (4)
master
V1.0
DS.v1.7.x64.2023年04月16日
DS.v1.6.x64.2023年04月13日
DS.v1.5.x64.2023年04月08日
DS.v1.0.x64.2023年03月18日
DS
/
Task
/
TaskImport.cpp
DS
/
Task
/
TaskImport.cpp
TaskImport.cpp 5.15 KB
一键复制 编辑 原始数据 按行查看 历史
#include "TaskImport.h"
#include "style.h"
#include "Utils/models.h"
#include "Utils/database.h"
#include "Utils/ComMessageBox.h"
#include "Utils/ComLineWidget.h"
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QLabel>
#include <QLineEdit>
#include <QPushButton>
#include <QComboBox>
#include <QStyledItemDelegate>
#include <QFileDialog>
#include <QsLog.h>
TaskImport::TaskImport(QWidget *parent) : QDialog(parent)
{
setFixedSize(520,200);
Qt::WindowFlags flags=Qt::Dialog;
flags |=Qt::WindowCloseButtonHint;
setWindowFlags(flags);
setAttribute(Qt::WA_StyledBackground,true);
setStyleSheet(".TaskImport{background-color:rgb(255,255,255);}");
setWindowTitle("导入任务");
QVBoxLayout *boxLayout = new QVBoxLayout(this);
boxLayout->setContentsMargins(20,10,20,0);
QWidget *gWidget = new QWidget(this);
QGridLayout *gLayout = new QGridLayout(gWidget);
gLayout->setColumnMinimumWidth(0,60);
gLayout->setColumnMinimumWidth(2,110);
// 第一行
QLabel *nameLabel = new QLabel(gWidget);
nameLabel->setText("任务名称");
QLineEdit *nameLine = new QLineEdit(gWidget);
nameLine->setFixedHeight(30);
nameLine->setStyleSheet(m_stylesheet_QLineEdit);
QPushButton *selectBtn = new QPushButton(gWidget);
selectBtn->setText("选择...");
selectBtn->setCursor(Qt::PointingHandCursor);
selectBtn->setStyleSheet(m_stylesheet_QPushButton_hollow);
selectBtn->setFixedSize(90,28);
connect(selectBtn,&QPushButton::clicked,this,[this,nameLine](){
QString filename = QFileDialog::getOpenFileName(this,"选择任务文件","","*.ds");
if(filename.length()>0){
nameLine->setText(filename);
}
});
gLayout->addWidget(nameLabel,0,0,Qt::AlignCenter);
gLayout->addWidget(nameLine,0,1);
gLayout->addWidget(selectBtn,0,2,Qt::AlignCenter);
// 第二行
QLabel *groupNameLabel = new QLabel(gWidget);
groupNameLabel->setText("任务组");
QComboBox *groupComboBox = new QComboBox(gWidget);
groupComboBox->setFixedHeight(30);
QStyledItemDelegate *groupDelegate = new QStyledItemDelegate(groupComboBox);
groupComboBox->setItemDelegate(groupDelegate);
groupComboBox->setStyleSheet(m_stylesheet_QComboBox);
QVector<MTaskGroup> taskGroups = Database::getInstance()->taskGroups;
for (int i = 0; i < taskGroups.length(); ++i) {
if(i==0){
m_currentGroupId = taskGroups[i].id;
}
groupComboBox->addItem(taskGroups[i].name);
}
connect(groupComboBox, QOverload<int>::of(&QComboBox::currentIndexChanged),[this,taskGroups](int index){
m_currentGroupId = taskGroups[index].id;
});
gLayout->addWidget(groupNameLabel,1,0,Qt::AlignCenter);
gLayout->addWidget(groupComboBox,1,1);
boxLayout->addWidget(gWidget);
boxLayout->addWidget(new ComLineWidget(this));
// 第三行(底部菜单)
QWidget *bottomWidget = new QWidget(this);
bottomWidget->setFixedHeight(40);
QHBoxLayout *bottomHLayout = new QHBoxLayout(bottomWidget);
bottomHLayout->setContentsMargins(0,0,0,0);
bottomHLayout->setSpacing(0);
QPushButton *okBtn = new QPushButton(bottomWidget);
okBtn->setText("确定");
okBtn->setCursor(Qt::PointingHandCursor);
okBtn->setStyleSheet(m_stylesheet_QPushButton);
okBtn->setFixedSize(80,28);
connect(okBtn,&QPushButton::clicked,this,[this,nameLine](){
QString filename = nameLine->text().trimmed();
if(filename.length()>0){
MTask *task = new MTask();
task->groupId = m_currentGroupId;
if(task->fromFile(filename)){
task->defaultUserAgent = Database::getInstance()->getRandomUserAgent();
m_importSuccessTasks.append(task);// 导出成功的任务放入数组
QString msg;
bool state = Database::getInstance()->addTask(task,msg);
if(state==true){
ComMessageBox::success(this,msg);
this->close();
}else{
ComMessageBox::error(this,msg);
}
}else{
delete task;
ComMessageBox::error(this,"您导入的任务可能已损毁!");
}
}else{
ComMessageBox::error(this,"请选择任务!");
}
});
QPushButton *cancelBtn = new QPushButton(bottomWidget);
cancelBtn->setText("取消");
cancelBtn->setCursor(Qt::PointingHandCursor);
cancelBtn->setStyleSheet(m_stylesheet_QPushButton_hollow);
cancelBtn->setFixedSize(80,28);
connect(cancelBtn,&QPushButton::clicked,this,[this](){
this->close();
});
bottomHLayout->addStretch(10);
bottomHLayout->addWidget(okBtn,0,Qt::AlignRight);
bottomHLayout->addSpacing(10);
bottomHLayout->addWidget(cancelBtn,0,Qt::AlignRight);
bottomHLayout->addSpacing(20);
boxLayout->addWidget(bottomWidget);
}
TaskImport::~TaskImport(){
for (int i = 0; i < m_importSuccessTasks.length(); ++i) {
delete m_importSuccessTasks[i];
}
}
Loading...
举报
举报成功
我们将于2个工作日内通过站内信反馈结果给你!
请认真填写举报原因,尽可能描述详细。
请选择举报类型
取消
发送
误判申诉

此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。

如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。

取消
提交

简介

一个Qt开发的可以替代爬虫的网页数据采集软件,它最重要的特点就是,降低了采集网页数据的门槛,由至少必须掌握一门编程语言降低到只要会操作电脑即可。
取消

发行版

暂无发行版

贡献者

全部

近期动态

不能加载更多了
编辑仓库简介
简介内容
主页
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C++
1
https://gitee.com/coderanks/DS.git
git@gitee.com:coderanks/DS.git
coderanks
DS
DS
master
点此查找更多帮助

搜索帮助

评论
仓库举报
回到顶部
登录提示
该操作需登录 Gitee 帐号,请先登录后再操作。
立即登录
没有帐号,去注册

AltStyle によって変換されたページ (->オリジナル) /