Browse Source

Create Help menu and stub for about box.

Neal Wilson 12 years ago
parent
commit
3c9896c541
9 changed files with 2216 additions and 1992 deletions
  1. 30
    26
      src/Typica.pro
  2. 20
    0
      src/abouttypica.cpp
  3. 18
    0
      src/abouttypica.h
  4. 43
    0
      src/abouttypica.w
  5. 35
    0
      src/helpmenu.cpp
  6. 20
    0
      src/helpmenu.h
  7. 67
    0
      src/helpmenu.w
  8. 1970
    1958
      src/typica.cpp
  9. 13
    8
      src/typica.w

+ 30
- 26
src/Typica.pro View File

@@ -1,26 +1,30 @@
1
-######################################################################
2
-# Automatically generated by qmake (2.01a) Sat May 23 23:41:13 2009
3
-######################################################################
4
-
5
-QT += script
6
-QT += xml
7
-QT += sql
8
-QT += xmlpatterns
9
-QT += scripttools
10
-QT += webkit
11
-
12
-include(3rdparty/qextserialport/src/qextserialport.pri)
13
-
14
-TEMPLATE = app
15
-TARGET = 
16
-DEPENDPATH += .
17
-
18
-# Input
19
-HEADERS += moc_typica.cpp
20
-SOURCES += typica.cpp
21
-
22
-RESOURCES += \
23
-    resources.qrc
24
-
25
-RC_FILE = typica.rc
26
-ICON = resources/icons/appicons/logo.icns
1
+######################################################################
2
+# Automatically generated by qmake (2.01a) Sat May 23 23:41:13 2009
3
+######################################################################
4
+
5
+QT += script
6
+QT += xml
7
+QT += sql
8
+QT += xmlpatterns
9
+QT += scripttools
10
+QT += webkit
11
+
12
+include(3rdparty/qextserialport/src/qextserialport.pri)
13
+
14
+TEMPLATE = app
15
+TARGET = 
16
+DEPENDPATH += .
17
+
18
+# Input
19
+HEADERS += moc_typica.cpp \
20
+    helpmenu.h \
21
+    abouttypica.h
22
+SOURCES += typica.cpp \
23
+    helpmenu.cpp \
24
+    abouttypica.cpp
25
+
26
+RESOURCES += \
27
+    resources.qrc
28
+
29
+RC_FILE = typica.rc
30
+ICON = resources/icons/appicons/logo.icns

+ 20
- 0
src/abouttypica.cpp View File

@@ -0,0 +1,20 @@
1
+/*223:*/
2
+#line 29 "./abouttypica.w"
3
+
4
+#include "abouttypica.h"
5
+
6
+/*224:*/
7
+#line 38 "./abouttypica.w"
8
+
9
+AboutTypica::AboutTypica():QMainWindow(NULL)
10
+{
11
+
12
+}
13
+
14
+#line 5650 "./typica.w"
15
+
16
+/*:224*/
17
+#line 32 "./abouttypica.w"
18
+
19
+
20
+/*:223*/

+ 18
- 0
src/abouttypica.h View File

@@ -0,0 +1,18 @@
1
+/*222:*/
2
+#line 12 "./abouttypica.w"
3
+
4
+#include <QMainWindow> 
5
+
6
+#ifndef AboutTypicaHeader
7
+#define AboutTypicaHeader
8
+
9
+class AboutTypica:public QMainWindow
10
+{
11
+Q_OBJECT
12
+public:
13
+AboutTypica();
14
+};
15
+
16
+#endif
17
+
18
+/*:222*/

+ 43
- 0
src/abouttypica.w View File

@@ -0,0 +1,43 @@
1
+@** A Window for Displaying Information About Typica.
2
+
3
+\noindent The About window for an application typically displays a few pieces
4
+of information: The application logo, name, and version number, copyright and
5
+license information, and other assorted information. In Typica this also
6
+includes a list of the people and companies that have provided financial
7
+assistance toward the ongoing development of the software and information that
8
+others can use to help in this way. Some of this information would benefit
9
+from existing as a link which can open an external application such as a web
10
+browser or email client.
11
+
12
+@(abouttypica.h@>=
13
+#include <QMainWindow>
14
+
15
+#ifndef AboutTypicaHeader
16
+#define AboutTypicaHeader
17
+
18
+class AboutTypica : public QMainWindow
19
+{
20
+	Q_OBJECT
21
+	public:
22
+		AboutTypica();
23
+};
24
+
25
+#endif
26
+
27
+@ The implementation is in a separate file.
28
+
29
+@(abouttypica.cpp@>=
30
+#include "abouttypica.h"
31
+
32
+@<AboutTypica implementation@>@;
33
+
34
+@ The information provided here comes from a set of HTML documents stored as
35
+compiled resources and presented in a set of |QWebView| instances accessible
36
+through a set of tabs.
37
+
38
+@<AboutTypica implementation@>=
39
+AboutTypica::AboutTypica() : QMainWindow(NULL)
40
+{
41
+
42
+}
43
+

+ 35
- 0
src/helpmenu.cpp View File

@@ -0,0 +1,35 @@
1
+/*167:*/
2
+#line 35 "./helpmenu.w"
3
+
4
+#include "helpmenu.h"
5
+#include "abouttypica.h"
6
+
7
+/*168:*/
8
+#line 47 "./helpmenu.w"
9
+
10
+HelpMenu::HelpMenu():QMenu()
11
+{
12
+setObjectName("helpMenu");
13
+setTitle(tr("Help"));
14
+QAction*aboutTypicaAction= new QAction(tr("About Typica"),this);
15
+aboutTypicaAction->setObjectName("aboutTypicaAction");
16
+addAction(aboutTypicaAction);
17
+connect(aboutTypicaAction,SIGNAL(triggered()),this,SLOT(displayAboutTypica()));
18
+}
19
+
20
+/*:168*//*169:*/
21
+#line 61 "./helpmenu.w"
22
+
23
+void HelpMenu::displayAboutTypica()
24
+{
25
+AboutTypica*aboutBox= new AboutTypica;
26
+aboutBox->show();
27
+}
28
+
29
+#line 4031 "./typica.w"
30
+
31
+/*:169*/
32
+#line 39 "./helpmenu.w"
33
+
34
+
35
+/*:167*/

+ 20
- 0
src/helpmenu.h View File

@@ -0,0 +1,20 @@
1
+/*166:*/
2
+#line 16 "./helpmenu.w"
3
+
4
+#include <QMenu> 
5
+
6
+#ifndef HelpMenuHeader
7
+#define HelpMenuHeader
8
+
9
+class HelpMenu:public QMenu
10
+{
11
+Q_OBJECT
12
+public:
13
+HelpMenu();
14
+public slots:
15
+void displayAboutTypica();
16
+};
17
+
18
+#endif
19
+
20
+/*:166*/

+ 67
- 0
src/helpmenu.w View File

@@ -0,0 +1,67 @@
1
+@* The Help Menu.
2
+
3
+\noindent Every window has a help menu that is inserted at the end of any
4
+configuration defined menus. At present this only serves to have a place to
5
+hold the "About Typica" menu item which brings up an appropriate about box, but
6
+there is the possibility that future developments will introduce other items
7
+that should be included in this menu.
8
+
9
+@<Insert help menu@>=
10
+HelpMenu *helpMenu = new HelpMenu();
11
+window->menuBar()->addMenu(helpMenu);
12
+
13
+@ Since the help menu is represented by its own class, we must have a
14
+declaration for that class. This is a trivial case.
15
+
16
+@(helpmenu.h@>=
17
+#include <QMenu>
18
+
19
+#ifndef HelpMenuHeader
20
+#define HelpMenuHeader
21
+
22
+class HelpMenu : public QMenu
23
+{
24
+	Q_OBJECT
25
+	public:
26
+		HelpMenu();
27
+	public slots:
28
+		void displayAboutTypica();
29
+};
30
+
31
+#endif
32
+
33
+@ Implementation is in a separate file.
34
+
35
+@(helpmenu.cpp@>=
36
+#include "helpmenu.h"
37
+#include "abouttypica.h"
38
+
39
+@<Help menu implementation@>@;
40
+
41
+@ The constructor sets an object name for the menu so scripts are able to look
42
+up the menu and add additional items. The "About Typica" menu item also has an
43
+object name which can be used to provide custom handling if this is desired.
44
+The |triggered()| signal from that item is immediately connected to a handler
45
+for displaying an about box.
46
+
47
+@<Help menu implementation@>=
48
+HelpMenu::HelpMenu() : QMenu()
49
+{
50
+	setObjectName("helpMenu");
51
+	setTitle(tr("Help"));
52
+	QAction *aboutTypicaAction = new QAction(tr("About Typica"), this);
53
+	aboutTypicaAction->setObjectName("aboutTypicaAction");
54
+	addAction(aboutTypicaAction);
55
+	connect(aboutTypicaAction, SIGNAL(triggered()), this, SLOT(displayAboutTypica()));
56
+}
57
+
58
+@ When "About Typica" is selected from the menu, we display an about box. This
59
+is also handled by a separate class.
60
+
61
+@<Help menu implementation@>=
62
+void HelpMenu::displayAboutTypica()
63
+{
64
+	AboutTypica *aboutBox = new AboutTypica;
65
+	aboutBox->show();
66
+}
67
+

+ 1970
- 1958
src/typica.cpp
File diff suppressed because it is too large
View File


+ 13
- 8
src/typica.w View File

@@ -842,6 +842,13 @@ various Qt modules.
842 842
 #include <QtXmlPatterns>
843 843
 #include <QtWebKit>
844 844
 
845
+@ New code is being written in separate files in a long term effort to improve
846
+organization of the code. The result of this is that some additional headers
847
+are required here.
848
+
849
+@<Header files to include@>=
850
+#include "helpmenu.h"
851
+
845 852
 @** The Scripting Engine.
846 853
 
847 854
 \noindent The main enhancement of \pn{} version 1.1 is the introduction of a
@@ -3894,14 +3901,8 @@ if(element.hasChildNodes())
3894 3901
 {
3895 3902
 	@<Process window children@>@;
3896 3903
 }
3897
-if(window)
3898
-{
3899
-	window->show();
3900
-}
3901
-else
3902
-{
3903
-	qDebug() << "Error! Window invalidated";
3904
-}
3904
+@<Insert help menu@>@;
3905
+window->show();
3905 3906
 
3906 3907
 @ Three element types make sense as top level children of a {\tt <window>}
3907 3908
 element. An element representing a layout element can be used to apply that
@@ -4026,6 +4027,8 @@ while(j < menuItems.count())
4026 4027
 	j++;
4027 4028
 }
4028 4029
 
4030
+@i helpmenu.w
4031
+
4029 4032
 @ A layout can contain a number of different elements including a variety of
4030 4033
 widget types and other layouts. This function is responsible for applying any
4031 4034
 layout class to the widget currently being populated and processing children of
@@ -5643,6 +5646,8 @@ QScriptValue QComboBox_findText(QScriptContext *context, QScriptEngine *engine)
5643 5646
 	return QScriptValue(engine, self->findText(argument<QString>(0, context)));
5644 5647
 }
5645 5648
 
5649
+@i abouttypica.w
5650
+
5646 5651
 @** A representation of temperature measurements.
5647 5652
 
5648 5653
 \noindent Most of the information in a roast log will be temperature

Loading…
Cancel
Save