2 * Copyright (C) 2009 Sakari Poussa
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, version 2.
12 #include <QPushButton>
14 #include <QVBoxLayout>
15 #include <QItemSelectionModel>
18 #include <QActionGroup>
19 #include <QXmlDefaultHandler>
23 #include "score-common.h"
24 #include "score-dialog.h"
25 #include "course-dialog.h"
26 #include "table-model.h"
27 #include "list-model.h"
29 class MainWindow : public QMainWindow
34 MainWindow(QMainWindow *parent = 0);
35 void createLayoutTable(QWidget *parent = 0);
36 void createLayoutList(QWidget *parent = 0);
37 void createListView(QList<Score *> &, QList <Club *> &);
38 void updateTitleBar(QString & msg);
39 void loadScoreFile(QString &fileName, QList<Score *> &scoreList);
40 void loadClubFile(QString &fileName, QList<Club *> &clubList, bool readOnly = false);
41 void saveScoreFile(QString &fileName, QList<Score *> &scoreList);
42 void saveClubFile(QString &fileName, QList<Club *> &clubList);
48 void clickedList(const QModelIndex &index);
56 void viewStatistics();
63 void loadSettings(void);
64 void saveSettings(void);
65 Club * findClub(QString &name);
66 Course * findCourse(const QString &clubName, const QString &courseName);
67 Course * currentCourse();
68 Score * currentScore();
69 Score * findScore(QString & clubName, QString & courseName);
70 void flushReadOnlyItems();
73 void showNote(QString msg);
74 void getStat(QTextEdit *);
76 void viewScore(Score * score, Course * course);
77 void viewCourse(Course * course);
79 QList<Score *> scoreList;
80 QList<Club *> clubList;
82 ScoreTableModel *scoreTableModel;
83 ScoreListModel *scoreListModel;
84 CourseListModel *courseListModel;
86 QItemSelectionModel *selectionModel;
91 QWidget *centralWidget;
101 QAction *newScoreAction;
102 QAction *newCourseAction;
104 QAction *settingsAction;
106 QActionGroup *filterGroup;
107 QAction *listScoreAction;
108 QAction *listCourseAction;
111 void createActions();
114 ScoreWindow *scoreWindow;
115 CourseWindow *courseWindow;