SkillsPanel and TaskWorkspacePanel were two copies of the same browser-plus- editor panel. Both are now the shared DocumentFolderPanel: SkillsPanel only adds createSkill, and TaskWorkspacePanel only adds picking a task's workspace directory (the browser/editor open and save logic lives in the component).
59 lines
1.5 KiB
C++
59 lines
1.5 KiB
C++
#pragma once
|
|
|
|
#include "FileBrowser.hpp"
|
|
#include "Label.hpp"
|
|
#include "MarkdownEditor.hpp"
|
|
#include "PageStack.hpp"
|
|
#include "DocumentFolderPanel.hpp"
|
|
#include "TaskBoard.hpp"
|
|
#include "TaskHeader.hpp"
|
|
#include "TaskStore.hpp"
|
|
|
|
#include <functional>
|
|
#include <optional>
|
|
#include <string>
|
|
#include <utility>
|
|
|
|
namespace tp::taskboard {
|
|
|
|
class TaskDescriptionPanel : public ui::Widget {
|
|
public:
|
|
explicit TaskDescriptionPanel(TaskBoard& board);
|
|
|
|
void showTask(std::optional<ui::NodeId> id);
|
|
[[nodiscard]] std::optional<ui::NodeId> shownTask() const { return mShown; }
|
|
|
|
ui::Label hint{ "Open a task to see and edit its description." };
|
|
TaskHeader header;
|
|
ui::MarkdownEditor editor;
|
|
|
|
void setOnChanged(std::function<void()> callback);
|
|
void setOnEditingChanged(EditingCallback callback);
|
|
|
|
private:
|
|
void buildLayout();
|
|
void bindEditors();
|
|
void change(const std::function<void(Task&)>& edit);
|
|
void reportEditing(TaskField field, bool editing);
|
|
void refreshFields(const Task& task);
|
|
|
|
TaskBoard& mBoard;
|
|
std::optional<ui::NodeId> mShown;
|
|
bool mLoading = false;
|
|
std::function<void()> mOnChanged;
|
|
EditingCallback mOnEditingChanged;
|
|
};
|
|
|
|
class TaskWorkspacePanel : public ui::DocumentFolderPanel {
|
|
public:
|
|
explicit TaskWorkspacePanel(TaskBoard& board, ui::FileSystem& files = ui::FileSystem::local());
|
|
|
|
void showTask(std::optional<ui::NodeId> id);
|
|
void showWorkspace(const std::string& workspace);
|
|
[[nodiscard]] const std::string& workspace() const { return mWorkspace; }
|
|
|
|
private:
|
|
TaskBoard& mBoard;
|
|
std::string mWorkspace;
|
|
};
|
|
}
|