File indexing completed on 2024-05-26 04:38:38

0001 /*
0002  *  This file is part of the KDE project.
0003  *
0004  *  Copyright (C) 2014-2016 Dominik Haumann <dhaumann@kde.org>
0005  *  Copyright (C) 2013 Christoph Cullmann <cullmann@kde.org>
0006  *
0007  *  This library is free software; you can redistribute it and/or
0008  *  modify it under the terms of the GNU Library General Public
0009  *  License as published by the Free Software Foundation; either
0010  *  version 2 of the License, or (at your option) any later version.
0011  *
0012  *  This library is distributed in the hope that it will be useful,
0013  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
0014  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0015  *  Library General Public License for more details.
0016  *
0017  *  You should have received a copy of the GNU Library General Public License
0018  *  along with this library; see the file COPYING.LIB.  If not, write to
0019  *  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0020  *  Boston, MA 02110-1301, USA.
0021  */
0022 
0023 #include "Application.h"
0024 // #include <tikz/ui/Plugin.h>
0025 
0026 namespace tikz {
0027 namespace ui {
0028 
0029 Application::Application(QObject *parent)
0030     : QObject(parent)
0031     , d(nullptr)
0032 {
0033 }
0034 
0035 Application::~Application()
0036 {
0037 }
0038 
0039 QList<tikz::ui::MainWindow *> Application::mainWindows()
0040 {
0041     /**
0042      * dispatch to parent
0043      */
0044     QList<tikz::ui::MainWindow *> mainWindow;
0045     QMetaObject::invokeMethod(parent()
0046                               , "mainWindows"
0047                               , Qt::DirectConnection
0048                               , Q_RETURN_ARG(QList<tikz::ui::MainWindow *>, mainWindow));
0049     return mainWindow;
0050 }
0051 
0052 tikz::ui::MainWindow *Application::activeMainWindow()
0053 {
0054     /**
0055      * dispatch to parent
0056      */
0057     tikz::ui::MainWindow *window = nullptr;
0058     QMetaObject::invokeMethod(parent()
0059                               , "activeMainWindow"
0060                               , Qt::DirectConnection
0061                               , Q_RETURN_ARG(tikz::ui::MainWindow *, window));
0062     return window;
0063 }
0064 
0065 QVector<tikz::ui::Document *> Application::documents()
0066 {
0067     /**
0068      * dispatch to parent
0069      */
0070     QVector<tikz::ui::Document *> documents;
0071     QMetaObject::invokeMethod(parent()
0072                               , "documents"
0073                               , Qt::DirectConnection
0074                               , Q_RETURN_ARG(QVector<tikz::ui::Document *>, documents));
0075     return documents;
0076 }
0077 
0078 tikz::ui::Document *Application::findUrl(const QUrl &url)
0079 {
0080     /**
0081      * dispatch to parent
0082      */
0083     tikz::ui::Document *document = nullptr;
0084     QMetaObject::invokeMethod(parent()
0085                               , "findUrl"
0086                               , Qt::DirectConnection
0087                               , Q_RETURN_ARG(tikz::ui::Document *, document)
0088                               , Q_ARG(const QUrl &, url));
0089     return document;
0090 }
0091 
0092 tikz::ui::Document *Application::openUrl(const QUrl &url)
0093 {
0094     /**
0095      * dispatch to parent
0096      */
0097     tikz::ui::Document *document = nullptr;
0098     QMetaObject::invokeMethod(parent()
0099                               , "openUrl"
0100                               , Qt::DirectConnection
0101                               , Q_RETURN_ARG(tikz::ui::Document *, document)
0102                               , Q_ARG(const QUrl &, url));
0103     return document;
0104 }
0105 
0106 bool Application::closeDocument(tikz::ui::Document *document)
0107 {
0108     /**
0109      * dispatch to parent
0110      */
0111     bool success = false;
0112     QMetaObject::invokeMethod(parent()
0113                               , "closeDocument"
0114                               , Qt::DirectConnection
0115                               , Q_RETURN_ARG(bool, success)
0116                               , Q_ARG(tikz::ui::Document *, document));
0117     return success;
0118 }
0119 
0120 #if 0
0121 tikz::ui::Plugin *Application::plugin(const QString &name)
0122 {
0123     /**
0124      * dispatch to parent
0125      */
0126     Plugin *plugin = nullptr;
0127     QMetaObject::invokeMethod(parent()
0128                               , "plugin"
0129                               , Qt::DirectConnection
0130                               , Q_RETURN_ARG(tikz::ui::Plugin *, plugin)
0131                               , Q_ARG(const QString &, name));
0132     return plugin;
0133 }
0134 #endif
0135 
0136 }
0137 }
0138 
0139 // kate: indent-width 4; replace-tabs on;