~ubuntu-branches/ubuntu/intrepid/kdesdk/intrepid-updates

« back to all changes in this revision

Viewing changes to kcachegrind/kcachegrind/configdlg.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Riddell
  • Date: 2008-05-28 10:11:43 UTC
  • mto: This revision was merged to the branch mainline in revision 37.
  • Revision ID: james.westby@ubuntu.com-20080528101143-gzc3styjz1b70zxu
Tags: upstream-4.0.80
ImportĀ upstreamĀ versionĀ 4.0.80

Show diffs side-by-side

added added

removed removed

Lines of Context:
12
12
 
13
13
   You should have received a copy of the GNU General Public License
14
14
   along with this program; see the file COPYING.  If not, write to
15
 
   the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
16
 
   Boston, MA 02111-1307, USA.
 
15
   the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 
16
   Boston, MA 02110-1301, USA.
17
17
*/
18
18
 
19
19
/*
20
20
 * Configuration Dialog for KCachegrind
21
21
 */
22
22
 
23
 
#include <qcombobox.h>
24
 
#include <qcheckbox.h>
25
 
#include <qlineedit.h>
26
 
#include <qlistview.h>
27
 
#include <qdict.h>
28
 
#include <qmessagebox.h>
 
23
#include "configdlg.h"
 
24
 
 
25
#include <QComboBox>
 
26
#include <QCheckBox>
 
27
#include <QLineEdit>
 
28
#include <QMessageBox>
 
29
#include <Qt3Support/Q3ListView>
 
30
#include <Qt3Support/Q3Dict>
29
31
 
30
32
#include <kcolorbutton.h>
31
33
#include <kfiledialog.h>
32
34
#include <klocale.h>
33
35
#include <knumvalidator.h>
34
36
 
35
 
#include "configdlg.h"
36
37
#include "tracedata.h"
37
38
#include "configuration.h"
38
39
 
39
40
 
40
41
ConfigDlg::ConfigDlg(Configuration* c, TraceData* data,
41
 
                     QWidget* parent, const char* name)
42
 
  :ConfigDlgBase(parent, name)
 
42
                     QWidget* parent)
 
43
  :ConfigDlgBase(parent)
43
44
{
44
45
  _config = c;
45
46
  _data = data;
54
55
  contextEdit->setValidator(numValidator );
55
56
 
56
57
#if 0
57
 
  QListViewItem *oItem, *fItem, *cItem, *fnItem;
 
58
  Q3ListViewItem *oItem, *fItem, *cItem, *fnItem;
58
59
  oItem = new(colorList, i18n("ELF Objects"));
59
60
 
60
61
  fItem = new(colorList, i18n("Source Files"));
89
90
  connect(fileColor, SIGNAL(changed(const QColor &)),
90
91
          this, SLOT(fileColorChanged(const QColor &)));
91
92
 
 
93
  connect(PushButton2, SIGNAL(clicked()),SLOT(accept()));
 
94
  connect(PushButton1, SIGNAL(clicked()),SLOT(reject()));
92
95
  QString objectPrefix = TraceCost::typeName(TraceCost::Object);
93
96
  QString classPrefix = TraceCost::typeName(TraceCost::Class);
94
97
  QString filePrefix = TraceCost::typeName(TraceCost::File);
120
123
    fList.append((*fit).prettyName());
121
124
 
122
125
  // then already defined colors (have to check for duplicates!)
123
 
  QDictIterator<Configuration::ColorSetting> it( c->_colors );
 
126
  Q3DictIterator<Configuration::ColorSetting> it( c->_colors );
124
127
  for( ; it.current(); ++it ) {
125
128
    if ((*it)->automatic) continue;
126
129
 
142
145
  oList.sort();
143
146
  cList.sort();
144
147
  fList.sort();
145
 
  objectCombo->insertStringList(oList);
146
 
  classCombo->insertStringList(cList);
147
 
  fileCombo->insertStringList(fList);
 
148
  objectCombo->addItems(oList);
 
149
  classCombo->addItems(cList);
 
150
  fileCombo->addItems(fList);
148
151
 
149
152
  objectActivated(objectCombo->currentText());
150
153
  classActivated(classCombo->currentText());
154
157
 
155
158
  _dirItem = 0;
156
159
 
157
 
  QListViewItem* i = new QListViewItem(dirList, i18n("(always)"));
 
160
  Q3ListViewItem* i = new Q3ListViewItem(dirList, i18n("(always)"));
158
161
  i->setOpen(true);
159
162
  QStringList::Iterator sit = c->_generalSourceDirs.begin();
160
163
  for(; sit != c->_generalSourceDirs.end(); ++sit ) {
161
164
    QString d = (*sit);
162
165
    if (d.isEmpty()) d = "/";
163
 
    new QListViewItem(i, d);
 
166
    new Q3ListViewItem(i, d);
164
167
  }
165
168
  for ( oit = data->objectMap().begin();
166
169
        oit != data->objectMap().end(); ++oit ) {
167
170
    QString n = (*oit).name();
168
 
    i = new QListViewItem(dirList, n);
 
171
    i = new Q3ListViewItem(dirList, n);
169
172
    i->setOpen(true);
170
173
    QStringList* dirs = c->_objectSourceDirs[n];
171
174
    if (!dirs) continue;
174
177
    for(; sit != dirs->end(); ++sit ) {
175
178
      QString d = (*sit);
176
179
      if (d.isEmpty()) d = "/";
177
 
      new QListViewItem(i, d);
 
180
      new Q3ListViewItem(i, d);
178
181
    }
179
182
  }
180
183
 
181
 
  connect(dirList, SIGNAL(selectionChanged(QListViewItem*)),
182
 
          this, SLOT(dirsItemChanged(QListViewItem*)));
 
184
  connect(dirList, SIGNAL(selectionChanged(Q3ListViewItem*)),
 
185
          this, SLOT(dirsItemChanged(Q3ListViewItem*)));
183
186
  connect(addDirButton, SIGNAL(clicked()),
184
187
          this, SLOT(dirsAddPressed()));
185
188
  connect(deleteDirButton, SIGNAL(clicked()),
209
212
    else
210
213
      QMessageBox::warning(p, i18n("KCachegrind Configuration"),
211
214
                           i18n("The Maximum Number of List Items should be below 500."
212
 
                                "The previous set value (%1) will still be used.")
213
 
                           .arg(QString::number(c->_maxListCount)),
 
215
                                "The previous set value (%1) will still be used.",
 
216
                                c->_maxListCount),
214
217
                           QMessageBox::Ok, 0);
215
218
 
216
219
    c->_maxSymbolCount = dlg.symbolCount->text().toInt();
228
231
 
229
232
  if (s.isEmpty()) { _objectCS=0; return; }
230
233
 
231
 
  QString n = TraceCost::typeName(TraceCost::Object) + "-" + s;
 
234
  QString n = TraceCost::typeName(TraceCost::Object) + '-' + s;
232
235
 
233
236
  Configuration* c = Configuration::config();
234
237
  Configuration::ColorSetting* cs = c->_colors[n];
273
276
 
274
277
  if (s.isEmpty()) { _classCS=0; return; }
275
278
 
276
 
  QString n = TraceCost::typeName(TraceCost::Class) + "-" + s;
 
279
  QString n = TraceCost::typeName(TraceCost::Class) + '-' + s;
277
280
 
278
281
  Configuration* c = Configuration::config();
279
282
  Configuration::ColorSetting* cs = c->_colors[n];
305
308
 
306
309
  if (s.isEmpty()) { _fileCS=0; return; }
307
310
 
308
 
  QString n = TraceCost::typeName(TraceCost::File) + "-" + s;
 
311
  QString n = TraceCost::typeName(TraceCost::File) + '-' + s;
309
312
 
310
313
  Configuration* c = Configuration::config();
311
314
  Configuration::ColorSetting* cs = c->_colors[n];
330
333
}
331
334
 
332
335
 
333
 
void ConfigDlg::dirsItemChanged(QListViewItem* i)
 
336
void ConfigDlg::dirsItemChanged(Q3ListViewItem* i)
334
337
{
335
338
  _dirItem = i;
336
339
  deleteDirButton->setEnabled(i->depth() == 1);
340
343
void ConfigDlg::dirsDeletePressed()
341
344
{
342
345
  if (!_dirItem || (_dirItem->depth() == 0)) return;
343
 
  QListViewItem* p = _dirItem->parent();
 
346
  Q3ListViewItem* p = _dirItem->parent();
344
347
  if (!p) return;
345
348
 
346
349
  Configuration* c = Configuration::config();
379
382
  }
380
383
 
381
384
  QString newDir;
382
 
  newDir = KFileDialog::getExistingDirectory(QString::null,
 
385
  newDir = KFileDialog::getExistingDirectory(KUrl(),
383
386
                                             this,
384
387
                                             i18n("Choose Source Folder"));
385
388
  if (newDir.isEmpty()) return;
386
389
 
387
 
  // even for "/", we strip the tailing slash
388
 
  if (newDir.endsWith("/"))
 
390
  // even for '/', we strip the tailing slash
 
391
  if (newDir.endsWith('/'))
389
392
    newDir = newDir.left(newDir.length()-1);
390
393
 
391
394
  if (dirs->findIndex(newDir)>=0) return;
392
395
 
393
396
  dirs->append(newDir);
394
397
  if (newDir.isEmpty()) newDir = QString("/");
395
 
  new QListViewItem(_dirItem, newDir);
 
398
  new Q3ListViewItem(_dirItem, newDir);
396
399
}
397
400
 
398
401
#include "configdlg.moc"