summaryrefslogtreecommitdiffstats
path: root/src/tools/gui/tool_config_widget.h
blob: a0408e2282abb49e983dd0a6146a7b10afaa0693 (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
/***************************************************************************
 *   Copyright (C) 2005-2006 Nicolas Hadacek <[email protected]>             *
 *   Copyright (C) 2004 Alain Gibaud <[email protected]>                *
 *                                                                         *
 *   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 TOOL_CONFIG_WIDGET_H
#define TOOL_CONFIG_WIDGET_H

#include <tqcombobox.h>
#include <tqlayout.h>
#include <tqtabwidget.h>
#include <tqvaluevector.h>
#include <kcombobox.h>
#include <klineedit.h>

#include "common/gui/container.h"
#include "tools/base/generic_tool.h"
#include "tools/base/tool_group.h"
#include "common/gui/config_widget.h"
#include "common/gui/editlistbox.h"
namespace PURL { class DirectoriesWidget; }

class ToolConfigWidget : public ::ConfigWidget
{
Q_OBJECT
  
public:
  ToolConfigWidget(Project *project);
  void init(Tool::Category category, const Tool::Group &group);
  virtual ~ToolConfigWidget();

signals:
  void changed();
  void displayHelp();

public slots:
  virtual void loadConfig();
  virtual void saveConfig() { saveConfig(*_config); }

private slots:
  void updateArguments();
  void resetCustomArguments();

protected:
  const Tool::Group *_group;
  Tool::Category _category;
  Project       *_project;
  TQLineEdit     *_customOptions, *_customLibraries;
  PURL::DirectoriesWidget *_includeDirs;
  TQComboBox     *_hexFormat;

  Container *container() { return _container; }
  PURL::DirectoriesWidget * createDirectoriesEntry(const TQString &label);
  void createIncludeDirectoriesEntry() { _includeDirs = createDirectoriesEntry(i18n("Include directories:")); }
  void createCustomOptionsEntry();
  void createCustomLibrariesEntry();
  void createHexFormatEntry();
  virtual void initEntries() = 0;
  virtual void loadConfig(const Compile::Config &config);
  virtual void saveConfig(Compile::Config &config) const;

private:
  enum ArgumentsType { AutomaticArguments = 0, CustomArguments, Nb_ArgumentsTypes };
  static const char * const ARGUMENTS_TYPE_LABELS[Nb_ArgumentsTypes];
  Compile::Config  *_config, *_tmpConfig;
  Compile::Process *_process;
  Project          *_tmpProject;
  KComboBox        *_argumentsType;
  KLineEdit        *_arguments;
  EditListBox      *_argumentsEditor;
  Container        *_container;

  TQStringList arguments(ArgumentsType type) const;
};

#endif