1 /** 2 * UGENE - Integrated Bioinformatics Tools. 3 * Copyright (C) 2008-2021 UniPro <ugene@unipro.ru> 4 * http://ugene.net 5 * 6 * This program is free software; you can redistribute it and/or 7 * modify it under the terms of the GNU General Public License 8 * as published by the Free Software Foundation; either version 2 9 * of the License, or (at your option) any later version. 10 * 11 * This program is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with this program; if not, write to the Free Software 18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 19 * MA 02110-1301, USA. 20 */ 21 22 #ifndef _U2_SAVABLE_WIDGET_H_ 23 #define _U2_SAVABLE_WIDGET_H_ 24 25 #include <QSet> 26 #include <QVariant> 27 28 #include <U2Core/global.h> 29 30 class QWidget; 31 32 namespace U2 { 33 34 class MWMDIWindow; 35 36 class U2GUI_EXPORT U2SavableWidget { 37 public: 38 U2SavableWidget(QWidget *wrappedWidget, MWMDIWindow *contextWindow = nullptr); 39 virtual ~U2SavableWidget(); 40 41 virtual QString getWidgetId() const; 42 virtual QSet<QString> getChildIds() const; 43 virtual bool childValueIsAcceptable(const QString &childId, const QVariant &value) const; 44 virtual QVariant getChildValue(const QString &childId) const; 45 virtual void setChildValue(const QString &childId, const QVariant &value); 46 47 MWMDIWindow *getContextWindow() const; 48 49 protected: 50 virtual bool childCanBeSaved(QWidget *child) const; 51 virtual QString getChildId(QWidget *child) const; 52 virtual bool childExists(const QString &childId) const; 53 virtual QWidget *getChildWidgetById(const QString &childId) const; 54 virtual QSet<QWidget *> getCompoundChildren() const; 55 56 QWidget *wrappedWidget; 57 MWMDIWindow *contextWindow; 58 bool widgetStateSaved; 59 }; 60 61 } // namespace U2 62 63 #endif // _U2_SAVABLE_WIDGET_H_ 64