Skip to content

Commit

Permalink
[*] 窗口按键
Browse files Browse the repository at this point in the history
  • Loading branch information
acgist committed Mar 5, 2024
1 parent 8aed4de commit 00ebb3c
Show file tree
Hide file tree
Showing 22 changed files with 192 additions and 123 deletions.
63 changes: 61 additions & 2 deletions boot/main/src/header/Window.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,10 +153,18 @@ class MainWindow : public LFRWindow {
virtual ~MainWindow();

public:
// ImageGC
// 音频风格迁移
void audioTs();
// 图片内容生成
void imageGc();
// ImageTS
// 图片风格迁移
void imageTs();
// 视频内容生成
void videoGc();
// 视频风格迁移
void videoTs();
// 诗词内容生成
void poetryGc();
// 关于
void about();

Expand Down Expand Up @@ -348,6 +356,19 @@ class AudioGCWindow : public ModelGCWindow {
* @see AudioTS
*/
class AudioTSWindow : public ModelTSWindow {

public:
/**
* @param width 窗口宽度
* @param height 窗口高度
* @param title 窗口名称
*/
AudioTSWindow(int width, int height, const char* title = "音频风格迁移");
virtual ~AudioTSWindow();

protected:
virtual void drawElement() override;

};

/**
Expand Down Expand Up @@ -397,6 +418,18 @@ class PoetryGCWindow : public ModelGCWindow {
// 自动标记:通过已有标记自动标记
Fl_Button* autoMarkPtr = nullptr;

public:
/**
* @param width 窗口宽度
* @param height 窗口高度
* @param title 窗口名称
*/
PoetryGCWindow(int width, int height, const char* title = "诗词内容生成");
virtual ~PoetryGCWindow();

protected:
virtual void drawElement() override;

};

/**
Expand All @@ -411,12 +444,38 @@ class PoetryTSWindow : public ModelTSWindow {
* @see VideoGC
*/
class VideoGCWindow : public ModelGCWindow {

public:
/**
* @param width 窗口宽度
* @param height 窗口高度
* @param title 窗口名称
*/
VideoGCWindow(int width, int height, const char* title = "视频内容生成");
virtual ~VideoGCWindow();

protected:
virtual void drawElement() override;

};

/**
* @see VideoTS
*/
class VideoTSWindow : public ModelTSWindow {

public:
/**
* @param width 窗口宽度
* @param height 窗口高度
* @param title 窗口名称
*/
VideoTSWindow(int width, int height, const char* title = "视频风格迁移");
virtual ~VideoTSWindow();

protected:
virtual void drawElement() override;

};

/**
Expand Down
8 changes: 8 additions & 0 deletions boot/main/src/source/MainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,14 +97,22 @@ void lifuren::MainWindow::drawElement() {
this->aboutButtonPtr = new Fl_Button((this->w() - 80) / 4 * 3 + 60, this->h() - 40, (this->w() - 80) / 4, 30, "关于");
this->resizable(this);
// 绑定事件
LFR_BUTTON_CALLBACK_FUNCTION_BINDER(audioTsPtr, audioTs);
LFR_BUTTON_CALLBACK_FUNCTION_BINDER(imageGcPtr, imageGc);
LFR_BUTTON_CALLBACK_FUNCTION_BINDER(imageTsPtr, imageTs);
LFR_BUTTON_CALLBACK_FUNCTION_BINDER(videoGcPtr, videoGc);
LFR_BUTTON_CALLBACK_FUNCTION_BINDER(videoTsPtr, videoTs);
LFR_BUTTON_CALLBACK_FUNCTION_BINDER(poetryGcPtr, poetryGc);
LFR_BUTTON_CALLBACK_FUNCTION_BINDER(aboutButtonPtr, about);
this->reloadButtonPtr->callback(reload, this);
}

LFR_BUTTON_CALLBACK_FUNCTION(audioTs, AudioTSWindow, audioTsWindowPtr, 1200, 800);
LFR_BUTTON_CALLBACK_FUNCTION(imageGc, ImageGCWindow, imageGcWindowPtr, 1200, 800);
LFR_BUTTON_CALLBACK_FUNCTION(imageTs, ImageTSWindow, imageTsWindowPtr, 1200, 800);
LFR_BUTTON_CALLBACK_FUNCTION(videoGc, VideoGCWindow, videoGcWindowPtr, 1200, 800);
LFR_BUTTON_CALLBACK_FUNCTION(videoTs, VideoTSWindow, videoTsWindowPtr, 1200, 800);
LFR_BUTTON_CALLBACK_FUNCTION(poetryGc, PoetryGCWindow, poetryGcWindowPtr, 1200, 800);
LFR_BUTTON_CALLBACK_FUNCTION(about, AboutWindow, aboutWindowPtr, 512, 256);

static void disable(Fl_Widget* widgetPtr, void* voidPtr) {
Expand Down
6 changes: 1 addition & 5 deletions boot/main/src/source/application/AudioGCWindow.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1 @@
/**
* 图片内容生成
*
* @author acgist
*/
#include "../../header/Window.hpp"
15 changes: 10 additions & 5 deletions boot/main/src/source/application/AudioTSWindow.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
/**
* 图片风格迁移
*
* @author acgist
*/
#include "../../header/Window.hpp"

lifuren::AudioTSWindow::AudioTSWindow(int width, int height, const char* title) : ModelTSWindow(width, height, title) {
}

lifuren::AudioTSWindow::~AudioTSWindow() {
}

void lifuren::AudioTSWindow::drawElement() {
}
16 changes: 11 additions & 5 deletions boot/main/src/source/application/PoetryGCWindow.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
/**
* 诗词内容生成
*
* @author acgist
*/
#include "../../header/Window.hpp"

lifuren::PoetryGCWindow::PoetryGCWindow(int width, int height, const char* title) : ModelGCWindow(width, height, title) {
}

lifuren::PoetryGCWindow::~PoetryGCWindow() {
LFR_DELETE_THIS_PTR(autoMarkPtr);
}

void lifuren::PoetryGCWindow::drawElement() {
}
6 changes: 1 addition & 5 deletions boot/main/src/source/application/PoetryTSWindow.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1 @@
/**
* 诗词风格迁移
*
* @author acgist
*/
#include "../../header/Window.hpp"
15 changes: 10 additions & 5 deletions boot/main/src/source/application/VideoGCWindow.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
/**
* 视频内容生成
*
* @author acgist
*/
#include "../../header/Window.hpp"

lifuren::VideoGCWindow::VideoGCWindow(int width, int height, const char* title) : ModelGCWindow(width, height, title) {
}

lifuren::VideoGCWindow::~VideoGCWindow() {
}

void lifuren::VideoGCWindow::drawElement() {
}
15 changes: 10 additions & 5 deletions boot/main/src/source/application/VideoTSWindow.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
/**
* 视频风格迁移
*
* @author acgist
*/
#include "../../header/Window.hpp"

lifuren::VideoTSWindow::VideoTSWindow(int width, int height, const char* title) : ModelTSWindow(width, height, title) {
}

lifuren::VideoTSWindow::~VideoTSWindow() {
}

void lifuren::VideoTSWindow::drawElement() {
}
45 changes: 2 additions & 43 deletions core/src/header/AudioGC.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,48 +2,7 @@
* 音频内容生成
*
* @author acgist
*
* @deprecated 不会实现
*/
#pragma once

#include "Model.hpp"

namespace lifuren {

/**
* 音频生成预测设置
*/
class AudioGCPredictSetting : public lifuren::PredictSetting {
};

/**
* 音频生成训练设置
*/
class AudioGCTrainingSetting : public lifuren::TrainingSetting {
};

/**
* 音频生成模型
*/
class AudioGCModel : public LFRModel<AudioGCPredictSetting, AudioGCTrainingSetting> {

public:
AudioGCModel();
~AudioGCModel();
/**
* @param setting 基本配置
*/
AudioGCModel(lifuren::Setting& setting);

public:
/**
* @param setting 预测配置
*/
void predict(lifuren::AudioGCPredictSetting& setting) override;
/**
* @param setting 训练配置
*/
void training(lifuren::AudioGCTrainingSetting& setting) override;

};

}
22 changes: 10 additions & 12 deletions core/src/header/Model.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,14 @@ namespace lifuren {
/**
* 李夫人模型
*
* @param P 预测配置
* @param T 训练配置
* @param M 模型配置
*
* @author acgist
*/
template <class P, class T>
template <typename M>
class LFRModel {

static_assert(std::is_base_of_v<lifuren::PredictSetting, P>, "必须继承训练配置");
static_assert(std::is_base_of_v<lifuren::TrainingSetting, T>, "必须继承预测配置");
static_assert(std::is_base_of_v<lifuren::ModelSetting, M>, "必须继承模型配置");

public:
// 基本配置
Expand All @@ -35,7 +33,7 @@ static_assert(std::is_base_of_v<lifuren::TrainingSetting, T>, "必须继承预
/**
* @param setting 基本配置
*/
LFRModel(lifuren::Setting& setting);
LFRModel(const lifuren::Setting& setting);

public:
/**
Expand All @@ -47,17 +45,17 @@ static_assert(std::is_base_of_v<lifuren::TrainingSetting, T>, "必须继承预
*/
virtual void load();
/**
* 模型预测
* 训练模型
*
* @param 预测设置
* @param setting 模型设置
*/
virtual void predict(P& setting) = 0;
virtual void train(const M& setting) = 0;
/**
* 训练模型
* 模型预测
*
* @param setting 训练设置
* @param 模型设置
*/
virtual void training(T& setting) = 0;
virtual void predict(const M& setting) = 0;

};

Expand Down
36 changes: 35 additions & 1 deletion core/src/header/PoetryGC.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,38 @@
*/
#pragma once

#include "Model.hpp"
#include "Model.hpp"

namespace lifuren {

/**
* 音频生成模型设置
*/
class AudioGCModelSetting : public lifuren::ModelSetting {
};

/**
* 音频生成模型
*/
class AudioGCModel : public LFRModel<AudioGCModelSetting> {

public:
/**
* @param setting 基本配置
*/
AudioGCModel(const lifuren::Setting& setting);
virtual ~AudioGCModel();

public:
/**
* @param setting 模型配置
*/
void train(const lifuren::AudioGCModelSetting& setting) override;
/**
* @param setting 模型配置
*/
void predict(const lifuren::AudioGCModelSetting& setting) override;

};

}
4 changes: 2 additions & 2 deletions core/src/header/PoetryTS.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* 诗词风格迁移
*
* @author acgist
*
* @deprecated 不会实现
*/
#pragma once

#include "Model.hpp"
10 changes: 2 additions & 8 deletions core/src/header/Setting.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,9 @@ class Setting {
};

/**
* 预测设置
* 模型设置
*/
class PredictSetting {
};

/**
* 训练设置
*/
class TrainingSetting {
class ModelSetting {
};

}
Loading

0 comments on commit 00ebb3c

Please sign in to comment.