directorylist.h 2.09 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
/**
 * Copyright (C) 2003-2004 Scott Wheeler <wheeler@kde.org>
 *
 * This program is free software; you can redistribute it and/or modify it under
 * the terms of the GNU General Public License as published by the Free Software
 * Foundation; either version 2 of the License, or (at your option) any later
 * version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT ANY
 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
 * PARTICULAR PURPOSE. See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along with
 * this program.  If not, see <http://www.gnu.org/licenses/>.
 */
16

17 18 19 20
#ifndef JUK_DIRECTORYLIST_H
#define JUK_DIRECTORYLIST_H

#include <QDialog>
21

Laurent Montel's avatar
Laurent Montel committed
22
#include "ui_directorylistbase.h"
23

24 25
class QStringListModel;

Laurent Montel's avatar
Laurent Montel committed
26 27
class DirectoryListBase : public QWidget, public Ui::DirectoryListBase
{
28 29
    Q_OBJECT

Laurent Montel's avatar
Laurent Montel committed
30
public:
31 32 33 34
    DirectoryListBase(QWidget *parent) : QWidget(parent)
    {
        setupUi(this);
    }
Laurent Montel's avatar
Laurent Montel committed
35
};
Nadeem Hasan's avatar
Nadeem Hasan committed
36

37
class DirectoryList : public QDialog
38 39 40 41
{
    Q_OBJECT

public:
42 43
    struct Result
    {
44 45
        QStringList addedDirs;
        QStringList removedDirs;
46
        QStringList excludedDirs;
47 48
        DialogCode status;
        bool addPlaylists;
49 50
    };

51 52 53 54 55
    DirectoryList(
        const QStringList &directories,
        const QStringList &excludeDirectories,
        bool importPlaylists,
        QWidget *parent = nullptr);
56

57 58
    Result dialogResult() const { return m_result; }

59
public slots:
60
    int exec();
61

62
signals:
63 64
    void signalDirectoryAdded(const QString &directory);
    void signalDirectoryRemoved(const QString &directory);
65 66
    void signalExcludeDirectoryAdded(const QString &directory);
    void signalExcludeDirectoryRemoved(const QString &directory);
67 68

private slots:
69 70
    void slotAddDirectory();
    void slotRemoveDirectory();
71 72
    void slotAddExcludeDirectory();
    void slotRemoveExcludeDirectory();
73 74

private:
75
    QStringListModel *m_dirListModel;
76
    QStringListModel *m_excludedDirListModel;
Nadeem Hasan's avatar
Nadeem Hasan committed
77
    DirectoryListBase *m_base;
78
    Result m_result;
79 80 81
};

#endif
Nadeem Hasan's avatar
Nadeem Hasan committed
82

83
// vim: set et sw=4 tw=0 sta: