optiondialog.h 3.46 KB
Newer Older
Joachim Eibl's avatar
Joachim Eibl committed
1 2
/*
 *   kdiff3 - Text Diff And Merge Tool
Joachim Eibl's avatar
Joachim Eibl committed
3
 *   Copyright (C) 2002-2007  Joachim Eibl, joachim.eibl at gmx.de
Joachim Eibl's avatar
Joachim Eibl committed
4 5 6 7 8 9 10 11 12 13 14 15 16
 *
 *   This program is free software; you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation; either version 2 of the License, or
 *   (at your option) any later version.
 *
 *   This program is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with this program; if not, write to the Free Software
17
 *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
Joachim Eibl's avatar
Joachim Eibl committed
18 19 20 21 22 23
 *
 */

#ifndef OPTION_DIALOG_H
#define OPTION_DIALOG_H

Joachim Eibl's avatar
Joachim Eibl committed
24
#include <QStringList>
Michael Reeves's avatar
Michael Reeves committed
25
#include <QGroupBox>
Michael Reeves's avatar
Michael Reeves committed
26 27 28 29

#include <KPageDialog>
#include <KSharedConfig>

Joachim Eibl's avatar
Joachim Eibl committed
30 31
#include <list>

32 33
#include "options.h"

Ragnar Thomsen's avatar
Ragnar Thomsen committed
34 35 36
class QLabel;
class QPlainTextEdit;

Joachim Eibl's avatar
Joachim Eibl committed
37
class OptionItem;
Joachim Eibl's avatar
Joachim Eibl committed
38 39
class OptionCheckBox;
class OptionEncodingComboBox;
Joachim Eibl's avatar
Joachim Eibl committed
40
class OptionLineEdit;
Joachim Eibl's avatar
Joachim Eibl committed
41 42
class KKeyDialog;

Joachim Eibl's avatar
0.9.93  
Joachim Eibl committed
43
class OptionDialog : public KPageDialog
Joachim Eibl's avatar
Joachim Eibl committed
44 45 46 47 48
{
   Q_OBJECT

public:

49
    explicit OptionDialog( bool bShowDirMergeSettings, QWidget *parent = nullptr );
50
    ~OptionDialog( void ) override;
Joachim Eibl's avatar
0.9.93  
Joachim Eibl committed
51
    QString parseOptions( const QStringList& optionList );
Joachim Eibl's avatar
Joachim Eibl committed
52 53
    QString calcOptionHelp();

54
    Options m_options;
Joachim Eibl's avatar
Joachim Eibl committed
55

Joachim Eibl's avatar
0.9.93  
Joachim Eibl committed
56 57
    void saveOptions(KSharedConfigPtr config);
    void readOptions(KSharedConfigPtr config);
Joachim Eibl's avatar
Joachim Eibl committed
58 59 60 61 62

    void setState(); // Must be called before calling exec();

    void addOptionItem(OptionItem*);
    KKeyDialog* m_pKeyDialog;
63
protected Q_SLOTS:
Joachim Eibl's avatar
Joachim Eibl committed
64 65 66
    virtual void slotDefault( void );
    virtual void slotOk( void );
    virtual void slotApply( void );
67
    //virtual void buttonClicked( QAbstractButton* );
Michael Reeves's avatar
Michael Reeves committed
68 69
    virtual void helpRequested();
    
Joachim Eibl's avatar
Joachim Eibl committed
70
    void slotEncodingChanged();
Joachim Eibl's avatar
Joachim Eibl committed
71
    void slotHistoryMergeRegExpTester();
72
Q_SIGNALS:
Joachim Eibl's avatar
0.9.93  
Joachim Eibl committed
73
    void applyDone();
Joachim Eibl's avatar
Joachim Eibl committed
74 75
private:
    void resetToDefaults();
Joachim Eibl's avatar
0.9.80  
Joachim Eibl committed
76

Joachim Eibl's avatar
Joachim Eibl committed
77
    std::list<OptionItem*> m_optionItemList;
Michael Reeves's avatar
Michael Reeves committed
78

79
    //QDialogButtonBox *mButtonBox;
Joachim Eibl's avatar
Joachim Eibl committed
80 81
    OptionCheckBox* m_pSameEncoding;
    OptionEncodingComboBox* m_pEncodingAComboBox;
Joachim Eibl's avatar
Joachim Eibl committed
82
    OptionCheckBox* m_pAutoDetectUnicodeA;
Joachim Eibl's avatar
Joachim Eibl committed
83
    OptionEncodingComboBox* m_pEncodingBComboBox;
Joachim Eibl's avatar
Joachim Eibl committed
84
    OptionCheckBox* m_pAutoDetectUnicodeB;
Joachim Eibl's avatar
Joachim Eibl committed
85
    OptionEncodingComboBox* m_pEncodingCComboBox;
Joachim Eibl's avatar
Joachim Eibl committed
86
    OptionCheckBox* m_pAutoDetectUnicodeC;
Joachim Eibl's avatar
Joachim Eibl committed
87
    OptionEncodingComboBox* m_pEncodingOutComboBox;
Joachim Eibl's avatar
Joachim Eibl committed
88
    OptionCheckBox* m_pAutoSelectOutEncoding;
Joachim Eibl's avatar
Joachim Eibl committed
89
    OptionEncodingComboBox* m_pEncodingPPComboBox;
Joachim Eibl's avatar
Joachim Eibl committed
90 91 92 93 94 95
    OptionCheckBox* m_pHistoryAutoMerge;
    OptionLineEdit* m_pAutoMergeRegExpLineEdit;
    OptionLineEdit* m_pHistoryStartRegExpLineEdit;
    OptionLineEdit* m_pHistoryEntryStartRegExpLineEdit;
    OptionCheckBox* m_pHistoryMergeSorting;
    OptionLineEdit* m_pHistorySortKeyOrderLineEdit;
Joachim Eibl's avatar
Joachim Eibl committed
96 97 98 99 100 101

private:
    void setupFontPage();
    void setupColorPage();
    void setupEditPage();
    void setupDiffPage();
Joachim Eibl's avatar
Joachim Eibl committed
102
    void setupMergePage();
Joachim Eibl's avatar
Joachim Eibl committed
103 104
    void setupDirectoryMergePage();
    void setupKeysPage();
Joachim Eibl's avatar
Joachim Eibl committed
105
    void setupRegionalPage();
Joachim Eibl's avatar
Joachim Eibl committed
106
    void setupIntegrationPage();
Joachim Eibl's avatar
0.9.80  
Joachim Eibl committed
107
    void setupOtherOptions();
Joachim Eibl's avatar
Joachim Eibl committed
108 109 110
};


Michael Reeves's avatar
Michael Reeves committed
111 112 113 114 115
class FontChooser : public QGroupBox
{
   Q_OBJECT
   QFont m_font;
   QPushButton* m_pSelectFont;
Ragnar Thomsen's avatar
Ragnar Thomsen committed
116
   QPlainTextEdit* m_pExampleTextEdit;
Michael Reeves's avatar
Michael Reeves committed
117 118
   QLabel* m_pLabel;
public:
Michael Reeves's avatar
Michael Reeves committed
119
   explicit FontChooser( QWidget* pParent );
Michael Reeves's avatar
Michael Reeves committed
120 121 122 123 124
   QFont font();
   void setFont( const QFont&, bool );
private slots:
   void slotSelectFont();
};
Joachim Eibl's avatar
Joachim Eibl committed
125

Joachim Eibl's avatar
Joachim Eibl committed
126 127 128 129 130 131 132 133
#endif