File indexing completed on 2024-12-29 04:11:43

0001 /***************************************************************************
0002  *                                                                         *
0003  *   Copyright : (C) 2003 The University of Toronto                        *
0004  *   email     : 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 ASCIICONFIGWIDGET_H
0014 #define ASCIICONFIGWIDGET_H
0015 
0016 #include "asciisource.h"
0017 #include "dataplugin.h"
0018 
0019 #include "ui_asciiconfig.h"
0020 
0021 class QTextStream;
0022 
0023 class AsciiConfigWidgetInternal : public QWidget, public Ui_AsciiConfig
0024 {
0025   Q_OBJECT
0026 
0027   public:
0028     explicit AsciiConfigWidgetInternal(QWidget *parent);
0029 
0030     AsciiSourceConfig config();
0031     void setConfig(const AsciiSourceConfig&);
0032     void setFilename(const QString& filename);
0033 
0034   private Q_SLOTS:
0035     void showBeginning();
0036     void showPreviewWindow();
0037 
0038   protected Q_SLOTS:
0039     void interpretationChanged(bool enabled);
0040     void testAsciiFormatString(QString format);
0041 
0042   private:
0043     const int _index_offset;
0044     QString _filename;
0045     QPlainTextEdit _previewWidget;
0046     QString readLine(QTextStream& in, int maxLength);
0047     void showBeginning(QPlainTextEdit* widget, int numberOfLines);
0048 };
0049 
0050 
0051 class AsciiConfigWidget : public Kst::DataSourceConfigWidget
0052 {
0053   Q_OBJECT
0054 
0055   public:
0056     explicit AsciiConfigWidget(QSettings&);
0057     ~AsciiConfigWidget();
0058 
0059     void load();
0060     void save();
0061     bool isOkAcceptabe() const;
0062     void setDialogParent(QDialog* parent);
0063 
0064     void setFilename(const QString& filename);
0065 
0066     AsciiConfigWidgetInternal *_ac;
0067     AsciiSourceConfig _oldConfig;
0068 
0069   public Q_SLOTS:
0070     void updateIndexVector();
0071     virtual void cancel();
0072 
0073   private:
0074     bool _busy_loading;
0075 };
0076 
0077 
0078 
0079 #endif
0080 // vim: ts=2 sw=2 et