configview.h 3.42 KB
Newer Older
Kåre Särs's avatar
Kåre Särs committed
1 2 3 4 5 6 7
//
// configview.h
//
// Description: View for configuring the set of targets to be used with the debugger
//
//
// Copyright (c) 2010 Ian Wakeling <ian.wakeling@ntlworld.com>
8
// Copyright (c) 2012 Kåre Särs <kare.sars@iki.fi>
Kåre Särs's avatar
Kåre Särs committed
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
//
//  This library is free software; you can redistribute it and/or
//  modify it under the terms of the GNU Library General Public
//  License version 2 as published by the Free Software Foundation.
//
//  This library is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
//  Library General Public License for more details.
//
//  You should have received a copy of the GNU Library General Public License
//  along with this library; see the file COPYING.LIB.  If not, write to
//  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
//  Boston, MA 02110-1301, USA.

#ifndef CONFIGVIEW_H
#define CONFIGVIEW_H

27 28
#include "advanced_settings.h"

29 30 31 32 33 34 35 36 37 38 39 40
#include <QWidget>
#include <QLabel>
#include <QLineEdit>
#include <QToolButton>
#include <QComboBox>
#include <QCheckBox>
#include <QBoxLayout>
#include <QResizeEvent>

#include <QList>

#include <KTextEditor/MainWindow>
Kåre Särs's avatar
Kåre Särs committed
41
#include <kconfiggroup.h>
Ian Wakeling's avatar
Ian Wakeling committed
42 43
#include <kactioncollection.h>
#include <kselectaction.h>
Kåre Särs's avatar
Kåre Särs committed
44

45 46 47 48 49 50
struct GDBTargetConf {
    QString     executable;
    QString     workDir;
    QString     arguments;
    QString     gdbCmd;
    QStringList customInit;
51
    QStringList srcPaths;
52 53
};

Kåre Särs's avatar
Kåre Särs committed
54 55 56 57
class ConfigView : public QWidget
{
Q_OBJECT
public:
58 59 60 61 62 63 64 65 66
    enum TargetStringOrder {
        NameIndex = 0,
        ExecIndex,
        WorkDirIndex,
        ArgsIndex,
        GDBIndex,
        CustomStartIndex
    };

67
    ConfigView(QWidget* parent, KTextEditor::MainWindow* mainWin);
Kåre Särs's avatar
Kåre Särs committed
68 69 70
    ~ConfigView();

public:
71
    void registerActions(KActionCollection* actionCollection);
Ian Wakeling's avatar
Ian Wakeling committed
72

73 74
    void readConfig (const KConfigGroup& config);
    void writeConfig (KConfigGroup& config);
Kåre Särs's avatar
Kåre Särs committed
75

76 77 78
    const GDBTargetConf currentTarget() const;
    bool  takeFocusAlways() const;
    bool  showIOTab() const;
79 80 81

Q_SIGNALS:
    void showIO(bool show);
Kåre Särs's avatar
Kåre Särs committed
82 83

private Q_SLOTS:
84 85
    void slotTargetEdited(const QString &newText);
    void slotTargetSelected(int index);
Ian Wakeling's avatar
Ian Wakeling committed
86
    void slotAddTarget();
87
    void slotCopyTarget();
Kåre Särs's avatar
Kåre Särs committed
88
    void slotDeleteTarget();
89 90 91
    void slotAdvancedClicked();
    void slotBrowseExec();
    void slotBrowseDir();
Kåre Särs's avatar
Kåre Särs committed
92 93

protected:
Laurent Montel's avatar
Laurent Montel committed
94
    void resizeEvent(QResizeEvent *event) Q_DECL_OVERRIDE;
Kåre Särs's avatar
Kåre Särs committed
95

Ian Wakeling's avatar
Ian Wakeling committed
96
private:
97 98
    void saveCurrentToIndex(int index);
    void loadFromIndex(int index);
99 100
    void setAdvancedOptions();

101
private:
102 103
    KTextEditor::MainWindow*   m_mainWindow;
    QComboBox*          m_targetCombo;
104 105 106 107 108
    int                 m_currentTarget;
    QToolButton*        m_addTarget;
    QToolButton*        m_copyTarget;
    QToolButton*        m_deleteTarget;
    QFrame*             m_line;
Ian Wakeling's avatar
Ian Wakeling committed
109

110
    QLineEdit*          m_executable;
111
    QToolButton*        m_browseExe;
Ian Wakeling's avatar
Ian Wakeling committed
112

113
    QLineEdit*          m_workingDirectory;
114 115
    QToolButton*        m_browseDir;

116
    QLineEdit*          m_arguments;
Ian Wakeling's avatar
Ian Wakeling committed
117

Kåre Särs's avatar
Kåre Särs committed
118 119
    QCheckBox*          m_takeFocus;
    QCheckBox*          m_redirectTerminal;
120
    QPushButton*        m_advancedSettings;
121 122
    QBoxLayout*         m_checBoxLayout;

Kåre Särs's avatar
Kåre Särs committed
123
    bool                m_useBottomLayout;
124
    QLabel*             m_execLabel;
Kåre Särs's avatar
Kåre Särs committed
125 126
    QLabel*             m_workDirLabel;
    QLabel*             m_argumentsLabel;
Ian Wakeling's avatar
Ian Wakeling committed
127
    KSelectAction*      m_targetSelectAction;
128 129

    AdvancedGDBSettings* m_advanced;
Kåre Särs's avatar
Kåre Särs committed
130 131 132
};

#endif