<commit_before>/* This file is part of the KDE libraries
   Copyright (C) 2005 <NAME> <<EMAIL>>
   Copyright (C) 2002, 2003 <NAME> <<EMAIL>>

   This library is free software; you can redistribute it and/or
   modify it under the terms of the GNU Library General Public
   License as published by the Free Software Foundation; either
   version 2 of the License, or (at your option) any later version.

   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 __KATE_MDI_H__
#define __KATE_MDI_H__

#include <KTextEditor/Plugin>

#include <KParts/MainWindow>

#include <KMultiTabBar>
#include <KXMLGUIClient>
#include <KToggleAction>

#include <QMap>
#include <QSplitter>
#include <QPixmap>
#include <QList>
#include <QEvent>
#include <QChildEvent>
#include <QPointer>
#include <QFrame>

class KActionMenu;
class QAction;
class KConfigBase;

namespace KTextEditor
{
class ConfigPageInterface;
};

namespace KateMDI
{

class ToolView;

class ToggleToolViewAction : public KToggleAction
{
    Q_OBJECT

public:
    ToggleToolViewAction(const QString &text, ToolView *tv, QObject *parent);

    virtual ~ToggleToolViewAction();

protected Q_SLOTS:
    void slotToggled(bool);
    void toolVisibleChanged(bool);

private:
    ToolView *m_tv;
};

class GUIClient : public QObject, public KXMLGUIClient
{
    Q_OBJECT

public:
    GUIClient(class MainWindow *mw);
    virtual ~GUIClient();

    void registerToolView(ToolView *tv);
    void unregisterToolView(ToolView *tv);
    void updateSidebarsVisibleAction();

private Q_SLOTS:
    void clientAdded(KXMLGUIClient *client);
    void updateActions();

private:
    MainWindow *m_mw;
    KToggleAction *m_showSidebarsAction;
    QList<QAction *> m_toolViewActions;
    QMap<ToolView *, QAction *> m_toolToAction;
    KActionMenu *m_toolMenu;
};

class ToolView : public QFrame
{
    Q_OBJECT

    friend class Sidebar;
    friend class MainWindow;
    friend class GUIClient;
    friend class ToggleToolViewAction;

protected:
    /**
     * ToolView
     * Objects of this clas represent a toolview in the mainwindow
     * you should only add one widget as child to this toolview, it will
     * be automatically set to be the focus proxy of the toolview
     * @param mainwin main window for this toolview
     * @param sidebar sidebar of this toolview
     * @param parent parent widget, e.g. the splitter of one of the sidebars
     */
    ToolView(class MainWindow *mainwin, class Sidebar *sidebar, QWidget *parent);

public:
    /**
     * destuct me, this is allowed for all, will care itself that the toolview is removed
     * from the mainwindow and sidebar
     */
    virtual ~ToolView();

Q_SIGNALS:
    /**
     * toolview hidden or shown
     * @param visible is this toolview made visible?
     */
    void toolVisibleChanged(bool visible);

    /**
     * some internal methodes needed by the main window and the sidebars
     */
protected:
    MainWindow *mainWindow() {
        return m_mainWin;
    }

    Sidebar *sidebar() {
        return m_sidebar;
    }

    void setToolVisible(bool vis);

public:
    bool toolVisible() const;

protected:
    QSize sizeHint() const;
    QSize minimumSizeHint() const;
    void childEvent(QChildEvent *ev);
    void actionEvent(QActionEvent *event);<commit_msg>[Dominik' request] sizeHint, minimumSizeHint moves to public modifiers Both + childEvent and actionEvent enable c++1y feature Q_DECL_OVERRIDE compile time verification to use correct override virtual function<commit_after>/* This file is part of the KDE libraries
   Copyright (C) 2005 <NAME> <<EMAIL>>
   Copyright (C) 2002, 2003 <NAME> <<EMAIL>>

   This library is free software; you can redistribute it and/or
   modify it under the terms of the GNU Library General Public
   License as published by the Free Software Foundation; either
   version 2 of the License, or (at your option) any later version.

   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 __KATE_MDI_H__
#define __KATE_MDI_H__

#include <KTextEditor/Plugin>

#include <KParts/MainWindow>

#include <KMultiTabBar>
#include <KXMLGUIClient>
#include <KToggleAction>

#include <QMap>
#include <QSplitter>
#include <QPixmap>
#include <QList>
#include <QEvent>
#include <QChildEvent>
#include <QPointer>
#include <QFrame>

class KActionMenu;
class QAction;
class KConfigBase;

namespace KTextEditor
{
class ConfigPageInterface;
};

namespace KateMDI
{

class ToolView;

class ToggleToolViewAction : public KToggleAction
{
    Q_OBJECT

public:
    ToggleToolViewAction(const QString &text, ToolView *tv, QObject *parent);

    virtual ~ToggleToolViewAction();

protected Q_SLOTS:
    void slotToggled(bool);
    void toolVisibleChanged(bool);

private:
    ToolView *m_tv;
};

class GUIClient : public QObject, public KXMLGUIClient
{
    Q_OBJECT

public:
    GUIClient(class MainWindow *mw);
    virtual ~GUIClient();

    void registerToolView(ToolView *tv);
    void unregisterToolView(ToolView *tv);
    void updateSidebarsVisibleAction();

private Q_SLOTS:
    void clientAdded(KXMLGUIClient *client);
    void updateActions();

private:
    MainWindow *m_mw;
    KToggleAction *m_showSidebarsAction;
    QList<QAction *> m_toolViewActions;
    QMap<ToolView *, QAction *> m_toolToAction;
    KActionMenu *m_toolMenu;
};

class ToolView : public QFrame
{
    Q_OBJECT

    friend class Sidebar;
    friend class MainWindow;
    friend class GUIClient;
    friend class ToggleToolViewAction;

protected:
    /**
     * ToolView
     * Objects of this clas represent a toolview in the mainwindow
     * you should only add one widget as child to this toolview, it will
     * be automatically set to be the focus proxy of the toolview
     * @param mainwin main window for this toolview
     * @param sidebar sidebar of this toolview
     * @param parent parent widget, e.g. the splitter of one of the sidebars
     */
    ToolView(class MainWindow *mainwin, class Sidebar *sidebar, QWidget *parent);

public:
    /**
     * destuct me, this is allowed for all, will care itself that the toolview is removed
     * from the mainwindow and sidebar
     */
    virtual ~ToolView();

Q_SIGNALS:
    /**
     * toolview hidden or shown
     * @param visible is this toolview made visible?
     */
    void toolVisibleChanged(bool visible);

    /**
     * some internal methodes needed by the main window and the sidebars
     */
protected:
    MainWindow *mainWindow() {
        return m_mainWin;
    }

    Sidebar *sidebar() {
        return m_sidebar;
    }

    void setToolVisible(bool vis);

public:
    bool toolVisible() const;
    QSize sizeHint() const Q_DECL_OVERRIDE;
    QSize minimumSizeHint() const Q_DECL_OVERRIDE;

protected:
    void childEvent(QChildEvent *ev) Q_DECL_OVERRIDE;
    void actionEvent(QActionEvent *event) Q_DECL_OVERRIDE;
{'fraction_non_alphanumeric': 0.07319600984583495, 'fraction_numerical': 0.006347972535302501, 'mean_word_length': 3.6844660194174756, 'pattern_counts': {'":': 0, '<': 45, '<?xml version=': 0, '>': 45, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5236306', 'n_tokens_mistral': 2338, 'n_tokens_neox': 2279, 'n_words': 851}