summaryrefslogtreecommitdiffstats
path: root/src/libgui/toplevel.h
blob: d3e78be4ee5b4e6e44835319f37892409d279163 (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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
/***************************************************************************
 *   Copyright (C) 2005-2007 Nicolas Hadacek <hadacek@kde.org>             *
 *   Copyright (C) 2003-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 TOPLEVEL_H
#define TOPLEVEL_H

#include <tqlabel.h>
#include <tqprogressbar.h>
#include <kdockwidget.h>

#include "config_center.h"
#include "tools/list/compile_process.h"
#include "toplevel_ui.h"
namespace Programmer { class Group; }
namespace Tool { class Group; }
class ConfigGenerator;
class HexEditor;
namespace Process { class Base; }

class MainWindow : public KDockMainWindow
{
Q_OBJECT
  TQ_OBJECT
public:
  MainWindow();
  virtual ~MainWindow();
  void setDevice(const TQString &device);

public slots:
  void newSourceFile();
  void newProject();
  void openProject();
  void buildProject();
  void cleanBuild();
  void configure(ConfigCenter::Type showType = ConfigCenter::General);
  void configureProject();
  void showDeviceInfo();
  void runPikloops();
  void runKtqfind();
  void configGenerator();
  void templateGenerator();
  void updateGUI();

private slots:
  void newHexFile();
  bool openFile();
  void openRecentFile(const KURL &url);

  void compileFile();
  void compileSuccess();
  void compileFailure();
  void updateFile(const Compile::FileData &data);
  void stopBuild();

  void erase();
  void blankCheck();
  void program();
  void verify();
  void read();
  void showProgress(bool show);
  void setTotalProgress(uint nbSteps);
  void setProgress(uint nbSteps);

  void applyToolbarSettings();
  void configureToolbar();
  void configureToolchains();
  void configureProgrammer() { configure(ConfigCenter::ProgSelect); }
  void showProgrammerSettings() { configure(ConfigCenter::ProgOptions); }
  void showDebuggerSettings() { configure(ConfigCenter::DebugOptions); }
  void selectProgrammer(const Programmer::Group &group);
  void selectTool(const Tool::Group &group);

  void updateToolViewsActions();
  void resetDockLayout();
  void toggleToolView(TQWidget *widget);

  void pikloopsDone();
  void kfindDone();

  void openRecentProject(const KURL &url);
  void closeProject();

  void initialLoading();

signals:
  void stateChanged();

private:
  Log::Widget            *_programLog;
  TQLabel                 *_actiontqStatus, *_debugtqStatus, *_editortqStatus;
  ProgrammerStatusWidget *_programmertqStatus;
  ToolStatusWidget       *_tooltqStatus;
  TQProgressBar           *_actionProgress;
  ConfigGenerator        *_configGenerator;
  ::Process::Base        *_pikloopsProcess, *_kfindProcess;
  bool _forceProgramAfterBuild;

  class DockPosition {
  public:
    DockPosition() {}
    DockPosition(const TQString &ptqparent) : tqparent(ptqparent), pos(KDockWidget::DockCenter), space(0) {}
    DockPosition(KDockWidget::DockPosition ppos, uint pspace) : tqparent("main_dock_widget"), pos(ppos), space(pspace) {}
    TQString tqparent;
    KDockWidget::DockPosition pos;
    uint space;
  };
  class DockData {
  public:
    ViewMenuAction *action;
    KDockWidget    *dock;
    TQString         title;
    DockPosition    position;
  };
  TQValueList<DockData> _docks;
  KDockWidget         *_mainDock;

  HexEditor *getHexEditor();
  virtual bool queryClose();
  bool stopOperations();
  void cleanBuild(bool singleFile);
  virtual void keyPressEvent(TQKeyEvent *e);
  void readDockConfig();
  KDockWidget *createDock(const TQString &name, const TQPixmap &icon, const TQString &title, const DockPosition &position);
  void initDockPosition(const DockData &ddata);
};

#endif