~noskcaj/ubuntu/wily/nootka/1.2

« back to all changes in this revision

Viewing changes to src/mainwindow.h

  • Committer: Package Import Robot
  • Author(s): Jackson Doak
  • Date: 2014-05-28 07:22:46 UTC
  • mfrom: (1.1.2)
  • Revision ID: package-import@ubuntu.com-20140528072246-7m1u5qc24gqhqurg
Tags: 1.0.1-0ubuntu1
* Add a debian/watch file
* New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/***************************************************************************
2
 
 *   Copyright (C) 2011-2012 by Tomasz Bojczuk                             *
 
2
 *   Copyright (C) 2011-2014 by Tomasz Bojczuk                             *
3
3
 *   tomaszbojczuk@gmail.com                                               *
4
4
 *                                                                         *
5
5
 *   This program is free software; you can redistribute it and/or modify  *
20
20
#define MAINWINDOW_H
21
21
 
22
22
#include "tnote.h"
23
 
#include "texamlevel.h"
 
23
#include "tlevel.h"
24
24
#include <texamexecutor.h>
25
25
#include <QMainWindow>
26
26
 
 
27
 
 
28
class TanimedChBox;
 
29
class QVBoxLayout;
 
30
class TnootkaLabel;
 
31
class TroundedLabel;
 
32
class TmainScore;
27
33
class QLabel;
28
34
class TfingerBoard;
29
35
class TnoteName;
30
 
class TscoreWidget;
31
36
class TexamView;
32
37
class TprogressWidget;
33
38
class TpitchView;
34
39
class Tsound;
35
 
class QCheckBox;
36
40
 
37
41
 
38
42
class MainWindow : public QMainWindow
49
53
    void setStatusMessage(QString msg, int time);
50
54
    void setStatusMessage(QString msg);
51
55
    void setMessageBg (QColor bg);
 
56
    
52
57
        /**  Returns font size used in status message label in pixels.
53
58
        * Its size depends on whole window size and is used for fonts' sizes
54
59
        * of others widgets. */
55
60
    int getFontSize() {return m_statFontSize; }
56
61
    QString statusMessage() { return m_statusText; }
57
62
    QWidget *innerWidget;
 
63
    
58
64
        /** Returns point of bottomLeft examResults.*/
59
65
    QPoint relatedPoint();
60
66
 
76
82
 
77
83
 
78
84
protected:
79
 
    TscoreWidget *score;
 
85
    TmainScore *score;
80
86
    TnoteName *noteName;
81
87
    TfingerBoard *guitar;
82
88
    Tsound *sound;
83
89
    TexamView *examResults;
84
90
    TexamExecutor *ex;
85
 
    QCheckBox *autoRepeatChB, *expertAnswChB;
 
91
                TnootkaLabel *nootLabel; // displays Nootka logo
 
92
    TanimedChBox *autoRepeatChB, *expertAnswChB, *correctChB;
86
93
    TpitchView *pitchView;
87
94
    TprogressWidget *progress;
88
95
 
89
96
    QToolBar *nootBar;
90
97
    QAction *settingsAct, *levelCreatorAct, *startExamAct, *aboutAct, *analyseAct;
91
98
    void clearAfterExam(TexamExecutor::Estate examState = TexamExecutor::e_finished);
 
99
                
 
100
    void updateSize(QSize newS); /** Updates position and sizes of the widgets. */
 
101
                
 
102
                                /* Invokes TnoteName::resize(). Also does the same for TexamView (examResults) and TprogressWidget.
 
103
                                 * Font size is calculated from m_statFontSize + m_extraFontOffset */
 
104
                void setWidgetsFont();
92
105
 
93
106
    void resizeEvent(QResizeEvent *event);
94
107
    bool event(QEvent *event);
98
111
        
99
112
protected slots:
100
113
    void restoreMessage();
101
 
    void hintsStateChanged(bool enable);
102
114
    void showSupportDialog();
 
115
                
 
116
                                /** Checks is score not too width and places pitchView under when it is.
 
117
                                 * Or opposite - moves pitchView.
 
118
                                 * Also avoid collision score and note name. */
 
119
                void fixPitchViewPos();
 
120
                
 
121
                                /** In first attempt it tries to increase window size if there is screen space in spare.
 
122
                                 * If not, Invokes TnoteName::resize() with smallest font size to decrease it.
 
123
                                 * Also does the same for TexamView (examResults) and TprogressWidget */
 
124
                void fixNoteNameSize();
 
125
                
 
126
                                /** This slot is invoked when clef is changed by clicking score.
 
127
                                 * It adjust ambitus to score possibilities if clef is differ than default
 
128
                                 * or to instrument scale if clef backs to default */
 
129
                void adjustAmbitus();
103
130
 
104
131
private:
105
132
 
106
 
    QLabel *m_statLab;
107
 
    QString m_statusText, m_prevMsg;
 
133
    TroundedLabel                         *m_statLab;
 
134
    QString                                                     m_statusText, m_prevMsg;
 
135
                
108
136
        /** Keeps true when statusMesage is locked by temporary message
109
137
        * and stops any status messages in this time.*/
110
 
    bool m_lockStat;
111
 
    QColor m_prevBg, m_curBG;
112
 
    QPixmap m_bgPixmap;
113
 
    int m_statFontSize;
114
 
    QCheckBox *m_hintsChB;
115
 
         /** Keeps true when Dialog windows is opened, to avoid opening another file. */
116
 
    bool m_levelCreatorExist;
117
 
    TexamLevel m_level;
 
138
    bool                                                                        m_lockStat;
 
139
    QColor                                                              m_prevBg, m_curBG;
 
140
    QPixmap                                                     m_bgPixmap, m_rosettePixmap;
 
141
    int                                                                         m_statFontSize, m_extraFontOffset;
 
142
    bool                                                                        m_levelCreatorExist; /** Keeps true when Dialog windows is opened, to avoid opening another file. */
 
143
    Tlevel                                                  m_level;
 
144
                bool                                                                    m_isPlayerFree;
 
145
                QWidget                                                         *m_pitchContainer;
 
146
                QVBoxLayout                                     *m_rightLay, *m_scoreLay;
 
147
 
118
148
 
119
149
    void createActions();
120
 
        /** it sets icon and status text in startExamAct. */
121
 
    void setStartExamActParams();
122
 
        /** Updates position and sizes of the widgets. */
123
 
    void updsateSize();
 
150
    void setStartExamActParams(); /** it sets icon and status text in startExamAct. */
124
151
 
125
152
};
126
153