File indexing completed on 2024-05-05 04:40:10
0001 /* 0002 SPDX-FileCopyrightText: 2006-2009 David Nolden <david.nolden.kdevelop@art-master.de> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #ifndef KDEVPLATFORM_PLUGIN_LOCALPATCHSOURCE_H 0008 #define KDEVPLATFORM_PLUGIN_LOCALPATCHSOURCE_H 0009 0010 #include <QString> 0011 #include <QWidget> 0012 #include <QUrl> 0013 0014 #include <interfaces/ipatchsource.h> 0015 0016 namespace Ui { class LocalPatchWidget; } 0017 0018 class LocalPatchSource : public KDevelop::IPatchSource 0019 { 0020 Q_OBJECT 0021 friend class LocalPatchWidget; 0022 public: 0023 LocalPatchSource(); 0024 ~LocalPatchSource() override; 0025 0026 QString name() const override; 0027 0028 QUrl baseDir() const override { 0029 return m_baseDir; 0030 } 0031 0032 QUrl file() const override { 0033 return m_filename; 0034 } 0035 0036 void update() override; 0037 QIcon icon() const override; 0038 0039 void setFilename(const QUrl& filename) { m_filename = filename; } 0040 void setBaseDir(const QUrl& dir) { m_baseDir = dir; } 0041 void setCommand(const QString& cmd) { m_command = cmd; } 0042 0043 QString command() const { return m_command; } 0044 0045 bool isAlreadyApplied() const override { return m_applied; } 0046 0047 void setAlreadyApplied( bool applied ) { m_applied = applied; } 0048 0049 // the widget should be created _after_ the basic 0050 // values have been filled 0051 void createWidget(); 0052 0053 QWidget* customWidget() const override; 0054 0055 private: 0056 QUrl m_filename; 0057 QUrl m_baseDir; 0058 QString m_command; 0059 bool m_applied = false; 0060 uint m_depth; 0061 class LocalPatchWidget* m_widget = nullptr; 0062 }; 0063 0064 class LocalPatchWidget : public QWidget 0065 { 0066 Q_OBJECT 0067 public: 0068 LocalPatchWidget(LocalPatchSource* lpatch, QWidget* parent); 0069 0070 public Q_SLOTS: 0071 void updatePatchFromEdit(); 0072 void syncPatch(); 0073 0074 private: 0075 LocalPatchSource* m_lpatch; 0076 Ui::LocalPatchWidget* m_ui; 0077 }; 0078 0079 #endif // KDEVPLATFORM_PLUGIN_LOCALPATCHSOURCE_H