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>
22 #include "table-model.h"
23 #include "list-model.h"
25 class MainWindow : public QMainWindow
30 MainWindow(QMainWindow *parent = 0);
31 void createLayoutTable(QWidget *parent = 0);
32 void createLayoutList(QWidget *parent = 0);
33 void createListView(QList<Score *> &, QList <Club *> &);
34 void updateTitleBar();
35 void loadScoreFile(QString &fileName, QList<Score *> &scoreList);
36 void loadClubFile(QString &fileName, QList<Club *> &clubList);
37 void saveScoreFile(QString &fileName, QList<Score *> &scoreList);
38 void saveClubFile(QString &fileName, QList<Club *> &clubList);
44 void scoreSelectionChanged(const QItemSelection &selected,
45 const QItemSelection &deselected);
46 void courseSelectionChanged(const QItemSelection &selected,
47 const QItemSelection &deselected);
48 void changeCurrent(const QModelIndex ¤t,
49 const QModelIndex &previous);
56 void viewStatistics();
62 void loadSettings(void);
63 Club * findClub(QString &name);
64 Course * findCourse(const QString &clubName, const QString &courseName);
65 Course * findCourse();
66 Score * findScore(QString & clubName, QString & courseName);
68 void showNote(QString msg);
69 void getStat(QTextEdit *);
71 void viewScore(Score * score, Course * course);
72 void viewCourse(Course * course);
74 QList<Score *> scoreList;
75 QList<Club *> clubList;
77 ScoreTableModel *scoreTableModel;
78 ScoreListModel *scoreListModel;
79 CourseListModel *courseListModel;
81 QAbstractItemModel *tableModel;
82 QItemSelectionModel *selectionModel;
88 QWidget *centralWidget;
94 QAction *newScoreAction;
95 QAction *newCourseAction;
98 QActionGroup *filterGroup;
99 QAction *listScoreAction;
100 QAction *listCourseAction;
103 void createActions();
106 QMainWindow *scoreWin;
107 QMainWindow *courseWin;