File indexing completed on 2024-04-28 04:03:11
0001 /*************************************************************************** 0002 File : enginesettings.h 0003 Project : Knights 0004 Description : Engine Settings 0005 -------------------------------------------------------------------- 0006 SPDX-FileCopyrightText: 2018 Alexander Semke (alexander.semke@web.de) 0007 SPDX-FileCopyrightText: 2009-2011 Miha Čančula (miha@noughmad.eu) 0008 0009 ***************************************************************************/ 0010 0011 /*************************************************************************** 0012 * * 0013 * SPDX-License-Identifier: GPL-2.0-or-later 0014 * * 0015 * This program is distributed in the hope that it will be useful, * 0016 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 0017 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 0018 * GNU General Public License for more details. * 0019 * * 0020 * You should have received a copy of the GNU General Public License * 0021 * along with this program; if not, write to the Free Software * 0022 * Foundation, Inc., 51 Franklin Street, Fifth Floor, * 0023 * Boston, MA 02110-1301 USA * 0024 * * 0025 ***************************************************************************/ 0026 0027 #ifndef KNIGHTS_ENGINESETTINGS_H 0028 #define KNIGHTS_ENGINESETTINGS_H 0029 0030 #include <QWidget> 0031 0032 class QTableWidgetItem; 0033 0034 namespace Ui { 0035 class EngineSettings; 0036 } 0037 0038 namespace Knights { 0039 0040 class EngineConfiguration { 0041 public: 0042 enum Interface { 0043 XBoard = 0, 0044 Uci = 1, 0045 Invalid = 0x10 0046 }; 0047 0048 explicit EngineConfiguration(const QString&); 0049 0050 const QString toString() const; 0051 0052 QString name; 0053 QString commandLine; 0054 Interface iface; 0055 }; 0056 0057 class EngineSettings : public QWidget { 0058 Q_OBJECT 0059 0060 enum Column { 0061 NameColumn = 0, 0062 CommandColumn = 1, 0063 ProtocolColumn = 2, 0064 InstalledColumn = 3, 0065 ColumnCount = 4 0066 }; 0067 0068 public: 0069 explicit EngineSettings(QWidget* parent = nullptr, Qt::WindowFlags f = {}); 0070 ~EngineSettings() override; 0071 0072 private: 0073 Ui::EngineSettings* ui; 0074 QList<EngineConfiguration> configurations; 0075 0076 public Q_SLOTS: 0077 void save(); 0078 0079 private Q_SLOTS: 0080 void autoDetectEngines(); 0081 void addClicked(); 0082 void removeClicked(); 0083 void checkInstalled(int row, const QString& name); 0084 void tableItemChanged(QTableWidgetItem*); 0085 }; 0086 0087 } 0088 0089 #endif // KNIGHTS_ENGINESETTINGS_H