stuff-from-scratch/apps/sample-gui/MediaTool.cpp

61 lines
1.9 KiB
C++
Raw Normal View History

2022-11-11 11:48:42 +00:00
#include "MediaTool.h"
#include "TextEditorView.h"
#include "AudioEditorView.h"
#include "ImageEditorView.h"
#include "WebClientView.h"
#include "TabbedPanelWidget.h"
#include "TopBar.h"
2022-11-16 15:06:08 +00:00
#include "TextNode.h"
2022-11-11 11:48:42 +00:00
#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()
{
2022-11-14 11:19:51 +00:00
auto mainWindow = mDesktopManager->getWindowManager()->getMainWindow();
mainWindow->setSize(800, 600);
2022-11-17 11:28:18 +00:00
mainWindow->setTitle("Media Tool");
2022-11-11 11:48:42 +00:00
auto tabbedPanel = TabbedPanelWidget::Create();
auto textEditor = TextEditorView::Create();
2022-11-16 17:27:19 +00:00
auto path = mMainApplication->getCommandLineArgs()->getLaunchPath();
2022-11-11 11:48:42 +00:00
path /= "out.txt";
2022-11-17 08:39:49 +00:00
textEditor->setName("TextEditor");
2022-11-11 11:48:42 +00:00
textEditor->GetController()->SetSavePath(path);
textEditor->GetController()->SetLoadPath(path);
textEditor->Initialize();
2022-11-16 17:27:19 +00:00
tabbedPanel->addPanel(std::move(textEditor), "Text Editor");
2022-11-11 11:48:42 +00:00
auto audioEditor = AudioEditorView::Create();
2022-11-17 08:39:49 +00:00
audioEditor->setName("audioEditor");
tabbedPanel->addPanel(std::move(audioEditor), "audio Editor");
2022-11-11 11:48:42 +00:00
auto imageEditor = ImageEditorView::Create();
2022-11-17 08:39:49 +00:00
imageEditor->setName("imageEditor");
2022-11-16 17:27:19 +00:00
tabbedPanel->addPanel(std::move(imageEditor), "Image Editor");
2022-11-11 11:48:42 +00:00
auto webClient = WebClientView::Create();
2022-11-17 08:39:49 +00:00
webClient->setName("webClient");
2022-11-16 17:27:19 +00:00
tabbedPanel->addPanel(std::move(webClient), "Web Client");
2022-11-11 11:48:42 +00:00
auto topBar = TopBar::Create();
auto statusBar = StatusBar::Create();
2022-11-16 17:27:19 +00:00
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);
2022-11-11 14:22:31 +00:00
2022-11-14 11:19:51 +00:00
mainWindow->setWidget(std::move(horizontal_spacer));
2022-11-11 11:48:42 +00:00
}