软件使用
使用前请下载好git工具
项目介绍
温馨提示:本地搭建完网站框架后,每次新建文章的写作体验较差,可以看看我的另一个 hugo 博客自动化写作工具
src目录:存放图形化项目的源代码,使用 Qt6 可直接启动 QHugoInit 项目。
bin目录:存放项目的可执行二进制文件。
- exec_code.bat:用于写入代码执行脚本
- hugo.exe:构建博客的基石
- QHugoInit.exe:软件启动程序
- log.txt:整个程序执行的日志
项目关键源码
通过多线程防止下载步骤把画面给阻塞
//TODO 简单封装一个用于多线程通信的类
class run_thread:public QThread{
public:
run_thread() = delete;
run_thread(const std::function<void()>&Runnable,QObject* parent = nullptr):m_task(nullptr){
m_task = Runnable;
}
void run()override{
if(m_task!=nullptr);
m_task();
}
private:
std::function<void()>m_task;
};
通过文件io控制命令行的代码执行来执行对应的每一步
void MainWindow::on_right_Btn_clicked()
{
auto path = ui->input->text();
if(!QDir(path).exists()||path.isEmpty()){
QMessageBox::warning(nullptr,"提示","文件夹路径不存在");
return;
}
ui->w2->setVisible(fals