summaryrefslogtreecommitdiffstats
path: root/examples/animation/stickman/editor/mainwindow.cpp
blob: 158c9b78d9caa08bc382a424e3561d33f29c113d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#include "mainwindow.h"
#include "animationdialog.h"
#include "stickman.h"

#include <QMenuBar>
#include <QApplication>

MainWindow::MainWindow(StickMan *stickMan)
{
    initActions(stickMan);
}

MainWindow::~MainWindow()
{
}

void MainWindow::initActions(StickMan *stickMan)
{
    AnimationDialog *dialog = new AnimationDialog(stickMan, this);
    dialog->show();

    QMenu *fileMenu = menuBar()->addMenu("&File");
    QAction *loadAction = fileMenu->addAction("&Open");
    QAction *saveAction = fileMenu->addAction("&Save");
    QAction *exitAction = fileMenu->addAction("E&xit");

    QMenu *animationMenu = menuBar()->addMenu("&Animation");
    QAction *newAnimationAction = animationMenu->addAction("&New animation");

    connect(loadAction, SIGNAL(triggered()), dialog, SLOT(loadAnimation()));
    connect(saveAction, SIGNAL(triggered()), dialog, SLOT(saveAnimation()));
    connect(exitAction, SIGNAL(triggered()), QApplication::instance(), SLOT(quit()));
    connect(newAnimationAction, SIGNAL(triggered()), dialog, SLOT(newAnimation()));

}