File indexing completed on 2024-04-21 04:34:28

0001 /*
0002  * This file is part of KDevelop project
0003  * Copyright 2016 Patrick José Pereira <patrickelectric@gmail.com>
0004  *
0005  * This program is free software; you can redistribute it and/or modify
0006  * it under the terms of the GNU Library General Public License as
0007  * published by the Free Software Foundation; either version 2 of the
0008  * License, or (at your option) any later version.
0009  *
0010  * This program is distributed in the hope that it will be useful,
0011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0013  * GNU General Public License for more details.
0014  *
0015  * You should have received a copy of the GNU General Public
0016  * License along with this program; if not, write to the
0017  * Free Software Foundation, Inc.,
0018  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
0019  */
0020 
0021 #include "embedded.h"
0022 
0023 #include <QAction>
0024 #include <QVariantList>
0025 #include <QLoggingCategory>
0026 
0027 #include <KLocalizedString>
0028 #include <KPluginFactory>
0029 #include <KPluginLoader>
0030 #include <KAboutData>
0031 #include <KActionCollection>
0032 #include <KConfigGroup>
0033 
0034 #include <KTextEditor/Document>
0035 #include <KTextEditor/View>
0036 #include <QApplication>
0037 #include <QStandardPaths>
0038 #include <QMessageBox>
0039 #include <KParts/MainWindow>
0040 
0041 #include <interfaces/icore.h>
0042 #include <interfaces/isession.h>
0043 #include <interfaces/iuicontroller.h>
0044 
0045 #include "firsttimewizard.h"
0046 
0047 Q_LOGGING_CATEGORY(PLUGIN_EMBEDDED, "kdevplatform.plugins.embedded")
0048 
0049 using namespace KDevelop;
0050 using namespace KTextEditor;
0051 
0052 K_PLUGIN_FACTORY_WITH_JSON(EmbeddedFactory, "kdevembedded.json", registerPlugin<Embedded>();)
0053 
0054 Embedded::Embedded(QObject* parent, const QVariantList&)
0055     : IPlugin(QStringLiteral("kdevembedded"), parent)
0056 {
0057     setXMLFile(QStringLiteral("kdevembedded.rc"));
0058 
0059     QAction* actionProject = actionCollection()->addAction(QStringLiteral("action_project"));
0060     actionProject->setText(i18n("Arduino Setup"));
0061     actionProject->setToolTip(i18n("Configure Arduino Toolkit."));
0062     actionProject->setWhatsThis(i18n("Toolkit manager for Arduino programs."));
0063     actionProject->setIcon(QIcon::fromTheme(QStringLiteral("project-development-new-template")));
0064     connect(actionProject, &QAction::triggered, this, &Embedded::firstTimeWizardEvent);
0065 }
0066 
0067 void Embedded::firstTimeWizardEvent()
0068 {
0069     FirstTimeWizard *embeddedWindow = new FirstTimeWizard(ICore::self()->uiController()->activeMainWindow());
0070     embeddedWindow->setAttribute(Qt::WA_DeleteOnClose);
0071     embeddedWindow->show();
0072 }
0073 
0074 Embedded::~Embedded()
0075 {
0076 }
0077 
0078 #include "embedded.moc"