File indexing completed on 2025-01-05 05:14:40
0001 /* 0002 SPDX-FileCopyrightText: 2021 Hamed Masafi <hamed.masfi@gmail.com> 0003 0004 SPDX-License-Identifier: GPL-3.0-or-later 0005 */ 0006 0007 #pragma once 0008 0009 #include <QWidget> 0010 0011 #include <QSettings> 0012 0013 class QSplitter; 0014 class QTreeView; 0015 class AppWindow; 0016 0017 namespace Git 0018 { 0019 class Manager; 0020 } 0021 class WidgetBase : public QWidget 0022 { 0023 Q_OBJECT 0024 0025 protected: 0026 Git::Manager *mGit{nullptr}; 0027 AppWindow *mParent{nullptr}; 0028 QString stateName(QWidget *w) const; 0029 0030 public: 0031 explicit WidgetBase(QWidget *parent = nullptr); 0032 explicit WidgetBase(Git::Manager *git, AppWindow *parent = nullptr); 0033 Git::Manager *git() const; 0034 void setGit(Git::Manager *newGit); 0035 0036 virtual void reload(); 0037 0038 int exec(QWidget *parent = nullptr); 0039 0040 virtual void saveState(QSettings &settings) const; 0041 virtual void restoreState(QSettings &settings); 0042 0043 void save(QSettings &settings, QSplitter *splitter) const; 0044 void restore(QSettings &settings, QSplitter *splitter); 0045 0046 void save(QSettings &settings, QTreeView *treeView) const; 0047 void restore(QSettings &settings, QTreeView *treeView); 0048 0049 virtual void settingsUpdated(); 0050 private Q_SLOTS: 0051 void git_pathChanged(); 0052 };