1/*
2 SPDX-FileCopyrightText: 2013 Christoph Cullmann <cullmann@kde.org>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7#include <ktexteditor/mainwindow.h>
8#include <ktexteditor/plugin.h>
9
10#include <KXMLGUIFactory>
11#include <QIcon>
12#include <QUrl>
13#include <QVariant>
14
15// clang-format off
16
17namespace KTextEditor
18{
19MainWindow::MainWindow(QObject *parent)
20 : QObject(parent)
21 , d(nullptr)
22{
23}
24
25MainWindow::~MainWindow()
26{
27}
28
29QWidget *MainWindow::window()
30{
31 // dispatch to parent
32 QWidget *window = nullptr;
33 QMetaObject::invokeMethod(obj: parent(), member: "window", c: Qt::DirectConnection, Q_RETURN_ARG(QWidget*, window));
34 return window;
35}
36
37KXMLGUIFactory *MainWindow::guiFactory()
38{
39 // dispatch to parent
40 KXMLGUIFactory *guiFactory = nullptr;
41 QMetaObject::invokeMethod(obj: parent(), member: "guiFactory", c: Qt::DirectConnection, Q_RETURN_ARG(KXMLGUIFactory*, guiFactory));
42 return guiFactory;
43}
44
45QList<KTextEditor::View *> MainWindow::views()
46{
47 // dispatch to parent
48 QList<KTextEditor::View *> views;
49 QMetaObject::invokeMethod(obj: parent(), member: "views", c: Qt::DirectConnection, Q_RETURN_ARG(QList<KTextEditor::View*>, views));
50 return views;
51}
52
53KTextEditor::View *MainWindow::activeView()
54{
55 // dispatch to parent
56 KTextEditor::View *view = nullptr;
57 QMetaObject::invokeMethod(obj: parent(), member: "activeView", c: Qt::DirectConnection, Q_RETURN_ARG(KTextEditor::View*, view));
58 return view;
59}
60
61KTextEditor::View *MainWindow::activateView(KTextEditor::Document *document)
62{
63 // dispatch to parent
64 KTextEditor::View *view = nullptr;
65 QMetaObject::invokeMethod(obj: parent(),
66 member: "activateView",
67 c: Qt::DirectConnection,
68 Q_RETURN_ARG(KTextEditor::View*, view),
69 Q_ARG(KTextEditor::Document*, document));
70 return view;
71}
72
73KTextEditor::View *MainWindow::openUrl(const QUrl &url, const QString &encoding)
74{
75 // dispatch to parent
76 KTextEditor::View *view = nullptr;
77 QMetaObject::invokeMethod(obj: parent(), member: "openUrl", c: Qt::DirectConnection, Q_RETURN_ARG(KTextEditor::View*, view), Q_ARG(QUrl, url), Q_ARG(QString, encoding));
78 return view;
79}
80
81bool MainWindow::closeView(KTextEditor::View *view)
82{
83 // dispatch to parent
84 bool success = false;
85 QMetaObject::invokeMethod(obj: parent(), member: "closeView", c: Qt::DirectConnection, Q_RETURN_ARG(bool, success), Q_ARG(KTextEditor::View*, view));
86 return success;
87}
88
89void MainWindow::splitView(Qt::Orientation orientation)
90{
91 // dispatch to parent
92 QMetaObject::invokeMethod(obj: parent(), member: "splitView", c: Qt::DirectConnection, Q_ARG(Qt::Orientation, orientation));
93}
94
95bool MainWindow::closeSplitView(KTextEditor::View *view)
96{
97 // dispatch to parent
98 bool success = false;
99 QMetaObject::invokeMethod(obj: parent(), member: "closeSplitView", c: Qt::DirectConnection, Q_RETURN_ARG(bool, success), Q_ARG(KTextEditor::View*, view));
100 return success;
101}
102
103bool MainWindow::viewsInSameSplitView(KTextEditor::View *view1, KTextEditor::View *view2)
104{
105 // dispatch to parent
106 bool success = false;
107 QMetaObject::invokeMethod(obj: parent(),
108 member: "viewsInSameSplitView",
109 c: Qt::DirectConnection,
110 Q_RETURN_ARG(bool, success),
111 Q_ARG(KTextEditor::View*, view1),
112 Q_ARG(KTextEditor::View*, view2));
113 return success;
114}
115
116QWidget *MainWindow::createViewBar(KTextEditor::View *view)
117{
118 // dispatch to parent
119 QWidget *viewBar = nullptr;
120 QMetaObject::invokeMethod(obj: parent(), member: "createViewBar", c: Qt::DirectConnection, Q_RETURN_ARG(QWidget*, viewBar), Q_ARG(KTextEditor::View*, view));
121 return viewBar;
122}
123
124void MainWindow::deleteViewBar(KTextEditor::View *view)
125{
126 // dispatch to parent
127 QMetaObject::invokeMethod(obj: parent(), member: "deleteViewBar", c: Qt::DirectConnection, Q_ARG(KTextEditor::View*, view));
128}
129
130void MainWindow::addWidgetToViewBar(KTextEditor::View *view, QWidget *bar)
131{
132 // dispatch to parent
133 QMetaObject::invokeMethod(obj: parent(), member: "addWidgetToViewBar", c: Qt::DirectConnection, Q_ARG(KTextEditor::View*, view), Q_ARG(QWidget*, bar));
134}
135
136void MainWindow::showViewBar(KTextEditor::View *view)
137{
138 // dispatch to parent
139 QMetaObject::invokeMethod(obj: parent(), member: "showViewBar", c: Qt::DirectConnection, Q_ARG(KTextEditor::View*, view));
140}
141
142void MainWindow::hideViewBar(KTextEditor::View *view)
143{
144 // dispatch to parent
145 QMetaObject::invokeMethod(obj: parent(), member: "hideViewBar", c: Qt::DirectConnection, Q_ARG(KTextEditor::View*, view));
146}
147
148QWidget *MainWindow::createToolView(KTextEditor::Plugin *plugin,
149 const QString &identifier,
150 KTextEditor::MainWindow::ToolViewPosition pos,
151 const QIcon &icon,
152 const QString &text)
153{
154 // dispatch to parent
155 QWidget *toolView = nullptr;
156 QMetaObject::invokeMethod(obj: parent(),
157 member: "createToolView",
158 c: Qt::DirectConnection,
159 Q_RETURN_ARG(QWidget*, toolView),
160 Q_ARG(KTextEditor::Plugin*, plugin),
161 Q_ARG(QString, identifier),
162 Q_ARG(KTextEditor::MainWindow::ToolViewPosition, pos),
163 Q_ARG(QIcon, icon),
164 Q_ARG(QString, text));
165 return toolView;
166}
167
168bool MainWindow::moveToolView(QWidget *widget, KTextEditor::MainWindow::ToolViewPosition pos)
169{
170 // dispatch to parent
171 bool success = false;
172 QMetaObject::invokeMethod(obj: parent(),
173 member: "moveToolView",
174 c: Qt::DirectConnection,
175 Q_RETURN_ARG(bool, success),
176 Q_ARG(QWidget*, widget),
177 Q_ARG(KTextEditor::MainWindow::ToolViewPosition, pos));
178 return success;
179}
180
181bool MainWindow::showToolView(QWidget *widget)
182{
183 // dispatch to parent
184 bool success = false;
185 QMetaObject::invokeMethod(obj: parent(), member: "showToolView", c: Qt::DirectConnection, Q_RETURN_ARG(bool, success), Q_ARG(QWidget*, widget));
186 return success;
187}
188
189bool MainWindow::hideToolView(QWidget *widget)
190{
191 // dispatch to parent
192 bool success = false;
193 QMetaObject::invokeMethod(obj: parent(), member: "hideToolView", c: Qt::DirectConnection, Q_RETURN_ARG(bool, success), Q_ARG(QWidget*, widget));
194 return success;
195}
196
197bool MainWindow::showPluginConfigPage(KTextEditor::Plugin *plugin, int page)
198{
199 // dispatch to parent
200 bool success = false;
201 QMetaObject::invokeMethod(obj: parent(),
202 member: "showPluginConfigPage",
203 c: Qt::DirectConnection,
204 Q_RETURN_ARG(bool, success),
205 Q_ARG(KTextEditor::Plugin*, plugin),
206 Q_ARG(int, page));
207 return success;
208}
209
210QObject *MainWindow::pluginView(const QString &name)
211{
212 // dispatch to parent
213 QObject *pluginView = nullptr;
214 QMetaObject::invokeMethod(obj: parent(), member: "pluginView", c: Qt::DirectConnection, Q_RETURN_ARG(QObject*, pluginView), Q_ARG(QString, name));
215 return pluginView;
216}
217
218bool MainWindow::addWidget(QWidget *widget)
219{
220 // dispatch to parent
221 bool success = false;
222 QMetaObject::invokeMethod(obj: parent(), member: "addWidget", c: Qt::DirectConnection, Q_RETURN_ARG(bool, success), Q_ARG(QWidget*, widget));
223 return success;
224}
225
226bool MainWindow::removeWidget(QWidget *widget)
227{
228 // dispatch to parent
229 bool success = false;
230 QMetaObject::invokeMethod(obj: parent(), member: "removeWidget", c: Qt::DirectConnection, Q_RETURN_ARG(bool, success), Q_ARG(QWidget*, widget));
231 return success;
232}
233
234QWidgetList MainWindow::widgets()
235{
236 // dispatch to parent
237 QWidgetList l;
238 QMetaObject::invokeMethod(obj: parent(), member: "widgets", c: Qt::DirectConnection, Q_RETURN_ARG(QWidgetList, l));
239 return l;
240}
241
242QWidget *MainWindow::activeWidget()
243{
244 // dispatch to parent
245 QWidget *w = nullptr;
246 QMetaObject::invokeMethod(obj: parent(), member: "activeWidget", c: Qt::DirectConnection, Q_RETURN_ARG(QWidget*, w));
247 return w;
248}
249
250void MainWindow::activateWidget(QWidget *widget)
251{
252 // dispatch to parent
253 QMetaObject::invokeMethod(obj: parent(), member: "activateWidget", c: Qt::DirectConnection, Q_ARG(QWidget*, widget));
254}
255
256bool MainWindow::showMessage(const QVariantMap &message)
257{
258 // dispatch to parent
259 bool success = false;
260 QMetaObject::invokeMethod(obj: parent(), member: "showMessage", c: Qt::DirectConnection, Q_RETURN_ARG(bool, success), Q_ARG(QVariantMap, message));
261 return success;
262}
263} // namespace KTextEditor
264
265// clang-format on
266

source code of ktexteditor/src/utils/mainwindow.cpp