blob: 27e8675c160b13fb1e10bcf0eee7a401bb9b735e (
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#pragma once
#include <utils/filepath.h>
#include <QDialog>
QT_BEGIN_NAMESPACE
class QLabel;
class QPushButton;
class QSortFilterProxyModel;
QT_END_NAMESPACE
namespace Utils { class TreeView; }
namespace Git::Internal {
class StashModel;
/* StashDialog: Non-modal dialog that manages the list of stashes
* of the repository. Offers to show, restore, restore to branch
* (in case restore fails due to conflicts) on current and
* delete on selection/all. */
class StashDialog : public QDialog
{
public:
explicit StashDialog(QWidget *parent = nullptr);
~StashDialog() override;
void refresh(const Utils::FilePath &repository, bool force);
private:
// Prompt dialog for modified repositories. Ask to undo or stash away.
enum ModifiedRepositoryAction {
ModifiedRepositoryCancel,
ModifiedRepositoryStash,
ModifiedRepositoryDiscard
};
void deleteAll();
void deleteSelection();
void showCurrent();
void restoreCurrent();
void restoreCurrentInBranch();
void enableButtons();
void forceRefresh();
ModifiedRepositoryAction promptModifiedRepository(const QString &stash);
bool promptForRestore(QString *stash, QString *branch /* = 0 */, QString *errorMessage);
bool ask(const QString &title, const QString &what, bool defaultButton = true);
void warning(const QString &title, const QString &what, const QString &details = QString());
int currentRow() const;
QList<int> selectedRows() const; \
StashModel *m_model;
QSortFilterProxyModel *m_proxyModel;
QPushButton *m_deleteAllButton;
QPushButton *m_deleteSelectionButton;
QPushButton *m_showCurrentButton;
QPushButton *m_restoreCurrentButton;
QPushButton *m_restoreCurrentInBranchButton;
QPushButton *m_refreshButton;
Utils::FilePath m_repository;
QLabel *m_repositoryLabel;
Utils::TreeView *m_stashView;
};
} // Git::Internal
|