~ubuntu-branches/ubuntu/quantal/kate/quantal-proposed

« back to all changes in this revision

Viewing changes to kate/plugins/katebuild-plugin/plugin_katebuild.cpp

  • Committer: Package Import Robot
  • Author(s): Jonathan Riddell
  • Date: 2011-12-14 13:28:06 UTC
  • mto: This revision was merged to the branch mainline in revision 8.
  • Revision ID: package-import@ubuntu.com-20111214132806-aa2uf6ri5w2p8ak3
Tags: upstream-4.7.90
ImportĀ upstreamĀ versionĀ 4.7.90

Show diffs side-by-side

added added

removed removed

Lines of Context:
146
146
    m_buildUi.ktabwidget->setCurrentWidget(m_targetsUi);
147
147
 
148
148
 
149
 
    connect(m_buildUi.errTreeWidget, SIGNAL(itemClicked(QTreeWidgetItem *, int)),
150
 
            SLOT(slotItemSelected(QTreeWidgetItem *)));
 
149
    connect(m_buildUi.errTreeWidget, SIGNAL(itemClicked(QTreeWidgetItem*,int)),
 
150
            SLOT(slotItemSelected(QTreeWidgetItem*)));
151
151
 
152
152
    m_buildUi.plainTextEdit->setReadOnly(true);
153
153
 
 
154
    connect(m_buildUi.showErrorsButton, SIGNAL(toggled(bool)), this, SLOT(slotShowErrors(bool)));
 
155
    connect(m_buildUi.showWarningsButton, SIGNAL(toggled(bool)), this, SLOT(slotShowWarnings(bool)));
 
156
    connect(m_buildUi.showOthersButton, SIGNAL(toggled(bool)), this, SLOT(slotShowOthers(bool)));
 
157
    
154
158
    connect(m_targetsUi->browse, SIGNAL(clicked()), this, SLOT(slotBrowseClicked()));
155
159
 
 
160
    
156
161
    // set the default values of the build settings. (I think loading a plugin should also trigger
157
162
    // a read of the session config data, but it does not)
158
163
   //m_targetsUi->buildCmds->setText("make");
166
171
 
167
172
    m_proc = new KProcess();
168
173
 
169
 
    connect(m_proc, SIGNAL(finished(int, QProcess::ExitStatus)), this, SLOT(slotProcExited(int, QProcess::ExitStatus)));
 
174
    connect(m_proc, SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(slotProcExited(int,QProcess::ExitStatus)));
170
175
    connect(m_proc, SIGNAL(readyReadStandardError()),this, SLOT(slotReadReadyStdErr()));
171
176
    connect(m_proc, SIGNAL(readyReadStandardOutput()),this, SLOT(slotReadReadyStdOut()));
172
177
 
344
349
void KateBuildView::addError(const QString &filename, const QString &line,
345
350
                             const QString &column, const QString &message)
346
351
{
 
352
    bool isError=false;
 
353
    bool isWarning=false;
347
354
    QTreeWidgetItem* item = new QTreeWidgetItem(m_buildUi.errTreeWidget);
348
355
    item->setBackground(1, Qt::gray);
349
356
    // The strings are twice in case kate is translated but not make.
353
360
        message.contains(i18nc("The same word as 'ld' uses to mark an ...","undefined reference"))
354
361
       )
355
362
    {
 
363
        isError=true;
356
364
        item->setForeground(1, Qt::red);
357
365
        m_numErrors++;
 
366
        item->setHidden(!m_buildUi.showErrorsButton->isChecked());
358
367
    }
359
368
    if (message.contains("warning") ||
360
369
        message.contains(i18nc("The same word as 'make' uses to mark a warning.","warning"))
361
370
       )
362
371
    {
 
372
        isWarning=true;
363
373
        item->setForeground(1, Qt::yellow);
364
374
        m_numWarnings++;
 
375
        item->setHidden(!m_buildUi.showWarningsButton->isChecked());
365
376
    }
366
377
    item->setTextAlignment(1, Qt::AlignRight);
367
378
 
377
388
    item->setData(1, Qt::UserRole, line);
378
389
    item->setData(2, Qt::UserRole, column);
379
390
 
 
391
    if ((isError==false) && (isWarning==false)) {
 
392
      item->setHidden(!m_buildUi.showOthersButton->isChecked());
 
393
    }
 
394
    
 
395
    item->setData(0,Qt::UserRole+1,isError);
 
396
    item->setData(0,Qt::UserRole+2,isWarning);
 
397
    
380
398
    // add tooltips in all columns
381
399
    // The enclosing <qt>...</qt> enables word-wrap for long error messages
382
400
    item->setData(0, Qt::ToolTipRole, filename);
845
863
    return QObject::eventFilter(obj, event);
846
864
}
847
865
 
 
866
void KateBuildView::slotShowErrors(bool showItems) {
 
867
  QTreeWidget *tree=m_buildUi.errTreeWidget;
 
868
  const int itemCount = tree->topLevelItemCount();
 
869
 
 
870
  for (int i=0;i<itemCount;i++) {
 
871
    QTreeWidgetItem* item=tree->topLevelItem(i);
 
872
    if (item->data(0,Qt::UserRole+1).toBool()==true) {
 
873
      item->setHidden(!showItems);      
 
874
    }    
 
875
  }
 
876
  
 
877
}
 
878
 
 
879
void KateBuildView::slotShowWarnings(bool showItems) {
 
880
QTreeWidget *tree=m_buildUi.errTreeWidget;
 
881
  const int itemCount = tree->topLevelItemCount();
 
882
 
 
883
  for (int i=0;i<itemCount;i++) {
 
884
    QTreeWidgetItem* item=tree->topLevelItem(i);
 
885
    if (item->data(0,Qt::UserRole+2).toBool()==true) {
 
886
      item->setHidden(!showItems);      
 
887
    }    
 
888
  }
 
889
 
 
890
}
 
891
 
 
892
void KateBuildView::slotShowOthers(bool showItems) {
 
893
QTreeWidget *tree=m_buildUi.errTreeWidget;
 
894
  const int itemCount = tree->topLevelItemCount();
 
895
 
 
896
  for (int i=0;i<itemCount;i++) {
 
897
    QTreeWidgetItem* item=tree->topLevelItem(i);
 
898
    if ( (item->data(0,Qt::UserRole+1).toBool()==false) && (item->data(0,Qt::UserRole+2).toBool()==false) ) {
 
899
      item->setHidden(!showItems);      
 
900
    }    
 
901
  }
 
902
 
 
903
}