summaryrefslogtreecommitdiffstats
path: root/src/tools/gui/tool_config_widget.h
blob: 5b38753ea78e45590dada7dd463703a9bf4850e8 (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
/***************************************************************************
 *   Copyright (C) 2005-2006 Nicolas Hadacek <hadacek@kde.org>             *
 *   Copyright (C) 2004 Alain Gibaud <alain.gibaud@free.fr>                *
 *                                                                         *
 *   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 <qcombobox.h>
#include <qlayout.h>
#include <qtabwidget.h>
#include <qvaluevector.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;
  QLineEdit     *_customOptions, *_customLibraries;
  PURL::DirectoriesWidget *_includeDirs;
  QComboBox     *_hexFormat;

  Container *container() { return _container; }
  PURL::DirectoriesWidget * createDirectoriesEntry(const QString &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;

  QStringList arguments(ArgumentsType type) const;
};

#endif