File indexing completed on 2024-06-02 04:34:58
0001 /*************************************************************************** 0002 * * 0003 * copyright : (C) 2007 The University of Toronto * 0004 * netterfield@astro.utoronto.ca * 0005 * * 0006 * This program is free software; you can redistribute it and/or modify * 0007 * it under the terms of the GNU General Public License as published by * 0008 * the Free Software Foundation; either version 2 of the License, or * 0009 * (at your option) any later version. * 0010 * * 0011 ***************************************************************************/ 0012 0013 #ifndef DATADIALOG_H 0014 #define DATADIALOG_H 0015 0016 #include "dialog.h" 0017 0018 #include "kst_export.h" 0019 0020 #include "dataobject.h" 0021 0022 class QLineEdit; 0023 class QCheckBox; 0024 class QLabel; 0025 0026 namespace Kst { 0027 0028 class DataTab; 0029 class Document; 0030 class EditMultipleWidget; 0031 0032 class DataDialog : public Dialog { 0033 Q_OBJECT 0034 public: 0035 friend class DialogLauncherSI; 0036 friend class DialogSI; 0037 enum EditMode { New, Edit, EditMultiple }; 0038 explicit DataDialog(ObjectPtr dataObject = 0, QWidget *parent = 0, bool edit_multiple = true); 0039 virtual ~DataDialog(); 0040 0041 EditMode editMode() const { return _mode; } 0042 void addDataTab(DataTab *tab); 0043 QString dataObjectName() const; 0044 0045 void editMultiple(const QList<ObjectPtr> &objects); 0046 0047 protected: 0048 virtual QString tagString() const; 0049 void setTagString(const QString &tagString); 0050 void setShortName(const QString &name); 0051 0052 bool tagStringAuto() const; 0053 0054 ObjectPtr dataObject() const { return _dataObject; } 0055 void setDataObject(ObjectPtr dataObject) { _dataObject = dataObject; } 0056 0057 virtual ObjectPtr createNewDataObject() = 0; 0058 virtual ObjectPtr editExistingDataObject() const = 0; 0059 0060 Document *_document; 0061 EditMultipleWidget *_editMultipleWidget; 0062 QString _dataObjectName; 0063 0064 virtual bool dialogValid() const {return true;} 0065 public Q_SLOTS: 0066 void slotEditMultiple(); 0067 0068 private Q_SLOTS: 0069 void slotApply(); 0070 void modified(); 0071 void clearModified(); 0072 0073 Q_SIGNALS: 0074 void editMultipleMode(); 0075 void editSingleMode(); 0076 0077 private: 0078 void createGui(bool edit_multiple = true); 0079 void updateApplyButton(); 0080 0081 private: 0082 QLineEdit *_tagString; 0083 QCheckBox *_tagStringAuto; 0084 QLabel *_shortName; 0085 QLabel *_nameLabel; 0086 QPushButton *_editMultipleButton; 0087 ObjectPtr _dataObject; 0088 EditMode _mode; 0089 bool _modified; 0090 int _coreWindowWidth; 0091 }; 0092 0093 } 0094 0095 #endif 0096 0097 // vim: ts=2 sw=2 et