stuff-from-scratch/apps/sample-gui/MediaTool.cpp
2022-11-18 17:05:33 +00:00

71 lines
2.2 KiB
C++

#include "MediaTool.h"
#include "TextEditorView.h"
#include "AudioEditorView.h"
#include "ImageEditorView.h"
#include "WebClientView.h"
#include "CanvasView.h"
#include "MeshViewerView.h"
#include "TabbedPanelWidget.h"
#include "TopBar.h"
#include "TextNode.h"
#include "StatusBar.h"
#include "HorizontalSpacer.h"
#include "DesktopManager.h"
#include "MainApplication.h"
MediaTool::MediaTool(std::unique_ptr<CommandLineArgs> args)
: GuiApplication(std::move(args))
{
}
void MediaTool::initializeViews()
{
auto mainWindow = mDesktopManager->getWindowManager()->getMainWindow();
mainWindow->setSize(800, 600);
mainWindow->setTitle("Media Tool");
auto tabbedPanel = TabbedPanelWidget::Create();
auto textEditor = TextEditorView::Create();
auto path = mMainApplication->getCommandLineArgs()->getLaunchPath();
path /= "out.txt";
textEditor->setName("TextEditor");
textEditor->getController()->SetSavePath(path);
textEditor->getController()->SetLoadPath(path);
textEditor->initialize();
tabbedPanel->addPanel(std::move(textEditor), "Text Editor");
auto audioEditor = AudioEditorView::Create();
audioEditor->setName("audioEditor");
tabbedPanel->addPanel(std::move(audioEditor), "audio Editor");
auto imageEditor = ImageEditorView::Create();
imageEditor->setName("imageEditor");
tabbedPanel->addPanel(std::move(imageEditor), "Image Editor");
auto webClient = WebClientView::Create();
webClient->setName("webClient");
tabbedPanel->addPanel(std::move(webClient), "Web Client");
auto canvas = CanvasView::Create();
canvas->setName("CanvasView");
tabbedPanel->addPanel(std::move(canvas), "Canvas");
auto mesh = MeshViewerView::Create();
mesh->setName("MeshViewer");
tabbedPanel->addPanel(std::move(mesh), "Mesh Viewer");
auto topBar = TopBar::Create();
auto statusBar = StatusBar::Create();
auto horizontal_spacer = HorizontalSpacer::Create();
horizontal_spacer->addWidgetWithScale(std::move(topBar), 1);
horizontal_spacer->addWidgetWithScale(std::move(tabbedPanel), 20);
horizontal_spacer->addWidgetWithScale(std::move(statusBar), 1);
mainWindow->setWidget(std::move(horizontal_spacer));
}