jiubingdao
2025-07-30 923b017b4cafdd403b4dede621edfc8da925ec00
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#include "vcsmainwindow.h"
#include "ui_vcsmainwindow.h"
 
#include <QFileInfo>
#include <QMessageBox>
#include "struct_data.h"
std::mutex _mutex;
std::condition_variable _conv;
int g_flag = 1;
VCSMainWindow::VCSMainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::VCSMainWindow)
{
    ui->setupUi(this);
    m_addFile = new AddFile(this);
    m_release = new Release(this);
    m_rollBack = new RollBack(this);
    m_readLog = new ReadLog(this);
    m_upLoad = new UpLoador(this);
    m_msg = new QMessageBox(this);
 
    ui->stackedWidget->addWidget(m_addFile);
    ui->stackedWidget->addWidget(m_release);
    ui->stackedWidget->addWidget(m_rollBack);
    ui->stackedWidget->addWidget(m_readLog);
    ui->stackedWidget->setCurrentWidget(m_addFile);
 
 
    connect(m_addFile,SIGNAL(addFileSignal(std::shared_ptr<char>,int)),this,SLOT(addFileSlot(std::shared_ptr<char>,int)));
    connect(this,SIGNAL(releaseSignal()),m_release,SLOT(releaseSlot()));
    connect(m_addFile,SIGNAL(addFileMsg(QString)),this,SLOT(msgSlot(QString)));
    connect(m_release,SIGNAL(releaseSignal(std::shared_ptr<char>,int)),this,SLOT(addFileSlot(std::shared_ptr<char>,int)));
}
 
VCSMainWindow::~VCSMainWindow()
{
    delete ui;
}
 
void VCSMainWindow::on_pushButton_clicked()
{
    ui->stackedWidget->setCurrentWidget(m_addFile);
}
 
// 上传
void VCSMainWindow::on_pushButton_2_clicked()
{
    ui->stackedWidget->setCurrentWidget(m_release);
    emit releaseSignal();
}
 
void VCSMainWindow::on_pushButton_4_clicked()
{
    ui->stackedWidget->setCurrentWidget(m_rollBack);
}
 
void VCSMainWindow::on_pushButton_3_clicked()
{
    ui->stackedWidget->setCurrentWidget(m_readLog);
}
 
void VCSMainWindow::addFileSlot(std::shared_ptr<char> buf, int len)
{
        if (!buf || len <= 0) {
 
            return;
        }
        int ret = m_upLoad->upfile(buf, len);  // 处理数据
        if(ret < len){
            qDebug()<<"传输有问题";
        }
 
}
 
void VCSMainWindow::msgSlot(QString msg)
{
    m_msg->information(this,"提示",msg);
}