Kind-of worked on the R-Tree; not really enough time to do much.
[aesalon.git] / src / visualizer / RootWindow.cpp
blobbda232d11e89159dbeda3b3bc8637a15ceb97f03
1 /** Aesalon, a tool to visualize program behaviour in real time.
2 Copyright (C) 2009-2011, Aesalon development team.
4 Aesalon is distributed under the terms of the GNU GPLv3. See
5 the included file LICENSE for more information.
7 @file src/visualizer/RootWindow.cpp
8 */
10 #include <QMenu>
11 #include <QMenuBar>
12 #include <QApplication>
13 #include <QLabel>
14 #include <QHBoxLayout>
15 #include <QVBoxLayout>
16 #include <QPixmap>
17 #include <QPushButton>
18 #include <QMdiSubWindow>
20 #include "visualizer/RootWindow.h"
21 #include "visualizer/InputManagerWidget.h"
22 #include "visualizer/ArtisanManagerWidget.h"
23 #include "util/MessageSystem.h"
25 namespace Visualizer {
27 RootWindow::RootWindow() {
28 setWindowTitle(tr("Aesalon Visualizer"));
29 setWindowIcon(QIcon(":/icon.png"));
31 m_mdiArea = new QMdiArea();
32 //m_mdiArea->setViewMode(QMdiArea::TabbedView);
33 setCentralWidget(m_mdiArea);
35 m_inputManager = new InputManager();
37 createAboutBox();
39 QMenu *aesalonMenu = new QMenu(tr("&Aesalon"));
40 aesalonMenu->addAction(tr("&Close"), this, SLOT(close()));
41 aesalonMenu->addAction(tr("&Quit"), qApp, SLOT(closeAllWindows()));
42 menuBar()->addMenu(aesalonMenu);
44 QMenu *windowMenu = new QMenu(tr("&Window"));
45 windowMenu->addAction(tr("Create &input manager"), this, SLOT(createInputManager()));
46 menuBar()->addMenu(windowMenu);
48 windowMenu->addAction(tr("Create &artisan manager"), this, SLOT(createArtisanManager()));
49 menuBar()->addMenu(windowMenu);
51 QMenu *helpMenu = new QMenu(tr("&Help"));
52 helpMenu->addAction(tr("&About . . ."), m_aboutAesalon, SLOT(show()));
53 helpMenu->addAction(tr("About &Qt . . ."), qApp, SLOT(aboutQt()));
54 menuBar()->addMenu(helpMenu);
56 createInputManager();
57 createArtisanManager();
60 RootWindow::~RootWindow() {
64 void RootWindow::createInputManager() {
65 InputManagerWidget *imw = new InputManagerWidget(m_inputManager);
66 QMdiSubWindow *msw = m_mdiArea->addSubWindow(imw);
67 msw->setAttribute(Qt::WA_DeleteOnClose);
68 msw->setWindowTitle(tr("Input manager"));
69 msw->show();
72 void RootWindow::createArtisanManager() {
73 ArtisanManagerWidget *amw = new ArtisanManagerWidget(m_inputManager->artisanManager());
74 connect(amw, SIGNAL(newViewport(Artisan::Viewport *)), this, SLOT(addSubwindow(Artisan::Viewport *)));
75 QMdiSubWindow *msw = m_mdiArea->addSubWindow(amw);
76 msw->setAttribute(Qt::WA_DeleteOnClose);
77 msw->setWindowTitle(tr("Artisan manager"));
78 msw->show();
81 void RootWindow::addSubwindow(Artisan::Viewport *viewport) {
82 QMdiSubWindow *msw = m_mdiArea->addSubWindow(viewport);
83 msw->setAttribute(Qt::WA_DeleteOnClose);
84 msw->setWindowTitle(viewport->windowTitle());
85 msw->show();
88 void RootWindow::createAboutBox() {
89 m_aboutAesalon = new QWidget();
91 QBoxLayout *layout = new QHBoxLayout();
92 m_aboutAesalon->setLayout(layout);
94 QLabel *iconLabel = new QLabel();
95 iconLabel->setPixmap(QPixmap(":/icon.png"));
96 layout->addWidget(iconLabel);
98 QVBoxLayout *rightLayout = new QVBoxLayout();
99 QLabel *aboutText = new QLabel();
100 aboutText->setText(
101 "Aesalon: a tool to visualize memory in real-time.<br />"
102 "Copyright (C) 2009-2011, Aesalon Development Team. <br />"
103 "Aesalon is released under the terms of the GNU GPLv3. "
104 "See the included file LICENSE for details."
105 "<hr />"
108 rightLayout->addWidget(aboutText);
110 QPushButton *okay = new QPushButton(tr("Ok"));
111 rightLayout->addWidget(okay);
112 connect(okay, SIGNAL(clicked(bool)), m_aboutAesalon, SLOT(hide()));
114 layout->addLayout(rightLayout);
117 } // namespace Visualizer