sAlarm 0.5
salarm/mainwindow.h
00001 /*
00002  * sAlarm - Scheduler
00003  * http://salarm.seberm.com
00004  *
00005  * Copyright (C) 2009-2010 Otto Sabart <seberm[at]gmail[dot]com>
00006  * 
00007  * This program is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU General Public License
00009  * version 3 as published by the Free Software Foundation.
00010  * 
00011  * This program is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  * 
00016  * You should have received a copy of the GNU General Public License
00017  * along with this program; if not, write to the Free Software
00018  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
00019  */
00020 
00021 
00022 #ifndef MAINWINDOW_H
00023 #define MAINWINDOW_H
00024 
00025 
00026 #include <QMainWindow>
00027 #include <QSystemTrayIcon>
00028 #include <QLabel>
00029 #include <QTimer>
00030 #include <QStatusBar>
00031 #include <QToolBar>
00032 #include <QModelIndex>
00033 
00034 
00035 class Scheduler;
00036 class KeyCatcher;
00037 class Database;
00038 
00039 namespace Ui {  
00040     class MainWindow;
00041 }
00042 
00043 
00045 class MainWindow : public QMainWindow {
00046         
00047     Q_OBJECT
00048 
00049 public:
00050         
00052 
00056         explicit MainWindow(QWidget* parent = 0);
00057         
00059         ~MainWindow();
00060 
00061         
00062 protected:
00063         
00065         void changeEvent(QEvent* e);
00066         
00068 
00072         void closeEvent(QCloseEvent* event);
00073 
00074         
00075 private:
00076         
00078         void createStatusBar();
00079         
00081         void createToolBar();
00082         
00084         void createTrayIcon();
00085         
00087         void makeConnections() const;
00088 
00090 
00093         void readSettings();
00094         
00096 
00099         void writeSettings() const;
00100 
00101         
00103 
00106         bool okToContinue();
00107         
00108         
00110         Ui::MainWindow *ui;
00111         
00113         QSystemTrayIcon *m_trayIcon;
00114         
00116         QStatusBar *m_statusBar;
00117         
00119         QToolBar *m_toolBar;
00120         
00122         QLabel *m_lblCurrentDateTime;
00123         
00125         QTimer *m_timer;
00126         
00128         KeyCatcher *m_keyCatcher;
00129         
00131         Scheduler *m_scheduler;
00132         
00134         Database *m_sqlDb;
00135                         
00136         
00137 private slots:
00138         
00140         void showHide();
00141         
00143         void trayActivation(QSystemTrayIcon::ActivationReason);
00144         
00146         void about();
00147         
00149         void reportBug();
00150         
00152         void openPreferences();
00153         
00155 
00159         void exportSchedules();
00160         
00162 
00166         void importSchedules();
00167         
00169         void showSchedule();
00170         
00172 
00175         void addSchedule();
00176         
00178 
00181         void removeSchedule();
00182         
00184 
00187         void showContextMenu(const QPoint &point);
00188         
00190 
00193         void editSchedule(const QModelIndex &index);
00194         
00196         void editSchedule();
00197         
00201         void timeoutInformation(int);
00202         
00204 
00207         void updateStatusBar();
00208         
00210 
00213         void keyPressed(int key);
00214         
00215 };
00216 
00217 #endif // MAINWINDOW_H
 All Classes Functions Enumerations