source: src/mvc/conferencemodel.h @ 68b2df2

qt5
Last change on this file since 68b2df2 was 68b2df2, checked in by gregor herrmann <gregoa@…>, 10 years ago

Add copyright to source.

  • Property mode set to 100644
File size: 1.9 KB
Line 
1/*
2 * Copyright (C) 2010 Ixonos Plc.
3 * Copyright (C) 2011 Philipp Spitzer, gregor herrmann
4 *
5 * This file is part of ConfClerk.
6 *
7 * ConfClerk is free software: you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the Free
9 * Software Foundation, either version 2 of the License, or (at your option)
10 * any later version.
11 *
12 * ConfClerk is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14 * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
15 * more details.
16 *
17 * You should have received a copy of the GNU General Public License along with
18 * ConfClerk.  If not, see <http://www.gnu.org/licenses/>.
19 */
20#ifndef CONFERENCE_MODEL_H
21#define CONFERENCE_MODEL_H
22
23#include <QAbstractListModel>
24#include <QList>
25
26#include "conference.h"
27
28/** ConferenceModel class represents list of conferences for ListViews that may need it.
29
30It also provides typed access to the conferences from ConferenceEditor.
31
32It does not actually modify anything in DB, this is performed by other classes.
33
34\see ConferenceEditor, MainWindow::showConferences()
35*/
36class ConferenceModel : public QAbstractListModel {
37    Q_OBJECT
38public:
39    ConferenceModel(QObject* parent);
40    virtual ~ConferenceModel() { }
41
42    virtual int rowCount(const QModelIndex& parent = QModelIndex()) const;
43    virtual QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const;
44
45    const Conference& conferenceFromIndex(const QModelIndex&) const;
46    QModelIndex indexFromId(int id) const;
47public slots:
48    void newConferenceBegin();
49    void newConferenceEnd(const QString& title);
50    void conferenceRemoved();
51private:
52    // reinitialize list from database
53    void reinit()
54    {
55        conferences = Conference::getAll();
56        reset();
57    }
58
59    QList<Conference> conferences;
60};
61
62#endif
Note: See TracBrowser for help on using the repository browser.