aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/coreplugin/dialogs/saveitemsdialog.h
blob: a60dc126c1a1c90285e66f8d5a7147ec74d98c83 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0

#pragma once

#include <QList>
#include <QDialog>

QT_BEGIN_NAMESPACE
class QLabel;
class QTreeWidget;
class QCheckBox;
class QDialogButtonBox;
QT_END_NAMESPACE

namespace Core {

class IDocument;

namespace Internal {

class SaveItemsDialog : public QDialog
{
    Q_OBJECT

public:
    SaveItemsDialog(QWidget *parent, const QList<IDocument *> &items);

    void setMessage(const QString &msg);
    void setAlwaysSaveMessage(const QString &msg);
    bool alwaysSaveChecked();
    QList<IDocument *> itemsToSave() const;
    QStringList filesToDiff() const;

private:
    void collectItemsToSave();
    void collectFilesToDiff();
    void discardAll();
    void updateButtons();
    void adjustButtonWidths();

    QLabel *m_msgLabel;
    QTreeWidget *m_treeWidget;
    QCheckBox *m_saveBeforeBuildCheckBox;
    QDialogButtonBox *m_buttonBox;
    QList<IDocument *> m_itemsToSave;
    QStringList m_filesToDiff;
    QPushButton *m_diffButton = nullptr;
};

} // namespace Internal
} // namespace Core