Switch to unified view

a/src/qtgui/confgui/confgui.cpp b/src/qtgui/confgui/confgui.cpp
1
#ifndef lint
1
#ifndef lint
2
static char rcsid[] = "@(#$Id: confgui.cpp,v 1.5 2007-10-01 06:35:31 dockes Exp $ (C) 2005 J.F.Dockes";
2
static char rcsid[] = "@(#$Id: confgui.cpp,v 1.6 2007-10-07 20:22:55 dockes Exp $ (C) 2005 J.F.Dockes";
3
#endif
3
#endif
4
4
5
#include <stdio.h>
5
#include <stdio.h>
6
6
7
#include <qglobal.h>
7
#include <qglobal.h>
...
...
83
    char buf[30];
83
    char buf[30];
84
    sprintf(buf, "%d", value);
84
    sprintf(buf, "%d", value);
85
    m_cflink->set(string(buf));
85
    m_cflink->set(string(buf));
86
}
86
}
87
87
88
void ConfParamW::loadValue()
89
{
90
91
}
92
93
bool ConfParamW::createCommon(const QString& lbltxt, const QString& tltptxt)
88
bool ConfParamW::createCommon(const QString& lbltxt, const QString& tltptxt)
94
{
89
{
95
    m_hl = new QHBOXLAYOUT(this);
90
    m_hl = new QHBOXLAYOUT(this);
96
    m_hl->setSpacing(spacing);
91
    m_hl->setSpacing(spacing);
97
92
...
...
119
{
114
{
120
    if (!createCommon(lbltxt, tltptxt))
115
    if (!createCommon(lbltxt, tltptxt))
121
    return;
116
    return;
122
117
123
    m_sb = new QSpinBox(this);
118
    m_sb = new QSpinBox(this);
124
    //    sb->setMinimum(minvalue);
125
    m_sb->setMinValue(minvalue);
119
    m_sb->setMinValue(minvalue);
126
    //    sb->setMaximum(maxvalue);
127
    m_sb->setMaxValue(maxvalue);
120
    m_sb->setMaxValue(maxvalue);
128
    m_sb->setSizePolicy(QSizePolicy(QSizePolicy::Fixed,
121
    m_sb->setSizePolicy(QSizePolicy(QSizePolicy::Fixed,
129
                  QSizePolicy::Fixed,
122
                    QSizePolicy::Fixed,
130
                  0,  // Horizontal stretch
123
                    0,  // Horizontal stretch
131
                  0,  // Vertical stretch
124
                    0,  // Vertical stretch
132
                  m_sb->sizePolicy().hasHeightForWidth() ) );
125
                    m_sb->sizePolicy().hasHeightForWidth()));
133
    m_hl->addWidget(m_sb);
126
    m_hl->addWidget(m_sb);
134
127
135
    QFRAME *fr = new QFRAME(this);
128
    QFRAME *fr = new QFRAME(this);
136
    fr->setSizePolicy(QSizePolicy(QSizePolicy::Preferred,
129
    fr->setSizePolicy(QSizePolicy(QSizePolicy::Preferred,
137
                  QSizePolicy::Fixed,
130
                  QSizePolicy::Fixed,
138
                  1,  // Horizontal stretch
131
                  1,  // Horizontal stretch
139
                  0,  // Vertical stretch
132
                  0,  // Vertical stretch
140
                  fr->sizePolicy().hasHeightForWidth() ) );
133
                  fr->sizePolicy().hasHeightForWidth() ) );
141
    m_hl->addWidget(fr);
134
    m_hl->addWidget(fr);
142
143
135
144
    loadValue();
136
    loadValue();
145
137
146
    QObject::connect(m_sb, SIGNAL(valueChanged(int)), 
138
    QObject::connect(m_sb, SIGNAL(valueChanged(int)), 
147
             this, SLOT(setValue(int)));
139
             this, SLOT(setValue(int)));
...
...
160
    : ConfParamW(parent, cflink)
152
    : ConfParamW(parent, cflink)
161
{
153
{
162
    if (!createCommon(lbltxt, tltptxt))
154
    if (!createCommon(lbltxt, tltptxt))
163
    return;
155
    return;
164
    m_le = new QLineEdit(this);
156
    m_le = new QLineEdit(this);
165
    //    m_le->setMinimumSize( QSize( 200, 0 ) );
166
157
167
    loadValue();
158
    loadValue();
168
159
169
    m_le->setSizePolicy(QSizePolicy(QSizePolicy::Preferred, 
160
    m_le->setSizePolicy(QSizePolicy(QSizePolicy::Preferred, 
170
                  QSizePolicy::Fixed,
161
                    QSizePolicy::Fixed,
171
                  1,  // Horizontal stretch
162
                    1,  // Horizontal stretch
172
                  0,  // Vertical stretch
163
                    0,  // Vertical stretch
173
                  m_le->sizePolicy().hasHeightForWidth() ) );
164
                    m_le->sizePolicy().hasHeightForWidth()));
174
165
175
    m_hl->addWidget(m_le);
166
    m_hl->addWidget(m_le);
176
167
177
    QObject::connect(m_le, SIGNAL(textChanged(const QString&)), 
168
    QObject::connect(m_le, SIGNAL(textChanged(const QString&)), 
178
             this, SLOT(setValue(const QString&)));
169
             this, SLOT(setValue(const QString&)));
...
...
195
    if (!createCommon(lbltxt, tltptxt))
186
    if (!createCommon(lbltxt, tltptxt))
196
    return;
187
    return;
197
    m_cmb = new QComboBox(this);
188
    m_cmb = new QComboBox(this);
198
    m_cmb->insertStringList(sl);
189
    m_cmb->insertStringList(sl);
199
    m_cmb->setEditable(false);
190
    m_cmb->setEditable(false);
191
    m_cmb->setSizePolicy(QSizePolicy(QSizePolicy::Preferred, 
192
                   QSizePolicy::Fixed,
193
                   1,  // Horizontal stretch
194
                   0,  // Vertical stretch
195
                   m_cmb->sizePolicy().hasHeightForWidth()));
196
    m_hl->addWidget(m_cmb);
200
197
201
    loadValue();
198
    loadValue();
202
203
    m_cmb->setSizePolicy(QSizePolicy(QSizePolicy::Preferred, 
204
                QSizePolicy::Fixed,
205
                1,  // Horizontal stretch
206
                0,  // Vertical stretch
207
                 m_cmb->sizePolicy().hasHeightForWidth() ) );
208
209
    m_hl->addWidget(m_cmb);
210
211
    QObject::connect(m_cmb, SIGNAL(activated(const QString&)), 
199
    QObject::connect(m_cmb, SIGNAL(activated(const QString&)), 
212
             this, SLOT(setValue(const QString&)));
200
             this, SLOT(setValue(const QString&)));
213
}
201
}
214
202
215
void ConfParamCStrW::loadValue()
203
void ConfParamCStrW::loadValue()
...
...
224
    }
212
    }
225
    }
213
    }
226
}
214
}
227
215
228
ConfParamBoolW::ConfParamBoolW(QWidget *parent, ConfLink cflink, 
216
ConfParamBoolW::ConfParamBoolW(QWidget *parent, ConfLink cflink, 
229
                 const QString& lbltxt,
217
                   const QString& lbltxt,
230
                 const QString& tltptxt)
218
                   const QString& tltptxt)
231
    : ConfParamW(parent, cflink)
219
    : ConfParamW(parent, cflink)
232
{
220
{
233
    // No createCommon because the checkbox has a label
221
    // No createCommon because the checkbox has a label
234
    m_hl = new QHBOXLAYOUT(this);
222
    m_hl = new QHBOXLAYOUT(this);
235
    m_hl->setSpacing(spacing);
223
    m_hl->setSpacing(spacing);
236
224
237
    m_cb = new QCheckBox(lbltxt, this);
225
    m_cb = new QCheckBox(lbltxt, this);
238
239
    m_cb->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, 
226
    m_cb->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, 
240
                  QSizePolicy::Fixed,
227
                  QSizePolicy::Fixed,
241
                  0,  // Horizontal stretch
228
                  0,  // Horizontal stretch
242
                  0,  // Vertical stretch
229
                  0,  // Vertical stretch
243
                  m_cb->sizePolicy().hasHeightForWidth() ) );
230
                  m_cb->sizePolicy().hasHeightForWidth()));
244
    QToolTip::add(m_cb, tltptxt);
231
    QToolTip::add(m_cb, tltptxt);
245
    m_hl->addWidget(m_cb);
232
    m_hl->addWidget(m_cb);
246
233
247
    QFRAME *fr = new QFRAME(this);
234
    QFRAME *fr = new QFRAME(this);
248
    fr->setSizePolicy(QSizePolicy(QSizePolicy::Preferred,
235
    fr->setSizePolicy(QSizePolicy(QSizePolicy::Preferred,
249
                  QSizePolicy::Fixed,
236
                  QSizePolicy::Fixed,
250
                  1,  // Horizontal stretch
237
                  1,  // Horizontal stretch
251
                  0,  // Vertical stretch
238
                  0,  // Vertical stretch
252
                  fr->sizePolicy().hasHeightForWidth() ) );
239
                  fr->sizePolicy().hasHeightForWidth()));
253
    m_hl->addWidget(fr);
240
    m_hl->addWidget(fr);
254
241
255
    QObject::connect(m_cb, SIGNAL(toggled(bool)), 
242
    QObject::connect(m_cb, SIGNAL(toggled(bool)), 
256
             this, SLOT(setValue(bool)));
243
             this, SLOT(setValue(bool)));
257
}
244
}
...
...
274
    return;
261
    return;
275
262
276
    m_le = new QLineEdit(this);
263
    m_le = new QLineEdit(this);
277
    m_le->setMinimumSize(QSize(150, 0 ));
264
    m_le->setMinimumSize(QSize(150, 0 ));
278
    m_le->setSizePolicy(QSizePolicy(QSizePolicy::Preferred, 
265
    m_le->setSizePolicy(QSizePolicy(QSizePolicy::Preferred, 
279
                  QSizePolicy::Fixed,
266
                    QSizePolicy::Fixed,
280
                  1,  // Horizontal stretch
267
                    1,  // Horizontal stretch
281
                  0,  // Vertical stretch
268
                    0,  // Vertical stretch
282
                  m_le->sizePolicy().hasHeightForWidth() ) );
269
                    m_le->sizePolicy().hasHeightForWidth()));
283
    m_hl->addWidget(m_le);
270
    m_hl->addWidget(m_le);
284
271
285
    QPushButton *pb = new QPushButton(this);
272
    QPushButton *pb = new QPushButton(this);
286
    pb->setText(tr("Browse"));
273
    pb->setText(tr("Browse"));
287
    pb->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, 
274
    pb->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, 
288
                  QSizePolicy::Fixed,
275
                  QSizePolicy::Fixed,
289
                  0,  // Horizontal stretch
276
                  0,  // Horizontal stretch
290
                  0,  // Vertical stretch
277
                  0,  // Vertical stretch
291
                  pb->sizePolicy().hasHeightForWidth() ) );
278
                  pb->sizePolicy().hasHeightForWidth()));
292
    m_hl->addWidget(pb);
279
    m_hl->addWidget(pb);
293
280
294
281
295
    QObject::connect(pb, SIGNAL(clicked()), this, SLOT(showBrowserDialog()));
282
    QObject::connect(pb, SIGNAL(clicked()), this, SLOT(showBrowserDialog()));
296
    QObject::connect(m_le, SIGNAL(textChanged(const QString&)), 
283
    QObject::connect(m_le, SIGNAL(textChanged(const QString&)), 
...
...
311
    if (!s.isEmpty()) 
298
    if (!s.isEmpty()) 
312
    m_le->setText(s);
299
    m_le->setText(s);
313
}
300
}
314
301
315
ConfParamSLW::ConfParamSLW(QWidget *parent, ConfLink cflink, 
302
ConfParamSLW::ConfParamSLW(QWidget *parent, ConfLink cflink, 
316
                 const QString& lbltxt,
303
               const QString& lbltxt,
317
                 const QString& tltptxt)
304
               const QString& tltptxt)
318
    : ConfParamW(parent, cflink)
305
    : ConfParamW(parent, cflink)
319
{
306
{
320
    // Can't use createCommon here cause we want the buttons below the label
307
    // Can't use createCommon here cause we want the buttons below the label
321
    m_hl = new QHBOXLAYOUT(this);
308
    m_hl = new QHBOXLAYOUT(this);
322
    m_hl->setSpacing(spacing);
309
    m_hl->setSpacing(spacing);
...
...
327
    QLabel *tl = new QLabel(this);
314
    QLabel *tl = new QLabel(this);
328
    tl->setSizePolicy(QSizePolicy(QSizePolicy::Preferred, 
315
    tl->setSizePolicy(QSizePolicy(QSizePolicy::Preferred, 
329
                  QSizePolicy::Fixed,
316
                  QSizePolicy::Fixed,
330
                  0,  // Horizontal stretch
317
                  0,  // Horizontal stretch
331
                  0,  // Vertical stretch
318
                  0,  // Vertical stretch
332
                  tl->sizePolicy().hasHeightForWidth() ) );
319
                  tl->sizePolicy().hasHeightForWidth()));
333
    tl->setText(lbltxt);
320
    tl->setText(lbltxt);
334
    QToolTip::add(tl, tltptxt);
321
    QToolTip::add(tl, tltptxt);
335
    /* qt4    tl->setProperty("toolTip", tltptxt);*/
336
    vl1->addWidget(tl);
322
    vl1->addWidget(tl);
337
323
338
    QPushButton *pbA = new QPushButton(this);
324
    QPushButton *pbA = new QPushButton(this);
339
    pbA->setText(tr("+"));
325
    pbA->setText(tr("+"));
340
    pbA->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, 
326
    pbA->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, 
341
                   QSizePolicy::Fixed,
327
                   QSizePolicy::Fixed,
342
                   0,  // Horizontal stretch
328
                   0,  // Horizontal stretch
343
                   0,  // Vertical stretch
329
                   0,  // Vertical stretch
344
                   pbA->sizePolicy().hasHeightForWidth() ) );
330
                   pbA->sizePolicy().hasHeightForWidth()));
345
    hl1->addWidget(pbA);
331
    hl1->addWidget(pbA);
346
    QPushButton *pbD = new QPushButton(this);
332
    QPushButton *pbD = new QPushButton(this);
347
    pbD->setText(tr("-"));
333
    pbD->setText(tr("-"));
348
    pbD->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, 
334
    pbD->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, 
349
                   QSizePolicy::Fixed,
335
                   QSizePolicy::Fixed,
350
                   0,  // Horizontal stretch
336
                   0,  // Horizontal stretch
351
                   0,  // Vertical stretch
337
                   0,  // Vertical stretch
352
                   pbD->sizePolicy().hasHeightForWidth() ) );
338
                   pbD->sizePolicy().hasHeightForWidth()));
353
354
    hl1->addWidget(pbD);
339
    hl1->addWidget(pbD);
340
355
    vl1->addLayout(hl1);
341
    vl1->addLayout(hl1);
356
    m_hl->addLayout(vl1);
342
    m_hl->addLayout(vl1);
357
343
358
359
    m_lb = new QLISTBOX(this);
344
    m_lb = new QLISTBOX(this);
345
    m_lb->setSelectionMode(QLISTBOX::Extended);
346
    m_lb->setSizePolicy(QSizePolicy(QSizePolicy::Preferred, 
347
                  QSizePolicy::Preferred,
348
                  1,  // Horizontal stretch
349
                  1,  // Vertical stretch
350
                  m_lb->sizePolicy().hasHeightForWidth()));
351
    m_hl->addWidget(m_lb);
352
353
    this->setSizePolicy(QSizePolicy(QSizePolicy::Preferred, 
354
                  QSizePolicy::Preferred,
355
                  1,  // Horizontal stretch
356
                  1,  // Vertical stretch
357
                  this->sizePolicy().hasHeightForWidth()));
360
358
361
    loadValue();
359
    loadValue();
362
363
    m_lb->setSelectionMode(QLISTBOX::Extended);
364
365
    m_lb->setSizePolicy(QSizePolicy(QSizePolicy::Preferred, 
366
                QSizePolicy::Preferred,
367
                1,  // Horizontal stretch
368
                1,  // Vertical stretch
369
                m_lb->sizePolicy().hasHeightForWidth() ) );
370
    m_hl->addWidget(m_lb);
371
372
    this->setSizePolicy(QSizePolicy(QSizePolicy::Preferred, 
373
                QSizePolicy::Preferred,
374
                1,  // Horizontal stretch
375
                1,  // Vertical stretch
376
                this->sizePolicy().hasHeightForWidth() ) );
377
378
    
379
    QObject::connect(pbA, SIGNAL(clicked()), this, SLOT(showInputDialog()));
360
    QObject::connect(pbA, SIGNAL(clicked()), this, SLOT(showInputDialog()));
380
    QObject::connect(pbD, SIGNAL(clicked()), this, SLOT(deleteSelected()));
361
    QObject::connect(pbD, SIGNAL(clicked()), this, SLOT(deleteSelected()));
381
}
362
}
382
363
383
void ConfParamSLW::loadValue()
364
void ConfParamSLW::loadValue()
...
...
474
    }
455
    }
475
    }
456
    }
476
}
457
}
477
458
478
} // Namespace confgui
459
} // Namespace confgui
479