#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);
|
}
|