File indexing completed on 2024-12-22 04:18:18

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 DATASOURCESELECTOR_H
0014 #define DATASOURCESELECTOR_H
0015 
0016 #include <QWidget>
0017 #include <QFileDialog>
0018 
0019 #include "kstwidgets_export.h"
0020 
0021 class QLineEdit;
0022 class QToolButton;
0023 
0024 namespace Kst {
0025 
0026 class KSTWIDGETS_EXPORT DataSourceSelector : public QWidget {
0027   Q_OBJECT
0028   Q_PROPERTY(QString file READ file WRITE setFile USER true)
0029   public:
0030     explicit DataSourceSelector(QWidget *parent = 0);
0031     virtual ~DataSourceSelector();
0032 
0033     QString file() const;
0034     void setMode(QFileDialog::FileMode mode) { _mode = mode; }
0035 
0036     QLineEdit *_fileEdit;
0037   public Q_SLOTS:
0038     void setFile(const QString &file);
0039     void updateFile(const QString &file);
0040 
0041   Q_SIGNALS:
0042     void changed(const QString &file);
0043 
0044   private Q_SLOTS:
0045     void chooseFile();
0046 
0047   private:
0048     void setup();
0049 
0050     QToolButton *_fileButton;
0051     QFileDialog::FileMode _mode;
0052     QString _file;
0053 };
0054 
0055 }
0056 
0057 #endif
0058 
0059 // vim: ts=2 sw=2 et