37#ifdef HAVE_LONG_DOUBLE
38#undef HAVE_LONG_DOUBLE
41ConfigDlg::ConfigDlg(TQWidget *parent,
const char *name, DefStruct *defstruct)
42 : TQDialog(parent, name)
46 TQVBoxLayout *lay1 =
new TQVBoxLayout(
this );
47 lay1->setMargin( KDialog::marginHint() );
48 lay1->setSpacing( KDialog::spacingHint() );
50 box =
new TQGroupBox(0, TQt::Vertical, i18n(
"Defaults"),
this,
"box");
51 box->layout()->setSpacing(KDialog::spacingHint());
52 box->layout()->setMargin(KDialog::marginHint());
54 TQGridLayout *grid1 =
new TQGridLayout(box->layout(),8,2);
55 label1 =
new TQLabel(box);
56 label1->setText(i18n(
"Foreground color:"));
57 grid1->addWidget(label1,0,0);
59 button1 =
new KColorButton( box,
"button1" );
60 grid1->addWidget(button1,0,1);
61 button1->setColor( defst->forecolor );
63 connect(button1 , TQ_SIGNAL( changed(
const TQColor & ) ),
64 this, TQ_SLOT( set_fore_color(
const TQColor & ) ) );
66 label2 =
new TQLabel(box);
67 grid1->addWidget(label2,1,0);
68 label2->setText(i18n(
"Background color:"));
70 button2 =
new KColorButton( box,
"button2" );
71 grid1->addWidget(button2,1,1);
72 button2->setColor( defst->backcolor );
74 connect(button2 , TQ_SIGNAL( changed(
const TQColor & ) ),
75 this, TQ_SLOT( set_background_color(
const TQColor & ) ) );
81 label5 =
new TQLabel(box);
82 grid1->addWidget(label5,2,0);
83 label5->setText(i18n(
"Precision:"));
86#ifdef HAVE_LONG_DOUBLE
92 precspin =
new TQSpinBox( box );
93 precspin->setRange( 0, maxprec );
94 grid1->addWidget(precspin,2,1);
96 if( defst->precision <= maxprec)
97 precspin->setValue(defst->precision);
99 precspin->setValue(maxprec);
102 cb =
new TQCheckBox(box);
103 grid1->addWidget(cb,3,0);
104 cb->setText(i18n(
"Set fixed precision at:"));
106 cb->setChecked(
true);
109#ifdef HAVE_LONG_DOUBLE
115 precspin2 =
new TQSpinBox( box );
116 precspin2->setRange(0,fixprec);
117 grid1->addWidget(precspin2,3,1);
119 if( defst->fixedprecision <= fixprec)
120 precspin2->setValue(defst->fixedprecision);
122 precspin2->setValue(fixprec);
126 cb2 =
new TQCheckBox(box);
127 grid1->addWidget(cb2,4,0);
128 cb2->setText(i18n(
"Beep on error"));
130 cb2->setChecked(
true);
133 stylegroup =
new TQButtonGroup(box,
"stylegroup");
134 grid1->addMultiCellWidget(stylegroup,5,7,0,1);
135 stylegroup->setFrameStyle(TQFrame::NoFrame);
137 TQGridLayout *grid2 =
new TQGridLayout(stylegroup,2,2,KDialog::marginHint(), KDialog::spacingHint());
139 trigstyle =
new TQRadioButton(i18n(
"Trigonometry mode"),stylegroup,
"trigstyle");
140 grid2->addWidget(trigstyle,0,0);
141 trigstyle->adjustSize();
142 trigstyle->setChecked(defst->style == 0 );
144 statstyle =
new TQRadioButton(i18n(
"Statistical mode"),stylegroup,
"Stats");
145 grid2->addWidget(statstyle,1,0);
146 statstyle->adjustSize();
147 statstyle->setChecked(defst->style == 1 );
149 sheetstyle =
new TQRadioButton(i18n(
"Sheet mode"),stylegroup,
"Sheet");
150 grid2->addWidget(sheetstyle,2,0);
151 sheetstyle->adjustSize();
153 sheetstyle->setChecked(defst->style == 2 );
154 button3 =
new TQPushButton(stylegroup);
155 grid2->addWidget(button3,0,1);
156 button3->setText(i18n(
"Help"));
158 connect(button3,TQ_SIGNAL(clicked()),
this,TQ_SLOT(help()));
160 lay1->addWidget(box);
161 connect(parent,TQ_SIGNAL(applyButtonPressed()),TQ_SLOT(okButton()));
164void ConfigDlg::help()
168void ConfigDlg::okButton()
170 defst->precision = precspin->value();
171 defst->fixedprecision = precspin2->value();
172 defst->fixed = cb->isChecked();
173 defst->beep = cb2->isChecked();
176 if( trigstyle->isChecked())
178 else if ( statstyle->isChecked() )
184void ConfigDlg::cancelbutton()
189void ConfigDlg::set_fore_color(
const TQColor &_color)
191 defst->forecolor=_color;
194void ConfigDlg::set_background_color(
const TQColor &_color )
196 defst->backcolor=_color;
199#include "configdlg.moc"