Done ! Testing and not working :)
[photoenhancer] / src / app / windows / appwindow.cpp
1 #include "appwindow.h"
2 #include "workspace.h"
3 #include <QDockWidget>
4 #include <QToolBar>
5 #include <QMenuBar>
6
7
8 AppWindow::AppWindow(QWidget *parent):QMainWindow(parent)
9 {
10     mWorkspace=new Workspace();
11     setCentralWidget(mWorkspace);
12     createActions();
13     createMenus();
14     createToolBars();
15     createStatusBar();
16     readSettings();
17 }
18
19  void AppWindow::newFile()
20  {
21
22  }
23
24  void AppWindow::open()
25  {
26
27  }
28
29  bool AppWindow::save()
30  {
31
32  }
33
34  bool AppWindow::saveAs()
35  {
36
37  }
38
39  void AppWindow::createActions()
40  {
41      newAct = new QAction(QIcon(":/images/new.png"), tr("&New"), this);
42      newAct->setShortcuts(QKeySequence::New);
43      newAct->setStatusTip(tr("Create a new file"));
44      connect(newAct, SIGNAL(triggered()), this, SLOT(newFile()));
45
46      openAct = new QAction(QIcon(":/images/open.png"), tr("&Open..."), this);
47      openAct->setShortcuts(QKeySequence::Open);
48      openAct->setStatusTip(tr("Open an existing file"));
49      connect(openAct, SIGNAL(triggered()), this, SLOT(open()));
50
51      saveAct = new QAction(QIcon(":/images/save.png"), tr("&Save"), this);
52      saveAct->setShortcuts(QKeySequence::Save);
53      saveAct->setStatusTip(tr("Save the document to disk"));
54      connect(saveAct, SIGNAL(triggered()), this, SLOT(save()));
55
56      saveAsAct = new QAction(tr("Save &As..."), this);
57      saveAsAct->setShortcuts(QKeySequence::SaveAs);
58      saveAsAct->setStatusTip(tr("Save the document under a new name"));
59      connect(saveAsAct, SIGNAL(triggered()), this, SLOT(saveAs()));
60
61      exitAct = new QAction(tr("E&xit"), this);
62      exitAct->setShortcuts(QKeySequence::Quit);
63      exitAct->setStatusTip(tr("Exit the application"));
64      connect(exitAct, SIGNAL(triggered()), this, SLOT(close()));
65
66
67      menuBar()->addSeparator();
68
69  }
70
71  void AppWindow::createToolBars()
72  {
73      fileToolBar = addToolBar(tr("File"));
74      fileToolBar->addAction(newAct);
75      fileToolBar->addAction(openAct);
76      fileToolBar->addAction(saveAct);
77
78
79  }
80
81  void AppWindow::createStatusBar()
82  {
83      statusBar()->showMessage(tr("Ready"));
84  }
85
86  void AppWindow::readSettings()
87  {
88
89  }
90
91  void AppWindow::writeSettings()
92  {
93
94  }
95
96  bool AppWindow::maybeSave()
97  {
98
99      return true;
100  }
101
102
103  void AppWindow::createMenus()
104  {
105     fileMenu = menuBar()->addMenu(tr("&File"));
106     fileMenu->addAction(newAct);
107     fileMenu->addAction(openAct);
108     fileMenu->addAction(saveAct);
109     fileMenu->addAction(saveAsAct);
110     fileMenu->addSeparator();
111     fileMenu->addAction(exitAct);
112  }