Warning, file /utilities/kronometer/src/gui/sessiondialog.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 /* 0002 Copyright (C) 2015 by Elvis Angelaccio <elvis.angelaccio@kde.org> 0003 0004 This file is part of Kronometer. 0005 0006 Kronometer is free software: you can redistribute it and/or modify 0007 it under the terms of the GNU General Public License as published by 0008 the Free Software Foundation, either version 2 of the License, or 0009 (at your option) any later version. 0010 0011 Kronometer is distributed in the hope that it will be useful, 0012 but WITHOUT ANY WARRANTY; without even the implied warranty of 0013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0014 GNU General Public License for more details. 0015 0016 You should have received a copy of the GNU General Public License 0017 along with Kronometer. If not, see <http://www.gnu.org/licenses/>. 0018 */ 0019 0020 #ifndef SESSIONDIALOG_H 0021 #define SESSIONDIALOG_H 0022 0023 #include "ui_sessiondialog.h" 0024 #include "session.h" 0025 0026 #include <QDialog> 0027 0028 class SessionModel; 0029 0030 class KMessageWidget; 0031 0032 class QDialogButtonBox; 0033 class QSortFilterProxyModel; 0034 class QTableView; 0035 0036 /** 0037 * @brief Dialog for sessions interaction. 0038 */ 0039 class SessionDialog : public QDialog, public Ui::SessionDialog 0040 { 0041 Q_OBJECT 0042 0043 public: 0044 0045 explicit SessionDialog(QWidget *parent = nullptr); 0046 0047 Session selectedSession() const; 0048 0049 public slots: 0050 0051 virtual void accept() override; 0052 0053 protected: 0054 0055 virtual void keyPressEvent(QKeyEvent *event) override; 0056 0057 private slots: 0058 0059 /** 0060 * Call accept() if the selection's column is not editable. 0061 * @param index The selected index. 0062 */ 0063 void slotDoubleClicked(const QModelIndex& index); 0064 0065 /** 0066 * Disable the OK button if no session is selected. 0067 */ 0068 void slotSelectionChanged(); 0069 0070 /** 0071 * Enable the OK button after the first session is added. 0072 */ 0073 void slotSessionAdded(); 0074 0075 /** 0076 * Disable the OK button if no session is available. 0077 */ 0078 void slotEmptyModel(); 0079 0080 private: 0081 0082 SessionModel *m_sessionModel; 0083 QSortFilterProxyModel *m_proxyModel; 0084 Session m_selectedSession; 0085 0086 /** 0087 * @return The actual selected index in the view. 0088 */ 0089 QModelIndex selectedIndex(); 0090 0091 /** 0092 * Ask confirm to the user before removing a session. 0093 */ 0094 void removeDialog(); 0095 0096 Q_DISABLE_COPY(SessionDialog) 0097 }; 0098 0099 #endif