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

0001 /*
0002  * Copyright 2015 Laszlo Kis-Adam <laszlo.kis-adam@kdemail.net>
0003  *
0004  * This program is free software; you can redistribute it and/or modify
0005  * it under the terms of the GNU Library General Public License as
0006  * published by the Free Software Foundation; either version 2 of the
0007  * License, or (at your option) any later version.
0008  *
0009  * This program is distributed in the hope that it will be useful,
0010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0012  * GNU General Public License for more details.
0013  *
0014  * You should have received a copy of the GNU General Public
0015  * License along with this program; if not, write to the
0016  * Free Software Foundation, Inc.,
0017  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
0018  */
0019 
0020 #ifndef KRAZY2_PRJ_SETTINGS_H
0021 #define KRAZY2_PRJ_SETTINGS_H
0022 
0023 #include <kdevplatform/interfaces/configpage.h>
0024 #include <QList>
0025 
0026 namespace KDevelop
0027 {
0028 class IProject;
0029 }
0030 
0031 class KJob;
0032 class QTabWidget;
0033 class SelectPathsWidget;
0034 class SelectCheckersWidget;
0035 class Checker;
0036 
0037 // Per project settings page for Krazy2. Contains 2 tabs
0038 // - Path selection widget
0039 // - Checker selection widget
0040 // Saves the settings to the per project Krazy2 group.
0041 // Runs the checker initialization job when first switching to the checker selection widget
0042 class Krazy2ProjectSettings : public KDevelop::ConfigPage
0043 {
0044     Q_OBJECT
0045 
0046 public:
0047     Krazy2ProjectSettings(KDevelop::IProject *project, QList<const Checker*> *checkers, QWidget *parent = nullptr);
0048     ~Krazy2ProjectSettings() override;
0049 
0050     QString name() const override;
0051 
0052 public slots:
0053     void apply() override;
0054     void defaults() override;
0055     void reset() override;
0056 
0057 private slots:
0058     // Triggered when the current tab is changed
0059     void onTabChanged(int idx);
0060 
0061 private:
0062     QTabWidget *m_tabs;
0063     KDevelop::IProject *m_project;
0064 
0065     SelectPathsWidget *m_pathsWidget;
0066     SelectCheckersWidget *m_checkersWidget;
0067 
0068     QList<const Checker*> *m_checkers;
0069 };
0070 
0071 #endif
0072