File indexing completed on 2024-04-28 04:38:52

0001 /*
0002     SPDX-FileCopyrightText: 2010 Aleix Pol Gonzalez <aleixpol@kde.org>
0003 
0004     SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #ifndef KDEVPLATFORM_PLUGIN_STASHMANAGERDIALOG_H
0008 #define KDEVPLATFORM_PLUGIN_STASHMANAGERDIALOG_H
0009 
0010 #include <QDialog>
0011 #include <QStandardItemModel>
0012 #include <QDir>
0013 
0014 class KJob;
0015 namespace Ui { class StashManager; }
0016 
0017 class GitPlugin;
0018 
0019 class StashManagerDialog : public QDialog
0020 {
0021     Q_OBJECT
0022     public:
0023         explicit StashManagerDialog(const QDir& stashed, GitPlugin* plugin, QWidget* parent);
0024         ~StashManagerDialog() override;
0025         
0026     public Q_SLOTS:
0027         void showStash();
0028         void applyClicked();
0029         void branchClicked();
0030         void popClicked();
0031         void dropClicked();
0032         void stashesFound();
0033         
0034     private:
0035         QString selection() const;
0036         void runStash(const QStringList& arguments);
0037         
0038         Ui::StashManager* m_ui;
0039         GitPlugin* m_plugin;
0040         QDir m_dir;
0041 };
0042 
0043 class StashModel : public QStandardItemModel
0044 {
0045     Q_OBJECT
0046     public:
0047         enum ItemRoles {
0048             RefRole = Qt::UserRole+1, /**< the stash item ref*/
0049             MessageRole,              /**< the message associated with the stash item (possibly empty)**/
0050             CommitHashRole,           /**< a short hash of the commit on which the stash was made */
0051             CommitDescRole,           /**< a brief description of the commit on which the stash was made (possibly empty) */
0052             BranchRole,               /**< the name of the branch on which the stash was made (possibly empty)*/
0053             DateRole,                 /**< the date when the stash was created */
0054         };
0055         explicit StashModel(const QDir& dir, GitPlugin* git, QObject* parent = nullptr);
0056         
0057     private Q_SLOTS:
0058         void stashListReady(KJob*);
0059 };
0060 
0061 #endif // KDEVPLATFORM_PLUGIN_STASHMANAGERDIALOG_H