stuff-from-scratch/apps/sample-gui/MediaTool.cpp
2022-11-17 08:39:49 +00:00

59 lines
1.8 KiB
C++

#include "MediaTool.h"
#include "TextEditorView.h"
#include "AudioEditorView.h"
#include "ImageEditorView.h"
#include "WebClientView.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);
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 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));
}