1 /**
2  * \file playlisteditdialog.h
3  * Edit playlist dialog.
4  *
5  * \b Project: Kid3
6  * \author Urs Fleisch
7  * \date 05 Aug 2018
8  *
9  * Copyright (C) 2018  Urs Fleisch
10  *
11  * This file is part of Kid3.
12  *
13  * Kid3 is free software; you can redistribute it and/or modify
14  * it under the terms of the GNU General Public License as published by
15  * the Free Software Foundation; either version 2 of the License, or
16  * (at your option) any later version.
17  *
18  * Kid3 is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21  * GNU General Public License for more details.
22  *
23  * You should have received a copy of the GNU General Public License
24  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
25  */
26 
27 #pragma once
28 
29 #include <QDialog>
30 
31 class QDialogButtonBox;
32 class QItemSelectionModel;
33 class PlaylistModel;
34 
35 /**
36  * Edit playlist dialog.
37  */
38 class PlaylistEditDialog : public QDialog {
39   Q_OBJECT
40 public:
41   /**
42    * Constructor.
43    * @param model playlist model
44    * @param selModel selection model of associated file proxy model
45    * @param parent parent widget
46    */
47   PlaylistEditDialog(PlaylistModel* model, QItemSelectionModel* selModel,
48                      QWidget* parent = nullptr);
49 
50   /**
51    * Destructor.
52    */
53   virtual ~PlaylistEditDialog() override;
54 
55   /**
56    * Get playlist model.
57    * @return playlist model.
58    */
playlistModel()59   PlaylistModel* playlistModel() const { return m_playlistModel; }
60 
61 protected:
62   /**
63    * Ask user before closing with unsaved modifications.
64    * @param event close event
65    */
66   virtual void closeEvent(QCloseEvent* event) override;
67 
68 private slots:
69   void setModified(bool modified);
70   void showHelp();
71 
72 private:
73   void setWindowCaption();
74 
75   QDialogButtonBox* m_buttonBox;
76   PlaylistModel* m_playlistModel;
77 };
78