62 lines
1.7 KiB
C++
62 lines
1.7 KiB
C++
#ifndef MAINWIDGET_H
|
|
#define MAINWIDGET_H
|
|
|
|
#include <QDir>
|
|
#include <QFileDialog>
|
|
#include <QLineEdit>
|
|
#include <QMessageBox>
|
|
#include <QWidget>
|
|
#include <filesystem>
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
namespace fs = std::filesystem;
|
|
|
|
QT_BEGIN_NAMESPACE
|
|
namespace Ui {
|
|
class MainWidget;
|
|
}
|
|
QT_END_NAMESPACE
|
|
|
|
class MainWidget : public QWidget
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
MainWidget(QWidget* parent = nullptr);
|
|
~MainWidget();
|
|
|
|
private:
|
|
void connect_operator();
|
|
void control_init();
|
|
void add_env_btn();
|
|
void del_env_btn();
|
|
void generate();
|
|
void simple_log(const QString& info, bool enter = true);
|
|
// 将某个文件夹拷贝到制定目录下
|
|
bool copy_dir(const std::string& source_dir, const std::string& des_dir);
|
|
// 将二进制文件安装到菜单栏
|
|
void install_bin2menu();
|
|
|
|
private:
|
|
std::vector<std::string> get_depend_on(const std::string& name, const std::vector<std::string>& env);
|
|
std::list<std::string> handle_result(const std::vector<std::string>& vec);
|
|
|
|
public:
|
|
static QString SelectDirectory(QWidget* parent, QLineEdit* pEdit, const QString& pre_path = "");
|
|
static QString SelectFile(QWidget* parent, QLineEdit* pEdit, const QString& info, const QString& filter);
|
|
static bool isOk(QWidget* parent, const QString& title, const QString& content);
|
|
static void message(QWidget* parent, const QString& content);
|
|
static void cmd_exec(const std::string& cmd);
|
|
static bool add_run_sh(const std::string& out_dir, const std::string& exe_name, const std::vector<std::string>& exports);
|
|
|
|
private:
|
|
Ui::MainWidget* ui;
|
|
|
|
private:
|
|
QString binary_{};
|
|
std::vector<std::string> envs_{};
|
|
std::vector<std::string> sos_{};
|
|
};
|
|
#endif // MAINWIDGET_H
|