summaryrefslogtreecommitdiffstats
path: root/src/progs/gui/prog_group_ui.h
blob: edc15ee2acf7e9ec41cd9d3438483622fc53706d (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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
/***************************************************************************
 *   Copyright (C) 2005-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.                                   *
 ***************************************************************************/
#ifndef PROG_GROUP_UI_H
#define PROG_GROUP_UI_H

#include "common/gui/container.h"
#include "common/gui/dialog.h"
#include "progs/base/prog_group.h"
#include "progs/base/generic_prog.h"
#include "devices/pic/gui/pic_memory_editor.h"
class Container;
class PopupButton;

namespace Programmer
{
class ConfigWidget;
class Base;
class Group;

//----------------------------------------------------------------------------
class StandaloneMemoryCalibrationEditor : public Pic::MemoryCalibrationEditor
{
Q_OBJECT
  TQ_OBJECT
public:
  StandaloneMemoryCalibrationEditor(const Pic::Memory &memory, TQWidget *tqparent);
  virtual void init(bool first);
  virtual bool hasAction(Device::Action) const { return false; }

signals:
  void updateCalibration();
  void regenerate();
};

//----------------------------------------------------------------------------
class ButtonContainer : public ::ButtonContainer
{
Q_OBJECT
  TQ_OBJECT
public:
  ButtonContainer(const TQString &title, TQObject *receiver, const char *updateSlot, TQWidget *tqparent);
};

//----------------------------------------------------------------------------
class AdvancedDialog : public Dialog
{
Q_OBJECT
  TQ_OBJECT
public:
  AdvancedDialog(Base &base, TQWidget *tqparent, const char *name);
  virtual void updateDisplay();

protected:
  Base      &_base;
  Container *_programmerContainer, *_calibrationContainer;
  ButtonContainer *_firmwareContainer, *_voltagesContainer, *_selfTestContainer;
  Pic::MemoryCalibrationEditor *_calEditor;
  bool connectProgrammer();
  bool ensureConnected();

protected slots:
  void updateFirmware();
  void uploadFirmware();
  void updateVoltages();
  void updateSelfTest();
  void updateCalibration();
  virtual void regenerateCalibration();

private:
  TQLabel *_firmwareLabel;
};

//----------------------------------------------------------------------------
class GroupUI : public ::Group::BaseGui
{
public:
  virtual ::Programmer::ConfigWidget *createConfigWidget(TQWidget *tqparent) const = 0;
  virtual bool hasAdvancedDialog() const = 0;
  virtual AdvancedDialog *createAdvancedDialog(Base &base, TQWidget *tqparent) const = 0;
};

inline const ::Programmer::GroupUI &groupui(const ::Programmer::Base &base) { return static_cast<const ::Programmer::GroupUI &>(*base.group().gui()); }

} // namespace

#endif