File indexing completed on 2024-04-28 08:25:25

0001 /*
0002  * This file is part of KDevelop project
0003  * Copyright 2016 Patrick José Pereira <patrickelectric@gmail.com>
0004  * Copyright 2010 Denis Martinez
0005  * Copyright 2010 Martin Peres
0006  *
0007  * This program is free software; you can redistribute it and/or modify
0008  * it under the terms of the GNU Library General Public License as
0009  * published by the Free Software Foundation; either version 2 of the
0010  * License, or (at your option) any later version.
0011  *
0012  * This program 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
0015  * GNU General Public License for more details.
0016  *
0017  * You should have received a copy of the GNU General Public
0018  * License along with this program; if not, write to the
0019  * Free Software Foundation, Inc.,
0020  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
0021  */
0022 
0023 #pragma once
0024 
0025 // file to manage tools
0026 
0027 #include <QStringList>
0028 #include <QLoggingCategory>
0029 
0030 #include "arduinoversion.h"
0031 
0032 Q_DECLARE_LOGGING_CATEGORY(TkMsg)
0033 
0034 class QFile;
0035 
0036 class Toolkit
0037 {
0038 private:
0039     Toolkit& operator = (Toolkit& other) = delete;
0040     Toolkit(const Toolkit& other) = delete;
0041     Toolkit();
0042     ~Toolkit();
0043 
0044     QString avrProgramPath();
0045     QString boardFilePath();
0046     QString getPath(QString path);
0047 
0048     QFile* m_arduinoFolder;
0049     QString m_arduinoPath;
0050 
0051     QStringList m_avrdudeMcuList;
0052 
0053 public:
0054     static Toolkit& instance();
0055 
0056     /**
0057      * @brief Check if path is a valid arduino folder
0058      *
0059      * @param Arduino path
0060      * @return bool True if valid and False if not
0061      */
0062     bool isValidArduinoPath(QString path);
0063 
0064     QString toolkitVersion(QString path);
0065     QString toolkitVersion();
0066 
0067     QString arduinoPath();
0068 
0069     QString boardFile(QString path);
0070     QString boardFile();
0071 
0072     QString avrdudeConfigPath();
0073     QString avrConfigFile();
0074 
0075     QString avrdudePath();
0076     QString getAvrdudeFile();
0077     QStringList avrdudeMcuList();
0078 
0079     QString getOpenocdFile();
0080 
0081     bool setArduinoPath(QString path);
0082 };