summaryrefslogtreecommitdiffstats
path: root/src/progs/pickit2/gui/pickit2_group_ui.cpp
blob: 473dea75e6cad8d09fcf17052e0fda49a8110b39 (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
43
44
45
46
47
48
49
50
51
52
/***************************************************************************
 * 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 "pickit2_group_ui.h"

#include <kfiledialog.h>

#include "common/global/purl.h"
#include "common/gui/misc_gui.h"
#include "progs/gui/prog_config_widget.h"
#include "progs/base/prog_group.h"
#include "progs/pickit2/base/pickit2_prog.h"
#include "progs/pickit2/base/pickit2.h"

//----------------------------------------------------------------------------
Pickit::AdvancedDialog::AdvancedDialog(Base &base, TQWidget *tqparent, const char *name)
  : ::Programmer::PicAdvancedDialog(base, tqparent, name)
{}

void Pickit::AdvancedDialog::regenerateCalibration()
{
  if ( !base().deviceHasOsccalRegeneration() ) {
    MessageBox::sorry(i18n("Osccal regeneration not available for the selected device."), Log::Show);
    return;
  }
  KFileDialog dialog(":open_autohex", PURL::filter(PURL::Hex), this, "autohex_dialog", true);
  dialog.setOperationMode(KFileDialog::Opening);
  dialog.setCaption(i18n("Open Calibration Firmware"));
  dialog.setMode(KFile::File);
  //dialog.ops->clearHistory();
  dialog.setSelection("autocal.hex");
  dialog.exec();
  PURL::Url url(dialog.selectedURL());
  if ( url.isEmpty() ) return;
  base().regenerateOsccal(url);
}

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

::Programmer::AdvancedDialog *Pickit2::GroupUI::createAdvancedDialog(::Programmer::Base &base, TQWidget *tqparent) const
{
  return new Pickit::AdvancedDialog(static_cast<Base &>(base), tqparent, "pickit2_advanced_dialog");
}