File indexing completed on 2024-05-12 05:35:41

0001 /*
0002     SPDX-FileCopyrightText: 2010 Andriy Rysin <rysin@kde.org>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include <QDialog>
0010 #include <QListWidgetItem>
0011 
0012 #include "keyboard_config.h"
0013 
0014 #include <config-keyboard.h>
0015 
0016 struct Rules;
0017 class Flags;
0018 class Ui_AddLayoutDialog;
0019 
0020 enum LayoutDataRoles { LayoutNameRole = Qt::UserRole, VariantNameRole };
0021 
0022 class AddLayoutDialog : public QDialog
0023 {
0024     Q_OBJECT
0025 
0026 public:
0027     AddLayoutDialog(const Rules *rules, Flags *flags, const QString &model, const QStringList &options, bool showLabel, QWidget *parent = nullptr);
0028 
0029     LayoutUnit getSelectedLayoutUnit()
0030     {
0031         return selectedLayoutUnit;
0032     }
0033     void accept() override;
0034 
0035 public Q_SLOTS:
0036     void layoutChanged(QListWidgetItem *, QListWidgetItem *);
0037     void layoutSearched(const QString &);
0038     void preview();
0039 
0040 private:
0041     const Rules *rules;
0042     Flags *flags;
0043     const QString &model;
0044     const QStringList &options;
0045     Ui_AddLayoutDialog *layoutDialogUi;
0046     QString selectedLayout;
0047     LayoutUnit selectedLayoutUnit;
0048 };