File indexing completed on 2024-05-12 05:46:36
0001 /* This file is part of KDevelop 0002 * 0003 * Copyright (C) 2008 Cédric Pasteur <cedric.pasteur@free.fr> 0004 * Copyright (C) 2017 Friedrich W. H. Kossebau <kossebau@kde.org> 0005 * 0006 * This program is free software; you can redistribute it and/or 0007 * modify it under the terms of the GNU General Public License 0008 * as published by the Free Software Foundation; either version 2 0009 * of the License, or (at your option) any later version. 0010 * 0011 * This program is distributed in the hope that it will be useful, 0012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0014 * GNU General Public License for more details. 0015 * 0016 * You should have received a copy of the GNU General Public License 0017 * along with this program; see the file COPYING. If not, write to 0018 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 0019 * Boston, MA 02110-1301, USA. 0020 */ 0021 0022 #ifndef KDEVPLATFORM_SOURCEFORMATTERSELECTIONEDIT_H 0023 #define KDEVPLATFORM_SOURCEFORMATTERSELECTIONEDIT_H 0024 0025 #include <QWidget> 0026 0027 #include "shellexport.h" 0028 0029 class KConfigGroup; 0030 class QListWidgetItem; 0031 0032 namespace KDevelop 0033 { 0034 class SourceFormatterStyle; 0035 class ISourceFormatter; 0036 class SourceFormatterSelectionEditPrivate; 0037 0038 class KDEVPLATFORMSHELL_EXPORT SourceFormatterSelectionEdit : public QWidget 0039 { 0040 Q_OBJECT 0041 0042 public: 0043 explicit SourceFormatterSelectionEdit(QWidget* parent = nullptr); 0044 ~SourceFormatterSelectionEdit() override; 0045 0046 public: 0047 void loadSettings(const KConfigGroup& config); 0048 void saveSettings(KConfigGroup& config) const; 0049 0050 Q_SIGNALS: 0051 void changed(); 0052 0053 private Q_SLOTS: 0054 void addSourceFormatter(KDevelop::ISourceFormatter* ifmt); 0055 void removeSourceFormatter(KDevelop::ISourceFormatter* ifmt); 0056 0057 void deleteStyle(); 0058 void editStyle(); 0059 void newStyle(); 0060 void selectLanguage(int ); 0061 void selectFormatter(int ); 0062 void selectStyle(int ); 0063 void styleNameChanged(QListWidgetItem* ); 0064 0065 private: 0066 void resetUi(); 0067 void updatePreview(); 0068 QListWidgetItem* addStyle(const KDevelop::SourceFormatterStyle& s); 0069 void enableStyleButtons(); 0070 0071 private: 0072 const QScopedPointer<class SourceFormatterSelectionEditPrivate> d_ptr; 0073 Q_DECLARE_PRIVATE(SourceFormatterSelectionEdit) 0074 }; 0075 0076 } 0077 0078 #endif 0079