File indexing completed on 2024-12-22 04:17:46
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 STRINGDIALOG_H 0014 #define STRINGDIALOG_H 0015 0016 #include "datadialog.h" 0017 #include "datatab.h" 0018 #include "datasource.h" 0019 0020 #include "ui_stringtab.h" 0021 0022 #include <QPointer> 0023 0024 #include "kst_export.h" 0025 0026 namespace Kst { 0027 0028 class StringTab : public DataTab, Ui::StringTab { 0029 Q_OBJECT 0030 public: 0031 friend class DialogSI; 0032 enum StringMode { DataString, GeneratedString }; 0033 0034 explicit StringTab(ObjectStore *store, QWidget *parent = 0); 0035 virtual ~StringTab(); 0036 0037 StringMode stringMode() const { return _mode; } 0038 void setStringMode(StringMode mode); 0039 0040 QString value() const; 0041 void setValue(const QString &value); 0042 0043 DataSourcePtr dataSource() const; 0044 void setDataSource(DataSourcePtr dataSource); 0045 0046 QString file() const; 0047 void setFile(const QString &file); 0048 0049 QString field() const; 0050 void setField(const QString &field); 0051 0052 int frame() const; 0053 bool frameDirty() const; 0054 void setFrame(int frame); 0055 0056 void setFieldList(const QStringList &fieldList); 0057 0058 void hideGeneratedOptions(); 0059 void hideDataOptions(); 0060 Q_SIGNALS: 0061 void valueChanged(); 0062 void sourceChanged(); 0063 0064 private Q_SLOTS: 0065 void readFromSourceClicked(); 0066 void generateClicked(); 0067 void textChanged(); 0068 void fileNameChanged(const QString &file); 0069 void fieldChanged(const QString &field); 0070 void showConfigWidget(); 0071 void sourceValid(QString filename, int requestID); 0072 void enableFrames(); 0073 0074 private: 0075 void updateDataSource(); 0076 StringMode _mode; 0077 ObjectStore *_store; 0078 DataSourcePtr _dataSource; 0079 int _requestID; 0080 QString _current_field; 0081 }; 0082 0083 class StringDialog : public DataDialog { 0084 Q_OBJECT 0085 public: 0086 friend class DialogSI; 0087 explicit StringDialog(ObjectPtr dataObject, QWidget *parent = 0); 0088 virtual ~StringDialog(); 0089 0090 protected: 0091 // virtual QString tagString() const; 0092 virtual ObjectPtr createNewDataObject(); 0093 virtual ObjectPtr createNewGeneratedString(); 0094 virtual ObjectPtr createNewDataString(); 0095 virtual ObjectPtr editExistingDataObject() const; 0096 0097 private: 0098 void configureTab(ObjectPtr object); 0099 0100 private Q_SLOTS: 0101 void updateButtons(); 0102 0103 private: 0104 StringTab *_stringTab; 0105 0106 }; 0107 0108 } 0109 0110 #endif 0111 0112 // vim: ts=2 sw=2 et