42
41
, _noHistoryButton(0)
43
42
, _fixedHistoryButton(0)
44
43
, _unlimitedHistoryButton(0)
45
, _saveToCurrentProfileButton(0)
47
, _defaultMode(FixedSizeHistory)
48
, _defaultLineCount(1000)
50
46
// basic dialog properties
51
setPlainCaption( i18n("Scrollback Options") );
52
setButtons( Default | Ok | Cancel );
47
setPlainCaption( i18n("Adjust Scrollback") );
48
setButtons( KDialog::Ok | KDialog::Cancel );
49
setDefaultButton( KDialog::Ok );
60
56
QVBoxLayout* dialogLayout = new QVBoxLayout(dialogWidget);
58
_noHistoryButton = new QRadioButton( i18n("No scrollback") );
59
_fixedHistoryButton = new QRadioButton( i18n("Fixed size scrollback: ") );
60
_unlimitedHistoryButton = new QRadioButton( i18n("Unlimited scrollback") );
62
62
QButtonGroup* modeGroup = new QButtonGroup(this);
64
_noHistoryButton = new QRadioButton( i18n("No scrollback") );
65
_fixedHistoryButton = new QRadioButton( i18n("Fixed size scrollback: ") );
66
_unlimitedHistoryButton = new QRadioButton( i18n("Unlimited scrollback") );
67
_saveToCurrentProfileButton = new QCheckBox( i18n("Save to current profile") );
69
63
modeGroup->addButton(_noHistoryButton);
70
64
modeGroup->addButton(_fixedHistoryButton);
71
65
modeGroup->addButton(_unlimitedHistoryButton);
73
67
_lineCountBox = new KIntSpinBox(this);
75
69
// minimum lines = 1 ( for 0 lines , "No History" mode should be used instead )
76
// maximum lines is abritrarily chosen, I do not think it is sensible to allow this
70
// maximum lines is arbitrarily chosen, I do not think it is sensible to allow this
77
71
// to be set to a very large figure because that will use large amounts of memory,
78
72
// if a very large log is required, "Unlimited History" mode should be used
79
73
_lineCountBox->setRange( 1 , 100000 );
81
// 1000 lines was the default in the KDE 3 series
83
_lineCountBox->setValue( _defaultLineCount );
75
_lineCountBox->setValue( HistorySizeDialog::defaultLineCount );
76
_lineCountBox->setSingleStep( HistorySizeDialog::defaultLineCount / 10 );
85
_lineCountBox->setSingleStep( _defaultLineCount / 10 );
78
_fixedHistoryButton->setFocusProxy(_lineCountBox);
79
connect( _fixedHistoryButton , SIGNAL(clicked()) ,
80
_lineCountBox , SLOT(selectAll()) );
87
82
QLabel* lineCountLabel = new QLabel(i18n("lines"),this);
88
84
QHBoxLayout* lineCountLayout = new QHBoxLayout();
90
_fixedHistoryButton->setFocusProxy(_lineCountBox);
92
connect( _fixedHistoryButton , SIGNAL(clicked()) , _lineCountBox , SLOT(selectAll()) );
93
85
lineCountLayout->addWidget(_fixedHistoryButton);
94
86
lineCountLayout->addWidget(_lineCountBox);
95
87
lineCountLayout->addWidget(lineCountLabel);
89
QLabel* warningLabel = new QLabel(i18n("<center>The adjustment is only temporary</center>"),this);
90
warningLabel->setStyleSheet("text-align:center; font-weight:normal; color:palette(dark)");
92
dialogLayout->addWidget(warningLabel);
93
dialogLayout->insertSpacing(-1, 5);
97
94
dialogLayout->addWidget(_noHistoryButton);
98
95
dialogLayout->addLayout(lineCountLayout);
99
96
dialogLayout->addWidget(_unlimitedHistoryButton);
100
dialogLayout->insertSpacing(3, 10);
101
dialogLayout->addWidget(_saveToCurrentProfileButton);
103
// select the fixed size mode by default
104
_fixedHistoryButton->click();
105
_fixedHistoryButton->setFocus( Qt::OtherFocusReason );
107
connect(this,SIGNAL(defaultClicked()),this,SLOT(useDefaults()));
97
dialogLayout->insertSpacing(-1, 10);
109
99
connect(this,SIGNAL(accepted()),this,SLOT(emitOptionsChanged()));
112
102
void HistorySizeDialog::emitOptionsChanged()
114
emit optionsChanged( mode() , lineCount(), saveToCurrentProfile() );
117
void HistorySizeDialog::setDefaultMode( HistoryMode mode ) { _defaultMode = mode; }
118
HistorySizeDialog::HistoryMode HistorySizeDialog::defaultMode() const { return _defaultMode; }
119
void HistorySizeDialog::setDefaultLineCount( int count ) { _defaultLineCount = count; }
120
int HistorySizeDialog::defaultLineCount() const { return _defaultLineCount; }
121
bool HistorySizeDialog::saveToCurrentProfile() const { return _saveToCurrentProfileButton->isChecked(); }
123
void HistorySizeDialog::useDefaults()
125
setMode( _defaultMode );
126
setLineCount( _defaultLineCount );
127
_saveToCurrentProfileButton->setChecked(false);
104
emit optionsChanged( mode() , lineCount() );
130
107
void HistorySizeDialog::setMode( HistoryMode mode )