summaryrefslogtreecommitdiffstats
path: root/src/progs/gpsim/gui/gpsim_group_ui.cpp
blob: 69dd55871a0f44ee69e5904d305e19e4fdebef11 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/***************************************************************************
 *   Copyright (C) 2006 Nicolas Hadacek <hadacek@kde.org>                  *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 ***************************************************************************/
#include "gpsim_group_ui.h"

#include <tqtimer.h>

#include "progs/base/prog_group.h"
#include "progs/gpsim/base/gpsim.h"

//----------------------------------------------------------------------------
GPSim::ConfigWidget::ConfigWidget(const ::Programmer::Group &group, TQWidget *parent)
  : ::Programmer::ConfigWidget(group, parent)
{
  uint row = numRows();
  TQLabel *label = new TQLabel(i18n("Status:"), this);
  addWidget(label, row,row, 0,0);
  _status = new TQLabel(this);
  addWidget(_status, row,row, 1,1);

  TQTimer::singleShot(0, this, TQ_SLOT(updateStatus()));
}

void GPSim::ConfigWidget::updateStatus()
{
  VersionData version;
  ProcessManager manager(0);
  if ( !manager.start() ) _status->setText(i18n("Could not start \"gpsim\""));
  else if ( !manager.getVersion(version) || !version.isValid() ) _status->setText(i18n("Could not detect \"gpsim\" version"));
  else _status->setText(i18n("Found version \"%1\"").arg(version.pretty()));
}

//----------------------------------------------------------------------------
::Programmer::ConfigWidget *GPSim::GroupUI::createConfigWidget(TQWidget *parent) const
{
  return new ConfigWidget(static_cast<const ::Programmer::Group &>(group()), parent);
}