File indexing completed on 2024-04-28 08:27:00

0001 /* This file is part of KDevelop
0002  *
0003  * Copyright (C) 2014-2015 Miquel Sabaté Solà <mikisabate@gmail.com>
0004  *
0005  * This program is free software: you can redistribute it and/or modify
0006  * it under the terms of the GNU General Public License as published by
0007  * the Free Software Foundation, either version 3 of the License, or
0008  * (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 License
0016  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
0017  */
0018 
0019 #ifndef RUBY_LAUNCHER_H
0020 #define RUBY_LAUNCHER_H
0021 
0022 #include <kactioncollection.h>
0023 
0024 namespace KDevelop {
0025     class IDocument;
0026     class ILaunchConfiguration;
0027 }
0028 
0029 namespace ruby {
0030 
0031 class LanguageSupport;
0032 
0033 /**
0034  * @class Launcher
0035  *
0036  * The class responsible for all the default launcher for this plugin. It's
0037  * only used by the LanguageSupport class, but I rather have this functionality
0038  * in this separate class than having a bloated LanguageSupport class.
0039  */
0040 class Launcher : public QObject
0041 {
0042 public:
0043     explicit Launcher(LanguageSupport *support);
0044 
0045     /**
0046      * Setup the Main Window actions.
0047      *
0048      * @param actions The main window actions to be modified.
0049      */
0050     void setupActions(KActionCollection &actions);
0051 
0052 private:
0053     /**
0054      * @internal Find or create a launch for a the given @p name.
0055      * @return the launch configuration for the given @p name.
0056      */
0057     KDevelop::ILaunchConfiguration * launchConfiguration(const QString &name);
0058 
0059 private slots:
0060     /// The slot that allows this plugin to run the current Ruby file.
0061     void runCurrentFile();
0062 
0063     /// The slot that allows this plugin to run the current test function.
0064     void runCurrentTest();
0065 
0066 private:
0067     LanguageSupport *m_support;
0068     KDevelop::ILaunchConfiguration *m_file;
0069     KDevelop::ILaunchConfiguration *m_function;
0070 };
0071 
0072 }
0073 
0074 #endif // RUBY_LAUNCHER_H
0075