summaryrefslogtreecommitdiff
path: root/src/export-import/CsvDialog.h
blob: f50cd62cca2970981708fa5961b11dd86b954872 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#ifndef CSV_DIALOG_H
#define CSV_DIALOG_H

#include <QtCore>
#include <QtWidgets>

class CsvDialog: public QDialog
{
    Q_OBJECT

public:
    CsvDialog(QWidget* parent);

protected:
    static QString setCharVisibility(const QString& input, bool visible);

protected:
    void init();
    virtual QLayout* createLeftGroupLayout() = 0;
    virtual QString getLeftGroupTitle() = 0;
    QWidget* createCharSetCombo();
    virtual QLayout* createSeparatorsLayout() = 0;
    QWidget* createFieldSeparatorWidget(const QString& additionalSeparators = "");
    QWidget* createTextDelimiterBox();
    QWidget* createTextDelimiterCombo();
    QWidget* createCommentCharCombo();
    QComboBox* createEditableCombo(const QStringList& items);
    virtual QLayout* createPreviewLt() = 0;
    QDialogButtonBox* createButtonBox();
    QTextCodec* getTextCodec();
    QChar getTextDelimiterChar() const;

protected slots:
    virtual void updatePreview() = 0;
    void updateTextDelimiterCombo();

private:
    QLayout* createMainLayout();
    void connectControlsToPreview();
    QLayout* createTopLayout();
    QGroupBox* createLeftGroup();
    QGroupBox* createSeparatorsGroup();
    void doUpdatePreview() { updatePreview(); }

private slots:
    void showInvisibleInSeparatorsEdit();
    void insertTabToSeparators();

protected:
    static QChar SpaceChar;
    static QChar TabChar;
    static QString ExtendedTab;

protected:
    QComboBox* charSetCombo;
    QLineEdit* separatorsEdit;
    QCheckBox* textDelimiterCB;
    QComboBox* textDelimiterCombo;
    QComboBox* commentCharCombo;
};

#endif