a9632a2bd67f0175fefbef77ad2ce5538a75db46
[qtmeetings] / src / UserInterface / Views / WeeklyViewWidget.h
1 #ifndef WEEKLYVIEWWIDGET_H_
2 #define WEEKLYVIEWWIDGET_H_
3
4 #include "ViewBase.h"
5 #include <QDateTime>
6
7 class QLabel;
8 class QPushButton;
9 class MeetingRoomCombo;
10 class TimeDisplayWidget;
11 class ScheduleWidget;
12 class Configuration;
13 class Meeting;
14 class Room;
15 class BorderedBarWidget;
16
17 //! Userinterface class. Shows a weekly calendar for the selected room, provides date and time information.
18 /*!
19  * UserInterface class. Shows the current date and time and selected week's calendar for
20  * selected meeting room. User can select meeting room, browse weeks back and forth, and can navigate
21  * back to the current week.
22  */
23 class WeeklyViewWidget : public ViewBase
24 {
25         Q_OBJECT
26
27 public:
28         //! Constructor.
29         /*!
30          * Constructor to initialize an WeeklyViewWidget instance.
31          * \param aCurrentDateTime
32          * \param aConfiguration Pointer to the configuration object. Not owned.
33          * \param aParent Pointer to the parent widget.
34          */
35         WeeklyViewWidget( QDateTime aCurrentDateTime, Configuration *aConfiguration, QWidget *aParent = 0 );
36         //! Destructor.
37         virtual ~WeeklyViewWidget();
38
39         //! Current room
40         /*!
41          * Returns the currently selected meeting room.
42          * \return Selected meeting room.
43          */
44         Room* currentRoom();
45
46         //! First day of week currently displayd
47         /*!
48          * Returns the first day of week currently displayd.
49          * \return First day of week.
50          */
51         QDate beginnigOfShownWeek();
52         //! Sends the refresh command to schedule widget.
53         /*!
54          * Sends the refresh command to schedule widget.
55          * \param aMeetings The list of meetings.
56          */
57         void refreshMeetings( const QList<Meeting*> &aMeetings );
58         
59         void showCurrentWeek();
60         
61         void setDefaultRoom();
62         
63 signals:
64         //! Signals change of the meeting room.
65         /*!
66          * Signal is emited when meeting room is changed.
67          * \param aNewRoom Selected meeting room.
68          */
69         void currentRoomChanged( Room *aNewRoom );
70         //! Meeting activated.
71         /*!
72          * Signal is emitted when a meeting is clicked by the user.
73          * \param aMeeting actived meeting.
74          */
75         void meetingActivated( Meeting *aMeeting );
76         //! Signals creation of new meeting.
77         /*!
78          * Signal is emited when new meeting is created.
79          * \param aMeeting Meeting that has been created.
80          * \param aUsername User who created the meeting.
81          * \param aPassword Password of the "aUsername"
82          */
83         void meetingToCreate( Meeting *aMeeting, const QString &aUsername, const QString &aPassword );
84         //! Signals deletion of a meeting.
85         /*!
86          * Signal is emited when meeting is deleted.
87          * \param aMeeting Deleted meeting.
88          * \param aUsername User who deleted the meeting.
89          * \param aPassword Password of the "aUsername"
90          */
91         void meetingToDelete( Meeting *aMeeting, const QString &aUsername, const QString &aPassword );
92         //! Signals modifications of a meeting.
93         /*!
94          * Signal is emited when meeting is modified.
95          * \param aMeeting Modified meeting.
96          * \param aUsername User who modified the meeting.
97          * \param aPassword Password of the "aUsername"
98          */
99         void meetingToUpdate( Meeting *aMeeting, const QString &aUsername, const QString &aPassword );
100
101         //! Signals
102         /*!
103          * Signal is emited when settings button is clicked.
104          */
105         void settingsButtonClicked();
106         
107         //! Signal. Emitted if the shown week has been changed.
108         /*!
109          * Signal. Emitted if the shown week has been changed.
110          * \param aDate The first date of the shown week.
111          */
112         void shownWeekChanged( QDate aDate );
113
114 public slots:
115         //! Slot. Sets the connection status
116         /*!
117          * Sets the current time, and connection status
118          * \param aCurrentTime Time to be displayed.
119          * \param aConnected connection status to be displayed.
120          * \param aLastUpdated Time of last successful connection to be displayed.
121          */
122         void setConnectionStatus( QDateTime aCurrentTime, bool aConnected, QTime aLastUpdated = QTime(), QString aError = "" );
123         //! Handle resizing
124         /*!
125          * Handle possible resize changes after the view is resized
126          * to match the window managers client area.
127          */
128         void viewResized(const QSize &/*newSize*/, const QSize &/*oldSize*/) { }
129
130         void showError( QString aError );
131
132         void connectionEstablished();
133
134         void connectionLost();
135
136 private:
137         //! Displays the selectable meeting rooms.
138         MeetingRoomCombo *iRoomsCombo;
139         //! Displays the time.
140         BorderedBarWidget *iTimeDisplay;
141         //! Displays the status.
142         BorderedBarWidget *iStatusBar;
143         //! Displays the calendar.
144         ScheduleWidget *iSchedule;
145         //! Displays the date.
146         QLabel *iCurrentDayLabel;
147         //! Displays the week number.
148         QLabel *iCurrentWeekLabel;
149         //! Button used to display previous week's calendar.
150         QPushButton *iPreviousWeekButton;
151         //! Button used to display current week's calendar.
152         QPushButton *iCurrentWeekButton;
153         //! Button used to display next week's calendar.
154         QPushButton *iNextWeekButton;
155         //! Settings button. TODO : Correct widget is needed!!
156         QPushButton *iSettingsButton;
157         //! About button. TODO : Correct widget is needed!!
158         QPushButton *iAboutButton;
159         /* !
160          * Pointer to configuration object.
161          * Contains configurable data and IS NOT OWNED by the widget.
162          */
163         Configuration *iConfiguration;
164 };
165
166 #endif /*WEEKLYVIEWWIDGET_H_*/