File indexing completed on 2022-09-27 20:25:25

0001 /**
0002  * Copyright (C) 2003-2004 Scott Wheeler <wheeler@kde.org>
0003  *
0004  * This program is free software; you can redistribute it and/or modify it under
0005  * the terms of the GNU General Public License as published by the Free Software
0006  * Foundation; either version 2 of the License, or (at your option) any later
0007  * version.
0008  *
0009  * This program is distributed in the hope that it will be useful, but WITHOUT ANY
0010  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
0011  * PARTICULAR PURPOSE. See the GNU General Public License for more details.
0012  *
0013  * You should have received a copy of the GNU General Public License along with
0014  * this program.  If not, see <http://www.gnu.org/licenses/>.
0015  */
0016 
0017 #ifndef JUK_DIRECTORYLIST_H
0018 #define JUK_DIRECTORYLIST_H
0019 
0020 #include <QDialog>
0021 
0022 #include "ui_directorylistbase.h"
0023 
0024 class QStringListModel;
0025 
0026 class DirectoryListBase : public QWidget, public Ui::DirectoryListBase
0027 {
0028     Q_OBJECT
0029 
0030 public:
0031     DirectoryListBase(QWidget *parent) : QWidget(parent)
0032     {
0033         setupUi(this);
0034     }
0035 };
0036 
0037 class DirectoryList : public QDialog
0038 {
0039     Q_OBJECT
0040 
0041 public:
0042     struct Result
0043     {
0044         QStringList addedDirs;
0045         QStringList removedDirs;
0046         QStringList excludedDirs;
0047         DialogCode status;
0048         bool addPlaylists;
0049     };
0050 
0051     explicit DirectoryList(
0052         const QStringList &directories,
0053         const QStringList &excludeDirectories,
0054         bool importPlaylists,
0055         QWidget *parent = nullptr);
0056 
0057     Result dialogResult() const { return m_result; }
0058 
0059 public slots:
0060     int exec() override;
0061 
0062 signals:
0063     void signalDirectoryAdded(const QString &directory);
0064     void signalDirectoryRemoved(const QString &directory);
0065     void signalExcludeDirectoryAdded(const QString &directory);
0066     void signalExcludeDirectoryRemoved(const QString &directory);
0067 
0068 private slots:
0069     void slotAddDirectory();
0070     void slotRemoveDirectory();
0071     void slotAddExcludeDirectory();
0072     void slotRemoveExcludeDirectory();
0073 
0074 private:
0075     QStringListModel *m_dirListModel;
0076     QStringListModel *m_excludedDirListModel;
0077     DirectoryListBase *m_base;
0078     Result m_result;
0079 };
0080 
0081 #endif
0082 
0083 // vim: set et sw=4 tw=0 sta: