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
|
/***************************************************************************
* Copyright 2007 Alexander Dymo <adymo@kdevelop.org> *
* *
* This program 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 program 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 General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public *
* License along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
#ifndef KDEVPLATFORM_UICONTROLLER_H
#define KDEVPLATFORM_UICONTROLLER_H
#include "shellexport.h"
#include <KSharedConfig>
#include <interfaces/iuicontroller.h>
#include <interfaces/iassistant.h>
#include <sublime/controller.h>
class QListWidgetItem;
namespace Sublime {
class ToolDocument;
}
namespace KDevelop {
class Core;
class MainWindow;
class UiControllerPrivate;
class KDEVPLATFORMSHELL_EXPORT UiController: public Sublime::Controller, public IUiController
{
Q_OBJECT
public:
explicit UiController(Core *core);
~UiController() override;
/** @return area for currently active sublime mainwindow or 0 if
no sublime mainwindow is active.*/
Sublime::Area *activeArea() override;
/** @return active sublime mainwindow or 0 if no such mainwindow is active.*/
virtual Sublime::MainWindow *activeSublimeWindow();
/** @return active sublime mainwindow or 0 if no such mainwindow is active.*/
KParts::MainWindow *activeMainWindow() override;
/** @return default main window - the main window for default area in the shell.
No guarantee is given that it always exists so this method may return 0.*/
MainWindow *defaultMainWindow();
void switchToArea(const QString &areaName, SwitchMode switchMode) override;
void addToolView(const QString &name, IToolViewFactory *factory, FindFlags state) override;
void removeToolView(IToolViewFactory *factory) override;
QWidget* findToolView(const QString& name, IToolViewFactory *factory, FindFlags flags) override;
void raiseToolView(QWidget* toolViewWidget) override;
void selectNewToolViewToAdd(MainWindow *mw);
void initialize();
void cleanup();
void showSettingsDialog();
Sublime::Controller* controller() override;
void mainWindowAdded(Sublime::MainWindow* mainWindow);
void saveAllAreas(const KSharedConfigPtr& config);
void saveArea(Sublime::Area* area, KConfigGroup & group);
void loadAllAreas(const KSharedConfigPtr& config);
void loadArea(Sublime::Area* area, const KConfigGroup & group);
/*! @p status must implement KDevelop::IStatus */
void registerStatus(QObject* status) override;
void showErrorMessage(const QString& message, int timeout) override;
void postMessage(Sublime::Message* message) override;
/// Returns list of available view factories together with their ToolDocuments.
/// @see addToolView(), removeToolView(), findToolView()
const QHash<IToolViewFactory*, Sublime::ToolDocument*>& factoryDocuments() const;
/// Adds a tool view in the active area to the dock area @p area.
/// @see activeArea()
void addToolViewToDockArea(KDevelop::IToolViewFactory* factory, Qt::DockWidgetArea area);
bool toolViewPresent(Sublime::ToolDocument* doc, Sublime::Area* area);
QWidget* activeToolViewActionListener() const override;
QList<Sublime::Area*> allAreas() const override;
public Q_SLOTS:
void raiseToolView(Sublime::View * view);
private Q_SLOTS:
void addNewToolView(MainWindow* mw, QListWidgetItem* item);
void slotAreaChanged(Sublime::Area* area);
void slotActiveToolViewChanged(Sublime::View* view);
private:
void addToolViewIfWanted(IToolViewFactory* factory,
Sublime::ToolDocument* doc,
Sublime::Area* area);
Sublime::View* addToolViewToArea(IToolViewFactory* factory,
Sublime::ToolDocument* doc,
Sublime::Area* area, Sublime::Position p=Sublime::AllPositions);
void setupActions();
private:
const QScopedPointer<class UiControllerPrivate> d_ptr;
Q_DECLARE_PRIVATE(UiController)
friend class UiControllerPrivate;
};
}
#endif
|