summaryrefslogtreecommitdiffstats
path: root/kbruch/src/mainqtwidget.h
blob: 4ddab9fa2e4a08455a5aa8860c936107633700a6 (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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
/***************************************************************************
                          mainqtwidget.h  -  The main TQt/KDE window
                             -------------------
    begin                : Tue Mar 16 00:00:00 CET 2003
    copyright            : (C) 2003-2004 by Sebastian Stein
    email                : seb.kde@hpfsc.de
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/
#ifndef MAINTQTWIDGET_H
#define MAINTQTWIDGET_H

#include <tdemainwindow.h>


class KJanusWidget;
class KWidgetAction;

class TQLabel;

class ExerciseCompare;
class ExerciseConvert;
class ExerciseFactorize;
class StatisticsView;
class TaskView;

/** Constructs the main window and presents the user interface.
 *  The window is seperated into 2 sections. In the left section is the
 *  statistic view and in the right section the task view.
 *  \author Sebastian Stein
 *  \author Eva Brucherseifer
 **/
class MainQtWidget : public TDEMainWindow
{
	TQ_OBJECT
  
			  
	public:
		/** constructor */
		MainQtWidget();

		/** destructor */
		~MainQtWidget();

	private:
		/** read the config file */
		void readOptions();

		/** read the config file */
		void writeOptions();
		
		/** pointing to the statistics view */
		StatisticsView * m_statview;

		/** the iconlist for the different exercises */
		KJanusWidget * m_exercises;

		/** pointing to the exercise solving a task with fractions; added as page
		 * to the iconlist */
		TaskView * m_taskview;

		/** pointing to the exercise comparing ratios; added as page to the
		 * iconlist */ 
		ExerciseCompare * m_exerciseCompare;

		/** pointing to the exercise convert rational number; added as page to the
		 * iconlist */ 
		ExerciseConvert * m_exerciseConvert;

		/** pointing to the exercise factorize a given number; added as page to
		 * the iconlist */ 
		ExerciseFactorize * m_exerciseFactorize;
		
		bool m_addSub;
		bool m_mulDiv;
		unsigned int m_nrRatios;
		unsigned int m_maxMainDenominator;

		void setupActions();

		TQComboBox * m_NrOfTermsBox;
		TQLabel * m_NrOfTermsLabel;
		KWidgetAction * m_NrOfTermsBoxAction;
		KWidgetAction * m_NrOfTermsLabelAction;

		TQComboBox * m_MaxMainDenominatorBox;
		TQLabel * m_MaxMainDenominatorLabel;
		KWidgetAction * m_MaxMainDenominatorBoxAction;
		KWidgetAction * m_MaxMainDenominatorLabelAction;

		TQComboBox * m_OperationBox;
		TQLabel * m_OperationLabel;
		KWidgetAction * m_OperationBoxAction;
		KWidgetAction * m_OperationLabelAction;

		TDEAction * m_NewTaskAction;

	private slots:
		/** 
		 * called to force generation of a new task 
		 */
		void NewTask();
		/** 
		 * called when the user changes the number of terms in the ComboBox 
		 */
		void NrOfTermsBoxSlot();
		/** 
		 *called, when the user changes the max. size of the main denominator in
 		 * the ComboBox 
		 */
		void MaxMainDenominatorBoxSlot();
		/** 
		 * called, when the user changes the wished task's operations 
		 */
		void OperationBoxSlot();

		/**
		 * calls the settings dialog
		 */
		void slotPrefs();

		/**
		 * makes sure, all parts of the UI update to new settings
		 */
		void slotApplySettings();

		/**
		 * called just before another page is shown
		 */
		void slotAboutToShowPage(TQWidget * page);

	protected:
		/** Function is called when user calls termination.
		 *  Used to save the current statistics and settings before exiting.
		 **/
		bool queryExit();
};

#endif // MainQtWidget