File indexing completed on 2024-05-05 04:40:20

0001 /*
0002     SPDX-FileCopyrightText: 2011 Martin Heide <martin.heide@gmx.net>
0003     SPDX-FileCopyrightText: 2011 Julien Desgats <julien.desgats@gmail.com>
0004 
0005     SPDX-License-Identifier: LGPL-2.0-or-later
0006 */
0007 
0008 #ifndef QMAKEBUILDDIRCHOOSER_H
0009 #define QMAKEBUILDDIRCHOOSER_H
0010 
0011 #include "ui_qmakebuilddirchooser.h"
0012 
0013 #include <KConfigGroup>
0014 
0015 namespace KDevelop {
0016     class IProject;
0017 }
0018 
0019 /**
0020  * Handles QMake project configuration on both project creation/import and
0021  * regular project configuration.
0022  */
0023 class QMakeBuildDirChooser : public QWidget, public Ui::QMakeBuildDirChooser
0024 {
0025     Q_OBJECT
0026 
0027 public:
0028     explicit QMakeBuildDirChooser(KDevelop::IProject* project, QWidget *parent = nullptr);
0029     ~QMakeBuildDirChooser() override;
0030 
0031     KDevelop::IProject* project() const;
0032 
0033 public:
0034     /**
0035      * Validate user input. Returns true is data is valid.
0036      * If provided, message is filled with error message, if any.
0037      * Error message is displayed in dialog anyway.
0038      */
0039     bool validate(QString *message=nullptr);
0040 
0041     /**
0042      * Saves current data to this build dir's config group (not to current values).
0043      */
0044     void saveConfig();
0045 
0046     /**
0047      * Saves current data to the given config group.
0048      */
0049     void saveConfig(KConfigGroup& config);
0050 
0051     /**
0052      * Loads current config (or a new one) into fields.
0053      */
0054     void loadConfig();
0055 
0056     /**
0057      * Loads given config into fields.
0058      */
0059     void loadConfig(const QString &config);
0060 
0061     QString errorString() const;
0062 
0063     QString qmakeExecutable() const;
0064     QString buildDir() const;
0065     QString installPrefix() const;
0066     int buildType() const;
0067     QString extraArgs() const;
0068 
0069     void setQMakeExecutable(const QString& executable);
0070     void setBuildDir(const QString &buildDir);
0071     void setInstallPrefix(const QString &prefix);
0072     void setBuildType(int type);
0073     void setExtraArgs(const QString &args);
0074 
0075 Q_SIGNALS:
0076     /// Emitted whenever one of the fields of this dialog is changed
0077     void changed();
0078 
0079 private:
0080     void setErrorString(const QString& errorString);
0081 
0082     KDevelop::IProject* m_project;
0083 };
0084 
0085 #endif