File indexing completed on 2024-05-12 04:37:46

0001 /*
0002     SPDX-FileCopyrightText: 2008 Aleix Pol <aleixpol@gmail.com>
0003     SPDX-FileCopyrightText: 2009 Ramón Zarazúa <killerfox512+kde@gmail.com>
0004 
0005     SPDX-License-Identifier: GPL-2.0-or-later
0006 */
0007 
0008 #ifndef KDEVPLATFORM_APPLYCHANGESWIDGET_H
0009 #define KDEVPLATFORM_APPLYCHANGESWIDGET_H
0010 
0011 #include <QDialog>
0012 #include <language/languageexport.h>
0013 
0014 namespace KTextEditor {
0015 class Document;
0016 }
0017 
0018 namespace KDevelop {
0019 class IndexedString;
0020 class ApplyChangesWidgetPrivate;
0021 
0022 class KDEVPLATFORMLANGUAGE_EXPORT ApplyChangesWidget
0023     : public QDialog
0024 {
0025     Q_OBJECT
0026 
0027 public:
0028     explicit ApplyChangesWidget(QWidget* parent = nullptr);
0029     ~ApplyChangesWidget() override;
0030 
0031     void setInformation(const QString& info);
0032 
0033     bool hasDocuments() const;
0034 
0035     KTextEditor::Document* document() const;
0036 
0037     ///@param original may be an artificial code representation @ref KDevelop::InsertArtificialCodeRepresentation
0038     void addDocuments(const IndexedString& original);
0039 
0040     ///This will save all the modified files into their originals
0041     bool applyAllChanges();
0042 
0043     ///Update the comparison view fo @p index, in case changes have been done directly to the opened document.
0044     ///@param index the index to update, -1 for current index
0045     void updateDiffView(int index = -1);
0046 
0047 public Q_SLOTS:
0048     ///Called to signal a change to the currently viewed index
0049     void indexChanged(int);
0050 
0051 private:
0052     const QScopedPointer<class ApplyChangesWidgetPrivate> d_ptr;
0053     Q_DECLARE_PRIVATE(ApplyChangesWidget)
0054 };
0055 }
0056 
0057 #endif