File indexing completed on 2024-05-19 04:50:29

0001 /****************************************************************************************
0002  * Copyright (c) 2013 Konrad Zemek <konrad.zemek@gmail.com>                             *
0003  *                                                                                      *
0004  * This program is free software; you can redistribute it and/or modify it under        *
0005  * the terms of the GNU General Public License as published by the Free Software        *
0006  * Foundation; either version 2 of the License, or (at your option) any later           *
0007  * version.                                                                             *
0008  *                                                                                      *
0009  * This program is distributed in the hope that it will be useful, but WITHOUT ANY      *
0010  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A      *
0011  * PARTICULAR PURPOSE. See the GNU General Public License for more details.             *
0012  *                                                                                      *
0013  * You should have received a copy of the GNU General Public License along with         *
0014  * this program.  If not, see <http://www.gnu.org/licenses/>.                           *
0015  ****************************************************************************************/
0016 
0017 #ifndef STATSYNCING_CREATE_PROVIDER_DIALOG_H
0018 #define STATSYNCING_CREATE_PROVIDER_DIALOG_H
0019 
0020 #include <KAssistantDialog>
0021 
0022 #include <QButtonGroup>
0023 #include <QMap>
0024 #include <QSharedPointer>
0025 #include <QString>
0026 
0027 #include <QIcon>
0028 
0029 class QVBoxLayout;
0030 
0031 namespace StatSyncing
0032 {
0033 
0034     class ProviderConfigWidget;
0035 
0036     class CreateProviderDialog : public KAssistantDialog
0037     {
0038         Q_OBJECT
0039 
0040     public:
0041         explicit CreateProviderDialog( QWidget *parent = nullptr, Qt::WindowFlags f = {} );
0042         ~CreateProviderDialog() override;
0043 
0044     public Q_SLOTS:
0045         void addProviderType( const QString &id, const QString &prettyName, const QIcon &icon,
0046                               ProviderConfigWidget *configWidget );
0047 
0048     Q_SIGNALS:
0049         void providerConfigured( const QString &id, const QVariantMap &config );
0050 
0051     private:
0052         int buttonInsertPosition( const QString &prettyName );
0053 
0054         QButtonGroup m_providerButtons;
0055         QMap<QObject*, QString> m_idForButton;
0056         QMap<QObject*, KPageWidgetItem*> m_configForButton;
0057         KPageWidgetItem *m_providerTypePage;
0058         QVBoxLayout *m_layout;
0059 
0060     private Q_SLOTS:
0061         void providerButtonToggled( bool checked );
0062         void slotAccepted();
0063     };
0064 
0065 } // namespace StatSyncing
0066 
0067 #endif // STATSYNCING_CREATE_PROVIDER_DIALOG_H